@fluixi/reactive 1.0.0-alpha.73 → 1.0.0-alpha.74
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 +1 -1
- package/dist/cdn/reactive.global.js +1 -1
- package/dist/cdn/reactive.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/lib/signal/graph/debounced.cjs +1 -1
- package/dist/lib/signal/graph/debounced.mjs +1 -1
- package/dist/lib/signal/graph/resource.cjs +1 -1
- package/dist/lib/signal/graph/resource.d.ts +2 -0
- package/dist/lib/signal/graph/resource.d.ts.map +1 -1
- package/dist/lib/signal/graph/resource.js +11 -1
- package/dist/lib/signal/graph/resource.mjs +1 -1
- package/dist/lib/signal/graph/signal-next.cjs +1 -1
- package/dist/lib/signal/graph/signal-next.mjs +1 -1
- package/dist/lib/signal/index-legacy.cjs +1 -1
- package/dist/lib/signal/index-legacy.mjs +1 -1
- package/dist/lib/signal/index.cjs +1 -1
- package/dist/lib/signal/index.mjs +1 -1
- package/dist/lib/signal/signal.cjs +1 -1
- package/dist/lib/signal/signal.d.ts +8 -0
- package/dist/lib/signal/signal.d.ts.map +1 -1
- package/dist/lib/signal/signal.js +1 -1
- package/dist/lib/signal/signal.mjs +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/version.generated.cjs +1 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/dist/version.generated.mjs +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
var De="__fluixi_signal_next_state__",Pe=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},o=globalThis[De]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Pe,onSuspend:null,onError:null};var ye=0,Te=1,M=2,$=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(o.untracked)return;let n=o.consumer;n&&((this.observers??=new Set).add(n),(n.sources??=new Set).add(this))}},C=class extends ${constructor(n,t){super(),this._value=n,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(n){if(!this._equals(this._value,n)){if(this._value=n,this.version++,this.observers)for(let t of[...this.observers])t.markDirty(M);X(this)}}peek(){return this._value}},g=class extends ${constructor(t,r){super();this._threw=!1;this._initialized=!1;this.state=M;this.sources=null;this._fn=t,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){if(o.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===Te&&this.sources){for(let t of this.sources)if(t.updateIfNecessary(),this.state===M)break}(this.state===M||!this._initialized)&&this.recompute(),this.state=ye}recompute(){if(this.sources){for(let i of this.sources)i.observers?.delete(this);this.sources.clear()}let t=o.consumer,r=o.untracked;o.consumer=this,o.untracked=!1;let s,u=!1,a;try{s=this._fn()}catch(i){u=!0,a=i,s=this._value}finally{o.consumer=t,o.untracked=r}let c=!this._initialized||this._threw!==u||(u?a!==this._error:!this._equals(this._value,s));if(this._initialized=!0,this._threw=u,this._error=a,this._value=s,c){if(this.version++,this.observers)for(let i of[...this.observers])i.markDirty(M);X(this)}}markDirty(t){if(this.state>=t)return;let r=this.state===ye;if(this.state=t,r){if(this.observers)for(let s of[...this.observers])s.markDirty(Te);X(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function X(e){if(e.watchers)for(let n of[...e.watchers])n._notify(e)}var A=class{constructor(n){this._watched=new Set;this._pending=new Set;this._notifyFn=n}watch(...n){for(let t of n)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...n){for(let t of n)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let n=[...this._pending];return this._pending.clear(),n}_notify(n){if(!this._watched.has(n)||this._pending.has(n))return;let t=this._pending.size===0;this._pending.add(n),t&&this._notifyFn()}};function U(e){if(o.untracked)return e();o.untracked=!0;try{return e()}finally{o.untracked=!1}}function me(){return o.consumer}function ve(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function qe(e){let n=B(e);return e&&(e.owned??=[]).push(n),n}function Ie(e,n=!0){F(e,n)}function Me(e){return!!e&&e.disposed===!0}function B(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function N(e){let n=Symbol("context");return{id:n,defaultValue:e,Provider:r=>{let s=o.owner,u=B(s);(u.contexts=new Map).set(n,r.value),s&&(s.owned??=[]).push(u),o.owner=u;try{return r.children}finally{o.owner=s}}}}function Ue(e){let n=o.owner;for(;n;){if(n.contexts&&n.contexts.has(e.id))return n.contexts.get(e.id);n=n.parent}return e.defaultValue}function H(e,n){let t=e;for(;t;){if(t.contexts&&t.contexts.has(n.id))return t.contexts.get(n.id);t=t.parent}return n.defaultValue}function V(e,n,t){let r=B(o.owner);(r.contexts=new Map).set(e.id,n),o.owner&&(o.owner.owned??=[]).push(r);let s=o.owner;o.owner=r;try{return t()}finally{o.owner=s}}function we(e){o.onSuspend=e}function Se(e){return o.onSuspend?(o.onSuspend(e,o.owner),!0):!1}function xe(e){o.onError=e}function K(){return o.owner}function be(e){let n=o.owner;return o.owner=e,n}function L(e,n){let t=o.owner;o.owner=e;try{return n()}finally{o.owner=t}}function v(e){if(o.owner){if(o.owner.disposed){e();return}(o.owner.cleanups??=[]).push(e)}}function F(e,n=!0){if(!e.disposed){if(e.owned){for(let t=e.owned.length-1;t>=0;t--)F(e.owned[t]);e.owned=null}if(e.cleanups){for(let t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}n&&(e.disposed=!0)}}function D(e){let n=B(o.owner);o.owner&&(o.owner.owned??=[]).push(n);let t=o.owner;o.owner=n;try{return e(()=>F(n))}finally{o.owner=t}}function ge(e){o.hostSchedule=e??(n=>{Promise.resolve().then(n)})}function Fe(e){e.queued||(e.queued=!0,o.queue.push(e),!o.scheduled&&o.batchDepth===0&&(o.scheduled=!0,o.hostSchedule(j)))}function j(){if(o.scheduled=!1,o.flushing)return;o.flushing=!0;let e=0;try{for(;o.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let n=o.queue;o.queue=[];for(let t of n)t.queued=!1,t.disposed||t.run()}}finally{o.flushing=!1}}function ke(){o.batchDepth===0&&j()}function Z(e){o.batchDepth++;try{return e()}finally{--o.batchDepth===0&&j()}}var J=class{constructor(n){this.queued=!1;this.disposed=!1;this.owner=B(o.owner),o.owner&&(o.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new g(()=>{F(this.owner,!1),L(this.owner,()=>{let t=n();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new A(()=>Fe(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(n){if(n&&typeof n.then=="function"&&o.onSuspend){o.onSuspend(n,this.owner);return}if(o.onError&&o.onError(n,this.owner))return;throw n}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),F(this.owner))}};function Y(e){let n=new J(e);return()=>n.dispose()}function Be(e){return!!e&&typeof e.then=="function"}ge(()=>{});var Re=Symbol.for("signal"),Ne=Symbol.for("memo"),Ve=Symbol.for("signal-node");function p(e,n){let t=new C(e,{equals:n?.equals}),r=(()=>t.get()),s=(u=>{let a=typeof u=="function"?u(t.peek()):u;return t.set(a),ke(),a});return Object.defineProperty(r,Re,{value:!0,enumerable:!0}),Object.defineProperty(r,Ve,{value:{get value(){return t.peek()},get version(){return t.version}},enumerable:!1}),[r,s]}function S(e,n,t){let r=n,s=K(),u=new g(()=>L(s,()=>{try{return r=e(r)}catch(c){if(Be(c))return Se(c),r;throw c}}),{equals:t?.equals}),a=(()=>u.get());return Object.defineProperty(a,Re,{value:!0,enumerable:!0}),Object.defineProperty(a,Ne,{value:!0,enumerable:!0}),a}function P(e,n){let t=n;return Y(()=>{t=e(t)})}function Le(e,n){let t=n;Y(()=>{t=e(t)})}function je(e,n){let t=n;return Y(()=>{t=e(t)})}function k(e){return Z(e)}function w(e){return U(e)}function Oe(e){return Z(e),Promise.resolve()}function Ge(){return[()=>!1,Oe]}function We(){return j(),Promise.resolve()}function ze(e,n,t){let r=Array.isArray(e),s,u=t?.defer??!1;return a=>{let c=r?e.map(d=>d()):e();if(u){u=!1,s=c;return}let i=U(()=>n(c,s,a));return s=c,i}}function En(e,n,t){let r=[];return v(()=>{for(let s of r)s.dispose();r=[]}),S(()=>{let s=e()||[];return w(()=>{if(s.length===0){for(let i of r)i.dispose();return r=[],t?.fallback?t.fallback():[]}let u=new Map;for(let i of r)u.has(i.item)||u.set(i.item,i);let a=[],c=new Set;for(let i=0;i<s.length;i++){let d=s[i],h=u.get(d);if(h&&!c.has(h))h.setIndex(i),a.push(h),c.add(h);else{let l,f,y;D(T=>{y=T;let[_,q]=p(i);f=q,l=n(d,_)});let x={item:d,rendered:l,dispose:y,setIndex:f};a.push(x),c.add(x)}}for(let i of r)c.has(i)||i.dispose();return r=a,a.map(i=>i.rendered)})})}function Cn(e,n,t,r){let s=[],u=[];return v(()=>{for(let a of u)a.dispose();s=[],u=[]}),S(()=>{let a=e()||[];return w(()=>{if(a.length===0){for(let l of u)l.dispose();return s=[],u=[],r?.fallback?r.fallback():[]}let c=new Map;for(let l=0;l<s.length;l++)c.set(s[l],u[l]);let i=[],d=[],h=new Set;for(let l=0;l<a.length;l++){let f=n(a[l]),y=c.get(f);if(y&&!h.has(f))y.setIndex(l),i.push(y);else{let x,T,_;D(q=>{_=q;let[R,I]=p(l);T=I;let G=S(E=>{let b=(e()||[])[R()];return b??E},a[l]);x=t(G,R)}),i.push({rendered:x,dispose:_,setIndex:T})}d.push(f),h.add(f)}for(let[l,f]of c)h.has(l)||f.dispose();return s=d,u=i,i.map(l=>l.rendered)})})}function An(e,n,t){let r=[];return v(()=>{for(let s of r)s.dispose();r=[]}),S(()=>{let s=e()||[];return w(()=>{if(s.length===0){for(let i of r)i.dispose();return r=[],t?.fallback?t.fallback():[]}let u=r.length,a=s.length;for(let i=u;i<a;i++){let d,h,l,f=s[i];D(y=>{l=y;let[x,T]=p(f);h=T,d=n(x,i)}),r.push({rendered:d,setItem:h,dispose:l})}for(let i=a;i<u;i++)r[i].dispose();a<u&&(r=r.slice(0,a));let c=Math.min(u,a);for(let i=0;i<c;i++)r[i].setItem(s[i]);return r.map(i=>i.rendered)})})}var ee=!1,$e=Symbol.for("signal"),He=Symbol.for("memo"),Ke=Symbol.for("resource");function ne(e){return typeof e=="function"&&e[$e]===!0}function Ye(e){return typeof e=="function"&&e[He]===!0}function Qe(e){return typeof e=="function"&&e[Ke]===!0}function Xe(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function Je(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function Ze(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function _e(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?_e(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var te=null;function en(e){te=e}function ie(e){te&&te(e)}var re=null;function nn(e){re=e}function ue(e){return re?re(e):void 0}var oe=null;function tn(e){oe=e}function ae(){return oe?oe():void 0}var se=null;function rn(e){se=e}function ce(e,n){se&&se(e,n)}function on(e,n=(t,r)=>t===r){let t=new Map;return P(()=>{let r=e();for(let[s,u]of t){let[a,c]=u,i=n(s,r);a()!==i&&c(i)}}),r=>{let s=t.get(r);if(!s){let[u,a]=p(!1);s=[u,a],t.set(r,s);let c=e();a(n(r,c))}return s[0]()}}function sn(e,n){let[t,r]=p(e(),n);return P(()=>{let s=e();n?.timeoutMs?setTimeout(()=>r(()=>s),n.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>r(()=>s)):Promise.resolve().then(()=>r(()=>s))}),t}function un(e,n){let t,r=(...s)=>{t!==void 0&&clearTimeout(t),t=setTimeout(()=>{t=void 0,e(...s)},n)};return v(()=>{t!==void 0&&clearTimeout(t)}),r}function an(e){return!!e&&typeof e.then=="function"}var le=Symbol();function de(e,n,t={}){let r,s;typeof n=="function"?(r=typeof e=="function"?e:()=>e,s=n):(r=()=>!0,s=e,n&&typeof n=="object"&&(t=n));let u=ae(),a=u!==void 0?ue(u):void 0,c=a!==void 0,[i,d]=p(a!==void 0?a.value:t.initialValue,{equals:!1}),[h,l]=p(void 0,{equals:!1}),[f,y]=p(a!==void 0||t.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[x,T]=p(void 0,{equals:!1}),[_,q]=p(void 0,{equals:!1}),R=le,I=!1;P(()=>{let m=r();if(_(),m===!1||m===null||m===void 0){R=le,k(()=>{y("unresolved"),T(void 0),l(void 0)});return}let b=I;if(I=!1,R!==le&&m===R&&!b)return;if(R=m,c){c=!1;return}let W=!1;v(()=>W=!0);let pe=w(f),Ae=w(i),he=pe==="ready"||pe==="refreshing";k(()=>{y(he?"refreshing":"pending"),l(void 0)});try{let O=s(m,{value:Ae,refetching:he});an(O)?(T(O),ie(O),O.then(z=>{W||(u!==void 0&&ce(u,z),k(()=>{d(()=>z),y("ready"),T(void 0)}))},z=>{W||k(()=>{l(z),y("errored"),T(void 0)})})):k(()=>{d(()=>O),y("ready"),T(void 0)})}catch(O){if(W)return;k(()=>{l(O),y("errored"),T(void 0)})}});let G=()=>{let m=f();return m==="pending"||m==="refreshing"},E=(()=>{let m=h();if(m)throw m;if(G()){let b=x();if(b)throw b}return i()});return Object.defineProperties(E,{state:{get:f},loading:{get:G},error:{get:h},latest:{get:i}}),Object.defineProperty(E,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(E,Symbol.for("signal"),{value:!0,enumerable:!0}),[E,{mutate:d,refetch:()=>{I=!0,q(void 0)}}]}function Ee(e,n=300){let[t,r]=p(e),[s,u]=p(e),[a,c]=p(!1),i,d=()=>{i!==void 0&&(clearTimeout(i),i=void 0)},h=()=>{d();let f=w(t);return u(()=>f),c(!1),f},l=(f=>{let y=typeof f=="function"?f(w(t)):f;return r(()=>y),c(!0),d(),i=setTimeout(h,n),y});return v(d),[s,l,{immediate:t,pending:a,flush:h,cancel:()=>{d(),c(!1)}}]}function cn(e){return e!=null&&e!==""}function ln(e,n,t={}){let{delay:r=300,initialValue:s,shouldFetch:u=cn}=t,[a,c,i]=Ee(e,r),d=()=>u(a())?a():!1,[h,{refetch:l}]=de(d,n,s===void 0?{}:{initialValue:s});return[h,{...i,query:a,setQuery:c,refetch:l}]}function Q(e){if(typeof e=="function"&&!e.length){let n=e();return ne(n)?n:Q(n)}if(Array.isArray(e)){let n=[];for(let t=0;t<e.length;t++){let r=Q(e[t]);Array.isArray(r)?n.push.apply(n,r):n.push(r)}return n}return e}function dn(e){let n=S(e);return S(()=>Q(n()))}var fe=N();we((e,n)=>{let t=H(n,fe);t&&(t.increment(),e.finally(()=>t.decrement()))});function fn(){let[e,n]=p(0),t=0;return{increment:()=>n(t+=1),decrement:()=>n(t-=1),inFallback:()=>e()>0}}function pn(e,n){return V(fe,e,n)}var Ce=N();xe((e,n)=>{let t=H(n,Ce);return t?(t.setError(e),!0):!1});function hn(){let[e,n]=p(void 0,{equals:!1});return{error:e,reset:()=>n(()=>{}),setError:r=>n(()=>r)}}function yn(e,n){return V(Ce,e,n)}var Tn={State:C,Computed:g,subtle:{Watcher:A,untrack:U,currentComputed:me,hasSinks:ve}};var Zn=Symbol.for("signal"),et=Symbol.for("fluixi-proxy");export{et as $PROXY,Zn as $SIGNAL,Tn as Signal,fe as SuspenseContext,ee as __DEV__,k as batch,qe as createChildOwner,Le as createComputed,N as createContext,un as createDebounce,ln as createDebouncedResource,Ee as createDebouncedSignal,sn as createDeferred,P as createEffect,hn as createErrorBoundary,S as createMemo,je as createRenderEffect,de as createResource,D as createRoot,on as createSelector,p as createSignal,fn as createSuspenseBoundary,Ie as disposeScope,We as flush,K as getOwner,ue as getServerData,An as indexArray,Xe as isComponent,Ye as isMemo,Me as isOwnerDisposed,Ze as isProvider,Qe as isResource,ne as isSignal,Je as isSuspense,Cn as keyArray,_e as makeArrayFlat,En as mapArray,ae as nextResourceId,ze as on,v as onCleanup,V as provide,yn as provideErrorBoundary,pn as provideSuspense,dn as readChildren,ce as reportResourceData,L as runWithOwner,be as setOwner,rn as setResourceDataSink,tn as setResourceIdSource,en as setResourceTracker,nn as setServerDataGetter,Oe as startTransition,ie as trackResourcePromise,w as untrack,Ue as useContext,Ge as useTransition};
|
|
1
|
+
var De="__fluixi_signal_next_state__",Pe=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},o=globalThis[De]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Pe,onSuspend:null,onError:null};var ye=0,Te=1,M=2,$=class{constructor(){this.observers=null;this.watchers=null;this.version=0}updateIfNecessary(){}track(){if(o.untracked)return;let n=o.consumer;n&&((this.observers??=new Set).add(n),(n.sources??=new Set).add(this))}},C=class extends ${constructor(n,t){super(),this._value=n,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(n){if(!this._equals(this._value,n)){if(this._value=n,this.version++,this.observers)for(let t of[...this.observers])t.markDirty(M);X(this)}}peek(){return this._value}},g=class extends ${constructor(t,r){super();this._threw=!1;this._initialized=!1;this.state=M;this.sources=null;this._fn=t,this._equals=r?.equals===!1?()=>!1:r?.equals??Object.is}get(){if(o.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===Te&&this.sources){for(let t of this.sources)if(t.updateIfNecessary(),this.state===M)break}(this.state===M||!this._initialized)&&this.recompute(),this.state=ye}recompute(){if(this.sources){for(let i of this.sources)i.observers?.delete(this);this.sources.clear()}let t=o.consumer,r=o.untracked;o.consumer=this,o.untracked=!1;let s,u=!1,a;try{s=this._fn()}catch(i){u=!0,a=i,s=this._value}finally{o.consumer=t,o.untracked=r}let c=!this._initialized||this._threw!==u||(u?a!==this._error:!this._equals(this._value,s));if(this._initialized=!0,this._threw=u,this._error=a,this._value=s,c){if(this.version++,this.observers)for(let i of[...this.observers])i.markDirty(M);X(this)}}markDirty(t){if(this.state>=t)return;let r=this.state===ye;if(this.state=t,r){if(this.observers)for(let s of[...this.observers])s.markDirty(Te);X(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function X(e){if(e.watchers)for(let n of[...e.watchers])n._notify(e)}var A=class{constructor(n){this._watched=new Set;this._pending=new Set;this._notifyFn=n}watch(...n){for(let t of n)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...n){for(let t of n)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let n=[...this._pending];return this._pending.clear(),n}_notify(n){if(!this._watched.has(n)||this._pending.has(n))return;let t=this._pending.size===0;this._pending.add(n),t&&this._notifyFn()}};function U(e){if(o.untracked)return e();o.untracked=!0;try{return e()}finally{o.untracked=!1}}function me(){return o.consumer}function ve(e){return!!(e.observers&&e.observers.size)||!!(e.watchers&&e.watchers.size)}function qe(e){let n=B(e);return e&&(e.owned??=[]).push(n),n}function Ie(e,n=!0){F(e,n)}function Me(e){return!!e&&e.disposed===!0}function B(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function N(e){let n=Symbol("context");return{id:n,defaultValue:e,Provider:r=>{let s=o.owner,u=B(s);(u.contexts=new Map).set(n,r.value),s&&(s.owned??=[]).push(u),o.owner=u;try{return r.children}finally{o.owner=s}}}}function Ue(e){let n=o.owner;for(;n;){if(n.contexts&&n.contexts.has(e.id))return n.contexts.get(e.id);n=n.parent}return e.defaultValue}function H(e,n){let t=e;for(;t;){if(t.contexts&&t.contexts.has(n.id))return t.contexts.get(n.id);t=t.parent}return n.defaultValue}function V(e,n,t){let r=B(o.owner);(r.contexts=new Map).set(e.id,n),o.owner&&(o.owner.owned??=[]).push(r);let s=o.owner;o.owner=r;try{return t()}finally{o.owner=s}}function we(e){o.onSuspend=e}function Se(e){return o.onSuspend?(o.onSuspend(e,o.owner),!0):!1}function xe(e){o.onError=e}function K(){return o.owner}function be(e){let n=o.owner;return o.owner=e,n}function L(e,n){let t=o.owner;o.owner=e;try{return n()}finally{o.owner=t}}function v(e){if(o.owner){if(o.owner.disposed){e();return}(o.owner.cleanups??=[]).push(e)}}function F(e,n=!0){if(!e.disposed){if(e.owned){for(let t=e.owned.length-1;t>=0;t--)F(e.owned[t]);e.owned=null}if(e.cleanups){for(let t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}n&&(e.disposed=!0)}}function D(e){let n=B(o.owner);o.owner&&(o.owner.owned??=[]).push(n);let t=o.owner;o.owner=n;try{return e(()=>F(n))}finally{o.owner=t}}function ge(e){o.hostSchedule=e??(n=>{Promise.resolve().then(n)})}function Fe(e){e.queued||(e.queued=!0,o.queue.push(e),!o.scheduled&&o.batchDepth===0&&(o.scheduled=!0,o.hostSchedule(j)))}function j(){if(o.scheduled=!1,o.flushing)return;o.flushing=!0;let e=0;try{for(;o.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let n=o.queue;o.queue=[];for(let t of n)t.queued=!1,t.disposed||t.run()}}finally{o.flushing=!1}}function ke(){o.batchDepth===0&&j()}function Z(e){o.batchDepth++;try{return e()}finally{--o.batchDepth===0&&j()}}var J=class{constructor(n){this.queued=!1;this.disposed=!1;this.owner=B(o.owner),o.owner&&(o.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new g(()=>{F(this.owner,!1),L(this.owner,()=>{let t=n();typeof t=="function"&&(this.owner.cleanups??=[]).push(t)})}),this.watcher=new A(()=>Fe(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(n){if(n&&typeof n.then=="function"&&o.onSuspend){o.onSuspend(n,this.owner);return}if(o.onError&&o.onError(n,this.owner))return;throw n}}}dispose(){this.disposed||(this.disposed=!0,this.watcher.unwatch(this.computed),F(this.owner))}};function Y(e){let n=new J(e);return()=>n.dispose()}function Be(e){return!!e&&typeof e.then=="function"}ge(()=>{});var Re=Symbol.for("signal"),Ne=Symbol.for("memo"),Ve=Symbol.for("signal-node");function p(e,n){let t=new C(e,{equals:n?.equals}),r=(()=>t.get()),s=(u=>{let a=typeof u=="function"?u(t.peek()):u;return t.set(a),ke(),a});return Object.defineProperty(r,Re,{value:!0,enumerable:!0}),Object.defineProperty(r,Ve,{value:{get value(){return t.peek()},get version(){return t.version}},enumerable:!1}),[r,s]}function S(e,n,t){let r=n,s=K(),u=new g(()=>L(s,()=>{try{return r=e(r)}catch(c){if(Be(c))return Se(c),r;throw c}}),{equals:t?.equals}),a=(()=>u.get());return Object.defineProperty(a,Re,{value:!0,enumerable:!0}),Object.defineProperty(a,Ne,{value:!0,enumerable:!0}),a}function P(e,n){let t=n;return Y(()=>{t=e(t)})}function Le(e,n){let t=n;Y(()=>{t=e(t)})}function je(e,n){let t=n;return Y(()=>{t=e(t)})}function k(e){return Z(e)}function w(e){return U(e)}function Oe(e){return Z(e),Promise.resolve()}function Ge(){return[()=>!1,Oe]}function We(){return j(),Promise.resolve()}function ze(e,n,t){let r=Array.isArray(e),s,u=t?.defer??!1;return a=>{let c=r?e.map(d=>d()):e();if(u){u=!1,s=c;return}let i=U(()=>n(c,s,a));return s=c,i}}function En(e,n,t){let r=[];return v(()=>{for(let s of r)s.dispose();r=[]}),S(()=>{let s=e()||[];return w(()=>{if(s.length===0){for(let i of r)i.dispose();return r=[],t?.fallback?t.fallback():[]}let u=new Map;for(let i of r)u.has(i.item)||u.set(i.item,i);let a=[],c=new Set;for(let i=0;i<s.length;i++){let d=s[i],h=u.get(d);if(h&&!c.has(h))h.setIndex(i),a.push(h),c.add(h);else{let l,f,y;D(T=>{y=T;let[_,q]=p(i);f=q,l=n(d,_)});let x={item:d,rendered:l,dispose:y,setIndex:f};a.push(x),c.add(x)}}for(let i of r)c.has(i)||i.dispose();return r=a,a.map(i=>i.rendered)})})}function Cn(e,n,t,r){let s=[],u=[];return v(()=>{for(let a of u)a.dispose();s=[],u=[]}),S(()=>{let a=e()||[];return w(()=>{if(a.length===0){for(let l of u)l.dispose();return s=[],u=[],r?.fallback?r.fallback():[]}let c=new Map;for(let l=0;l<s.length;l++)c.set(s[l],u[l]);let i=[],d=[],h=new Set;for(let l=0;l<a.length;l++){let f=n(a[l]),y=c.get(f);if(y&&!h.has(f))y.setIndex(l),i.push(y);else{let x,T,_;D(q=>{_=q;let[R,I]=p(l);T=I;let G=S(E=>{let b=(e()||[])[R()];return b??E},a[l]);x=t(G,R)}),i.push({rendered:x,dispose:_,setIndex:T})}d.push(f),h.add(f)}for(let[l,f]of c)h.has(l)||f.dispose();return s=d,u=i,i.map(l=>l.rendered)})})}function An(e,n,t){let r=[];return v(()=>{for(let s of r)s.dispose();r=[]}),S(()=>{let s=e()||[];return w(()=>{if(s.length===0){for(let i of r)i.dispose();return r=[],t?.fallback?t.fallback():[]}let u=r.length,a=s.length;for(let i=u;i<a;i++){let d,h,l,f=s[i];D(y=>{l=y;let[x,T]=p(f);h=T,d=n(x,i)}),r.push({rendered:d,setItem:h,dispose:l})}for(let i=a;i<u;i++)r[i].dispose();a<u&&(r=r.slice(0,a));let c=Math.min(u,a);for(let i=0;i<c;i++)r[i].setItem(s[i]);return r.map(i=>i.rendered)})})}var ee=!1,$e=Symbol.for("signal"),He=Symbol.for("memo"),Ke=Symbol.for("resource");function ne(e){return typeof e=="function"&&e[$e]===!0}function Ye(e){return typeof e=="function"&&e[He]===!0}function Qe(e){return typeof e=="function"&&e[Ke]===!0}function Xe(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function Je(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function Ze(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function _e(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?_e(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var te=null;function en(e){te=e}function ie(e){te&&te(e)}var re=null;function nn(e){re=e}function ue(e){return re?re(e):void 0}var oe=null;function tn(e){oe=e}function ae(){return oe?oe():void 0}var se=null;function rn(e){se=e}function ce(e,n){se&&se(e,n)}function on(e,n=(t,r)=>t===r){let t=new Map;return P(()=>{let r=e();for(let[s,u]of t){let[a,c]=u,i=n(s,r);a()!==i&&c(i)}}),r=>{let s=t.get(r);if(!s){let[u,a]=p(!1);s=[u,a],t.set(r,s);let c=e();a(n(r,c))}return s[0]()}}function sn(e,n){let[t,r]=p(e(),n);return P(()=>{let s=e();n?.timeoutMs?setTimeout(()=>r(()=>s),n.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>r(()=>s)):Promise.resolve().then(()=>r(()=>s))}),t}function un(e,n){let t,r=(...s)=>{t!==void 0&&clearTimeout(t),t=setTimeout(()=>{t=void 0,e(...s)},n)};return v(()=>{t!==void 0&&clearTimeout(t)}),r}function an(e){return!!e&&typeof e.then=="function"}var le=Symbol();function de(e,n,t={}){let r,s;typeof n=="function"?(r=typeof e=="function"?e:()=>e,s=n):(r=()=>!0,s=e,n&&typeof n=="object"&&(t=n));let u=t.transport===!1?void 0:ae(),a=u!==void 0?ue(u):void 0,c=a!==void 0,[i,d]=p(a!==void 0?a.value:t.initialValue,{equals:!1}),[h,l]=p(void 0,{equals:!1}),[f,y]=p(a!==void 0||t.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[x,T]=p(void 0,{equals:!1}),[_,q]=p(void 0,{equals:!1}),R=le,I=!1;P(()=>{let m=r();if(_(),m===!1||m===null||m===void 0){R=le,k(()=>{y("unresolved"),T(void 0),l(void 0)});return}let b=I;if(I=!1,R!==le&&m===R&&!b)return;if(R=m,c){c=!1;return}let W=!1;v(()=>W=!0);let pe=w(f),Ae=w(i),he=pe==="ready"||pe==="refreshing";k(()=>{y(he?"refreshing":"pending"),l(void 0)});try{let O=s(m,{value:Ae,refetching:he});an(O)?(T(O),ie(O),O.then(z=>{W||(u!==void 0&&ce(u,z),k(()=>{d(()=>z),y("ready"),T(void 0)}))},z=>{W||k(()=>{l(z),y("errored"),T(void 0)})})):k(()=>{d(()=>O),y("ready"),T(void 0)})}catch(O){if(W)return;k(()=>{l(O),y("errored"),T(void 0)})}});let G=()=>{let m=f();return m==="pending"||m==="refreshing"},E=(()=>{let m=h();if(m)throw m;if(G()){let b=x();if(b)throw b}return i()});return Object.defineProperties(E,{state:{get:f},loading:{get:G},error:{get:h},latest:{get:i}}),Object.defineProperty(E,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(E,Symbol.for("signal"),{value:!0,enumerable:!0}),[E,{mutate:d,refetch:()=>{I=!0,q(void 0)}}]}function Ee(e,n=300){let[t,r]=p(e),[s,u]=p(e),[a,c]=p(!1),i,d=()=>{i!==void 0&&(clearTimeout(i),i=void 0)},h=()=>{d();let f=w(t);return u(()=>f),c(!1),f},l=(f=>{let y=typeof f=="function"?f(w(t)):f;return r(()=>y),c(!0),d(),i=setTimeout(h,n),y});return v(d),[s,l,{immediate:t,pending:a,flush:h,cancel:()=>{d(),c(!1)}}]}function cn(e){return e!=null&&e!==""}function ln(e,n,t={}){let{delay:r=300,initialValue:s,shouldFetch:u=cn}=t,[a,c,i]=Ee(e,r),d=()=>u(a())?a():!1,[h,{refetch:l}]=de(d,n,s===void 0?{}:{initialValue:s});return[h,{...i,query:a,setQuery:c,refetch:l}]}function Q(e){if(typeof e=="function"&&!e.length){let n=e();return ne(n)?n:Q(n)}if(Array.isArray(e)){let n=[];for(let t=0;t<e.length;t++){let r=Q(e[t]);Array.isArray(r)?n.push.apply(n,r):n.push(r)}return n}return e}function dn(e){let n=S(e);return S(()=>Q(n()))}var fe=N();we((e,n)=>{let t=H(n,fe);t&&(t.increment(),e.finally(()=>t.decrement()))});function fn(){let[e,n]=p(0),t=0;return{increment:()=>n(t+=1),decrement:()=>n(t-=1),inFallback:()=>e()>0}}function pn(e,n){return V(fe,e,n)}var Ce=N();xe((e,n)=>{let t=H(n,Ce);return t?(t.setError(e),!0):!1});function hn(){let[e,n]=p(void 0,{equals:!1});return{error:e,reset:()=>n(()=>{}),setError:r=>n(()=>r)}}function yn(e,n){return V(Ce,e,n)}var Tn={State:C,Computed:g,subtle:{Watcher:A,untrack:U,currentComputed:me,hasSinks:ve}};var Zn=Symbol.for("signal"),et=Symbol.for("fluixi-proxy");export{et as $PROXY,Zn as $SIGNAL,Tn as Signal,fe as SuspenseContext,ee as __DEV__,k as batch,qe as createChildOwner,Le as createComputed,N as createContext,un as createDebounce,ln as createDebouncedResource,Ee as createDebouncedSignal,sn as createDeferred,P as createEffect,hn as createErrorBoundary,S as createMemo,je as createRenderEffect,de as createResource,D as createRoot,on as createSelector,p as createSignal,fn as createSuspenseBoundary,Ie as disposeScope,We as flush,K as getOwner,ue as getServerData,An as indexArray,Xe as isComponent,Ye as isMemo,Me as isOwnerDisposed,Ze as isProvider,Qe as isResource,ne as isSignal,Je as isSuspense,Cn as keyArray,_e as makeArrayFlat,En as mapArray,ae as nextResourceId,ze as on,v as onCleanup,V as provide,yn as provideErrorBoundary,pn as provideSuspense,dn as readChildren,ce as reportResourceData,L as runWithOwner,be as setOwner,rn as setResourceDataSink,tn as setResourceIdSource,en as setResourceTracker,nn as setServerDataGetter,Oe as startTransition,ie as trackResourcePromise,w as untrack,Ue as useContext,Ge as useTransition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Te=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var zt=Object.prototype.hasOwnProperty;var Ht=(e,t)=>{for(var n in t)Te(e,n,{get:t[n],enumerable:!0})},Yt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Wt(t))!zt.call(e,r)&&r!==n&&Te(e,r,{get:()=>t[r],enumerable:!(o=$t(t,r))||o.enumerable});return e};var Kt=e=>Yt(Te({},"__esModule",{value:!0}),e);var bn={};Ht(bn,{$MEMO:()=>Tt,$PROXY:()=>Le,$RESOURCE:()=>bt,$SIGNAL:()=>de,__DEV__:()=>Y,batch:()=>_,createComputed:()=>qt,createContext:()=>ve,createDebounce:()=>lt,createDeferred:()=>at,createEffect:()=>$,createMemo:()=>St,createProvider:()=>Ft,createRenderEffect:()=>We,createResource:()=>Rt,createRoot:()=>Ct,createSelector:()=>Ae,createSignal:()=>U,default:()=>Tn,flush:()=>Et,getOwner:()=>_t,getServerData:()=>Ne,getSharedConfig:()=>pn,getSuspenseContext:()=>Nt,getSuspenseListContext:()=>Ut,isComponent:()=>Qe,isMemo:()=>Xe,isProvider:()=>et,isResource:()=>Je,isSignal:()=>K,isSuspense:()=>Ze,makeArrayFlat:()=>me,nextResourceId:()=>Ue,on:()=>kt,onCleanup:()=>fe,onResolve:()=>Mt,readChildren:()=>Fe,reportResourceData:()=>Ie,resumeEffects:()=>It,runWithOwner:()=>At,setOwner:()=>dn,setResourceDataSink:()=>pt,setResourceIdSource:()=>dt,setResourceTracker:()=>ct,setScheduler:()=>Lt,setServerDataGetter:()=>ft,sharedConfig:()=>ce,startTransition:()=>$e,trackPromise:()=>Bt,trackResourcePromise:()=>qe,untrack:()=>j,useContext:()=>A,useTransition:()=>Pt});module.exports=Kt(bn);var Ke=require("@fluixi/utils/object"),be=require("@fluixi/utils/functions"),z=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:n}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let o of t)o.remove(this);if(n){for(let o of n)if((0,be.isFunction)(o)&&!(o instanceof e))try{o()}catch(r){console.error("Error in unsubscribe function:",r)}else if((0,Ke.isObject)(o)&&typeof o.unsubscribe=="function")try{o.unsubscribe()}catch(r){console.error("Error unsubscribing child:",r)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:n,_subscriptions:o}=this;if(n){if((0,be.isFunction)(t))try{t()}catch(r){console.error("Error in unsubscribe function:",r)}else if(t.unsubscribe)try{t.unsubscribe()}catch(r){console.error("Error unsubscribing:",r)}return this}return o||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:n}=this;if(!n)return;let o=n.indexOf(t);o!==-1&&(n.splice(o,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:n}=this;n?Array.isArray(n)?n.push(t):this._parentOrParents=[n,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:n}=this;if(n===t)this._parentOrParents=null;else if(Array.isArray(n)){let o=n.indexOf(t);o!==-1&&(n.splice(o,1),n.length===1&&(this._parentOrParents=n[0]))}}};var te=class extends z{constructor(n,o,r){super();this.isStopped=!1;let s;n?typeof n=="object"?s=n:s={next:n,error:o,complete:r}:s={},this.destination=s}next(n){if(!this.isStopped&&this.destination.next)try{this.destination.next(n)}catch(o){this.error(o)}}error(n){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(n)}catch(o){throw o}else throw n;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(n){this.error(n);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},ye=class extends te{constructor(n,o,r,s){super(n,o,r);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(n){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(n)}catch(o){this.error(o)}}error(n){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(n)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};var H=class extends z{constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,n,o){let r;t instanceof te?r=t:r=new ye(t,n,o);let{_subscribe:s}=this;try{let l=s.call(this,r);l&&(typeof l=="function"||typeof l.unsubscribe=="function")&&r.add(l)}catch(l){r.error(l)}return r}pipe(...t){return t.length===0?this:t.reduce((n,o)=>o(n),this)}toPromise(){return new Promise((t,n)=>{let o;this.subscribe({next:r=>o=r,error:n,complete:()=>t(o)})})}};var Q=require("@fluixi/utils");var Y=!1,Xt=Symbol.for("signal"),Jt=Symbol.for("memo"),Qt=Symbol.for("resource");function K(e){return typeof e=="function"&&e[Xt]===!0}function Xe(e){return typeof e=="function"&&e[Jt]===!0}function Je(e){return typeof e=="function"&&e[Qt]===!0}function Qe(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function Ze(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function et(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function me(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?me(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var Zt="__fluixi_signal_next_state__",en=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},a=globalThis[Zt]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:en,onSuspend:null,onError:null};var tt=0,nt=1,X=2,ne=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))}},re=class extends ne{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++,this.observers)for(let n of[...this.observers])n.markDirty(X);we(this)}}peek(){return this._value}},G=class extends ne{constructor(n,o){super();this._threw=!1;this._initialized=!1;this.state=X;this.sources=null;this._fn=n,this._equals=o?.equals===!1?()=>!1:o?.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===nt&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===X)break}(this.state===X||!this._initialized)&&this.recompute(),this.state=tt}recompute(){if(this.sources){for(let f of this.sources)f.observers?.delete(this);this.sources.clear()}let n=a.consumer,o=a.untracked;a.consumer=this,a.untracked=!1;let r,s=!1,l;try{r=this._fn()}catch(f){s=!0,l=f,r=this._value}finally{a.consumer=n,a.untracked=o}let c=!this._initialized||this._threw!==s||(s?l!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=s,this._error=l,this._value=r,c){if(this.version++,this.observers)for(let f of[...this.observers])f.markDirty(X);we(this)}}markDirty(n){if(this.state>=n)return;let o=this.state===tt;if(this.state=n,o){if(this.observers)for(let r of[...this.observers])r.markDirty(nt);we(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function we(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var oe=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 tn(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function rt(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function Se(){return a.owner}function se(e,t){let n=a.owner;a.owner=e;try{return t()}finally{a.owner=n}}function Oe(e){if(a.owner){if(a.owner.disposed){e();return}(a.owner.cleanups??=[]).push(e)}}function xe(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)xe(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function ot(e){a.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function nn(e){e.queued||(e.queued=!0,a.queue.push(e),!a.scheduled&&a.batchDepth===0&&(a.scheduled=!0,a.hostSchedule(Ce)))}function Ce(){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 n of t)n.queued=!1,n.disposed||n.run()}}finally{a.flushing=!1}}function st(){a.batchDepth===0&&Ce()}var ge=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=tn(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new G(()=>{xe(this.owner,!1),se(this.owner,()=>{let n=t();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),this.watcher=new oe(()=>nn(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.watcher.unwatch(this.computed),xe(this.owner))}};function it(e){let t=new ge(e);return()=>t.dispose()}function rn(e){return!!e&&typeof e.then=="function"}ot(()=>{});var ut=Symbol.for("signal"),on=Symbol.for("memo"),sn=Symbol.for("signal-node");function Re(e,t){let n=new re(e,{equals:t?.equals}),o=(()=>n.get()),r=(s=>{let l=typeof s=="function"?s(n.peek()):s;return n.set(l),st(),l});return Object.defineProperty(o,ut,{value:!0,enumerable:!0}),Object.defineProperty(o,sn,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[o,r]}function ie(e,t,n){let o=t,r=Se(),s=new G(()=>se(r,()=>{try{return o=e(o)}catch(c){if(rn(c))return rt(c),o;throw c}}),{equals:n?.equals}),l=(()=>s.get());return Object.defineProperty(l,ut,{value:!0,enumerable:!0}),Object.defineProperty(l,on,{value:!0,enumerable:!0}),l}function _e(e,t){let n=t;return it(()=>{n=e(n)})}function Ae(e,t=(n,o)=>n===o){let n=new Map;return _e(()=>{let o=e();for(let[r,s]of n){let[l,c]=s,f=t(r,o);l()!==f&&c(f)}}),o=>{let r=n.get(o);if(!r){let[s,l]=Re(!1);r=[s,l],n.set(o,r);let c=e();l(t(o,c))}return r[0]()}}function at(e,t){let[n,o]=Re(e(),t);return _e(()=>{let r=e();t?.timeoutMs?setTimeout(()=>o(()=>r),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>o(()=>r)):Promise.resolve().then(()=>o(()=>r))}),n}function lt(e,t){let n,o=(...r)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...r)},t)};return Oe(()=>{n!==void 0&&clearTimeout(n)}),o}function ue(e){if(typeof e=="function"&&!e.length){let t=e();return K(t)?t:ue(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let o=ue(e[n]);Array.isArray(o)?t.push.apply(t,o):t.push(o)}return t}return e}function Fe(e){let t=ie(e);return ie(()=>ue(t()))}var Ee=null;function ct(e){Ee=e}function qe(e){Ee&&Ee(e)}var Pe=null;function ft(e){Pe=e}function Ne(e){return Pe?Pe(e):void 0}var ke=null;function dt(e){ke=e}function Ue(){return ke?ke():void 0}var De=null;function pt(e){De=e}function Ie(e,t){De&&De(e,t)}var de=Symbol.for("signal"),Tt=Symbol.for("memo"),bt=Symbol.for("resource"),Le=Symbol("fluixi-proxy"),yt=Symbol.for("signal-node"),F=0,J=1,P=2,E=3,u=null,d=null,i=null,ae=null,le=0,un=!1,Me=!1,V=0,an=1e6,m=new WeakMap,g=null;var ln=null,cn=new Map,fn=0,ce={context:null,owner:null,routeData:new Map,matchedRoute:new Map};function dn(e){u=e,ce.owner=e,ce.context=e}function pn(){return ce}function vn(){return`node_${++fn}_${Date.now()}`}function hn(e){!1}function mt(e,t,n){let o={id:vn(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return hn(o),o}function wt(e,t){return e===t}function Ve(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}var Be=null,Ge=null;function xt(){if(!Be){let[e,t]=U(!1);Be=e,Ge=t}}function gt(e){if(i)i.indexOf(e)===-1&&i.push(e);else if(g&&g.running&&!e.pure)g.effects.indexOf(e)===-1&&g.effects.push(e);else if(!e.pure||e.computed)Z(e);else if(e.pure&&!e.computed&&e.accessor){let t=d,n=i;d=null,i=[],e.accessor(),d=t;let o=i;if(i=n,o.length>0){let r=i;pe(o),i=r}}}function vt(e,t){for(let n=0;n<e.length;n++)t(e[n])}function U(e,t){let n=e;typeof n=="object"&&n&&Le in n&&delete n[Le];let o=mt("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),r=[l,c];m.set(r,new Set);let s;function l(){let f=d;if(f){f.sources?f.sources.indexOf(r)===-1&&f.sources.push(r):f.sources=[r];let p=m.get(r);p&&!p.has(f)&&p.add(f)}return n}function c(f){let p=typeof f=="function"?f(n):f,b=o.equals||wt;if(t?.equals===!1||!b(n,p)){n=p,o.value=p,o.version++,o.updated=Date.now();let k=m.get(r);if(k&&k.size>0){let D=function(v,h=!1){let q=v.state;if(!(q===E&&v===d)){if(h&&!v.pure){q===F&&(v.state=J,un&&(i!==null&&i.indexOf(v)===-1?i.push(v):C.push(v)));return}if(!w.has(v)&&(w.add(v),v.state=P,q===F||q===J?C.push(v):!v.pure&&i!==null&&i.indexOf(v)===-1&&i.push(v),v.pure&&v.accessor)){let O=m.get(v.accessor);O&&vt(Array.from(O),R=>D(R,!0))}}};var x=D;let S=Array.from(k),C=[],w=new Set;vt(S,D);for(let v of C)gt(v)}}}return l.toObservable=()=>new H(f=>{let p=!0;return $(()=>{let x=l();p?p=!1:f.next(x)})}),Object.defineProperty(l,de,{value:!0,enumerable:!0}),Object.defineProperty(l,yt,{value:o,enumerable:!1}),r}function $(e,t,n){let o={fn:e,state:P,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:u,contexts:null,pure:!1,updatedAt:null};u&&(u.owned?u.owned.push(o):u.owned=[o]);let r=T&&A(T);return r&&(o.suspense=r),je(o,t),()=>I(o)}function je(e,t){if(e.sources){for(let r of e.sources){let s=m.get(r);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let r=0;r<e.owned.length;r++)I(e.owned[r]);e.owned=null}let n=d,o=u;if(d=e,u=e,le++,le>an)throw le=0,d=n,u=o,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=E;let r=e.fn(t);typeof r=="function"&&(e.cleanups?e.cleanups.push(r):e.cleanups=[r]),e.state===E&&(e.state=F)}catch(r){if((0,Q.isPromise)(r)){let s=T&&A(T);s&&(s.increment(),r.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Ve(r)}finally{d=n,u=o}}function Z(e){if(!(e.disposed||!e.fn||e.state===F)&&(e.state===P||e.state===J||e.state===E)){if(e.cleanups){for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}if(e.owned){for(let t=0;t<e.owned.length;t++)I(e.owned[t]);e.owned=null}e.renderEffect?Dt(e):je(e,e.value)}}function I(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=m.get(t);n&&n.delete(e)}if(e.cleanups)for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();if(e.owned)for(let t=0;t<e.owned.length;t++)I(e.owned[t]);if(e.owner&&e.owner.owned){let t=e.owner.owned.indexOf(e);t!==-1&&e.owner.owned.splice(t,1)}}function St(e,t,n){let o=mt("memo",t,{equals:n?.equals===!1?void 0:n?.equals,name:n?.name}),r={fn:e,state:P,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!0,updatedAt:null,node:o,accessor:void 0};u&&(u.owned?u.owned.push(r):u.owned=[r]);let s=()=>{if(d&&d!==r){d.sources?d.sources.indexOf(s)===-1&&d.sources.push(s):d.sources=[s];let c=s;m.has(c)||m.set(c,new Set);let f=m.get(c);f&&f.add(d)}if(r.state!==F){if(r.sources){for(let p of r.sources){let b=m.get(p);b&&b.delete(r)}r.sources=null,r.sourceSlots=null}if(r.cleanups){for(let p=0;p<r.cleanups.length;p++)r.cleanups[p]();r.cleanups=null}if(r.owned){for(let p=0;p<r.owned.length;p++)I(r.owned[p]);r.owned=null}let c=d,f=u;d=r,u=r,r.state=E;try{let p=r.fn(r.value),b=o.equals||wt;if(n?.equals===!1||!b(r.value,p)){r.value=p,o.value=p,o.version++,o.updated=Date.now();let k=s,S=m.get(k);if(S&&S.size>0){let v=function(h,q=!1){if(h===r)return;let O=h.state;if(O!==E){if(q&&!h.pure){O===F&&(h.state=J,i!==null&&i.indexOf(h)===-1?i.push(h):w.push(h));return}if(!D.has(h)&&(D.add(h),h.state=P,O===F||O===J?w.push(h):!h.pure&&i!==null&&i.indexOf(h)===-1&&i.push(h),h.pure&&h.accessor)){let R=m.get(h.accessor);if(R&&R.size>0)for(let W of Array.from(R))v(W,!0)}}};var l=v;let C=Array.from(S),w=[],D=new Set;for(let h=0;h<C.length;h++)v(C[h]);for(let h of w)gt(h)}}r.state===E&&(r.state=F)}catch(p){if((0,Q.isPromise)(p)){let b=T&&A(T);if(!b&&T){let x=f;for(;x;){if(x.contexts?.has(T.id)){b=x.contexts.get(T.id);break}x=x.owner}}return b&&(b.increment(),p.finally(()=>b.decrement())),r.value}Ve(p)}finally{d=c,u=f}}return r.value};return r.accessor=s,m.set(s,new Set),s.toObservable=()=>new H(l=>{let c=!0;return $(()=>{let p=s();c?c=!1:l.next(p)})}),Object.defineProperty(s,de,{value:!0,enumerable:!0}),Object.defineProperty(s,Tt,{value:!0,enumerable:!0}),Object.defineProperty(s,yt,{value:o,enumerable:!1}),s}function pe(e){let t=[],n=[];for(let r of e)r.pure&&!r.computed&&r.accessor?t.indexOf(r)===-1&&t.push(r):(r.computed||!r.pure)&&n.indexOf(r)===-1&&n.push(r);i=[];let o=0;for(;o<t.length;){let r=t[o++],s=m.get(r.accessor);if(s&&s.size>0){let c=d;d=null,r.accessor(),d=c}let l=i.splice(0);for(let c of l)c.pure&&!c.computed&&c.accessor?t.indexOf(c)===-1&&t.push(c):(c.computed||!c.pure)&&n.indexOf(c)===-1&&n.push(c)}i=null;for(let r of n)(r.computed||!r.pure)&&Z(r)}function _(e){if(i&&V>0)return e();if(i&&V===0){let t=i,n=[];i=n,V++;let o;try{o=e()}finally{V--,i=t}let r=i;return pe(n),i=r,o}V++,i=[],ae=[];try{return e()}finally{V--,Ot()}}function Ot(){if(!Me){Me=!0,le=0;try{for(;i&&i.length>0;){let e=i;i=null,pe(e)}if(i=null,ae){let e=ae;ae=null;for(let t=0;t<e.length;t++)Z(e[t])}}finally{Me=!1}}}function Ct(e){let t={owned:null,cleanups:null,contexts:null,owner:u},n=d;d=null;let o=u;u=t;try{return e(()=>{if(t.owned)for(let r=0;r<t.owned.length;r++)I(t.owned[r]);if(t.cleanups)for(let r=0;r<t.cleanups.length;r++)t.cleanups[r]()})}finally{u=o,d=n}}function j(e){let t=d;d=null;try{return e()}finally{d=t}}function fe(e){u&&(u.cleanups?u.cleanups.push(e):u.cleanups=[e])}function Rt(e,t,n={}){let o,r;typeof t=="function"?(o=typeof e=="function"?e:()=>e,r=t):(o=()=>!0,r=e,t&&typeof t=="object"&&(n=t));let{initialValue:s,name:l}=n,c=Ue(),f=c!==void 0?Ne(c):void 0,p=f!==void 0,[b,x]=U(f!==void 0?f.value:n.initialValue,{equals:!1}),[k,S]=U(void 0,{equals:!1}),[C,w]=U(f!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[D,v]=U(void 0,{equals:!1}),[h,q]=U(void 0,{equals:!1}),O=Symbol(),R=O,W=!1,Gt=y=>{if(!(typeof localStorage>"u"))try{y&&localStorage.setItem("storage",JSON.stringify({data:y,timestamp:Date.now()}))}catch(L){console.error(`Failed to save resource to cache (${l}):`,L)}},Vt=$(()=>{let y=o?o():e;if(h(),y===!1||y===null||y===void 0){R=O,_(()=>{w("unresolved"),v(void 0),S(void 0)});return}let L=W;if(W=!1,R!==O&&y===R&&!L)return;if(R=y,p){p=!1;return}let B=!1;fe(()=>B=!0);let He=j(C),jt=j(b),Ye=He==="ready"||He==="refreshing";_(()=>{w(Ye?"refreshing":"pending"),S(void 0)});try{let N=r(y,{value:jt,refetching:Ye});if((0,Q.isPromise)(N)){v(N),qe(N),N.then(M=>{B||(c!==void 0&&Ie(c,M),_(()=>{x(()=>M),Gt(M),w("ready"),v(void 0)}))},M=>{B||_(()=>{S(M),w("errored"),v(void 0)})}).catch(M=>{B||_(()=>{S(M),w("errored"),v(void 0)})});let he=T&&A(T);he&&(he.increment(),N.finally(()=>he.decrement()))}else{if(B)return;_(()=>{x(()=>N),w("ready"),v(void 0)})}}catch(N){if(B)return;_(()=>{S(N),w("errored"),v(void 0)})}});fe(Vt);let ze=()=>{let y=C();return y==="pending"||y==="refreshing"},ee=(()=>{let y=k();if(y)throw y;if(ze()){let L=D();if(L)throw L}return b()});return Object.defineProperty(ee,bt,{value:!0,enumerable:!0}),Object.defineProperty(ee,de,{value:!0,enumerable:!0}),Object.defineProperties(ee,{state:{get:C},loading:{get:()=>ze()},error:{get:k},latest:{get:b}}),[ee,{mutate:x,refetch:()=>{W=!0,q(void 0)}}]}function _t(){return u}function At(e,t){let n=u,o=d;u=e,d=null;try{return t()}finally{u=n,d=o}}function ve(e){let t=Symbol("context"),n=Ft(t);return{id:t,Provider:n,defaultValue:e}}function Ft(e){return t=>{let n=u;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let o;return We(()=>{o=j(()=>{let r=u;return r&&(r.contexts||(r.contexts=new Map),r.contexts.set(e,t.value)),Fe(()=>t.children)})}),o}}function A(e){let t=u;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.owner}if(e)return e.defaultValue}function Et(){return new Promise(e=>{queueMicrotask(()=>{Ot(),e()})})}function $e(e){if(g&&g.running)return e(),g.done;xt();let t,n=new Promise(r=>t=r),o={running:!0,effects:[],resolve:t,done:n};g=o;try{e()}finally{o.running=!1}return o.effects.length?(Ge(!0),Promise.resolve().then(()=>{let r=o.effects.splice(0);g=null,Ge(!1),r.length&&_(()=>{for(let s of r)s.state=P,Z(s)}),t()}),n):(g=null,t(),n)}function Pt(){return xt(),[Be,$e]}function kt(e,t,n){let o=n?.defer??!1,r=!0;return s=>{let l=e();return o&&r?(r=!1,s):j(()=>t(l,s))}}function We(e,t,n){let o={fn:e,state:P,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};u&&(u.owned?u.owned.push(o):u.owned=[o]);let r=T&&A(T);return r&&(o.suspense=r),Dt(o),()=>I(o)}function Dt(e){if(e.sources){for(let r of e.sources){let s=m.get(r);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.cleanups){for(let r=0;r<e.cleanups.length;r++)e.cleanups[r]();e.cleanups=null}if(e.owned){for(let r=0;r<e.owned.length;r++)I(e.owned[r]);e.owned=null}let t=d,n=u,o=i;d=e,u=e,i===null&&(i=[]),e.state=E;try{let r=e.fn(e.value);typeof r=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(r)),e.value=r,e.state===E&&(e.state=F)}catch(r){if((0,Q.isPromise)(r)){let s=T&&A(T);s&&(s.increment(),r.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Ve(r)}finally{d=t,u=n;let r=i;if(i=o,r!==o&&r&&r.length>0){let s=i;pe(r),i=s}}}function qt(e,t,n){let o={fn:e,state:P,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!0,computed:!0,updatedAt:null};u&&(u.owned?u.owned.push(o):u.owned=[o]),g&&g.running?(i||(i=[]),i.indexOf(o)===-1&&i.push(o)):i?i.indexOf(o)===-1&&i.push(o):je(o,t)}var T;function Nt(){return T||(T=ve())}var ht;function Ut(){return ht||(ht=ve())}function It(e){if(!e.length)return;let t=e.slice();e.length=0;for(let n of t)n.state=P,Z(n)}function Mt(e){let t=T&&A(T);t&&t.inFallback()?$(()=>{t.inFallback()||e()}):e()}function Lt(e){ln=e}function Bt(e){let t=T&&A(T);return t&&(t.increment(),e.finally(()=>t.decrement())),e}var Tn={createSignal:U,createEffect:$,createMemo:St,createComputed:qt,createRoot:Ct,createSelector:Ae,createResource:Rt,batch:_,untrack:j,onCleanup:fe,getOwner:_t,runWithOwner:At,createContext:ve,useContext:A,flush:Et,startTransition:$e,useTransition:Pt,isSignal:K,on:kt,createRenderEffect:We,getSuspenseContext:Nt,getSuspenseListContext:Ut,resumeEffects:It,onResolve:Mt,setScheduler:Lt,trackPromise:Bt};
|
|
1
|
+
"use strict";var Te=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var zt=Object.prototype.hasOwnProperty;var Ht=(e,t)=>{for(var n in t)Te(e,n,{get:t[n],enumerable:!0})},Yt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Wt(t))!zt.call(e,r)&&r!==n&&Te(e,r,{get:()=>t[r],enumerable:!(o=$t(t,r))||o.enumerable});return e};var Kt=e=>Yt(Te({},"__esModule",{value:!0}),e);var bn={};Ht(bn,{$MEMO:()=>Tt,$PROXY:()=>Le,$RESOURCE:()=>bt,$SIGNAL:()=>de,__DEV__:()=>Y,batch:()=>_,createComputed:()=>qt,createContext:()=>ve,createDebounce:()=>lt,createDeferred:()=>at,createEffect:()=>$,createMemo:()=>St,createProvider:()=>Ft,createRenderEffect:()=>We,createResource:()=>Rt,createRoot:()=>Ct,createSelector:()=>Ae,createSignal:()=>U,default:()=>Tn,flush:()=>Et,getOwner:()=>_t,getServerData:()=>Ne,getSharedConfig:()=>pn,getSuspenseContext:()=>Nt,getSuspenseListContext:()=>Ut,isComponent:()=>Qe,isMemo:()=>Xe,isProvider:()=>et,isResource:()=>Je,isSignal:()=>K,isSuspense:()=>Ze,makeArrayFlat:()=>me,nextResourceId:()=>Ue,on:()=>kt,onCleanup:()=>fe,onResolve:()=>Mt,readChildren:()=>Fe,reportResourceData:()=>Ie,resumeEffects:()=>It,runWithOwner:()=>At,setOwner:()=>dn,setResourceDataSink:()=>pt,setResourceIdSource:()=>dt,setResourceTracker:()=>ct,setScheduler:()=>Lt,setServerDataGetter:()=>ft,sharedConfig:()=>ce,startTransition:()=>$e,trackPromise:()=>Bt,trackResourcePromise:()=>qe,untrack:()=>j,useContext:()=>A,useTransition:()=>Pt});module.exports=Kt(bn);var Ke=require("@fluixi/utils/object"),be=require("@fluixi/utils/functions"),z=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:n}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let o of t)o.remove(this);if(n){for(let o of n)if((0,be.isFunction)(o)&&!(o instanceof e))try{o()}catch(r){console.error("Error in unsubscribe function:",r)}else if((0,Ke.isObject)(o)&&typeof o.unsubscribe=="function")try{o.unsubscribe()}catch(r){console.error("Error unsubscribing child:",r)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:n,_subscriptions:o}=this;if(n){if((0,be.isFunction)(t))try{t()}catch(r){console.error("Error in unsubscribe function:",r)}else if(t.unsubscribe)try{t.unsubscribe()}catch(r){console.error("Error unsubscribing:",r)}return this}return o||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:n}=this;if(!n)return;let o=n.indexOf(t);o!==-1&&(n.splice(o,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:n}=this;n?Array.isArray(n)?n.push(t):this._parentOrParents=[n,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:n}=this;if(n===t)this._parentOrParents=null;else if(Array.isArray(n)){let o=n.indexOf(t);o!==-1&&(n.splice(o,1),n.length===1&&(this._parentOrParents=n[0]))}}};var te=class extends z{constructor(n,o,r){super();this.isStopped=!1;let s;n?typeof n=="object"?s=n:s={next:n,error:o,complete:r}:s={},this.destination=s}next(n){if(!this.isStopped&&this.destination.next)try{this.destination.next(n)}catch(o){this.error(o)}}error(n){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(n)}catch(o){throw o}else throw n;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(n){this.error(n);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},ye=class extends te{constructor(n,o,r,s){super(n,o,r);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(n){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(n)}catch(o){this.error(o)}}error(n){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(n)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};var H=class extends z{constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,n,o){let r;t instanceof te?r=t:r=new ye(t,n,o);let{_subscribe:s}=this;try{let l=s.call(this,r);l&&(typeof l=="function"||typeof l.unsubscribe=="function")&&r.add(l)}catch(l){r.error(l)}return r}pipe(...t){return t.length===0?this:t.reduce((n,o)=>o(n),this)}toPromise(){return new Promise((t,n)=>{let o;this.subscribe({next:r=>o=r,error:n,complete:()=>t(o)})})}};var Q=require("@fluixi/utils");var Y=!1,Xt=Symbol.for("signal"),Jt=Symbol.for("memo"),Qt=Symbol.for("resource");function K(e){return typeof e=="function"&&e[Xt]===!0}function Xe(e){return typeof e=="function"&&e[Jt]===!0}function Je(e){return typeof e=="function"&&e[Qt]===!0}function Qe(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function Ze(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function et(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function me(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?me(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var Zt="__fluixi_signal_next_state__",en=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},a=globalThis[Zt]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:en,onSuspend:null,onError:null};var tt=0,nt=1,X=2,ne=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))}},re=class extends ne{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++,this.observers)for(let n of[...this.observers])n.markDirty(X);we(this)}}peek(){return this._value}},G=class extends ne{constructor(n,o){super();this._threw=!1;this._initialized=!1;this.state=X;this.sources=null;this._fn=n,this._equals=o?.equals===!1?()=>!1:o?.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===nt&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===X)break}(this.state===X||!this._initialized)&&this.recompute(),this.state=tt}recompute(){if(this.sources){for(let f of this.sources)f.observers?.delete(this);this.sources.clear()}let n=a.consumer,o=a.untracked;a.consumer=this,a.untracked=!1;let r,s=!1,l;try{r=this._fn()}catch(f){s=!0,l=f,r=this._value}finally{a.consumer=n,a.untracked=o}let c=!this._initialized||this._threw!==s||(s?l!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=s,this._error=l,this._value=r,c){if(this.version++,this.observers)for(let f of[...this.observers])f.markDirty(X);we(this)}}markDirty(n){if(this.state>=n)return;let o=this.state===tt;if(this.state=n,o){if(this.observers)for(let r of[...this.observers])r.markDirty(nt);we(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function we(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var oe=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 tn(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function rt(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function Se(){return a.owner}function se(e,t){let n=a.owner;a.owner=e;try{return t()}finally{a.owner=n}}function Oe(e){if(a.owner){if(a.owner.disposed){e();return}(a.owner.cleanups??=[]).push(e)}}function xe(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)xe(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function ot(e){a.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function nn(e){e.queued||(e.queued=!0,a.queue.push(e),!a.scheduled&&a.batchDepth===0&&(a.scheduled=!0,a.hostSchedule(Ce)))}function Ce(){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 n of t)n.queued=!1,n.disposed||n.run()}}finally{a.flushing=!1}}function st(){a.batchDepth===0&&Ce()}var ge=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=tn(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new G(()=>{xe(this.owner,!1),se(this.owner,()=>{let n=t();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),this.watcher=new oe(()=>nn(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.watcher.unwatch(this.computed),xe(this.owner))}};function it(e){let t=new ge(e);return()=>t.dispose()}function rn(e){return!!e&&typeof e.then=="function"}ot(()=>{});var ut=Symbol.for("signal"),on=Symbol.for("memo"),sn=Symbol.for("signal-node");function Re(e,t){let n=new re(e,{equals:t?.equals}),o=(()=>n.get()),r=(s=>{let l=typeof s=="function"?s(n.peek()):s;return n.set(l),st(),l});return Object.defineProperty(o,ut,{value:!0,enumerable:!0}),Object.defineProperty(o,sn,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[o,r]}function ie(e,t,n){let o=t,r=Se(),s=new G(()=>se(r,()=>{try{return o=e(o)}catch(c){if(rn(c))return rt(c),o;throw c}}),{equals:n?.equals}),l=(()=>s.get());return Object.defineProperty(l,ut,{value:!0,enumerable:!0}),Object.defineProperty(l,on,{value:!0,enumerable:!0}),l}function _e(e,t){let n=t;return it(()=>{n=e(n)})}function Ae(e,t=(n,o)=>n===o){let n=new Map;return _e(()=>{let o=e();for(let[r,s]of n){let[l,c]=s,f=t(r,o);l()!==f&&c(f)}}),o=>{let r=n.get(o);if(!r){let[s,l]=Re(!1);r=[s,l],n.set(o,r);let c=e();l(t(o,c))}return r[0]()}}function at(e,t){let[n,o]=Re(e(),t);return _e(()=>{let r=e();t?.timeoutMs?setTimeout(()=>o(()=>r),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>o(()=>r)):Promise.resolve().then(()=>o(()=>r))}),n}function lt(e,t){let n,o=(...r)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...r)},t)};return Oe(()=>{n!==void 0&&clearTimeout(n)}),o}function ue(e){if(typeof e=="function"&&!e.length){let t=e();return K(t)?t:ue(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let o=ue(e[n]);Array.isArray(o)?t.push.apply(t,o):t.push(o)}return t}return e}function Fe(e){let t=ie(e);return ie(()=>ue(t()))}var Ee=null;function ct(e){Ee=e}function qe(e){Ee&&Ee(e)}var Pe=null;function ft(e){Pe=e}function Ne(e){return Pe?Pe(e):void 0}var ke=null;function dt(e){ke=e}function Ue(){return ke?ke():void 0}var De=null;function pt(e){De=e}function Ie(e,t){De&&De(e,t)}var de=Symbol.for("signal"),Tt=Symbol.for("memo"),bt=Symbol.for("resource"),Le=Symbol("fluixi-proxy"),yt=Symbol.for("signal-node"),F=0,J=1,P=2,E=3,u=null,d=null,i=null,ae=null,le=0,un=!1,Me=!1,V=0,an=1e6,m=new WeakMap,g=null;var ln=null,cn=new Map,fn=0,ce={context:null,owner:null,routeData:new Map,matchedRoute:new Map};function dn(e){u=e,ce.owner=e,ce.context=e}function pn(){return ce}function vn(){return`node_${++fn}_${Date.now()}`}function hn(e){!1}function mt(e,t,n){let o={id:vn(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return hn(o),o}function wt(e,t){return e===t}function Ve(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}var Be=null,Ge=null;function xt(){if(!Be){let[e,t]=U(!1);Be=e,Ge=t}}function gt(e){if(i)i.indexOf(e)===-1&&i.push(e);else if(g&&g.running&&!e.pure)g.effects.indexOf(e)===-1&&g.effects.push(e);else if(!e.pure||e.computed)Z(e);else if(e.pure&&!e.computed&&e.accessor){let t=d,n=i;d=null,i=[],e.accessor(),d=t;let o=i;if(i=n,o.length>0){let r=i;pe(o),i=r}}}function vt(e,t){for(let n=0;n<e.length;n++)t(e[n])}function U(e,t){let n=e;typeof n=="object"&&n&&Le in n&&delete n[Le];let o=mt("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),r=[l,c];m.set(r,new Set);let s;function l(){let f=d;if(f){f.sources?f.sources.indexOf(r)===-1&&f.sources.push(r):f.sources=[r];let p=m.get(r);p&&!p.has(f)&&p.add(f)}return n}function c(f){let p=typeof f=="function"?f(n):f,b=o.equals||wt;if(t?.equals===!1||!b(n,p)){n=p,o.value=p,o.version++,o.updated=Date.now();let k=m.get(r);if(k&&k.size>0){let D=function(v,h=!1){let q=v.state;if(!(q===E&&v===d)){if(h&&!v.pure){q===F&&(v.state=J,un&&(i!==null&&i.indexOf(v)===-1?i.push(v):C.push(v)));return}if(!w.has(v)&&(w.add(v),v.state=P,q===F||q===J?C.push(v):!v.pure&&i!==null&&i.indexOf(v)===-1&&i.push(v),v.pure&&v.accessor)){let O=m.get(v.accessor);O&&vt(Array.from(O),R=>D(R,!0))}}};var x=D;let S=Array.from(k),C=[],w=new Set;vt(S,D);for(let v of C)gt(v)}}}return l.toObservable=()=>new H(f=>{let p=!0;return $(()=>{let x=l();p?p=!1:f.next(x)})}),Object.defineProperty(l,de,{value:!0,enumerable:!0}),Object.defineProperty(l,yt,{value:o,enumerable:!1}),r}function $(e,t,n){let o={fn:e,state:P,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:u,contexts:null,pure:!1,updatedAt:null};u&&(u.owned?u.owned.push(o):u.owned=[o]);let r=T&&A(T);return r&&(o.suspense=r),je(o,t),()=>I(o)}function je(e,t){if(e.sources){for(let r of e.sources){let s=m.get(r);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let r=0;r<e.owned.length;r++)I(e.owned[r]);e.owned=null}let n=d,o=u;if(d=e,u=e,le++,le>an)throw le=0,d=n,u=o,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=E;let r=e.fn(t);typeof r=="function"&&(e.cleanups?e.cleanups.push(r):e.cleanups=[r]),e.state===E&&(e.state=F)}catch(r){if((0,Q.isPromise)(r)){let s=T&&A(T);s&&(s.increment(),r.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Ve(r)}finally{d=n,u=o}}function Z(e){if(!(e.disposed||!e.fn||e.state===F)&&(e.state===P||e.state===J||e.state===E)){if(e.cleanups){for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}if(e.owned){for(let t=0;t<e.owned.length;t++)I(e.owned[t]);e.owned=null}e.renderEffect?Dt(e):je(e,e.value)}}function I(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=m.get(t);n&&n.delete(e)}if(e.cleanups)for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();if(e.owned)for(let t=0;t<e.owned.length;t++)I(e.owned[t]);if(e.owner&&e.owner.owned){let t=e.owner.owned.indexOf(e);t!==-1&&e.owner.owned.splice(t,1)}}function St(e,t,n){let o=mt("memo",t,{equals:n?.equals===!1?void 0:n?.equals,name:n?.name}),r={fn:e,state:P,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!0,updatedAt:null,node:o,accessor:void 0};u&&(u.owned?u.owned.push(r):u.owned=[r]);let s=()=>{if(d&&d!==r){d.sources?d.sources.indexOf(s)===-1&&d.sources.push(s):d.sources=[s];let c=s;m.has(c)||m.set(c,new Set);let f=m.get(c);f&&f.add(d)}if(r.state!==F){if(r.sources){for(let p of r.sources){let b=m.get(p);b&&b.delete(r)}r.sources=null,r.sourceSlots=null}if(r.cleanups){for(let p=0;p<r.cleanups.length;p++)r.cleanups[p]();r.cleanups=null}if(r.owned){for(let p=0;p<r.owned.length;p++)I(r.owned[p]);r.owned=null}let c=d,f=u;d=r,u=r,r.state=E;try{let p=r.fn(r.value),b=o.equals||wt;if(n?.equals===!1||!b(r.value,p)){r.value=p,o.value=p,o.version++,o.updated=Date.now();let k=s,S=m.get(k);if(S&&S.size>0){let v=function(h,q=!1){if(h===r)return;let O=h.state;if(O!==E){if(q&&!h.pure){O===F&&(h.state=J,i!==null&&i.indexOf(h)===-1?i.push(h):w.push(h));return}if(!D.has(h)&&(D.add(h),h.state=P,O===F||O===J?w.push(h):!h.pure&&i!==null&&i.indexOf(h)===-1&&i.push(h),h.pure&&h.accessor)){let R=m.get(h.accessor);if(R&&R.size>0)for(let W of Array.from(R))v(W,!0)}}};var l=v;let C=Array.from(S),w=[],D=new Set;for(let h=0;h<C.length;h++)v(C[h]);for(let h of w)gt(h)}}r.state===E&&(r.state=F)}catch(p){if((0,Q.isPromise)(p)){let b=T&&A(T);if(!b&&T){let x=f;for(;x;){if(x.contexts?.has(T.id)){b=x.contexts.get(T.id);break}x=x.owner}}return b&&(b.increment(),p.finally(()=>b.decrement())),r.value}Ve(p)}finally{d=c,u=f}}return r.value};return r.accessor=s,m.set(s,new Set),s.toObservable=()=>new H(l=>{let c=!0;return $(()=>{let p=s();c?c=!1:l.next(p)})}),Object.defineProperty(s,de,{value:!0,enumerable:!0}),Object.defineProperty(s,Tt,{value:!0,enumerable:!0}),Object.defineProperty(s,yt,{value:o,enumerable:!1}),s}function pe(e){let t=[],n=[];for(let r of e)r.pure&&!r.computed&&r.accessor?t.indexOf(r)===-1&&t.push(r):(r.computed||!r.pure)&&n.indexOf(r)===-1&&n.push(r);i=[];let o=0;for(;o<t.length;){let r=t[o++],s=m.get(r.accessor);if(s&&s.size>0){let c=d;d=null,r.accessor(),d=c}let l=i.splice(0);for(let c of l)c.pure&&!c.computed&&c.accessor?t.indexOf(c)===-1&&t.push(c):(c.computed||!c.pure)&&n.indexOf(c)===-1&&n.push(c)}i=null;for(let r of n)(r.computed||!r.pure)&&Z(r)}function _(e){if(i&&V>0)return e();if(i&&V===0){let t=i,n=[];i=n,V++;let o;try{o=e()}finally{V--,i=t}let r=i;return pe(n),i=r,o}V++,i=[],ae=[];try{return e()}finally{V--,Ot()}}function Ot(){if(!Me){Me=!0,le=0;try{for(;i&&i.length>0;){let e=i;i=null,pe(e)}if(i=null,ae){let e=ae;ae=null;for(let t=0;t<e.length;t++)Z(e[t])}}finally{Me=!1}}}function Ct(e){let t={owned:null,cleanups:null,contexts:null,owner:u},n=d;d=null;let o=u;u=t;try{return e(()=>{if(t.owned)for(let r=0;r<t.owned.length;r++)I(t.owned[r]);if(t.cleanups)for(let r=0;r<t.cleanups.length;r++)t.cleanups[r]()})}finally{u=o,d=n}}function j(e){let t=d;d=null;try{return e()}finally{d=t}}function fe(e){u&&(u.cleanups?u.cleanups.push(e):u.cleanups=[e])}function Rt(e,t,n={}){let o,r;typeof t=="function"?(o=typeof e=="function"?e:()=>e,r=t):(o=()=>!0,r=e,t&&typeof t=="object"&&(n=t));let{initialValue:s,name:l}=n,c=n.transport===!1?void 0:Ue(),f=c!==void 0?Ne(c):void 0,p=f!==void 0,[b,x]=U(f!==void 0?f.value:n.initialValue,{equals:!1}),[k,S]=U(void 0,{equals:!1}),[C,w]=U(f!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[D,v]=U(void 0,{equals:!1}),[h,q]=U(void 0,{equals:!1}),O=Symbol(),R=O,W=!1,Gt=y=>{if(!(typeof localStorage>"u"))try{y&&localStorage.setItem("storage",JSON.stringify({data:y,timestamp:Date.now()}))}catch(L){console.error(`Failed to save resource to cache (${l}):`,L)}},Vt=$(()=>{let y=o?o():e;if(h(),y===!1||y===null||y===void 0){R=O,_(()=>{w("unresolved"),v(void 0),S(void 0)});return}let L=W;if(W=!1,R!==O&&y===R&&!L)return;if(R=y,p){p=!1;return}let B=!1;fe(()=>B=!0);let He=j(C),jt=j(b),Ye=He==="ready"||He==="refreshing";_(()=>{w(Ye?"refreshing":"pending"),S(void 0)});try{let N=r(y,{value:jt,refetching:Ye});if((0,Q.isPromise)(N)){v(N),qe(N),N.then(M=>{B||(c!==void 0&&Ie(c,M),_(()=>{x(()=>M),Gt(M),w("ready"),v(void 0)}))},M=>{B||_(()=>{S(M),w("errored"),v(void 0)})}).catch(M=>{B||_(()=>{S(M),w("errored"),v(void 0)})});let he=T&&A(T);he&&(he.increment(),N.finally(()=>he.decrement()))}else{if(B)return;_(()=>{x(()=>N),w("ready"),v(void 0)})}}catch(N){if(B)return;_(()=>{S(N),w("errored"),v(void 0)})}});fe(Vt);let ze=()=>{let y=C();return y==="pending"||y==="refreshing"},ee=(()=>{let y=k();if(y)throw y;if(ze()){let L=D();if(L)throw L}return b()});return Object.defineProperty(ee,bt,{value:!0,enumerable:!0}),Object.defineProperty(ee,de,{value:!0,enumerable:!0}),Object.defineProperties(ee,{state:{get:C},loading:{get:()=>ze()},error:{get:k},latest:{get:b}}),[ee,{mutate:x,refetch:()=>{W=!0,q(void 0)}}]}function _t(){return u}function At(e,t){let n=u,o=d;u=e,d=null;try{return t()}finally{u=n,d=o}}function ve(e){let t=Symbol("context"),n=Ft(t);return{id:t,Provider:n,defaultValue:e}}function Ft(e){return t=>{let n=u;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let o;return We(()=>{o=j(()=>{let r=u;return r&&(r.contexts||(r.contexts=new Map),r.contexts.set(e,t.value)),Fe(()=>t.children)})}),o}}function A(e){let t=u;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.owner}if(e)return e.defaultValue}function Et(){return new Promise(e=>{queueMicrotask(()=>{Ot(),e()})})}function $e(e){if(g&&g.running)return e(),g.done;xt();let t,n=new Promise(r=>t=r),o={running:!0,effects:[],resolve:t,done:n};g=o;try{e()}finally{o.running=!1}return o.effects.length?(Ge(!0),Promise.resolve().then(()=>{let r=o.effects.splice(0);g=null,Ge(!1),r.length&&_(()=>{for(let s of r)s.state=P,Z(s)}),t()}),n):(g=null,t(),n)}function Pt(){return xt(),[Be,$e]}function kt(e,t,n){let o=n?.defer??!1,r=!0;return s=>{let l=e();return o&&r?(r=!1,s):j(()=>t(l,s))}}function We(e,t,n){let o={fn:e,state:P,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};u&&(u.owned?u.owned.push(o):u.owned=[o]);let r=T&&A(T);return r&&(o.suspense=r),Dt(o),()=>I(o)}function Dt(e){if(e.sources){for(let r of e.sources){let s=m.get(r);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.cleanups){for(let r=0;r<e.cleanups.length;r++)e.cleanups[r]();e.cleanups=null}if(e.owned){for(let r=0;r<e.owned.length;r++)I(e.owned[r]);e.owned=null}let t=d,n=u,o=i;d=e,u=e,i===null&&(i=[]),e.state=E;try{let r=e.fn(e.value);typeof r=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(r)),e.value=r,e.state===E&&(e.state=F)}catch(r){if((0,Q.isPromise)(r)){let s=T&&A(T);s&&(s.increment(),r.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Ve(r)}finally{d=t,u=n;let r=i;if(i=o,r!==o&&r&&r.length>0){let s=i;pe(r),i=s}}}function qt(e,t,n){let o={fn:e,state:P,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!0,computed:!0,updatedAt:null};u&&(u.owned?u.owned.push(o):u.owned=[o]),g&&g.running?(i||(i=[]),i.indexOf(o)===-1&&i.push(o)):i?i.indexOf(o)===-1&&i.push(o):je(o,t)}var T;function Nt(){return T||(T=ve())}var ht;function Ut(){return ht||(ht=ve())}function It(e){if(!e.length)return;let t=e.slice();e.length=0;for(let n of t)n.state=P,Z(n)}function Mt(e){let t=T&&A(T);t&&t.inFallback()?$(()=>{t.inFallback()||e()}):e()}function Lt(e){ln=e}function Bt(e){let t=T&&A(T);return t&&(t.increment(),e.finally(()=>t.decrement())),e}var Tn={createSignal:U,createEffect:$,createMemo:St,createComputed:qt,createRoot:Ct,createSelector:Ae,createResource:Rt,batch:_,untrack:j,onCleanup:fe,getOwner:_t,runWithOwner:At,createContext:ve,useContext:A,flush:Et,startTransition:$e,useTransition:Pt,isSignal:K,on:kt,createRenderEffect:We,getSuspenseContext:Nt,getSuspenseListContext:Ut,resumeEffects:It,onResolve:Mt,setScheduler:Lt,trackPromise:Bt};
|
|
@@ -195,6 +195,14 @@ export interface ResourceOptions<T, S = unknown> {
|
|
|
195
195
|
deferStream?: boolean;
|
|
196
196
|
storage?: string;
|
|
197
197
|
cacheTime?: number;
|
|
198
|
+
/**
|
|
199
|
+
* Whether this resource's value is carried from server to client in
|
|
200
|
+
* `__FX_DATA__`. `false` opts out and, importantly, does not consume an id:
|
|
201
|
+
* ids are positions in a per-render sequence that both sides count
|
|
202
|
+
* independently, so a resource present on one side only shifts every id after
|
|
203
|
+
* it. See the note in graph/resource.ts.
|
|
204
|
+
*/
|
|
205
|
+
transport?: boolean;
|
|
198
206
|
}
|
|
199
207
|
export declare function createResource<T>(fetcher: ResourceFetcher<T, true>, options?: ResourceOptions<T, true>): ResourceReturn<T>;
|
|
200
208
|
export declare function createResource<T, S>(source: ResourceSource<S>, fetcher: ResourceFetcher<T, S>, options?: ResourceOptions<T, S>): ResourceReturn<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../../src/lib/signal/signal.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAKzD,OAAO,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,UAAU,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,aAAa,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,UAAU,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,aAAa,GACd,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,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,IAAI;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,CAAC,CAAC;QAAC,QAAQ,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,GAAG,CAAC;IACvE,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;IAC5B,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACF,wBA2BE"}
|
|
@@ -726,7 +726,7 @@ export function createResource(source, fetcherFn, options = {}) {
|
|
|
726
726
|
const { initialValue, name } = options;
|
|
727
727
|
// SSR data transport: a stable per-render id; on the client, seed from the
|
|
728
728
|
// server-serialized value so hydration doesn't refetch (and doesn't flash).
|
|
729
|
-
const __ssrId = nextResourceId();
|
|
729
|
+
const __ssrId = options.transport === false ? undefined : nextResourceId();
|
|
730
730
|
const __seed = __ssrId !== undefined ? getServerData(__ssrId) : undefined;
|
|
731
731
|
let skipFirstFetch = __seed !== undefined;
|
|
732
732
|
const [value, setValue] = createSignal(__seed !== undefined ? __seed.value : options.initialValue, { equals: false });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject as pt}from"@fluixi/utils/object";import{isFunction as Ie}from"@fluixi/utils/functions";var $=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:n}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let o of t)o.remove(this);if(n){for(let o of n)if(Ie(o)&&!(o instanceof e))try{o()}catch(r){console.error("Error in unsubscribe function:",r)}else if(pt(o)&&typeof o.unsubscribe=="function")try{o.unsubscribe()}catch(r){console.error("Error unsubscribing child:",r)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:n,_subscriptions:o}=this;if(n){if(Ie(t))try{t()}catch(r){console.error("Error in unsubscribe function:",r)}else if(t.unsubscribe)try{t.unsubscribe()}catch(r){console.error("Error unsubscribing:",r)}return this}return o||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:n}=this;if(!n)return;let o=n.indexOf(t);o!==-1&&(n.splice(o,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:n}=this;n?Array.isArray(n)?n.push(t):this._parentOrParents=[n,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:n}=this;if(n===t)this._parentOrParents=null;else if(Array.isArray(n)){let o=n.indexOf(t);o!==-1&&(n.splice(o,1),n.length===1&&(this._parentOrParents=n[0]))}}};var Q=class extends ${constructor(n,o,r){super();this.isStopped=!1;let s;n?typeof n=="object"?s=n:s={next:n,error:o,complete:r}:s={},this.destination=s}next(n){if(!this.isStopped&&this.destination.next)try{this.destination.next(n)}catch(o){this.error(o)}}error(n){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(n)}catch(o){throw o}else throw n;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(n){this.error(n);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},de=class extends Q{constructor(n,o,r,s){super(n,o,r);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(n){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(n)}catch(o){this.error(o)}}error(n){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(n)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};var W=class extends ${constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,n,o){let r;t instanceof Q?r=t:r=new de(t,n,o);let{_subscribe:s}=this;try{let l=s.call(this,r);l&&(typeof l=="function"||typeof l.unsubscribe=="function")&&r.add(l)}catch(l){r.error(l)}return r}pipe(...t){return t.length===0?this:t.reduce((n,o)=>o(n),this)}toPromise(){return new Promise((t,n)=>{let o;this.subscribe({next:r=>o=r,error:n,complete:()=>t(o)})})}};import{isPromise as le}from"@fluixi/utils";var Z=!1,vt=Symbol.for("signal"),ht=Symbol.for("memo"),Tt=Symbol.for("resource");function ee(e){return typeof e=="function"&&e[vt]===!0}function bt(e){return typeof e=="function"&&e[ht]===!0}function yt(e){return typeof e=="function"&&e[Tt]===!0}function mt(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function wt(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function xt(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Me(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Me(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var gt="__fluixi_signal_next_state__",St=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},a=globalThis[gt]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:St,onSuspend:null,onError:null};var Le=0,Be=1,z=2,te=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))}},ne=class extends te{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++,this.observers)for(let n of[...this.observers])n.markDirty(z);pe(this)}}peek(){return this._value}},G=class extends te{constructor(n,o){super();this._threw=!1;this._initialized=!1;this.state=z;this.sources=null;this._fn=n,this._equals=o?.equals===!1?()=>!1:o?.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===Be&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===z)break}(this.state===z||!this._initialized)&&this.recompute(),this.state=Le}recompute(){if(this.sources){for(let f of this.sources)f.observers?.delete(this);this.sources.clear()}let n=a.consumer,o=a.untracked;a.consumer=this,a.untracked=!1;let r,s=!1,l;try{r=this._fn()}catch(f){s=!0,l=f,r=this._value}finally{a.consumer=n,a.untracked=o}let c=!this._initialized||this._threw!==s||(s?l!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=s,this._error=l,this._value=r,c){if(this.version++,this.observers)for(let f of[...this.observers])f.markDirty(z);pe(this)}}markDirty(n){if(this.state>=n)return;let o=this.state===Le;if(this.state=n,o){if(this.observers)for(let r of[...this.observers])r.markDirty(Be);pe(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function pe(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var re=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 Ot(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Ge(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function Te(){return a.owner}function oe(e,t){let n=a.owner;a.owner=e;try{return t()}finally{a.owner=n}}function be(e){if(a.owner){if(a.owner.disposed){e();return}(a.owner.cleanups??=[]).push(e)}}function ve(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)ve(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function Ve(e){a.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Ct(e){e.queued||(e.queued=!0,a.queue.push(e),!a.scheduled&&a.batchDepth===0&&(a.scheduled=!0,a.hostSchedule(ye)))}function ye(){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 n of t)n.queued=!1,n.disposed||n.run()}}finally{a.flushing=!1}}function je(){a.batchDepth===0&&ye()}var he=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=Ot(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new G(()=>{ve(this.owner,!1),oe(this.owner,()=>{let n=t();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),this.watcher=new re(()=>Ct(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.watcher.unwatch(this.computed),ve(this.owner))}};function $e(e){let t=new he(e);return()=>t.dispose()}function Rt(e){return!!e&&typeof e.then=="function"}Ve(()=>{});var We=Symbol.for("signal"),_t=Symbol.for("memo"),At=Symbol.for("signal-node");function me(e,t){let n=new ne(e,{equals:t?.equals}),o=(()=>n.get()),r=(s=>{let l=typeof s=="function"?s(n.peek()):s;return n.set(l),je(),l});return Object.defineProperty(o,We,{value:!0,enumerable:!0}),Object.defineProperty(o,At,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[o,r]}function se(e,t,n){let o=t,r=Te(),s=new G(()=>oe(r,()=>{try{return o=e(o)}catch(c){if(Rt(c))return Ge(c),o;throw c}}),{equals:n?.equals}),l=(()=>s.get());return Object.defineProperty(l,We,{value:!0,enumerable:!0}),Object.defineProperty(l,_t,{value:!0,enumerable:!0}),l}function we(e,t){let n=t;return $e(()=>{n=e(n)})}function ze(e,t=(n,o)=>n===o){let n=new Map;return we(()=>{let o=e();for(let[r,s]of n){let[l,c]=s,f=t(r,o);l()!==f&&c(f)}}),o=>{let r=n.get(o);if(!r){let[s,l]=me(!1);r=[s,l],n.set(o,r);let c=e();l(t(o,c))}return r[0]()}}function Ft(e,t){let[n,o]=me(e(),t);return we(()=>{let r=e();t?.timeoutMs?setTimeout(()=>o(()=>r),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>o(()=>r)):Promise.resolve().then(()=>o(()=>r))}),n}function Et(e,t){let n,o=(...r)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...r)},t)};return be(()=>{n!==void 0&&clearTimeout(n)}),o}function ie(e){if(typeof e=="function"&&!e.length){let t=e();return ee(t)?t:ie(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let o=ie(e[n]);Array.isArray(o)?t.push.apply(t,o):t.push(o)}return t}return e}function He(e){let t=se(e);return se(()=>ie(t()))}var xe=null;function Pt(e){xe=e}function Ye(e){xe&&xe(e)}var ge=null;function kt(e){ge=e}function Ke(e){return ge?ge(e):void 0}var Se=null;function Dt(e){Se=e}function Xe(){return Se?Se():void 0}var Oe=null;function qt(e){Oe=e}function Je(e,t){Oe&&Oe(e,t)}var Ee=Symbol.for("signal"),Nt=Symbol.for("memo"),Ut=Symbol.for("resource"),Qe=Symbol("fluixi-proxy"),tt=Symbol.for("signal-node"),A=0,H=1,E=2,F=3,u=null,d=null,i=null,ue=null,ae=0,It=!1,Ce=!1,V=0,Mt=1e6,m=new WeakMap,g=null;var Lt=null,Bt=new Map,Gt=0,Re={context:null,owner:null,routeData:new Map,matchedRoute:new Map};function Mn(e){u=e,Re.owner=e,Re.context=e}function Ln(){return Re}function Vt(){return`node_${++Gt}_${Date.now()}`}function jt(e){!1}function nt(e,t,n){let o={id:Vt(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return jt(o),o}function rt(e,t){return e===t}function Pe(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}var _e=null,Ae=null;function ot(){if(!_e){let[e,t]=M(!1);_e=e,Ae=t}}function st(e){if(i)i.indexOf(e)===-1&&i.push(e);else if(g&&g.running&&!e.pure)g.effects.indexOf(e)===-1&&g.effects.push(e);else if(!e.pure||e.computed)X(e);else if(e.pure&&!e.computed&&e.accessor){let t=d,n=i;d=null,i=[],e.accessor(),d=t;let o=i;if(i=n,o.length>0){let r=i;ce(o),i=r}}}function Ze(e,t){for(let n=0;n<e.length;n++)t(e[n])}function M(e,t){let n=e;typeof n=="object"&&n&&Qe in n&&delete n[Qe];let o=nt("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),r=[l,c];m.set(r,new Set);let s;function l(){let f=d;if(f){f.sources?f.sources.indexOf(r)===-1&&f.sources.push(r):f.sources=[r];let p=m.get(r);p&&!p.has(f)&&p.add(f)}return n}function c(f){let p=typeof f=="function"?f(n):f,b=o.equals||rt;if(t?.equals===!1||!b(n,p)){n=p,o.value=p,o.version++,o.updated=Date.now();let k=m.get(r);if(k&&k.size>0){let D=function(v,h=!1){let q=v.state;if(!(q===F&&v===d)){if(h&&!v.pure){q===A&&(v.state=H,It&&(i!==null&&i.indexOf(v)===-1?i.push(v):C.push(v)));return}if(!w.has(v)&&(w.add(v),v.state=E,q===A||q===H?C.push(v):!v.pure&&i!==null&&i.indexOf(v)===-1&&i.push(v),v.pure&&v.accessor)){let O=m.get(v.accessor);O&&Ze(Array.from(O),R=>D(R,!0))}}};var x=D;let S=Array.from(k),C=[],w=new Set;Ze(S,D);for(let v of C)st(v)}}}return l.toObservable=()=>new W(f=>{let p=!0;return K(()=>{let x=l();p?p=!1:f.next(x)})}),Object.defineProperty(l,Ee,{value:!0,enumerable:!0}),Object.defineProperty(l,tt,{value:o,enumerable:!1}),r}function K(e,t,n){let o={fn:e,state:E,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:u,contexts:null,pure:!1,updatedAt:null};u&&(u.owned?u.owned.push(o):u.owned=[o]);let r=T&&P(T);return r&&(o.suspense=r),ke(o,t),()=>U(o)}function ke(e,t){if(e.sources){for(let r of e.sources){let s=m.get(r);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let r=0;r<e.owned.length;r++)U(e.owned[r]);e.owned=null}let n=d,o=u;if(d=e,u=e,ae++,ae>Mt)throw ae=0,d=n,u=o,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=F;let r=e.fn(t);typeof r=="function"&&(e.cleanups?e.cleanups.push(r):e.cleanups=[r]),e.state===F&&(e.state=A)}catch(r){if(le(r)){let s=T&&P(T);s&&(s.increment(),r.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Pe(r)}finally{d=n,u=o}}function X(e){if(!(e.disposed||!e.fn||e.state===A)&&(e.state===E||e.state===H||e.state===F)){if(e.cleanups){for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}if(e.owned){for(let t=0;t<e.owned.length;t++)U(e.owned[t]);e.owned=null}e.renderEffect?lt(e):ke(e,e.value)}}function U(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=m.get(t);n&&n.delete(e)}if(e.cleanups)for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();if(e.owned)for(let t=0;t<e.owned.length;t++)U(e.owned[t]);if(e.owner&&e.owner.owned){let t=e.owner.owned.indexOf(e);t!==-1&&e.owner.owned.splice(t,1)}}function $t(e,t,n){let o=nt("memo",t,{equals:n?.equals===!1?void 0:n?.equals,name:n?.name}),r={fn:e,state:E,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!0,updatedAt:null,node:o,accessor:void 0};u&&(u.owned?u.owned.push(r):u.owned=[r]);let s=()=>{if(d&&d!==r){d.sources?d.sources.indexOf(s)===-1&&d.sources.push(s):d.sources=[s];let c=s;m.has(c)||m.set(c,new Set);let f=m.get(c);f&&f.add(d)}if(r.state!==A){if(r.sources){for(let p of r.sources){let b=m.get(p);b&&b.delete(r)}r.sources=null,r.sourceSlots=null}if(r.cleanups){for(let p=0;p<r.cleanups.length;p++)r.cleanups[p]();r.cleanups=null}if(r.owned){for(let p=0;p<r.owned.length;p++)U(r.owned[p]);r.owned=null}let c=d,f=u;d=r,u=r,r.state=F;try{let p=r.fn(r.value),b=o.equals||rt;if(n?.equals===!1||!b(r.value,p)){r.value=p,o.value=p,o.version++,o.updated=Date.now();let k=s,S=m.get(k);if(S&&S.size>0){let v=function(h,q=!1){if(h===r)return;let O=h.state;if(O!==F){if(q&&!h.pure){O===A&&(h.state=H,i!==null&&i.indexOf(h)===-1?i.push(h):w.push(h));return}if(!D.has(h)&&(D.add(h),h.state=E,O===A||O===H?w.push(h):!h.pure&&i!==null&&i.indexOf(h)===-1&&i.push(h),h.pure&&h.accessor)){let R=m.get(h.accessor);if(R&&R.size>0)for(let j of Array.from(R))v(j,!0)}}};var l=v;let C=Array.from(S),w=[],D=new Set;for(let h=0;h<C.length;h++)v(C[h]);for(let h of w)st(h)}}r.state===F&&(r.state=A)}catch(p){if(le(p)){let b=T&&P(T);if(!b&&T){let x=f;for(;x;){if(x.contexts?.has(T.id)){b=x.contexts.get(T.id);break}x=x.owner}}return b&&(b.increment(),p.finally(()=>b.decrement())),r.value}Pe(p)}finally{d=c,u=f}}return r.value};return r.accessor=s,m.set(s,new Set),s.toObservable=()=>new W(l=>{let c=!0;return K(()=>{let p=s();c?c=!1:l.next(p)})}),Object.defineProperty(s,Ee,{value:!0,enumerable:!0}),Object.defineProperty(s,Nt,{value:!0,enumerable:!0}),Object.defineProperty(s,tt,{value:o,enumerable:!1}),s}function ce(e){let t=[],n=[];for(let r of e)r.pure&&!r.computed&&r.accessor?t.indexOf(r)===-1&&t.push(r):(r.computed||!r.pure)&&n.indexOf(r)===-1&&n.push(r);i=[];let o=0;for(;o<t.length;){let r=t[o++],s=m.get(r.accessor);if(s&&s.size>0){let c=d;d=null,r.accessor(),d=c}let l=i.splice(0);for(let c of l)c.pure&&!c.computed&&c.accessor?t.indexOf(c)===-1&&t.push(c):(c.computed||!c.pure)&&n.indexOf(c)===-1&&n.push(c)}i=null;for(let r of n)(r.computed||!r.pure)&&X(r)}function _(e){if(i&&V>0)return e();if(i&&V===0){let t=i,n=[];i=n,V++;let o;try{o=e()}finally{V--,i=t}let r=i;return ce(n),i=r,o}V++,i=[],ue=[];try{return e()}finally{V--,it()}}function it(){if(!Ce){Ce=!0,ae=0;try{for(;i&&i.length>0;){let e=i;i=null,ce(e)}if(i=null,ue){let e=ue;ue=null;for(let t=0;t<e.length;t++)X(e[t])}}finally{Ce=!1}}}function Wt(e){let t={owned:null,cleanups:null,contexts:null,owner:u},n=d;d=null;let o=u;u=t;try{return e(()=>{if(t.owned)for(let r=0;r<t.owned.length;r++)U(t.owned[r]);if(t.cleanups)for(let r=0;r<t.cleanups.length;r++)t.cleanups[r]()})}finally{u=o,d=n}}function Y(e){let t=d;d=null;try{return e()}finally{d=t}}function Fe(e){u&&(u.cleanups?u.cleanups.push(e):u.cleanups=[e])}function zt(e,t,n={}){let o,r;typeof t=="function"?(o=typeof e=="function"?e:()=>e,r=t):(o=()=>!0,r=e,t&&typeof t=="object"&&(n=t));let{initialValue:s,name:l}=n,c=Xe(),f=c!==void 0?Ke(c):void 0,p=f!==void 0,[b,x]=M(f!==void 0?f.value:n.initialValue,{equals:!1}),[k,S]=M(void 0,{equals:!1}),[C,w]=M(f!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[D,v]=M(void 0,{equals:!1}),[h,q]=M(void 0,{equals:!1}),O=Symbol(),R=O,j=!1,ct=y=>{if(!(typeof localStorage>"u"))try{y&&localStorage.setItem("storage",JSON.stringify({data:y,timestamp:Date.now()}))}catch(L){console.error(`Failed to save resource to cache (${l}):`,L)}},ft=K(()=>{let y=o?o():e;if(h(),y===!1||y===null||y===void 0){R=O,_(()=>{w("unresolved"),v(void 0),S(void 0)});return}let L=j;if(j=!1,R!==O&&y===R&&!L)return;if(R=y,p){p=!1;return}let B=!1;Fe(()=>B=!0);let Ne=Y(C),dt=Y(b),Ue=Ne==="ready"||Ne==="refreshing";_(()=>{w(Ue?"refreshing":"pending"),S(void 0)});try{let N=r(y,{value:dt,refetching:Ue});if(le(N)){v(N),Ye(N),N.then(I=>{B||(c!==void 0&&Je(c,I),_(()=>{x(()=>I),ct(I),w("ready"),v(void 0)}))},I=>{B||_(()=>{S(I),w("errored"),v(void 0)})}).catch(I=>{B||_(()=>{S(I),w("errored"),v(void 0)})});let fe=T&&P(T);fe&&(fe.increment(),N.finally(()=>fe.decrement()))}else{if(B)return;_(()=>{x(()=>N),w("ready"),v(void 0)})}}catch(N){if(B)return;_(()=>{S(N),w("errored"),v(void 0)})}});Fe(ft);let qe=()=>{let y=C();return y==="pending"||y==="refreshing"},J=(()=>{let y=k();if(y)throw y;if(qe()){let L=D();if(L)throw L}return b()});return Object.defineProperty(J,Ut,{value:!0,enumerable:!0}),Object.defineProperty(J,Ee,{value:!0,enumerable:!0}),Object.defineProperties(J,{state:{get:C},loading:{get:()=>qe()},error:{get:k},latest:{get:b}}),[J,{mutate:x,refetch:()=>{j=!0,q(void 0)}}]}function Ht(){return u}function Yt(e,t){let n=u,o=d;u=e,d=null;try{return t()}finally{u=n,d=o}}function De(e){let t=Symbol("context"),n=Kt(t);return{id:t,Provider:n,defaultValue:e}}function Kt(e){return t=>{let n=u;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let o;return at(()=>{o=Y(()=>{let r=u;return r&&(r.contexts||(r.contexts=new Map),r.contexts.set(e,t.value)),He(()=>t.children)})}),o}}function P(e){let t=u;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.owner}if(e)return e.defaultValue}function Xt(){return new Promise(e=>{queueMicrotask(()=>{it(),e()})})}function ut(e){if(g&&g.running)return e(),g.done;ot();let t,n=new Promise(r=>t=r),o={running:!0,effects:[],resolve:t,done:n};g=o;try{e()}finally{o.running=!1}return o.effects.length?(Ae(!0),Promise.resolve().then(()=>{let r=o.effects.splice(0);g=null,Ae(!1),r.length&&_(()=>{for(let s of r)s.state=E,X(s)}),t()}),n):(g=null,t(),n)}function Jt(){return ot(),[_e,ut]}function Qt(e,t,n){let o=n?.defer??!1,r=!0;return s=>{let l=e();return o&&r?(r=!1,s):Y(()=>t(l,s))}}function at(e,t,n){let o={fn:e,state:E,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};u&&(u.owned?u.owned.push(o):u.owned=[o]);let r=T&&P(T);return r&&(o.suspense=r),lt(o),()=>U(o)}function lt(e){if(e.sources){for(let r of e.sources){let s=m.get(r);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.cleanups){for(let r=0;r<e.cleanups.length;r++)e.cleanups[r]();e.cleanups=null}if(e.owned){for(let r=0;r<e.owned.length;r++)U(e.owned[r]);e.owned=null}let t=d,n=u,o=i;d=e,u=e,i===null&&(i=[]),e.state=F;try{let r=e.fn(e.value);typeof r=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(r)),e.value=r,e.state===F&&(e.state=A)}catch(r){if(le(r)){let s=T&&P(T);s&&(s.increment(),r.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Pe(r)}finally{d=t,u=n;let r=i;if(i=o,r!==o&&r&&r.length>0){let s=i;ce(r),i=s}}}function Zt(e,t,n){let o={fn:e,state:E,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!0,computed:!0,updatedAt:null};u&&(u.owned?u.owned.push(o):u.owned=[o]),g&&g.running?(i||(i=[]),i.indexOf(o)===-1&&i.push(o)):i?i.indexOf(o)===-1&&i.push(o):ke(o,t)}var T;function en(){return T||(T=De())}var et;function tn(){return et||(et=De())}function nn(e){if(!e.length)return;let t=e.slice();e.length=0;for(let n of t)n.state=E,X(n)}function rn(e){let t=T&&P(T);t&&t.inFallback()?K(()=>{t.inFallback()||e()}):e()}function on(e){Lt=e}function sn(e){let t=T&&P(T);return t&&(t.increment(),e.finally(()=>t.decrement())),e}var Gn={createSignal:M,createEffect:K,createMemo:$t,createComputed:Zt,createRoot:Wt,createSelector:ze,createResource:zt,batch:_,untrack:Y,onCleanup:Fe,getOwner:Ht,runWithOwner:Yt,createContext:De,useContext:P,flush:Xt,startTransition:ut,useTransition:Jt,isSignal:ee,on:Qt,createRenderEffect:at,getSuspenseContext:en,getSuspenseListContext:tn,resumeEffects:nn,onResolve:rn,setScheduler:on,trackPromise:sn};export{Nt as $MEMO,Qe as $PROXY,Ut as $RESOURCE,Ee as $SIGNAL,Z as __DEV__,_ as batch,Zt as createComputed,De as createContext,Et as createDebounce,Ft as createDeferred,K as createEffect,$t as createMemo,Kt as createProvider,at as createRenderEffect,zt as createResource,Wt as createRoot,ze as createSelector,M as createSignal,Gn as default,Xt as flush,Ht as getOwner,Ke as getServerData,Ln as getSharedConfig,en as getSuspenseContext,tn as getSuspenseListContext,mt as isComponent,bt as isMemo,xt as isProvider,yt as isResource,ee as isSignal,wt as isSuspense,Me as makeArrayFlat,Xe as nextResourceId,Qt as on,Fe as onCleanup,rn as onResolve,He as readChildren,Je as reportResourceData,nn as resumeEffects,Yt as runWithOwner,Mn as setOwner,qt as setResourceDataSink,Dt as setResourceIdSource,Pt as setResourceTracker,on as setScheduler,kt as setServerDataGetter,Re as sharedConfig,ut as startTransition,sn as trackPromise,Ye as trackResourcePromise,Y as untrack,P as useContext,Jt as useTransition};
|
|
1
|
+
import{isObject as pt}from"@fluixi/utils/object";import{isFunction as Ie}from"@fluixi/utils/functions";var $=class e{constructor(t){this._closed=!1;this._parentOrParents=null;this._subscriptions=null;t&&(this._subscriptions=[t])}get closed(){return this._closed}unsubscribe(){if(this._closed)return;this._closed=!0;let{_parentOrParents:t,_subscriptions:n}=this;if(t instanceof e)t.remove(this);else if(t!==null)for(let o of t)o.remove(this);if(n){for(let o of n)if(Ie(o)&&!(o instanceof e))try{o()}catch(r){console.error("Error in unsubscribe function:",r)}else if(pt(o)&&typeof o.unsubscribe=="function")try{o.unsubscribe()}catch(r){console.error("Error unsubscribing child:",r)}this._subscriptions=null}}add(t){if(!t||t===this)return this;if(t.closed)return this;let{_closed:n,_subscriptions:o}=this;if(n){if(Ie(t))try{t()}catch(r){console.error("Error in unsubscribe function:",r)}else if(t.unsubscribe)try{t.unsubscribe()}catch(r){console.error("Error unsubscribing:",r)}return this}return o||(this._subscriptions=[]),this._subscriptions.push(t),t instanceof e&&t._addParent(this),this}remove(t){let{_subscriptions:n}=this;if(!n)return;let o=n.indexOf(t);o!==-1&&(n.splice(o,1),t._removeParent(this))}_addParent(t){let{_parentOrParents:n}=this;n?Array.isArray(n)?n.push(t):this._parentOrParents=[n,t]:this._parentOrParents=t}_removeParent(t){let{_parentOrParents:n}=this;if(n===t)this._parentOrParents=null;else if(Array.isArray(n)){let o=n.indexOf(t);o!==-1&&(n.splice(o,1),n.length===1&&(this._parentOrParents=n[0]))}}};var Q=class extends ${constructor(n,o,r){super();this.isStopped=!1;let s;n?typeof n=="object"?s=n:s={next:n,error:o,complete:r}:s={},this.destination=s}next(n){if(!this.isStopped&&this.destination.next)try{this.destination.next(n)}catch(o){this.error(o)}}error(n){if(!this.isStopped){if(this.isStopped=!0,this.destination.error)try{this.destination.error(n)}catch(o){throw o}else throw n;this.unsubscribe()}}complete(){if(!this.isStopped){if(this.isStopped=!0,this.destination.complete)try{this.destination.complete()}catch(n){this.error(n);return}this.unsubscribe()}}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}},de=class extends Q{constructor(n,o,r,s){super(n,o,r);this._isUnsubscribing=!1;this._parentSubscriber=null;this._parentSubscriber=s||null}next(n){if(!this.isStopped&&!this._isUnsubscribing)try{super.next(n)}catch(o){this.error(o)}}error(n){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.error(n)}finally{this._isUnsubscribing=!1}}}complete(){if(!this.isStopped&&!this._isUnsubscribing){this._isUnsubscribing=!0;try{super.complete()}finally{this._isUnsubscribing=!1}}}unsubscribe(){this.closed||(this._isUnsubscribing=!0,super.unsubscribe(),this._isUnsubscribing=!1)}};var W=class extends ${constructor(t){if(super(),t)this._subscribe=t;else throw new TypeError("Observable constructor requires a subscribe function")}subscribe(t,n,o){let r;t instanceof Q?r=t:r=new de(t,n,o);let{_subscribe:s}=this;try{let l=s.call(this,r);l&&(typeof l=="function"||typeof l.unsubscribe=="function")&&r.add(l)}catch(l){r.error(l)}return r}pipe(...t){return t.length===0?this:t.reduce((n,o)=>o(n),this)}toPromise(){return new Promise((t,n)=>{let o;this.subscribe({next:r=>o=r,error:n,complete:()=>t(o)})})}};import{isPromise as le}from"@fluixi/utils";var Z=!1,vt=Symbol.for("signal"),ht=Symbol.for("memo"),Tt=Symbol.for("resource");function ee(e){return typeof e=="function"&&e[vt]===!0}function bt(e){return typeof e=="function"&&e[ht]===!0}function yt(e){return typeof e=="function"&&e[Tt]===!0}function mt(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function wt(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function xt(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Me(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Me(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}var gt="__fluixi_signal_next_state__",St=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},a=globalThis[gt]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:St,onSuspend:null,onError:null};var Le=0,Be=1,z=2,te=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))}},ne=class extends te{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++,this.observers)for(let n of[...this.observers])n.markDirty(z);pe(this)}}peek(){return this._value}},G=class extends te{constructor(n,o){super();this._threw=!1;this._initialized=!1;this.state=z;this.sources=null;this._fn=n,this._equals=o?.equals===!1?()=>!1:o?.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===Be&&this.sources){for(let n of this.sources)if(n.updateIfNecessary(),this.state===z)break}(this.state===z||!this._initialized)&&this.recompute(),this.state=Le}recompute(){if(this.sources){for(let f of this.sources)f.observers?.delete(this);this.sources.clear()}let n=a.consumer,o=a.untracked;a.consumer=this,a.untracked=!1;let r,s=!1,l;try{r=this._fn()}catch(f){s=!0,l=f,r=this._value}finally{a.consumer=n,a.untracked=o}let c=!this._initialized||this._threw!==s||(s?l!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=s,this._error=l,this._value=r,c){if(this.version++,this.observers)for(let f of[...this.observers])f.markDirty(z);pe(this)}}markDirty(n){if(this.state>=n)return;let o=this.state===Le;if(this.state=n,o){if(this.observers)for(let r of[...this.observers])r.markDirty(Be);pe(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function pe(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var re=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 Ot(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Ge(e){return a.onSuspend?(a.onSuspend(e,a.owner),!0):!1}function Te(){return a.owner}function oe(e,t){let n=a.owner;a.owner=e;try{return t()}finally{a.owner=n}}function be(e){if(a.owner){if(a.owner.disposed){e();return}(a.owner.cleanups??=[]).push(e)}}function ve(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)ve(e.owned[n]);e.owned=null}if(e.cleanups){for(let n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}t&&(e.disposed=!0)}}function Ve(e){a.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Ct(e){e.queued||(e.queued=!0,a.queue.push(e),!a.scheduled&&a.batchDepth===0&&(a.scheduled=!0,a.hostSchedule(ye)))}function ye(){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 n of t)n.queued=!1,n.disposed||n.run()}}finally{a.flushing=!1}}function je(){a.batchDepth===0&&ye()}var he=class{constructor(t){this.queued=!1;this.disposed=!1;this.owner=Ot(a.owner),a.owner&&(a.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new G(()=>{ve(this.owner,!1),oe(this.owner,()=>{let n=t();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),this.watcher=new re(()=>Ct(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.watcher.unwatch(this.computed),ve(this.owner))}};function $e(e){let t=new he(e);return()=>t.dispose()}function Rt(e){return!!e&&typeof e.then=="function"}Ve(()=>{});var We=Symbol.for("signal"),_t=Symbol.for("memo"),At=Symbol.for("signal-node");function me(e,t){let n=new ne(e,{equals:t?.equals}),o=(()=>n.get()),r=(s=>{let l=typeof s=="function"?s(n.peek()):s;return n.set(l),je(),l});return Object.defineProperty(o,We,{value:!0,enumerable:!0}),Object.defineProperty(o,At,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),[o,r]}function se(e,t,n){let o=t,r=Te(),s=new G(()=>oe(r,()=>{try{return o=e(o)}catch(c){if(Rt(c))return Ge(c),o;throw c}}),{equals:n?.equals}),l=(()=>s.get());return Object.defineProperty(l,We,{value:!0,enumerable:!0}),Object.defineProperty(l,_t,{value:!0,enumerable:!0}),l}function we(e,t){let n=t;return $e(()=>{n=e(n)})}function ze(e,t=(n,o)=>n===o){let n=new Map;return we(()=>{let o=e();for(let[r,s]of n){let[l,c]=s,f=t(r,o);l()!==f&&c(f)}}),o=>{let r=n.get(o);if(!r){let[s,l]=me(!1);r=[s,l],n.set(o,r);let c=e();l(t(o,c))}return r[0]()}}function Ft(e,t){let[n,o]=me(e(),t);return we(()=>{let r=e();t?.timeoutMs?setTimeout(()=>o(()=>r),t.timeoutMs):typeof requestIdleCallback=="function"?requestIdleCallback(()=>o(()=>r)):Promise.resolve().then(()=>o(()=>r))}),n}function Et(e,t){let n,o=(...r)=>{n!==void 0&&clearTimeout(n),n=setTimeout(()=>{n=void 0,e(...r)},t)};return be(()=>{n!==void 0&&clearTimeout(n)}),o}function ie(e){if(typeof e=="function"&&!e.length){let t=e();return ee(t)?t:ie(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let o=ie(e[n]);Array.isArray(o)?t.push.apply(t,o):t.push(o)}return t}return e}function He(e){let t=se(e);return se(()=>ie(t()))}var xe=null;function Pt(e){xe=e}function Ye(e){xe&&xe(e)}var ge=null;function kt(e){ge=e}function Ke(e){return ge?ge(e):void 0}var Se=null;function Dt(e){Se=e}function Xe(){return Se?Se():void 0}var Oe=null;function qt(e){Oe=e}function Je(e,t){Oe&&Oe(e,t)}var Ee=Symbol.for("signal"),Nt=Symbol.for("memo"),Ut=Symbol.for("resource"),Qe=Symbol("fluixi-proxy"),tt=Symbol.for("signal-node"),A=0,H=1,E=2,F=3,u=null,d=null,i=null,ue=null,ae=0,It=!1,Ce=!1,V=0,Mt=1e6,m=new WeakMap,g=null;var Lt=null,Bt=new Map,Gt=0,Re={context:null,owner:null,routeData:new Map,matchedRoute:new Map};function Mn(e){u=e,Re.owner=e,Re.context=e}function Ln(){return Re}function Vt(){return`node_${++Gt}_${Date.now()}`}function jt(e){!1}function nt(e,t,n){let o={id:Vt(),type:e,value:t,version:0,equals:n?.equals,name:n?.name,created:Date.now(),updated:Date.now()};return jt(o),o}function rt(e,t){return e===t}function Pe(e){throw typeof console<"u"&&console.error("Reactive error:",e),e}var _e=null,Ae=null;function ot(){if(!_e){let[e,t]=M(!1);_e=e,Ae=t}}function st(e){if(i)i.indexOf(e)===-1&&i.push(e);else if(g&&g.running&&!e.pure)g.effects.indexOf(e)===-1&&g.effects.push(e);else if(!e.pure||e.computed)X(e);else if(e.pure&&!e.computed&&e.accessor){let t=d,n=i;d=null,i=[],e.accessor(),d=t;let o=i;if(i=n,o.length>0){let r=i;ce(o),i=r}}}function Ze(e,t){for(let n=0;n<e.length;n++)t(e[n])}function M(e,t){let n=e;typeof n=="object"&&n&&Qe in n&&delete n[Qe];let o=nt("signal",n,{equals:t?.equals===!1?void 0:t?.equals,name:t?.name}),r=[l,c];m.set(r,new Set);let s;function l(){let f=d;if(f){f.sources?f.sources.indexOf(r)===-1&&f.sources.push(r):f.sources=[r];let p=m.get(r);p&&!p.has(f)&&p.add(f)}return n}function c(f){let p=typeof f=="function"?f(n):f,b=o.equals||rt;if(t?.equals===!1||!b(n,p)){n=p,o.value=p,o.version++,o.updated=Date.now();let k=m.get(r);if(k&&k.size>0){let D=function(v,h=!1){let q=v.state;if(!(q===F&&v===d)){if(h&&!v.pure){q===A&&(v.state=H,It&&(i!==null&&i.indexOf(v)===-1?i.push(v):C.push(v)));return}if(!w.has(v)&&(w.add(v),v.state=E,q===A||q===H?C.push(v):!v.pure&&i!==null&&i.indexOf(v)===-1&&i.push(v),v.pure&&v.accessor)){let O=m.get(v.accessor);O&&Ze(Array.from(O),R=>D(R,!0))}}};var x=D;let S=Array.from(k),C=[],w=new Set;Ze(S,D);for(let v of C)st(v)}}}return l.toObservable=()=>new W(f=>{let p=!0;return K(()=>{let x=l();p?p=!1:f.next(x)})}),Object.defineProperty(l,Ee,{value:!0,enumerable:!0}),Object.defineProperty(l,tt,{value:o,enumerable:!1}),r}function K(e,t,n){let o={fn:e,state:E,sources:null,sourceSlots:null,owned:null,cleanups:null,owner:u,contexts:null,pure:!1,updatedAt:null};u&&(u.owned?u.owned.push(o):u.owned=[o]);let r=T&&P(T);return r&&(o.suspense=r),ke(o,t),()=>U(o)}function ke(e,t){if(e.sources){for(let r of e.sources){let s=m.get(r);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.owned){for(let r=0;r<e.owned.length;r++)U(e.owned[r]);e.owned=null}let n=d,o=u;if(d=e,u=e,ae++,ae>Mt)throw ae=0,d=n,u=o,new Error("Potential infinite loop detected. Exceeded maximum iterations.");try{e.state=F;let r=e.fn(t);typeof r=="function"&&(e.cleanups?e.cleanups.push(r):e.cleanups=[r]),e.state===F&&(e.state=A)}catch(r){if(le(r)){let s=T&&P(T);s&&(s.increment(),r.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Pe(r)}finally{d=n,u=o}}function X(e){if(!(e.disposed||!e.fn||e.state===A)&&(e.state===E||e.state===H||e.state===F)){if(e.cleanups){for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}if(e.owned){for(let t=0;t<e.owned.length;t++)U(e.owned[t]);e.owned=null}e.renderEffect?lt(e):ke(e,e.value)}}function U(e){if(e.disposed=!0,e.sources)for(let t of e.sources){let n=m.get(t);n&&n.delete(e)}if(e.cleanups)for(let t=0;t<e.cleanups.length;t++)e.cleanups[t]();if(e.owned)for(let t=0;t<e.owned.length;t++)U(e.owned[t]);if(e.owner&&e.owner.owned){let t=e.owner.owned.indexOf(e);t!==-1&&e.owner.owned.splice(t,1)}}function $t(e,t,n){let o=nt("memo",t,{equals:n?.equals===!1?void 0:n?.equals,name:n?.name}),r={fn:e,state:E,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!0,updatedAt:null,node:o,accessor:void 0};u&&(u.owned?u.owned.push(r):u.owned=[r]);let s=()=>{if(d&&d!==r){d.sources?d.sources.indexOf(s)===-1&&d.sources.push(s):d.sources=[s];let c=s;m.has(c)||m.set(c,new Set);let f=m.get(c);f&&f.add(d)}if(r.state!==A){if(r.sources){for(let p of r.sources){let b=m.get(p);b&&b.delete(r)}r.sources=null,r.sourceSlots=null}if(r.cleanups){for(let p=0;p<r.cleanups.length;p++)r.cleanups[p]();r.cleanups=null}if(r.owned){for(let p=0;p<r.owned.length;p++)U(r.owned[p]);r.owned=null}let c=d,f=u;d=r,u=r,r.state=F;try{let p=r.fn(r.value),b=o.equals||rt;if(n?.equals===!1||!b(r.value,p)){r.value=p,o.value=p,o.version++,o.updated=Date.now();let k=s,S=m.get(k);if(S&&S.size>0){let v=function(h,q=!1){if(h===r)return;let O=h.state;if(O!==F){if(q&&!h.pure){O===A&&(h.state=H,i!==null&&i.indexOf(h)===-1?i.push(h):w.push(h));return}if(!D.has(h)&&(D.add(h),h.state=E,O===A||O===H?w.push(h):!h.pure&&i!==null&&i.indexOf(h)===-1&&i.push(h),h.pure&&h.accessor)){let R=m.get(h.accessor);if(R&&R.size>0)for(let j of Array.from(R))v(j,!0)}}};var l=v;let C=Array.from(S),w=[],D=new Set;for(let h=0;h<C.length;h++)v(C[h]);for(let h of w)st(h)}}r.state===F&&(r.state=A)}catch(p){if(le(p)){let b=T&&P(T);if(!b&&T){let x=f;for(;x;){if(x.contexts?.has(T.id)){b=x.contexts.get(T.id);break}x=x.owner}}return b&&(b.increment(),p.finally(()=>b.decrement())),r.value}Pe(p)}finally{d=c,u=f}}return r.value};return r.accessor=s,m.set(s,new Set),s.toObservable=()=>new W(l=>{let c=!0;return K(()=>{let p=s();c?c=!1:l.next(p)})}),Object.defineProperty(s,Ee,{value:!0,enumerable:!0}),Object.defineProperty(s,Nt,{value:!0,enumerable:!0}),Object.defineProperty(s,tt,{value:o,enumerable:!1}),s}function ce(e){let t=[],n=[];for(let r of e)r.pure&&!r.computed&&r.accessor?t.indexOf(r)===-1&&t.push(r):(r.computed||!r.pure)&&n.indexOf(r)===-1&&n.push(r);i=[];let o=0;for(;o<t.length;){let r=t[o++],s=m.get(r.accessor);if(s&&s.size>0){let c=d;d=null,r.accessor(),d=c}let l=i.splice(0);for(let c of l)c.pure&&!c.computed&&c.accessor?t.indexOf(c)===-1&&t.push(c):(c.computed||!c.pure)&&n.indexOf(c)===-1&&n.push(c)}i=null;for(let r of n)(r.computed||!r.pure)&&X(r)}function _(e){if(i&&V>0)return e();if(i&&V===0){let t=i,n=[];i=n,V++;let o;try{o=e()}finally{V--,i=t}let r=i;return ce(n),i=r,o}V++,i=[],ue=[];try{return e()}finally{V--,it()}}function it(){if(!Ce){Ce=!0,ae=0;try{for(;i&&i.length>0;){let e=i;i=null,ce(e)}if(i=null,ue){let e=ue;ue=null;for(let t=0;t<e.length;t++)X(e[t])}}finally{Ce=!1}}}function Wt(e){let t={owned:null,cleanups:null,contexts:null,owner:u},n=d;d=null;let o=u;u=t;try{return e(()=>{if(t.owned)for(let r=0;r<t.owned.length;r++)U(t.owned[r]);if(t.cleanups)for(let r=0;r<t.cleanups.length;r++)t.cleanups[r]()})}finally{u=o,d=n}}function Y(e){let t=d;d=null;try{return e()}finally{d=t}}function Fe(e){u&&(u.cleanups?u.cleanups.push(e):u.cleanups=[e])}function zt(e,t,n={}){let o,r;typeof t=="function"?(o=typeof e=="function"?e:()=>e,r=t):(o=()=>!0,r=e,t&&typeof t=="object"&&(n=t));let{initialValue:s,name:l}=n,c=n.transport===!1?void 0:Xe(),f=c!==void 0?Ke(c):void 0,p=f!==void 0,[b,x]=M(f!==void 0?f.value:n.initialValue,{equals:!1}),[k,S]=M(void 0,{equals:!1}),[C,w]=M(f!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[D,v]=M(void 0,{equals:!1}),[h,q]=M(void 0,{equals:!1}),O=Symbol(),R=O,j=!1,ct=y=>{if(!(typeof localStorage>"u"))try{y&&localStorage.setItem("storage",JSON.stringify({data:y,timestamp:Date.now()}))}catch(L){console.error(`Failed to save resource to cache (${l}):`,L)}},ft=K(()=>{let y=o?o():e;if(h(),y===!1||y===null||y===void 0){R=O,_(()=>{w("unresolved"),v(void 0),S(void 0)});return}let L=j;if(j=!1,R!==O&&y===R&&!L)return;if(R=y,p){p=!1;return}let B=!1;Fe(()=>B=!0);let Ne=Y(C),dt=Y(b),Ue=Ne==="ready"||Ne==="refreshing";_(()=>{w(Ue?"refreshing":"pending"),S(void 0)});try{let N=r(y,{value:dt,refetching:Ue});if(le(N)){v(N),Ye(N),N.then(I=>{B||(c!==void 0&&Je(c,I),_(()=>{x(()=>I),ct(I),w("ready"),v(void 0)}))},I=>{B||_(()=>{S(I),w("errored"),v(void 0)})}).catch(I=>{B||_(()=>{S(I),w("errored"),v(void 0)})});let fe=T&&P(T);fe&&(fe.increment(),N.finally(()=>fe.decrement()))}else{if(B)return;_(()=>{x(()=>N),w("ready"),v(void 0)})}}catch(N){if(B)return;_(()=>{S(N),w("errored"),v(void 0)})}});Fe(ft);let qe=()=>{let y=C();return y==="pending"||y==="refreshing"},J=(()=>{let y=k();if(y)throw y;if(qe()){let L=D();if(L)throw L}return b()});return Object.defineProperty(J,Ut,{value:!0,enumerable:!0}),Object.defineProperty(J,Ee,{value:!0,enumerable:!0}),Object.defineProperties(J,{state:{get:C},loading:{get:()=>qe()},error:{get:k},latest:{get:b}}),[J,{mutate:x,refetch:()=>{j=!0,q(void 0)}}]}function Ht(){return u}function Yt(e,t){let n=u,o=d;u=e,d=null;try{return t()}finally{u=n,d=o}}function De(e){let t=Symbol("context"),n=Kt(t);return{id:t,Provider:n,defaultValue:e}}function Kt(e){return t=>{let n=u;for(;n;)n.contexts||(n.contexts=new Map),n.contexts.has(e)||n.contexts.set(e,t.value),n=n.owner;let o;return at(()=>{o=Y(()=>{let r=u;return r&&(r.contexts||(r.contexts=new Map),r.contexts.set(e,t.value)),He(()=>t.children)})}),o}}function P(e){let t=u;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.owner}if(e)return e.defaultValue}function Xt(){return new Promise(e=>{queueMicrotask(()=>{it(),e()})})}function ut(e){if(g&&g.running)return e(),g.done;ot();let t,n=new Promise(r=>t=r),o={running:!0,effects:[],resolve:t,done:n};g=o;try{e()}finally{o.running=!1}return o.effects.length?(Ae(!0),Promise.resolve().then(()=>{let r=o.effects.splice(0);g=null,Ae(!1),r.length&&_(()=>{for(let s of r)s.state=E,X(s)}),t()}),n):(g=null,t(),n)}function Jt(){return ot(),[_e,ut]}function Qt(e,t,n){let o=n?.defer??!1,r=!0;return s=>{let l=e();return o&&r?(r=!1,s):Y(()=>t(l,s))}}function at(e,t,n){let o={fn:e,state:E,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!1,updatedAt:null,renderEffect:!0};u&&(u.owned?u.owned.push(o):u.owned=[o]);let r=T&&P(T);return r&&(o.suspense=r),lt(o),()=>U(o)}function lt(e){if(e.sources){for(let r of e.sources){let s=m.get(r);s&&s.delete(e)}e.sources=null,e.sourceSlots=null}if(e.cleanups){for(let r=0;r<e.cleanups.length;r++)e.cleanups[r]();e.cleanups=null}if(e.owned){for(let r=0;r<e.owned.length;r++)U(e.owned[r]);e.owned=null}let t=d,n=u,o=i;d=e,u=e,i===null&&(i=[]),e.state=F;try{let r=e.fn(e.value);typeof r=="function"&&(e.cleanups||(e.cleanups=[]),e.cleanups.push(r)),e.value=r,e.state===F&&(e.state=A)}catch(r){if(le(r)){let s=T&&P(T);s&&(s.increment(),r.finally(()=>s.decrement()),e.suspense&&s.effects.push(e));return}Pe(r)}finally{d=t,u=n;let r=i;if(i=o,r!==o&&r&&r.length>0){let s=i;ce(r),i=s}}}function Zt(e,t,n){let o={fn:e,state:E,sources:null,sourceSlots:null,value:t,owned:null,cleanups:null,owner:u,contexts:null,pure:!0,computed:!0,updatedAt:null};u&&(u.owned?u.owned.push(o):u.owned=[o]),g&&g.running?(i||(i=[]),i.indexOf(o)===-1&&i.push(o)):i?i.indexOf(o)===-1&&i.push(o):ke(o,t)}var T;function en(){return T||(T=De())}var et;function tn(){return et||(et=De())}function nn(e){if(!e.length)return;let t=e.slice();e.length=0;for(let n of t)n.state=E,X(n)}function rn(e){let t=T&&P(T);t&&t.inFallback()?K(()=>{t.inFallback()||e()}):e()}function on(e){Lt=e}function sn(e){let t=T&&P(T);return t&&(t.increment(),e.finally(()=>t.decrement())),e}var Gn={createSignal:M,createEffect:K,createMemo:$t,createComputed:Zt,createRoot:Wt,createSelector:ze,createResource:zt,batch:_,untrack:Y,onCleanup:Fe,getOwner:Ht,runWithOwner:Yt,createContext:De,useContext:P,flush:Xt,startTransition:ut,useTransition:Jt,isSignal:ee,on:Qt,createRenderEffect:at,getSuspenseContext:en,getSuspenseListContext:tn,resumeEffects:nn,onResolve:rn,setScheduler:on,trackPromise:sn};export{Nt as $MEMO,Qe as $PROXY,Ut as $RESOURCE,Ee as $SIGNAL,Z as __DEV__,_ as batch,Zt as createComputed,De as createContext,Et as createDebounce,Ft as createDeferred,K as createEffect,$t as createMemo,Kt as createProvider,at as createRenderEffect,zt as createResource,Wt as createRoot,ze as createSelector,M as createSignal,Gn as default,Xt as flush,Ht as getOwner,Ke as getServerData,Ln as getSharedConfig,en as getSuspenseContext,tn as getSuspenseListContext,mt as isComponent,bt as isMemo,xt as isProvider,yt as isResource,ee as isSignal,wt as isSuspense,Me as makeArrayFlat,Xe as nextResourceId,Qt as on,Fe as onCleanup,rn as onResolve,He as readChildren,Je as reportResourceData,nn as resumeEffects,Yt as runWithOwner,Mn as setOwner,qt as setResourceDataSink,Dt as setResourceIdSource,Pt as setResourceTracker,on as setScheduler,kt as setServerDataGetter,Re as sharedConfig,ut as startTransition,sn as trackPromise,Ye as trackResourcePromise,Y as untrack,P as useContext,Jt as useTransition};
|