@fluixi/reactive 1.0.0-alpha.83 → 1.0.0-alpha.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/reactive.cjs +2722 -1
- package/dist/cdn/reactive.global.js +2 -1
- package/dist/cdn/reactive.mjs +2706 -1
- package/dist/cdn/signal.cjs +299 -1
- package/dist/cdn/signal.d.ts +1 -1
- package/dist/cdn/signal.global.js +2 -1
- package/dist/cdn/signal.js +1 -1
- package/dist/cdn/signal.mjs +276 -1
- package/dist/index.cjs +2722 -1
- package/dist/index.mjs +2706 -1
- package/dist/lib/index.cjs +2723 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.mjs +2708 -1
- package/dist/lib/observable/index.cjs +386 -1
- package/dist/lib/observable/index.mjs +364 -1
- package/dist/lib/observable/observable.cjs +384 -1
- package/dist/lib/observable/observable.d.ts +0 -137
- package/dist/lib/observable/observable.d.ts.map +1 -1
- package/dist/lib/observable/observable.js +0 -71
- package/dist/lib/observable/observable.mjs +361 -1
- package/dist/lib/observable/subscription.cjs +180 -1
- package/dist/lib/observable/subscription.d.ts +0 -12
- package/dist/lib/observable/subscription.d.ts.map +1 -1
- package/dist/lib/observable/subscription.js +0 -12
- package/dist/lib/observable/subscription.mjs +157 -1
- package/dist/lib/observable/types.cjs +18 -1
- package/dist/lib/observable/types.d.ts.map +1 -1
- package/dist/lib/predicates.cjs +44 -1
- package/dist/lib/predicates.d.ts +2 -2
- package/dist/lib/predicates.js +2 -2
- package/dist/lib/predicates.mjs +23 -1
- package/dist/lib/signal/api.cjs +571 -1
- package/dist/lib/signal/api.d.ts +211 -1
- package/dist/lib/signal/api.d.ts.map +1 -1
- package/dist/lib/signal/api.js +207 -12
- package/dist/lib/signal/api.mjs +548 -1
- package/dist/lib/signal/cached-resource.cjs +672 -1
- package/dist/lib/signal/cached-resource.d.ts +28 -16
- package/dist/lib/signal/cached-resource.d.ts.map +1 -1
- package/dist/lib/signal/cached-resource.js +35 -29
- package/dist/lib/signal/cached-resource.mjs +650 -1
- package/dist/lib/signal/graph/children.cjs +325 -1
- package/dist/lib/signal/graph/children.js +1 -1
- package/dist/lib/signal/graph/children.mjs +302 -1
- package/dist/lib/signal/graph/compat.cjs +578 -1
- package/dist/lib/signal/graph/compat.d.ts +13 -13
- package/dist/lib/signal/graph/compat.d.ts.map +1 -1
- package/dist/lib/signal/graph/compat.js +33 -31
- package/dist/lib/signal/graph/compat.mjs +556 -1
- package/dist/lib/signal/graph/core.cjs +295 -1
- package/dist/lib/signal/graph/core.d.ts +28 -24
- package/dist/lib/signal/graph/core.d.ts.map +1 -1
- package/dist/lib/signal/graph/core.js +38 -31
- package/dist/lib/signal/graph/core.mjs +273 -1
- package/dist/lib/signal/graph/debounced.cjs +668 -1
- package/dist/lib/signal/graph/debounced.d.ts +5 -5
- package/dist/lib/signal/graph/debounced.d.ts.map +1 -1
- package/dist/lib/signal/graph/debounced.js +5 -5
- package/dist/lib/signal/graph/debounced.mjs +645 -1
- package/dist/lib/signal/graph/derived.cjs +496 -1
- package/dist/lib/signal/graph/derived.d.ts +1 -1
- package/dist/lib/signal/graph/derived.js +1 -1
- package/dist/lib/signal/graph/derived.mjs +473 -1
- package/dist/lib/signal/graph/detect.cjs +66 -1
- package/dist/lib/signal/graph/detect.mjs +45 -1
- package/dist/lib/signal/graph/error-boundary.cjs +301 -1
- package/dist/lib/signal/graph/error-boundary.js +3 -3
- package/dist/lib/signal/graph/error-boundary.mjs +278 -1
- package/dist/lib/signal/graph/index.cjs +305 -1
- package/dist/lib/signal/graph/index.d.ts +7 -6
- package/dist/lib/signal/graph/index.d.ts.map +1 -1
- package/dist/lib/signal/graph/index.js +7 -6
- package/dist/lib/signal/graph/index.mjs +283 -1
- package/dist/lib/signal/graph/observe.cjs +163 -1
- package/dist/lib/signal/graph/observe.d.ts +8 -8
- package/dist/lib/signal/graph/observe.js +5 -5
- package/dist/lib/signal/graph/observe.mjs +140 -1
- package/dist/lib/signal/graph/resource.cjs +620 -1
- package/dist/lib/signal/graph/resource.d.ts +1 -1
- package/dist/lib/signal/graph/resource.js +7 -8
- package/dist/lib/signal/graph/resource.mjs +597 -1
- package/dist/lib/signal/graph/runtime.cjs +501 -1
- package/dist/lib/signal/graph/runtime.d.ts +7 -7
- package/dist/lib/signal/graph/runtime.d.ts.map +1 -1
- package/dist/lib/signal/graph/runtime.js +34 -30
- package/dist/lib/signal/graph/runtime.mjs +478 -1
- package/dist/lib/signal/graph/signal-next.cjs +1208 -1
- package/dist/lib/signal/graph/signal-next.d.ts +5 -5
- package/dist/lib/signal/graph/signal-next.d.ts.map +1 -1
- package/dist/lib/signal/graph/signal-next.js +14 -12
- package/dist/lib/signal/graph/signal-next.mjs +1186 -1
- package/dist/lib/signal/graph/ssr-hooks.cjs +60 -1
- package/dist/lib/signal/graph/ssr-hooks.d.ts +6 -7
- package/dist/lib/signal/graph/ssr-hooks.d.ts.map +1 -1
- package/dist/lib/signal/graph/ssr-hooks.js +6 -7
- package/dist/lib/signal/graph/ssr-hooks.mjs +39 -1
- package/dist/lib/signal/graph/state.cjs +72 -1
- package/dist/lib/signal/graph/state.d.ts +41 -10
- package/dist/lib/signal/graph/state.d.ts.map +1 -1
- package/dist/lib/signal/graph/state.js +83 -22
- package/dist/lib/signal/graph/state.mjs +49 -1
- package/dist/lib/signal/graph/suspense.cjs +301 -1
- package/dist/lib/signal/graph/suspense.js +4 -4
- package/dist/lib/signal/graph/suspense.mjs +278 -1
- package/dist/lib/signal/index-legacy.cjs +2540 -1
- package/dist/lib/signal/index-legacy.d.ts +1 -1
- package/dist/lib/signal/index-legacy.js +1 -1
- package/dist/lib/signal/index-legacy.mjs +2518 -1
- package/dist/lib/signal/index.cjs +1275 -1
- package/dist/lib/signal/index.d.ts +3 -2
- package/dist/lib/signal/index.d.ts.map +1 -1
- package/dist/lib/signal/index.js +7 -4
- package/dist/lib/signal/index.mjs +1253 -1
- package/dist/lib/signal/list.cjs +549 -1
- package/dist/lib/signal/list.d.ts +5 -5
- package/dist/lib/signal/list.js +5 -5
- package/dist/lib/signal/list.mjs +526 -1
- package/dist/lib/signal/resource-api.cjs +626 -1
- package/dist/lib/signal/resource-api.d.ts +5 -5
- package/dist/lib/signal/resource-api.js +5 -5
- package/dist/lib/signal/resource-api.mjs +603 -1
- package/dist/lib/signal/signal.cjs +2023 -1
- package/dist/lib/signal/signal.d.ts +4 -4
- package/dist/lib/signal/signal.d.ts.map +1 -1
- package/dist/lib/signal/signal.js +22 -23
- package/dist/lib/signal/signal.mjs +2000 -1
- package/dist/lib/signal/types.cjs +38 -1
- package/dist/lib/signal/types.d.ts.map +1 -1
- package/dist/lib/signal/types.js +2 -2
- package/dist/lib/signal/types.mjs +17 -1
- package/dist/lib/signal/utilities.cjs +1012 -1
- package/dist/lib/signal/utilities.d.ts +0 -108
- package/dist/lib/signal/utilities.d.ts.map +1 -1
- package/dist/lib/signal/utilities.js +0 -158
- package/dist/lib/signal/utilities.mjs +990 -1
- package/dist/lib/store/api.cjs +661 -1
- package/dist/lib/store/api.d.ts +33 -0
- package/dist/lib/store/api.d.ts.map +1 -1
- package/dist/lib/store/api.js +41 -8
- package/dist/lib/store/api.mjs +645 -1
- package/dist/lib/store/index.cjs +740 -1
- package/dist/lib/store/index.js +1 -1
- package/dist/lib/store/index.mjs +725 -1
- package/dist/lib/store/setter.types.cjs +18 -1
- package/dist/lib/store/setter.types.d.ts +43 -3
- package/dist/lib/store/setter.types.d.ts.map +1 -1
- package/dist/lib/store/store.cjs +707 -1
- package/dist/lib/store/store.d.ts +72 -0
- package/dist/lib/store/store.d.ts.map +1 -1
- package/dist/lib/store/store.js +238 -8
- package/dist/lib/store/store.mjs +693 -1
- package/dist/lib/store/types.cjs +18 -1
- package/dist/lib/store/types.d.ts +1 -1
- package/dist/lib/store/types.d.ts.map +1 -1
- package/dist/lib/store/utils.cjs +43 -1
- package/dist/lib/store/utils.d.ts +1 -1
- package/dist/lib/store/utils.js +1 -1
- package/dist/lib/store/utils.mjs +22 -1
- package/dist/lib/subject.cjs +450 -1
- package/dist/lib/subject.js +3 -91
- package/dist/lib/subject.mjs +427 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/version.generated.cjs +27 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +2 -2
- package/dist/version.generated.mjs +7 -1
- package/package.json +5 -4
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";var Fluixi=(()=>{var St=Object.defineProperty;var Kr=Object.getOwnPropertyDescriptor;var Hr=Object.getOwnPropertyNames;var Wr=Object.prototype.hasOwnProperty;var Gr=(e,t)=>{for(var n in t)St(e,n,{get:t[n],enumerable:!0})},zr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Hr(t))!Wr.call(e,o)&&o!==n&&St(e,o,{get:()=>t[o],enumerable:!(r=Kr(t,o))||r.enumerable});return e};var Xr=e=>zr(St({},"__esModule",{value:!0}),e);var Bs={};Gr(Bs,{$NAME:()=>mr,$NODE:()=>ee,$PROXY:()=>yo,$RAW:()=>we,$SELF:()=>ct,$SIGNAL:()=>ho,$STORE:()=>br,$TRACK:()=>lt,Observable:()=>M,SafeSubscriber:()=>Ye,Signal:()=>Jn,Store:()=>G,StoreAPI:()=>Dr,Subject:()=>xt,Subscriber:()=>ce,Subscription:()=>ae,SuspenseContext:()=>st,VERSION:()=>Xe,__DEV__:()=>Te,batch:()=>$,clearAllCachedResources:()=>Ls,clearCachedResourceNamespace:()=>Ms,combineSignal:()=>as,combineSignals:()=>cs,createCachedResource:()=>Ns,createChildOwner:()=>Cn,createComputed:()=>Nn,createComputedStore:()=>Or,createContext:()=>he,createDebounce:()=>Hn,createDebouncedResource:()=>Wn,createDebouncedSignal:()=>Ht,createDeferred:()=>Kn,createEffect:()=>U,createErrorBoundary:()=>Yn,createMemo:()=>y,createMutableStore:()=>on,createRenderEffect:()=>Mn,createResource:()=>me,createRoot:()=>J,createSelector:()=>$n,createSignal:()=>m,createStore:()=>He,createStoreEffect:()=>Rr,createStoreMemo:()=>Ar,createSuspenseBoundary:()=>Gn,debounceSignal:()=>Ts,disposeScope:()=>_n,distinctSignal:()=>us,effect:()=>mo,everySignal:()=>ss,filterSignal:()=>ts,findSignal:()=>rs,flush:()=>Bn,getNode:()=>_r,getOwner:()=>je,getServerData:()=>Ne,getStoreNode:()=>Er,guardSignal:()=>vs,indexArray:()=>io,isComponent:()=>Ft,isMemo:()=>Pt,isOwnerDisposed:()=>En,isProvider:()=>jt,isResource:()=>Dt,isSignal:()=>Ue,isStore:()=>Cr,isStoreProxy:()=>ht,isSuspense:()=>It,keyArray:()=>so,makeArrayFlat:()=>nt,mapArray:()=>oo,mapSignal:()=>es,memo:()=>To,mergeSignal:()=>ls,modifiable:()=>Pr,nextResourceId:()=>Me,observeReactiveNodes:()=>Ot,omitSignal:()=>hs,on:()=>Vn,onCleanup:()=>k,operate:()=>Yr,pickSignal:()=>ps,produceUtil:()=>Fr,provide:()=>ye,provideErrorBoundary:()=>Qn,provideSuspense:()=>zn,readChildren:()=>ot,readSignal:()=>bs,reconcileUtil:()=>Ir,reduceSignal:()=>ns,reportReactiveBinding:()=>gn,reportReactiveContext:()=>le,reportReactiveContextCreated:()=>Je,reportReactiveDirective:()=>xn,reportReactiveProps:()=>wn,reportResourceData:()=>Le,resource:()=>Zn,runWithOwner:()=>ve,selectSignal:()=>ds,setOwner:()=>Ct,setResourceDataSink:()=>$t,setResourceIdSource:()=>Vt,setResourceTracker:()=>Lt,setServerDataGetter:()=>Bt,signal:()=>vo,someSignal:()=>os,sortSignal:()=>is,startTransition:()=>Et,store:()=>jr,throttleSignal:()=>ms,trackResourcePromise:()=>Z,untrack:()=>I,untrackStore:()=>sn,unwrap:()=>Oe,useContext:()=>Pn,useTransition:()=>Ln,whenSignal:()=>ys,wrap:()=>kr,zipSignal:()=>fs});var Xe="1.0.0-alpha.83";function gt(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function hn(e){return e==null||Array.isArray(e)||typeof e=="function"||e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error?!1:typeof e=="object"}function wt(e){return e instanceof Promise||!!e&&(typeof e=="object"||typeof e=="function")&&"then"in e}var ae=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:n}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let r of t)r.remove(this);if(n){for(let r of n)if(gt(r)&&!(r instanceof e))try{r()}catch(o){console.error("Error in unsubscribe function:",o)}else if(hn(r)&&typeof r.unsubscribe=="function")try{r.unsubscribe()}catch(o){console.error("Error unsubscribing child:",o)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:n,_subscriptions:r}=this;if(n){if(gt(t))try{t()}catch(o){console.error("Error in unsubscribe function:",o)}else if(t.unsubscribe)try{t.unsubscribe()}catch(o){console.error("Error unsubscribing:",o)}return this}return r||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:n}=this;if(!n)return;let r=n.indexOf(t);r!==-1&&(n.splice(r,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:n}=this;n?Array.isArray(n)?n.push(t):this._parentOrParents=[n,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:n}=this;if(n===t)this._parentOrParents=null;else if(Array.isArray(n)){let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===1&&(this._parentOrParents=n[0]))}}};var ce=class extends ae{constructor(n,r,o){super();this.isStopped=!1;let s;n?typeof n=="object"?s=n:s={next:n,error:r,complete:o}:s={},this.destination=s}next(n){if(!this.isStopped&&this.destination.next)try{this.destination.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(n)}catch(r){throw r}else throw n;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(n){this.error(n);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},Ye=class extends ce{constructor(n,r,o,s){super(n,r,o);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(n){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(n)}catch(r){this.error(r)}}error(n){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(n)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};function Yr(e){return new ce(e.next,e.error,e.complete)}var M=class extends ae{constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,n,r){let o;t instanceof ce?o=t:o=new Ye(t,n,r);let{_subscribe:s}=this;try{let i=s.call(this,o);i&&(typeof i=="function"||typeof i.unsubscribe=="function")&&o.add(i)}catch(i){o.error(i)}return o}pipe(...t){return t.length===0?this:t.reduce((n,r)=>r(n),this)}toPromise(){return new Promise((t,n)=>{let r;this.subscribe({next:o=>r=o,error:n,complete:()=>t(r)})})}};var xt=class extends M{constructor(){super(n=>{if(this.closed)throw new Error("Subject has been closed");if(this.hasError)n.error(this.thrownError);else if(this.isStopped)n.complete();else return this.observers.push(n),()=>{let r=this.observers.indexOf(n);r!==-1&&this.observers.splice(r,1)}});this.observers=[];this.isStopped=!1;this.hasError=!1;this.thrownError=null}next(n){if(this.isStopped)return;let{observers:r}=this,o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].next?.(n)}error(n){if(this.isStopped)return;this.hasError=!0,this.thrownError=n,this.isStopped=!0;let{observers:r}=this;this.observers=[];let o=r.length,s=r.slice();for(let i=0;i<o;i++)s[i].error?.(n)}complete(){if(this.isStopped)return;this.isStopped=!0;let{observers:n}=this;this.observers=[];let r=n.length,o=n.slice();for(let s=0;s<r;s++)o[s].complete?.()}unsubscribe(){this.isStopped=!0,this.observers=[]}asObservable(){return new M(r=>this.subscribe(r))}};var Qr="__fluixi_signal_next_state__",Jr=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},c=globalThis[Qr]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Jr,onSuspend:null,onError:null,observer:null};function Ot(e){return c.observer=e,()=>{c.observer===e&&(c.observer=null)}}var _=[],Qe;function vn(e,t){if(!c.observer)return t();let n=Qe;Qe=e;try{return t()}finally{Qe=n}}function Q(e){let t=c.observer;t&&t.created(e.parents===void 0?{...e,parents:_,origin:e.origin??Qe}:e)}function Tn(e){return c.observer?(_.push(e),!0):!1}function mn(){_.pop()}function bn(e){c.observer?.ran?.(e)}function Sn(e,t){c.observer?.wrote?.(e,t)}function gn(e,t,n,r){let o=c.observer;!o?.bound||!_.length||o.bound(_[_.length-1],e,t,n,r)}function wn(e){let t=c.observer;!t?.props||!_.length||!e||t.props(_[_.length-1],e)}function xn(e,t,n,r){let o=c.observer;!o?.directive||!_.length||o.directive(_[_.length-1],e,t,n,r)}function Je(e){c.observer?.contextCreated?.(e)}function le(e,t,n){let r=c.observer;!r?.context||!_.length||r.context(_[_.length-1],e,t,n)}function Rt(e,t,n){c.observer?.moved?.(e,t,n)}function H(e){c.observer?.disposed?.(e)}var Zr="__FLUIXI_DEVTOOLS_HOOK__",yn=globalThis[Zr];if(typeof yn?.inject=="function")try{yn.inject({observeReactiveNodes:Ot,version:Xe})}catch{}function fe(){return c.observer!=null}var On=0,Rn=1,Pe=2,Ze=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(c.untracked)return;let t=c.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},de=class extends Ze{constructor(t,n){super(),this._value=t,this._equals=n?.equals===!1?()=>!1:n?.equals??Object.is}get(){return this.track(),this._value}set(t){if(!this._equals(this._value,t)){if(this._value=t,this.version++,Sn(this,c.consumer),this.observers)for(let n of[...this.observers])n.markDirty(Pe);At(this)}}peek(){return this._value}},W=class extends Ze{constructor(n,r){super();this._threw=!1;this._initialized=!1;this.state=Pe;this.sources=null;this._fn=n,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){if(c.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===Rn&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===Pe)break}(this.state===Pe||!this._initialized)&&this.recompute(),this.state=On}recompute(){if(this.sources){for(let f of this.sources)f.observers?.delete(this);this.sources.clear()}let n=c.consumer,r=c.untracked,o=Tn(this);c.consumer=this,c.untracked=!1;let s,i=!1,u;try{s=this._fn()}catch(f){i=!0,u=f,s=this._value}finally{c.consumer=n,c.untracked=r,o&&mn()}let a=!this._initialized||this._threw!==i||(i?u!==this._error:!this._equals(this._value,s));if(this._initialized=!0,this._threw=i,this._error=u,this._value=s,bn(this),a){if(this.version++,this.observers)for(let f of[...this.observers])f.markDirty(Pe);At(this)}}markDirty(n){if(this.state>=n)return;let r=this.state===On;if(this.state=n,r){if(this.observers)for(let o of[...this.observers])o.markDirty(Rn);At(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function At(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var pe=class{constructor(t){this._watched=new Set;this._pending=new Set;this._notifyFn=t}watch(...t){for(let n of t)this._watched.add(n),(n.watchers??=new Set).add(this)}unwatch(...t){for(let n of t)this._watched.delete(n),n.watchers?.delete(this),this._pending.delete(n)}getPending(){let t=[...this._pending];return this._pending.clear(),t}_notify(t){if(!this._watched.has(t)||this._pending.has(t))return;let n=this._pending.size===0;this._pending.add(t),n&&this._notifyFn()}};function De(e){if(c.untracked)return e();c.untracked=!0;try{return e()}finally{c.untracked=!1}}function An(){return c.consumer}function kn(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function Cn(e){let t=Ie(e);return e&&(e.owned??=[]).push(t),t}function _n(e,t=!0){Fe(e,t)}function En(e){return!!e&&e.disposed===!0}function Ie(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function he(e,t){let n=Symbol(t??"context");return Je(n),{id:n,defaultValue:e,Provider:o=>{le(n,"provide",o.value);let s=c.owner,i=Ie(s);(i.contexts=new Map).set(n,o.value),s&&(s.owned??=[]).push(i),c.owner=i;try{return o.children}finally{c.owner=s}}}}function Pn(e){let t=c.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id)){let n=t.contexts.get(e.id);return le(e.id,"read",n),n}t=t.parent}return le(e.id,"read",e.defaultValue),e.defaultValue}function et(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function ye(e,t,n){let r=Ie(c.owner);(r.contexts=new Map).set(e.id,t),c.owner&&(c.owner.owned??=[]).push(r);let o=c.owner;c.owner=r;try{return n()}finally{c.owner=o}}function Dn(e){c.onSuspend=e}function Fn(e){return c.onSuspend?(c.onSuspend(e,c.owner),!0):!1}function In(e){c.onError=e}function je(){return c.owner}function Ct(e){let t=c.owner;return c.owner=e,t}function ve(e,t){let n=c.owner;c.owner=e;try{return t()}finally{c.owner=n}}function k(e){if(c.owner){if(c.owner.disposed){e();return}(c.owner.cleanups??=[]).push(e)}}function Fe(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Fe(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function J(e){let t=Ie(c.owner);c.owner&&(c.owner.owned??=[]).push(t);let n=c.owner;c.owner=t;try{return e(()=>Fe(t))}finally{c.owner=n}}function jn(e){c.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function eo(e){e.queued||(e.queued=!0,c.queue.push(e),!c.scheduled&&c.batchDepth===0&&(c.scheduled=!0,c.hostSchedule(qe)))}function qe(){if(c.scheduled=!1,c.flushing)return;c.flushing=!0;let e=0;try{for(;c.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=c.queue;c.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{c.flushing=!1}}function qn(){c.batchDepth===0&&qe()}function _t(e){c.batchDepth++;try{return e()}finally{--c.batchDepth===0&&qe()}}var kt=class{constructor(t,n=!1){this.queued=!1;this.disposed=!1;this.owner=Ie(c.owner),c.owner&&(c.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new W(()=>{Fe(this.owner,!1),ve(this.owner,()=>{let r=t();typeof r=="function"&&(this.owner.cleanups??=[]).push(r)})}),Q({kind:"effect",node:this.computed,handle:this,internal:!n}),this.watcher=new pe(()=>eo(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(t){if(t&&typeof t.then=="function"&&c.onSuspend){c.onSuspend(t,this.owner);return}if(c.onError&&c.onError(t,this.owner))return;throw t}}}dispose(){this.disposed||(this.disposed=!0,H(this.computed),this.watcher.unwatch(this.computed),Fe(this.owner))}};function tt(e,t=!1){let n=new kt(e,t);return()=>n.dispose()}function to(e){return!!e&&typeof e.then=="function"}jn(()=>{});var Un=Symbol.for("signal"),no=Symbol.for("memo"),ro=Symbol.for("signal-node");function m(e,t){let n=new de(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),qn(),i});return Object.defineProperty(r,Un,{value:!0,enumerable:!0}),Object.defineProperty(r,ro,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),Q({kind:"signal",node:n,handle:r,name:t?.name,set:o}),fe()&&k(()=>H(n)),[r,o]}function y(e,t,n){let r=t,o=je(),s=new W(()=>ve(o,()=>{try{return r=e(r)}catch(u){if(to(u))return Fn(u),r;throw u}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,Un,{value:!0,enumerable:!0}),Object.defineProperty(i,no,{value:!0,enumerable:!0}),Q({kind:"memo",node:s,handle:i,name:n?.name}),fe()&&k(()=>H(s)),i}function U(e,t){let n=t;return tt(()=>{n=e(n)},!0)}function Nn(e,t){let n=t;tt(()=>{n=e(n)})}function Mn(e,t){let n=t;return tt(()=>{n=e(n)})}function $(e){return _t(e)}function I(e){return De(e)}function Et(e){return _t(e),Promise.resolve()}function Ln(){return[()=>!1,Et]}function Bn(){return qe(),Promise.resolve()}function Vn(e,t,n){let r=Array.isArray(e),o,s=n?.defer??!1;return i=>{let u=r?e.map(f=>f()):e();if(s){s=!1,o=u;return}let a=De(()=>t(u,o,i));return o=u,a}}function oo(e,t,n){let r=[];return k(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return I(()=>{if(o.length===0){for(let a of r)a.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let a of r)s.has(a.item)||s.set(a.item,a);let i=[],u=new Set;for(let a=0;a<o.length;a++){let f=o[a],b=s.get(f);if(b&&!u.has(b))b.setIndex(a),i.push(b),u.add(b);else{let p,T,S;J(w=>{S=w;let[E,h]=m(a,{name:"row index"});T=h,p=t(f,E)});let O={item:f,rendered:p,dispose:S,setIndex:T};i.push(O),u.add(O)}}for(let a of r)u.has(a)||a.dispose();return r=i,i.map(a=>a.rendered)})},void 0,{name:"mapArray"})}function so(e,t,n,r){let o=[],s=[];return k(()=>{for(let i of s)i.dispose();o=[],s=[]}),y(()=>{let i=e()||[];return I(()=>{if(i.length===0){for(let p of s)p.dispose();return o=[],s=[],r?.fallback?r.fallback():[]}let u=new Map;for(let p=0;p<o.length;p++)u.set(o[p],s[p]);let a=[],f=[],b=new Set;for(let p=0;p<i.length;p++){let T=t(i[p]),S=u.get(T);if(S&&!b.has(T))S.setIndex(p),a.push(S);else{let O,w,E;J(h=>{E=h;let[j,A]=m(p,{name:"row index"});w=A;let B=y(P=>{let q=(e()||[])[j()];return q??P},i[p]);O=n(B,j)}),a.push({rendered:O,dispose:E,setIndex:w})}f.push(T),b.add(T)}for(let[p,T]of u)b.has(p)||T.dispose();return o=f,s=a,a.map(p=>p.rendered)})},void 0,{name:"keyArray"})}function io(e,t,n){let r=[];return k(()=>{for(let o of r)o.dispose();r=[]}),y(()=>{let o=e()||[];return I(()=>{if(o.length===0){for(let a of r)a.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,i=o.length;for(let a=s;a<i;a++){let f,b,p,T=o[a];J(S=>{p=S;let[O,w]=m(T);b=w,f=t(O,a)}),r.push({rendered:f,setItem:b,dispose:p})}for(let a=i;a<s;a++)r[a].dispose();i<s&&(r=r.slice(0,i));let u=Math.min(s,i);for(let a=0;a<u;a++)r[a].setItem(o[a]);return r.map(a=>a.rendered)})},void 0,{name:"indexArray"})}var uo=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,Te=typeof process>"u"?uo:!1,ao=Symbol.for("signal"),co=Symbol.for("memo"),lo=Symbol.for("resource");function Ue(e){return typeof e=="function"&&e[ao]===!0}function Pt(e){return typeof e=="function"&&e[co]===!0}function Dt(e){return typeof e=="function"&&e[lo]===!0}function Ft(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function It(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function jt(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function nt(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?nt(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var qt=null;function Lt(e){qt=e}function Z(e){qt&&qt(e)}var Ut=null;function Bt(e){Ut=e}function Ne(e){return Ut?Ut(e):void 0}var Nt=null;function Vt(e){Nt=e}function Me(){return Nt?Nt():void 0}var Mt=null;function $t(e){Mt=e}function Le(e,t){Mt&&Mt(e,t)}function $n(e,t=(n,r)=>n===r){let n=new Map;return U(()=>{let r=e();for(let[o,s]of n){let[i,u]=s,a=t(o,r);i()!==a&&u(a)}}),r=>{let o=n.get(r);if(!o){let[s,i]=m(!1);o=[s,i],n.set(r,o);let u=e();i(t(r,u))}return o[0]()}}function Kn(e,t){let[n,r]=m(e(),t);return U(()=>{let o=e();t?.timeoutMs?setTimeout(()=>r(()=>o),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>r(()=>o)):Promise.resolve().then(()=>r(()=>o))}),n}function Hn(e,t){let n,r=(...o)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...o)},t)};return k(()=>{n!==void 0&&clearTimeout(n)}),r}function fo(e){return!!e&&typeof e.then=="function"}var Kt=Symbol();function me(e,t,n={}){let r,o;typeof t=="function"?(r=typeof e=="function"?e:()=>e,o=t):(r=()=>!0,o=e,t&&typeof t=="object"&&(n=t));let s=n.transport===!1?void 0:Me(),i=s!==void 0?Ne(s):void 0,u=i!==void 0,[a,f]=m(i!==void 0?i.value:n.initialValue,{equals:!1}),[b,p]=m(void 0,{equals:!1}),[T,S]=m(i!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[O,w]=m(void 0,{equals:!1}),[E,h]=m(void 0,{equals:!1}),j=Kt,A=!1;U(()=>{let C=r();if(E(),C===!1||C===null||C===void 0){j=Kt,$(()=>{S("unresolved"),w(void 0),p(void 0)});return}let q=A;if(A=!1,j!==Kt&&C===j&&!q)return;if(j=C,u){u=!1;return}let K=!1;k(()=>K=!0);let X=I(T),Ee=I(a),se=X==="ready"||X==="refreshing";$(()=>{S(se?"refreshing":"pending"),p(void 0)});try{let N=o(C,{value:Ee,refetching:se});fo(N)?(w(N),Z(N),N.then(Y=>{K||(s!==void 0&&Le(s,Y),$(()=>{f(()=>Y),S("ready"),w(void 0)}))},Y=>{K||$(()=>{p(Y),S("errored"),w(void 0)})})):$(()=>{f(()=>N),S("ready"),w(void 0)})}catch(N){if(K)return;$(()=>{p(N),S("errored"),w(void 0)})}});let B=()=>{let C=T();return C==="pending"||C==="refreshing"},P=(()=>{let C=b();if(C)throw C;if(B()){let q=O();if(q)throw q}return a()});return Object.defineProperties(P,{state:{get:T},loading:{get:B},error:{get:b},latest:{get:a}}),Object.defineProperty(P,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(P,Symbol.for("signal"),{value:!0,enumerable:!0}),[P,{mutate:f,refetch:()=>{A=!0,h(void 0)}}]}function Ht(e,t=300){let[n,r]=m(e),[o,s]=m(e),[i,u]=m(!1),a,f=()=>{a!==void 0&&(clearTimeout(a),a=void 0)},b=()=>{f();let T=I(n);return s(()=>T),u(!1),T},p=(T=>{let S=typeof T=="function"?T(I(n)):T;return r(()=>S),u(!0),f(),a=setTimeout(b,t),S});return k(f),[o,p,{immediate:n,pending:i,flush:b,cancel:()=>{f(),u(!1)}}]}function po(e){return e!=null&&e!==""}function Wn(e,t,n={}){let{delay:r=300,initialValue:o,shouldFetch:s=po}=n,[i,u,a]=Ht(e,r),f=()=>s(i())?i():!1,[b,{refetch:p}]=me(f,t,o===void 0?{}:{initialValue:o});return[b,{...a,query:i,setQuery:u,refetch:p}]}function rt(e){if(typeof e=="function"&&!e.length){let t=e();return Ue(t)?t:rt(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=rt(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function ot(e){let t=y(e);return Te?y(()=>rt(t()),void 0,{name:"children"}):y(()=>rt(t()))}var st=he();Dn((e,t)=>{let n=et(t,st);n&&(n.increment(),e.finally(()=>n.decrement()))});function Gn(){let[e,t]=m(0),n=0;return{increment:()=>t(n+=1),decrement:()=>t(n-=1),inFallback:()=>e()>0}}function zn(e,t){return ye(st,e,t)}var Xn=he();In((e,t)=>{let n=et(t,Xn);return n?(n.setError(e),!0):!1});function Yn(){let[e,t]=m(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:r=>t(()=>r)}}function Qn(e,t){return ye(Xn,e,t)}var Jn={State:de,Computed:W,subtle:{Watcher:pe,untrack:De,currentComputed:An,hasSinks:kn}};var ho=Symbol.for("signal"),yo=Symbol.for("fluixi-proxy");function vo(e,t){let[n,r]=m(e,t);return Object.assign(n,{set:r})}function To(e,t,n){return y(e,t,n)}function mo(e,t){return U(e,t)}function Zn(...e){let[t,n]=me(...e);return Object.assign(t,n)}var bo="__fluixi_signal_next_state__",So=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},l=globalThis[bo]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:So,onSuspend:null,onError:null,observer:null},go="1.0.0-alpha.83";function wo(e){return l.observer=e,()=>{l.observer===e&&(l.observer=null)}}var be=[],xo;function zt(e){let t=l.observer;t&&t.created(e.parents===void 0?{...e,parents:be,origin:e.origin??xo}:e)}function Oo(e){return l.observer?(be.push(e),!0):!1}function Ro(){be.pop()}function Ao(e){l.observer?.ran?.(e)}function ko(e,t){l.observer?.wrote?.(e,t)}function Co(e){l.observer?.contextCreated?.(e)}function _o(e,t,n){let r=l.observer;!r?.context||!be.length||r.context(be[be.length-1],e,t,n)}function Xt(e){l.observer?.disposed?.(e)}var Eo="__FLUIXI_DEVTOOLS_HOOK__",er=globalThis[Eo];if(typeof er?.inject=="function")try{er.inject({observeReactiveNodes:wo,version:go})}catch{}function rr(){return l.observer!=null}var tr=0,nr=1,Be=2,or=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(l.untracked)return;let e=l.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Po=class extends or{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,ko(this,l.consumer),this.observers)for(let t of[...this.observers])t.markDirty(Be);Wt(this)}}peek(){return this._value}},sr=class extends or{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=Be,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(l.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===nr&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Be)break}(this.state===Be||!this._initialized)&&this.recompute(),this.state=tr}recompute(){if(this.sources){for(let u of this.sources)u.observers?.delete(this);this.sources.clear()}let e=l.consumer,t=l.untracked,n=Oo(this);l.consumer=this,l.untracked=!1;let r,o=!1,s;try{r=this._fn()}catch(u){o=!0,s=u,r=this._value}finally{l.consumer=e,l.untracked=t,n&&Ro()}let i=!this._initialized||this._threw!==o||(o?s!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=o,this._error=s,this._value=r,Ao(this),i){if(this.version++,this.observers)for(let u of[...this.observers])u.markDirty(Be);Wt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===tr;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(nr);Wt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Wt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Do=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function Fo(e){if(l.untracked)return e();l.untracked=!0;try{return e()}finally{l.untracked=!1}}function ir(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function ur(e,t){let n=Symbol(t??"context");return Co(n),{id:n,defaultValue:e,Provider:r=>{_o(n,"provide",r.value);let o=l.owner,s=ir(o);(s.contexts=new Map).set(n,r.value),o&&(o.owned??=[]).push(s),l.owner=s;try{return r.children}finally{l.owner=o}}}}function ar(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Io(e){l.onSuspend=e}function jo(e){return l.onSuspend?(l.onSuspend(e,l.owner),!0):!1}function qo(e){l.onError=e}function Uo(){return l.owner}function cr(e,t){let n=l.owner;l.owner=e;try{return t()}finally{l.owner=n}}function lr(e){if(l.owner){if(l.owner.disposed){e();return}(l.owner.cleanups??=[]).push(e)}}function Gt(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Gt(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function No(e){l.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Mo(e){e.queued||(e.queued=!0,l.queue.push(e),!l.scheduled&&l.batchDepth===0&&(l.scheduled=!0,l.hostSchedule(Yt)))}function Yt(){if(l.scheduled=!1,l.flushing)return;l.flushing=!0;let e=0;try{for(;l.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=l.queue;l.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{l.flushing=!1}}function Lo(){l.batchDepth===0&&Yt()}function Bo(e){l.batchDepth++;try{return e()}finally{--l.batchDepth===0&&Yt()}}var Vo=class{constructor(e,t=!1){this.queued=!1,this.disposed=!1,this.owner=ir(l.owner),l.owner&&(l.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new sr(()=>{Gt(this.owner,!1),cr(this.owner,()=>{let n=e();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),zt({kind:"effect",node:this.computed,handle:this,internal:!t}),this.watcher=new Do(()=>Mo(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&l.onSuspend){l.onSuspend(e,this.owner);return}if(l.onError&&l.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,Xt(this.computed),this.watcher.unwatch(this.computed),Gt(this.owner))}};function $o(e,t=!1){let n=new Vo(e,t);return()=>n.dispose()}function Ko(e){return!!e&&typeof e.then=="function"}No(()=>{});var fr=Symbol.for("signal"),Ho=Symbol.for("memo"),Wo=Symbol.for("signal-node");function Qt(e,t){let n=new Po(e,{equals:t?.equals}),r=(()=>n.get()),o=(s=>{let i=typeof s=="function"?s(n.peek()):s;return n.set(i),Lo(),i});return Object.defineProperty(r,fr,{value:!0,enumerable:!0}),Object.defineProperty(r,Wo,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),zt({kind:"signal",node:n,handle:r,name:t?.name,set:o}),rr()&&lr(()=>Xt(n)),[r,o]}function it(e,t,n){let r=t,o=Uo(),s=new sr(()=>cr(o,()=>{try{return r=e(r)}catch(u){if(Ko(u))return jo(u),r;throw u}}),{equals:n?.equals}),i=(()=>s.get());return Object.defineProperty(i,fr,{value:!0,enumerable:!0}),Object.defineProperty(i,Ho,{value:!0,enumerable:!0}),zt({kind:"memo",node:s,handle:i,name:n?.name}),rr()&&lr(()=>Xt(s)),i}function Ve(e,t){let n=t;return $o(()=>{n=e(n)},!0)}function Jt(e){return Bo(e)}function dr(e){return Fo(e)}var uu=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var Go=ur();Io((e,t)=>{let n=ar(t,Go);n&&(n.increment(),e.finally(()=>n.decrement()))});var zo=ur();qo((e,t)=>{let n=ar(t,zo);return n?(n.setError(e),!0):!1});var ut=Symbol.for("fluixi-proxy");var we=Symbol("store-raw"),ee=Symbol("store-node"),pr=Symbol("store-has"),ct=Symbol("store-self"),lt=Symbol("store-track"),mr=Symbol("store-name"),br=Symbol("store-store"),Ke=new WeakMap,en=new WeakMap,xe=new WeakMap,ft=new WeakMap;function Xo(e,t){if(!ge(e)||!fe())return;let n=new Set,r=i=>{if(!(!ge(i)||n.has(i))){n.add(i);for(let u of Object.values(i))r(u)}};r(ft.get(t)??t);let o=new Set,s=i=>{if(!ge(i))return;let u=i;if(n.has(u)||o.has(u))return;o.add(u);let a=Ke.get(u);if(a){for(let f of a.keys.values())H(f);a.all&&H(a.all),Ke.delete(u),xe.delete(u),en.delete(u)}for(let f of Object.values(u))s(f)};s(e)}var dt=(e,t,n)=>n?`${e}[${String(t)}]`:`${e}.${String(t)}`;function Sr(e,t,n){let r=t?.owner,o=r&&n!==void 0?dt(r.name,n,t?.array):void 0,[s,i]=vn(r?.store,()=>Qt(e,o?{name:o}:void 0)),u=s;return u.$=i,u}function pt(e){let t=Ke.get(e);return t?t.owner||(t.owner=xe.get(e)):Ke.set(e,t={keys:new Map,owner:xe.get(e),array:Array.isArray(e)}),t}function hr(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=Sr(n,e,t)),r}function Yo(e,t,n,r){let o=xe.get(e);if(o&&o.store===t&&o.name===n)return;let s={store:t,name:n};xe.set(e,s),ft.set(e,ft.get(r)??r);let i=Ke.get(e);if(i&&(i.owner=s,!!fe())){for(let[u,a]of i.keys)Rt(a,t,dt(n,u,i.array));i.all&&Rt(i.all,t,dt(n,"*",i.array))}}function yr(e){let t=pt(e);(t.all||(t.all=Sr(void 0,t,"*")))()}function vr(e,t){e.$(typeof t=="function"?()=>t:t)}function ge(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function at(e){if(!ge(e))return e;let t=en.get(e);if(t)return t;let n=new Proxy(e,Qo);return en.set(e,n),n}var Qo={get(e,t,n){if(t===we||t===ee)return e;if(t===ut)return n;if(t===pr)return a=>a in e;if(t==="__proxy")return!0;if(t===lt||t===ct)return yr(e),n;let r=e[t];if(typeof r=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return r;let o=Object.getOwnPropertyDescriptor(e,t);if(o&&o.get)return o.get.call(n);let s=pt(e),i=hr(s,t,r),u=i();return ge(u)?(s.owner&&Yo(u,i,dt(s.owner.name,t,s.array),e),at(u)):u},set(){return!0},deleteProperty(e,t){return t in e&&$e(e,t,void 0),!0},has(e,t){return t===we||t===ut||t===ee||t===pr||t===ct||t===lt?!0:(hr(pt(e),t,e[t])(),t in e)},ownKeys(e){return yr(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function gr(e,t=new Set){if(e==null||typeof e!="object")return e;let n=e[we]??e;if(t.has(n)||!ge(n))return n;t.add(n);let r=!1,o=i=>{let u=gr(i,t);return u!==i&&(r=!0),u};if(Array.isArray(n)){let i=n.map(o);return r?i:n}let s={};for(let i of Object.keys(n))s[i]=o(n[i]);return r?s:n}function $e(e,t,n){let r=gr(n),o=e[t];if(o===r&&(r!==void 0||t in e))return;let s=Array.isArray(e),i=s?e.length:0;r===void 0?delete e[t]:e[t]=r;let u=pt(e),a=u.keys.get(t);if(a&&vr(a,r),Xo(o,e),s&&e.length!==i){let f=u.keys.get("length");f&&vr(f,e.length)}u.all&&u.all.$(void 0)}function Tr(e,t){return typeof e=="function"?e(t):e}function tn(e,t){for(let n of Object.keys(t)){let r=t[n],o=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&o&&typeof o=="object"&&!Array.isArray(o)?tn(o,r):$e(e,n,r)}}function rn(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function wr(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let i=t[s];if(i==="*"){let a=t.slice(s+1);if(Array.isArray(e))for(let f=0;f<e.length;f++)wr(e[f],a,n);return}let u=e[i];(u==null||typeof u!="object")&&(u=/^\d+$/.test(t[s+1])?[]:{},$e(e,i,u)),e=u}let o=t[r];if(o==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)$e(e,s,Tr(n,e[s]));return}$e(e,o,Tr(n,e[o]))}function Zt(e,t,n){wr(e,rn(t),n)}function Jo(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&tn(e,r);return}if(Array.isArray(n)&&t.length===1){for(let r of n)Array.isArray(r)&&Zt(e,r[0],r[1]);return}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){tn(e,n);return}if(Array.isArray(t[1])&&t.length>=3){Zt(e,`${n}.${t[1].join(".")}`,t[2]);return}Zt(e,String(n),t[1])}function nn(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(nn);let t={};for(let n of Object.keys(e))t[n]=nn(e[n]);return t}function Se(e,t){let n=e;for(let r of rn(t)){if(n==null)return;n=n[r]}return n}var G=class{constructor(t,n={immutable:!0}){this.options=n;this.root=t,this.set=((...r)=>Jt(()=>Jo(this.root,r))),t&&typeof t=="object"&&(xe.set(t,{store:this,name:n.name??"store"}),ft.set(t,t)),Q({kind:"store",node:this,handle:()=>this.root,name:n.name})}get state(){return at(this.root)}get proxy(){return at(this.root)}get accessor(){return(()=>at(this.root))}unwrap(){return this.root}getNode(t){return this.root&&this.root[t]}get(t){if(t==null||t==="")return Oe(this.state);let n=this.state;for(let r of rn(t)){if(n==null)return;n=n[r]}return Oe(n)}select(t){return it(()=>t(this.state))}subscribe(t){return Ve(()=>t(this.state))}watch(t,n){let r;return Ve(()=>{let o=t(this.state);Object.is(o,r)||(n(o,r),r=o)})}reactive(t){return it(()=>this.state[t])}produce(t){this.set((n=>{let r=nn(n);return t(r),r}))}reconcile(t,n={}){this.set(t)}push(t,...n){let r=Se(this.root,t);this.set(t,r.concat(n))}pop(t){let n=Se(this.root,t).slice(),r=n.pop();return this.set(t,n),r}shift(t){let n=Se(this.root,t).slice(),r=n.shift();return this.set(t,n),r}splice(t,n,r,...o){let s=Se(this.root,t).slice(),i=s.splice(n,r,...o);return this.set(t,s),i}insert(t,n,r){let o=Se(this.root,t).slice();o.splice(n,0,r),this.set(t,o)}removeAt(t,n){let r=Se(this.root,t).slice(),o=r.splice(n,1);return this.set(t,r),o}toObservable(){let[t]=Qt(this.state);return t.toObservable()}dispose(){}},Zo=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function xr(e,t){for(let n of Zo)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function He(e,t={immutable:!0}){let n=new G(e,t);return xr(n.set,n),[n.proxy,n.set]}function on(e,t={}){return new G(e,{...t,immutable:!1})}function Or(e,t={}){let n=new G(e(),t);return Ve(()=>n.set(e())),n}function Rr(e,t,n){return Ve(()=>n(t(e)))}function Ar(e,t,n){return it(()=>t(e),void 0,n)}function kr(e,t={}){let n=new G(e,t),r=(()=>n.proxy);return xr(r,n),r}function Oe(e){if(e==null||typeof e!="object")return e;let t=e[we];return t!==void 0?t:e}function sn(e){return dr(()=>Oe(e))}function Cr(e){return ht(e)}function _r(e){return ht(e)?e[ee]:null}function Er(e){return e&&typeof e=="object"&&ee in e?e[ee]:null}function ht(e){return!!e&&typeof e=="object"&&(ut in e||e.__proxy===!0)}function Pr(e){return e}var Dr=Object.freeze({createStore:He,createMutableStore:on,batch:Jt,unwrap:Oe,untrackStore:sn});function un(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(un);let t={};for(let n of Object.keys(e))t[n]=un(e[n]);return t}function Fr(e){return t=>{let n=un(t);return e(n),n}}function Ir(e,t={}){return()=>e}function jr(e,t){let[n,r]=He(e,t);return new Proxy(n,{get:(o,s)=>s==="set"?r:o[s],has:(o,s)=>s==="set"||Reflect.has(o,s)})}function es(e,t,n){return y(()=>t(e()),void 0,n)}function ts(e,t,n){return y(()=>e().filter(t),void 0,n)}function ns(e,t,n,r){return y(()=>e().reduce(t,n),void 0,r)}function rs(e,t,n){return y(()=>e().find(t),void 0,n)}function os(e,t,n){return y(()=>e().some(t),void 0,n)}function ss(e,t,n){return y(()=>e().every(t),void 0,n)}function is(e,t,n){return y(()=>[...e()].sort(t),void 0,n)}function us(e,t){return y(()=>[...new Set(e())],void 0,t)}function as(e,t,n){return y(()=>{let r=e.map(o=>o());return t(r)},void 0,n)}function cs(...e){return new M(t=>{let n=()=>e.map(o=>typeof o=="function"?o():o.get()),r=e.map(o=>typeof o=="function"&&o.subscribe?o.subscribe(()=>{t.next(n())}):typeof o!="function"?o.subscribe(()=>{t.next(n())}):U(()=>{t.next(n())}));return()=>{r.forEach(o=>{typeof o=="function"?o():o&&typeof o.unsubscribe=="function"&&o.unsubscribe()})}})}function ls(e,t,n){return y(()=>e()||t(),void 0,n)}function fs(e,t,n,r){return y(()=>n(e(),t()),void 0,r)}function ds(e,t,n){return y(()=>t(e()),void 0,{equals:n,internal:!0})}function ps(e,t,n){return y(()=>{let r=e(),o={};for(let s of t)o[s]=r[s];return o},void 0,n)}function hs(e,t,n){return y(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,n)}function ys(e,t,n,r){return y(()=>e()?t():n(),void 0,r)}function vs(e,t,n){return y(()=>e()?t():void 0,void 0,n)}function Ts(e,t,n){let[r,o]=m(e()),s;return y(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),r}function ms(e,t,n){let[r,o]=m(e()),s=0,i;return y(()=>{let u=e(),a=Date.now();a-s>=t?(s=a,o(()=>u)):(clearTimeout(i),i=setTimeout(()=>{s=Date.now(),o(()=>u)},t-(a-s)))}),r}function bs(e){let t=e;for(;typeof t=="function";)t=t();return t}var Ss=Symbol.for("signal");var qr=Symbol("fluixi-proxy"),gs=Symbol.for("signal-node"),We=0,cn=1,mt=2,Ae=3,g=null,R=null,d=null,vt=null,Tt=0,ws=!1,an=!1,Re=0,xs=1e6,z=new WeakMap,yt=null;var Os=new Map,Rs=0;function As(){return`node_${++Rs}_${Date.now()}`}function ks(e){Te&&Os.set(e.id,new WeakRef(e))}function Cs(e,t,n){let r={id:As(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return ks(r),r}function _s(e,t){return e===t}function Nr(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}function Es(e){if(d)d.indexOf(e)===-1&&d.push(e);else if(yt&&yt.running&&!e.pure)yt.effects.indexOf(e)===-1&&yt.effects.push(e);else if(!e.pure||e.computed)fn(e);else if(e.pure&&!e.computed&&e.accessor){let t=R,n=d;R=null,d=[],e.accessor(),R=t;let r=d;if(d=n,r.length>0){let o=d;bt(r),d=o}}}function Ur(e,t){for(let n=0;n<e.length;n++)t(e[n])}function te(e,t){let n=e;typeof n=="object"&&n&&qr in n&&delete n[qr];let r=Cs("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),o=[i,u];z.set(o,new Set);let s;function i(){let a=R;if(a){a.sources?a.sources.indexOf(o)===-1&&a.sources.push(o):a.sources=[o];let f=z.get(o);f&&!f.has(a)&&f.add(a)}return n}function u(a){let f=typeof a=="function"?a(n):a,b=r.equals||_s;if(t?.equals===!1||!b(n,f)){n=f,r.value=f,r.version++,r.updated=Date.now();let T=z.get(o);if(T&&T.size>0){let E=function(h,j=!1){let A=h.state;if(!(A===Ae&&h===R)){if(j&&!h.pure){A===We&&(h.state=cn,ws&&(d!==null&&d.indexOf(h)===-1?d.push(h):O.push(h)));return}if(!w.has(h)&&(w.add(h),h.state=mt,A===We||A===cn?O.push(h):!h.pure&&d!==null&&d.indexOf(h)===-1&&d.push(h),h.pure&&h.accessor)){let B=z.get(h.accessor);B&&Ur(Array.from(B),P=>E(P,!0))}}};var p=E;let S=Array.from(T),O=[],w=new Set;Ur(S,E);for(let h of O)Es(h)}}}return i.toObservable=()=>new M(a=>{let f=!0;return ln(()=>{let p=i();f?f=!1:a.next(p)})}),Object.defineProperty(i,Ss,{value:!0,enumerable:!0}),Object.defineProperty(i,gs,{value:r,enumerable:!1}),o}function ln(e,t,n){let r={fn:e,state:mt,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:g,contexts:null,pure:!1,updatedAt:null};g&&(g.owned?g.owned.push(r):g.owned=[r]);let o=L&&_e(L);return o&&(r.suspense=o),Mr(r,t),()=>ke(r)}function Mr(e,t){if(e.sources){for(let o of e.sources){let s=z.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let o=0;o<e.owned.length;o++)ke(e.owned[o]);e.owned=null}let n=R,r=g;if(R=e,g=e,Tt++,Tt>xs)throw Tt=0,R=n,g=r,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=Ae;let o=e.fn(t);typeof o=="function"&&(e.cleanups?e.cleanups.push(o):e.cleanups=[o]),e.state===Ae&&(e.state=We)}catch(o){if(wt(o)){let s=L&&_e(L);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Nr(o)}finally{R=n,g=r}}function fn(e){if(!(e.disposed||!e.fn||e.state===We)&&(e.state===mt||e.state===cn||e.state===Ae)){if(e.cleanups){for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}if(e.owned){for(let t=0;t<e.owned.length;t++)ke(e.owned[t]);e.owned=null}e.renderEffect?Br(e):Mr(e,e.value)}}function ke(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=z.get(t);n&&n.delete(e)}if(e.cleanups)for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();if(e.owned)for(let t=0;t<e.owned.length;t++)ke(e.owned[t]);if(e.owner&&e.owner.owned){let t=e.owner.owned.indexOf(e);t!==-1&&e.owner.owned.splice(t,1)}}function bt(e){let t=[],n=[];for(let o of e)o.pure&&!o.computed&&o.accessor?t.indexOf(o)===-1&&t.push(o):(o.computed||!o.pure)&&n.indexOf(o)===-1&&n.push(o);d=[];let r=0;for(;r<t.length;){let o=t[r++],s=z.get(o.accessor);if(s&&s.size>0){let u=R;R=null,o.accessor(),R=u}let i=d.splice(0);for(let u of i)u.pure&&!u.computed&&u.accessor?t.indexOf(u)===-1&&t.push(u):(u.computed||!u.pure)&&n.indexOf(u)===-1&&n.push(u)}d=null;for(let o of n)(o.computed||!o.pure)&&fn(o)}function ne(e){if(d&&Re>0)return e();if(d&&Re===0){let t=d,n=[];d=n,Re++;let r;try{r=e()}finally{Re--,d=t}let o=d;return bt(n),d=o,r}Re++,d=[],vt=[];try{return e()}finally{Re--,Ps()}}function Ps(){if(!an){an=!0,Tt=0;try{for(;d&&d.length>0;){let e=d;d=null,bt(e)}if(d=null,vt){let e=vt;vt=null;for(let t=0;t<e.length;t++)fn(e[t])}}finally{an=!1}}}function Ce(e){let t=R;R=null;try{return e()}finally{R=t}}function Lr(e){g&&(g.cleanups?g.cleanups.push(e):g.cleanups=[e])}function Ds(e){let t=Symbol("context"),n=Fs(t);return{id:t,Provider:n,defaultValue:e}}function Fs(e){return t=>{let n=g;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let r;return Is(()=>{r=Ce(()=>{let o=g;return o&&(o.contexts||(o.contexts=new Map),o.contexts.set(e,t.value)),ot(()=>t.children)})}),r}}function _e(e){let t=g;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.owner}if(e)return e.defaultValue}function Is(e,t,n){let r={fn:e,state:mt,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:g,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};g&&(g.owned?g.owned.push(r):g.owned=[r]);let o=L&&_e(L);return o&&(r.suspense=o),Br(r),()=>ke(r)}function Br(e){if(e.sources){for(let o of e.sources){let s=z.get(o);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.cleanups){for(let o=0;o<e.cleanups.length;o++)e.cleanups[o]();e.cleanups=null}if(e.owned){for(let o=0;o<e.owned.length;o++)ke(e.owned[o]);e.owned=null}let t=R,n=g,r=d;R=e,g=e,d===null&&(d=[]),e.state=Ae;try{let o=e.fn(e.value);typeof o=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(o)),e.value=o,e.state===Ae&&(e.state=We)}catch(o){if(wt(o)){let s=L&&_e(L);s&&(s.increment(),o.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Nr(o)}finally{R=t,g=n;let o=d;if(d=r,o!==r&&o&&o.length>0){let s=d;bt(o),d=s}}}var L;function Vr(){return L||(L=Ds())}var oe=new Map,re=new Map,js=0,qs=Symbol.for("signal"),Us=Symbol.for("resource");function Ns(e,t,n={}){let r,o,s;typeof t=="function"?(r=e,o=t,s=n):(r=()=>!0,o=e,s=t??n);let{ttl:i=1/0,name:u=`_auto_${js++}`,staleWhileRevalidate:a=!0}=s,f=u,b=v=>`${f}:${JSON.stringify(v)}`,p=v=>i===1/0||Date.now()-v.timestamp<=i,[T,S]=te(void 0,{equals:!1}),[O,w]=te("unresolved",{equals:!1}),[E,h]=te(void 0,{equals:!1}),[j,A]=te(void 0,{equals:!1}),[B,P]=te(!1),[C,q]=te(0,{equals:!1}),K=Symbol("unset"),X=K,Ee=!1,se=!1;function N(v,D,F,V){if(re.has(D)){re.get(D).then(x=>{V()||Y(x,F)},x=>{!V()&&!F&&dn(x)}),F||A(re.get(D));return}let ie=Promise.resolve(o(v)).then(x=>(oe.set(D,{value:x,timestamp:Date.now()}),re.delete(D),x),x=>{throw re.delete(D),x});if(re.set(D,ie),!F){Z(ie),A(ie);let x=Ge&&_e(Ge);x&&(x.increment(),ie.finally(()=>x.decrement()))}ie.then(x=>{V()||Y(x,F)},x=>{!V()&&!F&&dn(x)})}function Y(v,D){ne(()=>{S(()=>v),w("ready"),P(!1),A(void 0),h(void 0)})}function dn(v){ne(()=>{h(v),w("errored"),A(void 0)})}let Ge;ln(()=>{Ge===void 0&&(Ge=Vr());let v=r();if(C(),v===!1||v===null||v===void 0){X=K,ne(()=>{w("unresolved"),A(void 0),h(void 0)});return}let D=Ee,F=se;Ee=!1,se=!1;let V=b(v);F&&oe.delete(V);let ie=X===K||v!==X;X=v;let x=!1;Lr(()=>{x=!0});let ue=oe.get(V);if(ue&&p(ue)&&!D&&!F){(Ce(O)!=="ready"||Ce(T)!==ue.value)&&ne(()=>{S(()=>ue.value),w("ready"),P(!1),h(void 0)});return}if(ue&&a&&!F){ne(()=>{S(()=>ue.value),w("ready"),P(!0),h(void 0),A(void 0)}),N(v,V,!0,()=>x);return}let pn=Ce(O),$r=pn==="ready"||pn==="refreshing";ne(()=>{w($r?"refreshing":"pending"),h(void 0),P(!1)}),N(v,V,!1,()=>x)});let ze=(()=>{let v=E();if(v)throw v;if(O()==="pending"){let F=j();if(F)throw F}return T()});return Object.defineProperty(ze,Us,{value:!0,enumerable:!0}),Object.defineProperty(ze,qs,{value:!0,enumerable:!0}),Object.defineProperties(ze,{state:{get:O},loading:{get:()=>{let v=O();return v==="pending"||v==="refreshing"}},error:{get:E},latest:{get:T},stale:{get:B}}),[ze,{mutate:S,refetch:()=>{Ee=!0,q(v=>v+1)},invalidate:()=>{let v=Ce(r);v!=null&&v!==!1&&oe.delete(b(v)),se=!0,q(D=>D+1)}}]}function Ms(e){let t=`${e}:`;for(let n of oe.keys())n.startsWith(t)&&oe.delete(n)}function Ls(){oe.clear(),re.clear()}return Xr(Bs);})();
|
|
1
|
+
/*! @fluixi/reactive v1.0.0-alpha.85 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
|
+
"use strict";var Fluixi=(()=>{var st=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var kn=Object.getOwnPropertyNames;var _n=Object.prototype.hasOwnProperty;var En=(e,t)=>{for(var r in t)st(e,r,{get:t[r],enumerable:!0})},Cn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of kn(t))!_n.call(e,o)&&o!==r&&st(e,o,{get:()=>t[o],enumerable:!(n=An(t,o))||n.enumerable});return e};var Pn=e=>Cn(st({},"__esModule",{value:!0}),e);var vs={};En(vs,{$NAME:()=>an,$NODE:()=>J,$PROXY:()=>Jn,$RAW:()=>ye,$SELF:()=>Qe,$SIGNAL:()=>Xn,$STORE:()=>un,$TRACK:()=>Ze,Observable:()=>K,SafeSubscriber:()=>Pe,Signal:()=>Mr,Store:()=>G,StoreAPI:()=>gn,Subject:()=>at,Subscriber:()=>oe,Subscription:()=>ne,SuspenseContext:()=>We,VERSION:()=>Y,__DEV__:()=>Ke,batch:()=>x,childOwner:()=>so,clearAllCachedResources:()=>bs,clearCachedResourceNamespace:()=>ys,combineSignal:()=>Zo,combineSignals:()=>es,computed:()=>no,context:()=>oo,createCachedResource:()=>hs,createChildOwner:()=>Ue,createComputed:()=>qe,createComputedStore:()=>pn,createContext:()=>L,createDebounce:()=>Er,createDebouncedResource:()=>Cr,createDebouncedSignal:()=>gt,createDeferred:()=>_r,createEffect:()=>E,createErrorBoundary:()=>Fr,createMemo:()=>h,createMutableStore:()=>Ut,createRenderEffect:()=>Be,createResource:()=>de,createRoot:()=>q,createSelector:()=>kr,createSignal:()=>d,createStore:()=>Ee,createStoreEffect:()=>hn,createStoreMemo:()=>yn,createSuspenseBoundary:()=>Dr,debounceSignal:()=>us,disposeScope:()=>ir,distinctSignal:()=>Qo,effect:()=>eo,everySignal:()=>Xo,filterSignal:()=>Go,findSignal:()=>zo,flush:()=>br,getNode:()=>mn,getOwner:()=>Oe,getServerData:()=>Ve,getStoreNode:()=>Tn,guardSignal:()=>as,indexArray:()=>Vn,isComponent:()=>Sr,isMemo:()=>mr,isOwnerDisposed:()=>ar,isProvider:()=>wr,isResource:()=>Tr,isSignal:()=>$e,isStore:()=>vn,isStoreProxy:()=>ot,isSuspense:()=>gr,joinedVersions:()=>Gt,keyArray:()=>$n,makeArrayFlat:()=>yt,mapArray:()=>Kn,mapSignal:()=>Ho,memo:()=>Zn,mergeSignal:()=>ts,modifiable:()=>Sn,nextResourceId:()=>Le,observeReactiveNodes:()=>ut,omitSignal:()=>ss,on:()=>vr,onCleanup:()=>S,operate:()=>Dn,pickSignal:()=>os,produceUtil:()=>wn,provide:()=>ce,provideErrorBoundary:()=>Ur,provideSuspense:()=>Ir,readChildren:()=>Pr,readSignal:()=>fs,reconcileUtil:()=>xn,reduceSignal:()=>Wo,renderEffect:()=>ro,reportReactiveBinding:()=>Zt,reportReactiveContext:()=>se,reportReactiveContextCreated:()=>je,reportReactiveDirective:()=>tr,reportReactiveProps:()=>er,reportResourceData:()=>He,resource:()=>Nr,root:()=>to,runWithOwner:()=>fe,selectSignal:()=>ns,setOwner:()=>dt,setResourceDataSink:()=>Ar,setResourceIdSource:()=>Rr,setResourceTracker:()=>xr,setServerDataGetter:()=>Or,signal:()=>Qn,someSignal:()=>Yo,sortSignal:()=>Jo,startTransition:()=>ht,store:()=>On,throttleSignal:()=>cs,trackResourcePromise:()=>le,untrack:()=>g,untrackStore:()=>Mt,unwrap:()=>ve,useContext:()=>ur,useTransition:()=>yr,whenSignal:()=>is,wrap:()=>bn,zipSignal:()=>rs});var Y="1.0.0-alpha.85";function it(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function Kt(e){return e==null||Array.isArray(e)||typeof e=="function"||e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error?!1:typeof e=="object"}var ne=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:r}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let n of t)n.remove(this);if(r){for(let n of r)if(it(n)&&!(n instanceof e))try{n()}catch(o){console.error("Error in unsubscribe function:",o)}else if(Kt(n)&&typeof n.unsubscribe=="function")try{n.unsubscribe()}catch(o){console.error("Error unsubscribing child:",o)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:r,_subscriptions:n}=this;if(r){if(it(t))try{t()}catch(o){console.error("Error in unsubscribe function:",o)}else if(t.unsubscribe)try{t.unsubscribe()}catch(o){console.error("Error unsubscribing:",o)}return this}return n||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:r}=this;if(!r)return;let n=r.indexOf(t);n!==-1&&(r.splice(n,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:r}=this;r?Array.isArray(r)?r.push(t):this._parentOrParents=[r,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:r}=this;if(r===t)this._parentOrParents=null;else if(Array.isArray(r)){let n=r.indexOf(t);n!==-1&&(r.splice(n,1),r.length===1&&(this._parentOrParents=r[0]))}}};var oe=class extends ne{constructor(r,n,o){super();this.isStopped=!1;let s;r?typeof r=="object"?s=r:s={next:r,error:n,complete:o}:s={},this.destination=s}next(r){if(!this.isStopped&&this.destination.next)try{this.destination.next(r)}catch(n){this.error(n)}}error(r){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(r)}catch(n){throw n}else throw r;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(r){this.error(r);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},Pe=class extends oe{constructor(r,n,o,s){super(r,n,o);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(r){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(r)}catch(n){this.error(n)}}error(r){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(r)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};function Dn(e){return new oe(e.next,e.error,e.complete)}var K=class extends ne{constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,r,n){let o;t instanceof oe?o=t:o=new Pe(t,r,n);let{_subscribe:s}=this;try{let i=s.call(this,o);i&&(typeof i=="function"||typeof i.unsubscribe=="function")&&o.add(i)}catch(i){o.error(i)}return o}pipe(...t){return t.length===0?this:t.reduce((r,n)=>n(r),this)}toPromise(){return new Promise((t,r)=>{let n;this.subscribe({next:o=>n=o,error:r,complete:()=>t(n)})})}};var at=class extends K{constructor(){super(r=>{if(this.closed)throw new Error("Subject has been closed");if(this.hasError)r.error(this.thrownError);else if(this.isStopped)r.complete();else return this.observers.push(r),()=>{let n=this.observers.indexOf(r);n!==-1&&this.observers.splice(n,1)}});this.observers=[];this.isStopped=!1;this.hasError=!1;this.thrownError=null}next(r){if(this.isStopped)return;let{observers:n}=this,o=n.length,s=n.slice();for(let i=0;i<o;i++)s[i].next?.(r)}error(r){if(this.isStopped)return;this.hasError=!0,this.thrownError=r,this.isStopped=!0;let{observers:n}=this;this.observers=[];let o=n.length,s=n.slice();for(let i=0;i<o;i++)s[i].error?.(r)}complete(){if(this.isStopped)return;this.isStopped=!0;let{observers:r}=this;this.observers=[];let n=r.length,o=r.slice();for(let s=0;s<n;s++)o[s].complete?.()}unsubscribe(){this.isStopped=!0,this.observers=[]}asObservable(){return new K(n=>this.subscribe(n))}};var Vt=Y.split(".")[0],$t=`__fluixi_signal_state_v${Vt}__`,Lt=`__fluixi_signal_builds_v${Vt}__`,In=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function Ht(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:In,onSuspend:null,onError:null,observer:null}}var De=globalThis;function jn(e){let t=Ht(),r=e;for(let n of Object.keys(t))n in e||(r[n]=t[n]);return e}function Fn(){let e=De[$t];return e?jn(e):De[$t]=Ht()}var u=Fn();(De[Lt]??=[]).push(Y);function Gt(){return[...new Set(De[Lt]??[])]}function ut(e){return u.observer=e,()=>{u.observer===e&&(u.observer=null)}}var A=[],Ie;function zt(e,t){if(!u.observer)return t();let r=Ie;Ie=e;try{return t()}finally{Ie=r}}function X(e){let t=u.observer;t&&t.created(e.parents===void 0?{...e,parents:A,origin:e.origin??Ie}:e)}function Yt(e){return u.observer?(A.push(e),!0):!1}function Xt(){A.pop()}function Jt(e){u.observer?.ran?.(e)}function Qt(e,t){u.observer?.wrote?.(e,t)}function Zt(e,t,r,n){let o=u.observer;!o?.bound||!A.length||o.bound(A[A.length-1],e,t,r,n)}function er(e){let t=u.observer;!t?.props||!A.length||!e||t.props(A[A.length-1],e)}function tr(e,t,r,n){let o=u.observer;!o?.directive||!A.length||o.directive(A[A.length-1],e,t,r,n)}function je(e){u.observer?.contextCreated?.(e)}function se(e,t,r){let n=u.observer;!n?.context||!A.length||n.context(A[A.length-1],e,t,r)}function ct(e,t,r){u.observer?.moved?.(e,t,r)}function $(e){u.observer?.disposed?.(e)}var Un="__FLUIXI_DEVTOOLS_HOOK__",Wt=globalThis[Un];if(typeof Wt?.inject=="function")try{Wt.inject({observeReactiveNodes:ut,version:Y})}catch{}function ie(){return u.observer!=null}var rr=0,nr=1,Se=2,Fe=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(u.untracked)return;let t=u.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},ae=class extends Fe{constructor(t,r){super(),this._value=t,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){return this.track(),this._value}set(t){if(!this._equals(this._value,t)){if(this._value=t,this.version++,Qt(this,u.consumer),this.observers)for(let r of[...this.observers])r.markDirty(Se);ft(this)}}peek(){return this._value}},V=class extends Fe{constructor(r,n){super();this._threw=!1;this._initialized=!1;this.state=Se;this.sources=null;this._fn=r,this._equals=n?.equals===!1?()=>!1:n?.equals??Object.is}get(){if(u.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===nr&&this.sources){for(let r of this.sources)if(r.updateIfNecessary(),this.state===Se)break}(this.state===Se||!this._initialized)&&this.recompute(),this.state=rr}recompute(){if(this.sources){for(let l of this.sources)l.observers?.delete(this);this.sources.clear()}let r=u.consumer,n=u.untracked,o=Yt(this);u.consumer=this,u.untracked=!1;let s,i=!1,a;try{s=this._fn()}catch(l){i=!0,a=l,s=this._value}finally{u.consumer=r,u.untracked=n,o&&Xt()}let c=!this._initialized||this._threw!==i||(i?a!==this._error:!this._equals(this._value,s));if(this._initialized=!0,this._threw=i,this._error=a,this._value=s,Jt(this),c){if(this.version++,this.observers)for(let l of[...this.observers])l.markDirty(Se);ft(this)}}markDirty(r){if(this.state>=r)return;let n=this.state===rr;if(this.state=r,n){if(this.observers)for(let o of[...this.observers])o.markDirty(nr);ft(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function ft(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var ue=class{constructor(t){this._watched=new Set;this._pending=new Set;this._notifyFn=t}watch(...t){for(let r of t)this._watched.add(r),(r.watchers??=new Set).add(this)}unwatch(...t){for(let r of t)this._watched.delete(r),r.watchers?.delete(this),this._pending.delete(r)}getPending(){let t=[...this._pending];return this._pending.clear(),t}_notify(t){if(!this._watched.has(t)||this._pending.has(t))return;let r=this._pending.size===0;this._pending.add(t),r&&this._notifyFn()}};function ge(e){if(u.untracked)return e();u.untracked=!0;try{return e()}finally{u.untracked=!1}}function or(){return u.consumer}function sr(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function Ue(e){let t=xe(e);return e&&(e.owned??=[]).push(t),t}function ir(e,t=!0){we(e,t)}function ar(e){return!!e&&e.disposed===!0}function xe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function L(e,t){let r=Symbol(t??"context");return je(r),{id:r,defaultValue:e,Provider:o=>{se(r,"provide",o.value);let s=u.owner,i=xe(s);(i.contexts=new Map).set(r,o.value),s&&(s.owned??=[]).push(i),u.owner=i;try{return o.children}finally{u.owner=s}}}}function ur(e){let t=u.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id)){let r=t.contexts.get(e.id);return se(e.id,"read",r),r}t=t.parent}return se(e.id,"read",e.defaultValue),e.defaultValue}function Me(e,t){let r=e;for(;r;){if(r.contexts&&r.contexts.has(t.id))return r.contexts.get(t.id);r=r.parent}return t.defaultValue}function ce(e,t,r){let n=xe(u.owner);(n.contexts=new Map).set(e.id,t),u.owner&&(u.owner.owned??=[]).push(n);let o=u.owner;u.owner=n;try{return r()}finally{u.owner=o}}function cr(e){u.onSuspend=e}function fr(e){return u.onSuspend?(u.onSuspend(e,u.owner),!0):!1}function lr(e){u.onError=e}function Oe(){return u.owner}function dt(e){let t=u.owner;return u.owner=e,t}function fe(e,t){let r=u.owner;u.owner=e;try{return t()}finally{u.owner=r}}function S(e){if(u.owner){if(u.owner.disposed){e();return}(u.owner.cleanups??=[]).push(e)}}function we(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)we(e.owned[r]);e.owned=null}if(e.cleanups){for(let r=e.cleanups.length-1;r>=0;r--)e.cleanups[r]();e.cleanups=null}t&&(e.disposed=!0)}}function q(e){let t=xe(u.owner);u.owner&&(u.owner.owned??=[]).push(t);let r=u.owner;u.owner=t;try{return e(()=>we(t))}finally{u.owner=r}}function dr(e){u.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Mn(e){e.queued||(e.queued=!0,u.queue.push(e),!u.scheduled&&u.batchDepth===0&&(u.scheduled=!0,u.hostSchedule(Re)))}function Re(){if(u.scheduled=!1,u.flushing)return;u.flushing=!0;let e=0;try{for(;u.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=u.queue;u.queue=[];for(let r of t)r.queued=!1,r.disposed||r.run()}}finally{u.flushing=!1}}function pr(){u.batchDepth===0&&Re()}function pt(e){u.batchDepth++;try{return e()}finally{--u.batchDepth===0&&Re()}}var lt=class{constructor(t,r=!1){this.queued=!1;this.disposed=!1;this.owner=xe(u.owner),u.owner&&(u.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new V(()=>{we(this.owner,!1),fe(this.owner,()=>{let n=t();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),X({kind:"effect",node:this.computed,handle:this,internal:!r}),this.watcher=new ue(()=>Mn(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(t){if(t&&typeof t.then=="function"&&u.onSuspend){u.onSuspend(t,this.owner);return}if(u.onError&&u.onError(t,this.owner))return;throw t}}}dispose(){this.disposed||(this.disposed=!0,$(this.computed),this.watcher.unwatch(this.computed),we(this.owner))}};function Ne(e,t=!1){let r=new lt(e,t);return()=>r.dispose()}function Nn(e){return!!e&&typeof e.then=="function"}dr(()=>{});var hr=Symbol.for("signal"),qn=Symbol.for("memo"),Bn=Symbol.for("signal-node");function d(e,t){let r=new ae(e,{equals:t?.equals}),n=(()=>r.get()),o=(s=>{let i=typeof s=="function"?s(r.peek()):s;return r.set(i),pr(),i});return Object.defineProperty(n,hr,{value:!0,enumerable:!0}),Object.defineProperty(n,Bn,{value:{get value(){return r.peek()},get version(){return r.version}},enumerable:!1}),X({kind:"signal",node:r,handle:n,name:t?.name,set:o}),ie()&&S(()=>$(r)),[n,o]}function h(e,t,r){let n=t,o=Oe(),s=new V(()=>fe(o,()=>{try{return n=e(n)}catch(a){if(Nn(a))return fr(a),n;throw a}}),{equals:r?.equals}),i=(()=>s.get());return Object.defineProperty(i,hr,{value:!0,enumerable:!0}),Object.defineProperty(i,qn,{value:!0,enumerable:!0}),X({kind:"memo",node:s,handle:i,name:r?.name}),ie()&&S(()=>$(s)),i}function E(e,t){let r=t;return Ne(()=>{r=e(r)},!0)}function qe(e,t){let r=t;Ne(()=>{r=e(r)})}function Be(e,t){let r=t;return Ne(()=>{r=e(r)})}function x(e){return pt(e)}function g(e){return ge(e)}function ht(e){return pt(e),Promise.resolve()}function yr(){return[()=>!1,ht]}function br(){return Re(),Promise.resolve()}function vr(e,t,r){let n=Array.isArray(e),o,s=r?.defer??!1;return i=>{let a=n?e.map(l=>l()):e();if(s){s=!1,o=a;return}let c=ge(()=>t(a,o,i));return o=a,c}}function Kn(e,t,r){let n=[];return S(()=>{for(let o of n)o.dispose();n=[]}),h(()=>{let o=e()||[];return g(()=>{if(o.length===0){for(let c of n)c.dispose();return n=[],r?.fallback?r.fallback():[]}let s=new Map;for(let c of n)s.has(c.item)||s.set(c.item,c);let i=[],a=new Set;for(let c=0;c<o.length;c++){let l=o[c],v=s.get(l);if(v&&!a.has(v))v.setIndex(c),i.push(v),a.add(v);else{let p,b,m;q(T=>{m=T;let[U,C]=d(c,{name:"row index"});b=C,p=t(l,U)});let O={item:l,rendered:p,dispose:m,setIndex:b};i.push(O),a.add(O)}}for(let c of n)a.has(c)||c.dispose();return n=i,i.map(c=>c.rendered)})},void 0,{name:"mapArray"})}function $n(e,t,r,n){let o=[],s=[];return S(()=>{for(let i of s)i.dispose();o=[],s=[]}),h(()=>{let i=e()||[];return g(()=>{if(i.length===0){for(let p of s)p.dispose();return o=[],s=[],n?.fallback?n.fallback():[]}let a=new Map;for(let p=0;p<o.length;p++)a.set(o[p],s[p]);let c=[],l=[],v=new Set;for(let p=0;p<i.length;p++){let b=t(i[p]),m=a.get(b);if(m&&!v.has(b))m.setIndex(p),c.push(m);else{let O,T,U;q(C=>{U=C;let[M,P]=d(p,{name:"row index"});T=P;let ee=h(D=>{let I=(e()||[])[M()];return I??D},i[p]);O=r(ee,M)}),c.push({rendered:O,dispose:U,setIndex:T})}l.push(b),v.add(b)}for(let[p,b]of a)v.has(p)||b.dispose();return o=l,s=c,c.map(p=>p.rendered)})},void 0,{name:"keyArray"})}function Vn(e,t,r){let n=[];return S(()=>{for(let o of n)o.dispose();n=[]}),h(()=>{let o=e()||[];return g(()=>{if(o.length===0){for(let c of n)c.dispose();return n=[],r?.fallback?r.fallback():[]}let s=n.length,i=o.length;for(let c=s;c<i;c++){let l,v,p,b=o[c];q(m=>{p=m;let[O,T]=d(b);v=T,l=t(O,c)}),n.push({rendered:l,setItem:v,dispose:p})}for(let c=i;c<s;c++)n[c].dispose();i<s&&(n=n.slice(0,i));let a=Math.min(s,i);for(let c=0;c<a;c++)n[c].setItem(o[c]);return n.map(c=>c.rendered)})},void 0,{name:"indexArray"})}var Ln=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,Ke=typeof process>"u"?Ln:!1,Hn=Symbol.for("signal"),Gn=Symbol.for("memo"),Wn=Symbol.for("resource");function $e(e){return typeof e=="function"&&e[Hn]===!0}function mr(e){return typeof e=="function"&&e[Gn]===!0}function Tr(e){return typeof e=="function"&&e[Wn]===!0}function Sr(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function gr(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function wr(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function yt(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?yt(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var bt=null;function xr(e){bt=e}function le(e){bt&&bt(e)}var vt=null;function Or(e){vt=e}function Ve(e){return vt?vt(e):void 0}var mt=null;function Rr(e){mt=e}function Le(){return mt?mt():void 0}var Tt=null;function Ar(e){Tt=e}function He(e,t){Tt&&Tt(e,t)}function kr(e,t=(r,n)=>r===n){let r=new Map;return E(()=>{let n=e();for(let[o,s]of r){let[i,a]=s,c=t(o,n);i()!==c&&a(c)}}),n=>{let o=r.get(n);if(!o){let[s,i]=d(!1);o=[s,i],r.set(n,o);let a=e();i(t(n,a))}return o[0]()}}function _r(e,t){let[r,n]=d(e(),t);return E(()=>{let o=e();t?.timeoutMs?setTimeout(()=>n(()=>o),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>n(()=>o)):Promise.resolve().then(()=>n(()=>o))}),r}function Er(e,t){let r,n=(...o)=>{r!==void 0&&clearTimeout(r),r=setTimeout(()=>{r=void 0,e(...o)},t)};return S(()=>{r!==void 0&&clearTimeout(r)}),n}function zn(e){return!!e&&typeof e.then=="function"}var St=Symbol();function de(e,t,r={}){let n,o;typeof t=="function"?(n=typeof e=="function"?e:()=>e,o=t):(n=()=>!0,o=e,t&&typeof t=="object"&&(r=t));let s=r.transport===!1?void 0:Le(),i=s!==void 0?Ve(s):void 0,a=i!==void 0,[c,l]=d(i!==void 0?i.value:r.initialValue,{equals:!1}),[v,p]=d(void 0,{equals:!1}),[b,m]=d(i!==void 0||r.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[O,T]=d(void 0,{equals:!1}),[U,C]=d(void 0,{equals:!1}),M=St,P=!1;E(()=>{let R=n();if(U(),R===!1||R===null||R===void 0){M=St,x(()=>{m("unresolved"),T(void 0),p(void 0)});return}let I=P;if(P=!1,M!==St&&R===M&&!I)return;if(M=R,a){a=!1;return}let B=!1;S(()=>B=!0);let W=g(b),me=g(c),te=W==="ready"||W==="refreshing";x(()=>{m(te?"refreshing":"pending"),p(void 0)});try{let F=o(R,{value:me,refetching:te});zn(F)?(T(F),le(F),F.then(z=>{B||(s!==void 0&&He(s,z),x(()=>{l(()=>z),m("ready"),T(void 0)}))},z=>{B||x(()=>{p(z),m("errored"),T(void 0)})})):x(()=>{l(()=>F),m("ready"),T(void 0)})}catch(F){if(B)return;x(()=>{p(F),m("errored"),T(void 0)})}});let ee=()=>{let R=b();return R==="pending"||R==="refreshing"},D=(()=>{let R=v();if(R)throw R;if(ee()){let I=O();if(I)throw I}return c()});return Object.defineProperties(D,{state:{get:b},loading:{get:ee},error:{get:v},latest:{get:c}}),Object.defineProperty(D,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(D,Symbol.for("signal"),{value:!0,enumerable:!0}),[D,{mutate:l,refetch:()=>{P=!0,C(void 0)}}]}function gt(e,t=300){let[r,n]=d(e),[o,s]=d(e),[i,a]=d(!1),c,l=()=>{c!==void 0&&(clearTimeout(c),c=void 0)},v=()=>{l();let b=g(r);return s(()=>b),a(!1),b},p=(b=>{let m=typeof b=="function"?b(g(r)):b;return n(()=>m),a(!0),l(),c=setTimeout(v,t),m});return S(l),[o,p,{immediate:r,pending:i,flush:v,cancel:()=>{l(),a(!1)}}]}function Yn(e){return e!=null&&e!==""}function Cr(e,t,r={}){let{delay:n=300,initialValue:o,shouldFetch:s=Yn}=r,[i,a,c]=gt(e,n),l=()=>s(i())?i():!1,[v,{refetch:p}]=de(l,t,o===void 0?{}:{initialValue:o});return[v,{...c,query:i,setQuery:a,refetch:p}]}function Ge(e){if(typeof e=="function"&&!e.length){let t=e();return $e(t)?t:Ge(t)}if(Array.isArray(e)){let t=[];for(let r=0;r<e.length;r++){let n=Ge(e[r]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function Pr(e){let t=h(e);return Ke?h(()=>Ge(t()),void 0,{name:"children"}):h(()=>Ge(t()))}var We=L();cr((e,t)=>{let r=Me(t,We);r&&(r.increment(),e.finally(()=>r.decrement()))});function Dr(){let[e,t]=d(0),r=0;return{increment:()=>t(r+=1),decrement:()=>t(r-=1),inFallback:()=>e()>0}}function Ir(e,t){return ce(We,e,t)}var jr=L();lr((e,t)=>{let r=Me(t,jr);return r?(r.setError(e),!0):!1});function Fr(){let[e,t]=d(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:n=>t(()=>n)}}function Ur(e,t){return ce(jr,e,t)}var Mr={State:ae,Computed:V,subtle:{Watcher:ue,untrack:ge,currentComputed:or,hasSinks:sr}};var Xn=Symbol.for("signal"),Jn=Symbol.for("fluixi-proxy");function Qn(e,t){let[r,n]=d(e,t);return Object.assign(r,{set:n})}function Zn(e,t,r){return h(e,t,r)}function eo(e,t){return E(e,t)}function to(e){return q(e)}function ro(e,t){return Be(e,t)}function no(e,t){qe(e,t)}function oo(e,t){return L(e,t)}function so(e){return Ue(e)}function Nr(...e){let[t,r]=de(...e);return Object.assign(t,r)}var Rt="1.0.0-alpha.85",Vr=Rt.split(".")[0],qr=`__fluixi_signal_state_v${Vr}__`,io=`__fluixi_signal_builds_v${Vr}__`,ao=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function Lr(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:ao,onSuspend:null,onError:null,observer:null}}var wt=globalThis;function uo(e){let t=Lr(),r=e;for(let n of Object.keys(t))n in e||(r[n]=t[n]);return e}function co(){let e=wt[qr];return e?uo(e):wt[qr]=Lr()}var f=co();(wt[io]??=[]).push(Rt);function fo(e){return f.observer=e,()=>{f.observer===e&&(f.observer=null)}}var pe=[],lo;function At(e){let t=f.observer;t&&t.created(e.parents===void 0?{...e,parents:pe,origin:e.origin??lo}:e)}function po(e){return f.observer?(pe.push(e),!0):!1}function ho(){pe.pop()}function yo(e){f.observer?.ran?.(e)}function bo(e,t){f.observer?.wrote?.(e,t)}function vo(e){f.observer?.contextCreated?.(e)}function mo(e,t,r){let n=f.observer;!n?.context||!pe.length||n.context(pe[pe.length-1],e,t,r)}function kt(e){f.observer?.disposed?.(e)}var To="__FLUIXI_DEVTOOLS_HOOK__",Br=globalThis[To];if(typeof Br?.inject=="function")try{Br.inject({observeReactiveNodes:fo,version:Rt})}catch{}function Hr(){return f.observer!=null}var Kr=0,$r=1,Ae=2,Gr=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(f.untracked)return;let e=f.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},So=class extends Gr{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,bo(this,f.consumer),this.observers)for(let t of[...this.observers])t.markDirty(Ae);xt(this)}}peek(){return this._value}},Wr=class extends Gr{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=Ae,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(f.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}updateIfNecessary(){if(this.state===$r&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Ae)break}(this.state===Ae||!this._initialized)&&this.recompute(),this.state=Kr}recompute(){if(this.sources){for(let a of this.sources)a.observers?.delete(this);this.sources.clear()}let e=f.consumer,t=f.untracked,r=po(this);f.consumer=this,f.untracked=!1;let n,o=!1,s;try{n=this._fn()}catch(a){o=!0,s=a,n=this._value}finally{f.consumer=e,f.untracked=t,r&&ho()}let i=!this._initialized||this._threw!==o||(o?s!==this._error:!this._equals(this._value,n));if(this._initialized=!0,this._threw=o,this._error=s,this._value=n,yo(this),i){if(this.version++,this.observers)for(let a of[...this.observers])a.markDirty(Ae);xt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Kr;if(this.state=e,t){if(this.observers)for(let r of[...this.observers])r.markDirty($r);xt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function xt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var go=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function wo(e){if(f.untracked)return e();f.untracked=!0;try{return e()}finally{f.untracked=!1}}function zr(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Yr(e,t){let r=Symbol(t??"context");return vo(r),{id:r,defaultValue:e,Provider:o=>{mo(r,"provide",o.value);let s=f.owner,i=zr(s);(i.contexts=new Map).set(r,o.value),s&&(s.owned??=[]).push(i),f.owner=i;try{return o.children}finally{f.owner=s}}}}function Xr(e,t){let r=e;for(;r;){if(r.contexts&&r.contexts.has(t.id))return r.contexts.get(t.id);r=r.parent}return t.defaultValue}function xo(e){f.onSuspend=e}function Oo(e){return f.onSuspend?(f.onSuspend(e,f.owner),!0):!1}function Ro(e){f.onError=e}function Ao(){return f.owner}function Jr(e,t){let r=f.owner;f.owner=e;try{return t()}finally{f.owner=r}}function Qr(e){if(f.owner){if(f.owner.disposed){e();return}(f.owner.cleanups??=[]).push(e)}}function Ot(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)Ot(e.owned[r]);e.owned=null}if(e.cleanups){for(let r=e.cleanups.length-1;r>=0;r--)e.cleanups[r]();e.cleanups=null}t&&(e.disposed=!0)}}function ko(e){f.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function _o(e){e.queued||(e.queued=!0,f.queue.push(e),!f.scheduled&&f.batchDepth===0&&(f.scheduled=!0,f.hostSchedule(_t)))}function _t(){if(f.scheduled=!1,f.flushing)return;f.flushing=!0;let e=0;try{for(;f.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=f.queue;f.queue=[];for(let r of t)r.queued=!1,r.disposed||r.run()}}finally{f.flushing=!1}}function Eo(){f.batchDepth===0&&_t()}function Co(e){f.batchDepth++;try{return e()}finally{--f.batchDepth===0&&_t()}}var Po=class{constructor(e,t=!1){this.queued=!1,this.disposed=!1,this.owner=zr(f.owner),f.owner&&(f.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new Wr(()=>{Ot(this.owner,!1),Jr(this.owner,()=>{let r=e();typeof r=="function"&&(this.owner.cleanups??=[]).push(r)})}),At({kind:"effect",node:this.computed,handle:this,internal:!t}),this.watcher=new go(()=>_o(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&f.onSuspend){f.onSuspend(e,this.owner);return}if(f.onError&&f.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,kt(this.computed),this.watcher.unwatch(this.computed),Ot(this.owner))}};function Do(e,t=!1){let r=new Po(e,t);return()=>r.dispose()}function Io(e){return!!e&&typeof e.then=="function"}ko(()=>{});var Zr=Symbol.for("signal"),jo=Symbol.for("memo"),Fo=Symbol.for("signal-node");function Et(e,t){let r=new So(e,{equals:t?.equals}),n=(()=>r.get()),o=(s=>{let i=typeof s=="function"?s(r.peek()):s;return r.set(i),Eo(),i});return Object.defineProperty(n,Zr,{value:!0,enumerable:!0}),Object.defineProperty(n,Fo,{value:{get value(){return r.peek()},get version(){return r.version}},enumerable:!1}),At({kind:"signal",node:r,handle:n,name:t?.name,set:o}),Hr()&&Qr(()=>kt(r)),[n,o]}function ze(e,t,r){let n=t,o=Ao(),s=new Wr(()=>Jr(o,()=>{try{return n=e(n)}catch(a){if(Io(a))return Oo(a),n;throw a}}),{equals:r?.equals}),i=(()=>s.get());return Object.defineProperty(i,Zr,{value:!0,enumerable:!0}),Object.defineProperty(i,jo,{value:!0,enumerable:!0}),At({kind:"memo",node:s,handle:i,name:r?.name}),Hr()&&Qr(()=>kt(s)),i}function ke(e,t){let r=t;return Do(()=>{r=e(r)},!0)}function Ct(e){return Co(e)}function en(e){return wo(e)}var Bi=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var Uo=Yr();xo((e,t)=>{let r=Xr(t,Uo);r&&(r.increment(),e.finally(()=>r.decrement()))});var Mo=Yr();Ro((e,t)=>{let r=Xr(t,Mo);return r?(r.setError(e),!0):!1});var Ye=Symbol.for("fluixi-proxy");var ye=Symbol("store-raw"),J=Symbol("store-node"),tn=Symbol("store-has"),Qe=Symbol("store-self"),Ze=Symbol("store-track"),an=Symbol("store-name"),un=Symbol("store-store"),_e=new WeakMap,Pt=new WeakMap,be=new WeakMap,et=new WeakMap;function No(e,t){if(!he(e)||!ie())return;let r=new Set,n=i=>{if(!(!he(i)||r.has(i))){r.add(i);for(let a of Object.values(i))n(a)}};n(et.get(t)??t);let o=new Set,s=i=>{if(!he(i))return;let a=i;if(r.has(a)||o.has(a))return;o.add(a);let c=_e.get(a);if(c){for(let l of c.keys.values())$(l);c.all&&$(c.all),_e.delete(a),be.delete(a),Pt.delete(a)}for(let l of Object.values(a))s(l)};s(e)}var tt=(e,t,r)=>r?`${e}[${String(t)}]`:`${e}.${String(t)}`;function cn(e,t,r){let n=t?.owner,o=n&&r!==void 0?tt(n.name,r,t?.array):void 0,[s,i]=zt(n?.store,()=>Et(e,o?{name:o}:void 0)),a=s;return a.$=i,a}function rt(e){let t=_e.get(e);return t?t.owner||(t.owner=be.get(e)):_e.set(e,t={keys:new Map,owner:be.get(e),array:Array.isArray(e)}),t}function rn(e,t,r){let n=e.keys.get(t);return n||e.keys.set(t,n=cn(r,e,t)),n}function qo(e,t,r,n){let o=be.get(e);if(o&&o.store===t&&o.name===r)return;let s={store:t,name:r};be.set(e,s),et.set(e,et.get(n)??n);let i=_e.get(e);if(i&&(i.owner=s,!!ie())){for(let[a,c]of i.keys)ct(c,t,tt(r,a,i.array));i.all&&ct(i.all,t,tt(r,"*",i.array))}}function nn(e){let t=rt(e);(t.all||(t.all=cn(void 0,t,"*")))()}function on(e,t){e.$(typeof t=="function"?()=>t:t)}function he(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Xe(e){if(!he(e))return e;let t=Pt.get(e);if(t)return t;let r=new Proxy(e,Bo);return Pt.set(e,r),r}var Bo={get(e,t,r){if(t===ye||t===J)return e;if(t===Ye)return r;if(t===tn)return c=>c in e;if(t==="__proxy")return!0;if(t===Ze||t===Qe)return nn(e),r;let n=e[t];if(typeof n=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return n;let o=Object.getOwnPropertyDescriptor(e,t);if(o&&o.get)return o.get.call(r);let s=rt(e),i=rn(s,t,n),a=i();return he(a)?(s.owner&&qo(a,i,tt(s.owner.name,t,s.array),e),Xe(a)):a},set(){return!0},deleteProperty(e,t){return t in e&&j(e,t,void 0),!0},has(e,t){return t===ye||t===Ye||t===J||t===tn||t===Qe||t===Ze?!0:(rn(rt(e),t,e[t])(),t in e)},ownKeys(e){return nn(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function fn(e,t=new Set){if(e==null||typeof e!="object")return e;let r=e[ye]??e;if(t.has(r)||!he(r))return r;t.add(r);let n=!1,o=i=>{let a=fn(i,t);return a!==i&&(n=!0),a};if(Array.isArray(r)){let i=r.map(o);return n?i:r}let s={};for(let i of Object.keys(r))s[i]=o(r[i]);return n?s:r}function j(e,t,r){let n=fn(r),o=e[t];if(o===n&&(n!==void 0||t in e))return;let s=Array.isArray(e),i=s?e.length:0;n===void 0?delete e[t]:e[t]=n;let a=rt(e),c=a.keys.get(t);if(c&&on(c,n),No(o,e),s&&e.length!==i){let l=a.keys.get("length");l&&on(l,e.length)}a.all&&a.all.$(void 0)}function Dt(e,t){return typeof e=="function"?e(t):e}function It(e,t){for(let r of Object.keys(t)){let n=t[r],o=e[r];n&&typeof n=="object"&&!Array.isArray(n)&&o&&typeof o=="object"&&!Array.isArray(o)?It(o,n):j(e,r,n)}}function nt(e){let t=[],r=e.replace(/\[([^\]]*)\]/g,".$1");for(let n of r.split("."))n.length&&t.push(n);return t}function ln(e,t,r){let n=t.length-1;for(let s=0;s<n;s++){let i=t[s];if(i==="*"){let c=t.slice(s+1);if(Array.isArray(e))for(let l=0;l<e.length;l++)ln(e[l],c,r);return}let a=e[i];(a==null||typeof a!="object")&&(a=/^\d+$/.test(t[s+1])?[]:{},j(e,i,a)),e=a}let o=t[n];if(o==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)j(e,s,Dt(r,e[s]));return}j(e,o,Dt(r,e[o]))}function sn(e,t,r){ln(e,nt(t),r)}function Ko(e){return Array.isArray(e)&&e.length>0&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="string")}function Je(e,t){for(let r=e.length-1;r>=t.length;r--)j(e,String(r),void 0);e.length!==t.length&&j(e,"length",t.length);for(let r=0;r<t.length;r++)j(e,String(r),t[r])}function $o(e,t){let r=t[0];if(typeof r=="function"&&t.length===1){let n=r(e);n&&n!==e&&It(e,n);return}if(Array.isArray(r)&&t.length===1){if(Ko(r)){for(let n of r)sn(e,n[0],n[1]);return}if(Array.isArray(e)){Je(e,r);return}if(r.length===0)return;throw new TypeError("[fluixi] set() was given an array that is neither a batch of [path, value] pairs nor a replacement for an array root. Name the path you meant, as in set('items', [...]).")}if(r&&typeof r=="object"&&!Array.isArray(r)&&t.length===1){It(e,r);return}if(t.length>=3){jt(e,t.slice(0,-1),t[t.length-1]);return}sn(e,String(r),t[1])}function Vo(e,t){if(typeof t=="function"){if(!Array.isArray(e))return[];let r=[];for(let n=0;n<e.length;n++)t(e[n],n)&&r.push(n);return r}if(Array.isArray(t))return Array.isArray(e)?t.map(Number):t.map(String);if(t&&typeof t=="object"&&("from"in t||"to"in t||"by"in t)){if(!Array.isArray(e))return[];let r=t.by??1,n=t.from??0,o=t.to??e.length-1,s=[];for(let i=n;i<=o;i+=r)i>=0&&i<e.length&&s.push(i);return s}return t==="*"?Array.isArray(e)?e.map((r,n)=>n):Object.keys(e??{}):[t]}function jt(e,t,r){if(e==null)return;let[n,...o]=t;if(typeof n=="string"){let i=nt(n);if(i.length>1){jt(e,[...i,...o],r);return}}let s=Vo(e,n);if(o.length===0){for(let i of s)j(e,i,Dt(r,e[i]));return}for(let i of s){let a=e[i];if(a==null||typeof a!="object"){let c=o[0];a=typeof c=="number"||/^\d+$/.test(String(c))?[]:{},j(e,i,a)}jt(a,o,r)}}function Ft(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Ft);let t={};for(let r of Object.keys(e))t[r]=Ft(e[r]);return t}function H(e,t){let r=e;for(let n of nt(t)){if(r==null)return;r=r[n]}return r}var G=class{constructor(t,r={immutable:!0}){this.options=r;this.root=t,this.set=((...n)=>Ct(()=>$o(this.root,n))),t&&typeof t=="object"&&(be.set(t,{store:this,name:r.name??"store"}),et.set(t,t)),X({kind:"store",node:this,handle:()=>this.root,name:r.name})}get state(){return Xe(this.root)}get proxy(){return Xe(this.root)}get accessor(){return(()=>Xe(this.root))}unwrap(){return this.root}getNode(t){return this.root&&this.root[t]}get(t){if(t==null||t==="")return ve(this.state);let r=this.state;for(let n of nt(t)){if(r==null)return;r=r[n]}return ve(r)}select(t){return ze(()=>t(this.state))}subscribe(t){return ke(()=>t(this.state))}watch(t,r){let n;return ke(()=>{let o=t(this.state);Object.is(o,n)||(r(o,n),n=o)})}reactive(t){return ze(()=>this.state[t])}produce(t){this.set((r=>{let n=Ft(r);return t(n),n}))}reconcile(t,r={}){this.set(t)}push(t,...r){let n=H(this.root,t);this.set(t,n.concat(r))}pop(t){let r=H(this.root,t).slice(),n=r.pop();return this.set(t,r),n}shift(t){let r=H(this.root,t).slice(),n=r.shift();return this.set(t,r),n}splice(t,r,n,...o){let s=H(this.root,t).slice(),i=s.splice(r,n,...o);return this.set(t,s),i}insert(t,r,n){let o=H(this.root,t).slice();o.splice(r,0,n),this.set(t,o)}removeAt(t,r){let n=H(this.root,t).slice(),o=n.splice(r,1);return this.set(t,n),o}replace(t,r){if(arguments.length>=2){let o=H(this.root,String(t)),s=r;if(Array.isArray(o)&&Array.isArray(s)){Je(o,s);return}this.set(t,s);return}let n=this.root;if(Array.isArray(n)&&Array.isArray(t)){Je(n,t);return}this.set(t)}clear(t){let r=t===void 0?this.root:H(this.root,t);if(Array.isArray(r)){Je(r,[]);return}if(r&&typeof r=="object")for(let n of Object.keys(r))j(r,n,void 0)}toObservable(){let[t]=Et(this.state);return t.toObservable()}dispose(){}},Lo=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","replace","clear","unwrap","toObservable"];function dn(e,t){for(let r of Lo)e[r]=t[r].bind(t);e.$=t.reactive.bind(t)}function Ee(e,t={immutable:!0}){let r=new G(e,t);return dn(r.set,r),[r.proxy,r.set]}function Ut(e,t={}){return new G(e,{...t,immutable:!1})}function pn(e,t={}){let r=new G(e(),t);return ke(()=>r.set(e())),r}function hn(e,t,r){return ke(()=>r(t(e)))}function yn(e,t,r){return ze(()=>t(e),void 0,r)}function bn(e,t={}){let r=new G(e,t),n=(()=>r.proxy);return dn(n,r),n}function ve(e){if(e==null||typeof e!="object")return e;let t=e[ye];return t!==void 0?t:e}function Mt(e){return en(()=>ve(e))}function vn(e){return ot(e)}function mn(e){return ot(e)?e[J]:null}function Tn(e){return e&&typeof e=="object"&&J in e?e[J]:null}function ot(e){return!!e&&typeof e=="object"&&(Ye in e||e.__proxy===!0)}function Sn(e){return e}var gn=Object.freeze({createStore:Ee,createMutableStore:Ut,batch:Ct,unwrap:ve,untrackStore:Mt});function Nt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Nt);let t={};for(let r of Object.keys(e))t[r]=Nt(e[r]);return t}function wn(e){return t=>{let r=Nt(t);return e(r),r}}function xn(e,t={}){return()=>e}function On(e,t){let[r,n]=Ee(e,t);return new Proxy(r,{get:(o,s)=>s==="set"?n:o[s],has:(o,s)=>s==="set"||Reflect.has(o,s)})}function Ho(e,t,r){return h(()=>t(e()),void 0,r)}function Go(e,t,r){return h(()=>e().filter(t),void 0,r)}function Wo(e,t,r,n){return h(()=>e().reduce(t,r),void 0,n)}function zo(e,t,r){return h(()=>e().find(t),void 0,r)}function Yo(e,t,r){return h(()=>e().some(t),void 0,r)}function Xo(e,t,r){return h(()=>e().every(t),void 0,r)}function Jo(e,t,r){return h(()=>[...e()].sort(t),void 0,r)}function Qo(e,t){return h(()=>[...new Set(e())],void 0,t)}function Zo(e,t,r){return h(()=>{let n=e.map(o=>o());return t(n)},void 0,r)}function es(...e){return new K(t=>{let r=()=>e.map(o=>typeof o=="function"?o():o.get()),n=e.map(o=>typeof o=="function"&&o.subscribe?o.subscribe(()=>{t.next(r())}):typeof o!="function"?o.subscribe(()=>{t.next(r())}):E(()=>{t.next(r())}));return()=>{n.forEach(o=>{typeof o=="function"?o():o&&typeof o.unsubscribe=="function"&&o.unsubscribe()})}})}function ts(e,t,r){return h(()=>e()||t(),void 0,r)}function rs(e,t,r,n){return h(()=>r(e(),t()),void 0,n)}function ns(e,t,r){return h(()=>t(e()),void 0,{equals:r,internal:!0})}function os(e,t,r){return h(()=>{let n=e(),o={};for(let s of t)o[s]=n[s];return o},void 0,r)}function ss(e,t,r){return h(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,r)}function is(e,t,r,n){return h(()=>e()?t():r(),void 0,n)}function as(e,t,r){return h(()=>e()?t():void 0,void 0,r)}function us(e,t,r){let[n,o]=d(e()),s;return h(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),n}function cs(e,t,r){let[n,o]=d(e()),s=0,i;return h(()=>{let a=e(),c=Date.now();c-s>=t?(s=c,o(()=>a)):(clearTimeout(i),i=setTimeout(()=>{s=Date.now(),o(()=>a)},t-(c-s)))}),n}function fs(e){let t=e;for(;typeof t=="function";)t=t();return t}var Z=new Map,Q=new Map,ls=0,ds=Symbol.for("signal"),ps=Symbol.for("resource");function hs(e,t,r={}){let n,o,s;typeof t=="function"?(n=e,o=t,s=r):(n=()=>!0,o=e,s=t??r);let{ttl:i=1/0,name:a=`_auto_${ls++}`,staleWhileRevalidate:c=!0}=s,l=a,v=y=>`${l}:${JSON.stringify(y)}`,p=y=>i===1/0||Date.now()-y.timestamp<=i,[b,m]=d(void 0,{equals:!1}),[O,T]=d("unresolved",{equals:!1}),[U,C]=d(void 0,{equals:!1}),[M,P]=d(void 0,{equals:!1}),[ee,D]=d(!1),[R,I]=d(0,{equals:!1}),B=Symbol("unset"),W=B,me=!1,te=!1;function F(y,k,_,N){if(Q.has(k)){Q.get(k).then(w=>{N()||z(w,_)},w=>{!N()&&!_&&qt(w)}),_||P(Q.get(k));return}let Te=Promise.resolve(o(y)).then(w=>(Z.set(k,{value:w,timestamp:Date.now()}),Q.delete(k),w),w=>{throw Q.delete(k),w});Q.set(k,Te),_||(le(Te),P(Te)),Te.then(w=>{N()||z(w,_)},w=>{!N()&&!_&&qt(w)})}function z(y,k){x(()=>{m(()=>y),T("ready"),D(!1),P(void 0),C(void 0)})}function qt(y){x(()=>{C(y),T("errored"),P(void 0)})}E(()=>{let y=n();if(R(),y===!1||y===null||y===void 0){W=B,x(()=>{T("unresolved"),P(void 0),C(void 0)});return}let k=me,_=te;me=!1,te=!1;let N=v(y);_&&Z.delete(N);let Te=W===B||y!==W;W=y;let w=!1;S(()=>{w=!0});let re=Z.get(N);if(re&&p(re)&&!k&&!_){(g(O)!=="ready"||g(b)!==re.value)&&x(()=>{m(()=>re.value),T("ready"),D(!1),C(void 0)});return}if(re&&c&&!_){x(()=>{m(()=>re.value),T("ready"),D(!0),C(void 0),P(void 0)}),F(y,N,!0,()=>w);return}let Bt=g(O),Rn=Bt==="ready"||Bt==="refreshing";x(()=>{T(Rn?"refreshing":"pending"),C(void 0),D(!1)}),F(y,N,!1,()=>w)});let Ce=(()=>{let y=U();if(y)throw y;if(O()==="pending"){let _=M();if(_)throw _}return b()});return Object.defineProperty(Ce,ps,{value:!0,enumerable:!0}),Object.defineProperty(Ce,ds,{value:!0,enumerable:!0}),Object.defineProperties(Ce,{state:{get:O},loading:{get:()=>{let y=O();return y==="pending"||y==="refreshing"}},error:{get:U},latest:{get:b},stale:{get:ee}}),[Ce,{mutate:m,refetch:()=>{me=!0,I(y=>y+1)},invalidate:()=>{let y=g(n);y!=null&&y!==!1&&Z.delete(v(y)),te=!0,I(k=>k+1)}}]}function ys(e){let t=`${e}:`;for(let r of Z.keys())r.startsWith(t)&&Z.delete(r)}function bs(){Z.clear(),Q.clear()}return Pn(vs);})();
|