(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,18834,e=>{"use strict";var t=e.i(71645),a=e.i(43668),s=e.i(87543),r=e.i(85149);function i(e){try{localStorage.setItem(r.THEME_STORAGE_KEY,e)}catch(e){}}function n(){let e=(0,s.useAppConfigStore)(s.selectSetAppConfig);return(0,t.useEffect)(()=>{if(window.__APP_CONFIG__){let t=window.__APP_CONFIG__.theme??"light";e({appName:window.__APP_CONFIG__.appName,theme:t}),i(t);return}let t=(0,a.getApiBaseUrl)();fetch(t?`${t.replace(/\/$/,"")}/api/v1/settings/app-config`:"/api/v1/settings/app-config").then(e=>e.ok?e.json():null).then(t=>{if(!t)return;let a=t.theme??"light",s=t.app_name??window.__APP_CONFIG__?.appName;e({appName:s,theme:a}),i(a),window.__APP_CONFIG__={...window.__APP_CONFIG__,theme:a,...null!=s&&{appName:s}}}).catch(()=>{})},[e]),null}e.s(["default",()=>n])},52488,e=>{"use strict";var t=e.i(71645),a=e.i(87543),s=e.i(85149);function r(){let e=(0,a.useAppConfigStore)(a.selectTheme),[r,i]=(0,t.useState)(()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return(0,t.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>i(t.matches?"dark":"light");return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e]),(0,t.useMemo)(()=>{let t="system"!==e?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",a="system"===e?r:t;return{className:"dark"===a?"dark":"","data-theme":s.NAMED_THEME_IDS.includes(a)?a:void 0}},[e,r])}function i(){let e=r();return(0,t.useLayoutEffect)(()=>{let t=document.documentElement;t.classList.toggle("dark","dark"===e.className),e["data-theme"]?t.setAttribute("data-theme",e["data-theme"]):t.removeAttribute("data-theme")},[e.className,e["data-theme"]]),null}e.s(["default",()=>i,"useResolvedThemeAttrs",()=>r])}]);