1import{w,bi as b,r as s,u as C,j as P}from"./index-B-XoyWcT.js";const x=["system","light","dark"],A="omanote:theme-mode",L=b(x);function h(t,e){return t==="dark"?"dark":t==="light"?"light":e?"dark":"light"}function y(t,e=document.documentElement){e.classList.toggle("dark",t==="dark"),e.style.colorScheme=t}function p(t){w(A,L,t)}const g='"Lato", ui-sans-serif, system-ui, sans-serif',c='"Solway", Georgia, ui-serif, serif';function D(t,e=document.documentElement){const o=t==="serif"?c:g,n=t==="sans"?g:c;e.style.setProperty("--app-font-family",o),e.style.setProperty("--app-font-family-serif",c),e.style.setProperty("--app-heading-font-family",n),e.setAttribute("data-heading-font",n===c?"serif":"sans"),e.setAttribute("data-body-font",o===c?"serif":"sans")}function S(t,e=document.documentElement){t==="sharp"?e.setAttribute("data-corner-style","sharp"):e.removeAttribute("data-corner-style")}const M=s.createContext(null);function j({children:t}){const{settings:e,updateSettings:o,loading:n}=C(),[T,k]=s.useState(()=>E()),[u,f]=s.useState(null),a=u??e.themeMode,d=h(a,T);s.useEffect(()=>{u!==null&&e.themeMode===u&&f(null)},[u,e.themeMode]),s.useEffect(()=>{var m;const r=(m=window.matchMedia)==null?void 0:m.call(window,"(prefers-color-scheme: dark)");if(!r)return;const i=()=>k(r.matches);return i(),r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[]),s.useEffect(()=>{n||(p(a),y(d))},[n,d,a]),s.useEffect(()=>{n||D(e.fontFamily)},[n,e.fontFamily]),s.useEffect(()=>{if(!n)return S(e.cornerStyle),()=>S("rounded")},[n,e.cornerStyle]);const l=s.useCallback(async r=>{f(r),p(r),y(h(r,E()));try{await o({themeMode:r})}catch(i){throw f(null),i}},[o]),v=s.useMemo(()=>({themeMode:a,resolvedTheme:d,setThemeMode:l}),[d,l,a]);return P.jsx(M.Provider,{value:v,children:t})}function K(){const t=s.useContext(M);if(!t)throw new Error("useTheme must be used inside ThemeProvider");return t}function E(){var t;return!!((t=window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: dark)").matches)}export{j as T,D as a,S as b,K as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.