@fluixi/reactive 1.0.0-alpha.84 → 1.0.0-alpha.86
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 +52 -3
- package/dist/cdn/reactive.global.js +2 -2
- package/dist/cdn/reactive.mjs +52 -3
- package/dist/cdn/signal.cjs +1 -1
- package/dist/cdn/signal.global.js +2 -2
- package/dist/cdn/signal.mjs +1 -1
- package/dist/index.cjs +52 -3
- package/dist/index.mjs +52 -3
- package/dist/lib/index.cjs +53 -4
- package/dist/lib/index.mjs +53 -4
- package/dist/lib/observable/index.cjs +1 -1
- package/dist/lib/observable/index.mjs +1 -1
- package/dist/lib/signal/api.cjs +1 -1
- package/dist/lib/signal/api.mjs +1 -1
- package/dist/lib/signal/cached-resource.cjs +2 -2
- package/dist/lib/signal/cached-resource.mjs +2 -2
- package/dist/lib/signal/graph/children.cjs +1 -1
- package/dist/lib/signal/graph/children.mjs +1 -1
- package/dist/lib/signal/graph/compat.cjs +2 -2
- package/dist/lib/signal/graph/compat.mjs +2 -2
- package/dist/lib/signal/graph/core.cjs +2 -2
- package/dist/lib/signal/graph/core.mjs +2 -2
- package/dist/lib/signal/graph/debounced.cjs +1 -1
- package/dist/lib/signal/graph/debounced.mjs +1 -1
- package/dist/lib/signal/graph/derived.cjs +1 -1
- package/dist/lib/signal/graph/derived.mjs +1 -1
- package/dist/lib/signal/graph/error-boundary.cjs +1 -1
- package/dist/lib/signal/graph/error-boundary.mjs +1 -1
- package/dist/lib/signal/graph/index.cjs +2 -2
- package/dist/lib/signal/graph/index.mjs +2 -2
- package/dist/lib/signal/graph/observe.cjs +1 -1
- package/dist/lib/signal/graph/observe.mjs +1 -1
- package/dist/lib/signal/graph/resource.cjs +1 -1
- package/dist/lib/signal/graph/resource.mjs +1 -1
- package/dist/lib/signal/graph/runtime.cjs +1 -1
- package/dist/lib/signal/graph/runtime.mjs +1 -1
- package/dist/lib/signal/graph/signal-next.cjs +2 -2
- package/dist/lib/signal/graph/signal-next.mjs +2 -2
- package/dist/lib/signal/graph/state.cjs +1 -1
- package/dist/lib/signal/graph/state.mjs +1 -1
- package/dist/lib/signal/graph/suspense.cjs +1 -1
- package/dist/lib/signal/graph/suspense.mjs +1 -1
- package/dist/lib/signal/index-legacy.cjs +2 -2
- package/dist/lib/signal/index-legacy.mjs +2 -2
- package/dist/lib/signal/index.cjs +2 -2
- package/dist/lib/signal/index.mjs +2 -2
- package/dist/lib/signal/list.cjs +1 -1
- package/dist/lib/signal/list.mjs +1 -1
- package/dist/lib/signal/resource-api.cjs +1 -1
- package/dist/lib/signal/resource-api.d.ts +14 -22
- package/dist/lib/signal/resource-api.d.ts.map +1 -1
- package/dist/lib/signal/resource-api.mjs +1 -1
- package/dist/lib/signal/signal.cjs +1 -1
- package/dist/lib/signal/signal.mjs +1 -1
- package/dist/lib/signal/utilities.cjs +2 -2
- package/dist/lib/signal/utilities.mjs +2 -2
- package/dist/lib/store/api.cjs +52 -3
- package/dist/lib/store/api.mjs +52 -3
- package/dist/lib/store/index.cjs +53 -4
- package/dist/lib/store/index.mjs +53 -4
- package/dist/lib/store/store.cjs +52 -3
- package/dist/lib/store/store.d.ts.map +1 -1
- package/dist/lib/store/store.js +90 -3
- package/dist/lib/store/store.mjs +52 -3
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/version.generated.cjs +2 -2
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/version.generated.mjs +2 -2
- package/package.json +2 -2
package/dist/cdn/reactive.cjs
CHANGED
|
@@ -150,7 +150,7 @@ __export(reactive_exports, {
|
|
|
150
150
|
module.exports = __toCommonJS(reactive_exports);
|
|
151
151
|
|
|
152
152
|
// src/version.generated.ts
|
|
153
|
-
var VERSION = "1.0.0-alpha.
|
|
153
|
+
var VERSION = "1.0.0-alpha.86";
|
|
154
154
|
|
|
155
155
|
// src/lib/predicates.ts
|
|
156
156
|
function isFunction(value) {
|
|
@@ -2030,12 +2030,61 @@ function applySet(root2, args) {
|
|
|
2030
2030
|
mergeInto(root2, first);
|
|
2031
2031
|
return;
|
|
2032
2032
|
}
|
|
2033
|
-
if (
|
|
2034
|
-
|
|
2033
|
+
if (args.length >= 3) {
|
|
2034
|
+
setDeep(root2, args.slice(0, -1), args[args.length - 1]);
|
|
2035
2035
|
return;
|
|
2036
2036
|
}
|
|
2037
2037
|
applyPath(root2, String(first), args[1]);
|
|
2038
2038
|
}
|
|
2039
|
+
function selectKeys(current, selector) {
|
|
2040
|
+
if (typeof selector === "function") {
|
|
2041
|
+
if (!Array.isArray(current)) return [];
|
|
2042
|
+
const keys = [];
|
|
2043
|
+
for (let i = 0; i < current.length; i++) if (selector(current[i], i)) keys.push(i);
|
|
2044
|
+
return keys;
|
|
2045
|
+
}
|
|
2046
|
+
if (Array.isArray(selector)) {
|
|
2047
|
+
return Array.isArray(current) ? selector.map(Number) : selector.map(String);
|
|
2048
|
+
}
|
|
2049
|
+
if (selector && typeof selector === "object" && ("from" in selector || "to" in selector || "by" in selector)) {
|
|
2050
|
+
if (!Array.isArray(current)) return [];
|
|
2051
|
+
const by = selector.by ?? 1;
|
|
2052
|
+
const from = selector.from ?? 0;
|
|
2053
|
+
const to = selector.to ?? current.length - 1;
|
|
2054
|
+
const keys = [];
|
|
2055
|
+
for (let i = from; i <= to; i += by) if (i >= 0 && i < current.length) keys.push(i);
|
|
2056
|
+
return keys;
|
|
2057
|
+
}
|
|
2058
|
+
if (selector === "*") {
|
|
2059
|
+
return Array.isArray(current) ? current.map((_, i) => i) : Object.keys(current ?? {});
|
|
2060
|
+
}
|
|
2061
|
+
return [selector];
|
|
2062
|
+
}
|
|
2063
|
+
function setDeep(current, selectors, value) {
|
|
2064
|
+
if (current == null) return;
|
|
2065
|
+
const [head, ...rest] = selectors;
|
|
2066
|
+
if (typeof head === "string") {
|
|
2067
|
+
const parts = parsePath(head);
|
|
2068
|
+
if (parts.length > 1) {
|
|
2069
|
+
setDeep(current, [...parts, ...rest], value);
|
|
2070
|
+
return;
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
const keys = selectKeys(current, head);
|
|
2074
|
+
if (rest.length === 0) {
|
|
2075
|
+
for (const key of keys) writeKey(current, key, nextValue(value, current[key]));
|
|
2076
|
+
return;
|
|
2077
|
+
}
|
|
2078
|
+
for (const key of keys) {
|
|
2079
|
+
let next = current[key];
|
|
2080
|
+
if (next == null || typeof next !== "object") {
|
|
2081
|
+
const lookahead = rest[0];
|
|
2082
|
+
next = typeof lookahead === "number" || /^\d+$/.test(String(lookahead)) ? [] : {};
|
|
2083
|
+
writeKey(current, key, next);
|
|
2084
|
+
}
|
|
2085
|
+
setDeep(next, rest, value);
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2039
2088
|
function clone(value) {
|
|
2040
2089
|
if (value == null || typeof value !== "object") return value;
|
|
2041
2090
|
if (Array.isArray(value)) return value.map(clone);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @fluixi/reactive v1.0.0-alpha.
|
|
2
|
-
"use strict";var Fluixi=(()=>{var ot=Object.defineProperty;var Rn=Object.getOwnPropertyDescriptor;var kn=Object.getOwnPropertyNames;var An=Object.prototype.hasOwnProperty;var _n=(e,t)=>{for(var r in t)ot(e,r,{get:t[r],enumerable:!0})},En=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of kn(t))!An.call(e,o)&&o!==r&&ot(e,o,{get:()=>t[o],enumerable:!(n=Rn(t,o))||n.enumerable});return e};var Cn=e=>En(ot({},"__esModule",{value:!0}),e);var ys={};_n(ys,{$NAME:()=>sn,$NODE:()=>J,$PROXY:()=>Xn,$RAW:()=>ye,$SELF:()=>Qe,$SIGNAL:()=>Yn,$STORE:()=>un,$TRACK:()=>Ze,Observable:()=>$,SafeSubscriber:()=>Pe,Signal:()=>Ur,Store:()=>G,StoreAPI:()=>Sn,Subject:()=>it,Subscriber:()=>oe,Subscription:()=>ne,SuspenseContext:()=>We,VERSION:()=>Y,__DEV__:()=>$e,batch:()=>x,childOwner:()=>oo,clearAllCachedResources:()=>hs,clearCachedResourceNamespace:()=>ps,combineSignal:()=>Jo,combineSignals:()=>Qo,computed:()=>ro,context:()=>no,createCachedResource:()=>ds,createChildOwner:()=>Ue,createComputed:()=>qe,createComputedStore:()=>dn,createContext:()=>L,createDebounce:()=>_r,createDebouncedResource:()=>Er,createDebouncedSignal:()=>St,createDeferred:()=>Ar,createEffect:()=>E,createErrorBoundary:()=>jr,createMemo:()=>h,createMutableStore:()=>Ft,createRenderEffect:()=>Be,createResource:()=>de,createRoot:()=>N,createSelector:()=>kr,createSignal:()=>d,createStore:()=>Ee,createStoreEffect:()=>pn,createStoreMemo:()=>hn,createSuspenseBoundary:()=>Pr,debounceSignal:()=>is,disposeScope:()=>sr,distinctSignal:()=>Xo,effect:()=>Zn,everySignal:()=>zo,filterSignal:()=>Lo,findSignal:()=>Go,flush:()=>yr,getNode:()=>bn,getOwner:()=>Oe,getServerData:()=>Ve,getStoreNode:()=>mn,guardSignal:()=>ss,indexArray:()=>Kn,isComponent:()=>Tr,isMemo:()=>br,isOwnerDisposed:()=>ir,isProvider:()=>wr,isResource:()=>mr,isSignal:()=>Ke,isStore:()=>vn,isStoreProxy:()=>nt,isSuspense:()=>Sr,joinedVersions:()=>Ht,keyArray:()=>$n,makeArrayFlat:()=>ht,mapArray:()=>Bn,mapSignal:()=>Vo,memo:()=>Qn,mergeSignal:()=>Zo,modifiable:()=>Tn,nextResourceId:()=>Le,observeReactiveNodes:()=>ut,omitSignal:()=>ns,on:()=>vr,onCleanup:()=>S,operate:()=>Pn,pickSignal:()=>rs,produceUtil:()=>wn,provide:()=>ce,provideErrorBoundary:()=>Fr,provideSuspense:()=>Dr,readChildren:()=>Cr,readSignal:()=>as,reconcileUtil:()=>gn,reduceSignal:()=>Ho,renderEffect:()=>to,reportReactiveBinding:()=>Qt,reportReactiveContext:()=>se,reportReactiveContextCreated:()=>je,reportReactiveDirective:()=>er,reportReactiveProps:()=>Zt,reportResourceData:()=>He,resource:()=>Mr,root:()=>eo,runWithOwner:()=>le,selectSignal:()=>ts,setOwner:()=>ft,setResourceDataSink:()=>Rr,setResourceIdSource:()=>Or,setResourceTracker:()=>gr,setServerDataGetter:()=>xr,signal:()=>Jn,someSignal:()=>Wo,sortSignal:()=>Yo,startTransition:()=>pt,store:()=>xn,throttleSignal:()=>us,trackResourcePromise:()=>fe,untrack:()=>w,untrackStore:()=>Ut,unwrap:()=>be,useContext:()=>ur,useTransition:()=>hr,whenSignal:()=>os,wrap:()=>yn,zipSignal:()=>es});var Y="1.0.0-alpha.84";function st(e){return typeof e=="function"&&!/^class\s/.test(Function.prototype.toString.call(e))}function Bt(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(st(n)&&!(n instanceof e))try{n()}catch(o){console.error("Error in unsubscribe function:",o)}else if(Bt(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(st(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 Pn(e){return new oe(e.next,e.error,e.complete)}var $=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 it=class extends ${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 $(n=>this.subscribe(n))}};var Kt=Y.split(".")[0],$t=`__fluixi_signal_state_v${Kt}__`,Vt=`__fluixi_signal_builds_v${Kt}__`,Dn=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function Lt(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Dn,onSuspend:null,onError:null,observer:null}}var De=globalThis;function In(e){let t=Lt(),r=e;for(let n of Object.keys(t))n in e||(r[n]=t[n]);return e}function jn(){let e=De[$t];return e?In(e):De[$t]=Lt()}var u=jn();(De[Vt]??=[]).push(Y);function Ht(){return[...new Set(De[Vt]??[])]}function ut(e){return u.observer=e,()=>{u.observer===e&&(u.observer=null)}}var k=[],Ie;function Wt(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:k,origin:e.origin??Ie}:e)}function zt(e){return u.observer?(k.push(e),!0):!1}function Yt(){k.pop()}function Xt(e){u.observer?.ran?.(e)}function Jt(e,t){u.observer?.wrote?.(e,t)}function Qt(e,t,r,n){let o=u.observer;!o?.bound||!k.length||o.bound(k[k.length-1],e,t,r,n)}function Zt(e){let t=u.observer;!t?.props||!k.length||!e||t.props(k[k.length-1],e)}function er(e,t,r,n){let o=u.observer;!o?.directive||!k.length||o.directive(k[k.length-1],e,t,r,n)}function je(e){u.observer?.contextCreated?.(e)}function se(e,t,r){let n=u.observer;!n?.context||!k.length||n.context(k[k.length-1],e,t,r)}function at(e,t,r){u.observer?.moved?.(e,t,r)}function K(e){u.observer?.disposed?.(e)}var Fn="__FLUIXI_DEVTOOLS_HOOK__",Gt=globalThis[Fn];if(typeof Gt?.inject=="function")try{Gt.inject({observeReactiveNodes:ut,version:Y})}catch{}function ie(){return u.observer!=null}var tr=0,rr=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))}},ue=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++,Jt(this,u.consumer),this.observers)for(let r of[...this.observers])r.markDirty(Se);ct(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===rr&&this.sources){for(let r of this.sources)if(r.updateIfNecessary(),this.state===Se)break}(this.state===Se||!this._initialized)&&this.recompute(),this.state=tr}recompute(){if(this.sources){for(let f of this.sources)f.observers?.delete(this);this.sources.clear()}let r=u.consumer,n=u.untracked,o=zt(this);u.consumer=this,u.untracked=!1;let s,i=!1,a;try{s=this._fn()}catch(f){i=!0,a=f,s=this._value}finally{u.consumer=r,u.untracked=n,o&&Yt()}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,Xt(this),c){if(this.version++,this.observers)for(let f of[...this.observers])f.markDirty(Se);ct(this)}}markDirty(r){if(this.state>=r)return;let n=this.state===tr;if(this.state=r,n){if(this.observers)for(let o of[...this.observers])o.markDirty(rr);ct(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function ct(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var ae=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 we(e){if(u.untracked)return e();u.untracked=!0;try{return e()}finally{u.untracked=!1}}function nr(){return u.consumer}function or(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 sr(e,t=!0){ge(e,t)}function ir(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 ar(e){u.onSuspend=e}function cr(e){return u.onSuspend?(u.onSuspend(e,u.owner),!0):!1}function lr(e){u.onError=e}function Oe(){return u.owner}function ft(e){let t=u.owner;return u.owner=e,t}function le(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 ge(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)ge(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 N(e){let t=xe(u.owner);u.owner&&(u.owner.owned??=[]).push(t);let r=u.owner;u.owner=t;try{return e(()=>ge(t))}finally{u.owner=r}}function fr(e){u.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Un(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 dr(){u.batchDepth===0&&Re()}function dt(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(()=>{ge(this.owner,!1),le(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 ae(()=>Un(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,K(this.computed),this.watcher.unwatch(this.computed),ge(this.owner))}};function Ne(e,t=!1){let r=new lt(e,t);return()=>r.dispose()}function Mn(e){return!!e&&typeof e.then=="function"}fr(()=>{});var pr=Symbol.for("signal"),Nn=Symbol.for("memo"),qn=Symbol.for("signal-node");function d(e,t){let r=new ue(e,{equals:t?.equals}),n=(()=>r.get()),o=(s=>{let i=typeof s=="function"?s(r.peek()):s;return r.set(i),dr(),i});return Object.defineProperty(n,pr,{value:!0,enumerable:!0}),Object.defineProperty(n,qn,{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(()=>K(r)),[n,o]}function h(e,t,r){let n=t,o=Oe(),s=new V(()=>le(o,()=>{try{return n=e(n)}catch(a){if(Mn(a))return cr(a),n;throw a}}),{equals:r?.equals}),i=(()=>s.get());return Object.defineProperty(i,pr,{value:!0,enumerable:!0}),Object.defineProperty(i,Nn,{value:!0,enumerable:!0}),X({kind:"memo",node:s,handle:i,name:r?.name}),ie()&&S(()=>K(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 dt(e)}function w(e){return we(e)}function pt(e){return dt(e),Promise.resolve()}function hr(){return[()=>!1,pt]}function yr(){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(f=>f()):e();if(s){s=!1,o=a;return}let c=we(()=>t(a,o,i));return o=a,c}}function Bn(e,t,r){let n=[];return S(()=>{for(let o of n)o.dispose();n=[]}),h(()=>{let o=e()||[];return w(()=>{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 f=o[c],b=s.get(f);if(b&&!a.has(b))b.setIndex(c),i.push(b),a.add(b);else{let p,v,m;N(T=>{m=T;let[F,C]=d(c,{name:"row index"});v=C,p=t(f,F)});let O={item:f,rendered:p,dispose:m,setIndex:v};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 w(()=>{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=[],f=[],b=new Set;for(let p=0;p<i.length;p++){let v=t(i[p]),m=a.get(v);if(m&&!b.has(v))m.setIndex(p),c.push(m);else{let O,T,F;N(C=>{F=C;let[U,P]=d(p,{name:"row index"});T=P;let ee=h(D=>{let I=(e()||[])[U()];return I??D},i[p]);O=r(ee,U)}),c.push({rendered:O,dispose:F,setIndex:T})}f.push(v),b.add(v)}for(let[p,v]of a)b.has(p)||v.dispose();return o=f,s=c,c.map(p=>p.rendered)})},void 0,{name:"keyArray"})}function Kn(e,t,r){let n=[];return S(()=>{for(let o of n)o.dispose();n=[]}),h(()=>{let o=e()||[];return w(()=>{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 f,b,p,v=o[c];N(m=>{p=m;let[O,T]=d(v);b=T,f=t(O,c)}),n.push({rendered:f,setItem:b,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 Vn=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,$e=typeof process>"u"?Vn:!1,Ln=Symbol.for("signal"),Hn=Symbol.for("memo"),Gn=Symbol.for("resource");function Ke(e){return typeof e=="function"&&e[Ln]===!0}function br(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[Symbol.for("fluixi-component")]===!0}function Sr(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 ht(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?ht(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var yt=null;function gr(e){yt=e}function fe(e){yt&&yt(e)}var vt=null;function xr(e){vt=e}function Ve(e){return vt?vt(e):void 0}var bt=null;function Or(e){bt=e}function Le(){return bt?bt():void 0}var mt=null;function Rr(e){mt=e}function He(e,t){mt&&mt(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 Ar(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 _r(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 Wn(e){return!!e&&typeof e.then=="function"}var Tt=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,f]=d(i!==void 0?i.value:r.initialValue,{equals:!1}),[b,p]=d(void 0,{equals:!1}),[v,m]=d(i!==void 0||r.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[O,T]=d(void 0,{equals:!1}),[F,C]=d(void 0,{equals:!1}),U=Tt,P=!1;E(()=>{let R=n();if(F(),R===!1||R===null||R===void 0){U=Tt,x(()=>{m("unresolved"),T(void 0),p(void 0)});return}let I=P;if(P=!1,U!==Tt&&R===U&&!I)return;if(U=R,a){a=!1;return}let B=!1;S(()=>B=!0);let W=w(v),me=w(c),te=W==="ready"||W==="refreshing";x(()=>{m(te?"refreshing":"pending"),p(void 0)});try{let j=o(R,{value:me,refetching:te});Wn(j)?(T(j),fe(j),j.then(z=>{B||(s!==void 0&&He(s,z),x(()=>{f(()=>z),m("ready"),T(void 0)}))},z=>{B||x(()=>{p(z),m("errored"),T(void 0)})})):x(()=>{f(()=>j),m("ready"),T(void 0)})}catch(j){if(B)return;x(()=>{p(j),m("errored"),T(void 0)})}});let ee=()=>{let R=v();return R==="pending"||R==="refreshing"},D=(()=>{let R=b();if(R)throw R;if(ee()){let I=O();if(I)throw I}return c()});return Object.defineProperties(D,{state:{get:v},loading:{get:ee},error:{get:b},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:f,refetch:()=>{P=!0,C(void 0)}}]}function St(e,t=300){let[r,n]=d(e),[o,s]=d(e),[i,a]=d(!1),c,f=()=>{c!==void 0&&(clearTimeout(c),c=void 0)},b=()=>{f();let v=w(r);return s(()=>v),a(!1),v},p=(v=>{let m=typeof v=="function"?v(w(r)):v;return n(()=>m),a(!0),f(),c=setTimeout(b,t),m});return S(f),[o,p,{immediate:r,pending:i,flush:b,cancel:()=>{f(),a(!1)}}]}function zn(e){return e!=null&&e!==""}function Er(e,t,r={}){let{delay:n=300,initialValue:o,shouldFetch:s=zn}=r,[i,a,c]=St(e,n),f=()=>s(i())?i():!1,[b,{refetch:p}]=de(f,t,o===void 0?{}:{initialValue:o});return[b,{...c,query:i,setQuery:a,refetch:p}]}function Ge(e){if(typeof e=="function"&&!e.length){let t=e();return Ke(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 Cr(e){let t=h(e);return $e?h(()=>Ge(t()),void 0,{name:"children"}):h(()=>Ge(t()))}var We=L();ar((e,t)=>{let r=Me(t,We);r&&(r.increment(),e.finally(()=>r.decrement()))});function Pr(){let[e,t]=d(0),r=0;return{increment:()=>t(r+=1),decrement:()=>t(r-=1),inFallback:()=>e()>0}}function Dr(e,t){return ce(We,e,t)}var Ir=L();lr((e,t)=>{let r=Me(t,Ir);return r?(r.setError(e),!0):!1});function jr(){let[e,t]=d(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:n=>t(()=>n)}}function Fr(e,t){return ce(Ir,e,t)}var Ur={State:ue,Computed:V,subtle:{Watcher:ae,untrack:we,currentComputed:nr,hasSinks:or}};var Yn=Symbol.for("signal"),Xn=Symbol.for("fluixi-proxy");function Jn(e,t){let[r,n]=d(e,t);return Object.assign(r,{set:n})}function Qn(e,t,r){return h(e,t,r)}function Zn(e,t){return E(e,t)}function eo(e){return N(e)}function to(e,t){return Be(e,t)}function ro(e,t){qe(e,t)}function no(e,t){return L(e,t)}function oo(e){return Ue(e)}function Mr(...e){let[t,r]=de(...e);return Object.assign(t,r)}var Ot="1.0.0-alpha.84",Kr=Ot.split(".")[0],Nr=`__fluixi_signal_state_v${Kr}__`,so=`__fluixi_signal_builds_v${Kr}__`,io=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function Vr(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:io,onSuspend:null,onError:null,observer:null}}var wt=globalThis;function uo(e){let t=Vr(),r=e;for(let n of Object.keys(t))n in e||(r[n]=t[n]);return e}function ao(){let e=wt[Nr];return e?uo(e):wt[Nr]=Vr()}var l=ao();(wt[so]??=[]).push(Ot);function co(e){return l.observer=e,()=>{l.observer===e&&(l.observer=null)}}var pe=[],lo;function Rt(e){let t=l.observer;t&&t.created(e.parents===void 0?{...e,parents:pe,origin:e.origin??lo}:e)}function fo(e){return l.observer?(pe.push(e),!0):!1}function po(){pe.pop()}function ho(e){l.observer?.ran?.(e)}function yo(e,t){l.observer?.wrote?.(e,t)}function vo(e){l.observer?.contextCreated?.(e)}function bo(e,t,r){let n=l.observer;!n?.context||!pe.length||n.context(pe[pe.length-1],e,t,r)}function kt(e){l.observer?.disposed?.(e)}var mo="__FLUIXI_DEVTOOLS_HOOK__",qr=globalThis[mo];if(typeof qr?.inject=="function")try{qr.inject({observeReactiveNodes:co,version:Ot})}catch{}function Lr(){return l.observer!=null}var Br=0,$r=1,ke=2,Hr=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))}},To=class extends Hr{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++,yo(this,l.consumer),this.observers)for(let t of[...this.observers])t.markDirty(ke);gt(this)}}peek(){return this._value}},Gr=class extends Hr{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=ke,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===$r&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===ke)break}(this.state===ke||!this._initialized)&&this.recompute(),this.state=Br}recompute(){if(this.sources){for(let a of this.sources)a.observers?.delete(this);this.sources.clear()}let e=l.consumer,t=l.untracked,r=fo(this);l.consumer=this,l.untracked=!1;let n,o=!1,s;try{n=this._fn()}catch(a){o=!0,s=a,n=this._value}finally{l.consumer=e,l.untracked=t,r&&po()}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,ho(this),i){if(this.version++,this.observers)for(let a of[...this.observers])a.markDirty(ke);gt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Br;if(this.state=e,t){if(this.observers)for(let r of[...this.observers])r.markDirty($r);gt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function gt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var So=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(l.untracked)return e();l.untracked=!0;try{return e()}finally{l.untracked=!1}}function Wr(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function zr(e,t){let r=Symbol(t??"context");return vo(r),{id:r,defaultValue:e,Provider:o=>{bo(r,"provide",o.value);let s=l.owner,i=Wr(s);(i.contexts=new Map).set(r,o.value),s&&(s.owned??=[]).push(i),l.owner=i;try{return o.children}finally{l.owner=s}}}}function Yr(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 go(e){l.onSuspend=e}function xo(e){return l.onSuspend?(l.onSuspend(e,l.owner),!0):!1}function Oo(e){l.onError=e}function Ro(){return l.owner}function Xr(e,t){let r=l.owner;l.owner=e;try{return t()}finally{l.owner=r}}function Jr(e){if(l.owner){if(l.owner.disposed){e();return}(l.owner.cleanups??=[]).push(e)}}function xt(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)xt(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){l.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Ao(e){e.queued||(e.queued=!0,l.queue.push(e),!l.scheduled&&l.batchDepth===0&&(l.scheduled=!0,l.hostSchedule(At)))}function At(){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 r of t)r.queued=!1,r.disposed||r.run()}}finally{l.flushing=!1}}function _o(){l.batchDepth===0&&At()}function Eo(e){l.batchDepth++;try{return e()}finally{--l.batchDepth===0&&At()}}var Co=class{constructor(e,t=!1){this.queued=!1,this.disposed=!1,this.owner=Wr(l.owner),l.owner&&(l.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new Gr(()=>{xt(this.owner,!1),Xr(this.owner,()=>{let r=e();typeof r=="function"&&(this.owner.cleanups??=[]).push(r)})}),Rt({kind:"effect",node:this.computed,handle:this,internal:!t}),this.watcher=new So(()=>Ao(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,kt(this.computed),this.watcher.unwatch(this.computed),xt(this.owner))}};function Po(e,t=!1){let r=new Co(e,t);return()=>r.dispose()}function Do(e){return!!e&&typeof e.then=="function"}ko(()=>{});var Qr=Symbol.for("signal"),Io=Symbol.for("memo"),jo=Symbol.for("signal-node");function _t(e,t){let r=new To(e,{equals:t?.equals}),n=(()=>r.get()),o=(s=>{let i=typeof s=="function"?s(r.peek()):s;return r.set(i),_o(),i});return Object.defineProperty(n,Qr,{value:!0,enumerable:!0}),Object.defineProperty(n,jo,{value:{get value(){return r.peek()},get version(){return r.version}},enumerable:!1}),Rt({kind:"signal",node:r,handle:n,name:t?.name,set:o}),Lr()&&Jr(()=>kt(r)),[n,o]}function ze(e,t,r){let n=t,o=Ro(),s=new Gr(()=>Xr(o,()=>{try{return n=e(n)}catch(a){if(Do(a))return xo(a),n;throw a}}),{equals:r?.equals}),i=(()=>s.get());return Object.defineProperty(i,Qr,{value:!0,enumerable:!0}),Object.defineProperty(i,Io,{value:!0,enumerable:!0}),Rt({kind:"memo",node:s,handle:i,name:r?.name}),Lr()&&Jr(()=>kt(s)),i}function Ae(e,t){let r=t;return Po(()=>{r=e(r)},!0)}function Et(e){return Eo(e)}function Zr(e){return wo(e)}var Ni=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var Fo=zr();go((e,t)=>{let r=Yr(t,Fo);r&&(r.increment(),e.finally(()=>r.decrement()))});var Uo=zr();Oo((e,t)=>{let r=Yr(t,Uo);return r?(r.setError(e),!0):!1});var Ye=Symbol.for("fluixi-proxy");var ye=Symbol("store-raw"),J=Symbol("store-node"),en=Symbol("store-has"),Qe=Symbol("store-self"),Ze=Symbol("store-track"),sn=Symbol("store-name"),un=Symbol("store-store"),_e=new WeakMap,Pt=new WeakMap,ve=new WeakMap,et=new WeakMap;function Mo(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 f of c.keys.values())K(f);c.all&&K(c.all),_e.delete(a),ve.delete(a),Pt.delete(a)}for(let f of Object.values(a))s(f)};s(e)}var tt=(e,t,r)=>r?`${e}[${String(t)}]`:`${e}.${String(t)}`;function an(e,t,r){let n=t?.owner,o=n&&r!==void 0?tt(n.name,r,t?.array):void 0,[s,i]=Wt(n?.store,()=>_t(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=ve.get(e)):_e.set(e,t={keys:new Map,owner:ve.get(e),array:Array.isArray(e)}),t}function tn(e,t,r){let n=e.keys.get(t);return n||e.keys.set(t,n=an(r,e,t)),n}function No(e,t,r,n){let o=ve.get(e);if(o&&o.store===t&&o.name===r)return;let s={store:t,name:r};ve.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)at(c,t,tt(r,a,i.array));i.all&&at(i.all,t,tt(r,"*",i.array))}}function rn(e){let t=rt(e);(t.all||(t.all=an(void 0,t,"*")))()}function nn(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,qo);return Pt.set(e,r),r}var qo={get(e,t,r){if(t===ye||t===J)return e;if(t===Ye)return r;if(t===en)return c=>c in e;if(t==="__proxy")return!0;if(t===Ze||t===Qe)return rn(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=tn(s,t,n),a=i();return he(a)?(s.owner&&No(a,i,tt(s.owner.name,t,s.array),e),Xe(a)):a},set(){return!0},deleteProperty(e,t){return t in e&&q(e,t,void 0),!0},has(e,t){return t===ye||t===Ye||t===J||t===en||t===Qe||t===Ze?!0:(tn(rt(e),t,e[t])(),t in e)},ownKeys(e){return rn(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function cn(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=cn(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 q(e,t,r){let n=cn(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&&nn(c,n),Mo(o,e),s&&e.length!==i){let f=a.keys.get("length");f&&nn(f,e.length)}a.all&&a.all.$(void 0)}function on(e,t){return typeof e=="function"?e(t):e}function Dt(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)?Dt(o,n):q(e,r,n)}}function jt(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 f=0;f<e.length;f++)ln(e[f],c,r);return}let a=e[i];(a==null||typeof a!="object")&&(a=/^\d+$/.test(t[s+1])?[]:{},q(e,i,a)),e=a}let o=t[n];if(o==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)q(e,s,on(r,e[s]));return}q(e,o,on(r,e[o]))}function Ct(e,t,r){ln(e,jt(t),r)}function Bo(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--)q(e,String(r),void 0);e.length!==t.length&&q(e,"length",t.length);for(let r=0;r<t.length;r++)q(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&&Dt(e,n);return}if(Array.isArray(r)&&t.length===1){if(Bo(r)){for(let n of r)Ct(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){Dt(e,r);return}if(Array.isArray(t[1])&&t.length>=3){Ct(e,`${r}.${t[1].join(".")}`,t[2]);return}Ct(e,String(r),t[1])}function It(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(It);let t={};for(let r of Object.keys(e))t[r]=It(e[r]);return t}function H(e,t){let r=e;for(let n of jt(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)=>Et(()=>$o(this.root,n))),t&&typeof t=="object"&&(ve.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 be(this.state);let r=this.state;for(let n of jt(t)){if(r==null)return;r=r[n]}return be(r)}select(t){return ze(()=>t(this.state))}subscribe(t){return Ae(()=>t(this.state))}watch(t,r){let n;return Ae(()=>{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=It(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))q(r,n,void 0)}toObservable(){let[t]=_t(this.state);return t.toObservable()}dispose(){}},Ko=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","replace","clear","unwrap","toObservable"];function fn(e,t){for(let r of Ko)e[r]=t[r].bind(t);e.$=t.reactive.bind(t)}function Ee(e,t={immutable:!0}){let r=new G(e,t);return fn(r.set,r),[r.proxy,r.set]}function Ft(e,t={}){return new G(e,{...t,immutable:!1})}function dn(e,t={}){let r=new G(e(),t);return Ae(()=>r.set(e())),r}function pn(e,t,r){return Ae(()=>r(t(e)))}function hn(e,t,r){return ze(()=>t(e),void 0,r)}function yn(e,t={}){let r=new G(e,t),n=(()=>r.proxy);return fn(n,r),n}function be(e){if(e==null||typeof e!="object")return e;let t=e[ye];return t!==void 0?t:e}function Ut(e){return Zr(()=>be(e))}function vn(e){return nt(e)}function bn(e){return nt(e)?e[J]:null}function mn(e){return e&&typeof e=="object"&&J in e?e[J]:null}function nt(e){return!!e&&typeof e=="object"&&(Ye in e||e.__proxy===!0)}function Tn(e){return e}var Sn=Object.freeze({createStore:Ee,createMutableStore:Ft,batch:Et,unwrap:be,untrackStore:Ut});function Mt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Mt);let t={};for(let r of Object.keys(e))t[r]=Mt(e[r]);return t}function wn(e){return t=>{let r=Mt(t);return e(r),r}}function gn(e,t={}){return()=>e}function xn(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 Vo(e,t,r){return h(()=>t(e()),void 0,r)}function Lo(e,t,r){return h(()=>e().filter(t),void 0,r)}function Ho(e,t,r,n){return h(()=>e().reduce(t,r),void 0,n)}function Go(e,t,r){return h(()=>e().find(t),void 0,r)}function Wo(e,t,r){return h(()=>e().some(t),void 0,r)}function zo(e,t,r){return h(()=>e().every(t),void 0,r)}function Yo(e,t,r){return h(()=>[...e()].sort(t),void 0,r)}function Xo(e,t){return h(()=>[...new Set(e())],void 0,t)}function Jo(e,t,r){return h(()=>{let n=e.map(o=>o());return t(n)},void 0,r)}function Qo(...e){return new $(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 Zo(e,t,r){return h(()=>e()||t(),void 0,r)}function es(e,t,r,n){return h(()=>r(e(),t()),void 0,n)}function ts(e,t,r){return h(()=>t(e()),void 0,{equals:r,internal:!0})}function rs(e,t,r){return h(()=>{let n=e(),o={};for(let s of t)o[s]=n[s];return o},void 0,r)}function ns(e,t,r){return h(()=>{let o={...e()};for(let s of t)delete o[s];return o},void 0,r)}function os(e,t,r,n){return h(()=>e()?t():r(),void 0,n)}function ss(e,t,r){return h(()=>e()?t():void 0,void 0,r)}function is(e,t,r){let[n,o]=d(e()),s;return h(()=>{let i=e();clearTimeout(s),s=setTimeout(()=>o(()=>i),t)}),n}function us(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 as(e){let t=e;for(;typeof t=="function";)t=t();return t}var Z=new Map,Q=new Map,cs=0,ls=Symbol.for("signal"),fs=Symbol.for("resource");function ds(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_${cs++}`,staleWhileRevalidate:c=!0}=s,f=a,b=y=>`${f}:${JSON.stringify(y)}`,p=y=>i===1/0||Date.now()-y.timestamp<=i,[v,m]=d(void 0,{equals:!1}),[O,T]=d("unresolved",{equals:!1}),[F,C]=d(void 0,{equals:!1}),[U,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 j(y,A,_,M){if(Q.has(A)){Q.get(A).then(g=>{M()||z(g,_)},g=>{!M()&&!_&&Nt(g)}),_||P(Q.get(A));return}let Te=Promise.resolve(o(y)).then(g=>(Z.set(A,{value:g,timestamp:Date.now()}),Q.delete(A),g),g=>{throw Q.delete(A),g});Q.set(A,Te),_||(fe(Te),P(Te)),Te.then(g=>{M()||z(g,_)},g=>{!M()&&!_&&Nt(g)})}function z(y,A){x(()=>{m(()=>y),T("ready"),D(!1),P(void 0),C(void 0)})}function Nt(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 A=me,_=te;me=!1,te=!1;let M=b(y);_&&Z.delete(M);let Te=W===B||y!==W;W=y;let g=!1;S(()=>{g=!0});let re=Z.get(M);if(re&&p(re)&&!A&&!_){(w(O)!=="ready"||w(v)!==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)}),j(y,M,!0,()=>g);return}let qt=w(O),On=qt==="ready"||qt==="refreshing";x(()=>{T(On?"refreshing":"pending"),C(void 0),D(!1)}),j(y,M,!1,()=>g)});let Ce=(()=>{let y=F();if(y)throw y;if(O()==="pending"){let _=U();if(_)throw _}return v()});return Object.defineProperty(Ce,fs,{value:!0,enumerable:!0}),Object.defineProperty(Ce,ls,{value:!0,enumerable:!0}),Object.defineProperties(Ce,{state:{get:O},loading:{get:()=>{let y=O();return y==="pending"||y==="refreshing"}},error:{get:F},latest:{get:v},stale:{get:ee}}),[Ce,{mutate:m,refetch:()=>{me=!0,I(y=>y+1)},invalidate:()=>{let y=w(n);y!=null&&y!==!1&&Z.delete(b(y)),te=!0,I(A=>A+1)}}]}function ps(e){let t=`${e}:`;for(let r of Z.keys())r.startsWith(t)&&Z.delete(r)}function hs(){Z.clear(),Q.clear()}return Cn(ys);})();
|
|
1
|
+
/*! @fluixi/reactive v1.0.0-alpha.86 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
|
+
"use strict";var Fluixi=(()=>{var st=Object.defineProperty;var kn=Object.getOwnPropertyDescriptor;var An=Object.getOwnPropertyNames;var _n=Object.prototype.hasOwnProperty;var En=(e,t)=>{for(var r in t)st(e,r,{get:t[r],enumerable:!0})},Pn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of An(t))!_n.call(e,o)&&o!==r&&st(e,o,{get:()=>t[o],enumerable:!(n=kn(t,o))||n.enumerable});return e};var Cn=e=>Pn(st({},"__esModule",{value:!0}),e);var vs={};En(vs,{$NAME:()=>un,$NODE:()=>J,$PROXY:()=>Jn,$RAW:()=>ye,$SELF:()=>Qe,$SIGNAL:()=>Xn,$STORE:()=>an,$TRACK:()=>Ze,Observable:()=>K,SafeSubscriber:()=>Ce,Signal:()=>Mr,Store:()=>G,StoreAPI:()=>gn,Subject:()=>ut,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:()=>H,createDebounce:()=>Er,createDebouncedResource:()=>Pr,createDebouncedSignal:()=>gt,createDeferred:()=>_r,createEffect:()=>E,createErrorBoundary:()=>Fr,createMemo:()=>h,createMutableStore:()=>Ut,createRenderEffect:()=>Be,createResource:()=>de,createRoot:()=>q,createSelector:()=>Ar,createSignal:()=>d,createStore:()=>Ee,createStoreEffect:()=>hn,createStoreMemo:()=>yn,createSuspenseBoundary:()=>Dr,debounceSignal:()=>as,disposeScope:()=>ir,distinctSignal:()=>Qo,effect:()=>eo,everySignal:()=>Xo,filterSignal:()=>Go,findSignal:()=>zo,flush:()=>br,getNode:()=>mn,getOwner:()=>Oe,getServerData:()=>Ve,getStoreNode:()=>Tn,guardSignal:()=>us,indexArray:()=>Vn,isComponent:()=>Sr,isMemo:()=>mr,isOwnerDisposed:()=>ur,isProvider:()=>wr,isResource:()=>Tr,isSignal:()=>$e,isStore:()=>vn,isStoreProxy:()=>ot,isSuspense:()=>gr,joinedVersions:()=>Gt,keyArray:()=>$n,makeArrayFlat:()=>yt,mapArray:()=>Kn,mapSignal:()=>Lo,memo:()=>Zn,mergeSignal:()=>ts,modifiable:()=>Sn,nextResourceId:()=>He,observeReactiveNodes:()=>at,omitSignal:()=>ss,on:()=>vr,onCleanup:()=>S,operate:()=>Dn,pickSignal:()=>os,produceUtil:()=>wn,provide:()=>ce,provideErrorBoundary:()=>Ur,provideSuspense:()=>Ir,readChildren:()=>Cr,readSignal:()=>fs,reconcileUtil:()=>xn,reduceSignal:()=>Wo,renderEffect:()=>ro,reportReactiveBinding:()=>Zt,reportReactiveContext:()=>se,reportReactiveContextCreated:()=>je,reportReactiveDirective:()=>tr,reportReactiveProps:()=>er,reportResourceData:()=>Le,resource:()=>Nr,root:()=>to,runWithOwner:()=>fe,selectSignal:()=>ns,setOwner:()=>dt,setResourceDataSink:()=>kr,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:()=>ar,useTransition:()=>yr,whenSignal:()=>is,wrap:()=>bn,zipSignal:()=>rs});var Y="1.0.0-alpha.86";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())}},Ce=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 Ce(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 ut=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}__`,Ht=`__fluixi_signal_builds_v${Vt}__`,In=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function Lt(){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=Lt(),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]=Lt()}var a=Fn();(De[Ht]??=[]).push(Y);function Gt(){return[...new Set(De[Ht]??[])]}function at(e){return a.observer=e,()=>{a.observer===e&&(a.observer=null)}}var k=[],Ie;function zt(e,t){if(!a.observer)return t();let r=Ie;Ie=e;try{return t()}finally{Ie=r}}function X(e){let t=a.observer;t&&t.created(e.parents===void 0?{...e,parents:k,origin:e.origin??Ie}:e)}function Yt(e){return a.observer?(k.push(e),!0):!1}function Xt(){k.pop()}function Jt(e){a.observer?.ran?.(e)}function Qt(e,t){a.observer?.wrote?.(e,t)}function Zt(e,t,r,n){let o=a.observer;!o?.bound||!k.length||o.bound(k[k.length-1],e,t,r,n)}function er(e){let t=a.observer;!t?.props||!k.length||!e||t.props(k[k.length-1],e)}function tr(e,t,r,n){let o=a.observer;!o?.directive||!k.length||o.directive(k[k.length-1],e,t,r,n)}function je(e){a.observer?.contextCreated?.(e)}function se(e,t,r){let n=a.observer;!n?.context||!k.length||n.context(k[k.length-1],e,t,r)}function ct(e,t,r){a.observer?.moved?.(e,t,r)}function $(e){a.observer?.disposed?.(e)}var Un="__FLUIXI_DEVTOOLS_HOOK__",Wt=globalThis[Un];if(typeof Wt?.inject=="function")try{Wt.inject({observeReactiveNodes:at,version:Y})}catch{}function ie(){return a.observer!=null}var rr=0,nr=1,Se=2,Fe=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(a.untracked)return;let t=a.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},ue=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,a.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(a.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=a.consumer,n=a.untracked,o=Yt(this);a.consumer=this,a.untracked=!1;let s,i=!1,u;try{s=this._fn()}catch(l){i=!0,u=l,s=this._value}finally{a.consumer=r,a.untracked=n,o&&Xt()}let c=!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,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 ae=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(a.untracked)return e();a.untracked=!0;try{return e()}finally{a.untracked=!1}}function or(){return a.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 ur(e){return!!e&&e.disposed===!0}function xe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function H(e,t){let r=Symbol(t??"context");return je(r),{id:r,defaultValue:e,Provider:o=>{se(r,"provide",o.value);let s=a.owner,i=xe(s);(i.contexts=new Map).set(r,o.value),s&&(s.owned??=[]).push(i),a.owner=i;try{return o.children}finally{a.owner=s}}}}function ar(e){let t=a.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(a.owner);(n.contexts=new Map).set(e.id,t),a.owner&&(a.owner.owned??=[]).push(n);let o=a.owner;a.owner=n;try{return r()}finally{a.owner=o}}function cr(e){a.onSuspend=e}function fr(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function lr(e){a.onError=e}function Oe(){return a.owner}function dt(e){let t=a.owner;return a.owner=e,t}function fe(e,t){let r=a.owner;a.owner=e;try{return t()}finally{a.owner=r}}function S(e){if(a.owner){if(a.owner.disposed){e();return}(a.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(a.owner);a.owner&&(a.owner.owned??=[]).push(t);let r=a.owner;a.owner=t;try{return e(()=>we(t))}finally{a.owner=r}}function dr(e){a.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Mn(e){e.queued||(e.queued=!0,a.queue.push(e),!a.scheduled&&a.batchDepth===0&&(a.scheduled=!0,a.hostSchedule(Re)))}function Re(){if(a.scheduled=!1,a.flushing)return;a.flushing=!0;let e=0;try{for(;a.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=a.queue;a.queue=[];for(let r of t)r.queued=!1,r.disposed||r.run()}}finally{a.flushing=!1}}function pr(){a.batchDepth===0&&Re()}function pt(e){a.batchDepth++;try{return e()}finally{--a.batchDepth===0&&Re()}}var lt=class{constructor(t,r=!1){this.queued=!1;this.disposed=!1;this.owner=xe(a.owner),a.owner&&(a.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 ae(()=>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"&&a.onSuspend){a.onSuspend(t,this.owner);return}if(a.onError&&a.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 ue(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(u){if(Nn(u))return fr(u),n;throw u}}),{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 u=n?e.map(l=>l()):e();if(s){s=!1,o=u;return}let c=ge(()=>t(u,o,i));return o=u,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=[],u=new Set;for(let c=0;c<o.length;c++){let l=o[c],v=s.get(l);if(v&&!u.has(v))v.setIndex(c),i.push(v),u.add(v);else{let p,b,m;q(T=>{m=T;let[U,P]=d(c,{name:"row index"});b=P,p=t(l,U)});let O={item:l,rendered:p,dispose:m,setIndex:b};i.push(O),u.add(O)}}for(let c of n)u.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 u=new Map;for(let p=0;p<o.length;p++)u.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=u.get(b);if(m&&!v.has(b))m.setIndex(p),c.push(m);else{let O,T,U;q(P=>{U=P;let[M,C]=d(p,{name:"row index"});T=C;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 u)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 u=Math.min(s,i);for(let c=0;c<u;c++)n[c].setItem(o[c]);return n.map(c=>c.rendered)})},void 0,{name:"indexArray"})}var Hn=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,Ke=typeof process>"u"?Hn:!1,Ln=Symbol.for("signal"),Gn=Symbol.for("memo"),Wn=Symbol.for("resource");function $e(e){return typeof e=="function"&&e[Ln]===!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 He(){return mt?mt():void 0}var Tt=null;function kr(e){Tt=e}function Le(e,t){Tt&&Tt(e,t)}function Ar(e,t=(r,n)=>r===n){let r=new Map;return E(()=>{let n=e();for(let[o,s]of r){let[i,u]=s,c=t(o,n);i()!==c&&u(c)}}),n=>{let o=r.get(n);if(!o){let[s,i]=d(!1);o=[s,i],r.set(n,o);let u=e();i(t(n,u))}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:He(),i=s!==void 0?Ve(s):void 0,u=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,P]=d(void 0,{equals:!1}),M=St,C=!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=C;if(C=!1,M!==St&&R===M&&!I)return;if(M=R,u){u=!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&&Le(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:()=>{C=!0,P(void 0)}}]}function gt(e,t=300){let[r,n]=d(e),[o,s]=d(e),[i,u]=d(!1),c,l=()=>{c!==void 0&&(clearTimeout(c),c=void 0)},v=()=>{l();let b=g(r);return s(()=>b),u(!1),b},p=(b=>{let m=typeof b=="function"?b(g(r)):b;return n(()=>m),u(!0),l(),c=setTimeout(v,t),m});return S(l),[o,p,{immediate:r,pending:i,flush:v,cancel:()=>{l(),u(!1)}}]}function Yn(e){return e!=null&&e!==""}function Pr(e,t,r={}){let{delay:n=300,initialValue:o,shouldFetch:s=Yn}=r,[i,u,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:u,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 Cr(e){let t=h(e);return Ke?h(()=>Ge(t()),void 0,{name:"children"}):h(()=>Ge(t()))}var We=H();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=H();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:ue,Computed:V,subtle:{Watcher:ae,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 H(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.86",Vr=Rt.split(".")[0],qr=`__fluixi_signal_state_v${Vr}__`,io=`__fluixi_signal_builds_v${Vr}__`,uo=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function Hr(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:uo,onSuspend:null,onError:null,observer:null}}var wt=globalThis;function ao(e){let t=Hr(),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?ao(e):wt[qr]=Hr()}var f=co();(wt[io]??=[]).push(Rt);function fo(e){return f.observer=e,()=>{f.observer===e&&(f.observer=null)}}var pe=[],lo;function kt(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 At(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 Lr(){return f.observer!=null}var Kr=0,$r=1,ke=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(ke);xt(this)}}peek(){return this._value}},Wr=class extends Gr{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=ke,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===ke)break}(this.state===ke||!this._initialized)&&this.recompute(),this.state=Kr}recompute(){if(this.sources){for(let u of this.sources)u.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(u){o=!0,s=u,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 u of[...this.observers])u.markDirty(ke);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 ko(){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 Ao(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 Po(e){f.batchDepth++;try{return e()}finally{--f.batchDepth===0&&_t()}}var Co=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)})}),kt({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,At(this.computed),this.watcher.unwatch(this.computed),Ot(this.owner))}};function Do(e,t=!1){let r=new Co(e,t);return()=>r.dispose()}function Io(e){return!!e&&typeof e.then=="function"}Ao(()=>{});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}),kt({kind:"signal",node:r,handle:n,name:t?.name,set:o}),Lr()&&Qr(()=>At(r)),[n,o]}function ze(e,t,r){let n=t,o=ko(),s=new Wr(()=>Jr(o,()=>{try{return n=e(n)}catch(u){if(Io(u))return Oo(u),n;throw u}}),{equals:r?.equals}),i=(()=>s.get());return Object.defineProperty(i,Zr,{value:!0,enumerable:!0}),Object.defineProperty(i,jo,{value:!0,enumerable:!0}),kt({kind:"memo",node:s,handle:i,name:r?.name}),Lr()&&Qr(()=>At(s)),i}function Ae(e,t){let r=t;return Do(()=>{r=e(r)},!0)}function Pt(e){return Po(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"),un=Symbol("store-name"),an=Symbol("store-store"),_e=new WeakMap,Ct=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 u of Object.values(i))n(u)}};n(et.get(t)??t);let o=new Set,s=i=>{if(!he(i))return;let u=i;if(r.has(u)||o.has(u))return;o.add(u);let c=_e.get(u);if(c){for(let l of c.keys.values())$(l);c.all&&$(c.all),_e.delete(u),be.delete(u),Ct.delete(u)}for(let l of Object.values(u))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)),u=s;return u.$=i,u}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[u,c]of i.keys)ct(c,t,tt(r,u,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=Ct.get(e);if(t)return t;let r=new Proxy(e,Bo);return Ct.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),u=i();return he(u)?(s.owner&&qo(u,i,tt(s.owner.name,t,s.array),e),Xe(u)):u},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 u=fn(i,t);return u!==i&&(n=!0),u};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 u=rt(e),c=u.keys.get(t);if(c&&on(c,n),No(o,e),s&&e.length!==i){let l=u.keys.get("length");l&&on(l,e.length)}u.all&&u.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 u=e[i];(u==null||typeof u!="object")&&(u=/^\d+$/.test(t[s+1])?[]:{},j(e,i,u)),e=u}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 u=e[i];if(u==null||typeof u!="object"){let c=o[0];u=typeof c=="number"||/^\d+$/.test(String(c))?[]:{},j(e,i,u)}jt(u,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 L(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)=>Pt(()=>$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 Ae(()=>t(this.state))}watch(t,r){let n;return Ae(()=>{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=L(this.root,t);this.set(t,n.concat(r))}pop(t){let r=L(this.root,t).slice(),n=r.pop();return this.set(t,r),n}shift(t){let r=L(this.root,t).slice(),n=r.shift();return this.set(t,r),n}splice(t,r,n,...o){let s=L(this.root,t).slice(),i=s.splice(r,n,...o);return this.set(t,s),i}insert(t,r,n){let o=L(this.root,t).slice();o.splice(r,0,n),this.set(t,o)}removeAt(t,r){let n=L(this.root,t).slice(),o=n.splice(r,1);return this.set(t,n),o}replace(t,r){if(arguments.length>=2){let o=L(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:L(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(){}},Ho=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","replace","clear","unwrap","toObservable"];function dn(e,t){for(let r of Ho)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 Ae(()=>r.set(e())),r}function hn(e,t,r){return Ae(()=>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:Pt,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 Lo(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 us(e,t,r){return h(()=>e()?t():void 0,void 0,r)}function as(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 u=e(),c=Date.now();c-s>=t?(s=c,o(()=>u)):(clearTimeout(i),i=setTimeout(()=>{s=Date.now(),o(()=>u)},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:u=`_auto_${ls++}`,staleWhileRevalidate:c=!0}=s,l=u,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,P]=d(void 0,{equals:!1}),[M,C]=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,A,_,N){if(Q.has(A)){Q.get(A).then(w=>{N()||z(w,_)},w=>{!N()&&!_&&qt(w)}),_||C(Q.get(A));return}let Te=Promise.resolve(o(y)).then(w=>(Z.set(A,{value:w,timestamp:Date.now()}),Q.delete(A),w),w=>{throw Q.delete(A),w});Q.set(A,Te),_||(le(Te),C(Te)),Te.then(w=>{N()||z(w,_)},w=>{!N()&&!_&&qt(w)})}function z(y,A){x(()=>{m(()=>y),T("ready"),D(!1),C(void 0),P(void 0)})}function qt(y){x(()=>{P(y),T("errored"),C(void 0)})}E(()=>{let y=n();if(R(),y===!1||y===null||y===void 0){W=B,x(()=>{T("unresolved"),C(void 0),P(void 0)});return}let A=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)&&!A&&!_){(g(O)!=="ready"||g(b)!==re.value)&&x(()=>{m(()=>re.value),T("ready"),D(!1),P(void 0)});return}if(re&&c&&!_){x(()=>{m(()=>re.value),T("ready"),D(!0),P(void 0),C(void 0)}),F(y,N,!0,()=>w);return}let Bt=g(O),Rn=Bt==="ready"||Bt==="refreshing";x(()=>{T(Rn?"refreshing":"pending"),P(void 0),D(!1)}),F(y,N,!1,()=>w)});let Pe=(()=>{let y=U();if(y)throw y;if(O()==="pending"){let _=M();if(_)throw _}return b()});return Object.defineProperty(Pe,ps,{value:!0,enumerable:!0}),Object.defineProperty(Pe,ds,{value:!0,enumerable:!0}),Object.defineProperties(Pe,{state:{get:O},loading:{get:()=>{let y=O();return y==="pending"||y==="refreshing"}},error:{get:U},latest:{get:b},stale:{get:ee}}),[Pe,{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(A=>A+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 Cn(vs);})();
|
package/dist/cdn/reactive.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.generated.ts
|
|
2
|
-
var VERSION = "1.0.0-alpha.
|
|
2
|
+
var VERSION = "1.0.0-alpha.86";
|
|
3
3
|
|
|
4
4
|
// src/lib/predicates.ts
|
|
5
5
|
function isFunction(value) {
|
|
@@ -1886,12 +1886,61 @@ function applySet(root2, args) {
|
|
|
1886
1886
|
mergeInto(root2, first);
|
|
1887
1887
|
return;
|
|
1888
1888
|
}
|
|
1889
|
-
if (
|
|
1890
|
-
|
|
1889
|
+
if (args.length >= 3) {
|
|
1890
|
+
setDeep(root2, args.slice(0, -1), args[args.length - 1]);
|
|
1891
1891
|
return;
|
|
1892
1892
|
}
|
|
1893
1893
|
applyPath(root2, String(first), args[1]);
|
|
1894
1894
|
}
|
|
1895
|
+
function selectKeys(current, selector) {
|
|
1896
|
+
if (typeof selector === "function") {
|
|
1897
|
+
if (!Array.isArray(current)) return [];
|
|
1898
|
+
const keys = [];
|
|
1899
|
+
for (let i = 0; i < current.length; i++) if (selector(current[i], i)) keys.push(i);
|
|
1900
|
+
return keys;
|
|
1901
|
+
}
|
|
1902
|
+
if (Array.isArray(selector)) {
|
|
1903
|
+
return Array.isArray(current) ? selector.map(Number) : selector.map(String);
|
|
1904
|
+
}
|
|
1905
|
+
if (selector && typeof selector === "object" && ("from" in selector || "to" in selector || "by" in selector)) {
|
|
1906
|
+
if (!Array.isArray(current)) return [];
|
|
1907
|
+
const by = selector.by ?? 1;
|
|
1908
|
+
const from = selector.from ?? 0;
|
|
1909
|
+
const to = selector.to ?? current.length - 1;
|
|
1910
|
+
const keys = [];
|
|
1911
|
+
for (let i = from; i <= to; i += by) if (i >= 0 && i < current.length) keys.push(i);
|
|
1912
|
+
return keys;
|
|
1913
|
+
}
|
|
1914
|
+
if (selector === "*") {
|
|
1915
|
+
return Array.isArray(current) ? current.map((_, i) => i) : Object.keys(current ?? {});
|
|
1916
|
+
}
|
|
1917
|
+
return [selector];
|
|
1918
|
+
}
|
|
1919
|
+
function setDeep(current, selectors, value) {
|
|
1920
|
+
if (current == null) return;
|
|
1921
|
+
const [head, ...rest] = selectors;
|
|
1922
|
+
if (typeof head === "string") {
|
|
1923
|
+
const parts = parsePath(head);
|
|
1924
|
+
if (parts.length > 1) {
|
|
1925
|
+
setDeep(current, [...parts, ...rest], value);
|
|
1926
|
+
return;
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
const keys = selectKeys(current, head);
|
|
1930
|
+
if (rest.length === 0) {
|
|
1931
|
+
for (const key of keys) writeKey(current, key, nextValue(value, current[key]));
|
|
1932
|
+
return;
|
|
1933
|
+
}
|
|
1934
|
+
for (const key of keys) {
|
|
1935
|
+
let next = current[key];
|
|
1936
|
+
if (next == null || typeof next !== "object") {
|
|
1937
|
+
const lookahead = rest[0];
|
|
1938
|
+
next = typeof lookahead === "number" || /^\d+$/.test(String(lookahead)) ? [] : {};
|
|
1939
|
+
writeKey(current, key, next);
|
|
1940
|
+
}
|
|
1941
|
+
setDeep(next, rest, value);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1895
1944
|
function clone(value) {
|
|
1896
1945
|
if (value == null || typeof value !== "object") return value;
|
|
1897
1946
|
if (Array.isArray(value)) return value.map(clone);
|
package/dist/cdn/signal.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @fluixi/reactive v1.0.0-alpha.
|
|
2
|
-
"use strict";var Signal=(()=>{var b=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var z=(e,t)=>{for(var n in t)b(e,n,{get:t[n],enumerable:!0})},H=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of K(t))!j.call(e,s)&&s!==n&&b(e,s,{get:()=>t[s],enumerable:!(o=G(t,s))||o.enumerable});return e};var V=e=>H(b({},"__esModule",{value:!0}),e);var U={};z(U,{Computed:()=>h,State:()=>v,subtle:()=>Y});var a="1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/reactive v1.0.0-alpha.86 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
|
+
"use strict";var Signal=(()=>{var b=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var z=(e,t)=>{for(var n in t)b(e,n,{get:t[n],enumerable:!0})},H=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of K(t))!j.call(e,s)&&s!==n&&b(e,s,{get:()=>t[s],enumerable:!(o=G(t,s))||o.enumerable});return e};var V=e=>H(b({},"__esModule",{value:!0}),e);var U={};z(U,{Computed:()=>h,State:()=>v,subtle:()=>Y});var a="1.0.0-alpha.86";var m=a.split(".")[0],_=`__fluixi_signal_state_v${m}__`,A=`__fluixi_signal_builds_v${m}__`,F=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function R(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:F,onSuspend:null,onError:null,observer:null}}var w=globalThis;function L(e){let t=R(),n=e;for(let o of Object.keys(t))o in e||(n[o]=t[o]);return e}function M(){let e=w[_];return e?L(e):w[_]=R()}var r=M();(w[A]??=[]).push(a);function P(e){return r.observer=e,()=>{r.observer===e&&(r.observer=null)}}var y=[];function S(e){return r.observer?(y.push(e),!0):!1}function x(){y.pop()}function T(e){r.observer?.ran?.(e)}function O(e,t){r.observer?.wrote?.(e,t)}var W="__FLUIXI_DEVTOOLS_HOOK__",g=globalThis[W];if(typeof g?.inject=="function")try{g.inject({observeReactiveNodes:P,version:a})}catch{}var N=0,C=1,u=2,d=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(r.untracked)return;let t=r.consumer;t&&((this.observers??=new Set).add(t),(t.sources??=new Set).add(this))}},v=class extends d{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++,O(this,r.consumer),this.observers)for(let n of[...this.observers])n.markDirty(u);k(this)}}peek(){return this._value}},h=class extends d{constructor(n,o){super();this._threw=!1;this._initialized=!1;this.state=u;this.sources=null;this._fn=n,this._equals=o?.equals===!1?()=>!1:o?.equals??Object.is}get(){if(r.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===C&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===u)break}(this.state===u||!this._initialized)&&this.recompute(),this.state=N}recompute(){if(this.sources){for(let i of this.sources)i.observers?.delete(this);this.sources.clear()}let n=r.consumer,o=r.untracked,s=S(this);r.consumer=this,r.untracked=!1;let c,l=!1,p;try{c=this._fn()}catch(i){l=!0,p=i,c=this._value}finally{r.consumer=n,r.untracked=o,s&&x()}let I=!this._initialized||this._threw!==l||(l?p!==this._error:!this._equals(this._value,c));if(this._initialized=!0,this._threw=l,this._error=p,this._value=c,T(this),I){if(this.version++,this.observers)for(let i of[...this.observers])i.markDirty(u);k(this)}}markDirty(n){if(this.state>=n)return;let o=this.state===N;if(this.state=n,o){if(this.observers)for(let s of[...this.observers])s.markDirty(C);k(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function k(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var f=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 q(e){if(r.untracked)return e();r.untracked=!0;try{return e()}finally{r.untracked=!1}}function E(){return r.consumer}function D(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}var Y={Watcher:f,untrack:q,currentComputed:E,hasSinks:D};return V(U);})();
|
package/dist/cdn/signal.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -150,7 +150,7 @@ __export(index_exports, {
|
|
|
150
150
|
module.exports = __toCommonJS(index_exports);
|
|
151
151
|
|
|
152
152
|
// src/version.generated.ts
|
|
153
|
-
var VERSION = "1.0.0-alpha.
|
|
153
|
+
var VERSION = "1.0.0-alpha.86";
|
|
154
154
|
|
|
155
155
|
// src/lib/predicates.ts
|
|
156
156
|
function isFunction(value) {
|
|
@@ -2030,12 +2030,61 @@ function applySet(root2, args) {
|
|
|
2030
2030
|
mergeInto(root2, first);
|
|
2031
2031
|
return;
|
|
2032
2032
|
}
|
|
2033
|
-
if (
|
|
2034
|
-
|
|
2033
|
+
if (args.length >= 3) {
|
|
2034
|
+
setDeep(root2, args.slice(0, -1), args[args.length - 1]);
|
|
2035
2035
|
return;
|
|
2036
2036
|
}
|
|
2037
2037
|
applyPath(root2, String(first), args[1]);
|
|
2038
2038
|
}
|
|
2039
|
+
function selectKeys(current, selector) {
|
|
2040
|
+
if (typeof selector === "function") {
|
|
2041
|
+
if (!Array.isArray(current)) return [];
|
|
2042
|
+
const keys = [];
|
|
2043
|
+
for (let i = 0; i < current.length; i++) if (selector(current[i], i)) keys.push(i);
|
|
2044
|
+
return keys;
|
|
2045
|
+
}
|
|
2046
|
+
if (Array.isArray(selector)) {
|
|
2047
|
+
return Array.isArray(current) ? selector.map(Number) : selector.map(String);
|
|
2048
|
+
}
|
|
2049
|
+
if (selector && typeof selector === "object" && ("from" in selector || "to" in selector || "by" in selector)) {
|
|
2050
|
+
if (!Array.isArray(current)) return [];
|
|
2051
|
+
const by = selector.by ?? 1;
|
|
2052
|
+
const from = selector.from ?? 0;
|
|
2053
|
+
const to = selector.to ?? current.length - 1;
|
|
2054
|
+
const keys = [];
|
|
2055
|
+
for (let i = from; i <= to; i += by) if (i >= 0 && i < current.length) keys.push(i);
|
|
2056
|
+
return keys;
|
|
2057
|
+
}
|
|
2058
|
+
if (selector === "*") {
|
|
2059
|
+
return Array.isArray(current) ? current.map((_, i) => i) : Object.keys(current ?? {});
|
|
2060
|
+
}
|
|
2061
|
+
return [selector];
|
|
2062
|
+
}
|
|
2063
|
+
function setDeep(current, selectors, value) {
|
|
2064
|
+
if (current == null) return;
|
|
2065
|
+
const [head, ...rest] = selectors;
|
|
2066
|
+
if (typeof head === "string") {
|
|
2067
|
+
const parts = parsePath(head);
|
|
2068
|
+
if (parts.length > 1) {
|
|
2069
|
+
setDeep(current, [...parts, ...rest], value);
|
|
2070
|
+
return;
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
const keys = selectKeys(current, head);
|
|
2074
|
+
if (rest.length === 0) {
|
|
2075
|
+
for (const key of keys) writeKey(current, key, nextValue(value, current[key]));
|
|
2076
|
+
return;
|
|
2077
|
+
}
|
|
2078
|
+
for (const key of keys) {
|
|
2079
|
+
let next = current[key];
|
|
2080
|
+
if (next == null || typeof next !== "object") {
|
|
2081
|
+
const lookahead = rest[0];
|
|
2082
|
+
next = typeof lookahead === "number" || /^\d+$/.test(String(lookahead)) ? [] : {};
|
|
2083
|
+
writeKey(current, key, next);
|
|
2084
|
+
}
|
|
2085
|
+
setDeep(next, rest, value);
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2039
2088
|
function clone(value) {
|
|
2040
2089
|
if (value == null || typeof value !== "object") return value;
|
|
2041
2090
|
if (Array.isArray(value)) return value.map(clone);
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.generated.ts
|
|
2
|
-
var VERSION = "1.0.0-alpha.
|
|
2
|
+
var VERSION = "1.0.0-alpha.86";
|
|
3
3
|
|
|
4
4
|
// src/lib/predicates.ts
|
|
5
5
|
function isFunction(value) {
|
|
@@ -1886,12 +1886,61 @@ function applySet(root2, args) {
|
|
|
1886
1886
|
mergeInto(root2, first);
|
|
1887
1887
|
return;
|
|
1888
1888
|
}
|
|
1889
|
-
if (
|
|
1890
|
-
|
|
1889
|
+
if (args.length >= 3) {
|
|
1890
|
+
setDeep(root2, args.slice(0, -1), args[args.length - 1]);
|
|
1891
1891
|
return;
|
|
1892
1892
|
}
|
|
1893
1893
|
applyPath(root2, String(first), args[1]);
|
|
1894
1894
|
}
|
|
1895
|
+
function selectKeys(current, selector) {
|
|
1896
|
+
if (typeof selector === "function") {
|
|
1897
|
+
if (!Array.isArray(current)) return [];
|
|
1898
|
+
const keys = [];
|
|
1899
|
+
for (let i = 0; i < current.length; i++) if (selector(current[i], i)) keys.push(i);
|
|
1900
|
+
return keys;
|
|
1901
|
+
}
|
|
1902
|
+
if (Array.isArray(selector)) {
|
|
1903
|
+
return Array.isArray(current) ? selector.map(Number) : selector.map(String);
|
|
1904
|
+
}
|
|
1905
|
+
if (selector && typeof selector === "object" && ("from" in selector || "to" in selector || "by" in selector)) {
|
|
1906
|
+
if (!Array.isArray(current)) return [];
|
|
1907
|
+
const by = selector.by ?? 1;
|
|
1908
|
+
const from = selector.from ?? 0;
|
|
1909
|
+
const to = selector.to ?? current.length - 1;
|
|
1910
|
+
const keys = [];
|
|
1911
|
+
for (let i = from; i <= to; i += by) if (i >= 0 && i < current.length) keys.push(i);
|
|
1912
|
+
return keys;
|
|
1913
|
+
}
|
|
1914
|
+
if (selector === "*") {
|
|
1915
|
+
return Array.isArray(current) ? current.map((_, i) => i) : Object.keys(current ?? {});
|
|
1916
|
+
}
|
|
1917
|
+
return [selector];
|
|
1918
|
+
}
|
|
1919
|
+
function setDeep(current, selectors, value) {
|
|
1920
|
+
if (current == null) return;
|
|
1921
|
+
const [head, ...rest] = selectors;
|
|
1922
|
+
if (typeof head === "string") {
|
|
1923
|
+
const parts = parsePath(head);
|
|
1924
|
+
if (parts.length > 1) {
|
|
1925
|
+
setDeep(current, [...parts, ...rest], value);
|
|
1926
|
+
return;
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
const keys = selectKeys(current, head);
|
|
1930
|
+
if (rest.length === 0) {
|
|
1931
|
+
for (const key of keys) writeKey(current, key, nextValue(value, current[key]));
|
|
1932
|
+
return;
|
|
1933
|
+
}
|
|
1934
|
+
for (const key of keys) {
|
|
1935
|
+
let next = current[key];
|
|
1936
|
+
if (next == null || typeof next !== "object") {
|
|
1937
|
+
const lookahead = rest[0];
|
|
1938
|
+
next = typeof lookahead === "number" || /^\d+$/.test(String(lookahead)) ? [] : {};
|
|
1939
|
+
writeKey(current, key, next);
|
|
1940
|
+
}
|
|
1941
|
+
setDeep(next, rest, value);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1895
1944
|
function clone(value) {
|
|
1896
1945
|
if (value == null || typeof value !== "object") return value;
|
|
1897
1946
|
if (Array.isArray(value)) return value.map(clone);
|
package/dist/lib/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @fluixi/reactive v1.0.0-alpha.
|
|
1
|
+
/*! @fluixi/reactive v1.0.0-alpha.86 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -151,7 +151,7 @@ __export(index_exports, {
|
|
|
151
151
|
module.exports = __toCommonJS(index_exports);
|
|
152
152
|
|
|
153
153
|
// src/version.generated.ts
|
|
154
|
-
var VERSION = "1.0.0-alpha.
|
|
154
|
+
var VERSION = "1.0.0-alpha.86";
|
|
155
155
|
|
|
156
156
|
// src/lib/predicates.ts
|
|
157
157
|
function isFunction(value) {
|
|
@@ -2031,12 +2031,61 @@ function applySet(root2, args) {
|
|
|
2031
2031
|
mergeInto(root2, first);
|
|
2032
2032
|
return;
|
|
2033
2033
|
}
|
|
2034
|
-
if (
|
|
2035
|
-
|
|
2034
|
+
if (args.length >= 3) {
|
|
2035
|
+
setDeep(root2, args.slice(0, -1), args[args.length - 1]);
|
|
2036
2036
|
return;
|
|
2037
2037
|
}
|
|
2038
2038
|
applyPath(root2, String(first), args[1]);
|
|
2039
2039
|
}
|
|
2040
|
+
function selectKeys(current, selector) {
|
|
2041
|
+
if (typeof selector === "function") {
|
|
2042
|
+
if (!Array.isArray(current)) return [];
|
|
2043
|
+
const keys = [];
|
|
2044
|
+
for (let i = 0; i < current.length; i++) if (selector(current[i], i)) keys.push(i);
|
|
2045
|
+
return keys;
|
|
2046
|
+
}
|
|
2047
|
+
if (Array.isArray(selector)) {
|
|
2048
|
+
return Array.isArray(current) ? selector.map(Number) : selector.map(String);
|
|
2049
|
+
}
|
|
2050
|
+
if (selector && typeof selector === "object" && ("from" in selector || "to" in selector || "by" in selector)) {
|
|
2051
|
+
if (!Array.isArray(current)) return [];
|
|
2052
|
+
const by = selector.by ?? 1;
|
|
2053
|
+
const from = selector.from ?? 0;
|
|
2054
|
+
const to = selector.to ?? current.length - 1;
|
|
2055
|
+
const keys = [];
|
|
2056
|
+
for (let i = from; i <= to; i += by) if (i >= 0 && i < current.length) keys.push(i);
|
|
2057
|
+
return keys;
|
|
2058
|
+
}
|
|
2059
|
+
if (selector === "*") {
|
|
2060
|
+
return Array.isArray(current) ? current.map((_, i) => i) : Object.keys(current ?? {});
|
|
2061
|
+
}
|
|
2062
|
+
return [selector];
|
|
2063
|
+
}
|
|
2064
|
+
function setDeep(current, selectors, value) {
|
|
2065
|
+
if (current == null) return;
|
|
2066
|
+
const [head, ...rest] = selectors;
|
|
2067
|
+
if (typeof head === "string") {
|
|
2068
|
+
const parts = parsePath(head);
|
|
2069
|
+
if (parts.length > 1) {
|
|
2070
|
+
setDeep(current, [...parts, ...rest], value);
|
|
2071
|
+
return;
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
const keys = selectKeys(current, head);
|
|
2075
|
+
if (rest.length === 0) {
|
|
2076
|
+
for (const key of keys) writeKey(current, key, nextValue(value, current[key]));
|
|
2077
|
+
return;
|
|
2078
|
+
}
|
|
2079
|
+
for (const key of keys) {
|
|
2080
|
+
let next = current[key];
|
|
2081
|
+
if (next == null || typeof next !== "object") {
|
|
2082
|
+
const lookahead = rest[0];
|
|
2083
|
+
next = typeof lookahead === "number" || /^\d+$/.test(String(lookahead)) ? [] : {};
|
|
2084
|
+
writeKey(current, key, next);
|
|
2085
|
+
}
|
|
2086
|
+
setDeep(next, rest, value);
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2040
2089
|
function clone(value) {
|
|
2041
2090
|
if (value == null || typeof value !== "object") return value;
|
|
2042
2091
|
if (Array.isArray(value)) return value.map(clone);
|