import{i as o,p as n,u as f}from"./useEvent-D91BmmQi.js";import{t as k}from"./compiler-runtime-B3qBwwSJ.js";import{t as g,x as y}from"./utils-BWBBpCkT.js";import{r as p}from"./constants-CDyU_g2F.js";var w=k();const i=["light","dark","system"];function b(){if(typeof window>"u")return;let t=new URLSearchParams(window.location.search).get(p.theme);return i.includes(t)?t:void 0}var v=n(t=>{if(g()){if(document.body.classList.contains("dark-mode")||document.body.classList.contains("dark")||document.body.dataset.theme==="dark"||document.body.dataset.mode==="dark"||s()==="dark")return"dark";let e=window.getComputedStyle(document.body),r=e.getPropertyValue("color-scheme").trim();if(r)return r.includes("dark")?"dark":"light";let a=e.getPropertyValue("background-color").match(/\d+/g);if(a){let[u,l,h]=a.map(Number);return(u*299+l*587+h*114)/1e3<128?"dark":"light"}return"light"}return b()??t(y).display.theme}),d=n(!1);function L(){if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia("(prefers-color-scheme: dark)");o.set(d,t.matches),t.addEventListener("change",e=>{o.set(d,e.matches)})}L();function s(){switch(document.body.dataset.vscodeThemeKind){case"vscode-dark":return"dark";case"vscode-high-contrast":return"dark";case"vscode-light":return"light"}}var c=n(s());function M(){let t=new MutationObserver(()=>{let e=s();o.set(c,e)});return t.observe(document.body,{attributes:!0,attributeFilter:["data-vscode-theme-kind"]}),()=>t.disconnect()}M();const m=n(t=>{let e=t(v),r=t(c);if(r!==void 0)return r;let a=t(d);return e==="system"?a?"dark":"light":e});function P(){let t=(0,w.c)(3),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={store:o},t[0]=e):e=t[0];let r=f(m,e),a;return t[1]===r?a=t[2]:(a={theme:r},t[1]=r,t[2]=a),a}export{m as n,P as r,i as t};
