import{o as e}from"./chunk-QXcFz7f5.js";import{c as t,t as n}from"./app-G6wC4CCm.js";import{t as r}from"./createLucideIcon-DKE3u1f2.js";var i=r(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),a=r(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),o=e(t(),1),s=n(),c=`appshot:theme`,l=new Set;function u(){return typeof document>`u`?`light`:document.documentElement.getAttribute(`data-theme`)===`dark`?`dark`:`light`}function d(e){document.documentElement.setAttribute(`data-theme`,e);try{window.localStorage.setItem(c,e)}catch{}}function f(){if(typeof window>`u`)return`light`;try{let e=window.localStorage.getItem(c);if(e===`light`||e===`dark`)return e}catch{}let e=window.__themeModePref;return e===`light`||e===`dark`?e:window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function p(e){document.documentElement.setAttribute(`data-theme`,e);for(let t of l)t(e)}function m(e){document.documentElement.setAttribute(`data-chrome`,e)}function h(){(0,o.useLayoutEffect)(()=>{if(m(`marketing`),typeof window<`u`){let e=new URLSearchParams(window.location.search).get(`theme_mode`);if(e===`light`||e===`dark`||e===`system`)return}p(`light`)},[])}function g(){(0,o.useLayoutEffect)(()=>{m(`app`),p(f())},[])}function _(){let[e,t]=(0,o.useState)(u);return(0,o.useEffect)(()=>{let e=e=>t(e);return l.add(e),()=>{l.delete(e)}},[]),[e,e=>{d(e);for(let t of l)t(e)}]}function v(){let[e]=_(),[t,n]=(0,o.useState)(y);return(0,o.useEffect)(()=>{n(y());let e=new MutationObserver(()=>n(y()));return e.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`style`]}),()=>e.disconnect()},[e]),t}function y(){return typeof document>`u`?`#0052ff`:getComputedStyle(document.documentElement).getPropertyValue(`--color-accent`).trim()||`#0052ff`}function b({className:e}){let[t,n]=_(),r=t===`dark`;return(0,s.jsx)(`button`,{type:`button`,onClick:()=>n(r?`light`:`dark`),"aria-label":r?`Switch to light theme`:`Switch to dark theme`,title:r?`Light theme`:`Dark theme`,"data-testid":`theme-toggle`,className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground `+(e??``),children:r?(0,s.jsx)(a,{className:`h-4 w-4`}):(0,s.jsx)(i,{className:`h-4 w-4`})})}export{g as a,_ as i,v as n,a as o,h as r,i as s,b as t};