UNPKG

@dark-engine/core

Version:

The lightweight and powerful UI rendering engine without dependencies and written in TypeScript (Browser, Node.js, Android, iOS, Windows, Linux, macOS)

2 lines 36.6 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("DarkCore",[],e):"object"==typeof exports?exports.DarkCore=e():t.DarkCore=e()}(self,(()=>(()=>{"use strict";var t={d:(e,s)=>{for(var n in s)t.o(s,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:s[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{$$inject:()=>C,$$scope:()=>ye,ATOM_HOST_MASK:()=>p,ATTR_BLACK_LIST:()=>A,CREATE_EFFECT_TAG:()=>l,Comment:()=>vt,CommentVirtualNode:()=>It,Component:()=>x,DELETE_EFFECT_TAG:()=>h,EFFECT_HOST_MASK:()=>f,ErrorBoundary:()=>Vs,EventEmitter:()=>ue,FLAGS:()=>M,FLUSH_MASK:()=>m,Fiber:()=>Kt,Flag:()=>O,Fragment:()=>Fe,Guard:()=>Us,HOOK_DELIMETER:()=>S,Hook:()=>Vt,INDEX_KEY:()=>r,IS_BOUNDARY_HOOK_MASK:()=>E,IS_PENDING_HOOK_MASK:()=>v,IS_PORTAL_HOOK_MASK:()=>I,IS_SUSPENSE_HOOK_MASK:()=>y,IS_WIP_HOOK_MASK:()=>k,KEY_ATTR:()=>c,LIB:()=>n,MOVE_MASK:()=>g,NodeType:()=>Wt,REF_ATTR:()=>a,REJECTED_STATUS:()=>b,REPLACER:()=>o,ROOT:()=>i,ReadableAtom:()=>Ts,SKIP_EFFECT_TAG:()=>d,STATE_SCRIPT_TYPE:()=>_,Suspense:()=>Hs,TagVirtualNode:()=>gt,TaskPriority:()=>w,Text:()=>Et,TextVirtualNode:()=>kt,UPDATE_EFFECT_TAG:()=>u,VERSION:()=>s,View:()=>yt,VirtualNode:()=>mt,WritableAtom:()=>Ss,YIELD_INTERVAL:()=>T,__useCursor:()=>Oe,__useInBoundary:()=>Ce,__useInSuspense:()=>Ae,__useLoc:()=>xe,__useSSR:()=>Me,applyRef:()=>Ps,atom:()=>Os,batch:()=>qe,collectElements:()=>qt,component:()=>L,computed:()=>Ms,createContext:()=>ms,createError:()=>ht,createHookLoc:()=>ee,createIndexKey:()=>lt,createLoc:()=>se,createReplacer:()=>Lt,createUpdate:()=>hs,detectAreDepsDifferent:()=>ct,detectAreSameComponentTypesWithSameKeys:()=>Ht,detectAreSameInstanceTypes:()=>Bt,detectIsArray:()=>j,detectIsAtom:()=>_s,detectIsBoolean:()=>F,detectIsBusy:()=>fs,detectIsCommentVirtualNode:()=>_t,detectIsComponent:()=>N,detectIsEmpty:()=>G,detectIsEqual:()=>q,detectIsFalsy:()=>Y,detectIsFiberAlive:()=>Xt,detectIsFunction:()=>U,detectIsHydration:()=>Te,detectIsMutableRef:()=>Ns,detectIsNull:()=>$,detectIsNumber:()=>H,detectIsObject:()=>V,detectIsPlainVirtualNode:()=>xt,detectIsPromise:()=>z,detectIsReadableAtom:()=>ws,detectIsReplacer:()=>Rt,detectIsSSR:()=>_e,detectIsServer:()=>Se,detectIsString:()=>W,detectIsTagVirtualNode:()=>Tt,detectIsTextBased:()=>K,detectIsTextVirtualNode:()=>bt,detectIsUndefined:()=>B,detectIsVirtualNode:()=>St,detectIsVirtualNodeFactory:()=>wt,detectIsWritableAtom:()=>bs,dummyFn:()=>Z,falseFn:()=>et,flatten:()=>rt,formatErrorMsg:()=>nt,getComponentKey:()=>P,getElementKey:()=>Nt,getElementType:()=>Dt,getFiberWithElement:()=>Qt,getHook:()=>Ft,getRootId:()=>me,getTime:()=>J,hasChildrenProp:()=>Ut,hasComponentFlag:()=>D,hasElementFlag:()=>Pt,hasKeys:()=>X,hot:()=>Zs,illegal:()=>ot,keys:()=>Q,lazy:()=>Rs,logError:()=>st,mapRecord:()=>ut,memo:()=>Gt,nextTick:()=>at,notifyParents:()=>ae,platform:()=>ve,removeScope:()=>ke,replaceScope:()=>Ie,resolveBoundary:()=>te,resolveSuspense:()=>Zt,scheduler:()=>Ke,setRootId:()=>ge,startTransition:()=>Fs,stringify:()=>dt,throwThis:()=>it,trueFn:()=>tt,tryOptMemoSlot:()=>ie,tryOptStaticSlot:()=>ne,unmountRoot:()=>ze,useAtom:()=>As,useCallback:()=>Is,useComputed:()=>Cs,useContext:()=>gs,useDeferredValue:()=>$s,useEffect:()=>Pe,useError:()=>Ks,useEvent:()=>Ws,useId:()=>qs,useImperativeHandle:()=>Ys,useInsertionEffect:()=>Gs,useLayoutEffect:()=>De,useMemo:()=>we,useReducer:()=>zs,useRef:()=>Ds,useState:()=>Es,useStore:()=>xs,useSyncExternalStore:()=>Js,useTransition:()=>js,useUpdate:()=>ps,walk:()=>zt,workLoop:()=>Qe});const s="1.5.1",n="@dark-engine/core",i="dark:root",o="dark:matter",r="dark:idx",c="key",a="ref",l="C",u="U",h="D",d="S",f=1,p=2,m=4,g=8,k=1,I=2,y=4,E=8,v=16,S=":",T=6,_="text/dark-state",b="rejected";var w,O;!function(t){t[t.LOW=0]="LOW",t[t.NORMAL=1]="NORMAL",t[t.HIGH=2]="HIGH"}(w||(w={})),function(t){t.SKIP_SCAN_OPT="__skipScanOpt",t.MEMO_SLOT_OPT="__memoSlotOpt",t.STATIC_SLOT_OPT="__staticSlotOpt"}(O||(O={}));const M={__skipScanOpt:!0,__memoSlotOpt:!0,__staticSlotOpt:!0},A={[c]:!0,[a]:!0,[O.SKIP_SCAN_OPT]:!0,[O.MEMO_SLOT_OPT]:!0,[O.STATIC_SLOT_OPT]:!0},C=Symbol("inject");class x{type=null;props=null;token=null;displayName=null;shouldUpdate=null;children=null;constructor(t,e,s,n,i){this.type=t,this.props=s,e&&(this.token=e),n&&(this.shouldUpdate=n),i&&(this.displayName=i)}}function L(t,e={}){const{token:s,displayName:n}=e,i=(e={})=>{const{token:o=s,shouldUpdate:r}=i[C]||R;return new x(t,o,e,r,n)};return i.displayName=n,i}const R={},N=t=>t instanceof x,P=t=>t.props[c]??null,D=(t,e)=>Boolean(t.props[e]),U=t=>"function"==typeof t,B=t=>void 0===t,H=t=>"number"==typeof t,W=t=>"string"==typeof t,K=t=>"string"==typeof t||"number"==typeof t,V=t=>"object"==typeof t,F=t=>"boolean"==typeof t,j=Array.isArray,$=t=>null===t,G=t=>null==t,Y=t=>null==t||!1===t,z=t=>t instanceof Promise,q=Object.is,Q=Object.keys,X=t=>Q(t).length>0,J=()=>Date.now(),Z=()=>{},tt=()=>!0,et=()=>!1,st=(...t)=>!B(console)&&console.error(...t),nt=(t,e=n)=>`[${e}]: ${t}`;function it(t){throw t}const ot=(t,e=n)=>it(new Error(nt(t,e))),rt=t=>t.flat(1/0);function ct(t,e){if(t===e||0===t.length&&0===e.length)return!1;const s=Math.max(t.length,e.length);for(let n=0;n<s;n++)if(!q(t[n],e[n]))return!0;return!1}const at=t=>Promise.resolve().then(t),lt=t=>`${r}:${t}`,ut=t=>Q(t).map((e=>t[e])),ht=t=>t instanceof Error?t:new Error(String(t)),dt=JSON.stringify,ft=Symbol("vNode"),pt="type";class mt{type=null;constructor(t){this.type=t}}class gt extends mt{name;attrs;children;constructor(t,e,s){super(Wt.TAG),this.name=t,this.attrs=e,this.children=s}}class kt extends mt{value;constructor(t){super(Wt.TEXT),this.value=String(t)}}class It extends mt{value="";constructor(t){super(Wt.COMMENT),this.value=t}}function yt(t){const e=()=>{const{as:e,slot:s,_void:n=!1,...i}=t,o=n?[]:j(s)?s:G(s)?[]:[s];return new gt(e,i,o)};return e[ft]=!0,e[pt]=t.as,e[c]=t.key,e}const Et=t=>new kt(t);Et.from=t=>bt(t)?t.value:String(t);const vt=t=>new It(t),St=t=>t instanceof mt,Tt=t=>t instanceof gt,_t=t=>t instanceof It,bt=t=>t instanceof kt,wt=t=>U(t)&&!0===t[ft],Ot=t=>t.attrs?t.attrs[c]??null:null,Mt=(t,e)=>Boolean(t.attrs[e]),At=t=>t[c]??null,Ct=(t,e)=>Boolean(t[e]),xt=t=>bt(t)||_t(t),Lt=()=>new It(o),Rt=t=>_t(t)&&t.value===o;function Nt(t){return N(t)?P(t):wt(t)?At(t):Tt(t)?Ot(t):null}function Pt(t,e){return N(t)?D(t,e):wt(t)?Ct(t,e):!!Tt(t)&&Mt(t,e)}function Dt(t){return N(t)?t.type:wt(t)?t[pt]:Tt(t)?t.name:St(t)?t.type:null}function Ut(t){return Tt(t)||N(t)}function Bt(t,e,s=!1){return s?t.type===e.type:Dt(t)===Dt(e)}function Ht(t,e){return N(t)&&N(e)&&Bt(t,e,!0)&&Nt(t)===Nt(e)}var Wt;!function(t){t.TAG="TAG",t.TEXT="TEXT",t.COMMENT="COMMENT"}(Wt||(Wt={}));class Kt{id=0;cc=0;cec=0;idx=0;eidx=0;mask=0;el=null;tag=null;parent=null;child=null;next=null;alt=null;inst=null;hook=null;constructor(t=0,e=null){this.id=Kt.incrementId(),this.idx=t,this.hook=e}mutate(t){for(const e in t)this[e]=t[e];return this}markHost(t){this.mask|=t,this.parent&&!(this.parent.mask&t)&&this.parent.markHost(t)}increment(t=1){this.parent&&(this.parent.cec+=t,this.parent.el||this.parent.hook?.getIsWip()||this.parent.increment(t))}setError(t){if(this.hook?.hasCatch())this.hook.catch(t),st(t);else{if(!this.parent)throw t;this.parent.setError(t)}}static incrementId(){return++Kt.nextId}static setNextId(t){Kt.nextId=t}static nextId=0}class Vt{idx=0;values=[];owner=null;mask=0;providers=null;atoms=null;batch=null;catch=null;pendings=0;update=null;__getMask(t){return Boolean(this.mask&t)}__mark(t,e){e?this.mask|=t:this.mask&=~t}getIsWip(){return this.__getMask(k)}setIsWip(t){this.__mark(k,t)}getIsPortal(){return this.__getMask(I)}setIsPortal(t){this.__mark(I,t)}getIsSuspense(){return this.__getMask(y)}setIsSuspense(t){this.__mark(y,t)}getIsBoundary(){return this.__getMask(E)}setIsBoundary(t){this.__mark(E,t)}getIsPending(){return this.__getMask(v)}setIsPeinding(t){this.__mark(v,t)}getProviders(){return this.providers}setProviders(t){this.providers=t}setAtom(t,e){!this.atoms&&(this.atoms=new Map),this.atoms.set(t,e)}removeAtom(t){this.atoms.delete(t)}getBatch(){return this.batch}setBatch(t){this.batch=t}hasCatch(){return U(this.catch)}setCatch(t){this.catch=t}setUpdate(t){this.update=t}incrementPendings(){this.pendings++}getPendings(){return this.pendings}drop(){const{atoms:t,values:e,owner:s}=this;if(e.length>0&&s.mask&f&&function(t){for(const{value:e}of t.values)e?.token===Le&&U(e.cleanup)&&e.cleanup()}(this),t){for(const[e,s]of t)s();this.atoms=null}}}function Ft(t,e,s){return t&&Ht(e,s)?t.hook:N(s)?new Vt:null}const jt=Symbol("memo"),$t=(t,e)=>{for(const s in e)if("slot"!==s&&e[s]!==t[s])return!0;return!1};function Gt(t,e=$t){return t[C]={token:jt,shouldUpdate:e},t}const Yt=t=>N(t)&&t.token===jt;function zt(t,e){let s=!0,n=!1;const i=()=>s=!1,o=()=>n=!0,r=[t];for(;0!==r.length;){const c=r.pop();if(e(c,i,o),n)break;c!==t&&c.next&&r.push(c.next),s&&c.child&&r.push(c.child),s=!0}}function qt(t,e){const s=[];return zt(t,function(t,e){return(s,n)=>{if(s.el)return!s.hook?.getIsPortal()&&t.push(e(s)),n()}}(s,e)),s}function Qt(t){let e=t;for(;e;){if(e.el)return e;e=e.parent}return e}function Xt(t){let e=t;for(;e;){if(e.tag===h)return!1;e=e.parent}return Boolean(t)}function Jt(t,e){let s=t;for(;s;){if(s.hook?.getIsSuspense()&&(!e||s.hook.getIsPending()))return s;s=s.parent}return null}function Zt(t){return Jt(t,!0)||Jt(t,!1)||null}function te(t){let e=t;for(;e;){if(e.hook?.getIsBoundary())return e;e=e.parent}return null}function ee(t,e,s){const n=s.owner;let i=n,o=`${n.idx}${S}${e}`;for(;i;)i=i.parent,i&&(o=`${i.idx}.${o}`);return o=`[${t}]${o}`,o}const se=(t,e,s)=>()=>ee(t,e,s);function ne(t,e,s){const n=s.getReconciler().get(t.id),i=t.inst;e.el&&(t.el=e.el);for(let e=0;e<i.children.length;e++)re(i.children,t,n.map,e,t.eidx);t.cc=i.children.length,s.setMountDeep(!1)}function ie(t,e,s){const n=s.getReconciler().get(t.id),i=Boolean(n.move),o=Boolean(n.remove),r=Boolean(n.insert),c=Boolean(n.replace);(i&&!o||o&&!i)&&!r&&!c&&function(t,e){if(!Ut(t.inst))return;const s=e.getReconciler().get(t.id),n=t.inst.children;for(let t=0;t<n.length;t++){const e=n[t],i=Nt(e);if(null===i)return!1;const o=s.map[i];if(!o)return!1;const r=o.inst,c=e;if(!Yt(c)||!Yt(r)||c.type!==r.type||c.shouldUpdate(r.props,c.props))return!1}return!0}(t,s)&&(i&&function(t,e,s){const n=s.getReconciler().get(t.id);oe(t,e,s,((t,e)=>{n.move[e]&&(t.alt=(new Kt).mutate(t),t.tag=u,t.mask|=g,s.addCandidate(t))}))}(t,e,s),o&&oe(t,e,s))}function oe(t,e,s,n){const i=s.getReconciler().get(t.id),o=t.inst.children;e.el&&(t.el=e.el);for(let e=0;e<o.length;e++){const s=ce(o[e],e),r=i.map[s];re(o,t,i.map,e,t.eidx),n&&n(r,s)}t.cc=o.length,s.setMountDeep(!1)}function re(t,e,s,n,i){const o=n-1,r=n+1,c=ce(t[n],n),a=ce(t[o],o),l=ce(t[r],r),u=s[c],h=s[a],f=s[l],p=0===n,m=n===t.length-1;p&&(e.child=u),u.alt=null,u.parent=e,u.tag=d,u.idx=n,u.eidx=h?h.eidx+(h.el?1:h.cec):i,f&&(u.next=f),m&&(u.next=null),ae(u)}function ce(t,e){const s=Nt(t);return null!==s?s:lt(e)}function ae(t,e=t){t.increment(e.el?1:e.cec),e.mask&f&&t.markHost(f),e.mask&p&&t.markHost(p)}class le{store;constructor(t={}){this.store=t}get(t){return this.store[t]}reset(){this.store={}}fork(){return new le({...this.store})}reconcile(t,e,s){const{id:n,inst:i}=t,o=Bt(e.inst,i),r=i.children;if(o){if(Ut(e.inst)&&r&&!Pt(i,O.SKIP_SCAN_OPT)){const{prevKeys:o,nextKeys:c,prevKeysMap:a,nextKeysMap:l,keyedFibersMap:u}=function(t,e){let s=t,n=0;const i=[],o=[],r={},c={},a={},l={};for(;s||n<e.length;){if(s){const t=Nt(s.inst),e=G(t)?lt(n):t;r[e]||(r[e]=!0,i.push(e)),a[e]=s}if(n<e.length){const t=Nt(e[n]),s=G(t)?lt(n):t;c[s]||(c[s]=!0,o.push(s)),l[s]=!0}s=s?s.next:null,n++}return{prevKeys:i,nextKeys:o,prevKeysMap:r,nextKeysMap:c,keyedFibersMap:a}}(e.child,r),h=0===c.length;let d=Math.max(o.length,c.length),f=0,p=0;this.createStore(n,u);for(let t=0;t<d;t++){const e=c[t-p]??null,i=o[t-f]??null,r=u[i]||null;e!==i?null===e||a[e]?l[i]?l[i]&&l[e]&&this.move(n,e):(this.remove(n,i),s.addDeletion(r),h&&(r.mask|=m),p++,d++):null===i||l[i]?(this.insert(n,e),f++,d++):(this.replace(n,e),s.addDeletion(r)):null!==e&&this.stable(n,e)}Pt(i,O.STATIC_SLOT_OPT)&&ne(t,e,s),Pt(i,O.MEMO_SLOT_OPT)&&ie(t,e,s)}}else s.addDeletion(e)}createStore(t,e){this.store[t]={map:e,replace:null,insert:null,remove:null,move:null,stable:null}}replace(t,e){!this.store[t].replace&&(this.store[t].replace={}),this.store[t].replace[e]=!0}insert(t,e){!this.store[t].insert&&(this.store[t].insert={}),this.store[t].insert[e]=!0}remove(t,e){!this.store[t].remove&&(this.store[t].remove={}),this.store[t].remove[e]=!0}move(t,e){!this.store[t].move&&(this.store[t].move={}),this.store[t].move[e]=!0}stable(t,e){!this.store[t].stable&&(this.store[t].stable={}),this.store[t].stable[e]=!0}}class ue{subscribers=new Map;on(t,e){return!this.subscribers.has(t)&&this.subscribers.set(t,new Set),this.subscribers.get(t).add(e),()=>this.subscribers.has(t)&&this.subscribers.get(t).delete(e)}emit(t,e){this.subscribers.has(t)&&this.subscribers.get(t).forEach((t=>t(e)))}kill(){this.subscribers=new Map}__getSize(){return this.subscribers.size}}class he{store=new Map;add(t,e,s){const n=t?.hook||e?.hook;!this.store.has(n)&&this.store.set(n,[null,null,new Set]);const i=this.store.get(n);i[0]=t?.hook||null,i[1]=e?.hook||null,i[2].add(s)}resolve(){for(const[t,e]of this.store){this.store.delete(t);const[s,n,i]=e;let o=0;0!==i.size&&(s&&(s.setIsPeinding(!0),s.incrementPendings(),o=s.getPendings(),s.update()),Promise.allSettled(i).then((t=>{const e=n&&s?n.owner.id<s.owner.id?n:s:n||s;if(n){const e=t.find((t=>t.status===b));e&&n.owner.setError(ht(e.reason))}s&&o===s.getPendings()&&s.setIsPeinding(!1),e.update()})))}}}class de{root=null;wip=null;cursor=null;unit=null;mDeep=!0;mLevel=0;mNav=new Map;events=new Map;offs=new Set;reconciler=new le;candidates=new Set;deletions=new Set;cancels=[];asyncEffects=new Set;layoutEffects=new Set;insertionEffects=new Set;resId=0;resources=new Map;awaiter=new he;onTransitionEnd=null;isLayoutEffect=!1;isInsertionEffect=!1;isUpdate=!1;isBatch=!1;isHydration=!1;isStream=!1;isTransition=!1;isEvent=!1;isHot=!1;isDynamic=ve.detectIsDynamic();isServer=Se();emitter=new ue;fork(){const t=new de;return t.root=null,t.wip=null,t.cursor=null,t.unit=this.unit,t.mDeep=this.mDeep,t.mLevel=this.mLevel,t.mNav=new Map(this.mNav),t.events=this.events,t.offs=this.offs,t.reconciler=this.reconciler.fork(),t.candidates=new Set([...this.candidates]),t.deletions=new Set([...this.deletions]),t.asyncEffects=new Set([...this.asyncEffects]),t.layoutEffects=new Set([...this.layoutEffects]),t.isUpdate=this.isUpdate,t.emitter=this.emitter,t.awaiter=this.awaiter,t}getRoot(){return this.root}setRoot(t){this.root=t}keepRoot(){!this.isUpdate&&this.setRoot(this.wip)}getWorkInProgress(){return this.wip}setWorkInProgress(t){this.wip=t}getNextUnitOfWork(){return this.unit}setUnitOfWork(t){this.unit=t}getCursor(){return this.cursor}setCursor(t){this.cursor=t}navToChild(){this.mLevel=this.mLevel+1,this.mNav.set(this.mLevel,0)}navToSibling(){this.mNav.set(this.mLevel,this.mNav.get(this.mLevel)+1)}navToParent(){this.mLevel=this.mLevel-1}navToPrev(){0===this.getMountIndex()?(this.navToParent(),this.setMountDeep(!0)):(this.mNav.set(this.mLevel,this.mNav.get(this.mLevel)-1),this.setMountDeep(!1))}getMountIndex(){return this.mNav.get(this.mLevel)}getMountDeep(){return this.mDeep}setMountDeep(t){this.mDeep=t}resetMount(){this.mLevel=0,this.mNav=new Map,this.mDeep=!0}getEvents(){return this.events}addOff(t){this.offs.add(t)}off(){this.offs.forEach((t=>t())),this.offs=new Set}getCandidates(){return this.candidates}addCandidate(t){this.candidates.add(t)}resetCandidates(){this.candidates=new Set}getDeletions(){return this.deletions}hasDeletion(t){let e=t;for(;e;){if(this.deletions.has(e))return!0;e=e.parent}return!1}addDeletion(t){!this.hasDeletion(t)&&this.deletions.add(t)}resetDeletions(){this.deletions=new Set}addAsyncEffect(t){this.asyncEffects.add(t)}resetAsyncEffects(){this.asyncEffects=new Set}runAsyncEffects(){if(!this.isDynamic)return;const t=this.asyncEffects;t.size>0&&setTimeout((()=>t.forEach((t=>t()))))}addLayoutEffect(t){this.layoutEffects.add(t)}resetLayoutEffects(){this.layoutEffects=new Set}runLayoutEffects(){this.isDynamic&&(this.setIsLayoutEffect(!0),this.layoutEffects.forEach((t=>t())),this.setIsLayoutEffect(!1))}addInsertionEffect(t){this.insertionEffects.add(t)}resetInsertionEffects(){this.insertionEffects=new Set}runInsertionEffects(){this.isDynamic&&(this.setIsInsertionEffect(!0),this.insertionEffects.forEach((t=>t())),this.setIsInsertionEffect(!1))}addCancel(t){this.cancels.push(t)}applyCancels(){for(let t=this.cancels.length-1;t>=0;t--)this.cancels[t]()}resetCancels(){this.cancels=[]}getIsLayoutEffect(){return this.isLayoutEffect}setIsLayoutEffect(t){this.isLayoutEffect=t}getIsInsertionEffect(){return this.isInsertionEffect}setIsInsertionEffect(t){this.isInsertionEffect=t}getIsUpdate(){return this.isUpdate}setIsUpdate(t){this.isUpdate=t}getIsBatch(){return this.isBatch}setIsBatch(t){this.isBatch=t}getIsHydration(){return this.isHydration}setIsHydration(t){this.isHydration=t}getIsStream(){return this.isStream}setIsStream(t){this.isStream=t}getIsTransition(){return this.isTransition}setIsTransition(t){this.isTransition=t}getIsEvent(){return this.isEvent}setIsEvent(t){this.isEvent=t}getIsHot(){return this.isHot}setIsHot(t){this.isHot=t}getOnTransitionEnd(){return this.onTransitionEnd}setOnTransitionEnd(t){this.onTransitionEnd=t}getReconciler(){return this.reconciler}cleanup(){this.keepRoot(),this.setWorkInProgress(null),this.setUnitOfWork(null),this.setCursor(null),this.resetMount(),this.resetCandidates(),this.resetDeletions(),this.resetCancels(),this.resetInsertionEffects(),this.resetLayoutEffects(),this.resetAsyncEffects(),this.setIsHydration(!1),this.setIsUpdate(!1),this.reconciler.reset()}getEmitter(){return this.emitter}getResource(t){return this.resources.get(t)}setResource(t,e){this.resources.set(t,e)}getResources(){return this.resources}getNextResourceId(){return++this.resId}getAwaiter(){return this.awaiter}runAfterCommit(){this.resources=new Map,this.isServer&&(this.resId=0)}}let fe=null;const pe=new Map,me=()=>fe,ge=t=>{fe=t,!pe.has(fe)&&pe.set(fe,new de)},ke=t=>pe.delete(t),Ie=(t,e=fe)=>Object.assign(pe.get(e),t),ye=(t=fe)=>pe.get(t),Ee=()=>ot("The function was not installed by renderer!"),ve={createElement:Ee,toggle:Ee,raf:Ee,caf:Ee,spawn:Ee,commit:Ee,finishCommit:Ee,detectIsDynamic:Ee},Se=()=>!ve.detectIsDynamic(),Te=()=>ye().getIsHydration(),_e=()=>Se()||Te(),be=Gt(L((({getValue:t})=>t())),((t,e)=>ct(t.deps,e.deps)));function we(t,e){const s=Oe(),{hook:n}=s,{idx:i,values:o}=n,r=o[i]||(o[i]={deps:e,value:t()});let c=null,a=null;return function(t){return N(t)||wt(t)}(r.value)?(c=r.value,a=be({getValue:t,deps:e})):(c=ct(r.deps,e)?t():r.value,a=c),r.deps=e,r.value=c,n.idx++,a}function Oe(){return ye().getCursor()}function Me(){const t=Se(),e=Te();return{isServer:t,isHydration:e,isSSR:t||e}}function Ae(){const t=Oe(),e=we((()=>Zt(t)),[t]);return Boolean(e)}function Ce(){const t=Oe(),e=we((()=>te(t)),[t]);return Boolean(e)}function xe(){const t=me(),e=Oe(),{hook:s}=e,{idx:n}=s;return se(t,n,s)}const Le=Symbol("effect");function Re(t){return(e,s=[{}])=>{const n=ye(),i=Oe(),o=we((()=>({token:Le,cleanup:void 0})),[]);i.markHost(f),we((()=>{const s=()=>{o.cleanup=e(),t===Ne.ASYNC&&U(o.cleanup)&&!Xt(i)&&o.cleanup()};switch(t){case Ne.INSERTION:n.addInsertionEffect(s);break;case Ne.LAYOUT:n.addLayoutEffect(s);break;case Ne.ASYNC:n.addAsyncEffect(s)}return U(o.cleanup)&&o.cleanup(),null}),s)}}var Ne;!function(t){t.ASYNC="ASYNC",t.LAYOUT="LAYOUT",t.INSERTION="INSERTION"}(Ne||(Ne={}));const Pe=Re(Ne.ASYNC),De=Re(Ne.LAYOUT);class Ue extends ue{port1=null;port2=null;constructor(){super(),this.port1=new Be(this),this.port2=new Be(this)}}class Be{channel;offs=[];constructor(t){this.channel=t}on(t,e){const s=this.channel.on(t,e);this.offs.push(s)}postMessage(t){ve.spawn((()=>{this.channel.emit("message",t)}))}unref(){this.offs.forEach((t=>t())),this.offs=[]}}class He{__id;priority;forceAsync=!1;isTransition=!1;isObsolete=!1;callback=null;createLoc=null;onRestore=null;onTransitionEnd=null;static nextTaskId=0;constructor(t,e,s){this.__id=++He.nextTaskId,this.callback=t,this.priority=e,this.forceAsync=s}getId(){return this.__id}getPriority(){return this.priority}getForceAsync(){return this.forceAsync}setIsTransition(t){this.isTransition=t}getIsTransition(){return this.isTransition}run(){this.isObsolete=!1,this.callback(this.onRestore),this.onRestore=null}complete(t){this.isTransition&&!this.isObsolete&&U(this.onTransitionEnd)&&this.onTransitionEnd((e=>!!t&&this.createBase(e)===this.base()))}markAsObsolete(){this.isObsolete=!0}getIsObsolete(){return this.isObsolete}setOnRestore(t){this.onRestore=t}setCreateLoc(t){this.createLoc=t}createBase(t){const[e]=t.split(S);return e}base(){return this.createBase(this.loc())}loc(){return this.createLoc()}setOnTransitionEnd(t){this.onTransitionEnd=t}}const We=()=>">",Ke=new class{queue={[w.HIGH]:[],[w.NORMAL]:[],[w.LOW]:[]};deadline=0;lastId=0;task=null;scheduledCallback=null;isMessageLoopRunning=!1;channel=null;port=null;constructor(){this.channel=new Ue,this.port=this.channel.port2,this.channel.port1.on("message",this.performWorkUntilDeadline.bind(this))}reset(){this.deadline=0,this.task=null,this.scheduledCallback=null,this.isMessageLoopRunning=!1}shouldYield(){return J()>=this.deadline}schedule(t,e){const s=function(t,e){const{priority:s=w.NORMAL,forceAsync:n=!1,isTransition:i=!1,loc:o,onTransitionEnd:r}=e,c=new He(t,s,n);return c.setIsTransition(i),c.setOnTransitionEnd(r),c.setCreateLoc(o||We),c}(t,e);this.lastId=s.getId(),this.put(s),this.execute()}getLastId(){return this.lastId}detectIsTransition(){return this.task.getIsTransition()}hasNewTask(){const{high:t,normal:e,low:s}=this.getQueues();return t.length+e.length+s.length>0}retain(t){const{high:e,normal:s,low:n}=this.getQueues(),i=[...e,...s,...n],{hasHostUpdate:o,hasChildUpdate:r}=function(t,e){const s=t.base();let n=!1,i=!1,o=!1;for(let t=0;t<e.length;t++){const r=e[t].base();r.length<s.length&&0===s.indexOf(r)?n=!0:r===s?i=!0:r.length>s.length&&0===r.indexOf(s)&&(o=!0)}return{hasTopUpdate:n,hasHostUpdate:i,hasChildUpdate:o}}(this.task,i);if(o||r){const t=function(t,e){const s=t.loc();return e.some((t=>t.loc()===s))}(this.task,i);t?this.complete(this.task,!0):this.defer(this.task),this.task.markAsObsolete()}else this.task.setOnRestore(t),this.defer(this.task)}complete(t,e){t.complete(e)}put(t){const e=this.queue[t.getPriority()];if(t.getIsTransition()){const s=t.base(),n=e.filter((t=>t.base()!==s));e.splice(0,e.length,...n)}e.push(t)}pick(t){return 0!==t.length&&(this.task=t.shift(),this.run(this.task),!0)}run(t){try{t.run(),t.getForceAsync()?this.requestCallbackAsync(Qe):this.requestCallback(Qe)}catch(e){if(!z(e))throw e;e.catch(Z).finally((()=>{this.run(t)}))}}execute(){if(!fs()&&!this.isMessageLoopRunning){const{high:t,normal:e,low:s}=this.getQueues();this.pick(t)||this.pick(e)||this.pick(s)}}requestCallbackAsync(t){this.scheduledCallback=t,this.isMessageLoopRunning||(this.isMessageLoopRunning=!0,this.port.postMessage(null))}requestCallback(t){const e=t(!1);z(e)?e.catch(Z).finally((()=>{this.requestCallback(t)})):(this.task=null,this.execute())}performWorkUntilDeadline(){if(this.scheduledCallback){this.deadline=J()+T;const t=this.scheduledCallback(!0);z(t)?t.catch(Z).finally((()=>{this.port.postMessage(null)})):t?this.port.postMessage(null):(this.complete(this.task,!1),this.reset(),this.execute())}else this.isMessageLoopRunning=!1}defer(t){const{low:e}=this.getQueues();e.unshift(t)}getQueues(){return{high:this.queue[w.HIGH],normal:this.queue[w.NORMAL],low:this.queue[w.LOW]}}},Ve=Symbol("fragment"),Fe=L((({slot:t})=>t||null),{token:Ve,displayName:"Fragment"}),je=t=>N(t)&&t.token===Ve,$e=f|p;function Ge(t){t.mask&$e&&zt(t,Ye)}function Ye(t,e){const{hook:s}=t;if(!(t.mask&$e))return e();s?.drop()}function ze(t){if(B(t))return;const e=ye(t);ve.detectIsDynamic()&&(Ge(e.getRoot()),e.off()),ke(t)}function qe(t){const e=ye();e.setIsBatch(!0),t(),e.setIsBatch(!1)}function Qe(t){const e=ye(),s=e.getWorkInProgress(),n=e.getIsStream(),i=e.getEmitter();let o=e.getNextUnitOfWork(),r=!1;try{for(;o&&!r;)if(o=Xe(o,s,e.getMountDeep(),n,i,e),r=t&&Ke.shouldYield(),e.setUnitOfWork(o),r&&Ke.detectIsTransition()&&Ke.hasNewTask())return ls(e),!1;!o&&s&&function(t){if(t.getIsStream())ve.finishCommit(),cs(t);else{const e=t.getWorkInProgress(),s=t.getDeletions(),n=t.getCandidates(),i=t.getIsUpdate(),o=t.getAwaiter(),r=[],c=e.inst;for(const t of s)t.mask&p&&!(t.mask&f)?r.push(t):Ge(t),t.tag=h,ve.commit(t);i&&function(t){const e=t.cec-t.alt.cec;if(0===e)return;const s=Qt(t.parent);t.hook.setIsWip(!1),t.increment(e),zt(s.child,as(e,t,{isRight:!1}))}(e),t.runInsertionEffects();for(const t of n){const e=t.inst;t.tag!==d&&ve.commit(t),t.alt=null,e.children&&(e.children=null)}e.alt=null,e.hook?.setIsWip(!1),c.children=null,ve.finishCommit(),t.runLayoutEffects(),t.runAsyncEffects(),o.resolve(),r.length>0&&setTimeout(rs(r)),cs(t)}}(e)}catch(s){if(z(s))return s;{const n=e.getEmitter();if(e.keepRoot(),n.emit("error",ht(s)),!t)throw s;return st(s),!1}}return Boolean(o)}function Xe(t,e,s,n,i,o){if(t.hook&&(t.hook.idx=0),s){const e=t.inst.children;if(e&&e.length>0){const e=function(t,e){e.navToChild();const s=t.inst?.children||null,n=s?Ze(s,0):null,i=es(ss(t,n,0,e),n,0);return i.hook=t.child?.hook||i.hook,i.parent=t,t.child=i,i.eidx=t.el?0:t.eidx,ts(i,t,n,e),i}(t,o);return n&&i.emit("chunk",e),e}}let r=t.parent;for(;r&&t!==e;){const e=Je(t,o);if(n&&(i.emit("chunk",t),e&&i.emit("chunk",e)),e)return e;r=(t=r).parent}return null}function Je(t,e){e.navToSibling();const s=e.getMountIndex(),n=t.parent.inst.children,i=n?Ze(n,s):null;if(!i)return e.navToParent(),e.setMountDeep(!1),null;e.setMountDeep(!0);const o=es(ss(t,i,s,e),i,s);return o.hook=t.next?.hook||o.hook,o.parent=t.parent,t.next=o,o.eidx=t.eidx+(t.el?t.hook?.getIsPortal()?0:1:t.cec),ts(o,t,i,e),o}function Ze(t,e){if(!t||e>=t.length)return null;const s=t[e];let n=null;return t[e]=j(s)?Fe({slot:s}):K(s)?Et(s):s||function(t){return Y(t)?Lt():t}(s),n=t[e],n}function ts(t,e,s,n){const{alt:i}=t,o=!i||!Yt(s)||function(t,e,s){const n=t.alt,i=n.inst,o=e;if(o.type!==i.type||o.shouldUpdate(i.props,o.props))return!0;s.setMountDeep(!1),t.tag=d,t.child=n.child,t.child.parent=t,t.hook=n.hook,t.cc=n.cc,t.cec=n.cec,n.el&&(t.el=n.el);const r=t.eidx-n.eidx;return 0!==r&&zt(t.child,ns(r)),ae(t,n),!1}(t,s,n);n.setCursor(t),t.inst=s,i&&i.mask&g&&(t.mask|=g,i.mask&=~g),t.hook&&(t.hook.owner=t),o?(t.inst=is(t,e,n),i&&n.getReconciler().reconcile(t,i,n),function(t,e){const s=t.inst;let n=!1;t.parent.tag===l&&(t.tag=t.parent.tag),n=e&&t.tag!==l&&Bt(e.inst,s)&&Nt(e.inst)===Nt(s),t.tag=n?u:l,t.el||(n&&e.el?t.el=e.el:St(t.inst)&&(t.el=ve.createElement(t.inst))),t.el&&!t.hook?.getIsPortal()&&t.increment()}(t,i)):t.mask&g&&(t.tag=u),n.addCandidate(t)}function es(t,e,s){const n=t?t.inst:null,i=new Kt(s,Ft(t,n,e));return i.alt=t||null,i}function ss(t,e,s,n){const i=0===s,o=i?t:t.parent;if(!t.hook?.getIsWip()&&o.tag===l)return null;const r=i?t.id:t.parent.id,c=Nt(e),a=n.getReconciler().get(r);let u=null;if(null!==c&&a){const t=a.move&&Boolean(a.move[c]),e=a.stable&&Boolean(a.stable[c]);(t||e)&&(u=a.map[c],t&&(u.mask|=g))}else u=t.alt?i?t.alt.child:t.alt.next:a&&a.map[lt(s)]||null;return u}const ns=t=>(e,s)=>{if(e.eidx+=t,e.el)return s()};function is(t,e,s){let n=t.inst;const i=N(n),o=n;if(i)try{let t=o.type(o.props);j(t)?!je(o)&&(t=Fe({slot:t})):K(t)&&(t=Et(t)),o.children=t}catch(n){const i=_e();if(z(n)){const o=n,r=os(t,e,s),c=te(t);if(i)throw r(),o;{const e=Zt(t);if(!e&&!c)throw r(),o;s.getAwaiter().add(e,c,o)}}else o.children=[],!i&&t.setError(n)}else wt(n)&&(n=n());return Ut(n)&&(n.children=j(n.children)?n.children:[n.children],i&&0===o.children.length&&o.children.push(Lt()),t.cc=n.children.length),n}const os=(t,e,s)=>()=>{e?(t.hook.owner=null,t.hook.idx=0,s.navToPrev(),s.setUnitOfWork(e),Kt.setNextId(e.id)):(t.id=Kt.incrementId(),t.cec=t.alt.cec)},rs=t=>()=>t.forEach(Ge);function cs(t,e=!1){t.cleanup(),!e&&t.getEmitter().emit("finish"),t.runAfterCommit()}const as=(t,e,s)=>(n,i)=>{if(n===e)return s.isRight=!0,i();n.el&&i(),s.isRight&&(n.eidx+=t)};function ls(t){const e=t.fork(),s=t.getWorkInProgress(),n=us(e,s.child),{alt:i}=s;s.child=i.child,s.cc=i.cc,s.cec=i.cec,s.hook?.setIsWip(!1),s.alt=null,s.hook.idx=0,s.hook.owner=s,t.runInsertionEffects(),t.applyCancels(),cs(t,!0),Ke.retain(n)}const us=(t,e)=>s=>{const{fiber:n,setValue:i,resetValue:o}=s,r=ye();U(i)&&i(),U(o)&&t.addCancel(o),n.alt=(new Kt).mutate(n),n.tag=u,n.child=e,n.hook?.setIsWip(!0),e.parent=n,t.setRoot(r.getRoot()),t.setWorkInProgress(n),Ie(t)};function hs(t,e){const{idx:s}=e;return n=>{const i=ye();if(i.getIsInsertionEffect())return;const o=U(n),r=i.getIsTransition(),c=i.getIsBatch(),a=i.getIsEvent(),l=r?w.LOW:a?w.HIGH:w.NORMAL,h=r,d=r?i.getOnTransitionEnd():null,f=function(t){const{rootId:e,hook:s,isTransition:n,tools:i=ds}=t;return t=>{ge(e);const o=U(t),{shouldUpdate:r,setValue:c,resetValue:a}=i(),l=ye(),h=s.owner,d=h.alt||h;d.tag&&r()&&Xt(d)&&!o?(U(c)&&c(),U(a)&&n&&l.addCancel(a),d.alt=null,d.alt=(new Kt).mutate(d),d.tag=u,d.cc=0,d.cec=0,d.child=null,d.hook.setIsWip(!0),s.idx=0,s.owner=d,l.setIsUpdate(!0),l.resetMount(),l.setWorkInProgress(d),l.setCursor(d),d.inst=is(d,null,l),l.setUnitOfWork(d)):o&&t({fiber:d,setValue:c,resetValue:a})}}({rootId:t,hook:e,isTransition:r,tools:o?n:void 0}),p={priority:l,forceAsync:h,isTransition:r,loc:se(t,s,e),onTransitionEnd:d};c?function(t,e,s){if(ye().getIsTransition())e();else{const s=t.getBatch()||{timer:null,changes:[]};t.setBatch(s),s.changes.push((()=>o&&n().setValue())),s.timer&&clearTimeout(s.timer),s.timer=setTimeout((()=>{s.changes.splice(-1),s.changes.forEach((t=>t())),t.setBatch(null),e()}))}}(e,(()=>Ke.schedule(f,p))):Ke.schedule(f,p)}}const ds=()=>({shouldUpdate:tt,setValue:null,resetValue:null}),fs=()=>Boolean(ye()?.getWorkInProgress());function ps(){return hs(me(),Oe().hook)}function ms(t,e){const{displayName:s="Component"}=e||{},n=L((({value:e=t,slot:s})=>{const i=Oe(),{hook:o}=i;let r=o.getProviders();r||(r=new Map,r.set(n,{value:e,emitter:new ue}),o.setProviders(r));const c=r.get(n);return De((()=>{c.emitter.emit("publish",e)}),[e]),c.value=e,s}),{displayName:`Context(${s})`});return n.defaultValue=t,Object.freeze(n),n}function gs(t){const{defaultValue:e}=t,s=Oe(),n=we((()=>({value:null,provider:ks(t,s)})),[]),i=ps(),{provider:o}=n,r=o?o.value:e;return De((()=>{if(o)return o.emitter.on("publish",(t=>{!q(n.value,t)&&i()}))}),[]),n.value=r,r}function ks(t,e){let s=e;for(;s;){const e=s.hook?.getProviders();if(e?.has(t))return e.get(t);s=s.parent}return null}function Is(t,e){return we((()=>t),e)}function ys(t){const{get:e,set:s,reset:n,next:i,shouldUpdate:o=tt}=t,r=ye().getIsBatch();return()=>{const t=e(),c=U(i)?i(t):i;return{shouldUpdate:()=>r||o(t,c),setValue:()=>s(c),resetValue:()=>n(t)}}}function Es(t){const e=ps(),s=we((()=>({value:U(t)?t():t})),[]),n=Is((t=>{const n=ys({next:t,get:()=>s.value,set:t=>s.value=t,reset:t=>s.value=t,shouldUpdate:(t,e)=>!q(t,e)});e(n)}),[]);return[s.value,n]}class vs{value;connections1;connections2;subjects;emitter;constructor(t){this.value=t}val(t,e){try{this.__connect(t,e)}catch(t){}return this.value}get(){return this.value}on(t){return!this.emitter&&(this.emitter=new ue),this.emitter.on("data",t)}kill(){if(this.connections1)for(const[t,[e,s,n,i]]of this.connections1)this.off(t,i);if(this.connections2)for(const[t,[e,s]]of this.connections2)this.off(s,t);this.connections1=null,this.connections2=null,this.emitter=null,this.subjects=null}toString(){return String(this.value)}toJSON(){return this.value}valueOf(){return this.value}__connect(t,e){const s=me(),n=ye().getCursor(),{hook:i}=n,o=()=>this.off(i,e);return i.setAtom(this,o),n.markHost(p),G(e)?(!this.connections1&&(this.connections1=new Map),this.connections1.set(i,[s,i,t,e])):(!this.connections2&&(this.connections2=new Map),this.connections2.set(e,[s,i,t,e])),o}__addSubject(t){!this.subjects&&(this.subjects=new Set),this.subjects.add(t)}__removeSubject(t){return this.subjects&&this.subjects.delete(t)}__getSize(){return(this.connections1?this.connections1.size:0)+(this.connections2?this.connections2.size:0)+(this.subjects?this.subjects.size:0)+(this.emitter?this.emitter.__getSize():0)}setValue(t){const e=this.value,s=U(t)?t(this.value):t,n={prev:e,next:s},i=(t,e,s)=>{const[n,i,o,r]=t;if((o||tt)(e,s,r)){const t=hs(n,i);1===this.__getSize()?t(ys({next:s,get:()=>e,set:()=>this.value=s,reset:()=>this.value=e})):t()}};if(this.value=s,this.connections1)for(const[t,n]of this.connections1)i(n,e,s);this.connections2&&this.connections2.has(s)&&(i(this.connections2.get(s),e,s),this.connections2.has(e)&&i(this.connections2.get(e),e,s)),this.emitter&&this.emitter.emit("data",n),this.subjects&&this.subjects.forEach((t=>t.__notify()))}off(t,e){t.removeAtom(this),this.connections1&&this.connections1.delete(t),this.connections2&&this.connections2.delete(e)}}class Ss extends vs{set(t){super.setValue(t)}}class Ts extends vs{deps$=[];fn=null;values=[];constructor(t,e){const s=Ts.values(t);super(Ts.compute(e,s)),this.deps$=t,this.fn=e,this.values=s,t.forEach((t=>t.__addSubject(this)))}__notify(){const t=Ts.values(this.deps$);ct(this.values,t)&&super.setValue(Ts.compute(this.fn,t)),this.values=t}kill(){super.kill(),this.deps$.forEach((t=>t.__removeSubject(this))),this.deps$=[],this.fn=null}static compute(t,e){return t(...e)}static values(t){return t.map((t=>t.get()))}}const _s=t=>t instanceof vs,bs=t=>t instanceof Ss,ws=t=>t instanceof Ts,Os=t=>new Ss(t),Ms=(t,e)=>new Ts(t,e);function As(t){const e=we((()=>Os(t)),[]);return De((()=>()=>e.kill()),[]),e}function Cs(t,e){const s=we((()=>Ms(t,e)),[]);return De((()=>()=>s.kill()),[]),s}function xs(t){const e=ps(),s=()=>qe(e);return De((()=>{const e=t.map((t=>t.on(s)));return()=>e.forEach((t=>t()))}),[...t]),t.map((t=>t.get()))}const Ls=new Map;function Rs(t,e){return L((s=>{const n=we((()=>({isDirty:!1})),[]),i=Ls.get(t);if(B(i)&&!n.isDirty){const s=async()=>{Ls.set(t,await function(t){return new Promise(((e,s)=>{t().then((t=>{e(t.default)})).catch(s)}))}(t)),U(e)&&e()};n.isDirty=!0,it(s())}return i?i(s):null}),{displayName:"Lazy"})}function Ns(t){if(!V(t)||$(t))return!1;const e=t;for(const t in e)if("current"===t&&e.hasOwnProperty(t))return!0;return!1}function Ps(t,e){U(t)?t(e):Ns(t)&&(t.current=e)}function Ds(t=null){return we((()=>({current:t})),[])}const Us=Gt(L((({slot:t})=>t),{displayName:"Guard"}),(()=>!1)),Bs=L((({isOpen:t,slot:e})=>{const{isSSR:s}=Me(),n=Oe();return De((()=>{if(s)return;const e=qt(n,(t=>t));for(const s of e)Tt(s.inst)&&ve.toggle(s.el,t)}),[t]),e}),{token:Symbol("shadow"),displayName:"Shadow"}),Hs=L((({fallback:t=null,slot:e})=>{const s=Oe(),n=ps(),i=s.hook.getIsPending(),o=[i?Fe({key:1,slot:t}):null,Bs({key:2,isOpen:!i,slot:e})].filter(Boolean);return s.hook.setIsSuspense(!0),s.hook.setUpdate(n),Fe({slot:o})}),{displayName:"Suspense"});function Ws(t){const e=we((()=>({fn:t})),[]);return e.fn=t,Is(((...t)=>e.fn(...t)),[])}function Ks(){const t=Oe(),e=ps(),[s,n]=Es(null),i=Ws((()=>n(null)));return t.hook.setIsBoundary(!0),t.hook.setCatch(n),t.hook.setUpdate(e),[s,i]}const Vs=L((({fallback:t=null,renderFallback:e,onError:s,slot:n})=>{const[i,o]=Ks();return Pe((()=>{i&&U(s)&&s(i)}),[i]),i?U(e)?e({error:i,reset:o}):t:n}),{displayName:"ErrorBoundary"});function Fs(t){const e=ye(),s=Ke.getLastId();e.setIsTransition(!0);try{if(t(),s===Ke.getLastId()){const t=e.getOnTransitionEnd();U(t)&&t((()=>!1)),ot("startTransition must plan a new render!")}}finally{e.setIsTransition(!1)}}function js(){const[t,e]=Es(!1),s=xe(),n=ye(),i=Ws((t=>{e(!0),n.setOnTransitionEnd((t=>e(t(s())))),Fs(t),n.setOnTransitionEnd(null)}));return[!Ke.detectIsTransition()&&t,i]}function $s(t){const[e,s]=Es(t);return De((()=>{Fs((()=>s(t)))}),[t]),e}const Gs=Re(Ne.INSERTION);function Ys(t,e,s){const n=we((()=>e()),s||[{}]);t&&Ps(t,n)}function zs(t,e,s){const n=we((()=>U(s)?s(e):e),[]),[i,o]=Es(n),r=Is((e=>o((s=>t(s,e)))),[]);return[i,r]}function qs(){return we((()=>Xs(me())),[])}let Qs=1e6;const Xs=t=>`dark:${t}:${(++Qs).toString(36)}`;function Js(t,e,s){const{isSSR:n}=Me();n&&!U(s)&&ot("getServerSnapshot was not found!");const[i,o]=Es(n?s():e());return De((()=>t((()=>o(e())))),[e]),i}function Zs(t){t()}return e})())); //# sourceMappingURL=dark-core.production.min.js.map