"use strict";const w=require("react/jsx-runtime"),I=require("@chakra-ui/react/styled-system"),q=require("./nimbus-i18n-provider-BPK9twpQ.cjs.js"),_=require("./index-Dzrt5_tw.cjs.js"),z=require("react"),R=require("./openLink-CkDzR4gQ.cjs.js");function D(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,l.get?l:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const r=D(z);var H=(e,n,t,l,u,c,d,h)=>{let m=document.documentElement,p=["light","dark"];function f(s){(Array.isArray(e)?e:[e]).forEach(b=>{let C=b==="class",x=C&&c?u.map(v=>c[v]||v):u;C?(m.classList.remove(...x),m.classList.add(c&&c[s]?c[s]:s)):m.setAttribute(b,s)}),E(s)}function E(s){h&&p.includes(s)&&(m.style.colorScheme=s)}function i(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(l)f(l);else try{let s=localStorage.getItem(n)||t,b=d&&s==="system"?i():s;f(b)}catch{}},A=["light","dark"],$="(prefers-color-scheme: dark)",K=typeof window>"u",j=r.createContext(void 0),V={setTheme:e=>{},themes:[]},W=()=>{var e;return(e=r.useContext(j))!=null?e:V},J=e=>r.useContext(j)?r.createElement(r.Fragment,null,e.children):r.createElement(Q,{...e}),F=["light","dark"],Q=({forcedTheme:e,disableTransitionOnChange:n=!1,enableSystem:t=!0,enableColorScheme:l=!0,storageKey:u="theme",themes:c=F,defaultTheme:d=t?"system":"light",attribute:h="data-theme",value:m,children:p,nonce:f,scriptProps:E})=>{let[i,s]=r.useState(()=>B(u,d)),[b,C]=r.useState(()=>i==="system"?P():i),x=m?Object.values(m):c,v=r.useCallback(o=>{let a=o;if(!a)return;o==="system"&&t&&(a=P());let g=m?m[a]:a,L=n?G(f):null,S=document.documentElement,O=y=>{y==="class"?(S.classList.remove(...x),g&&S.classList.add(g)):y.startsWith("data-")&&(g?S.setAttribute(y,g):S.removeAttribute(y))};if(Array.isArray(h)?h.forEach(O):O(h),l){let y=A.includes(d)?d:null,N=A.includes(a)?a:y;S.style.colorScheme=N}L?.()},[f]),T=r.useCallback(o=>{let a=typeof o=="function"?o(i):o;s(a);try{localStorage.setItem(u,a)}catch{}},[i]),k=r.useCallback(o=>{let a=P(o);C(a),i==="system"&&t&&!e&&v("system")},[i,e]);r.useEffect(()=>{let o=window.matchMedia($);return o.addListener(k),k(o),()=>o.removeListener(k)},[k]),r.useEffect(()=>{let o=a=>{a.key===u&&(a.newValue?s(a.newValue):T(d))};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[T]),r.useEffect(()=>{v(e??i)},[e,i]);let M=r.useMemo(()=>({theme:i,setTheme:T,forcedTheme:e,resolvedTheme:i==="system"?b:i,themes:t?[...c,"system"]:c,systemTheme:t?b:void 0}),[i,T,e,b,t,c]);return r.createElement(j.Provider,{value:M},r.createElement(U,{forcedTheme:e,storageKey:u,attribute:h,enableSystem:t,enableColorScheme:l,defaultTheme:d,value:m,themes:c,nonce:f,scriptProps:E}),p)},U=r.memo(({forcedTheme:e,storageKey:n,attribute:t,enableSystem:l,enableColorScheme:u,defaultTheme:c,value:d,themes:h,nonce:m,scriptProps:p})=>{let f=JSON.stringify([t,n,c,e,h,d,l,u]).slice(1,-1);return r.createElement("script",{...p,suppressHydrationWarning:!0,nonce:typeof window>"u"?m:"",dangerouslySetInnerHTML:{__html:`(${H.toString()})(${f})`}})}),B=(e,n)=>{if(K)return;let t;try{t=localStorage.getItem(e)||void 0}catch{}return t||n},G=e=>{let n=document.createElement("style");return e&&n.setAttribute("nonce",e),n.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(n),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(n)},1)}},P=e=>(e||(e=window.matchMedia($)),e.matches?"dark":"light");const X=e=>w.jsx(J,{attribute:"class",disableTransitionOnChange:!0,...e});function Y({children:e,locale:n,router:t,...l}){const u=w.jsx(I.ChakraProvider,{value:_.system,children:w.jsx(X,{enableSystem:!1,...l,children:w.jsx(q.NimbusI18nProvider,{locale:n,children:e})})});return t?w.jsx(R.$ea8dcbcb9ea1b556$export$323e4fc2fa4753fb,{...t,children:u}):u}exports.NimbusProvider=Y;exports.z=W;
//# sourceMappingURL=nimbus-provider-lSSS3DBl.cjs.js.map
