@fluixi/template-runtime 0.1.0-alpha.3 → 0.1.0-alpha.5

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.
@@ -1 +1,4 @@
1
- "use strict";var Fluixi=(()=>{var kt=Object.defineProperty;var _o=Object.getOwnPropertyDescriptor;var Oo=Object.getOwnPropertyNames;var No=Object.prototype.hasOwnProperty;var Pr=(e,t)=>{for(var r in t)kt(e,r,{get:t[r],enumerable:!0})},To=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Oo(t))!No.call(e,i)&&i!==r&&kt(e,i,{get:()=>t[i],enumerable:!(n=_o(t,i))||n.enumerable});return e};var Po=e=>To(kt({},"__esModule",{value:!0}),e);var cc={};Pr(cc,{Dynamic:()=>hr,ErrorBoundary:()=>mr,For:()=>ur,Index:()=>cr,Match:()=>fr,Portal:()=>pr,Show:()=>ar,Switch:()=>dr,batch:()=>B,define:()=>So,effect:()=>Sn,html:()=>Ao,hydrate:()=>Pe,insert:()=>D,memo:()=>xn,onCleanup:()=>we,render:()=>Te,resource:()=>$n,signal:()=>kn,store:()=>Nn,svg:()=>Eo,untrack:()=>se});var gr={};Pr(gr,{ClientOnly:()=>Pi,Dynamic:()=>hr,ErrorBoundary:()=>mr,FX_DATA_ID:()=>sr,For:()=>ur,Index:()=>cr,Island:()=>wa,JSX_PROPERTIES:()=>It,Match:()=>fr,NoSsr:()=>Na,Portal:()=>pr,SVG_ELEMENTS:()=>cl,SVG_NAMESPACE:()=>st,Show:()=>ar,Switch:()=>dr,VERSION:()=>Qn,VOID_ELEMENTS:()=>ul,addClass:()=>Vn,addDelegatedEventListener:()=>Gt,addNativeEventListener:()=>Qt,appendChildren:()=>Kn,applyElementProp:()=>Lt,applyProps:()=>tr,applyUse:()=>Yt,asComponent:()=>ti,asContext:()=>jl,asOutlet:()=>Ml,asProvider:()=>Rl,asRoute:()=>Pl,asRouter:()=>Nl,asRoutes:()=>Tl,asSuspense:()=>Dl,bindPair:()=>$i,captureHydrationCursor:()=>Fl,checkRenderType:()=>ql,classMap:()=>Ta,cleanChildren:()=>z,cloneTemplate:()=>Zt,closest:()=>dl,createComponent:()=>rr,createDynamicElement:()=>Aa,createElement:()=>Gn,createNativeElement:()=>Xt,createPortal:()=>xi,createRequestContext:()=>ir,createTemplate:()=>Kt,default:()=>Za,delegate:()=>gl,delegateEvents:()=>ct,escapeFxJson:()=>Ni,escapeHTML:()=>sa,fnName:()=>Yl,generateID:()=>Jl,getAttribute:()=>Un,getGlobal:()=>_l,getLitEventName:()=>ll,getLocals:()=>ha,getOffset:()=>vl,getRequestContext:()=>ae,getRequestEvent:()=>_i,getRequestLocals:()=>Oi,getServerData:()=>Ti,getStableElementId:()=>Ul,getStyle:()=>pl,handleRef:()=>Ne,hasClass:()=>hl,holeContent:()=>vi,holeEnd:()=>yi,holeScope:()=>mi,html:()=>Sa,hydrate:()=>Pe,hydrateAdvancePast:()=>Jt,hydrateIslands:()=>xa,indexArray:()=>Ve,initializeIntegration:()=>ca,insert:()=>D,insertExpression:()=>$e,intergartionInitialized:()=>fa,isAccessor:()=>la,isComponent:()=>j,isContext:()=>li,isCustomElement:()=>Fn,isDOMNode:()=>El,isDelegatedEvent:()=>Kl,isDomElement:()=>ui,isDomNode:()=>Oe,isDomText:()=>ci,isEventHandler:()=>sl,isFunction:()=>Zl,isIntegrationInitialized:()=>Ai,isJSXTemplate:()=>Al,isLitTemplateResult:()=>Zn,isNativeElement:()=>oa,isOutlet:()=>oi,isPromise:()=>ke,isProvider:()=>si,isReactElement:()=>Sl,isRoute:()=>ii,isRouter:()=>ri,isRoutes:()=>ni,isSVGElement:()=>Si,isServer:()=>q,isSuspense:()=>ai,isTemplateFactory:()=>$l,isVisible:()=>ml,iterateFn:()=>ea,keyArray:()=>Fe,makeArrayFlat:()=>gi,mapArray:()=>He,mergeProps:()=>ki,observeIntersection:()=>wl,observeResize:()=>kl,query:()=>Wt,queryAll:()=>fl,registerCoreVersion:()=>Ol,registerCreateComponent:()=>ua,registerGlobal:()=>Cl,removeAttribute:()=>Jn,removeChildren:()=>Xn,removeClass:()=>Bn,removeDelegatedEventListener:()=>it,render:()=>Te,renderToString:()=>za,renderToStringAsync:()=>Xa,resetIntegration:()=>Ei,runHydrationAt:()=>Ht,runWithRequestContext:()=>or,runWithoutHydration:()=>Vl,scrollIntoView:()=>yl,serializeNode:()=>J,serializeResourceData:()=>zi,setAttribute:()=>T,setClassList:()=>Ce,setClassName:()=>ce,setDataRedactor:()=>Ja,setDynamicAttribute:()=>Ae,setDynamicBoolAttribute:()=>er,setDynamicProperty:()=>Ee,setProperty:()=>ue,setRequestStore:()=>da,setServerMode:()=>Se,setStyle:()=>_e,setStyles:()=>zt,shouldSetAsProperty:()=>al,splitProps:()=>ia,spread:()=>wi,stampVersions:()=>Yn,styleMap:()=>Ma,svg:()=>$a,templateNode:()=>pi,toAttributeName:()=>ol,toggleClass:()=>zn,versions:()=>A,waitForElement:()=>bl,warnOnVersionSkew:()=>ei});var Mo="__fluixi_signal_next_state__",Ro=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},d=globalThis[Mo]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Ro,onSuspend:null,onError:null,observer:null},jo="1.0.0-alpha.83";function Do(e){return d.observer=e,()=>{d.observer===e&&(d.observer=null)}}var C=[],qo;function St(e){let t=d.observer;t&&t.created(e.parents===void 0?{...e,parents:C,origin:e.origin??qo}:e)}function Lo(e){return d.observer?(C.push(e),!0):!1}function Io(){C.pop()}function Wo(e){d.observer?.ran?.(e)}function Ho(e,t){d.observer?.wrote?.(e,t)}function O(e,t,r,n){let i=d.observer;!i?.bound||!C.length||i.bound(C[C.length-1],e,t,r,n)}function N(e,t,r,n){let i=d.observer;!i?.directive||!C.length||i.directive(C[C.length-1],e,t,r,n)}function Fo(e){d.observer?.contextCreated?.(e)}function Vo(e,t,r){let n=d.observer;!n?.context||!C.length||n.context(C[C.length-1],e,t,r)}function $t(e){d.observer?.disposed?.(e)}var Bo="__FLUIXI_DEVTOOLS_HOOK__",Mr=globalThis[Bo];if(typeof Mr?.inject=="function")try{Mr.inject({observeReactiveNodes:Do,version:jo})}catch{}function Dr(){return d.observer!=null}var Rr=0,jr=1,pe=2,qr=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(d.untracked)return;let e=d.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},zo=class extends qr{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,Ho(this,d.consumer),this.observers)for(let t of[...this.observers])t.markDirty(pe);xt(this)}}peek(){return this._value}},Lr=class extends qr{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=pe,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(d.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===jr&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===pe)break}(this.state===pe||!this._initialized)&&this.recompute(),this.state=Rr}recompute(){if(this.sources){for(let l of this.sources)l.observers?.delete(this);this.sources.clear()}let e=d.consumer,t=d.untracked,r=Lo(this);d.consumer=this,d.untracked=!1;let n,i=!1,o;try{n=this._fn()}catch(l){i=!0,o=l,n=this._value}finally{d.consumer=e,d.untracked=t,r&&Io()}let s=!this._initialized||this._threw!==i||(i?o!==this._error:!this._equals(this._value,n));if(this._initialized=!0,this._threw=i,this._error=o,this._value=n,Wo(this),s){if(this.version++,this.observers)for(let l of[...this.observers])l.markDirty(pe);xt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Rr;if(this.state=e,t){if(this.observers)for(let r of[...this.observers])r.markDirty(jr);xt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function xt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Uo=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function Jo(e){if(d.untracked)return e();d.untracked=!0;try{return e()}finally{d.untracked=!1}}function ee(e){let t=Ie(e);return e&&(e.owned??=[]).push(t),t}function te(e,t=!0){me(e,t)}function Ie(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Ir(e,t){let r=Symbol(t??"context");return Fo(r),{id:r,defaultValue:e,Provider:n=>{Vo(r,"provide",n.value);let i=d.owner,o=Ie(i);(o.contexts=new Map).set(r,n.value),i&&(i.owned??=[]).push(o),d.owner=o;try{return n.children}finally{d.owner=i}}}}function Wr(e,t){let r=e;for(;r;){if(r.contexts&&r.contexts.has(t.id))return r.contexts.get(t.id);r=r.parent}return t.defaultValue}function Go(e){d.onSuspend=e}function Xo(e){return d.onSuspend?(d.onSuspend(e,d.owner),!0):!1}function Ko(e){d.onError=e}function L(){return d.owner}function _(e,t){let r=d.owner;d.owner=e;try{return t()}finally{d.owner=r}}function k(e){if(d.owner){if(d.owner.disposed){e();return}(d.owner.cleanups??=[]).push(e)}}function me(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)me(e.owned[r]);e.owned=null}if(e.cleanups){for(let r=e.cleanups.length-1;r>=0;r--)e.cleanups[r]();e.cleanups=null}t&&(e.disposed=!0)}}function P(e){let t=Ie(d.owner);d.owner&&(d.owner.owned??=[]).push(t);let r=d.owner;d.owner=t;try{return e(()=>me(t))}finally{d.owner=r}}function Zo(e){d.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Qo(e){e.queued||(e.queued=!0,d.queue.push(e),!d.scheduled&&d.batchDepth===0&&(d.scheduled=!0,d.hostSchedule(We)))}function We(){if(d.scheduled=!1,d.flushing)return;d.flushing=!0;let e=0;try{for(;d.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=d.queue;d.queue=[];for(let r of t)r.queued=!1,r.disposed||r.run()}}finally{d.flushing=!1}}function Yo(){d.batchDepth===0&&We()}function es(e){d.batchDepth++;try{return e()}finally{--d.batchDepth===0&&We()}}var ts=class{constructor(e,t=!1){this.queued=!1,this.disposed=!1,this.owner=Ie(d.owner),d.owner&&(d.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new Lr(()=>{me(this.owner,!1),_(this.owner,()=>{let r=e();typeof r=="function"&&(this.owner.cleanups??=[]).push(r)})}),St({kind:"effect",node:this.computed,handle:this,internal:!t}),this.watcher=new Uo(()=>Qo(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&d.onSuspend){d.onSuspend(e,this.owner);return}if(d.onError&&d.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,$t(this.computed),this.watcher.unwatch(this.computed),me(this.owner))}};function Hr(e,t=!1){let r=new ts(e,t);return()=>r.dispose()}function rs(e){return!!e&&typeof e.then=="function"}Zo(()=>{});var Fr=Symbol.for("signal"),ns=Symbol.for("memo"),is=Symbol.for("signal-node");function M(e,t){let r=new zo(e,{equals:t?.equals}),n=(()=>r.get()),i=(o=>{let s=typeof o=="function"?o(r.peek()):o;return r.set(s),Yo(),s});return Object.defineProperty(n,Fr,{value:!0,enumerable:!0}),Object.defineProperty(n,is,{value:{get value(){return r.peek()},get version(){return r.version}},enumerable:!1}),St({kind:"signal",node:r,handle:n,name:t?.name,set:i}),Dr()&&k(()=>$t(r)),[n,i]}function g(e,t,r){let n=t,i=L(),o=new Lr(()=>_(i,()=>{try{return n=e(n)}catch(l){if(rs(l))return Xo(l),n;throw l}}),{equals:r?.equals}),s=(()=>o.get());return Object.defineProperty(s,Fr,{value:!0,enumerable:!0}),Object.defineProperty(s,ns,{value:!0,enumerable:!0}),St({kind:"memo",node:o,handle:s,name:r?.name}),Dr()&&k(()=>$t(o)),s}function I(e,t){let r=t;return Hr(()=>{r=e(r)},!0)}function w(e,t){let r=t;return Hr(()=>{r=e(r)})}function re(e){return es(e)}function R(e){return Jo(e)}function Vr(){return We(),Promise.resolve()}function He(e,t,r){let n=[];return k(()=>{for(let i of n)i.dispose();n=[]}),g(()=>{let i=e()||[];return R(()=>{if(i.length===0){for(let a of n)a.dispose();return n=[],r?.fallback?r.fallback():[]}let o=new Map;for(let a of n)o.has(a.item)||o.set(a.item,a);let s=[],l=new Set;for(let a=0;a<i.length;a++){let u=i[a],f=o.get(u);if(f&&!l.has(f))f.setIndex(a),s.push(f),l.add(f);else{let c,h,y;P(v=>{y=v;let[E,de]=M(a,{name:"row index"});h=de,c=t(u,E)});let b={item:u,rendered:c,dispose:y,setIndex:h};s.push(b),l.add(b)}}for(let a of n)l.has(a)||a.dispose();return n=s,s.map(a=>a.rendered)})},void 0,{name:"mapArray"})}function Fe(e,t,r,n){let i=[],o=[];return k(()=>{for(let s of o)s.dispose();i=[],o=[]}),g(()=>{let s=e()||[];return R(()=>{if(s.length===0){for(let c of o)c.dispose();return i=[],o=[],n?.fallback?n.fallback():[]}let l=new Map;for(let c=0;c<i.length;c++)l.set(i[c],o[c]);let a=[],u=[],f=new Set;for(let c=0;c<s.length;c++){let h=t(s[c]),y=l.get(h);if(y&&!f.has(h))y.setIndex(c),a.push(y);else{let b,v,E;P(de=>{E=de;let[X,he]=M(c,{name:"row index"});v=he;let Re=g(Y=>(e()||[])[X()]??Y,s[c]);b=r(Re,X)}),a.push({rendered:b,dispose:E,setIndex:v})}u.push(h),f.add(h)}for(let[c,h]of l)f.has(c)||h.dispose();return i=u,o=a,a.map(c=>c.rendered)})},void 0,{name:"keyArray"})}function Ve(e,t,r){let n=[];return k(()=>{for(let i of n)i.dispose();n=[]}),g(()=>{let i=e()||[];return R(()=>{if(i.length===0){for(let a of n)a.dispose();return n=[],r?.fallback?r.fallback():[]}let o=n.length,s=i.length;for(let a=o;a<s;a++){let u,f,c,h=i[a];P(y=>{c=y;let[b,v]=M(h);f=v,u=t(b,a)}),n.push({rendered:u,setItem:f,dispose:c})}for(let a=s;a<o;a++)n[a].dispose();s<o&&(n=n.slice(0,s));let l=Math.min(o,s);for(let a=0;a<l;a++)n[a].setItem(i[a]);return n.map(a=>a.rendered)})},void 0,{name:"indexArray"})}var os=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,ss=typeof process>"u"?os:!1,ls=Symbol.for("signal");function x(e){return typeof e=="function"&&e[ls]===!0}var as=null;function Br(e){as=e}var us=null;function zr(e){us=e}var cs=null;function Be(e){cs=e}var fs=null;function Ur(e){fs=e}function Le(e){if(typeof e=="function"&&!e.length){let t=e();return x(t)?t:Le(t)}if(Array.isArray(e)){let t=[];for(let r=0;r<e.length;r++){let n=Le(e[r]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function ze(e){let t=g(e);return ss?g(()=>Le(t()),void 0,{name:"children"}):g(()=>Le(t()))}var ds=Ir();Go((e,t)=>{let r=Wr(t,ds);r&&(r.increment(),e.finally(()=>r.decrement()))});var hs=Ir();Ko((e,t)=>{let r=Wr(t,hs);return r?(r.setError(e),!0):!1});var At=Symbol.for("fluixi-proxy");var Jr="1.0.0-alpha.83";var ps="1.0.0-alpha.83";var ms="__fluixi_signal_next_state__",ys=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)},p=globalThis[ms]??={consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:ys,onSuspend:null,onError:null,observer:null};function vs(e){return p.observer=e,()=>{p.observer===e&&(p.observer=null)}}var W=[],Ue;function gs(e,t){if(!p.observer)return t();let r=Ue;Ue=e;try{return t()}finally{Ue=r}}function Ye(e){let t=p.observer;t&&t.created(e.parents===void 0?{...e,parents:W,origin:e.origin??Ue}:e)}function bs(e){return p.observer?(W.push(e),!0):!1}function ws(){W.pop()}function ks(e){p.observer?.ran?.(e)}function xs(e,t){p.observer?.wrote?.(e,t)}function fn(e){let t=p.observer;!t?.props||!W.length||!e||t.props(W[W.length-1],e)}function Ss(e){p.observer?.contextCreated?.(e)}function $s(e,t,r){let n=p.observer;!n?.context||!W.length||n.context(W[W.length-1],e,t,r)}function Gr(e,t,r){p.observer?.moved?.(e,t,r)}function ge(e){p.observer?.disposed?.(e)}var As="__FLUIXI_DEVTOOLS_HOOK__",Xr=globalThis[As];if(typeof Xr?.inject=="function")try{Xr.inject({observeReactiveNodes:vs,version:ps})}catch{}function et(){return p.observer!=null}var Kr=0,Zr=1,ye=2,dn=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(p.untracked)return;let e=p.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Es=class extends dn{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,xs(this,p.consumer),this.observers)for(let t of[...this.observers])t.markDirty(ye);_t(this)}}peek(){return this._value}},hn=class extends dn{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=ye,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(p.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===Zr&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===ye)break}(this.state===ye||!this._initialized)&&this.recompute(),this.state=Kr}recompute(){if(this.sources){for(let l of this.sources)l.observers?.delete(this);this.sources.clear()}let e=p.consumer,t=p.untracked,r=bs(this);p.consumer=this,p.untracked=!1;let n,i=!1,o;try{n=this._fn()}catch(l){i=!0,o=l,n=this._value}finally{p.consumer=e,p.untracked=t,r&&ws()}let s=!this._initialized||this._threw!==i||(i?o!==this._error:!this._equals(this._value,n));if(this._initialized=!0,this._threw=i,this._error=o,this._value=n,ks(this),s){if(this.version++,this.observers)for(let l of[...this.observers])l.markDirty(ye);_t(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Kr;if(this.state=e,t){if(this.observers)for(let r of[...this.observers])r.markDirty(Zr);_t(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function _t(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Cs=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function _s(e){if(p.untracked)return e();p.untracked=!0;try{return e()}finally{p.untracked=!1}}function pn(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function mn(e,t){let r=Symbol(t??"context");return Ss(r),{id:r,defaultValue:e,Provider:n=>{$s(r,"provide",n.value);let i=p.owner,o=pn(i);(o.contexts=new Map).set(r,n.value),i&&(i.owned??=[]).push(o),p.owner=o;try{return n.children}finally{p.owner=i}}}}function yn(e,t){let r=e;for(;r;){if(r.contexts&&r.contexts.has(t.id))return r.contexts.get(t.id);r=r.parent}return t.defaultValue}function Os(e){p.onSuspend=e}function Ns(e){return p.onSuspend?(p.onSuspend(e,p.owner),!0):!1}function Ts(e){p.onError=e}function Ps(){return p.owner}function vn(e,t){let r=p.owner;p.owner=e;try{return t()}finally{p.owner=r}}function we(e){if(p.owner){if(p.owner.disposed){e();return}(p.owner.cleanups??=[]).push(e)}}function Ot(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)Ot(e.owned[r]);e.owned=null}if(e.cleanups){for(let r=e.cleanups.length-1;r>=0;r--)e.cleanups[r]();e.cleanups=null}t&&(e.disposed=!0)}}function Ms(e){p.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Rs(e){e.queued||(e.queued=!0,p.queue.push(e),!p.scheduled&&p.batchDepth===0&&(p.scheduled=!0,p.hostSchedule(Mt)))}function Mt(){if(p.scheduled=!1,p.flushing)return;p.flushing=!0;let e=0;try{for(;p.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=p.queue;p.queue=[];for(let r of t)r.queued=!1,r.disposed||r.run()}}finally{p.flushing=!1}}function js(){p.batchDepth===0&&Mt()}function Ds(e){p.batchDepth++;try{return e()}finally{--p.batchDepth===0&&Mt()}}var qs=class{constructor(e,t=!1){this.queued=!1,this.disposed=!1,this.owner=pn(p.owner),p.owner&&(p.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new hn(()=>{Ot(this.owner,!1),vn(this.owner,()=>{let r=e();typeof r=="function"&&(this.owner.cleanups??=[]).push(r)})}),Ye({kind:"effect",node:this.computed,handle:this,internal:!t}),this.watcher=new Cs(()=>Rs(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&p.onSuspend){p.onSuspend(e,this.owner);return}if(p.onError&&p.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,ge(this.computed),this.watcher.unwatch(this.computed),Ot(this.owner))}};function Ls(e,t=!1){let r=new qs(e,t);return()=>r.dispose()}function Is(e){return!!e&&typeof e.then=="function"}Ms(()=>{});var gn=Symbol.for("signal"),Ws=Symbol.for("memo"),Hs=Symbol.for("signal-node");function ie(e,t){let r=new Es(e,{equals:t?.equals}),n=(()=>r.get()),i=(o=>{let s=typeof o=="function"?o(r.peek()):o;return r.set(s),js(),s});return Object.defineProperty(n,gn,{value:!0,enumerable:!0}),Object.defineProperty(n,Hs,{value:{get value(){return r.peek()},get version(){return r.version}},enumerable:!1}),Ye({kind:"signal",node:r,handle:n,name:t?.name,set:i}),et()&&we(()=>ge(r)),[n,i]}function Rt(e,t,r){let n=t,i=Ps(),o=new hn(()=>vn(i,()=>{try{return n=e(n)}catch(l){if(Is(l))return Ns(l),n;throw l}}),{equals:r?.equals}),s=(()=>o.get());return Object.defineProperty(s,gn,{value:!0,enumerable:!0}),Object.defineProperty(s,Ws,{value:!0,enumerable:!0}),Ye({kind:"memo",node:o,handle:s,name:r?.name}),et()&&we(()=>ge(o)),s}function bn(e,t){let r=t;return Ls(()=>{r=e(r)},!0)}function B(e){return Ds(e)}function se(e){return _s(e)}var bc=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var Fs=Symbol.for("signal");function wn(e){return typeof e=="function"&&e[Fs]===!0}var Qr=null;function Vs(e){Qr&&Qr(e)}var Yr=null;function Bs(e){return Yr?Yr(e):void 0}var en=null;function zs(){return en?en():void 0}var tn=null;function Us(e,t){tn&&tn(e,t)}function Js(e){return!!e&&typeof e.then=="function"}var Et=Symbol();function Gs(e,t,r={}){let n,i;typeof t=="function"?(n=typeof e=="function"?e:()=>e,i=t):(n=()=>!0,i=e,t&&typeof t=="object"&&(r=t));let o=r.transport===!1?void 0:zs(),s=o!==void 0?Bs(o):void 0,l=s!==void 0,[a,u]=ie(s!==void 0?s.value:r.initialValue,{equals:!1}),[f,c]=ie(void 0,{equals:!1}),[h,y]=ie(s!==void 0||r.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[b,v]=ie(void 0,{equals:!1}),[E,de]=ie(void 0,{equals:!1}),X=Et,he=!1;bn(()=>{let S=n();if(E(),S===!1||S===null||S===void 0){X=Et,B(()=>{y("unresolved"),v(void 0),c(void 0)});return}let je=he;if(he=!1,X!==Et&&S===X&&!je)return;if(X=S,l){l=!1;return}let De=!1;we(()=>De=!0);let Nr=se(h),Co=se(a),Tr=Nr==="ready"||Nr==="refreshing";B(()=>{y(Tr?"refreshing":"pending"),c(void 0)});try{let K=i(S,{value:Co,refetching:Tr});Js(K)?(v(K),Vs(K),K.then(qe=>{De||(o!==void 0&&Us(o,qe),B(()=>{u(()=>qe),y("ready"),v(void 0)}))},qe=>{De||B(()=>{c(qe),y("errored"),v(void 0)})})):B(()=>{u(()=>K),y("ready"),v(void 0)})}catch(K){if(De)return;B(()=>{c(K),y("errored"),v(void 0)})}});let Re=()=>{let S=h();return S==="pending"||S==="refreshing"},Y=(()=>{let S=f();if(S)throw S;if(Re()){let je=b();if(je)throw je}return a()});return Object.defineProperties(Y,{state:{get:h},loading:{get:Re},error:{get:f},latest:{get:a}}),Object.defineProperty(Y,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(Y,Symbol.for("signal"),{value:!0,enumerable:!0}),[Y,{mutate:u,refetch:()=>{he=!0,de(void 0)}}]}var Xs=mn();Os((e,t)=>{let r=yn(t,Xs);r&&(r.increment(),e.finally(()=>r.decrement()))});var Ks=mn();Ts((e,t)=>{let r=yn(t,Ks);return r?(r.setError(e),!0):!1});function kn(e,t){let[r,n]=ie(e,t);return Object.assign(r,{set:n})}function xn(e,t,r){return Rt(e,t,r)}function Sn(e,t){return bn(e,t)}function $n(...e){let[t,r]=Gs(...e);return Object.assign(t,r)}var Ge=Symbol("store-raw"),rn=Symbol("store-node"),nn=Symbol("store-has"),on=Symbol("store-self"),sn=Symbol("store-track");var be=new WeakMap,Nt=new WeakMap,le=new WeakMap,Xe=new WeakMap;function Zs(e,t){if(!oe(e)||!et())return;let r=new Set,n=s=>{if(!(!oe(s)||r.has(s))){r.add(s);for(let l of Object.values(s))n(l)}};n(Xe.get(t)??t);let i=new Set,o=s=>{if(!oe(s))return;let l=s;if(r.has(l)||i.has(l))return;i.add(l);let a=be.get(l);if(a){for(let u of a.keys.values())ge(u);a.all&&ge(a.all),be.delete(l),le.delete(l),Nt.delete(l)}for(let u of Object.values(l))o(u)};o(e)}var Ke=(e,t,r)=>r?`${e}[${String(t)}]`:`${e}.${String(t)}`;function An(e,t,r){let n=t?.owner,i=n&&r!==void 0?Ke(n.name,r,t?.array):void 0,[o,s]=gs(n?.store,()=>M(e,i?{name:i}:void 0)),l=o;return l.$=s,l}function Ze(e){let t=be.get(e);return t?t.owner||(t.owner=le.get(e)):be.set(e,t={keys:new Map,owner:le.get(e),array:Array.isArray(e)}),t}function ln(e,t,r){let n=e.keys.get(t);return n||e.keys.set(t,n=An(r,e,t)),n}function Qs(e,t,r,n){let i=le.get(e);if(i&&i.store===t&&i.name===r)return;let o={store:t,name:r};le.set(e,o),Xe.set(e,Xe.get(n)??n);let s=be.get(e);if(s&&(s.owner=o,!!et())){for(let[l,a]of s.keys)Gr(a,t,Ke(r,l,s.array));s.all&&Gr(s.all,t,Ke(r,"*",s.array))}}function an(e){let t=Ze(e);(t.all||(t.all=An(void 0,t,"*")))()}function un(e,t){e.$(typeof t=="function"?()=>t:t)}function oe(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Je(e){if(!oe(e))return e;let t=Nt.get(e);if(t)return t;let r=new Proxy(e,Ys);return Nt.set(e,r),r}var Ys={get(e,t,r){if(t===Ge||t===rn)return e;if(t===At)return r;if(t===nn)return a=>a in e;if(t==="__proxy")return!0;if(t===sn||t===on)return an(e),r;let n=e[t];if(typeof n=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return n;let i=Object.getOwnPropertyDescriptor(e,t);if(i&&i.get)return i.get.call(r);let o=Ze(e),s=ln(o,t,n),l=s();return oe(l)?(o.owner&&Qs(l,s,Ke(o.owner.name,t,o.array),e),Je(l)):l},set(){return!0},deleteProperty(e,t){return t in e&&ve(e,t,void 0),!0},has(e,t){return t===Ge||t===At||t===rn||t===nn||t===on||t===sn?!0:(ln(Ze(e),t,e[t])(),t in e)},ownKeys(e){return an(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function En(e,t=new Set){if(e==null||typeof e!="object")return e;let r=e[Ge]??e;if(t.has(r)||!oe(r))return r;t.add(r);let n=!1,i=s=>{let l=En(s,t);return l!==s&&(n=!0),l};if(Array.isArray(r)){let s=r.map(i);return n?s:r}let o={};for(let s of Object.keys(r))o[s]=i(r[s]);return n?o:r}function ve(e,t,r){let n=En(r),i=e[t];if(i===n&&(n!==void 0||t in e))return;let o=Array.isArray(e),s=o?e.length:0;n===void 0?delete e[t]:e[t]=n;let l=Ze(e),a=l.keys.get(t);if(a&&un(a,n),Zs(i,e),o&&e.length!==s){let u=l.keys.get("length");u&&un(u,e.length)}l.all&&l.all.$(void 0)}function cn(e,t){return typeof e=="function"?e(t):e}function Tt(e,t){for(let r of Object.keys(t)){let n=t[r],i=e[r];n&&typeof n=="object"&&!Array.isArray(n)&&i&&typeof i=="object"&&!Array.isArray(i)?Tt(i,n):ve(e,r,n)}}function jt(e){let t=[],r=e.replace(/\[([^\]]*)\]/g,".$1");for(let n of r.split("."))n.length&&t.push(n);return t}function Cn(e,t,r){let n=t.length-1;for(let o=0;o<n;o++){let s=t[o];if(s==="*"){let a=t.slice(o+1);if(Array.isArray(e))for(let u=0;u<e.length;u++)Cn(e[u],a,r);return}let l=e[s];(l==null||typeof l!="object")&&(l=/^\d+$/.test(t[o+1])?[]:{},ve(e,s,l)),e=l}let i=t[n];if(i==="*"){if(Array.isArray(e))for(let o=0;o<e.length;o++)ve(e,o,cn(r,e[o]));return}ve(e,i,cn(r,e[i]))}function Ct(e,t,r){Cn(e,jt(t),r)}function el(e,t){let r=t[0];if(typeof r=="function"&&t.length===1){let n=r(e);n&&n!==e&&Tt(e,n);return}if(Array.isArray(r)&&t.length===1){for(let n of r)Array.isArray(n)&&Ct(e,n[0],n[1]);return}if(r&&typeof r=="object"&&!Array.isArray(r)&&t.length===1){Tt(e,r);return}if(Array.isArray(t[1])&&t.length>=3){Ct(e,`${r}.${t[1].join(".")}`,t[2]);return}Ct(e,String(r),t[1])}function Pt(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Pt);let t={};for(let r of Object.keys(e))t[r]=Pt(e[r]);return t}function ne(e,t){let r=e;for(let n of jt(t)){if(r==null)return;r=r[n]}return r}var _n=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...r)=>re(()=>el(this.root,r))),e&&typeof e=="object"&&(le.set(e,{store:this,name:t.name??"store"}),Xe.set(e,e)),Ye({kind:"store",node:this,handle:()=>this.root,name:t.name})}get state(){return Je(this.root)}get proxy(){return Je(this.root)}get accessor(){return(()=>Je(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return Qe(this.state);let t=this.state;for(let r of jt(e)){if(t==null)return;t=t[r]}return Qe(t)}select(e){return g(()=>e(this.state))}subscribe(e){return I(()=>e(this.state))}watch(e,t){let r;return I(()=>{let n=e(this.state);Object.is(n,r)||(t(n,r),r=n)})}reactive(e){return g(()=>this.state[e])}produce(e){this.set((t=>{let r=Pt(t);return e(r),r}))}reconcile(e,t={}){this.set(e)}push(e,...t){let r=ne(this.root,e);this.set(e,r.concat(t))}pop(e){let t=ne(this.root,e).slice(),r=t.pop();return this.set(e,t),r}shift(e){let t=ne(this.root,e).slice(),r=t.shift();return this.set(e,t),r}splice(e,t,r,...n){let i=ne(this.root,e).slice(),o=i.splice(t,r,...n);return this.set(e,i),o}insert(e,t,r){let n=ne(this.root,e).slice();n.splice(t,0,r),this.set(e,n)}removeAt(e,t){let r=ne(this.root,e).slice(),n=r.splice(t,1);return this.set(e,r),n}toObservable(){let[e]=M(this.state);return e.toObservable()}dispose(){}},tl=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","unwrap","toObservable"];function rl(e,t){for(let r of tl)e[r]=t[r].bind(t);e.$=t.reactive.bind(t)}function On(e,t={immutable:!0}){let r=new _n(e,t);return rl(r.set,r),[r.proxy,r.set]}function nl(e,t={}){return new _n(e,{...t,immutable:!1})}function Qe(e){if(e==null||typeof e!="object")return e;let t=e[Ge];return t!==void 0?t:e}function il(e){return R(()=>Qe(e))}var kc=Object.freeze({createStore:On,createMutableStore:nl,batch:re,unwrap:Qe,untrackStore:il});function Nn(e,t){let[r,n]=On(e,t);return new Proxy(r,{get:(i,o)=>o==="set"?n:i[o],has:(i,o)=>o==="set"||Reflect.has(i,o)})}function ol(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function sl(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function ll(e){return e.startsWith("@")?e.slice(1):e.startsWith("on")?e.slice(2).toLowerCase():e}function al(e,t){let r=new Set(["checked","value","selected","disabled","readonly","required","multiple","open","contenteditable","draggable","spellcheck"]),n={input:new Set(["value","checked","indeterminate"]),textarea:new Set(["value"]),select:new Set(["value"]),option:new Set(["selected","value"]),audio:new Set(["volume","currentTime","paused"]),video:new Set(["volume","currentTime","paused"]),img:new Set(["src","srcset"]),iframe:new Set(["src"]),a:new Set(["href"])};return r.has(t)||n[e]&&n[e].has(t)}var ul=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),cl=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","text","tspan","use","defs","symbol","mask","clipPath","pattern","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","foreignObject"]),st="http://www.w3.org/2000/svg";function Fn(e){return e.localName.includes("-")}function Lt(e,t,r,n=!1){if(r==null){e.removeAttribute(t);return}if(Fn(e)){e[t]=r;return}T(e,t,r,n)}var It=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function Wt(e,t=document){return t.querySelector(e)}function fl(e,t=document){return Array.from(t.querySelectorAll(e))}function dl(e,t){return e.closest(t)}function Vn(e,...t){e.classList.add(...t)}function Bn(e,...t){e.classList.remove(...t)}function zn(e,...t){t.forEach(r=>e.classList.toggle(r))}function hl(e,t){return e.classList.contains(t)}function T(e,t,r,n=!1){if(r==null||r===!1){e.removeAttribute(t);return}if(r===!0){e.setAttribute(t,"");return}if(typeof r=="object"){e.setAttribute(t,JSON.stringify(r));return}e.setAttribute(t,String(r))}function Un(e,t){return e.getAttribute(t)}function Jn(e,t){e.removeAttribute(t)}function zt(e,t){Object.assign(e.style,t)}function pl(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function Gn(e,t={},...r){let n=document.createElement(e);return Object.entries(t).forEach(([i,o])=>{if(i==="class"||i==="className")n.className=o;else if(i==="style"&&typeof o=="object")zt(n,o);else if(i.startsWith("on")&&typeof o=="function"){let s=i.slice(2).toLowerCase();n.addEventListener(s,o)}else T(n,i,o)}),r.forEach(i=>{typeof i=="string"?n.appendChild(document.createTextNode(i)):n.appendChild(i)}),n}function Xn(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Kn(e,...t){t.forEach(r=>{typeof r=="string"?e.appendChild(document.createTextNode(r)):e.appendChild(r)})}function ml(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function yl(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function vl(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function gl(e,t,r,n){let i=o=>{let s=o.target.closest(r);s&&e.contains(s)&&n(o,s)};return e.addEventListener(t,i),()=>{e.removeEventListener(t,i)}}function bl(e,t=5e3){return new Promise((r,n)=>{let i=Wt(e);if(i){r(i);return}let o=new MutationObserver(()=>{let l=Wt(e);l&&(o.disconnect(),clearTimeout(s),r(l))});o.observe(document.body,{childList:!0,subtree:!0});let s=setTimeout(()=>{o.disconnect(),n(new Error(`Element ${e} not found within ${t}ms`))},t)})}function wl(e,t,r={}){let n=new IntersectionObserver(i=>{i.forEach(o=>{t(o.isIntersecting)})},r);return n.observe(e),()=>{n.disconnect()}}function kl(e,t){let r=new ResizeObserver(n=>{n.forEach(t)});return r.observe(e),()=>{r.disconnect()}}var xl=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function Sl(e){return typeof e=="object"&&e!==null&&e.$$typeof===xl}function Zn(e){return e&&typeof e=="object"&&e.strings&&Array.isArray(e.strings)&&e.values&&Array.isArray(e.values)}function $l(e){if(typeof e!="function")return!1;try{let t=e();return Zn(t)}catch{return!1}}function Al(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function El(e){return e instanceof Node}function Cl(e,t,r="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[r]>"u"&&(globalThis[r]={}),typeof globalThis[r][e]>"u"&&(globalThis[r][e]=t))}function _l(e,t,r="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[r]<"u"&&typeof globalThis[r][e]<"u"?globalThis[r][e]:t}var Qn="1.0.0-alpha.83",A={dom:Qn,reactive:Jr};function Ol(e){A.core=e}function Yn(e){A.core&&e.setAttribute("fluixi",A.core),e.setAttribute("fx-dom",A.dom),e.setAttribute("fx-reactive",A.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=A)}function ei(){let e=[A.core,A.dom,A.reactive].filter(t=>t!==void 0);new Set(e).size<=1||console.warn(`[fluixi] package versions disagree — core ${A.core??"(absent)"}, dom ${A.dom}, reactive ${A.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function Nl(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function Tl(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Pl(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Ml(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function Rl(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function jl(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function ti(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Dl(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function ri(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function ni(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function ii(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function oi(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function si(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function li(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function j(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function ai(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function ql(e){return ri(e)?{type:"router",value:e}:ii(e)?{type:"route",value:e}:ni(e)?{type:"routes",value:e}:oi(e)?{type:"outlet",value:e}:j(e)?{type:"component",value:e}:ai(e)?{type:"suspense",value:e}:si(e)?{type:"provider",value:e}:li(e)?{type:"context",value:e}:{type:"none",value:e}}var lt=Symbol.for("fluixi.server-node"),Ll=Symbol.for("fluixi.dom.server-host"),Il=globalThis,xe=Il[Ll]??={server:typeof document>"u",nodes:null};function q(){return xe.server}function Se(e){xe.server=e}function Wl(e){xe.nodes=e}function at(){if(!xe.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return xe.nodes}function Oe(e){return e!=null&&e[lt]===!0?!0:typeof Node<"u"&&e instanceof Node}function ui(e){return e!=null&&e[lt]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function ci(e){return e!=null&&e[lt]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var m={active:!1,cursor:null,parents:[]},fi=null;function Hl(e){fi=e}function Ut(){return fi}function Tn(e,t){return m.active&&t.parentNode===e}function di(e){let t=m.parents.lastIndexOf(e);t!==-1&&(m.parents.length=t),m.cursor=e.nextSibling}function Fl(){return m.active?m.cursor:null}function Ht(e,t){if(!e||e.parentNode==null)return t();let r=m.active,n=m.cursor,i=m.parents;m.active=!0,m.cursor=e,m.parents=[];try{return t()}finally{m.active=r,m.cursor=n,m.parents=i}}function Vl(e){if(!m.active)return e();let t=m.cursor,r=m.parents;m.active=!1,m.parents=[];try{return e()}finally{m.active=!0,m.cursor=t,m.parents=r}}function Jt(e){if(!m.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&di(t)}function Bl(e){let t=[];for(;e&&e.nodeType===1;){let r=e.tagName.toLowerCase();if(e.id){r+=`#${e.id}`,t.unshift(r);break}e.getAttribute("data-id")&&(r+=`[data-id="${e.getAttribute("data-id")}"]`);let n=0,i=e;for(;i=i.previousElementSibling;)i.tagName===e.tagName&&n++;r+=`:nth-of-type(${n+1})`,t.unshift(r),e=e.parentElement}return t.join(">")}function zl(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return`el_${Math.abs(t)}`}function Ul(e){return zl(Bl(e))}var Jl=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Gl={},rt="__fx_at",hi="__fx_loc";function Pn(e,t){return t&&(e[hi]=t),e}var Mn=new Map,nt=new Set,ut=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function ct(e){if(!q())for(let t of e)nt.has(t)||ut.has(t)||(nt.add(t),document.addEventListener(t,Xl))}function Xl(e){let t=`$$${e.type}`,r=e.composedPath&&e.composedPath()[0]||e.target;for(;r;){let n=r[t];if(n&&!r.disabled&&(n(e),e.cancelBubble))return;r=r.host&&r.host!==r&&r.host instanceof Element?r.host:r.parentNode}}function Gt(e,t,r){if(e[`$$${t}`]=r,ut.has(t)){let n=`__fx_${t}`;if(!e[n]){let i=o=>{e[`$$${t}`]?.(o)};e.addEventListener(t,i),e[n]=i}return}nt.has(t)||ct([t])}function it(e,t){delete e[`$$${t}`];let r=`__fx_${t}`,n=e[r];n&&(e.removeEventListener(t,n),delete e[r])}function Kl(e){return!ut.has(e)}function Zl(e){return typeof e=="function"}function U(e,t=!1){if(q())return at().createText(e);if(m.active&&!t){let r=Ut()?.hydrateText(e);if(r)return r}return document.createTextNode(e)}function Xt(e,t=!1,r){if(q())return at().createElement(e,t);if(m.active){let n=Ut()?.hydrateElement(e);if(n)return r?Pn(n,r):n}return Pn(t?document.createElementNS(st,e):document.createElement(e),r)}function Kt(e,t=!1){let r=Mn.get(e);if(r)return r;let n=document.createElement("template");return t?n.innerHTML=`<svg>${e}</svg>`:n.innerHTML=e,Mn.set(e,n),n}function pi(e,t,r=!1,n=!1,i){if(q()){let o=at();return r?o.parseTemplate(e,n):o.createRaw(e)}if(m.active){let o=Ut()?.hydrateStatic(t);if(o)return Rn(o,i)}return Rn(Zt(Kt(e,n),n).firstChild,i)}function Rn(e,t){let r=e;if(!t||typeof r?.querySelectorAll!="function")return e;let n=[r,...r.querySelectorAll("*")];for(let i=0;i<n.length&&i*2+1<t.pos.length;i++){let o=t.pos[i*2];o&&(n[i][hi]={file:t.file,line:o,column:t.pos[i*2+1]})}return e}function mi(e,t){if(!m.active)return t();let r=Ht(e.nextSibling,t);if(typeof r=="function"){let n=r;return Ql(n,(...i)=>m.active?Ht(e.nextSibling,()=>n(...i)):n(...i))}return r}function Ql(e,t){let r=e[rt];return r!==void 0&&(t[rt]=r),t}function yi(e){for(let t=e.nextSibling;t;t=t.nextSibling)if(t.nodeType===8&&t.data==="fx/")return t;throw new Error("[fluixi] template hole is missing its closing marker")}function vi(e,t){let r=[];for(let n=e.nextSibling;n&&n!==t;n=n.nextSibling)r.push(n);return r}function Zt(e,t=!1){let r=e.content.cloneNode(!0);return t?r.firstChild:r}function gi(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?gi(e[0]):(e[0],e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function Yl(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function ea(e){if(x(e)||j(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!x(t)&&!j(t);)t=t();return t}var V=0,ta=200;function ra(e,t,r,n,i){let o=n,s=new Map;return w(()=>{O(r??t,"content",void 0,e);let l;if(j(e)&&!x(e)){if(!s.has(e)){V++;try{let a=e();s.set(e,a)}finally{V--}}for(l=s.get(e);typeof l=="function"&&x(l);)l=l()}else for(l=e();typeof l=="function"&&x(l);)l=l();{let a=0;for(;typeof l=="function"&&a++<50;)if(j(l)){if(!s.has(l)){let u=l;V++;try{let f=u();s.set(u,f)}finally{V--}}l=s.get(l)}else if(x(l))l=l();else if(l=l(),typeof l!="function"||!x(l)&&!j(l))break}V++;try{o=$e(t,l,r,o,s),i(o)}finally{V--}})}function D(e,t,r,n){if(V>ta)return console.error("[insert] Exceeded max call depth — possible infinite loop."),()=>null;r!==void 0&&!r&&(r=U("",!0),e.appendChild(r));let i=n??null,o=a=>Array.isArray(a)&&a.some(u=>typeof u=="function"),s=a=>typeof a=="function"?a:()=>a;if(typeof t!="function"&&!o(t)){V++;try{i=$e(e,t,r,i)}finally{V--}return()=>i}let l=ra(s(t),e,r,i,a=>{i=a});return()=>(l?.(),i)}function $e(e,t,r,n,i){if(t==null||typeof t=="boolean")return z(e,n,r);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return z(e,n,r);if(ke(t)){let s=U("",!0);return Array.isArray(n)?n.length>0?(e.replaceChild(s,n[0]),z(e,n.slice(1),r)):$(e,s,r):n?e.replaceChild(s,n):$(e,s,r),t.then(l=>{s.parentNode===e&&$e(e,l,s.nextSibling,s)}).catch(l=>{console.error("Error resolving promise in insertExpression:",l)}),s}let o=typeof t;if(o==="string"||o==="number"){if(o==="number"&&(t=String(t)),Array.isArray(n)){if(n.length===0){let l=U(t);return $(e,l,r),l}if(n.length===1&&n[0].nodeType===3)return n[0].data=t,n;n=z(e,n,r)}if(n&&ci(n))return n.data=t,n;let s=U(t);return n&&n.parentNode===e?e.replaceChild(s,n):Tn(e,s)||$(e,s,r),s}if(Oe(t))return Tn(e,t)?(di(t),t):Array.isArray(n)?(n.length===0?$(e,t,r):n[0].parentNode===e?(e.replaceChild(t,n[0]),z(e,n.slice(1),r)):$(e,t,r),t):(n?n!==t&&(n.parentNode===e?e.replaceChild(t,n):$(e,t,r)):$(e,t,r),t);if(Array.isArray(t)){let s=[],l=Array.isArray(n)?n:n?[n]:[],a=[];F(t,s,e,r,!0,i,a);let u=na(e,l,s,r);for(let f of a){let c=D(e,f.sig,f.marker);k(()=>{z(e,c()),f.marker.parentNode===e&&e.removeChild(f.marker)})}return u}if(o==="object"&&t!==null&&typeof t=="object"){let s=t;if("type"in s&&"props"in s){let l=s;if(typeof l.type=="function"){let a=l.type(l.props||{});return $e(e,a,r,n)}}}return z(e,n,r)}function F(e,t,r,n,i=!0,o,s){for(let l=0;l<e.length;l++){let a=e[l];if(!(a==null||typeof a=="boolean")){for(;typeof a=="function"&&!ke(a)&&!x(a)&&!j(a)&&(a=a(),!(a==null||typeof a=="boolean")););if(!(a==null||typeof a=="boolean")){if(typeof a=="function"){let u;for(j(a)&&!x(a)?(o||(o=new Map),o.has(a)||o.set(a,a()),u=o.get(a)):u=a();typeof u=="function"&&!ke(u)&&!x(u)&&!j(u);)o||(o=new Map),o.has(u)||o.set(u,u()),u=o.get(u);if(u==null||typeof u=="boolean")continue;if(typeof u=="function"){if(x(u)){if(s){let c=U("",!0);t.push(c),s.push({marker:c,sig:u});continue}let f=u();for(;typeof f=="function"&&x(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?F(f,t,r,n,i,o):F([f],t,r,n,i,o);continue}continue}Array.isArray(u)?F(u,t,r,n,i,o,s):F([u],t,r,n,i,o,s);continue}if(ke(a)){let u=U("",!0);t.push(u),a.then(f=>{if(u.parentNode){let c=[];if(F([f],c,u.parentNode,void 0,!1,o),c.length>0){u.parentNode.replaceChild(c[0],u);for(let h=1;h<c.length;h++)u.parentNode?.insertBefore(c[h],c[h-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(a)){F(a,t,r,n,i,o,s);continue}if(Oe(a)){t.push(a);continue}if(typeof a=="object"&&a!==null&&"type"in a&&"props"in a){let u=a;if(typeof u.type=="function"){let f=u.type(u.props||{});Array.isArray(f)?F(f,t,r,n,!1,o):F([f],t,r,n,!1,o);continue}}if(typeof a=="string"||typeof a=="number"){let u=String(a);if(u.trim()===""&&u!==" ")continue;t.push(U(u));continue}t.push(U(String(a)))}}}}function na(e,t,r,n){for(let c=0;c<r.length;c++){let h=r[c].parentNode;h!==null&&h!==e&&h.nodeType!==11&&(r=r.slice(),r[c]=r[c].cloneNode(!0))}let i=r.length,o=t.length,s=i,l=0,a=0,u=o>0?t[o-1].nextSibling??void 0:n,f=null;for(;l<o||a<s;){if(t[l]===r[a]){l++,a++;continue}for(;o>l&&s>a&&t[o-1]===r[s-1];)o--,s--;if(o===l){let c=s<i?a?r[a-1].nextSibling??void 0:r[s-a]:u;for(;a<s;)$(e,r[a++],c)}else if(s===a)for(;l<o;)(!f||!f.has(t[l]))&&t[l].parentNode===e&&e.removeChild(t[l]),l++;else if(t[l]===r[s-1]&&r[a]===t[o-1]){let c=t[--o].nextSibling;$(e,r[a++],t[l++].nextSibling),$(e,r[--s],c),t[o]=t[l-1]}else{if(!f){f=new Map;let h=a;for(;h<s;)f.set(r[h],h++)}let c=f.get(t[l]);if(c!=null)if(a<c&&c<s){let h=l,y=1;for(;++h<o&&h<s&&!(!f.has(t[h])||f.get(t[h])!==c+y);)y++;if(y>c-a){let b=t[l];for(;a<c;)$(e,r[a++],b)}else t[l].parentNode===e?e.replaceChild(r[a++],t[l++]):($(e,r[a++],u),l++)}else l++;else t[l].parentNode===e&&e.removeChild(t[l]),l++}}return r}function z(e,t,r){if(t)if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n].parentNode===e&&e.removeChild(t[n]);else t.parentNode===e&&e.removeChild(t);return null}function $(e,t,r){m.active&&t.parentNode===e||(r&&r.parentNode===e?e.insertBefore(t,r):e.appendChild(t))}function ue(e,t,r){r==null?delete e[t]:e[t]=r}function Qt(e,t,r){let n=r,i;return Array.isArray(r)&&(n=r[0],i=r[1]),typeof n!="function"?()=>{}:(e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i))}function bi(e,t){if(!t||typeof t!="function")return;let r=t[rt]?.name;if(!r)return;let n=r.indexOf(":");n!==-1&&N(e,r.slice(0,n),r.slice(n+1),t)}function ot(e,t,r){let n=typeof r=="function"?R(()=>r()):r;if(!(!n||typeof n!="object"))for(let i of Object.keys(n))N(e,t,i)}function Yt(e,t){let r=(n,i)=>{typeof n=="function"&&(N(e,"use",n.name||"use",i),n(e,i??(()=>{})))};if(typeof t=="function"){r(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){r(t[0],t[1]);return}for(let n of t)Array.isArray(n)?r(n[0],n[1]):r(n)}}function Ae(e,t,r,n=!1){return bi(e,r),typeof r!="function"?(T(e,t,r,n),()=>{}):w(()=>{O(e,"attribute",t,r);let i=typeof r=="function"?r():r;T(e,t,i,n)})}function Ee(e,t,r){return typeof r!="function"?(ue(e,t,r),()=>{}):(bi(e,r),w(()=>{O(e,"property",t,r);let n=typeof r=="function"?r():r;ue(e,t,n)}))}function er(e,t,r){return typeof r!="function"?(T(e,t,!!r),()=>{}):w(()=>{O(e,"attribute",t,r);let n=r();T(e,t,!!n)})}function ce(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){w(()=>{O(e,"attribute","class",t),ce(e,t())});return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let r=Object.keys(t).filter(n=>{let i=t[n];return typeof i=="function"?i():!!i}).join(" ");e.setAttribute("class",r);return}e.setAttribute("class",String(t))}function Ce(e,t,r){if(!(!t||typeof t!="object"))for(let n in t){let i=t[n],o=n.split(/\s+/).filter(Boolean);if(typeof i=="function"&&r)r.push(w(()=>{let s=!!i();for(let l of o)e.classList.toggle(l,s)}));else{let s=!!(typeof i=="function"?i():i);for(let l of o)e.classList.toggle(l,s)}}}function _e(e,t){let r=t;for(;typeof r=="function";)r=r();if(r==null){e.removeAttribute("style");return}if(typeof r=="string"){e.style.cssText=r;return}if(typeof r=="object")for(let n in r){let i=r[n];i==null?e.style[n]="":e.style[n]=i}}function wi(e){let{element:t,props:r,prevProps:n=Gl,isSVG:i=!1,skipChildren:o=!1}=e;if(!t||!ui(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!r)return console.warn("[spread] Warning: props is undefined!"),()=>{};let s=i||t.namespaceURI===st,l=[];for(let a in r){if(o&&a==="children")continue;let u=r[a],f=n[a];if(u===f)continue;if(a==="ref"){Ne(u,t);continue}if(a==="use"){Yt(t,u);continue}if(a.startsWith("on:")){l.push(Qt(t,a.slice(3),u));continue}if(a.startsWith("prop:")){N(t,"prop",a.slice(5),u),l.push(Ee(t,a.slice(5),u));continue}if(a.startsWith("attr:")){N(t,"attr",a.slice(5),u),l.push(Ae(t,a.slice(5),u,s));continue}if(a.startsWith("bool:")){N(t,"bool",a.slice(5),u),l.push(er(t,a.slice(5),u));continue}if(a==="class"||a==="className"){typeof u=="function"?l.push(w(()=>{O(t,"attribute","class",u),ce(t,u())})):ce(t,u);continue}if(a==="classList"){ot(t,"class",u),typeof u=="function"?l.push(w(()=>{O(t,"attribute","class",u),Ce(t,u())})):Ce(t,u,l);continue}if(a==="style"){ot(t,"style",u),typeof u=="function"?l.push(w(()=>{O(t,"attribute","style",u),_e(t,u())})):_e(t,u);continue}if(a.startsWith("on")){let h=a.slice(2).toLowerCase();f&&it(t,h),u&&Gt(t,h,u);continue}let c=It.has(a)||!s&&a in t;typeof u=="function"?l.push(c?Ee(t,a,u):Ae(t,a,u,s)):l.push(w(()=>c?ue(t,a,r[a]):T(t,a,r[a],s)))}for(let a in n)if(!(a in r))if(a.startsWith("on")){let u=a.slice(2).toLowerCase();it(t,u)}else It.has(a)?ue(t,a,null):t.removeAttribute(a);return()=>{l.forEach(a=>a())}}function tr(e,t,r=!1){for(let n in t){let i=t[n];if(n==="ref"){Ne(i,e);continue}if(n!=="children"){if(n==="use"){Yt(e,i);continue}if(n.startsWith("on:")){Qt(e,n.slice(3),i);continue}if(n.startsWith("prop:")){N(e,"prop",n.slice(5),i),Ee(e,n.slice(5),i);continue}if(n.startsWith("attr:")){N(e,"attr",n.slice(5),i),Ae(e,n.slice(5),i,r);continue}if(n.startsWith("bool:")){N(e,"bool",n.slice(5),i),er(e,n.slice(5),i);continue}if(n.startsWith("on")&&n.length>2){let o=n.slice(2).toLowerCase();if(typeof i=="function")if(ut.has(o)){e[`$$${o}`]=i;let s=`__fx_${o}`;if(!e[s]){let l=a=>{e[`$$${o}`]?.(a)};e.addEventListener(o,l),e[s]=l}}else e[`$$${o}`]=i,nt.has(o)||ct([o]);continue}if(n==="class"||n==="className"){ce(e,i);continue}if(n==="classList"){ot(e,"class",i),typeof i=="function"?w(()=>{O(e,"attribute","class",i),Ce(e,i())}):Ce(e,i);continue}if(n==="style"){ot(e,"style",i),typeof i=="function"?w(()=>{O(e,"attribute","style",i),_e(e,i())}):_e(e,i);continue}if(n==="innerHTML"){if(typeof i=="function"){let o=I(()=>{let s=i();for(;typeof s=="function";)s=s();e.innerHTML=s});k(()=>o())}else e.innerHTML=i;continue}if(n==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let o=I(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.value=s??"")});k(()=>{o()})}else w(()=>{document.activeElement!==e&&(e.value=t[n]??"")});continue}if(n==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let o=I(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.checked=s??"")});k(()=>{o()})}else w(()=>{document.activeElement!==e&&(e.checked=t[n]??"")});continue}if(n==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let o=!0,s=I(()=>{let l=i();for(;typeof l=="function"&&l.length===0;)l=l();o?(o=!1,queueMicrotask(()=>{e.value=l??""})):e.value=l??""});k(()=>{s()})}else{let o=!0;w(()=>{let s=t[n];o?(o=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""})}continue}if(typeof i=="function"){let o=I(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();Lt(e,n,s,r)});k(()=>{o()})}else w(()=>Lt(e,n,t[n],r))}}}function ki(...e){let t=n=>{for(let i=e.length-1;i>=0;i--){let o=e[i];if(o&&n in o&&o[n]!==void 0)return o[n]}},r=n=>{for(let i of e)if(i&&n in i)return!0;return!1};return new Proxy({},{get:(n,i)=>t(i),has:(n,i)=>r(i),ownKeys:()=>{let n=new Set;for(let i of e)if(i)for(let o of Reflect.ownKeys(i))n.add(o);return[...n]},getOwnPropertyDescriptor:(n,i)=>r(i)?{enumerable:!0,configurable:!0,get:()=>t(i)}:void 0})}function ia(e,...t){let r=new Set;for(let s of t)for(let l of s)r.add(l);let n=s=>({enumerable:!0,configurable:!0,get:()=>e[s]}),i=t.map(s=>{let l=new Set(s);return new Proxy({},{get:(a,u)=>l.has(u)?e[u]:void 0,has:(a,u)=>l.has(u)&&u in e,ownKeys:()=>Array.from(l).filter(a=>a in e),getOwnPropertyDescriptor:(a,u)=>l.has(u)&&u in e?n(u):void 0})}),o=new Proxy({},{get:(s,l)=>r.has(l)?void 0:e[l],has:(s,l)=>!r.has(l)&&l in e,ownKeys:()=>Reflect.ownKeys(e).filter(s=>!r.has(s)),getOwnPropertyDescriptor:(s,l)=>!r.has(l)&&l in e?n(l):void 0});return[...i,o]}function Ne(e,t){if(!e)return;let r=e[rt]?.name;if(N(t,"ref",r||typeof e=="function"&&e.name||"ref",e),Oe(e)){let n=t,i=e;if(!n)return;typeof n=="function"?n(i):typeof n=="object"&&"current"in n&&(n.current=i);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}function xi(e,t,r){let n=t||document.body,i=ze(()=>e),o=[];return re(()=>{let s=w(()=>{let l=i();Array.isArray(l)?(l.forEach(a=>n.appendChild(a)),o.push(()=>{l.forEach(a=>{a.parentNode===n&&n.removeChild(a)})})):Oe(l)&&(n.appendChild(l),o.push(()=>{l.parentNode===n&&n.removeChild(l)}))});o.push(s),k(()=>{o.forEach(l=>l())})}),null}function oa(e){return typeof e=="string"&&e.toLowerCase()===e}function Si(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function sa(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function ke(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function la(e){return typeof e=="function"&&e.length===0&&x(e)}function Te(e,t,r){if(!t)throw new Error("Container element is required");let n,i,o=[];return P(s=>{re(()=>{m.active||(t.textContent=""),Yn(t),ei(),D(t,e)}),i=s}),()=>{i?.(),n?.(),o.forEach(s=>s()),t.textContent=""}}function $i(e){if(Array.isArray(e))return e;if(typeof e=="function"&&typeof e.set=="function")return[e,e.set];throw new TypeError("[fluixi] bind: needs a signal — either `signal(…)` or the `[get, set]` pair from `createSignal(…)`.")}var aa="__fx_dom_create_component__",Z=globalThis[aa]??={fn:null};function ua(e){Z.fn=e}function ca(e={}){let t=e.signalSystem?.createComponent;t&&(Z.fn=t)}function rr(e,t){if(Z.fn)return Z.fn(e,t);t&&fn(t);let r=typeof e=="function"?se(()=>e(t)):e,n=r!=null&&(typeof r=="function"||typeof r=="object");if(n)try{r.$name=e?.name}catch{}return n&&!wn(r)?ti(r):r}var fa=()=>Z.fn!==null,Ai=()=>Z.fn!==null;function Ei(){Z.fn=null}var tt,Ci={getStore:()=>tt,run(e,t){let r=tt;tt=e;try{return t()}finally{tt=r}}},nr=Ci;function da(e){nr=e??Ci}function ir(e={}){e.locals||(e.locals=e.request?Oi(e.request):{});let t=0,r=0,n=null,i=new Map,o=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${t++}`,nextResourceId:()=>{if(n===null)return`r${r++}`;let s=i.get(n)??0;return i.set(n,s+1),`${n}:r${s}`},nextIslandNamespace:s=>{let l=o.get(s)??0;return o.set(s,l+1),`${s}#${l}`},withResourceScope(s,l){let a=n;n=s;try{return l()}finally{n=a}},pending:new Set,data:new Map}}function or(e,t){return nr.run(e,t)}function ae(){return nr.getStore()}function _i(){return ae()?.event}function ha(){let e=_i();return e?(e.locals||(e.locals={}),e.locals):{}}var jn=new WeakMap;function Oi(e){let t=jn.get(e);return t||(t={},jn.set(e,t)),t}var sr="__FX_DATA__";function Ni(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var Dt;function Ti(){let e=globalThis.__FX_DATA__;if(e)return e;if(Dt!==void 0)return Dt;let t=null;if(typeof document<"u"){let r=document.getElementById(sr)?.textContent;if(r)try{t=JSON.parse(r)}catch{t=null}}return Dt=t}function ft(){for(;;){for(;m.cursor&&m.cursor.nodeType===3&&m.cursor.data==="";)m.cursor=m.cursor.nextSibling;if(m.cursor!=null||!m.parents.length)return;m.cursor=m.parents.pop().nextSibling}}var pa=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),dt=typeof process<"u"&&process.env&&!1;function ht(e,t){let r=t.nodeType===1?`<${t.tagName.toLowerCase()}>`:t.nodeType===3?`text ${JSON.stringify((t.nodeValue??"").slice(0,24))}`:t.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${e} but the server DOM has ${r}. Server and client rendered different markup; recreating this node on the client. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function ma(e){ft();let t=m.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(pa.has(e.toLowerCase())?m.cursor=t.nextSibling:(m.parents.push(t),m.cursor=t.firstChild),t):(dt&&t&&ht(`<${e}>`,t),null)}function ya(e){ft();let t=m.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(m.cursor=t.nextSibling,t):(dt&&t&&ht(`<${e}> (static)`,t),null)}function va(e){if(e===""){let r=m.cursor;return r&&r.nodeType===3&&r.data!==""?(m.cursor=r.nextSibling,r.data="",r):null}ft();let t=m.cursor;return t&&t.nodeType===3?(m.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(dt&&t&&ht(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function ga(e){ft();let t=m.cursor;return t&&t.nodeType===8&&t.data===e?(m.cursor=t.nextSibling,t):(dt&&t&&ht(`marker <!--${e.slice(0,24)}-->`,t),null)}var Dn=!1;function ba(){Dn||(Dn=!0,Hl({hydrateElement:ma,hydrateText:va,hydrateMarker:ga,hydrateStatic:ya}))}function Pe(e,t,r){ba(),m.active=!0,m.cursor=t.firstChild,m.parents=[];let n=Ti(),i=r?.resourceNamespace,o=0;Be(()=>i?`${i}:r${o++}`:`r${o++}`),zr(n?s=>s in n?{value:n[s]}:void 0:null);try{return Te(e,t)}finally{m.active=!1,m.cursor=null,m.parents=[]}}var lr="fluixi-island";function wa(e){let{component:t,props:r={},name:n}=e,i=Xt(lr),o=n??t.name??"Island";T(i,"name",o),T(i,"props",JSON.stringify(r??{}));let s=q()?ae():void 0;if(s){let l=s.nextIslandNamespace(o);D(i,()=>s.withResourceScope(l,()=>t(r)))}else D(i,()=>t(r));return i}var qn=!1;function ka(){if(qn||typeof document>"u")return;qn=!0;let e=document.createElement("style");e.textContent=`${lr}{display:contents}`,document.head.appendChild(e)}function xa(e){if(typeof document>"u")return;ka();let t=document.querySelectorAll(lr),r=new Map;t.forEach(n=>{let i=n.getAttribute("name")??"",o=r.get(i)??0;r.set(i,o+1);let s=e[i];if(!s){typeof process>"u"&&console.warn(`[fluixi] island "${i}" has no component in the registry — left static.`);return}let l={};try{l=JSON.parse(n.getAttribute("props")||"{}")}catch{}Pe(()=>s(l),n,{resourceNamespace:`${i}#${o}`})})}function Sa(e,...t){throw new Error("html`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}function $a(e,...t){throw new Error("svg`` was not compiled — enable the lit format: fluixi({ format: 'lit' }).")}function Aa(e,t={}){if(typeof e=="function")return rr(e,t);if(typeof e!="string"||e.length===0)return null;let r=Si(e);if(q())return at().createElement(e,r);let n=r?document.createElementNS(st,e):document.createElement(e);return tr(n,t,r),Ea(n,t),n}function Ea(e,t){if(!t||t.children===void 0)return;let r=ze(()=>t.children),n=i=>{D(e,i,typeof i=="function"?null:void 0)};Array.isArray(r)?r.forEach(n):n(r)}function Ca(e){return typeof e=="function"?e:(()=>e)}function pt(e){return()=>{let t=e();return typeof t=="function"?t():t}}function _a(e){return e!=null&&e!==!1}function Oa(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function ar(e){let t=pt(()=>e.when),r=g(t,void 0,{name:"Show.when"}),n=g(r,void 0,{name:"Show.cond"}),i=L(),o=null,s=null,l=a=>{a!==s&&(o&&te(o),o=ee(i),s=a)};return g(()=>{let a=n();return l(a?"when":"fallback"),_(o,()=>{if(a){let u=e.children;return typeof u=="function"&&!Oa(u)?typeof r=="function"?R(()=>R(r)?u(r()):e.fallback):u(r):u}return e.fallback})},void 0,{name:"Show.result"})}function ur(e){let t=pt(()=>e.each),r=()=>e.fallback??null,n=(i,o)=>{let s=e.children,l=Array.isArray(s)?s.map(a=>typeof a=="function"?a(i,o):a):typeof s=="function"?s(i,o):s;return Jt(l),l};return e.by?Fe(t,e.by,(i,o)=>n(i,o),{fallback:r}):He(t,(i,o)=>n(i,o),{fallback:r})}function cr(e){let t=pt(()=>e.each);return Ve(t,(r,n)=>{let i=e.children(r,n);return Jt(i),i},{fallback:()=>e.fallback??null})}var Ft=Symbol("match");function fr(e){return{[Ft]:!0,when:pt(()=>e.when),get children(){return e.children}}}function dr(e){let t=Array.isArray(e.children)?e.children:[e.children],r=L(),n=null,i=-1,o=s=>{s!==i&&(n&&te(n),n=ee(r),i=s)};return g(()=>{for(let s=0;s<t.length;s+=1){let l=t[s],a=0;for(;typeof l=="function"&&!l[Ft]&&a++<10;)l=l();if(!l||typeof l!="object"||l[Ft]!==!0)continue;let u=l.when();if(_a(u))return o(s),_(n,()=>typeof l.children=="function"?l.children(u):l.children)}return o(-2),_(n,()=>e.fallback??null)},void 0,{name:"Switch"})}function hr(e){let t=Ca(e.component),{component:r,...n}=e,i=L(),o=null,s;return g(()=>{let l=t();return l!==s&&(o&&te(o),o=ee(i),s=l),l==null?null:typeof l=="string"?{tag:l,props:n}:_(o,()=>l(n))},void 0,{name:"Dynamic"})}function pr(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,r,n;return P(i=>{r=i,n=document.createElement("div"),n.style.display="contents",t().appendChild(n),D(n,e.children)&&Ne(e.ref,n)}),k(()=>{r(),n.remove()}),null}function Pi(e){if(q())return e.fallback??null;let t=m.active,[r,n]=M(!t);return t&&queueMicrotask(()=>n(!0)),g(()=>r()?e.children:e.fallback??null,void 0,{name:"client-only"})}var Na=Pi;function mr(e){let[t,r]=M(null),n=()=>r(null);return g(()=>{let i=t();if(i!==null)return typeof e.fallback=="function"?e.fallback(i,n):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(o){return r(o),typeof e.fallback=="function"?e.fallback(o,n):e.fallback}},void 0,{name:"ErrorBoundary"})}function Ta(e){return g(()=>{let t=typeof e=="function"?e():e,r=[];for(let[n,i]of Object.entries(t))n&&(typeof i=="function"?i():i)&&r.push(n);return r.join(" ")},void 0,{name:"ClassMap"})}function Pa(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Ma(e){return g(()=>{let t=typeof e=="function"?e():e,r=[];for(let[n,i]of Object.entries(t)){if(!n)continue;let o=typeof i=="function"?i():i;o!=null&&r.push(`${Pa(n)}: ${o}`)}return r.join("; ")},void 0,{name:"StyleMap"})}var yr=1,Mi=3,Ri=8,ji;ji=lt;var mt=class{constructor(){this[ji]=!0,this.parentNode=null,this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let e=this.parentNode;if(!e)return null;let t=e.childNodes.indexOf(this);return t>=0?e.childNodes[t+1]??null:null}get previousSibling(){let e=this.parentNode;if(!e)return null;let t=e.childNodes.indexOf(this);return t>0?e.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes.push(e),e}insertBefore(e,t){if(t==null)return this.appendChild(e);e.parentNode&&e.parentNode.removeChild(e);let r=this.childNodes.indexOf(t);return e.parentNode=this,r<0?this.childNodes.push(e):this.childNodes.splice(r,0,e),e}removeChild(e){let t=this.childNodes.indexOf(e);return t>=0&&this.childNodes.splice(t,1),e.parentNode=null,e}replaceChild(e,t){let r=this.childNodes.indexOf(t);return r>=0&&(e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes[r]=e,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},vr=class Di extends mt{constructor(t){super(),this.nodeType=Mi,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new Di(this.data)}},Ra=class qi extends mt{constructor(t){super(),this.nodeType=yr,this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new qi(this.rawOuterHTML)}},Li=class Ii extends mt{constructor(t){super(),this.nodeType=Ri,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new Ii(this.data)}},ja=class{constructor(){this.cssText=""}setProperty(e,t){this[e]=t}removeProperty(e){delete this[e]}},Da=class{constructor(e){this.el=e}list(){let e=this.el.getAttribute("class");return e?e.split(/\s+/).filter(Boolean):[]}write(e){e.length?this.el.setAttribute("class",e.join(" ")):this.el.removeAttribute("class")}add(...e){let t=this.list();for(let r of e)t.includes(r)||t.push(r);this.write(t)}remove(...e){this.write(this.list().filter(t=>!e.includes(t)))}contains(e){return this.list().includes(e)}toggle(e,t){let r=this.contains(e),n=t===void 0?!r:t;return n?this.add(e):this.remove(e),n}},Vt=class Wi extends mt{constructor(t,r=!1){super(),this.nodeType=yr,this.attributes=new Map,this.style=new ja,this.classList=new Da(this),this.rawHTML=null,this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new vr(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new Wi(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let n of this.childNodes)r.appendChild(n.cloneNode(!0));return r}},qa=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Hi=/&/g,Fi=/</g,Vi=/>/g,La=/"/g;function qt(e){return e.replace(Hi,"&amp;").replace(Fi,"&lt;").replace(Vi,"&gt;")}function Ln(e){return e.replace(Hi,"&amp;").replace(La,"&quot;").replace(Fi,"&lt;").replace(Vi,"&gt;")}function Ia(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Wa(e){if(!e)return"";let t=[];e.cssText&&t.push(e.cssText.trim().replace(/;\s*$/,""));for(let r of Object.keys(e)){if(r==="cssText")continue;let n=e[r];n==null||n===""||t.push(`${Ia(r)}: ${n}`)}return t.join("; ")}function Ha(e){let t="",r=Wa(e.style);for(let[n,i]of e.attributes)n==="style"&&r||(t+=` ${n}="${Ln(i)}"`);if(r){let n=e.attributes.get("style"),i=n?`${n.replace(/;\s*$/,"")}; ${r}`:r;t+=` style="${Ln(i)}"`}return t}function J(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return qt(e);if(typeof e=="number")return qt(String(e));if(typeof e=="function")return J(e());if(Array.isArray(e))return e.map(J).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case Mi:return qt(e.data??"");case Ri:return`<!--${e.data??""}-->`;case yr:{let t=e.localName,r=`<${t}${Ha(e)}>`;if(qa.has(t))return r;let n=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(J).join("");return`${r}${n}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(J).join(""):""}var Fa=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Va={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function In(e){return e.replace(/&(#?\w+);/g,(t,r)=>Va[r]??t)}var H=class extends Error{};function Ba(e,t=!1){let r=0,n=[],i=[],o=u=>{let f=i[i.length-1];f?f.appendChild(u):n.push(u)};for(;r<e.length;){let u=e.indexOf("<",r);if(u===-1){l(e.slice(r));break}if(u>r&&l(e.slice(r,u)),e.startsWith("<!--",u)){let f=e.indexOf("-->",u);if(f===-1)throw new H(`unterminated comment at ${u}`);o(new Li(e.slice(u+4,f))),r=f+3;continue}if(e[u+1]==="/"){let f=e.indexOf(">",u);if(f===-1)throw new H(`unterminated closing tag at ${u}`);let c=e.slice(u+2,f).trim().toLowerCase(),h=i.pop();if(!h||h.localName!==c)throw new H(`</${c}> does not close <${h?.localName??"nothing"}>`);r=f+1;continue}r=a(u)}if(i.length>0)throw new H(`unclosed <${i[i.length-1].localName}>`);let s=n[0];if(n.length!==1||!(s instanceof Vt))throw new H(`expected exactly one root element, got ${n.length}`);return s;function l(u){u!==""&&o(new vr(In(u)))}function a(u){let f=/[\s/>]/.exec(e.slice(u+1));if(!f)throw new H(`unterminated tag at ${u}`);let c=e.slice(u+1,u+1+f.index).toLowerCase(),h=new Vt(c,t),y=u+1+f.index;for(;y<e.length;){for(;y<e.length&&/\s/.test(e[y]);)y++;if(e[y]===">"){y++;break}if(e[y]==="/"&&e[y+1]===">"){y+=2;break}let b=y;for(;y<e.length&&!/[\s=/>]/.test(e[y]);)y++;let v=e.slice(b,y);if(v==="")throw new H(`malformed attribute at ${y}`);if(e[y]==="="){if(e[y+1]!=='"')throw new H(`attribute ${v} must have a double-quoted value`);let E=e.indexOf('"',y+2);if(E===-1)throw new H(`unterminated value for ${v}`);h.setAttribute(v,In(e.slice(y+2,E))),y=E+1}else h.setAttribute(v,"")}return o(h),Fa.has(c)||i.push(h),y}}var Wn=!1;function Bi(){Wn||(Wn=!0,Wl({createElement:(e,t)=>new Vt(e,t),createText:e=>new vr(e),createRaw:e=>new Ra(e),parseTemplate:(e,t)=>Ba(e,t),createComment:e=>new Li(e)}))}function za(e,t={}){let r=q();Bi(),Se(!0);let n=ir(t.event);try{return or(n,()=>P(i=>{try{let o=typeof e=="function"?e():e;return J(o)}finally{i()}}))}finally{Se(r)}}var Hn=!1;function Ua(){Hn||(Hn=!0,Br(e=>{ae()?.pending.add(e)}),Be(()=>ae()?.nextResourceId()??""),Ur((e,t)=>{e&&ae()?.data.set(e,t)}))}var Bt=null;function Ja(e){Bt=e}function zi(e){if(e.data.size===0)return"";let t={};for(let[n,i]of e.data){let o=i;if(Bt)try{o=Bt(i,n)}catch{continue}o!==void 0&&(typeof o=="function"||typeof o=="symbol"||(t[n]=o))}if(Object.keys(t).length===0)return"";let r=Ni(JSON.stringify(t));return r==="{}"?"":`<script type="application/json" id="${sr}">${r}<\/script>`}var Ga=50;async function Xa(e,t={}){let r=q();Bi(),Se(!0),Ua();let n=ir(t.event);try{return await or(n,async()=>{t.preload&&await t.preload(t.event);let i,o=null,s=()=>{};P(f=>{s=f,o=L(),i=typeof e=="function"?e():e});let l=()=>{try{_(o,()=>J(i))}catch{}};l();let a=0;for(;n.pending.size>0&&a++<Ga;){let f=Array.from(n.pending);n.pending.clear(),await Promise.allSettled(f),await Vr(),l()}let u=_(o,()=>J(i))+zi(n);return s(),u})}finally{Se(r)}}var Ka={createComponent:rr,createElement:Gn,createNativeElement:Xt,createTemplate:Kt,cloneTemplate:Zt,templateNode:pi,holeContent:vi,holeEnd:yi,holeScope:mi,createPortal:xi,render:Te,hydrate:Pe,insert:D,appendChildren:Kn,removeChildren:Xn,spread:wi,applyProps:tr,mergeProps:ki,bindPair:$i,setProperty:ue,setDynamicProperty:Ee,setAttribute:T,setDynamicAttribute:Ae,removeAttribute:Jn,getAttribute:Un,setClassName:ce,addClass:Vn,removeClass:Bn,toggleClass:zn,setStyles:zt,delegateEvents:ct,addDelegatedEventListener:Gt,removeDelegatedEventListener:it,handleRef:Ne,resetIntegration:Ei,isIntegrationInitialized:Ai},Za=Ka;function Qa(e){let t=(r,n)=>{r.parent=n;let i=Ya(r);for(let o of i)t(o,r)};return t(e,null),e}function Ya(e){switch(e.kind){case"Root":case"Element":case"Component":case"Fragment":return e.children;default:return[]}}var eu=class{constructor(e){this.pieces=e,this.pi=0,this.oi=0,this.normalize()}normalize(){for(;this.pi<this.pieces.length;){let e=this.pieces[this.pi];if(e.kind==="static"&&this.oi>=e.text.length){this.pi++,this.oi=0;continue}break}}eof(){return this.pi>=this.pieces.length}pos(){if(this.eof()){let t=this.pieces[this.pieces.length-1];return t?t.kind==="static"?t.start+t.text.length:t.end:0}let e=this.pieces[this.pi];return e.kind==="static"?e.start+this.oi:e.start}atHole(){return!this.eof()&&this.pieces[this.pi].kind==="hole"}holeFollows(){if(this.eof())return!1;let e=this.pieces[this.pi];if(e.kind!=="static"||this.oi+1<e.text.length)return!1;let t=this.pieces[this.pi+1];return t!==void 0&&t.kind==="hole"}takeHole(){let e=this.pieces[this.pi];if(e.kind!=="hole")throw new Error("takeHole called off a hole");return this.pi++,this.oi=0,this.normalize(),{index:e.index,loc:{start:e.start,end:e.end}}}peek(e=0){if(this.eof())return"";let t=this.pieces[this.pi];return t.kind!=="static"?"":t.text[this.oi+e]??""}startsWith(e){if(this.eof())return!1;let t=this.pieces[this.pi];return t.kind!=="static"?!1:t.text.startsWith(e,this.oi)}advance(){if(this.eof())return"";let e=this.pieces[this.pi];if(e.kind!=="static")return"";let t=e.text[this.oi++]??"";return this.normalize(),t}readWhile(e){let t="";for(;!this.eof()&&!this.atHole();){let r=this.peek();if(r===""||!e(r))break;t+=r,this.oi++}return this.normalize(),t}skipWhitespace(){this.readWhile(e=>/\s/.test(e))}span(e){return{start:e,end:this.pos()}}},Ui=new Set(["capture","once","passive","prevent","stop","self"]);function G(e,t){return e.value&&e.value.kind==="hole"?e.value.hole:(e.report("invalid-binding",`${t} requires an expression value: ${e.name}=\${…}`),-1)}var Gi=(e,t)=>({kind:"Attribute",name:t?e.name.slice(1):e.name,value:e.value,boolean:t,loc:e.loc}),Xi=[{id:"event",match:e=>e[0]==="@"||e.startsWith("on:")||/^on[A-Z]/.test(e),build:e=>{let t,r;e.name[0]==="@"?(t="at",r=e.name.slice(1)):e.name.startsWith("on:")?(t="colon",r=e.name.slice(3)):(t="on",r=e.name.slice(2));let[n,...i]=r.split("."),o=n.toLowerCase();for(let s of i)Ui.has(s)||e.report("invalid-directive",`Unknown event modifier ".${s}" — expected one of ${[...Ui].join(", ")}`);return{kind:"EventBinding",name:o,syntax:t,modifiers:i,hole:G(e,"event binding"),loc:e.loc}}},{id:"bind",elementOnly:!0,match:e=>e.startsWith("bind:"),build:e=>({kind:"BindDirective",name:e.name.slice(5),hole:G(e,"two-way binding"),loc:e.loc})},{id:"class-directive",elementOnly:!0,match:e=>e.startsWith("class:"),build:e=>({kind:"ClassDirective",name:e.name.slice(6),hole:G(e,"class directive"),loc:e.loc})},{id:"style-directive",elementOnly:!0,match:e=>e.startsWith("style:"),build:e=>({kind:"StyleDirective",name:e.name.slice(6),hole:G(e,"style directive"),loc:e.loc})},{id:"load",match:e=>e.startsWith("load:"),build:e=>({kind:"LoadDirective",strategy:e.name.slice(5),modifier:e.value&&e.value.kind==="static"?e.value.value:null,loc:e.loc})},{id:"use",match:e=>e==="use"||e.startsWith("use:"),build:e=>({kind:"UseDirective",name:e.name.startsWith("use:")?e.name.slice(4):null,hole:e.value&&e.value.kind==="hole"?e.value.hole:null,loc:e.loc})},{id:"if",elementOnly:!0,match:e=>e==="if",build:e=>({kind:"IfDirective",hole:G(e,"if directive"),loc:e.loc})},{id:"each",elementOnly:!0,match:e=>e==="each",build:e=>({kind:"EachDirective",hole:G(e,"each directive"),key:null,loc:e.loc})},{id:"else",elementOnly:!0,match:e=>e==="else",build:e=>(e.value!==null&&e.report("invalid-directive","`else` takes no value"),{kind:"ElseDirective",loc:e.loc})},{id:"ref",match:e=>e==="ref",build:e=>({kind:"RefBinding",hole:G(e,"ref binding"),loc:e.loc})},{id:"property",match:e=>e[0]===".",build:e=>({kind:"PropertyBinding",name:e.name.slice(1),hole:G(e,"property binding"),loc:e.loc})},{id:"boolean",match:e=>e[0]==="?",build:e=>Gi(e,!0)}];function tu(e,t=Xi,r={component:!1}){for(let n of t)if(!(n.elementOnly&&r.component)&&n.match(e.name))return n.build(e);return Gi(e,!1)}var ru=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"]),nu=new Set(["script","style","textarea","title"]),iu=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function ou(e){return e.length>0&&(e[0]!==e[0].toLowerCase()||e.includes("."))}var su=new Set(["a","button","input","select","textarea","summary","details","option","label"]),lu=new Set(["keydown","keyup","keypress"]);function fe(e,t){return e.attributes.find(r=>"name"in r&&r.name===t)}function au(e){return e.attributes.some(t=>t.kind==="Spread")}function yt(e,t){let r=fe(e,t);if(!r||r.kind!=="Attribute"||!r.value)return;let n=r.value;return n.kind==="static"?n.value:void 0}function uu(e){let t=yt(e,"role");return t==="presentation"||t==="none"?!0:yt(e,"aria-hidden")==="true"}function Ji(e,t){return e.attributes.some(r=>r.kind==="EventBinding"&&t(r.name))}function cu(e){let t=[],r=(i,o,s)=>{t.push({code:o,message:s,severity:"warning",loc:i.loc})},n=i=>{for(let o of i){o.kind==="Element"&&fu(o,r);let s="children"in o?o.children:void 0;s&&n(s)}};return n(e.children),t}function fu(e,t){if(au(e))return;let r=e.tag.toLowerCase();r==="img"&&!fe(e,"alt")&&!uu(e)&&t(e,"a11y-img-alt",'An `img` needs an `alt`. Use `alt=""` when the image is decorative.'),r==="a"&&!fe(e,"href")&&!fe(e,"role")&&t(e,"a11y-anchor-href","An `a` without `href` is not a link. Use a `button` for an action."),r==="iframe"&&!fe(e,"title")&&t(e,"a11y-iframe-title","An `iframe` needs a `title` describing its content.");let n=yt(e,"tabindex")??yt(e,"tabIndex");n!==void 0&&Number(n)>0&&t(e,"a11y-positive-tabindex","A positive `tabindex` reorders tab navigation for the entire page. Use `0`, or restructure the markup."),!su.has(r)&&Ji(e,i=>i==="click")&&!fe(e,"role")&&!Ji(e,i=>lu.has(i))&&t(e,"a11y-click-without-keyboard",`A click handler on \`${r}\` is unreachable by keyboard. Use a \`button\`, or add a \`role\` and a key handler.`)}var du=/[A-Za-z0-9\-_:@.?]/,hu=class{constructor(e,t){this.diagnostics=[],this.r=new eu(e),this.svg=t.svg??!1,this.directives=t.directives??Xi,this.accessibility=t.accessibility??!0}parse(){let e=this.r.pos(),t=[];for(;!this.r.eof()&&(t.push(...this.parseChildren()),!this.r.eof());){let n=this.r.pos();this.consumeCloseTag(),this.report("stray-close-tag","error","Close tag without a matching open tag",this.r.span(n))}let r={kind:"Root",children:t,loc:this.r.span(e)};return Qa(r),this.validateTree(r),this.accessibility&&this.diagnostics.push(...cu(r)),{root:r,diagnostics:this.diagnostics}}validateTree(e){let t=r=>{let n=null;for(let i of r)i.kind==="Text"&&/^\s*$/.test(i.value)||(i.kind==="Element"||i.kind==="Component"?(i.attributes.some(o=>o.kind==="ElseDirective")&&(n!=null&&(n.kind==="Element"||n.kind==="Component")&&n.attributes.some(o=>o.kind==="IfDirective")||this.report("else-without-if","error","`else` must immediately follow an element with `if`",i.loc)),n=i):n=null,"children"in i&&i.children&&t(i.children))};t(e.children)}parseChildren(){let e=[];for(;!this.r.eof()&&!this.r.startsWith("</");){if(this.r.startsWith("<!--")){e.push(this.parseComment());continue}if(this.isFragmentStart()){e.push(this.parseFragment());continue}if(this.isDynamicTagStart()){e.push(this.parseDynamicComponent());continue}if(this.isTagStart()){e.push(this.parseElement());continue}if(this.r.atHole()){let r=this.r.takeHole(),n={kind:"Expression",hole:r.index,loc:r.loc};e.push(n);continue}let t=this.readText();t&&e.push(t)}return e}isTagStart(){return this.r.peek()==="<"&&/[A-Za-z]/.test(this.r.peek(1))}isFragmentStart(){return this.r.peek()==="<"&&this.r.peek(1)===">"}isDynamicTagStart(){return this.r.peek()==="<"&&this.r.holeFollows()}parseDynamicComponent(){let e=this.r.pos();this.r.advance();let t=this.r.takeHole().index,r=this.parseAttributes(!0);this.r.skipWhitespace();let n=!1,i=[];return this.r.startsWith("/>")?(this.r.advance(),this.r.advance(),n=!0):(this.r.peek()===">"&&this.r.advance(),i=this.parseChildren(),this.r.startsWith("</")?(this.r.advance(),this.r.advance(),this.r.atHole()?this.r.takeHole():this.readName(),this.r.skipWhitespace(),this.r.peek()===">"&&this.r.advance()):this.report("unclosed-tag","error","Unclosed dynamic component",this.r.span(e))),{kind:"Component",tag:"",tagHole:t,attributes:r,children:i,selfClosing:n,loc:this.r.span(e)}}readText(){let e=this.r.pos(),t="";for(;!this.r.eof()&&!this.r.atHole()&&!(this.r.startsWith("</")||this.r.startsWith("<!--")||this.isTagStart()||this.isFragmentStart()||this.isDynamicTagStart());)t+=this.r.advance();return t?{kind:"Text",value:t,raw:!1,loc:this.r.span(e)}:null}parseComment(){let e=this.r.pos();this.r.advance(),this.r.advance(),this.r.advance(),this.r.advance();let t="";for(;!this.r.eof()&&!this.r.startsWith("-->");){if(this.r.atHole()){this.r.takeHole(),t+="\0";continue}t+=this.r.advance()}return this.r.startsWith("-->")?(this.r.advance(),this.r.advance(),this.r.advance()):this.report("unclosed-comment","warning","Unterminated comment",this.r.span(e)),{kind:"Comment",value:t,loc:this.r.span(e)}}parseFragment(){let e=this.r.pos();this.r.advance(),this.r.advance();let t=this.parseChildren();if(this.r.startsWith("</")){let r=this.consumeCloseTag();r&&this.report("mismatched-close-tag","error",`Expected </> to close fragment, got </${r}>`,this.r.span(e))}else this.report("unclosed-tag","error","Unterminated fragment",this.r.span(e));return{kind:"Fragment",children:t,loc:this.r.span(e)}}parseElement(){let e=this.r.pos();this.r.advance();let t=this.readName(),r=ou(t),n=this.parseAttributes(r);this.foldEachKey(n,e),this.r.skipWhitespace();let i=t.toLowerCase(),o=!r&&nu.has(i),s=!r&&iu.has(i),l=!1,a=[];if(this.r.startsWith("/>"))this.r.advance(),this.r.advance(),l=!0;else if(this.r.peek()===">"&&this.r.advance(),!s)if(a=o?this.parseRawText(t):this.parseChildren(),this.r.startsWith("</")){let c=this.consumeCloseTag();c&&c!==t&&this.report("mismatched-close-tag","error",`Expected </${t}>, got </${c}>`,this.r.span(e))}else this.report("unclosed-tag","error",`Unclosed <${t}>`,this.r.span(e));let u=this.r.span(e);if(r)return{kind:"Component",tag:t,tagHole:null,attributes:n,children:a,selfClosing:l,loc:u};let f=this.svg||ru.has(t)?"svg":"html";return{kind:"Element",tag:t,namespace:f,attributes:n,children:a,selfClosing:l,rawText:o,loc:u}}parseRawText(e){let t=[],r="</"+e.toLowerCase(),n="",i=this.r.pos(),o=()=>{n&&t.push({kind:"Text",value:n,raw:!0,loc:this.r.span(i)}),n=""};for(;!this.r.eof()&&!this.startsWithCloseFor(r);){if(this.r.atHole()){o();let s=this.r.takeHole();t.push({kind:"Expression",hole:s.index,loc:s.loc}),i=this.r.pos();continue}n||(i=this.r.pos()),n+=this.r.advance()}return o(),t}startsWithCloseFor(e){let t=0;for(;t<e.length;){let r=this.r.peek(t);if(r===""||r.toLowerCase()!==e[t])return!1;t++}return!0}parseAttributes(e){let t=[];for(;!this.r.eof()&&(this.r.skipWhitespace(),!(this.r.peek()===">"||this.r.startsWith("/>")));){if(this.r.atHole()){let l=this.r.takeHole();t.push({kind:"Spread",hole:l.index,loc:l.loc});continue}if(this.r.startsWith("...")){let l=this.r.pos();if(this.r.advance(),this.r.advance(),this.r.advance(),this.r.atHole()){let a=this.r.takeHole();t.push({kind:"Spread",hole:a.index,loc:this.r.span(l)})}else this.report("invalid-binding","error","Spread `...` must be followed by ${…}",this.r.span(l));continue}let r=this.r.pos(),n=this.readName();if(!n){this.r.advance();continue}let i=this.r.span(r);this.r.skipWhitespace();let o=null;this.r.peek()==="="&&(this.r.advance(),this.r.skipWhitespace(),o=this.parseAttrValue());let s={name:n,nameLoc:i,value:o,loc:this.r.span(r),report:(l,a)=>this.report(l,"error",a,this.r.span(r))};t.push(tu(s,this.directives,{component:e}))}return t}parseAttrValue(){if(this.r.atHole())return{kind:"hole",hole:this.r.takeHole().index};let e=this.r.peek();return e==='"'||e==="'"?this.classifyParts(this.readQuotedParts(e)):{kind:"static",value:this.r.readWhile(t=>!/[\s>]/.test(t))}}readQuotedParts(e){this.r.advance();let t=[],r="";for(;!this.r.eof()&&this.r.peek()!==e;){if(this.r.atHole()){r&&(t.push({text:r}),r=""),t.push({hole:this.r.takeHole().index});continue}let n=this.r.advance();if(n==="")break;r+=n}return r&&t.push({text:r}),this.r.peek()===e&&this.r.advance(),t}classifyParts(e){let t=e.filter(r=>"hole"in r);return t.length===0?{kind:"static",value:e.map(r=>"text"in r?r.text:"").join("")}:e.length===1?{kind:"hole",hole:t[0].hole}:{kind:"mixed",parts:e}}foldEachKey(e,t){let r=null,n=0,i=0,o=0,s=0;for(let f of e)f.kind==="EachDirective"?(r=f,i++):f.kind==="IfDirective"?n++:f.kind==="ElseDirective"?o++:f.kind==="RefBinding"&&s++;let l=this.r.span(t);i>1&&this.report("duplicate-directive","error","Multiple `each` directives on one element",l),n>1&&this.report("duplicate-directive","error","Multiple `if` directives on one element",l),s>1&&this.report("duplicate-directive","error","Multiple `ref` bindings on one element",l),n>0&&i>0&&this.report("unsupported-combination","error","`if` and `each` cannot both apply to one element — wrap one in another element",l),n>0&&o>0&&this.report("invalid-directive","error","`if` and `else` cannot be on the same element",l);let a=e.findIndex(f=>f.kind==="Attribute"&&f.name==="key");if(!r){a!==-1&&this.report("invalid-directive","error","`key` requires an `each` directive on the same element",l);return}if(a===-1)return;let u=e[a];u.kind==="Attribute"&&u.value&&(u.value.kind==="static"?r.key={static:u.value.value}:u.value.kind==="hole"&&(r.key={hole:u.value.hole})),e.splice(a,1)}readName(){return this.r.readWhile(e=>du.test(e))}consumeCloseTag(){this.r.advance(),this.r.advance();let e=this.readName();return this.r.skipWhitespace(),this.r.peek()===">"&&this.r.advance(),e}report(e,t,r,n){this.diagnostics.push({code:e,severity:t,message:r,loc:n})}};function br(e,t={}){return new hu(e,t).parse()}function pu(e){let t=[],r=0;return e.forEach((n,i)=>{t.push({kind:"static",text:n,start:r}),r+=n.length,i<e.length-1&&t.push({kind:"hole",index:i,start:r,end:r})}),t}function Ki(e,t={}){return br(pu(e),t)}function mu(e){switch(e.kind){case"event":return"event";case"ref":return"ref";case"spread":return"spread";case"class":case"style":return"class-or-style-directive";case"attr":case"prop":return e.reactive?"reactive-prop":e.expr!==void 0?"expression-prop":void 0;default:return"expression-prop"}}function yu(e){let t=[],r=new Map,n=i=>{switch(i.kind){case"text":return!0;case"expr":return!1;case"component":case"control":for(let o of i.children)n(o);return!1;case"fragment":for(let o of i.children)n(o);return!1;case"element":{let o=!0;for(let l of i.children)n(l)||(o=!1);let s;for(let l of i.props)if(s=mu(l),s)break;return!s&&!o&&(s=vu(i)),i.static=!s,s?r.set(i,s):t.push(i),i.static}default:return!1}};for(let i of Array.isArray(e)?e:[e])n(i);return{staticElements:t,reasons:r}}function vu(e){for(let t of e.children){if(t.kind==="expr")return"expression-child";if(t.kind==="component")return"component-child";if(t.kind==="control")return"control-child";if(t.kind==="element"&&!t.static||t.kind==="fragment")return"expression-child"}return"expression-child"}var wr={kind:"eager"},gu=["pointerdown","focusin","keydown"],Zi=new Set(["eager","idle","visible","interaction","media","never"]),vt=class extends Error{};function bu(e,t){let r=e.slice(5);if(!Zi.has(r))throw new vt(`Unknown load strategy 'load:${r}'. Expected one of ${[...Zi].join(", ")}.`);switch(r){case"eager":return wr;case"idle":return{kind:"idle"};case"never":return{kind:"never"};case"visible":return t?{kind:"visible",rootMargin:t}:{kind:"visible"};case"interaction":return{kind:"interaction",events:t?wu(t):[...gu]};case"media":if(!t)throw new vt(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new vt(`Unhandled load strategy '${r}'.`)}}function wu(e){let t=e.split(/[\s,]+/).map(r=>r.trim()).filter(Boolean);if(t.length===0)throw new vt("'load:interaction' was given no event names.");return t}function ku(e){return e.kind!=="eager"&&e.kind!=="never"}var kr=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],xr=["Suspense","SuspenseList","Await"],Sr=["Router","Outlet","Redirect","Link"],tf=[...kr,...xr,...Sr],Qi=new Set([...kr,...xr]);function xu(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:r="@fluixi/core",routerModule:n="@fluixi/core/router"}=e,i={};for(let o of kr)i[o]=t;for(let o of xr)i[o]=r;for(let o of Sr)i[o]=n;return i}function Su(e,t={}){let{resolver:r,isBound:n,modules:i,strategyFor:o}=t,s=xu(i),l=new Map,a=new Set,u=c=>{let{name:h}=c;if(!h||h.includes(".")||n?.(h))return;let y=f(h);if(!y){a.add(h);return}let b=y.origin==="builtin"&&Qi.has(h)?wr:o?.(c)??wr;c.source={...y,loading:b},l.set(h,c.source)},f=c=>{if(Qi.has(c))return{module:s[c],export:c,origin:"builtin"};let h=r?.resolve(c);if(h)return{module:h.module,export:h.export,origin:"rule"};if(Sr.includes(c))return{module:s[c],export:c,origin:"builtin"}};return $r(e,c=>{c.kind==="component"&&u(c)}),{resolved:l,unresolved:[...a]}}function $r(e,t){let r=Array.isArray(e)?e:[e];for(let n of r){t(n);let i=n.children;i&&$r(i,t)}}function $u(e){let t=[];$r(e,o=>{o.kind==="component"&&o.source&&t.push(o)});let r=new Set,n=new Set;for(let o of t){let{module:s,loading:l}=o.source;l.kind==="eager"&&r.add(s),l.kind==="never"&&n.add(s)}let i=new Map;for(let o of t){let s=o.source;ku(s.loading)&&r.has(s.module)&&(s.loading={kind:"eager"},i.set(s.module,(i.get(s.module)??0)+1))}return{collapsed:i,conflicted:[...n].filter(o=>r.has(o))}}var Au=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),so={className:"class",htmlFor:"for"},Eu=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),Cu=new Set(["script","style","textarea","title"]);function lo(e){return Cu.has(e)}function _u(e){return so[e]??e}function Ar(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!Eu.has(e.name)}function ao(e){if(!e.static||lo(e.tag))return!1;for(let t of e.props)if(!Ar(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&ao(t)))return!1;return!0}function Er(e){let t=e.props.map(Nu).filter(Boolean).join(""),r=`<${e.tag}${t}>`;return Au.has(e.tag)?r:`${r}${e.children.map(Ou).join("")}</${e.tag}>`}function Ou(e){if(e.kind==="text")return Pu(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return Er(e)}function Nu(e){let t=so[e.name]??e.name,r=e.literal;return r===!0||r===void 0?` ${t}`:r===!1||r===null?"":` ${t}="${Tu(String(r))}"`}function Tu(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pu(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Yi(e){let t=[],r,n=i=>{r??=i.at?.file,t.push(i.at?.line??0,i.at?.column??0);for(let o of i.children)o.kind==="element"&&n(o)};return n(e),r&&t.some(i=>i!==0)?{file:r,pos:t}:void 0}var Mu="<!--fx-->",Ru="<!--fx/-->";function wt(e){return e.kind==="expr"||e.kind==="component"||e.kind==="control"}function ju(e){return e.kind==="text"||e.kind==="element"&&uo(e)}function uo(e){return e.svg||lo(e.tag)||!e.props.every(t=>Ar(t))?!1:e.children.every(t=>ju(t)||wt(t))}function gt(e){if(wt(e))return!0;let t=e.children;return t?t.some(gt):!1}function co(e){for(let t=0;t<e.children.length;t++){let r=e.children[t];if(r.kind==="text"&&(r.value===""||e.children[t+1]?.kind==="text"))return!1}return e.children.every(t=>t.kind!=="element"||co(t))}function Du(e){if(!uo(e)||!co(e)||!e.children.some(gt))return null;let t=[],r=[],n=0,i=s=>{let l=`_n$${n++}`;return t.push({ref:l,expr:s}),l};return o(e,"_el$"),{html:qu(e),tag:e.tag,steps:t,holes:r};function o(s,l){let a=-1;s.children.forEach((f,c)=>{gt(f)&&(a=c)});let u=null;for(let f=0;f<=a;f++){let c=s.children[f],h=u?`${u}.nextSibling`:`${l}.firstChild`;if(wt(c)){let b=i(h),v=i(`holeEnd(${b})`);r.push({parentRef:l,startRef:b,endRef:v,node:c}),u=v;continue}let y=i(h);c.kind==="element"&&gt(c)&&o(c,y),u=y}}}function qu(e){return Er(fo(e)).split(ho).join(Mu+Ru)}function fo(e){return{...e,children:e.children.map(t=>wt(t)?{kind:"text",value:ho}:t.kind==="element"?fo(t):t)}}var ho="\0fx-hole\0",po={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},rf={version:2,module:"@fluixi/dom",symbols:[...po.symbols,"template","cloneTemplate","walk"]},Q="@fluixi/reactive/signal",Lu={$signal:{export:"signal",module:Q,returns:"signal-handle"},$memo:{export:"memo",module:Q,returns:"memo-handle"},$effect:{export:"effect",module:Q,returns:"effect"},$store:{export:"store",module:"@fluixi/reactive/store",returns:"store-handle"},$resource:{export:"resource",module:Q,returns:"resource-handle"},$selector:{export:"createSelector",module:Q,returns:"memo-accessor"},$deferred:{export:"createDeferred",module:Q,returns:"memo-accessor"},$untrack:{export:"untrack",module:Q,returns:"plain"},$untrackStore:{export:"untrackStore",module:"@fluixi/reactive/store",returns:"plain"}},nf=new RegExp(`\\$(?:${Object.keys(Lu).map(e=>e.slice(1)).join("|")})\\s*\\(`),Iu="__fx_source",Wu="__fx_hole",bt=(e,t,r,n)=>`(globalThis.${Wu} ?? ((f) => f))(${e},${t},${r}${n===void 0?"":`,${JSON.stringify(n)}`})`,Hu="__fx_props",Fu=(e,t)=>`(globalThis.${Hu} ?? ((p) => p))(${e},${JSON.stringify(t)})`,Vu={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};function Bu(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function mo(e){return Bu(e)?e:JSON.stringify(e)}function zu(e){if(e.expr!==void 0){if(e.name==="ref"&&e.at)return bt(`(${e.expr})`,e.at.line,e.at.column,e.expr);if(!e.reactive)return`(${e.expr})`;let t=`() => (${e.expr})`;return e.at?bt(t,e.at.line,e.at.column,e.directive):t}return JSON.stringify(e.literal??!0)}function Uu(e){return e.expr!==void 0?`(${e.expr})`:JSON.stringify(e.literal??!0)}function Ju(e,t,r){let n=e.filter(s=>s.kind==="spread"),i=e.filter(s=>s.kind!=="spread").map(s=>`${mo(s.name)}: ${zu(s)}`);t!=null&&i.push(`children: ${t}`);let o=`{ ${i.join(", ")} }`;return n.length>0?(r.add("mergeProps"),`mergeProps(${n.map(s=>s.expr).join(", ")}, ${o})`):o}function eo(e,t){return t?bt(e,t.line,t.column):e}function yo(e,t,r){return e.length===1?Me(e[0],t,r):`[${e.map(n=>Me(n,t,r)).join(", ")}]`}function to(e,t,r,n,i,o){n.add("createMemo"),n.add("createComponent");let s=t.filter(c=>c.kind==="spread"),l=t.filter(c=>c.kind!=="spread"),a=l.map(c=>`get ${mo(c.name)}() { return ${Uu(c)}; }`);r.length>0&&a.push(`get children() { return ${yo(r,n,i)}; }`);let u=`{ ${a.join(", ")} }`;s.length>0&&(n.add("mergeProps"),u=`mergeProps(${s.map(c=>c.expr).join(", ")}, ${u})`);let f={};for(let c of l)c.at&&(f[c.name]=[c.at.line,c.at.column]);return Object.keys(f).length&&(u=Fu(u,f)),`createMemo((${o?`globalThis.${Iu}?.(${JSON.stringify(o.file)},${o.line},${o.column},${JSON.stringify(e)}), `:""}() => createComponent(${e}, ${u})))`}function Gu(e,t){let r=_u(t.name),n=t.literal;return n===!0||n===void 0?`${e}.setAttribute(${JSON.stringify(r)}, "");`:n===!1||n===null?"":`${e}.setAttribute(${JSON.stringify(r)}, ${JSON.stringify(String(n))});`}var vo=!1;function Me(e,t,r){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":{if(!e.reactive)return`(${e.code})`;let n=`() => (${e.code})`;return e.at?bt(n,e.at.line,e.at.column):n}case"fragment":return e.children.length===0?"null":yo(e.children,t,r);case"component":return eo(to(e.name,e.props,e.children,t,r,e.at),e.bindAt??e.at);case"control":{let n=Vu[e.control]??e.control;return t.add(n),eo(to(n,e.props,e.children,t,r),e.bindAt)}case"element":{if(r&&e.static&&!e.svg&&ao(e)){t.add("templateNode");let l=`_tmpl$${r.length}`;r.push({id:l,html:Er(e),tag:e.tag,svg:!1});let a=Yi(e);return a?`templateNode(${l}, ${JSON.stringify(e.tag)}, false, false, ${JSON.stringify(a)})`:`templateNode(${l}, ${JSON.stringify(e.tag)})`}if(r&&vo){let l=Du(e);if(l){t.add("templateNode"),t.add("insert"),t.add("holeEnd"),t.add("holeContent"),t.add("holeScope");let a=`_tmpl$${r.length}`;r.push({id:a,html:l.html,tag:l.tag,svg:!1});let u=Yi(e),f=[`const _el$ = templateNode(${a}, ${JSON.stringify(l.tag)}, true${u?`, false, ${JSON.stringify(u)}`:""});`];for(let c of l.steps)f.push(`const ${c.ref} = ${c.expr};`);for(let c of l.holes)f.push(`insert(${c.parentRef}, holeScope(${c.startRef}, () => (${Me(c.node,t,r)})), ${c.endRef}, holeContent(${c.startRef}, ${c.endRef}));`);return f.push("return _el$;"),`(() => { ${f.join(" ")} })()`}}t.add("createNativeElement");let n=JSON.stringify(e.tag),i="_el$",o=[],s=e.at?`${n}, ${e.svg}, ${JSON.stringify(e.at)}`:e.svg?`${n}, true`:n;if(o.push(`const ${i} = createNativeElement(${s});`),e.props.length>0)if(!e.svg&&e.props.every(Ar))for(let l of e.props)o.push(Gu(i,l));else{t.add("spread");let l=e.svg?", isSVG: true":"";o.push(`spread({ element: ${i}, props: ${Ju(e.props,null,t)}${l} });`)}for(let l of e.children){t.add("insert");let a=Me(l,t,r),u=l.kind==="expr"&&l.reactive||l.kind==="component"||l.kind==="control";o.push(u?`insert(${i}, ${a}, null);`:`insert(${i}, ${a});`)}return o.push(`return ${i};`),`(() => { ${o.join(" ")} })()`}}}function go(e,t){if(!t||t.length===0)return e;let r=new Map(t.map(n=>[n.id,JSON.stringify(n.html)]));return e.replace(/_tmpl\$\d+/g,n=>r.get(n)??n)}var bo={name:"imperative",contract:po,emit(e,t){let r=new Set,n=t?.templateClone!==!1?[]:void 0;return vo=t?.partialTemplates===!0,{code:Me(e,r,n),imports:Array.from(r),templates:n}}},Xu=e=>"components"in e;function ro(e,t){return e.replace(/\$(\d+)/g,(r,n)=>t[Number(n)]??r)}function Ku(e,t){return typeof t=="string"?{module:t,export:e}:t}function Zu(e=[]){let t=new Map,r=[],n=[];for(let o of e){if(!Xu(o)){n.push(o);continue}for(let[s,l]of Object.entries(o.components)){let a=Ku(s,l),u=t.get(s);if(u&&u.module!==a.module){let f=r.find(c=>c.name===s);f?f.modules.push(a.module):r.push({name:s,modules:[u.module,a.module]});continue}t.set(s,a)}}let i=new Map;return{resolve:o=>{if(i.has(o))return i.get(o);let s=t.get(o);if(!s)for(let l of n){let a=o.match(new RegExp(l.match.source,l.match.flags.replace("g","")));if(a){s={module:ro(l.module,a),export:l.export?ro(l.export,a):o};break}}return i.set(o,s),s},names:()=>[...t.keys()],conflicts:()=>r}}function no(e){let t=e.split(/\r\n|\n|\r/),r=0;for(let i=0;i<t.length;i++)/[^ \t]/.test(t[i])&&(r=i);let n="";for(let i=0;i<t.length;i++){let o=t[i].replace(/\t/g," ");i!==0&&(o=o.replace(/^ +/,"")),i!==t.length-1&&(o=o.replace(/ +$/,"")),o&&(i!==r&&(o+=" "),n+=o)}return n}var io=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);function Qu(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function oo(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Yu=class{constructor(e,t,r,n){this.holes=e,this.used=t,this.sourceFile=r,this.positionAt=n}tagAt(e){let t=e.loc?.start;if(!this.sourceFile||!this.positionAt||t==null)return;let{line:r,column:n}=this.positionAt(t);return{file:this.sourceFile,line:r,column:n}}hole(e){return this.holes[e]??{code:"undefined",reactive:!1}}emit(e){let{code:t,imports:r,templates:n}=bo.emit(e,{});for(let i of r)this.used.add(i);return go(t,n)}lowerRoot(e){let t=this.lowerChildren(e);return t.length===1?t[0]:{kind:"fragment",children:t}}lowerChildren(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r];if(n.kind==="Element"||n.kind==="Component"){let o=n.attributes.find(s=>s.kind==="IfDirective");if(o&&o.kind==="IfDirective"){let s=r+1;s<e.length&&this.isBlankText(e[s])&&s++;let l=e[s],a=l&&(l.kind==="Element"||l.kind==="Component")&&l.attributes.some(u=>u.kind==="ElseDirective");t.push(this.lowerIf(n,o.hole,a?l:null)),a&&(r=s);continue}if(n.attributes.some(s=>s.kind==="EachDirective")){t.push(this.lowerEach(n));continue}}let i=this.lowerNode(n);i&&t.push(i)}return t}isBlankText(e){return e.kind==="Text"&&!e.raw&&no(e.value)===""}lowerNode(e){switch(e.kind){case"Text":{if(e.raw)return{kind:"text",value:e.value};let t=no(e.value);return t?{kind:"text",value:t}:null}case"Comment":return null;case"Expression":{let t=this.hole(e.hole);return{kind:"expr",code:t.code,reactive:t.reactive,...t.at?{at:t.at}:{}}}case"Fragment":return{kind:"fragment",children:this.lowerChildren(e.children)};case"Element":return this.lowerElement(e);case"Component":return this.lowerComponent(e);default:return null}}lowerElement(e){let t=e.attributes.find(n=>n.kind==="Attribute"&&n.name==="is");if(e.tag==="component"&&t&&t.value&&t.value.kind==="hole"){let n=e.attributes.filter(o=>o!==t),i=this.lowerComponent({...e,kind:"Component",tag:"Dynamic",tagHole:null,attributes:n});return i.props.unshift({name:"component",kind:"attr",expr:`() => (${this.hole(t.value.hole).code})`}),i}let r=this.tagAt(e);return{kind:"element",tag:e.tag,svg:e.namespace==="svg",props:this.lowerAttributes(e.attributes),children:this.lowerChildren(e.children),static:!1,...r?{at:r}:{}}}lowerComponent(e){let t=e.tagHole!=null?this.hole(e.tagHole).code:e.tag,r=this.lowerAttributes(e.attributes),{slots:n,rest:i}=this.partitionSlots(e.children);for(let[u,f]of n){let c=f.length===1?f[0]:{kind:"fragment",children:f},h={name:u,kind:"attr",expr:this.emit(c),jsxElement:!0},y=r.findIndex(b=>b.name===u);y>=0?r[y]=h:r.push(h)}let o=e.attributes.find(u=>u.kind==="LoadDirective"),s=o?bu(`load:${o.strategy}`,o.modifier):void 0,l=r.find(u=>u.at&&u.reactive)?.at,a=this.tagAt(e);return{kind:"component",name:t,props:r,children:this.lowerChildren(i),...a?{at:a}:{},...l?{bindAt:l}:{},...s?{load:s}:{}}}partitionSlots(e){let t=new Map,r=[];for(let n of e){if(n.kind==="Element"||n.kind==="Component"){let i=n.attributes.find(o=>o.kind==="Attribute"&&o.name==="slot");if(i&&i.value&&i.value.kind==="static"){let o={...n,attributes:n.attributes.filter(a=>a!==i)},s=o.kind==="Element"?this.lowerElement(o):this.lowerComponent(o),l=t.get(i.value.value)??[];l.push(s),t.set(i.value.value,l);continue}}r.push(n)}return{slots:t,rest:r}}lowerIf(e,t,r){let n=this.hole(t),i=[{name:"when",kind:"attr",expr:n.code,reactive:n.reactive,...n.at?{at:n.at}:{}}];if(r){let l=this.stripAndLower(r,a=>a.kind==="ElseDirective");i.push({name:"fallback",kind:"attr",expr:this.emit(l),jsxElement:!0})}let o=this.stripAndLower(e,l=>l.kind==="IfDirective"),s=this.tagAt(e);return{kind:"component",name:"Show",props:i,children:[o],...s?{at:s}:{},...n.at?{bindAt:n.at}:{}}}lowerEach(e){let t=e.attributes.find(a=>a.kind==="EachDirective");if(!t||t.kind!=="EachDirective")return this.lowerNode(e);let r=this.hole(t.hole),n=[{name:"each",kind:"attr",expr:r.code,reactive:r.reactive,...r.at?{at:r.at}:{}}];if(t.key){let a="static"in t.key?`(item) => item[${JSON.stringify(t.key.static)}]`:this.hole(t.key.hole).code;n.push({name:"by",kind:"attr",expr:a})}let i=this.itemArrow(e),o;if(i){let a={kind:"expr",code:i.body,reactive:i.bodyReactive},u=this.rebuildWithChildren(e,[a]);o=`(${i.params.join(", ")}) => (${this.emit(u)})`}else{let a=this.stripAndLower(e,u=>u.kind==="EachDirective");o=`() => (${this.emit(a)})`}let s=[{kind:"expr",code:o,reactive:!1}],l=this.tagAt(e);return{kind:"component",name:"For",props:n,children:s,...l?{at:l}:{},...r.at?{bindAt:r.at}:{}}}itemArrow(e){let t=e.children.filter(r=>!this.isBlankText(r));return t.length!==1||t[0].kind!=="Expression"?null:this.hole(t[0].hole).arrow??null}stripAndLower(e,t){let r={...e,attributes:e.attributes.filter(n=>!t(n))};return r.kind==="Element"?this.lowerElement(r):this.lowerComponent(r)}rebuildWithChildren(e,t){let r=this.lowerAttributes(e.attributes.filter(n=>n.kind!=="EachDirective"));if(e.kind==="Element"){let n=this.tagAt(e);return{kind:"element",tag:e.tag,svg:e.namespace==="svg",props:r,children:t,static:!1,...n?{at:n}:{}}}return{kind:"component",name:e.tag,props:r,children:t}}lowerAttributes(e){let t=[],r=[],n=!1,i,o=[],s=!1,l,a=[];for(let u of e)switch(u.kind){case"IfDirective":case"EachDirective":case"ElseDirective":break;case"Attribute":t.push(this.plainAttr(u));break;case"PropertyBinding":t.push({name:u.name,kind:"prop",expr:this.hole(u.hole).code,reactive:this.hole(u.hole).reactive,...this.hole(u.hole).at?{at:this.hole(u.hole).at}:{}});break;case"EventBinding":t.push(this.eventProp(u));break;case"RefBinding":t.push({name:"ref",kind:"ref",expr:this.hole(u.hole).code,reactive:this.hole(u.hole).reactive,...this.hole(u.hole).at?{at:this.hole(u.hole).at}:{}});break;case"Spread":t.push({name:"",kind:"spread",expr:this.hole(u.hole).code});break;case"ClassDirective":{let f=this.hole(u.hole);r.push(`${JSON.stringify(u.name)}: ${f.code}`),n=n||f.reactive,i??=f.at;break}case"StyleDirective":{let f=this.hole(u.hole);o.push(`${JSON.stringify(u.name)}: ${f.code}`),s=s||f.reactive,l??=f.at;break}case"BindDirective":t.push(...this.bindProps(u.name,this.hole(u.hole)));break;case"UseDirective":{let f=u.name??(u.hole!=null?this.hole(u.hole).code:null);if(!f)break;a.push(u.name!=null&&u.hole!=null?`[${f}, () => (${this.hole(u.hole).code})]`:`[${f}]`);break}}return r.length>0&&t.push({name:"classList",kind:"attr",expr:`{ ${r.join(", ")} }`,reactive:n,...i?{at:i}:{}}),o.length>0&&t.push({name:"style",kind:"attr",expr:`{ ${o.join(", ")} }`,reactive:s,...l?{at:l}:{}}),a.length>0&&t.push({name:"use",kind:"attr",expr:`[${a.join(", ")}]`}),t}eventProp(e){let t=e.name.toLowerCase(),r=this.hole(e.hole).code;if(!(e.syntax==="colon"||e.modifiers.length>0))return{name:"on"+oo(e.name),kind:"event",event:{name:t,delegated:io.has(t)},expr:r};let n=this.wrapHandler(r,e.modifiers),i=this.eventOptions(e.modifiers),o=i?`[${n}, ${i}]`:n;return{name:"on:"+t,kind:"attr",expr:o}}wrapHandler(e,t){let r=t.includes("self")?"if (e.target !== e.currentTarget) return; ":"",n=[];return t.includes("prevent")&&n.push("e.preventDefault();"),t.includes("stop")&&n.push("e.stopPropagation();"),!r&&n.length===0?e:`(e) => { ${r}${n.join(" ")} return (${e})(e); }`}eventOptions(e){let t=[];return e.includes("capture")&&t.push("capture: true"),e.includes("once")&&t.push("once: true"),e.includes("passive")&&t.push("passive: true"),t.length?`{ ${t.join(", ")} }`:null}bindProps(e,t){let r=t.code,n=e==="checked",i=n?"change":"input",o=n?"checked":"value";this.used.add("bindPair");let s=`bindPair(${r})`;return[{name:e,kind:"attr",expr:`${s}[0]()`,reactive:!0,directive:`bind:${e}`,...t.at?{at:t.at}:{}},{name:"on"+oo(i),kind:"event",event:{name:i,delegated:io.has(i)},expr:`(e) => ${s}[1](e.target.${o})`}]}plainAttr(e){let t=e.value,r=e.name;e.name==="class"?r=t&&t.kind==="hole"&&this.hole(t.hole).object?"classList":"className":e.name==="html"&&(r="innerHTML");let n={name:r,kind:"attr"};if(t==null)return n.literal=!0,n;if(t.kind==="static")return n.literal=t.value,n;if(t.kind==="hole"){let l=this.hole(t.hole);return n.expr=l.code,n.reactive=l.reactive,l.at&&(n.at=l.at),n}let i=!1,o,s=t.parts.map(l=>{if("text"in l)return Qu(l.text);let a=this.hole(l.hole);return i=i||a.reactive,o??=a.at,"${"+a.code+"}"}).join("");return n.expr="`"+s+"`",n.reactive=i,o&&(n.at=o),n}};function ec(e,t,r,n={}){let{root:i}=br(e,{svg:n.svg});return new Yu(t,r,n.sourceFile,n.positionAt).lowerRoot(i.children)}function tc(e){let t=[],r=0;return e.statics.forEach((n,i)=>{if(t.push({kind:"static",text:n,start:r}),r+=n.length,i<e.holes.length){let o=r+e.holes[i].code.length;t.push({kind:"hole",index:i,start:r,end:o}),r=o}}),t}function wo(e,t={}){if(e.statics.length!==e.holes.length+1)throw new Error(`[fluixi] compileTemplate: ${e.statics.length} static runs for ${e.holes.length} holes — a template always has exactly one more.`);return rc(tc(e),e.holes,t)}function rc(e,t,r={}){let n=new Set,i=ec(e,[...t],n,{svg:r.svg,...r.sourceFile?{sourceFile:r.sourceFile}:{},...r.positionAt?{positionAt:r.positionAt}:{}});yu(i),Su(i,{resolver:Zu(r.resolve??[]),modules:{controlFlowModule:r.controlFlowModule??"@fluixi/dom",coreModule:r.coreModule??"@fluixi/core",routerModule:r.routerModule??"@fluixi/core/router"},strategyFor:a=>a.load}),$u(i);let{code:o,imports:s,templates:l}=bo.emit(i,{templateClone:r.templateClone,partialTemplates:r.partialTemplates});for(let a of s)n.add(a);return r.hoistTemplates?{code:o,imports:[...n],ir:i,templates:l}:{code:go(o,l),imports:[...n],ir:i}}function nc(e,t){switch(e.kind){case"Attribute":if(e.value&&e.value.kind==="hole")t.set(e.value.hole,"attr");else if(e.value&&e.value.kind==="mixed")for(let r of e.value.parts)"hole"in r&&t.set(r.hole,"attr");return;case"PropertyBinding":t.set(e.hole,"attr");return;case"BindDirective":t.set(e.hole,"bind");return;case"EventBinding":t.set(e.hole,"event");return;case"RefBinding":t.set(e.hole,"ref");return;case"Spread":t.set(e.hole,"spread");return;case"IfDirective":t.set(e.hole,"control");return;case"EachDirective":t.set(e.hole,"control"),e.key&&"hole"in e.key&&t.set(e.key.hole,"attr");return;default:return}}function Cr(e,t,r){for(let n of e)switch(n.kind){case"Expression":t.has(n.hole)||t.set(n.hole,"text");break;case"Element":case"Component":{n.kind==="Component"&&(n.tagHole!==null?t.set(n.tagHole,"component"):n.tag&&r.add(n.tag.split(".")[0]));let i=n.attributes.some(o=>o.kind==="EachDirective");for(let o of n.attributes)nc(o,t);if(i)for(let o of n.children)o.kind==="Expression"&&t.set(o.hole,"render");Cr(n.children,t,r);break}case"Root":case"Fragment":Cr(n.children,t,r);break;default:break}}function ko(e){let t=new Map,r=new Set;return Cr(e.root.children,t,r),{holes:t,components:r}}var _r={...gr,createMemo:Rt},ic=["For","Index","Show","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense"],Or=new Map;function So(e){for(let[t,r]of Object.entries(e))Or.set(t,r)}function oc(e){return e==="text"||e==="attr"||e==="control"}function sc(e,t){return e.map((r,n)=>{let i=t.get(n)??"text";return i==="render"?{code:`$$v[${n}]`,reactive:!1,arrow:{params:["$$item"],body:`$$v[${n}]($$item)`,bodyReactive:!1}}:typeof r=="function"&&oc(i)?{code:`$$v[${n}]()`,reactive:!0}:{code:`$$v[${n}]`,reactive:!1}})}function lc(e){if(Or.has(e))return Or.get(e);let t=globalThis[e];if(t!==void 0)return t;throw new Error(`[fluixi] <${e}> is not defined. Pass it as a hole — <\${${e}} /> — or register it with define({ ${e} }).`)}function ac(e,t,r){let n=e,i=Ki(n,{svg:r}),o=i.diagnostics.filter(v=>v.severity==="error");if(o.length>0)throw new Error(`[fluixi] ${r?"svg":"html"}\`\`: ${o.map(v=>v.message).join("; ")}`);let{holes:s,components:l}=ko(i),{code:a,imports:u}=wo({statics:n,holes:sc(t,s)},{svg:r}),f=u.filter(v=>!(v in _r));if(f.length>0)throw new Error(`[fluixi] no runtime binding for: ${f.join(", ")}`);let c=Array.from(new Set([...u,...ic])).filter(v=>v in _r),h=Array.from(l).filter(v=>!c.includes(v)),y=[...c,...h],b=new Function(...y,"$$v",`return (${a});`);return{run:v=>b(...c.map(E=>_r[E]),...h.map(lc),v)}}var xo=new WeakMap;function uc(e){let t="";for(let r of e)t+=typeof r=="function"?"f":"v";return t}function $o(e){return(t,...r)=>{let n=xo.get(t);n||(n=new Map,xo.set(t,n));let i=uc(r),o=n.get(i);return o||(o=ac(t,r,e),n.set(i,o)),o.run(r)}}var Ao=$o(!1),Eo=$o(!0);return Po(cc);})();
1
+ /*! @fluixi/template-runtime v0.1.0-alpha.5 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+ "use strict";var Fluixi=(()=>{var At=Object.defineProperty;var Uo=Object.getOwnPropertyDescriptor;var zo=Object.getOwnPropertyNames;var Ko=Object.prototype.hasOwnProperty;var Wn=(e,t)=>{for(var n in t)At(e,n,{get:t[n],enumerable:!0})},Jo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of zo(t))!Ko.call(e,i)&&i!==n&&At(e,i,{get:()=>t[i],enumerable:!(r=Uo(t,i))||r.enumerable});return e};var Go=e=>Jo(At({},"__esModule",{value:!0}),e);var Ml={};Wn(Ml,{Dynamic:()=>Sn,ErrorBoundary:()=>xn,For:()=>vn,Index:()=>gn,Match:()=>bn,Portal:()=>kn,Show:()=>yn,Switch:()=>wn,batch:()=>J,define:()=>Wo,effect:()=>Lr,html:()=>Vo,hydrate:()=>Pe,insert:()=>L,memo:()=>jr,onCleanup:()=>ke,render:()=>Me,resource:()=>Hr,signal:()=>Ir,store:()=>Ur,svg:()=>Fo,untrack:()=>ue});var _n={};Wn(_n,{ClientOnly:()=>Ki,Dynamic:()=>Sn,ErrorBoundary:()=>xn,FX_DATA_ID:()=>pn,For:()=>vn,Index:()=>gn,Island:()=>Wa,JSX_PROPERTIES:()=>zt,Match:()=>bn,NoSsr:()=>Xa,Portal:()=>kn,SVG_ELEMENTS:()=>Nc,SVG_NAMESPACE:()=>lt,Show:()=>yn,Switch:()=>wn,VERSION:()=>hi,VOID_ELEMENTS:()=>Cc,addClass:()=>ii,addDelegatedEventListener:()=>tn,addNativeEventListener:()=>sn,appendChildren:()=>fi,applyElementProp:()=>Ut,applyProps:()=>un,applyUse:()=>cn,asComponent:()=>yi,asContext:()=>ta,asOutlet:()=>Qc,asProvider:()=>ea,asRoute:()=>Zc,asRouter:()=>Xc,asRoutes:()=>Yc,asSuspense:()=>na,bindPair:()=>Hi,captureHydrationCursor:()=>aa,checkRenderType:()=>ra,classMap:()=>Ya,cleanChildren:()=>G,cloneTemplate:()=>on,closest:()=>Rc,createComponent:()=>ln,createDynamicElement:()=>Ua,createElement:()=>ui,createNativeElement:()=>nn,createPortal:()=>ji,createRequestContext:()=>dn,createTemplate:()=>rn,default:()=>vu,delegate:()=>Lc,delegateEvents:()=>pt,escapeFxJson:()=>Ui,escapeHTML:()=>_a,fnName:()=>ba,generateID:()=>ha,getAttribute:()=>ci,getGlobal:()=>Jc,getLitEventName:()=>$c,getLocals:()=>Ma,getOffset:()=>jc,getRequestContext:()=>fe,getRequestEvent:()=>Fi,getRequestLocals:()=>Bi,getServerData:()=>zi,getStableElementId:()=>da,getStyle:()=>Pc,handleRef:()=>Re,hasClass:()=>Mc,holeContent:()=>Ri,holeEnd:()=>Oi,holeScope:()=>Ni,html:()=>Fa,hydrate:()=>Pe,hydrateAdvancePast:()=>en,hydrateIslands:()=>Va,indexArray:()=>Ue,initializeIntegration:()=>Na,insert:()=>L,insertExpression:()=>_e,intergartionInitialized:()=>Oa,isAccessor:()=>$a,isComponent:()=>j,isContext:()=>ki,isCustomElement:()=>ri,isDOMNode:()=>zc,isDelegatedEvent:()=>ya,isDomElement:()=>Ei,isDomNode:()=>Oe,isDomText:()=>Ai,isEventHandler:()=>_c,isFunction:()=>va,isIntegrationInitialized:()=>Wi,isJSXTemplate:()=>Uc,isLitTemplateResult:()=>di,isNativeElement:()=>Aa,isOutlet:()=>wi,isPromise:()=>xe,isProvider:()=>Si,isReactElement:()=>Fc,isRoute:()=>bi,isRouter:()=>vi,isRoutes:()=>gi,isSVGElement:()=>Li,isServer:()=>H,isSuspense:()=>xi,isTemplateFactory:()=>Bc,isVisible:()=>Dc,iterateFn:()=>wa,keyArray:()=>Be,makeArrayFlat:()=>Mi,mapArray:()=>Fe,mergeProps:()=>Ii,observeIntersection:()=>Wc,observeResize:()=>qc,query:()=>Kt,queryAll:()=>Oc,registerCoreVersion:()=>Gc,registerCreateComponent:()=>Ca,registerGlobal:()=>Kc,removeAttribute:()=>ai,removeChildren:()=>li,removeClass:()=>oi,removeDelegatedEventListener:()=>at,render:()=>Me,renderToString:()=>fu,renderToStringAsync:()=>mu,resetIntegration:()=>qi,runHydrationAt:()=>Jt,runWithRequestContext:()=>hn,runWithoutHydration:()=>ua,scrollIntoView:()=>Ic,serializeNode:()=>Y,serializeResourceData:()=>so,setAttribute:()=>M,setClassList:()=>Ce,setClassName:()=>he,setDataRedactor:()=>hu,setDynamicAttribute:()=>$e,setDynamicBoolAttribute:()=>an,setDynamicProperty:()=>Te,setProperty:()=>de,setRequestStore:()=>Ra,setServerMode:()=>Ae,setStyle:()=>Ne,setStyles:()=>Zt,shouldSetAsProperty:()=>Tc,splitProps:()=>Ea,spread:()=>Di,stampVersions:()=>pi,styleMap:()=>Qa,svg:()=>Ba,templateNode:()=>Ci,toAttributeName:()=>Ac,toggleClass:()=>si,versions:()=>A,waitForElement:()=>Hc,warnOnVersionSkew:()=>mi});var $t="1.0.0-alpha.85",Un=$t.split(".")[0],qn=`__fluixi_signal_state_v${Un}__`,zn=`__fluixi_signal_builds_v${Un}__`,Xo=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function Kn(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Xo,onSuspend:null,onError:null,observer:null}}var He=globalThis;function Yo(e){let t=Kn(),n=e;for(let r of Object.keys(t))r in e||(n[r]=t[r]);return e}function Zo(){let e=He[qn];return e?Yo(e):He[qn]=Kn()}var h=Zo();(He[zn]??=[]).push($t);function Jn(){return[...new Set(He[zn]??[])]}function Qo(e){return h.observer=e,()=>{h.observer===e&&(h.observer=null)}}var $=[],es;function Tt(e){let t=h.observer;t&&t.created(e.parents===void 0?{...e,parents:$,origin:e.origin??es}:e)}function ts(e){return h.observer?($.push(e),!0):!1}function ns(){$.pop()}function rs(e){h.observer?.ran?.(e)}function is(e,t){h.observer?.wrote?.(e,t)}function N(e,t,n,r){let i=h.observer;!i?.bound||!$.length||i.bound($[$.length-1],e,t,n,r)}function O(e,t,n,r){let i=h.observer;!i?.directive||!$.length||i.directive($[$.length-1],e,t,n,r)}function os(e){h.observer?.contextCreated?.(e)}function ss(e,t,n){let r=h.observer;!r?.context||!$.length||r.context($[$.length-1],e,t,n)}function Ct(e){h.observer?.disposed?.(e)}var cs="__FLUIXI_DEVTOOLS_HOOK__",Vn=globalThis[cs];if(typeof Vn?.inject=="function")try{Vn.inject({observeReactiveNodes:Qo,version:$t})}catch{}function Gn(){return h.observer!=null}var Fn=0,Bn=1,ve=2,Xn=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(h.untracked)return;let e=h.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},as=class extends Xn{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,is(this,h.consumer),this.observers)for(let t of[...this.observers])t.markDirty(ve);_t(this)}}peek(){return this._value}},Yn=class extends Xn{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=ve,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(h.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===Bn&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===ve)break}(this.state===ve||!this._initialized)&&this.recompute(),this.state=Fn}recompute(){if(this.sources){for(let c of this.sources)c.observers?.delete(this);this.sources.clear()}let e=h.consumer,t=h.untracked,n=ts(this);h.consumer=this,h.untracked=!1;let r,i=!1,o;try{r=this._fn()}catch(c){i=!0,o=c,r=this._value}finally{h.consumer=e,h.untracked=t,n&&ns()}let s=!this._initialized||this._threw!==i||(i?o!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=i,this._error=o,this._value=r,rs(this),s){if(this.version++,this.observers)for(let c of[...this.observers])c.markDirty(ve);_t(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Fn;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(Bn);_t(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function _t(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var us=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function ls(e){if(h.untracked)return e();h.untracked=!0;try{return e()}finally{h.untracked=!1}}function ie(e){let t=qe(e);return e&&(e.owned??=[]).push(t),t}function oe(e,t=!0){ge(e,t)}function qe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Zn(e,t){let n=Symbol(t??"context");return os(n),{id:n,defaultValue:e,Provider:i=>{ss(n,"provide",i.value);let o=h.owner,s=qe(o);(s.contexts=new Map).set(n,i.value),o&&(o.owned??=[]).push(s),h.owner=s;try{return i.children}finally{h.owner=o}}}}function Qn(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function fs(e){h.onSuspend=e}function ds(e){return h.onSuspend?(h.onSuspend(e,h.owner),!0):!1}function hs(e){h.onError=e}function W(){return h.owner}function T(e,t){let n=h.owner;h.owner=e;try{return t()}finally{h.owner=n}}function S(e){if(h.owner){if(h.owner.disposed){e();return}(h.owner.cleanups??=[]).push(e)}}function ge(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)ge(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 P(e){let t=qe(h.owner);h.owner&&(h.owner.owned??=[]).push(t);let n=h.owner;h.owner=t;try{return e(()=>ge(t))}finally{h.owner=n}}function ps(e){h.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function ms(e){e.queued||(e.queued=!0,h.queue.push(e),!h.scheduled&&h.batchDepth===0&&(h.scheduled=!0,h.hostSchedule(Ve)))}function Ve(){if(h.scheduled=!1,h.flushing)return;h.flushing=!0;let e=0;try{for(;h.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=h.queue;h.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{h.flushing=!1}}function ys(){h.batchDepth===0&&Ve()}function vs(e){h.batchDepth++;try{return e()}finally{--h.batchDepth===0&&Ve()}}var gs=class{constructor(e,t=!1){this.queued=!1,this.disposed=!1,this.owner=qe(h.owner),h.owner&&(h.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new Yn(()=>{ge(this.owner,!1),T(this.owner,()=>{let n=e();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),Tt({kind:"effect",node:this.computed,handle:this,internal:!t}),this.watcher=new us(()=>ms(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&h.onSuspend){h.onSuspend(e,this.owner);return}if(h.onError&&h.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,Ct(this.computed),this.watcher.unwatch(this.computed),ge(this.owner))}};function er(e,t=!1){let n=new gs(e,t);return()=>n.dispose()}function bs(e){return!!e&&typeof e.then=="function"}ps(()=>{});var tr=Symbol.for("signal"),ws=Symbol.for("memo"),Ss=Symbol.for("signal-node");function D(e,t){let n=new as(e,{equals:t?.equals}),r=(()=>n.get()),i=(o=>{let s=typeof o=="function"?o(n.peek()):o;return n.set(s),ys(),s});return Object.defineProperty(r,tr,{value:!0,enumerable:!0}),Object.defineProperty(r,Ss,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),Tt({kind:"signal",node:n,handle:r,name:t?.name,set:i}),Gn()&&S(()=>Ct(n)),[r,i]}function g(e,t,n){let r=t,i=W(),o=new Yn(()=>T(i,()=>{try{return r=e(r)}catch(c){if(bs(c))return ds(c),r;throw c}}),{equals:n?.equals}),s=(()=>o.get());return Object.defineProperty(s,tr,{value:!0,enumerable:!0}),Object.defineProperty(s,ws,{value:!0,enumerable:!0}),Tt({kind:"memo",node:o,handle:s,name:n?.name}),Gn()&&S(()=>Ct(o)),s}function q(e,t){let n=t;return er(()=>{n=e(n)},!0)}function w(e,t){let n=t;return er(()=>{n=e(n)})}function se(e){return vs(e)}function I(e){return ls(e)}function nr(){return Ve(),Promise.resolve()}function Fe(e,t,n){let r=[];return S(()=>{for(let i of r)i.dispose();r=[]}),g(()=>{let i=e()||[];return I(()=>{if(i.length===0){for(let a of r)a.dispose();return r=[],n?.fallback?n.fallback():[]}let o=new Map;for(let a of r)o.has(a.item)||o.set(a.item,a);let s=[],c=new Set;for(let a=0;a<i.length;a++){let u=i[a],l=o.get(u);if(l&&!c.has(l))l.setIndex(a),s.push(l),c.add(l);else{let f,d,y;P(v=>{y=v;let[_,me]=D(a,{name:"row index"});d=me,f=t(u,_)});let b={item:u,rendered:f,dispose:y,setIndex:d};s.push(b),c.add(b)}}for(let a of r)c.has(a)||a.dispose();return r=s,s.map(a=>a.rendered)})},void 0,{name:"mapArray"})}function Be(e,t,n,r){let i=[],o=[];return S(()=>{for(let s of o)s.dispose();i=[],o=[]}),g(()=>{let s=e()||[];return I(()=>{if(s.length===0){for(let f of o)f.dispose();return i=[],o=[],r?.fallback?r.fallback():[]}let c=new Map;for(let f=0;f<i.length;f++)c.set(i[f],o[f]);let a=[],u=[],l=new Set;for(let f=0;f<s.length;f++){let d=t(s[f]),y=c.get(d);if(y&&!l.has(d))y.setIndex(f),a.push(y);else{let b,v,_;P(me=>{_=me;let[Q,ye]=D(f,{name:"row index"});v=ye;let Ie=g(re=>{let z=(e()||[])[Q()];return z??re},s[f]);b=n(Ie,Q)}),a.push({rendered:b,dispose:_,setIndex:v})}u.push(d),l.add(d)}for(let[f,d]of c)l.has(f)||d.dispose();return i=u,o=a,a.map(f=>f.rendered)})},void 0,{name:"keyArray"})}function Ue(e,t,n){let r=[];return S(()=>{for(let i of r)i.dispose();r=[]}),g(()=>{let i=e()||[];return I(()=>{if(i.length===0){for(let a of r)a.dispose();return r=[],n?.fallback?n.fallback():[]}let o=r.length,s=i.length;for(let a=o;a<s;a++){let u,l,f,d=i[a];P(y=>{f=y;let[b,v]=D(d);l=v,u=t(b,a)}),r.push({rendered:u,setItem:l,dispose:f})}for(let a=s;a<o;a++)r[a].dispose();s<o&&(r=r.slice(0,s));let c=Math.min(o,s);for(let a=0;a<c;a++)r[a].setItem(i[a]);return r.map(a=>a.rendered)})},void 0,{name:"indexArray"})}var ks=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,xs=typeof process>"u"?ks:!1,Es=Symbol.for("signal");function k(e){return typeof e=="function"&&e[Es]===!0}var As=null;function rr(e){As=e}var _s=null;function ir(e){_s=e}var $s=null;function ze(e){$s=e}var Ts=null;function or(e){Ts=e}function We(e){if(typeof e=="function"&&!e.length){let t=e();return k(t)?t:We(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=We(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function Ke(e){let t=g(e);return xs?g(()=>We(t()),void 0,{name:"children"}):g(()=>We(t()))}var Cs=Zn();fs((e,t)=>{let n=Qn(t,Cs);n&&(n.increment(),e.finally(()=>n.decrement()))});var Ns=Zn();hs((e,t)=>{let n=Qn(t,Ns);return n?(n.setError(e),!0):!1});var Nt=Symbol.for("fluixi-proxy");var sr="1.0.0-alpha.85";var Wt="1.0.0-alpha.85";var Er=Wt.split(".")[0],cr=`__fluixi_signal_state_v${Er}__`,Os=`__fluixi_signal_builds_v${Er}__`,Rs=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function Ar(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Rs,onSuspend:null,onError:null,observer:null}}var Rt=globalThis;function Ms(e){let t=Ar(),n=e;for(let r of Object.keys(t))r in e||(n[r]=t[r]);return e}function Ps(){let e=Rt[cr];return e?Ms(e):Rt[cr]=Ar()}var p=Ps();(Rt[Os]??=[]).push(Wt);function Ds(e){return p.observer=e,()=>{p.observer===e&&(p.observer=null)}}var V=[],Je;function Is(e,t){if(!p.observer)return t();let n=Je;Je=e;try{return t()}finally{Je=n}}function nt(e){let t=p.observer;t&&t.created(e.parents===void 0?{...e,parents:V,origin:e.origin??Je}:e)}function js(e){return p.observer?(V.push(e),!0):!1}function Ls(){V.pop()}function Hs(e){p.observer?.ran?.(e)}function Ws(e,t){p.observer?.wrote?.(e,t)}function _r(e){let t=p.observer;!t?.props||!V.length||!e||t.props(V[V.length-1],e)}function qs(e){p.observer?.contextCreated?.(e)}function Vs(e,t,n){let r=p.observer;!r?.context||!V.length||r.context(V[V.length-1],e,t,n)}function ar(e,t,n){p.observer?.moved?.(e,t,n)}function we(e){p.observer?.disposed?.(e)}var Fs="__FLUIXI_DEVTOOLS_HOOK__",ur=globalThis[Fs];if(typeof ur?.inject=="function")try{ur.inject({observeReactiveNodes:Ds,version:Wt})}catch{}function rt(){return p.observer!=null}var lr=0,fr=1,be=2,$r=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(p.untracked)return;let e=p.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Bs=class extends $r{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,Ws(this,p.consumer),this.observers)for(let t of[...this.observers])t.markDirty(be);Mt(this)}}peek(){return this._value}},Tr=class extends $r{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this.state=be,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(p.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===fr&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===be)break}(this.state===be||!this._initialized)&&this.recompute(),this.state=lr}recompute(){if(this.sources){for(let c of this.sources)c.observers?.delete(this);this.sources.clear()}let e=p.consumer,t=p.untracked,n=js(this);p.consumer=this,p.untracked=!1;let r,i=!1,o;try{r=this._fn()}catch(c){i=!0,o=c,r=this._value}finally{p.consumer=e,p.untracked=t,n&&Ls()}let s=!this._initialized||this._threw!==i||(i?o!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=i,this._error=o,this._value=r,Hs(this),s){if(this.version++,this.observers)for(let c of[...this.observers])c.markDirty(be);Mt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===lr;if(this.state=e,t){if(this.observers)for(let n of[...this.observers])n.markDirty(fr);Mt(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Mt(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}var Us=class{constructor(e){this._watched=new Set,this._pending=new Set,this._notifyFn=e}watch(...e){for(let t of e)this._watched.add(t),(t.watchers??=new Set).add(this)}unwatch(...e){for(let t of e)this._watched.delete(t),t.watchers?.delete(this),this._pending.delete(t)}getPending(){let e=[...this._pending];return this._pending.clear(),e}_notify(e){if(!this._watched.has(e)||this._pending.has(e))return;let t=this._pending.size===0;this._pending.add(e),t&&this._notifyFn()}};function zs(e){if(p.untracked)return e();p.untracked=!0;try{return e()}finally{p.untracked=!1}}function Cr(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Nr(e,t){let n=Symbol(t??"context");return qs(n),{id:n,defaultValue:e,Provider:i=>{Vs(n,"provide",i.value);let o=p.owner,s=Cr(o);(s.contexts=new Map).set(n,i.value),o&&(o.owned??=[]).push(s),p.owner=s;try{return i.children}finally{p.owner=o}}}}function Or(e,t){let n=e;for(;n;){if(n.contexts&&n.contexts.has(t.id))return n.contexts.get(t.id);n=n.parent}return t.defaultValue}function Ks(e){p.onSuspend=e}function Js(e){return p.onSuspend?(p.onSuspend(e,p.owner),!0):!1}function Gs(e){p.onError=e}function Xs(){return p.owner}function Rr(e,t){let n=p.owner;p.owner=e;try{return t()}finally{p.owner=n}}function ke(e){if(p.owner){if(p.owner.disposed){e();return}(p.owner.cleanups??=[]).push(e)}}function Pt(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Pt(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 Ys(e){p.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Zs(e){e.queued||(e.queued=!0,p.queue.push(e),!p.scheduled&&p.batchDepth===0&&(p.scheduled=!0,p.hostSchedule(qt)))}function qt(){if(p.scheduled=!1,p.flushing)return;p.flushing=!0;let e=0;try{for(;p.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let t=p.queue;p.queue=[];for(let n of t)n.queued=!1,n.disposed||n.run()}}finally{p.flushing=!1}}function Qs(){p.batchDepth===0&&qt()}function ec(e){p.batchDepth++;try{return e()}finally{--p.batchDepth===0&&qt()}}var tc=class{constructor(e,t=!1){this.queued=!1,this.disposed=!1,this.owner=Cr(p.owner),p.owner&&(p.owner.cleanups??=[]).push(()=>this.dispose()),this.computed=new Tr(()=>{Pt(this.owner,!1),Rr(this.owner,()=>{let n=e();typeof n=="function"&&(this.owner.cleanups??=[]).push(n)})}),nt({kind:"effect",node:this.computed,handle:this,internal:!t}),this.watcher=new Us(()=>Zs(this)),this.run(),this.watcher.watch(this.computed)}run(){if(!this.disposed){this.watcher.getPending();try{this.computed.get()}catch(e){if(e&&typeof e.then=="function"&&p.onSuspend){p.onSuspend(e,this.owner);return}if(p.onError&&p.onError(e,this.owner))return;throw e}}}dispose(){this.disposed||(this.disposed=!0,we(this.computed),this.watcher.unwatch(this.computed),Pt(this.owner))}};function nc(e,t=!1){let n=new tc(e,t);return()=>n.dispose()}function rc(e){return!!e&&typeof e.then=="function"}Ys(()=>{});var Mr=Symbol.for("signal"),ic=Symbol.for("memo"),oc=Symbol.for("signal-node");function ce(e,t){let n=new Bs(e,{equals:t?.equals}),r=(()=>n.get()),i=(o=>{let s=typeof o=="function"?o(n.peek()):o;return n.set(s),Qs(),s});return Object.defineProperty(r,Mr,{value:!0,enumerable:!0}),Object.defineProperty(r,oc,{value:{get value(){return n.peek()},get version(){return n.version}},enumerable:!1}),nt({kind:"signal",node:n,handle:r,name:t?.name,set:i}),rt()&&ke(()=>we(n)),[r,i]}function Vt(e,t,n){let r=t,i=Xs(),o=new Tr(()=>Rr(i,()=>{try{return r=e(r)}catch(c){if(rc(c))return Js(c),r;throw c}}),{equals:n?.equals}),s=(()=>o.get());return Object.defineProperty(s,Mr,{value:!0,enumerable:!0}),Object.defineProperty(s,ic,{value:!0,enumerable:!0}),nt({kind:"memo",node:o,handle:s,name:n?.name}),rt()&&ke(()=>we(o)),s}function Pr(e,t){let n=t;return nc(()=>{n=e(n)},!0)}function J(e){return ec(e)}function ue(e){return zs(e)}var Vl=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var sc=Symbol.for("signal");function Dr(e){return typeof e=="function"&&e[sc]===!0}var dr=null;function cc(e){dr&&dr(e)}var hr=null;function ac(e){return hr?hr(e):void 0}var pr=null;function uc(){return pr?pr():void 0}var mr=null;function lc(e,t){mr&&mr(e,t)}function fc(e){return!!e&&typeof e.then=="function"}var Ot=Symbol();function dc(e,t,n={}){let r,i;typeof t=="function"?(r=typeof e=="function"?e:()=>e,i=t):(r=()=>!0,i=e,t&&typeof t=="object"&&(n=t));let o=n.transport===!1?void 0:uc(),s=o!==void 0?ac(o):void 0,c=s!==void 0,[a,u]=ce(s!==void 0?s.value:n.initialValue,{equals:!1}),[l,f]=ce(void 0,{equals:!1}),[d,y]=ce(s!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[b,v]=ce(void 0,{equals:!1}),[_,me]=ce(void 0,{equals:!1}),Q=Ot,ye=!1;Pr(()=>{let x=r();if(_(),x===!1||x===null||x===void 0){Q=Ot,J(()=>{y("unresolved"),v(void 0),f(void 0)});return}let z=ye;if(ye=!1,Q!==Ot&&x===Q&&!z)return;if(Q=x,c){c=!1;return}let je=!1;ke(()=>je=!0);let Ln=ue(d),Bo=ue(a),Hn=Ln==="ready"||Ln==="refreshing";J(()=>{y(Hn?"refreshing":"pending"),f(void 0)});try{let ee=i(x,{value:Bo,refetching:Hn});fc(ee)?(v(ee),cc(ee),ee.then(Le=>{je||(o!==void 0&&lc(o,Le),J(()=>{u(()=>Le),y("ready"),v(void 0)}))},Le=>{je||J(()=>{f(Le),y("errored"),v(void 0)})})):J(()=>{u(()=>ee),y("ready"),v(void 0)})}catch(ee){if(je)return;J(()=>{f(ee),y("errored"),v(void 0)})}});let Ie=()=>{let x=d();return x==="pending"||x==="refreshing"},re=(()=>{let x=l();if(x)throw x;if(Ie()){let z=b();if(z)throw z}return a()});return Object.defineProperties(re,{state:{get:d},loading:{get:Ie},error:{get:l},latest:{get:a}}),Object.defineProperty(re,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(re,Symbol.for("signal"),{value:!0,enumerable:!0}),[re,{mutate:u,refetch:()=>{ye=!0,me(void 0)}}]}var hc=Nr();Ks((e,t)=>{let n=Or(t,hc);n&&(n.increment(),e.finally(()=>n.decrement()))});var pc=Nr();Gs((e,t)=>{let n=Or(t,pc);return n?(n.setError(e),!0):!1});function Ir(e,t){let[n,r]=ce(e,t);return Object.assign(n,{set:r})}function jr(e,t,n){return Vt(e,t,n)}function Lr(e,t){return Pr(e,t)}function Hr(...e){let[t,n]=dc(...e);return Object.assign(t,n)}var Ye=Symbol("store-raw"),yr=Symbol("store-node"),vr=Symbol("store-has"),gr=Symbol("store-self"),br=Symbol("store-track");var Se=new WeakMap,Dt=new WeakMap,le=new WeakMap,Ze=new WeakMap;function mc(e,t){if(!ae(e)||!rt())return;let n=new Set,r=s=>{if(!(!ae(s)||n.has(s))){n.add(s);for(let c of Object.values(s))r(c)}};r(Ze.get(t)??t);let i=new Set,o=s=>{if(!ae(s))return;let c=s;if(n.has(c)||i.has(c))return;i.add(c);let a=Se.get(c);if(a){for(let u of a.keys.values())we(u);a.all&&we(a.all),Se.delete(c),le.delete(c),Dt.delete(c)}for(let u of Object.values(c))o(u)};o(e)}var Qe=(e,t,n)=>n?`${e}[${String(t)}]`:`${e}.${String(t)}`;function Wr(e,t,n){let r=t?.owner,i=r&&n!==void 0?Qe(r.name,n,t?.array):void 0,[o,s]=Is(r?.store,()=>D(e,i?{name:i}:void 0)),c=o;return c.$=s,c}function et(e){let t=Se.get(e);return t?t.owner||(t.owner=le.get(e)):Se.set(e,t={keys:new Map,owner:le.get(e),array:Array.isArray(e)}),t}function wr(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=Wr(n,e,t)),r}function yc(e,t,n,r){let i=le.get(e);if(i&&i.store===t&&i.name===n)return;let o={store:t,name:n};le.set(e,o),Ze.set(e,Ze.get(r)??r);let s=Se.get(e);if(s&&(s.owner=o,!!rt())){for(let[c,a]of s.keys)ar(a,t,Qe(n,c,s.array));s.all&&ar(s.all,t,Qe(n,"*",s.array))}}function Sr(e){let t=et(e);(t.all||(t.all=Wr(void 0,t,"*")))()}function kr(e,t){e.$(typeof t=="function"?()=>t:t)}function ae(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Ge(e){if(!ae(e))return e;let t=Dt.get(e);if(t)return t;let n=new Proxy(e,vc);return Dt.set(e,n),n}var vc={get(e,t,n){if(t===Ye||t===yr)return e;if(t===Nt)return n;if(t===vr)return a=>a in e;if(t==="__proxy")return!0;if(t===br||t===gr)return Sr(e),n;let r=e[t];if(typeof r=="function"&&!Object.prototype.hasOwnProperty.call(e,t))return r;let i=Object.getOwnPropertyDescriptor(e,t);if(i&&i.get)return i.get.call(n);let o=et(e),s=wr(o,t,r),c=s();return ae(c)?(o.owner&&yc(c,s,Qe(o.owner.name,t,o.array),e),Ge(c)):c},set(){return!0},deleteProperty(e,t){return t in e&&R(e,t,void 0),!0},has(e,t){return t===Ye||t===Nt||t===yr||t===vr||t===gr||t===br?!0:(wr(et(e),t,e[t])(),t in e)},ownKeys(e){return Sr(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function qr(e,t=new Set){if(e==null||typeof e!="object")return e;let n=e[Ye]??e;if(t.has(n)||!ae(n))return n;t.add(n);let r=!1,i=s=>{let c=qr(s,t);return c!==s&&(r=!0),c};if(Array.isArray(n)){let s=n.map(i);return r?s:n}let o={};for(let s of Object.keys(n))o[s]=i(n[s]);return r?o:n}function R(e,t,n){let r=qr(n),i=e[t];if(i===r&&(r!==void 0||t in e))return;let o=Array.isArray(e),s=o?e.length:0;r===void 0?delete e[t]:e[t]=r;let c=et(e),a=c.keys.get(t);if(a&&kr(a,r),mc(i,e),o&&e.length!==s){let u=c.keys.get("length");u&&kr(u,e.length)}c.all&&c.all.$(void 0)}function It(e,t){return typeof e=="function"?e(t):e}function jt(e,t){for(let n of Object.keys(t)){let r=t[n],i=e[n];r&&typeof r=="object"&&!Array.isArray(r)&&i&&typeof i=="object"&&!Array.isArray(i)?jt(i,r):R(e,n,r)}}function it(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function Vr(e,t,n){let r=t.length-1;for(let o=0;o<r;o++){let s=t[o];if(s==="*"){let a=t.slice(o+1);if(Array.isArray(e))for(let u=0;u<e.length;u++)Vr(e[u],a,n);return}let c=e[s];(c==null||typeof c!="object")&&(c=/^\d+$/.test(t[o+1])?[]:{},R(e,s,c)),e=c}let i=t[r];if(i==="*"){if(Array.isArray(e))for(let o=0;o<e.length;o++)R(e,o,It(n,e[o]));return}R(e,i,It(n,e[i]))}function xr(e,t,n){Vr(e,it(t),n)}function gc(e){return Array.isArray(e)&&e.length>0&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="string")}function Xe(e,t){for(let n=e.length-1;n>=t.length;n--)R(e,String(n),void 0);e.length!==t.length&&R(e,"length",t.length);for(let n=0;n<t.length;n++)R(e,String(n),t[n])}function bc(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&jt(e,r);return}if(Array.isArray(n)&&t.length===1){if(gc(n)){for(let r of n)xr(e,r[0],r[1]);return}if(Array.isArray(e)){Xe(e,n);return}if(n.length===0)return;throw new TypeError("[fluixi] set() was given an array that is neither a batch of [path, value] pairs nor a replacement for an array root. Name the path you meant, as in set('items', [...]).")}if(n&&typeof n=="object"&&!Array.isArray(n)&&t.length===1){jt(e,n);return}if(t.length>=3){Lt(e,t.slice(0,-1),t[t.length-1]);return}xr(e,String(n),t[1])}function wc(e,t){if(typeof t=="function"){if(!Array.isArray(e))return[];let n=[];for(let r=0;r<e.length;r++)t(e[r],r)&&n.push(r);return n}if(Array.isArray(t))return Array.isArray(e)?t.map(Number):t.map(String);if(t&&typeof t=="object"&&("from"in t||"to"in t||"by"in t)){if(!Array.isArray(e))return[];let n=t.by??1,r=t.from??0,i=t.to??e.length-1,o=[];for(let s=r;s<=i;s+=n)s>=0&&s<e.length&&o.push(s);return o}return t==="*"?Array.isArray(e)?e.map((n,r)=>r):Object.keys(e??{}):[t]}function Lt(e,t,n){if(e==null)return;let[r,...i]=t;if(typeof r=="string"){let s=it(r);if(s.length>1){Lt(e,[...s,...i],n);return}}let o=wc(e,r);if(i.length===0){for(let s of o)R(e,s,It(n,e[s]));return}for(let s of o){let c=e[s];if(c==null||typeof c!="object"){let a=i[0];c=typeof a=="number"||/^\d+$/.test(String(a))?[]:{},R(e,s,c)}Lt(c,i,n)}}function Ht(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Ht);let t={};for(let n of Object.keys(e))t[n]=Ht(e[n]);return t}function K(e,t){let n=e;for(let r of it(t)){if(n==null)return;n=n[r]}return n}var Fr=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...n)=>se(()=>bc(this.root,n))),e&&typeof e=="object"&&(le.set(e,{store:this,name:t.name??"store"}),Ze.set(e,e)),nt({kind:"store",node:this,handle:()=>this.root,name:t.name})}get state(){return Ge(this.root)}get proxy(){return Ge(this.root)}get accessor(){return(()=>Ge(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return tt(this.state);let t=this.state;for(let n of it(e)){if(t==null)return;t=t[n]}return tt(t)}select(e){return g(()=>e(this.state))}subscribe(e){return q(()=>e(this.state))}watch(e,t){let n;return q(()=>{let r=e(this.state);Object.is(r,n)||(t(r,n),n=r)})}reactive(e){return g(()=>this.state[e])}produce(e){this.set((t=>{let n=Ht(t);return e(n),n}))}reconcile(e,t={}){this.set(e)}push(e,...t){let n=K(this.root,e);this.set(e,n.concat(t))}pop(e){let t=K(this.root,e).slice(),n=t.pop();return this.set(e,t),n}shift(e){let t=K(this.root,e).slice(),n=t.shift();return this.set(e,t),n}splice(e,t,n,...r){let i=K(this.root,e).slice(),o=i.splice(t,n,...r);return this.set(e,i),o}insert(e,t,n){let r=K(this.root,e).slice();r.splice(t,0,n),this.set(e,r)}removeAt(e,t){let n=K(this.root,e).slice(),r=n.splice(t,1);return this.set(e,n),r}replace(e,t){if(arguments.length>=2){let r=K(this.root,String(e)),i=t;if(Array.isArray(r)&&Array.isArray(i)){Xe(r,i);return}this.set(e,i);return}let n=this.root;if(Array.isArray(n)&&Array.isArray(e)){Xe(n,e);return}this.set(e)}clear(e){let t=e===void 0?this.root:K(this.root,e);if(Array.isArray(t)){Xe(t,[]);return}if(t&&typeof t=="object")for(let n of Object.keys(t))R(t,n,void 0)}toObservable(){let[e]=D(this.state);return e.toObservable()}dispose(){}},Sc=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","replace","clear","unwrap","toObservable"];function kc(e,t){for(let n of Sc)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function Br(e,t={immutable:!0}){let n=new Fr(e,t);return kc(n.set,n),[n.proxy,n.set]}function xc(e,t={}){return new Fr(e,{...t,immutable:!1})}function tt(e){if(e==null||typeof e!="object")return e;let t=e[Ye];return t!==void 0?t:e}function Ec(e){return I(()=>tt(e))}var Bl=Object.freeze({createStore:Br,createMutableStore:xc,batch:se,unwrap:tt,untrackStore:Ec});function Ur(e,t){let[n,r]=Br(e,t);return new Proxy(n,{get:(i,o)=>o==="set"?r:i[o],has:(i,o)=>o==="set"||Reflect.has(i,o)})}function Ac(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function _c(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function $c(e){return e.startsWith("@")?e.slice(1):e.startsWith("on")?e.slice(2).toLowerCase():e}function Tc(e,t){let n=new Set(["checked","value","selected","disabled","readonly","required","multiple","open","contenteditable","draggable","spellcheck"]),r={input:new Set(["value","checked","indeterminate"]),textarea:new Set(["value"]),select:new Set(["value"]),option:new Set(["selected","value"]),audio:new Set(["volume","currentTime","paused"]),video:new Set(["volume","currentTime","paused"]),img:new Set(["src","srcset"]),iframe:new Set(["src"]),a:new Set(["href"])};return n.has(t)||r[e]&&r[e].has(t)}var Cc=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Nc=new Set(["svg","g","path","circle","rect","line","polyline","polygon","ellipse","text","tspan","use","defs","symbol","mask","clipPath","pattern","linearGradient","radialGradient","stop","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","foreignObject"]),lt="http://www.w3.org/2000/svg";function ri(e){return e.localName.includes("-")}function Ut(e,t,n,r=!1){if(n==null){e.removeAttribute(t);return}if(ri(e)){e[t]=n;return}M(e,t,n,r)}var zt=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]);function Kt(e,t=document){return t.querySelector(e)}function Oc(e,t=document){return Array.from(t.querySelectorAll(e))}function Rc(e,t){return e.closest(t)}function ii(e,...t){e.classList.add(...t)}function oi(e,...t){e.classList.remove(...t)}function si(e,...t){t.forEach(n=>e.classList.toggle(n))}function Mc(e,t){return e.classList.contains(t)}function M(e,t,n,r=!1){if(n==null||n===!1){e.removeAttribute(t);return}if(n===!0){e.setAttribute(t,"");return}if(typeof n=="object"){e.setAttribute(t,JSON.stringify(n));return}e.setAttribute(t,String(n))}function ci(e,t){return e.getAttribute(t)}function ai(e,t){e.removeAttribute(t)}function Zt(e,t){Object.assign(e.style,t)}function Pc(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function ui(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([i,o])=>{if(i==="class"||i==="className")r.className=o;else if(i==="style"&&typeof o=="object")Zt(r,o);else if(i.startsWith("on")&&typeof o=="function"){let s=i.slice(2).toLowerCase();r.addEventListener(s,o)}else M(r,i,o)}),n.forEach(i=>{typeof i=="string"?r.appendChild(document.createTextNode(i)):r.appendChild(i)}),r}function li(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function fi(e,...t){t.forEach(n=>{typeof n=="string"?e.appendChild(document.createTextNode(n)):e.appendChild(n)})}function Dc(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function Ic(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function jc(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function Lc(e,t,n,r){let i=o=>{let s=o.target.closest(n);s&&e.contains(s)&&r(o,s)};return e.addEventListener(t,i),()=>{e.removeEventListener(t,i)}}function Hc(e,t=5e3){return new Promise((n,r)=>{let i=Kt(e);if(i){n(i);return}let o=new MutationObserver(()=>{let c=Kt(e);c&&(o.disconnect(),clearTimeout(s),n(c))});o.observe(document.body,{childList:!0,subtree:!0});let s=setTimeout(()=>{o.disconnect(),r(new Error(`Element ${e} not found within ${t}ms`))},t)})}function Wc(e,t,n={}){let r=new IntersectionObserver(i=>{i.forEach(o=>{t(o.isIntersecting)})},n);return r.observe(e),()=>{r.disconnect()}}function qc(e,t){let n=new ResizeObserver(r=>{r.forEach(t)});return n.observe(e),()=>{n.disconnect()}}var Vc=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function Fc(e){return typeof e=="object"&&e!==null&&e.$$typeof===Vc}function di(e){return e&&typeof e=="object"&&e.strings&&Array.isArray(e.strings)&&e.values&&Array.isArray(e.values)}function Bc(e){if(typeof e!="function")return!1;try{let t=e();return di(t)}catch{return!1}}function Uc(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function zc(e){return e instanceof Node}function Kc(e,t,n="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[n]>"u"&&(globalThis[n]={}),typeof globalThis[n][e]>"u"&&(globalThis[n][e]=t))}function Jc(e,t,n="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[n]<"u"&&typeof globalThis[n][e]<"u"?globalThis[n][e]:t}var hi="1.0.0-alpha.85",A={dom:hi,reactive:sr};function Gc(e){A.core=e}function pi(e){A.core&&e.setAttribute("fluixi",A.core),e.setAttribute("fx-dom",A.dom),e.setAttribute("fx-reactive",A.reactive),typeof globalThis<"u"&&(globalThis.Fluixi=A)}function mi(){let e=Jn();e.length>1&&console.warn(`[fluixi] ${e.length} builds of @fluixi/reactive are driving one reactive graph: ${e.join(", ")}. They share it on purpose, so signals still cross between them, but the oldest one decided what the graph looks like. Build the components on one release, or load them as shared-runtime bundles.`);let t=[A.core,A.dom,A.reactive].filter(n=>n!==void 0);new Set(t).size<=1||console.warn(`[fluixi] package versions disagree: core ${A.core??"(absent)"}, dom ${A.dom}, reactive ${A.reactive}. These ship as one release, so a mismatch usually means a stale lockfile or two copies resolved side by side. Reinstall, or check for duplicates with \`pnpm why @fluixi/dom\`.`)}function Xc(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function Yc(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Zc(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Qc(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function ea(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function ta(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function yi(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function na(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function vi(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function gi(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function bi(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function wi(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function Si(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function ki(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function j(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function xi(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function ra(e){return vi(e)?{type:"router",value:e}:bi(e)?{type:"route",value:e}:gi(e)?{type:"routes",value:e}:wi(e)?{type:"outlet",value:e}:j(e)?{type:"component",value:e}:xi(e)?{type:"suspense",value:e}:Si(e)?{type:"provider",value:e}:ki(e)?{type:"context",value:e}:{type:"none",value:e}}var ft=Symbol.for("fluixi.server-node"),ia=Symbol.for("fluixi.dom.server-host"),oa=globalThis,Ee=oa[ia]??={server:typeof document>"u",nodes:null};function H(){return Ee.server}function Ae(e){Ee.server=e}function sa(e){Ee.nodes=e}function dt(){if(!Ee.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Ee.nodes}function Oe(e){return e!=null&&e[ft]===!0?!0:typeof Node<"u"&&e instanceof Node}function Ei(e){return e!=null&&e[ft]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Ai(e){return e!=null&&e[ft]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var m={active:!1,cursor:null,parents:[]},_i=null;function ca(e){_i=e}function Qt(){return _i}function zr(e,t){return m.active&&t.parentNode===e}function $i(e){let t=m.parents.lastIndexOf(e);t!==-1&&(m.parents.length=t),m.cursor=e.nextSibling}function aa(){return m.active?m.cursor:null}function Jt(e,t){if(!e||e.parentNode==null)return t();let n=m.active,r=m.cursor,i=m.parents;m.active=!0,m.cursor=e,m.parents=[];try{return t()}finally{m.active=n,m.cursor=r,m.parents=i}}function ua(e){if(!m.active)return e();let t=m.cursor,n=m.parents;m.active=!1,m.parents=[];try{return e()}finally{m.active=!0,m.cursor=t,m.parents=n}}function en(e){if(!m.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&$i(t)}function la(e){let t=[];for(;e&&e.nodeType===1;){let n=e.tagName.toLowerCase();if(e.id){n+=`#${e.id}`,t.unshift(n);break}e.getAttribute("data-id")&&(n+=`[data-id="${e.getAttribute("data-id")}"]`);let r=0,i=e;for(;i=i.previousElementSibling;)i.tagName===e.tagName&&r++;n+=`:nth-of-type(${r+1})`,t.unshift(n),e=e.parentElement}return t.join(">")}function fa(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return`el_${Math.abs(t)}`}function da(e){return fa(la(e))}var ha=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),pa={},st="__fx_at",Ti="__fx_loc";function Kr(e,t){return t&&(e[Ti]=t),e}var Jr=new Map,ct=new Set,ht=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function pt(e){if(!H())for(let t of e)ct.has(t)||ht.has(t)||(ct.add(t),document.addEventListener(t,ma))}function ma(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;for(;n;){let r=n[t];if(r&&!n.disabled&&(r(e),e.cancelBubble))return;n=n.host&&n.host!==n&&n.host instanceof Element?n.host:n.parentNode}}function tn(e,t,n){if(e[`$$${t}`]=n,ht.has(t)){let r=`__fx_${t}`;if(!e[r]){let i=o=>{e[`$$${t}`]?.(o)};e.addEventListener(t,i),e[r]=i}return}ct.has(t)||pt([t])}function at(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function ya(e){return!ht.has(e)}function va(e){return typeof e=="function"}function X(e,t=!1){if(H())return dt().createText(e);if(m.active&&!t){let n=Qt()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function nn(e,t=!1,n){if(H())return dt().createElement(e,t);if(m.active){let r=Qt()?.hydrateElement(e);if(r)return n?Kr(r,n):r}return Kr(t?document.createElementNS(lt,e):document.createElement(e),n)}function rn(e,t=!1){let n=Jr.get(e);if(n)return n;let r=document.createElement("template");return t?r.innerHTML=`<svg>${e}</svg>`:r.innerHTML=e,Jr.set(e,r),r}function Ci(e,t,n=!1,r=!1,i){if(H()){let o=dt();return n?o.parseTemplate(e,r):o.createRaw(e)}if(m.active){let o=Qt()?.hydrateStatic(t);if(o)return Gr(o,i)}return Gr(on(rn(e,r),r).firstChild,i)}function Gr(e,t){let n=e;if(!t||typeof n?.querySelectorAll!="function")return e;let r=[n,...n.querySelectorAll("*")];for(let i=0;i<r.length&&i*2+1<t.pos.length;i++){let o=t.pos[i*2];o&&(r[i][Ti]={file:t.file,line:o,column:t.pos[i*2+1]})}return e}function Ni(e,t){if(!m.active)return t();let n=Jt(e.nextSibling,t);if(typeof n=="function"){let r=n;return ga(r,(...o)=>m.active?Jt(e.nextSibling,()=>r(...o)):r(...o))}return n}function ga(e,t){let n=e[st];return n!==void 0&&(t[st]=n),t}function Oi(e){for(let t=e.nextSibling;t;t=t.nextSibling)if(t.nodeType===8&&t.data==="fx/")return t;throw new Error("[fluixi] template hole is missing its closing marker")}function Ri(e,t){let n=[];for(let r=e.nextSibling;r&&r!==t;r=r.nextSibling)n.push(r);return n}function on(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function Mi(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Mi(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function ba(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function wa(e){if(k(e)||j(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!k(t)&&!j(t);)t=t();return t}var U=0,Sa=200;function ka(e,t,n,r,i){let o=r,s=new Map;return w(()=>{N(n??t,"content",void 0,e);let c;if(j(e)&&!k(e)){if(!s.has(e)){U++;try{let a=e();s.set(e,a)}finally{U--}}for(c=s.get(e);typeof c=="function"&&k(c);)c=c()}else for(c=e();typeof c=="function"&&k(c);)c=c();{let a=0;for(;typeof c=="function"&&a++<50;)if(j(c)){if(!s.has(c)){let u=c;U++;try{let l=u();s.set(u,l)}finally{U--}}c=s.get(c)}else if(k(c))c=c();else if(c=c(),typeof c!="function"||!k(c)&&!j(c))break}U++;try{o=_e(t,c,n,o,s),i(o)}finally{U--}})}function L(e,t,n,r){if(U>Sa)return console.error("[insert] Exceeded max call depth, possible infinite loop."),()=>null;n!==void 0&&!n&&(n=X("",!0),e.appendChild(n));let i=r??null,o=a=>Array.isArray(a)&&a.some(u=>typeof u=="function"),s=a=>typeof a=="function"?a:()=>a;if(typeof t!="function"&&!o(t)){U++;try{i=_e(e,t,n,i)}finally{U--}return()=>i}let c=ka(s(t),e,n,i,a=>{i=a});return()=>(c?.(),i)}function _e(e,t,n,r,i){if(t==null||typeof t=="boolean")return G(e,r,n);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return G(e,r,n);if(xe(t)){let s=X("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(s,r[0]),G(e,r.slice(1),n)):E(e,s,n):r?e.replaceChild(s,r):E(e,s,n),t.then(c=>{s.parentNode===e&&_e(e,c,s.nextSibling,s)}).catch(c=>{console.error("Error resolving promise in insertExpression:",c)}),s}let o=typeof t;if(o==="string"||o==="number"){if(o==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let c=X(t);return E(e,c,n),c}if(r.length===1&&r[0].nodeType===3)return r[0].data=t,r;r=G(e,r,n)}if(r&&Ai(r))return r.data=t,r;let s=X(t);return r&&r.parentNode===e?e.replaceChild(s,r):zr(e,s)||E(e,s,n),s}if(Oe(t))return zr(e,t)?($i(t),t):Array.isArray(r)?(r.length===0?E(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),G(e,r.slice(1),n)):E(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):E(e,t,n)):E(e,t,n),t);if(Array.isArray(t)){let s=[],c=Array.isArray(r)?r:r?[r]:[],a=[];B(t,s,e,n,!0,i,a);let u=xa(e,c,s,n);for(let l of a){let f=L(e,l.sig,l.marker);S(()=>{G(e,f()),l.marker.parentNode===e&&e.removeChild(l.marker)})}return u}if(o==="object"&&t!==null&&typeof t=="object"){let s=t;if("type"in s&&"props"in s){let c=s;if(typeof c.type=="function"){let a=c.type(c.props||{});return _e(e,a,n,r)}}}return G(e,r,n)}function B(e,t,n,r,i=!0,o,s){for(let c=0;c<e.length;c++){let a=e[c];if(!(a==null||typeof a=="boolean")){for(;typeof a=="function"&&!xe(a)&&!k(a)&&!j(a)&&(a=a(),!(a==null||typeof a=="boolean")););if(!(a==null||typeof a=="boolean")){if(typeof a=="function"){let u;for(j(a)&&!k(a)?(o||(o=new Map),o.has(a)||o.set(a,a()),u=o.get(a)):u=a();typeof u=="function"&&!xe(u)&&!k(u)&&!j(u);)o||(o=new Map),o.has(u)||o.set(u,u()),u=o.get(u);if(u==null||typeof u=="boolean")continue;if(typeof u=="function"){if(k(u)){if(s){let f=X("",!0);t.push(f),s.push({marker:f,sig:u});continue}let l=u();for(;typeof l=="function"&&k(l);)l=l();if(l==null||typeof l=="boolean")continue;Array.isArray(l)?B(l,t,n,r,i,o):B([l],t,n,r,i,o);continue}continue}Array.isArray(u)?B(u,t,n,r,i,o,s):B([u],t,n,r,i,o,s);continue}if(xe(a)){let u=X("",!0);t.push(u),a.then(l=>{if(u.parentNode){let f=[];if(B([l],f,u.parentNode,void 0,!1,o),f.length>0){u.parentNode.replaceChild(f[0],u);for(let d=1;d<f.length;d++)u.parentNode?.insertBefore(f[d],f[d-1].nextSibling)}}}).catch(l=>console.error("Error resolving promise in array:",l));continue}if(Array.isArray(a)){B(a,t,n,r,i,o,s);continue}if(Oe(a)){t.push(a);continue}if(typeof a=="object"&&a!==null&&"type"in a&&"props"in a){let u=a;if(typeof u.type=="function"){let l=u.type(u.props||{});Array.isArray(l)?B(l,t,n,r,!1,o):B([l],t,n,r,!1,o);continue}}if(typeof a=="string"||typeof a=="number"){let u=String(a);if(u.trim()===""&&u!==" ")continue;t.push(X(u));continue}t.push(X(String(a)))}}}}function xa(e,t,n,r){for(let f=0;f<n.length;f++){let d=n[f].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(n=n.slice(),n[f]=n[f].cloneNode(!0))}let i=n.length,o=t.length,s=i,c=0,a=0,u=o>0?t[o-1].nextSibling??void 0:r,l=null;for(;c<o||a<s;){if(t[c]===n[a]){c++,a++;continue}for(;o>c&&s>a&&t[o-1]===n[s-1];)o--,s--;if(o===c){let f=s<i?a?n[a-1].nextSibling??void 0:n[s-a]:u;for(;a<s;)E(e,n[a++],f)}else if(s===a)for(;c<o;)(!l||!l.has(t[c]))&&t[c].parentNode===e&&e.removeChild(t[c]),c++;else if(t[c]===n[s-1]&&n[a]===t[o-1]){let f=t[--o].nextSibling;E(e,n[a++],t[c++].nextSibling),E(e,n[--s],f),t[o]=t[c-1]}else{if(!l){l=new Map;let d=a;for(;d<s;)l.set(n[d],d++)}let f=l.get(t[c]);if(f!=null)if(a<f&&f<s){let d=c,y=1;for(;++d<o&&d<s&&!(!l.has(t[d])||l.get(t[d])!==f+y);)y++;if(y>f-a){let b=t[c];for(;a<f;)E(e,n[a++],b)}else t[c].parentNode===e?e.replaceChild(n[a++],t[c++]):(E(e,n[a++],u),c++)}else c++;else t[c].parentNode===e&&e.removeChild(t[c]),c++}}return n}function G(e,t,n){if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r].parentNode===e&&e.removeChild(t[r]);else t.parentNode===e&&e.removeChild(t);return null}function E(e,t,n){m.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function de(e,t,n){n==null?delete e[t]:e[t]=n}function sn(e,t,n){let r=n,i;return Array.isArray(n)&&(r=n[0],i=n[1]),typeof r!="function"?()=>{}:(e.addEventListener(t,r,i),()=>e.removeEventListener(t,r,i))}function Pi(e,t){if(!t||typeof t!="function")return;let n=t[st]?.name;if(!n)return;let r=n.indexOf(":");r!==-1&&O(e,n.slice(0,r),n.slice(r+1),t)}function ut(e,t,n){let r=typeof n=="function"?I(()=>n()):n;if(!(!r||typeof r!="object"))for(let i of Object.keys(r))O(e,t,i)}function cn(e,t){let n=(r,i)=>{typeof r=="function"&&(O(e,"use",r.name||"use",i),r(e,i??(()=>{})))};if(typeof t=="function"){n(t);return}if(Array.isArray(t)){if(typeof t[0]=="function"){n(t[0],t[1]);return}for(let r of t)Array.isArray(r)?n(r[0],r[1]):n(r)}}function $e(e,t,n,r=!1){return Pi(e,n),typeof n!="function"?(M(e,t,n,r),()=>{}):w(()=>{N(e,"attribute",t,n);let i=typeof n=="function"?n():n;M(e,t,i,r)})}function Te(e,t,n){return typeof n!="function"?(de(e,t,n),()=>{}):(Pi(e,n),w(()=>{N(e,"property",t,n);let r=typeof n=="function"?n():n;de(e,t,r)}))}function an(e,t,n){return typeof n!="function"?(M(e,t,!!n),()=>{}):w(()=>{N(e,"attribute",t,n);let r=n();M(e,t,!!r)})}function he(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){w(()=>{N(e,"attribute","class",t),he(e,t())});return}if(typeof t=="string"){e.setAttribute("class",t);return}if(Array.isArray(t)){e.setAttribute("class",t.filter(Boolean).join(" "));return}if(typeof t=="object"){let n=Object.keys(t).filter(r=>{let i=t[r];return typeof i=="function"?i():!!i}).join(" ");e.setAttribute("class",n);return}e.setAttribute("class",String(t))}function Ce(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let i=t[r],o=r.split(/\s+/).filter(Boolean);if(typeof i=="function"&&n)n.push(w(()=>{let s=!!i();for(let c of o)e.classList.toggle(c,s)}));else{let s=!!(typeof i=="function"?i():i);for(let c of o)e.classList.toggle(c,s)}}}function Ne(e,t){let n=t;for(;typeof n=="function";)n=n();if(n==null){e.removeAttribute("style");return}if(typeof n=="string"){e.style.cssText=n;return}if(typeof n=="object")for(let r in n){let i=n[r];i==null?e.style[r]="":e.style[r]=i}}function Di(e){let{element:t,props:n,prevProps:r=pa,isSVG:i=!1,skipChildren:o=!1}=e;if(!t||!Ei(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let s=i||t.namespaceURI===lt,c=[];for(let a in n){if(o&&a==="children")continue;let u=n[a],l=r[a];if(u===l)continue;if(a==="ref"){Re(u,t);continue}if(a==="use"){cn(t,u);continue}if(a.startsWith("on:")){c.push(sn(t,a.slice(3),u));continue}if(a.startsWith("prop:")){O(t,"prop",a.slice(5),u),c.push(Te(t,a.slice(5),u));continue}if(a.startsWith("attr:")){O(t,"attr",a.slice(5),u),c.push($e(t,a.slice(5),u,s));continue}if(a.startsWith("bool:")){O(t,"bool",a.slice(5),u),c.push(an(t,a.slice(5),u));continue}if(a==="class"||a==="className"){typeof u=="function"?c.push(w(()=>{N(t,"attribute","class",u),he(t,u())})):he(t,u);continue}if(a==="classList"){ut(t,"class",u),typeof u=="function"?c.push(w(()=>{N(t,"attribute","class",u),Ce(t,u())})):Ce(t,u,c);continue}if(a==="style"){ut(t,"style",u),typeof u=="function"?c.push(w(()=>{N(t,"attribute","style",u),Ne(t,u())})):Ne(t,u);continue}if(a.startsWith("on")){let d=a.slice(2).toLowerCase();l&&at(t,d),u&&tn(t,d,u);continue}let f=zt.has(a)||!s&&a in t;typeof u=="function"?c.push(f?Te(t,a,u):$e(t,a,u,s)):c.push(w(()=>f?de(t,a,n[a]):M(t,a,n[a],s)))}for(let a in r)if(!(a in n))if(a.startsWith("on")){let u=a.slice(2).toLowerCase();at(t,u)}else zt.has(a)?de(t,a,null):t.removeAttribute(a);return()=>{c.forEach(a=>a())}}function un(e,t,n=!1){for(let r in t){let i=t[r];if(r==="ref"){Re(i,e);continue}if(r!=="children"){if(r==="use"){cn(e,i);continue}if(r.startsWith("on:")){sn(e,r.slice(3),i);continue}if(r.startsWith("prop:")){O(e,"prop",r.slice(5),i),Te(e,r.slice(5),i);continue}if(r.startsWith("attr:")){O(e,"attr",r.slice(5),i),$e(e,r.slice(5),i,n);continue}if(r.startsWith("bool:")){O(e,"bool",r.slice(5),i),an(e,r.slice(5),i);continue}if(r.startsWith("on")&&r.length>2){let o=r.slice(2).toLowerCase();if(typeof i=="function")if(ht.has(o)){e[`$$${o}`]=i;let s=`__fx_${o}`;if(!e[s]){let c=a=>{e[`$$${o}`]?.(a)};e.addEventListener(o,c),e[s]=c}}else e[`$$${o}`]=i,ct.has(o)||pt([o]);continue}if(r==="class"||r==="className"){he(e,i);continue}if(r==="classList"){ut(e,"class",i),typeof i=="function"?w(()=>{N(e,"attribute","class",i),Ce(e,i())}):Ce(e,i);continue}if(r==="style"){ut(e,"style",i),typeof i=="function"?w(()=>{N(e,"attribute","style",i),Ne(e,i())}):Ne(e,i);continue}if(r==="innerHTML"){if(typeof i=="function"){let o=q(()=>{let s=i();for(;typeof s=="function";)s=s();e.innerHTML=s});S(()=>o())}else e.innerHTML=i;continue}if(r==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let o=q(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.value=s??"")});S(()=>{o()})}else w(()=>{document.activeElement!==e&&(e.value=t[r]??"")});continue}if(r==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let o=q(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.checked=s??"")});S(()=>{o()})}else w(()=>{document.activeElement!==e&&(e.checked=t[r]??"")});continue}if(r==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let o=!0,s=q(()=>{let c=i();for(;typeof c=="function"&&c.length===0;)c=c();o?(o=!1,queueMicrotask(()=>{e.value=c??""})):e.value=c??""});S(()=>{s()})}else{let o=!0;w(()=>{let s=t[r];o?(o=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""})}continue}if(typeof i=="function"){let o=q(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();Ut(e,r,s,n)});S(()=>{o()})}else w(()=>Ut(e,r,t[r],n))}}}function Ii(...e){let t=r=>{for(let i=e.length-1;i>=0;i--){let o=e[i];if(o&&r in o&&o[r]!==void 0)return o[r]}},n=r=>{for(let i of e)if(i&&r in i)return!0;return!1};return new Proxy({},{get:(r,i)=>t(i),has:(r,i)=>n(i),ownKeys:()=>{let r=new Set;for(let i of e)if(i)for(let o of Reflect.ownKeys(i))r.add(o);return[...r]},getOwnPropertyDescriptor:(r,i)=>n(i)?{enumerable:!0,configurable:!0,get:()=>t(i)}:void 0})}function Ea(e,...t){let n=new Set;for(let s of t)for(let c of s)n.add(c);let r=s=>({enumerable:!0,configurable:!0,get:()=>e[s]}),i=t.map(s=>{let c=new Set(s);return new Proxy({},{get:(a,u)=>c.has(u)?e[u]:void 0,has:(a,u)=>c.has(u)&&u in e,ownKeys:()=>Array.from(c).filter(a=>a in e),getOwnPropertyDescriptor:(a,u)=>c.has(u)&&u in e?r(u):void 0})}),o=new Proxy({},{get:(s,c)=>n.has(c)?void 0:e[c],has:(s,c)=>!n.has(c)&&c in e,ownKeys:()=>Reflect.ownKeys(e).filter(s=>!n.has(s)),getOwnPropertyDescriptor:(s,c)=>!n.has(c)&&c in e?r(c):void 0});return[...i,o]}function Re(e,t){if(!e)return;let n=e[st]?.name;if(O(t,"ref",n||typeof e=="function"&&e.name||"ref",e),Oe(e)){let r=t,i=e;if(!r)return;typeof r=="function"?r(i):typeof r=="object"&&"current"in r&&(r.current=i);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e&&(e.current=t)}function ji(e,t,n){let r=t||document.body,i=Ke(()=>e),o=[];return se(()=>{let s=w(()=>{let c=i();Array.isArray(c)?(c.forEach(a=>r.appendChild(a)),o.push(()=>{c.forEach(a=>{a.parentNode===r&&r.removeChild(a)})})):Oe(c)&&(r.appendChild(c),o.push(()=>{c.parentNode===r&&r.removeChild(c)}))});o.push(s),S(()=>{o.forEach(c=>c())})}),null}function Aa(e){return typeof e=="string"&&e.toLowerCase()===e}function Li(e){return e==="svg"||e==="path"||e==="circle"||e==="rect"||e==="line"||e==="polygon"||e==="polyline"||e==="ellipse"||e==="g"||e==="defs"||e==="clipPath"||e==="text"}function _a(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function xe(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function $a(e){return typeof e=="function"&&e.length===0&&k(e)}function Me(e,t,n){if(!t)throw new Error("Container element is required");let r,i,o=[];return P(s=>{se(()=>{m.active||(t.textContent=""),pi(t),mi(),L(t,e)}),i=s}),()=>{i?.(),r?.(),o.forEach(s=>s()),t.textContent=""}}function Hi(e){if(Array.isArray(e))return e;if(typeof e=="function"&&typeof e.set=="function")return[e,e.set];throw new TypeError("[fluixi] bind: needs a signal, either `signal(...)` or the `[get, set]` pair from `createSignal(...)`.")}var Ta="__fx_dom_create_component__",te=globalThis[Ta]??={fn:null};function Ca(e){te.fn=e}function Na(e={}){let t=e.signalSystem?.createComponent;t&&(te.fn=t)}function ln(e,t){if(te.fn)return te.fn(e,t);t&&_r(t);let n=typeof e=="function"?ue(()=>e(t)):e,r=n!=null&&(typeof n=="function"||typeof n=="object");if(r)try{n.$name=e?.name}catch{}return r&&!Dr(n)?yi(n):n}var Oa=()=>te.fn!==null,Wi=()=>te.fn!==null;function qi(){te.fn=null}var ot,Vi={getStore:()=>ot,run(e,t){let n=ot;ot=e;try{return t()}finally{ot=n}}},fn=Vi;function Ra(e){fn=e??Vi}function dn(e={}){e.locals||(e.locals=e.request?Bi(e.request):{});let t=0,n=0,r=null,i=new Map,o=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${t++}`,nextResourceId:()=>{if(r===null)return`r${n++}`;let s=i.get(r)??0;return i.set(r,s+1),`${r}:r${s}`},nextIslandNamespace:s=>{let c=o.get(s)??0;return o.set(s,c+1),`${s}#${c}`},withResourceScope(s,c){let a=r;r=s;try{return c()}finally{r=a}},pending:new Set,data:new Map}}function hn(e,t){return fn.run(e,t)}function fe(){return fn.getStore()}function Fi(){return fe()?.event}function Ma(){let e=Fi();return e?(e.locals||(e.locals={}),e.locals):{}}var Xr=new WeakMap;function Bi(e){let t=Xr.get(e);return t||(t={},Xr.set(e,t)),t}var pn="__FX_DATA__";function Ui(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var Ft;function zi(){let e=globalThis.__FX_DATA__;if(e)return e;if(Ft!==void 0)return Ft;let t=null;if(typeof document<"u"){let n=document.getElementById(pn)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return Ft=t}function mt(){for(;;){for(;m.cursor&&m.cursor.nodeType===3&&m.cursor.data==="";)m.cursor=m.cursor.nextSibling;if(m.cursor!=null||!m.parents.length)return;m.cursor=m.parents.pop().nextSibling}}var Pa=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),yt=typeof process<"u"&&process.env&&!1;function vt(e,t){let n=t.nodeType===1?`<${t.tagName.toLowerCase()}>`:t.nodeType===3?`text ${JSON.stringify((t.nodeValue??"").slice(0,24))}`:t.nodeType===8?"comment":"node";console.warn(`[fluixi] hydration mismatch: expected ${e} but the server DOM has ${n}. Server and client rendered different markup; recreating this node on the client. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function Da(e){mt();let t=m.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(Pa.has(e.toLowerCase())?m.cursor=t.nextSibling:(m.parents.push(t),m.cursor=t.firstChild),t):(yt&&t&&vt(`<${e}>`,t),null)}function Ia(e){mt();let t=m.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(m.cursor=t.nextSibling,t):(yt&&t&&vt(`<${e}> (static)`,t),null)}function ja(e){if(e===""){let n=m.cursor;return n&&n.nodeType===3&&n.data!==""?(m.cursor=n.nextSibling,n.data="",n):null}mt();let t=m.cursor;return t&&t.nodeType===3?(m.cursor=t.nextSibling,t.nodeValue!==e&&(t.nodeValue=e),t):(yt&&t&&vt(`text ${JSON.stringify(e.slice(0,24))}`,t),null)}function La(e){mt();let t=m.cursor;return t&&t.nodeType===8&&t.data===e?(m.cursor=t.nextSibling,t):(yt&&t&&vt(`marker <!--${e.slice(0,24)}-->`,t),null)}var Yr=!1;function Ha(){Yr||(Yr=!0,ca({hydrateElement:Da,hydrateText:ja,hydrateMarker:La,hydrateStatic:Ia}))}function Pe(e,t,n){Ha(),m.active=!0,m.cursor=t.firstChild,m.parents=[];let r=zi(),i=n?.resourceNamespace,o=0;ze(()=>i?`${i}:r${o++}`:`r${o++}`),ir(r?s=>s in r?{value:r[s]}:void 0:null);try{return Me(e,t)}finally{m.active=!1,m.cursor=null,m.parents=[]}}var mn="fluixi-island";function Wa(e){let{component:t,props:n={},name:r}=e,i=nn(mn),o=r??t.name??"Island";M(i,"name",o),M(i,"props",JSON.stringify(n??{}));let s=H()?fe():void 0;if(s){let c=s.nextIslandNamespace(o);L(i,()=>s.withResourceScope(c,()=>t(n)))}else L(i,()=>t(n));return i}var Zr=!1;function qa(){if(Zr||typeof document>"u")return;Zr=!0;let e=document.createElement("style");e.textContent=`${mn}{display:contents}`,document.head.appendChild(e)}function Va(e){if(typeof document>"u")return;qa();let t=document.querySelectorAll(mn),n=new Map;t.forEach(r=>{let i=r.getAttribute("name")??"",o=n.get(i)??0;n.set(i,o+1);let s=e[i];if(!s){typeof process>"u"&&console.warn(`[fluixi] island "${i}" has no component in the registry, left static.`);return}let c={};try{c=JSON.parse(r.getAttribute("props")||"{}")}catch{}Pe(()=>s(c),r,{resourceNamespace:`${i}#${o}`})})}function Fa(e,...t){throw new Error("html`` was not compiled, enable the lit format: fluixi({ format: 'lit' }).")}function Ba(e,...t){throw new Error("svg`` was not compiled, enable the lit format: fluixi({ format: 'lit' }).")}function Ua(e,t={}){if(typeof e=="function")return ln(e,t);if(typeof e!="string"||e.length===0)return null;let n=Li(e);if(H())return dt().createElement(e,n);let r=n?document.createElementNS(lt,e):document.createElement(e);return un(r,t,n),za(r,t),r}function za(e,t){if(!t||t.children===void 0)return;let n=Ke(()=>t.children),r=i=>{L(e,i,typeof i=="function"?null:void 0)};Array.isArray(n)?n.forEach(r):r(n)}function Ka(e){return typeof e=="function"?e:(()=>e)}function gt(e){return()=>{let t=e();return typeof t=="function"?t():t}}function Ja(e){return e!=null&&e!==!1}function Ga(e){return!e||typeof e!="object"?!1:!!(typeof e._$litType$<"u"||typeof e._$litDirective$<"u"||Array.isArray(e.strings)&&Array.isArray(e.values))}function yn(e){let t=gt(()=>e.when),n=g(t,void 0,{name:"Show.when"}),r=g(n,void 0,{name:"Show.cond"}),i=W(),o=null,s=null,c=a=>{a!==s&&(o&&oe(o),o=ie(i),s=a)};return g(()=>{let a=r();return c(a?"when":"fallback"),T(o,()=>{if(a){let u=e.children;return typeof u=="function"&&!Ga(u)?typeof n=="function"?I(()=>I(n)?u(n()):e.fallback):u(n):u}return e.fallback});return e.fallback??null},void 0,{name:"Show.result"})}function vn(e){let t=gt(()=>e.each),n=()=>e.fallback??null,r=(i,o)=>{let s=e.children,c=Array.isArray(s)?s.map(a=>typeof a=="function"?a(i,o):a):typeof s=="function"?s(i,o):s;return en(c),c};return e.by?Be(t,e.by,(i,o)=>r(i,o),{fallback:n}):Fe(t,(i,o)=>r(i,o),{fallback:n})}function gn(e){let t=gt(()=>e.each);return Ue(t,(n,r)=>{let i=e.children(n,r);return en(i),i},{fallback:()=>e.fallback??null})}var Gt=Symbol("match");function bn(e){return{[Gt]:!0,when:gt(()=>e.when),get children(){return e.children}}}function wn(e){let t=Array.isArray(e.children)?e.children:[e.children],n=W(),r=null,i=-1,o=s=>{s!==i&&(r&&oe(r),r=ie(n),i=s)};return g(()=>{for(let s=0;s<t.length;s+=1){let a=t[s],u=0;for(;typeof a=="function"&&!a[Gt]&&u++<10;)a=a();if(!a||typeof a!="object"||a[Gt]!==!0)continue;let l=a.when();if(Ja(l))return o(s),T(r,()=>typeof a.children=="function"?a.children(l):a.children)}return o(-2),T(r,()=>e.fallback??null)},void 0,{name:"Switch"})}function Sn(e){let t=Ka(e.component),{component:n,...r}=e,i=W(),o=null,s;return g(()=>{let c=t();return c!==s&&(o&&oe(o),o=ie(i),s=c),c==null?null:typeof c=="string"?{tag:c,props:r}:T(o,()=>c(r))},void 0,{name:"Dynamic"})}function kn(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return P(i=>{n=i,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),L(r,e.children)&&Re(e.ref,r)}),S(()=>{n(),r.remove()}),null}function Ki(e){if(H())return e.fallback??null;let t=m.active,[n,r]=D(!t);return t&&queueMicrotask(()=>r(!0)),g(()=>n()?e.children:e.fallback??null,void 0,{name:"client-only"})}var Xa=Ki;function xn(e){let[t,n]=D(null),r=()=>n(null);return g(()=>{let i=t();if(i!==null)return typeof e.fallback=="function"?e.fallback(i,r):e.fallback;try{return typeof e.children=="function"?e.children():e.children}catch(o){return n(o),typeof e.fallback=="function"?e.fallback(o,r):e.fallback}},void 0,{name:"ErrorBoundary"})}function Ya(e){return g(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;(typeof i=="function"?i():i)&&n.push(r)}return n.join(" ")},void 0,{name:"ClassMap"})}function Za(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Qa(e){return g(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;let o=typeof i=="function"?i():i;o!=null&&n.push(`${Za(r)}: ${o}`)}return n.join("; ")},void 0,{name:"StyleMap"})}var En=1,Ji=3,Gi=8,Xi;Xi=ft;var bt=class{constructor(){this[Xi]=!0,this.parentNode=null,this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let e=this.parentNode;if(!e)return null;let t=e.childNodes.indexOf(this);return t>=0?e.childNodes[t+1]??null:null}get previousSibling(){let e=this.parentNode;if(!e)return null;let t=e.childNodes.indexOf(this);return t>0?e.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes.push(e),e}insertBefore(e,t){if(t==null)return this.appendChild(e);e.parentNode&&e.parentNode.removeChild(e);let n=this.childNodes.indexOf(t);return e.parentNode=this,n<0?this.childNodes.push(e):this.childNodes.splice(n,0,e),e}removeChild(e){let t=this.childNodes.indexOf(e);return t>=0&&this.childNodes.splice(t,1),e.parentNode=null,e}replaceChild(e,t){let n=this.childNodes.indexOf(t);return n>=0&&(e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes[n]=e,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},An=class Yi extends bt{constructor(t){super(),this.nodeType=Ji,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new Yi(this.data)}},eu=class Zi extends bt{constructor(t){super(),this.nodeType=En,this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new Zi(this.rawOuterHTML)}},Qi=class eo extends bt{constructor(t){super(),this.nodeType=Gi,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new eo(this.data)}},tu=class{constructor(){this.cssText=""}setProperty(e,t){this[e]=t}removeProperty(e){delete this[e]}},nu=class{constructor(e){this.el=e}list(){let e=this.el.getAttribute("class");return e?e.split(/\s+/).filter(Boolean):[]}write(e){e.length?this.el.setAttribute("class",e.join(" ")):this.el.removeAttribute("class")}add(...e){let t=this.list();for(let n of e)t.includes(n)||t.push(n);this.write(t)}remove(...e){this.write(this.list().filter(t=>!e.includes(t)))}contains(e){return this.list().includes(e)}toggle(e,t){let n=this.contains(e),r=t===void 0?!n:t;return r?this.add(e):this.remove(e),r}},Xt=class to extends bt{constructor(t,n=!1){super(),this.nodeType=En,this.attributes=new Map,this.style=new tu,this.classList=new nu(this),this.rawHTML=null,this.localName=t.toLowerCase(),this.tagName=n?t:t.toUpperCase(),this.isSVG=n,this.namespaceURI=n?"http://www.w3.org/2000/svg":null}setAttribute(t,n){this.attributes.set(t,String(n))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let n of this.childNodes)n.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new An(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let n of this.childNodes)n.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let n=new to(this.localName,this.isSVG);if(n.attributes=new Map(this.attributes),n.style.cssText=this.style.cssText,n.rawHTML=this.rawHTML,t)for(let r of this.childNodes)n.appendChild(r.cloneNode(!0));return n}},ru=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),no=/&/g,ro=/</g,io=/>/g,iu=/"/g;function Bt(e){return e.replace(no,"&amp;").replace(ro,"&lt;").replace(io,"&gt;")}function Qr(e){return e.replace(no,"&amp;").replace(iu,"&quot;").replace(ro,"&lt;").replace(io,"&gt;")}function ou(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function su(e){if(!e)return"";let t=[];e.cssText&&t.push(e.cssText.trim().replace(/;\s*$/,""));for(let n of Object.keys(e)){if(n==="cssText")continue;let r=e[n];r==null||r===""||t.push(`${ou(n)}: ${r}`)}return t.join("; ")}function cu(e){let t="",n=su(e.style);for(let[r,i]of e.attributes)r==="style"&&n||(t+=` ${r}="${Qr(i)}"`);if(n){let r=e.attributes.get("style"),i=r?`${r.replace(/;\s*$/,"")}; ${n}`:n;t+=` style="${Qr(i)}"`}return t}function Y(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Bt(e);if(typeof e=="number")return Bt(String(e));if(typeof e=="function")return Y(e());if(Array.isArray(e))return e.map(Y).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case Ji:return Bt(e.data??"");case Gi:return`<!--${e.data??""}-->`;case En:{let t=e.localName,n=`<${t}${cu(e)}>`;if(ru.has(t))return n;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(Y).join("");return`${n}${r}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(Y).join(""):""}var au=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),uu={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function ei(e){return e.replace(/&(#?\w+);/g,(t,n)=>uu[n]??t)}var F=class extends Error{};function lu(e,t=!1){let n=0,r=[],i=[],o=u=>{let l=i[i.length-1];l?l.appendChild(u):r.push(u)};for(;n<e.length;){let u=e.indexOf("<",n);if(u===-1){c(e.slice(n));break}if(u>n&&c(e.slice(n,u)),e.startsWith("<!--",u)){let l=e.indexOf("-->",u);if(l===-1)throw new F(`unterminated comment at ${u}`);o(new Qi(e.slice(u+4,l))),n=l+3;continue}if(e[u+1]==="/"){let l=e.indexOf(">",u);if(l===-1)throw new F(`unterminated closing tag at ${u}`);let f=e.slice(u+2,l).trim().toLowerCase(),d=i.pop();if(!d||d.localName!==f)throw new F(`</${f}> does not close <${d?.localName??"nothing"}>`);n=l+1;continue}n=a(u)}if(i.length>0)throw new F(`unclosed <${i[i.length-1].localName}>`);let s=r[0];if(r.length!==1||!(s instanceof Xt))throw new F(`expected exactly one root element, got ${r.length}`);return s;function c(u){u!==""&&o(new An(ei(u)))}function a(u){let l=/[\s/>]/.exec(e.slice(u+1));if(!l)throw new F(`unterminated tag at ${u}`);let f=e.slice(u+1,u+1+l.index).toLowerCase(),d=new Xt(f,t),y=u+1+l.index;for(;y<e.length;){for(;y<e.length&&/\s/.test(e[y]);)y++;if(e[y]===">"){y++;break}if(e[y]==="/"&&e[y+1]===">"){y+=2;break}let b=y;for(;y<e.length&&!/[\s=/>]/.test(e[y]);)y++;let v=e.slice(b,y);if(v==="")throw new F(`malformed attribute at ${y}`);if(e[y]==="="){if(e[y+1]!=='"')throw new F(`attribute ${v} must have a double-quoted value`);let _=e.indexOf('"',y+2);if(_===-1)throw new F(`unterminated value for ${v}`);d.setAttribute(v,ei(e.slice(y+2,_))),y=_+1}else d.setAttribute(v,"")}return o(d),au.has(f)||i.push(d),y}}var ti=!1;function oo(){ti||(ti=!0,sa({createElement:(e,t)=>new Xt(e,t),createText:e=>new An(e),createRaw:e=>new eu(e),parseTemplate:(e,t)=>lu(e,t),createComment:e=>new Qi(e)}))}function fu(e,t={}){let n=H();oo(),Ae(!0);let r=dn(t.event);try{return hn(r,()=>P(i=>{try{let o=typeof e=="function"?e():e;return Y(o)}finally{i()}}))}finally{Ae(n)}}var ni=!1;function du(){ni||(ni=!0,rr(e=>{fe()?.pending.add(e)}),ze(()=>fe()?.nextResourceId()??""),or((e,t)=>{e&&fe()?.data.set(e,t)}))}var Yt=null;function hu(e){Yt=e}function so(e){if(e.data.size===0)return"";let t={};for(let[r,i]of e.data){let o=i;if(Yt)try{o=Yt(i,r)}catch{continue}o!==void 0&&(typeof o=="function"||typeof o=="symbol"||(t[r]=o))}if(Object.keys(t).length===0)return"";let n=Ui(JSON.stringify(t));return n==="{}"?"":`<script type="application/json" id="${pn}">${n}<\/script>`}var pu=50;async function mu(e,t={}){let n=H();oo(),Ae(!0),du();let r=dn(t.event);try{return await hn(r,async()=>{t.preload&&await t.preload(t.event);let i,o=null,s=()=>{};P(l=>{s=l,o=W(),i=typeof e=="function"?e():e});let c=()=>{try{T(o,()=>Y(i))}catch{}};c();let a=0;for(;r.pending.size>0&&a++<pu;){let l=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(l),await nr(),c()}let u=T(o,()=>Y(i))+so(r);return s(),u})}finally{Ae(n)}}var yu={createComponent:ln,createElement:ui,createNativeElement:nn,createTemplate:rn,cloneTemplate:on,templateNode:Ci,holeContent:Ri,holeEnd:Oi,holeScope:Ni,createPortal:ji,render:Me,hydrate:Pe,insert:L,appendChildren:fi,removeChildren:li,spread:Di,applyProps:un,mergeProps:Ii,bindPair:Hi,setProperty:de,setDynamicProperty:Te,setAttribute:M,setDynamicAttribute:$e,removeAttribute:ai,getAttribute:ci,setClassName:he,addClass:ii,removeClass:oi,toggleClass:si,setStyles:Zt,delegateEvents:pt,addDelegatedEventListener:tn,removeDelegatedEventListener:at,handleRef:Re,resetIntegration:qi,isIntegrationInitialized:Wi},vu=yu;function gu(e){let t=(n,r)=>{n.parent=r;let i=bu(n);for(let o of i)t(o,n)};return t(e,null),e}function bu(e){switch(e.kind){case"Root":case"Element":case"Component":case"Fragment":return e.children;default:return[]}}var wu=class{constructor(e){this.pieces=e,this.pi=0,this.oi=0,this.normalize()}normalize(){for(;this.pi<this.pieces.length;){let e=this.pieces[this.pi];if(e.kind==="static"&&this.oi>=e.text.length){this.pi++,this.oi=0;continue}break}}eof(){return this.pi>=this.pieces.length}pos(){if(this.eof()){let t=this.pieces[this.pieces.length-1];return t?t.kind==="static"?t.start+t.text.length:t.end:0}let e=this.pieces[this.pi];return e.kind==="static"?e.start+this.oi:e.start}atHole(){return!this.eof()&&this.pieces[this.pi].kind==="hole"}holeFollows(){if(this.eof())return!1;let e=this.pieces[this.pi];if(e.kind!=="static"||this.oi+1<e.text.length)return!1;let t=this.pieces[this.pi+1];return t!==void 0&&t.kind==="hole"}takeHole(){let e=this.pieces[this.pi];if(e.kind!=="hole")throw new Error("takeHole called off a hole");return this.pi++,this.oi=0,this.normalize(),{index:e.index,loc:{start:e.start,end:e.end}}}peek(e=0){if(this.eof())return"";let t=this.pieces[this.pi];return t.kind!=="static"?"":t.text[this.oi+e]??""}startsWith(e){if(this.eof())return!1;let t=this.pieces[this.pi];return t.kind!=="static"?!1:t.text.startsWith(e,this.oi)}advance(){if(this.eof())return"";let e=this.pieces[this.pi];if(e.kind!=="static")return"";let t=e.text[this.oi++]??"";return this.normalize(),t}readWhile(e){let t="";for(;!this.eof()&&!this.atHole();){let n=this.peek();if(n===""||!e(n))break;t+=n,this.oi++}return this.normalize(),t}skipWhitespace(){this.readWhile(e=>/\s/.test(e))}span(e){return{start:e,end:this.pos()}}},co=new Set(["capture","once","passive","prevent","stop","self"]);function Z(e,t){return e.value&&e.value.kind==="hole"?e.value.hole:(e.report("invalid-binding",`${t} requires an expression value: ${e.name}=\${…}`),-1)}var uo=(e,t)=>({kind:"Attribute",name:t?e.name.slice(1):e.name,value:e.value,boolean:t,loc:e.loc}),lo=[{id:"event",match:e=>e[0]==="@"||e.startsWith("on:")||/^on[A-Z]/.test(e),build:e=>{let t,n;e.name[0]==="@"?(t="at",n=e.name.slice(1)):e.name.startsWith("on:")?(t="colon",n=e.name.slice(3)):(t="on",n=e.name.slice(2));let[r,...i]=n.split("."),o=r.toLowerCase();for(let s of i)co.has(s)||e.report("invalid-directive",`Unknown event modifier ".${s}" — expected one of ${[...co].join(", ")}`);return{kind:"EventBinding",name:o,syntax:t,modifiers:i,hole:Z(e,"event binding"),loc:e.loc}}},{id:"bind",elementOnly:!0,match:e=>e.startsWith("bind:"),build:e=>({kind:"BindDirective",name:e.name.slice(5),hole:Z(e,"two-way binding"),loc:e.loc})},{id:"class-directive",elementOnly:!0,match:e=>e.startsWith("class:"),build:e=>({kind:"ClassDirective",name:e.name.slice(6),hole:Z(e,"class directive"),loc:e.loc})},{id:"style-directive",elementOnly:!0,match:e=>e.startsWith("style:"),build:e=>({kind:"StyleDirective",name:e.name.slice(6),hole:Z(e,"style directive"),loc:e.loc})},{id:"load",match:e=>e.startsWith("load:"),build:e=>({kind:"LoadDirective",strategy:e.name.slice(5),modifier:e.value&&e.value.kind==="static"?e.value.value:null,loc:e.loc})},{id:"use",match:e=>e==="use"||e.startsWith("use:"),build:e=>({kind:"UseDirective",name:e.name.startsWith("use:")?e.name.slice(4):null,hole:e.value&&e.value.kind==="hole"?e.value.hole:null,loc:e.loc})},{id:"if",elementOnly:!0,match:e=>e==="if",build:e=>({kind:"IfDirective",hole:Z(e,"if directive"),loc:e.loc})},{id:"each",elementOnly:!0,match:e=>e==="each",build:e=>({kind:"EachDirective",hole:Z(e,"each directive"),key:null,loc:e.loc})},{id:"else",elementOnly:!0,match:e=>e==="else",build:e=>(e.value!==null&&e.report("invalid-directive","`else` takes no value"),{kind:"ElseDirective",loc:e.loc})},{id:"ref",match:e=>e==="ref",build:e=>({kind:"RefBinding",hole:Z(e,"ref binding"),loc:e.loc})},{id:"property",match:e=>e[0]===".",build:e=>({kind:"PropertyBinding",name:e.name.slice(1),hole:Z(e,"property binding"),loc:e.loc})},{id:"boolean",match:e=>e[0]==="?",build:e=>uo(e,!0)}];function Su(e,t=lo,n={component:!1}){for(let r of t)if(!(r.elementOnly&&n.component)&&r.match(e.name))return r.build(e);return uo(e,!1)}var ku=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"]),xu=new Set(["script","style","textarea","title"]),Eu=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Au(e){return e.length>0&&(e[0]!==e[0].toLowerCase()||e.includes("."))}var _u=new Set(["a","button","input","select","textarea","summary","details","option","label"]),$u=new Set(["keydown","keyup","keypress"]);function pe(e,t){return e.attributes.find(n=>"name"in n&&n.name===t)}function Tu(e){return e.attributes.some(t=>t.kind==="Spread")}function wt(e,t){let n=pe(e,t);if(!n||n.kind!=="Attribute"||!n.value)return;let r=n.value;return r.kind==="static"?r.value:void 0}function Cu(e){let t=wt(e,"role");return t==="presentation"||t==="none"?!0:wt(e,"aria-hidden")==="true"}function ao(e,t){return e.attributes.some(n=>n.kind==="EventBinding"&&t(n.name))}function Nu(e){let t=[],n=(i,o,s)=>{t.push({code:o,message:s,severity:"warning",loc:i.loc})},r=i=>{for(let o of i){o.kind==="Element"&&Ou(o,n);let s="children"in o?o.children:void 0;s&&r(s)}};return r(e.children),t}function Ou(e,t){if(Tu(e))return;let n=e.tag.toLowerCase();n==="img"&&!pe(e,"alt")&&!Cu(e)&&t(e,"a11y-img-alt",'An `img` needs an `alt`. Use `alt=""` when the image is decorative.'),n==="a"&&!pe(e,"href")&&!pe(e,"role")&&t(e,"a11y-anchor-href","An `a` without `href` is not a link. Use a `button` for an action."),n==="iframe"&&!pe(e,"title")&&t(e,"a11y-iframe-title","An `iframe` needs a `title` describing its content.");let r=wt(e,"tabindex")??wt(e,"tabIndex");r!==void 0&&Number(r)>0&&t(e,"a11y-positive-tabindex","A positive `tabindex` reorders tab navigation for the entire page. Use `0`, or restructure the markup."),!_u.has(n)&&ao(e,i=>i==="click")&&!pe(e,"role")&&!ao(e,i=>$u.has(i))&&t(e,"a11y-click-without-keyboard",`A click handler on \`${n}\` is unreachable by keyboard. Use a \`button\`, or add a \`role\` and a key handler.`)}var Ru=/[A-Za-z0-9\-_:@.?]/,Mu=class{constructor(e,t){this.diagnostics=[],this.r=new wu(e),this.svg=t.svg??!1,this.directives=t.directives??lo,this.accessibility=t.accessibility??!0}parse(){let e=this.r.pos(),t=[];for(;!this.r.eof()&&(t.push(...this.parseChildren()),!this.r.eof());){let r=this.r.pos();this.consumeCloseTag(),this.report("stray-close-tag","error","Close tag without a matching open tag",this.r.span(r))}let n={kind:"Root",children:t,loc:this.r.span(e)};return gu(n),this.validateTree(n),this.accessibility&&this.diagnostics.push(...Nu(n)),{root:n,diagnostics:this.diagnostics}}validateTree(e){let t=n=>{let r=null;for(let i of n)i.kind==="Text"&&/^\s*$/.test(i.value)||(i.kind==="Element"||i.kind==="Component"?(i.attributes.some(s=>s.kind==="ElseDirective")&&(r!=null&&(r.kind==="Element"||r.kind==="Component")&&r.attributes.some(c=>c.kind==="IfDirective")||this.report("else-without-if","error","`else` must immediately follow an element with `if`",i.loc)),r=i):r=null,"children"in i&&i.children&&t(i.children))};t(e.children)}parseChildren(){let e=[];for(;!this.r.eof()&&!this.r.startsWith("</");){if(this.r.startsWith("<!--")){e.push(this.parseComment());continue}if(this.isFragmentStart()){e.push(this.parseFragment());continue}if(this.isDynamicTagStart()){e.push(this.parseDynamicComponent());continue}if(this.isTagStart()){e.push(this.parseElement());continue}if(this.r.atHole()){let n=this.r.takeHole(),r={kind:"Expression",hole:n.index,loc:n.loc};e.push(r);continue}let t=this.readText();t&&e.push(t)}return e}isTagStart(){return this.r.peek()==="<"&&/[A-Za-z]/.test(this.r.peek(1))}isFragmentStart(){return this.r.peek()==="<"&&this.r.peek(1)===">"}isDynamicTagStart(){return this.r.peek()==="<"&&this.r.holeFollows()}parseDynamicComponent(){let e=this.r.pos();this.r.advance();let t=this.r.takeHole().index,n=this.parseAttributes(!0);this.r.skipWhitespace();let r=!1,i=[];return this.r.startsWith("/>")?(this.r.advance(),this.r.advance(),r=!0):(this.r.peek()===">"&&this.r.advance(),i=this.parseChildren(),this.r.startsWith("</")?(this.r.advance(),this.r.advance(),this.r.atHole()?this.r.takeHole():this.readName(),this.r.skipWhitespace(),this.r.peek()===">"&&this.r.advance()):this.report("unclosed-tag","error","Unclosed dynamic component",this.r.span(e))),{kind:"Component",tag:"",tagHole:t,attributes:n,children:i,selfClosing:r,loc:this.r.span(e)}}readText(){let e=this.r.pos(),t="";for(;!this.r.eof()&&!this.r.atHole()&&!(this.r.startsWith("</")||this.r.startsWith("<!--")||this.isTagStart()||this.isFragmentStart()||this.isDynamicTagStart());)t+=this.r.advance();return t?{kind:"Text",value:t,raw:!1,loc:this.r.span(e)}:null}parseComment(){let e=this.r.pos();this.r.advance(),this.r.advance(),this.r.advance(),this.r.advance();let t="";for(;!this.r.eof()&&!this.r.startsWith("-->");){if(this.r.atHole()){this.r.takeHole(),t+="\0";continue}t+=this.r.advance()}return this.r.startsWith("-->")?(this.r.advance(),this.r.advance(),this.r.advance()):this.report("unclosed-comment","warning","Unterminated comment",this.r.span(e)),{kind:"Comment",value:t,loc:this.r.span(e)}}parseFragment(){let e=this.r.pos();this.r.advance(),this.r.advance();let t=this.parseChildren();if(this.r.startsWith("</")){let n=this.consumeCloseTag();n&&this.report("mismatched-close-tag","error",`Expected </> to close fragment, got </${n}>`,this.r.span(e))}else this.report("unclosed-tag","error","Unterminated fragment",this.r.span(e));return{kind:"Fragment",children:t,loc:this.r.span(e)}}parseElement(){let e=this.r.pos();this.r.advance();let t=this.readName(),n=Au(t),r=this.parseAttributes(n);this.foldEachKey(r,e),this.r.skipWhitespace();let i=t.toLowerCase(),o=!n&&xu.has(i),s=!n&&Eu.has(i),c=!1,a=[];if(this.r.startsWith("/>"))this.r.advance(),this.r.advance(),c=!0;else if(this.r.peek()===">"&&this.r.advance(),!s)if(a=o?this.parseRawText(t):this.parseChildren(),this.r.startsWith("</")){let f=this.consumeCloseTag();f&&f!==t&&this.report("mismatched-close-tag","error",`Expected </${t}>, got </${f}>`,this.r.span(e))}else this.report("unclosed-tag","error",`Unclosed <${t}>`,this.r.span(e));let u=this.r.span(e);if(n)return{kind:"Component",tag:t,tagHole:null,attributes:r,children:a,selfClosing:c,loc:u};let l=this.svg||ku.has(t)?"svg":"html";return{kind:"Element",tag:t,namespace:l,attributes:r,children:a,selfClosing:c,rawText:o,loc:u}}parseRawText(e){let t=[],n="</"+e.toLowerCase(),r="",i=this.r.pos(),o=()=>{r&&t.push({kind:"Text",value:r,raw:!0,loc:this.r.span(i)}),r=""};for(;!this.r.eof()&&!this.startsWithCloseFor(n);){if(this.r.atHole()){o();let s=this.r.takeHole();t.push({kind:"Expression",hole:s.index,loc:s.loc}),i=this.r.pos();continue}r||(i=this.r.pos()),r+=this.r.advance()}return o(),t}startsWithCloseFor(e){let t=0;for(;t<e.length;){let n=this.r.peek(t);if(n===""||n.toLowerCase()!==e[t])return!1;t++}return!0}parseAttributes(e){let t=[];for(;!this.r.eof()&&(this.r.skipWhitespace(),!(this.r.peek()===">"||this.r.startsWith("/>")));){if(this.r.atHole()){let c=this.r.takeHole();t.push({kind:"Spread",hole:c.index,loc:c.loc});continue}if(this.r.startsWith("...")){let c=this.r.pos();if(this.r.advance(),this.r.advance(),this.r.advance(),this.r.atHole()){let a=this.r.takeHole();t.push({kind:"Spread",hole:a.index,loc:this.r.span(c)})}else this.report("invalid-binding","error","Spread `...` must be followed by ${…}",this.r.span(c));continue}let n=this.r.pos(),r=this.readName();if(!r){this.r.advance();continue}let i=this.r.span(n);this.r.skipWhitespace();let o=null;this.r.peek()==="="&&(this.r.advance(),this.r.skipWhitespace(),o=this.parseAttrValue());let s={name:r,nameLoc:i,value:o,loc:this.r.span(n),report:(c,a)=>this.report(c,"error",a,this.r.span(n))};t.push(Su(s,this.directives,{component:e}))}return t}parseAttrValue(){if(this.r.atHole())return{kind:"hole",hole:this.r.takeHole().index};let e=this.r.peek();return e==='"'||e==="'"?this.classifyParts(this.readQuotedParts(e)):{kind:"static",value:this.r.readWhile(n=>!/[\s>]/.test(n))}}readQuotedParts(e){this.r.advance();let t=[],n="";for(;!this.r.eof()&&this.r.peek()!==e;){if(this.r.atHole()){n&&(t.push({text:n}),n=""),t.push({hole:this.r.takeHole().index});continue}let r=this.r.advance();if(r==="")break;n+=r}return n&&t.push({text:n}),this.r.peek()===e&&this.r.advance(),t}classifyParts(e){let t=e.filter(n=>"hole"in n);return t.length===0?{kind:"static",value:e.map(n=>"text"in n?n.text:"").join("")}:e.length===1?{kind:"hole",hole:t[0].hole}:{kind:"mixed",parts:e}}foldEachKey(e,t){let n=null,r=0,i=0,o=0,s=0;for(let l of e)l.kind==="EachDirective"?(n=l,i++):l.kind==="IfDirective"?r++:l.kind==="ElseDirective"?o++:l.kind==="RefBinding"&&s++;let c=this.r.span(t);i>1&&this.report("duplicate-directive","error","Multiple `each` directives on one element",c),r>1&&this.report("duplicate-directive","error","Multiple `if` directives on one element",c),s>1&&this.report("duplicate-directive","error","Multiple `ref` bindings on one element",c),r>0&&i>0&&this.report("unsupported-combination","error","`if` and `each` cannot both apply to one element — wrap one in another element",c),r>0&&o>0&&this.report("invalid-directive","error","`if` and `else` cannot be on the same element",c);let a=e.findIndex(l=>l.kind==="Attribute"&&l.name==="key");if(!n){a!==-1&&this.report("invalid-directive","error","`key` requires an `each` directive on the same element",c);return}if(a===-1)return;let u=e[a];u.kind==="Attribute"&&u.value&&(u.value.kind==="static"?n.key={static:u.value.value}:u.value.kind==="hole"&&(n.key={hole:u.value.hole})),e.splice(a,1)}readName(){return this.r.readWhile(e=>Ru.test(e))}consumeCloseTag(){this.r.advance(),this.r.advance();let e=this.readName();return this.r.skipWhitespace(),this.r.peek()===">"&&this.r.advance(),e}report(e,t,n,r){this.diagnostics.push({code:e,severity:t,message:n,loc:r})}};function $n(e,t={}){return new Mu(e,t).parse()}function Pu(e){let t=[],n=0;return e.forEach((r,i)=>{t.push({kind:"static",text:r,start:n}),n+=r.length,i<e.length-1&&t.push({kind:"hole",index:i,start:n,end:n})}),t}function fo(e,t={}){return $n(Pu(e),t)}function Du(e){switch(e.kind){case"event":return"event";case"ref":return"ref";case"spread":return"spread";case"class":case"style":return"class-or-style-directive";case"attr":case"prop":return e.reactive?"reactive-prop":e.expr!==void 0?"expression-prop":void 0;default:return"expression-prop"}}function Iu(e){let t=[],n=new Map,r=i=>{switch(i.kind){case"text":return!0;case"expr":return!1;case"component":case"control":for(let o of i.children)r(o);return!1;case"fragment":for(let o of i.children)r(o);return!1;case"element":{let o=!0;for(let c of i.children)r(c)||(o=!1);let s;for(let c of i.props)if(s=Du(c),s)break;return!s&&!o&&(s=ju(i)),i.static=!s,s?n.set(i,s):t.push(i),i.static}default:return!1}};for(let i of Array.isArray(e)?e:[e])r(i);return{staticElements:t,reasons:n}}function ju(e){for(let t of e.children){if(t.kind==="expr")return"expression-child";if(t.kind==="component")return"component-child";if(t.kind==="control")return"control-child";if(t.kind==="element"&&!t.static||t.kind==="fragment")return"expression-child"}return"expression-child"}var Tn={kind:"eager"},Lu=["pointerdown","focusin","keydown"],ho=new Set(["eager","idle","visible","interaction","media","never"]),St=class extends Error{};function Hu(e,t){let n=e.slice(5);if(!ho.has(n))throw new St(`Unknown load strategy 'load:${n}'. Expected one of ${[...ho].join(", ")}.`);switch(n){case"eager":return Tn;case"idle":return{kind:"idle"};case"never":return{kind:"never"};case"visible":return t?{kind:"visible",rootMargin:t}:{kind:"visible"};case"interaction":return{kind:"interaction",events:t?Wu(t):[...Lu]};case"media":if(!t)throw new St(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new St(`Unhandled load strategy '${n}'.`)}}function Wu(e){let t=e.split(/[\s,]+/).map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new St("'load:interaction' was given no event names.");return t}function qu(e){return e.kind!=="eager"&&e.kind!=="never"}var Cn=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],Nn=["Suspense","SuspenseList","Await"],On=["Router","Outlet","Redirect","Link"],_f=[...Cn,...Nn,...On],po=new Set([...Cn,...Nn]);function Vu(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:n="@fluixi/core",routerModule:r="@fluixi/core/router"}=e,i={};for(let o of Cn)i[o]=t;for(let o of Nn)i[o]=n;for(let o of On)i[o]=r;return i}function Fu(e,t={}){let{resolver:n,isBound:r,modules:i,strategyFor:o}=t,s=Vu(i),c=new Map,a=new Set,u=f=>{let{name:d}=f;if(!d||d.includes(".")||r?.(d))return;let y=l(d);if(!y){a.add(d);return}let b=y.origin==="builtin"&&po.has(d)?Tn:o?.(f)??Tn;f.source={...y,loading:b},c.set(d,f.source)},l=f=>{if(po.has(f))return{module:s[f],export:f,origin:"builtin"};let d=n?.resolve(f);if(d)return{module:d.module,export:d.export,origin:"rule"};if(On.includes(f))return{module:s[f],export:f,origin:"builtin"}};return Rn(e,f=>{f.kind==="component"&&u(f)}),{resolved:c,unresolved:[...a]}}function Rn(e,t){let n=Array.isArray(e)?e:[e];for(let r of n){t(r);let i=r.children;i&&Rn(i,t)}}function Bu(e){let t=[];Rn(e,o=>{o.kind==="component"&&o.source&&t.push(o)});let n=new Set,r=new Set;for(let o of t){let{module:s,loading:c}=o.source;c.kind==="eager"&&n.add(s),c.kind==="never"&&r.add(s)}let i=new Map;for(let o of t){let s=o.source;qu(s.loading)&&n.has(s.module)&&(s.loading={kind:"eager"},i.set(s.module,(i.get(s.module)??0)+1))}return{collapsed:i,conflicted:[...r].filter(o=>n.has(o))}}var Uu=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ko={className:"class",htmlFor:"for"},zu=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),Ku=new Set(["script","style","textarea","title"]);function xo(e){return Ku.has(e)}function Ju(e){return ko[e]??e}function Mn(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!zu.has(e.name)}function Eo(e){if(!e.static||xo(e.tag))return!1;for(let t of e.props)if(!Mn(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&Eo(t)))return!1;return!0}function Pn(e){let t=e.props.map(Xu).filter(Boolean).join(""),n=`<${e.tag}${t}>`;return Uu.has(e.tag)?n:`${n}${e.children.map(Gu).join("")}</${e.tag}>`}function Gu(e){if(e.kind==="text")return Zu(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return Pn(e)}function Xu(e){let t=ko[e.name]??e.name,n=e.literal;return n===!0||n===void 0?` ${t}`:n===!1||n===null?"":` ${t}="${Yu(String(n))}"`}function Yu(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zu(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mo(e){let t=[],n,r=i=>{n??=i.at?.file,t.push(i.at?.line??0,i.at?.column??0);for(let o of i.children)o.kind==="element"&&r(o)};return r(e),n&&t.some(i=>i!==0)?{file:n,pos:t}:void 0}var Qu="<!--fx-->",el="<!--fx/-->";function Et(e){return e.kind==="expr"||e.kind==="component"||e.kind==="control"}function tl(e){return e.kind==="text"||e.kind==="element"&&Ao(e)}function Ao(e){return e.svg||xo(e.tag)||!e.props.every(t=>Mn(t))?!1:e.children.every(t=>tl(t)||Et(t))}function kt(e){if(Et(e))return!0;let t=e.children;return t?t.some(kt):!1}function _o(e){for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.kind==="text"&&(n.value===""||e.children[t+1]?.kind==="text"))return!1}return e.children.every(t=>t.kind!=="element"||_o(t))}function nl(e){if(!Ao(e)||!_o(e)||!e.children.some(kt))return null;let t=[],n=[],r=0,i=s=>{let c=`_n$${r++}`;return t.push({ref:c,expr:s}),c};return o(e,"_el$"),{html:rl(e),tag:e.tag,steps:t,holes:n};function o(s,c){let a=-1;s.children.forEach((l,f)=>{kt(l)&&(a=f)});let u=null;for(let l=0;l<=a;l++){let f=s.children[l],d=u?`${u}.nextSibling`:`${c}.firstChild`;if(Et(f)){let b=i(d),v=i(`holeEnd(${b})`);n.push({parentRef:c,startRef:b,endRef:v,node:f}),u=v;continue}let y=i(d);f.kind==="element"&&kt(f)&&o(f,y),u=y}}}function rl(e){return Pn($o(e)).split(To).join(Qu+el)}function $o(e){return{...e,children:e.children.map(t=>Et(t)?{kind:"text",value:To}:t.kind==="element"?$o(t):t)}}var To="\0fx-hole\0",Co={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},$f={version:2,module:"@fluixi/dom",symbols:[...Co.symbols,"template","cloneTemplate","walk"]},ne="@fluixi/reactive/signal",il={$signal:{export:"signal",module:ne,returns:"signal-handle"},$memo:{export:"memo",module:ne,returns:"memo-handle"},$effect:{export:"effect",module:ne,returns:"effect"},$store:{export:"store",module:"@fluixi/reactive/store",returns:"store-handle"},$resource:{export:"resource",module:ne,returns:"resource-handle"},$selector:{export:"createSelector",module:ne,returns:"memo-accessor"},$deferred:{export:"createDeferred",module:ne,returns:"memo-accessor"},$untrack:{export:"untrack",module:ne,returns:"plain"},$untrackStore:{export:"untrackStore",module:"@fluixi/reactive/store",returns:"plain"}},Tf=new RegExp(`\\$(?:${Object.keys(il).map(e=>e.slice(1)).join("|")})\\s*\\(`),ol="__fx_source",sl="__fx_hole",xt=(e,t,n,r)=>`(globalThis.${sl} ?? ((f) => f))(${e},${t},${n}${r===void 0?"":`,${JSON.stringify(r)}`})`,cl="__fx_props",al=(e,t)=>`(globalThis.${cl} ?? ((p) => p))(${e},${JSON.stringify(t)})`;function No(e,t){let n=e[t];for(let r=t+1;r<e.length;r++){let i=e[r];if(i==="\\")r++;else{if(i===n)return r+1;if(i===`
3
+ `)return-1}}return-1}function Oo(e,t){let n=t+1;for(;n<e.length;){let r=e[n];if(r==="\\")n+=2;else{if(r==="`")return n+1;if(r==="$"&&e[n+1]==="{"){let i=1;for(n+=2;n<e.length&&i>0;){let o=e[n];if(o==="\\")n+=2;else if(o==="`"){let s=Oo(e,n);if(s<0)return-1;n=s}else if(o==='"'||o==="'"){let s=No(e,n);if(s<0)return-1;n=s}else o==="{"?i++:o==="}"&&i--,n++}}else n++}}return-1}function ul(e,t){let n=!1;for(let r=t+1;r<e.length;r++){let i=e[r];if(i==="\\")r++;else if(i==="[")n=!0;else if(i==="]")n=!1;else{if(i===`
4
+ `)return-1;if(i==="/"&&!n){let o=r+1;for(;o<e.length&&/[a-z]/i.test(e[o]);)o++;return o}}}return-1}function ll(e){return e!==""&&/[A-Za-z0-9_$)\]]/.test(e)}function fl(e){let t=0,n="",r=0;for(;r<e.length;){let i=e[r];if(i==='"'||i==="'"){let o=No(e,r);if(o<0)return null;r=o,n=i}else if(i==="`"){let o=Oo(e,r);if(o<0)return null;r=o,n=i}else{if(i==="/"&&e[r+1]==="/")return null;if(i==="/"&&e[r+1]==="*"){let o=e.indexOf("*/",r+2);if(o<0)return null;r=o+2}else if(i==="/"&&!ll(n)){let o=ul(e,r);if(o<0)return null;r=o,n="/"}else{if(i==="("||i==="["||i==="{")t++;else if(i===")"||i==="]"||i==="}"){if(t--,t<0)return null}else if(i===","&&t===0)return!0;/\s/.test(i)||(n=i),r++}}}return t===0?!1:null}function C(e,t){let n=e.trim();return n===""?`(${e})`:t==="arrowBody"&&n[0]==="{"?`(${e})`:fl(n)===!1?e:`(${e})`}var dl={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};function hl(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function Ro(e){return hl(e)?e:JSON.stringify(e)}function pl(e){if(e.expr!==void 0){if(e.name==="ref"&&e.at)return xt(C(e.expr,"value"),e.at.line,e.at.column,e.expr);if(!e.reactive)return C(e.expr,"value");let t=`() => ${C(e.expr,"arrowBody")}`;return e.at?xt(t,e.at.line,e.at.column,e.directive):t}return JSON.stringify(e.literal??!0)}function ml(e){return e.expr!==void 0?C(e.expr,"value"):JSON.stringify(e.literal??!0)}function yl(e,t,n){let r=e.filter(c=>c.kind==="spread"),o=e.filter(c=>c.kind!=="spread").map(c=>`${Ro(c.name)}: ${pl(c)}`);t!=null&&o.push(`children: ${t}`);let s=`{ ${o.join(", ")} }`;return r.length>0?(n.add("mergeProps"),`mergeProps(${r.map(c=>c.expr).join(", ")}, ${s})`):s}function yo(e,t){return t?xt(e,t.line,t.column):e}function Mo(e,t,n){return e.length===1?De(e[0],t,n):`[${e.map(r=>De(r,t,n)).join(", ")}]`}function vo(e,t,n,r,i,o){r.add("createMemo"),r.add("createComponent");let s=t.filter(d=>d.kind==="spread"),c=t.filter(d=>d.kind!=="spread"),a=c.map(d=>`get ${Ro(d.name)}() { return ${ml(d)}; }`);n.length>0&&a.push(`get children() { return ${Mo(n,r,i)}; }`);let u=`{ ${a.join(", ")} }`;s.length>0&&(r.add("mergeProps"),u=`mergeProps(${s.map(d=>d.expr).join(", ")}, ${u})`);let l={};for(let d of c)d.at&&(l[d.name]=[d.at.line,d.at.column]);Object.keys(l).length&&(u=al(u,l));let f=o?`globalThis.${ol}?.(${JSON.stringify(o.file)},${o.line},${o.column},${JSON.stringify(e)}), `:"";return`createMemo(${C(`${f}() => createComponent(${e}, ${u})`,"value")})`}function vl(e,t){let n=Ju(t.name),r=t.literal;return r===!0||r===void 0?`${e}.setAttribute(${JSON.stringify(n)}, "");`:r===!1||r===null?"":`${e}.setAttribute(${JSON.stringify(n)}, ${JSON.stringify(String(r))});`}var Po=!1;function De(e,t,n){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":{if(!e.reactive)return C(e.code,"value");let r=`() => ${C(e.code,"arrowBody")}`;return e.at?xt(r,e.at.line,e.at.column):r}case"fragment":return e.children.length===0?"null":Mo(e.children,t,n);case"component":return yo(vo(e.name,e.props,e.children,t,n,e.at),e.bindAt??e.at);case"control":{let r=dl[e.control]??e.control;return t.add(r),yo(vo(r,e.props,e.children,t,n),e.bindAt)}case"element":{if(n&&e.static&&!e.svg&&Eo(e)){t.add("templateNode");let c=`_tmpl$${n.length}`;n.push({id:c,html:Pn(e),tag:e.tag,svg:!1});let a=mo(e);return a?`templateNode(${c}, ${JSON.stringify(e.tag)}, false, false, ${JSON.stringify(a)})`:`templateNode(${c}, ${JSON.stringify(e.tag)})`}if(n&&Po){let c=nl(e);if(c){t.add("templateNode"),t.add("insert"),t.add("holeEnd"),t.add("holeContent"),t.add("holeScope");let a=`_tmpl$${n.length}`;n.push({id:a,html:c.html,tag:c.tag,svg:!1});let u=mo(e),l=[`const _el$ = templateNode(${a}, ${JSON.stringify(c.tag)}, true${u?`, false, ${JSON.stringify(u)}`:""});`];for(let f of c.steps)l.push(`const ${f.ref} = ${f.expr};`);for(let f of c.holes)l.push(`insert(${f.parentRef}, holeScope(${f.startRef}, () => ${C(De(f.node,t,n),"arrowBody")}), ${f.endRef}, holeContent(${f.startRef}, ${f.endRef}));`);return l.push("return _el$;"),`(() => { ${l.join(" ")} })()`}}t.add("createNativeElement");let r=JSON.stringify(e.tag),i="_el$",o=[],s=e.at?`${r}, ${e.svg}, ${JSON.stringify(e.at)}`:e.svg?`${r}, true`:r;if(o.push(`const ${i} = createNativeElement(${s});`),e.props.length>0)if(!e.svg&&e.props.every(Mn))for(let c of e.props)o.push(vl(i,c));else{t.add("spread");let c=e.svg?", isSVG: true":"";o.push(`spread({ element: ${i}, props: ${yl(e.props,null,t)}${c} });`)}for(let c of e.children){t.add("insert");let a=De(c,t,n),u=c.kind==="expr"&&c.reactive||c.kind==="component"||c.kind==="control";o.push(u?`insert(${i}, ${a}, null);`:`insert(${i}, ${a});`)}return o.push(`return ${i};`),`(() => { ${o.join(" ")} })()`}}}function Do(e,t){if(!t||t.length===0)return e;let n=new Map(t.map(r=>[r.id,JSON.stringify(r.html)]));return e.replace(/_tmpl\$\d+/g,r=>n.get(r)??r)}var Io={name:"imperative",contract:Co,emit(e,t){let n=new Set,r=t?.templateClone!==!1?[]:void 0;return Po=t?.partialTemplates===!0,{code:De(e,n,r),imports:Array.from(n),templates:r}}},gl=e=>"components"in e;function go(e,t){return e.replace(/\$(\d+)/g,(n,r)=>t[Number(r)]??n)}function bl(e,t){return typeof t=="string"?{module:t,export:e}:t}function wl(e=[]){let t=new Map,n=[],r=[];for(let s of e){if(!gl(s)){r.push(s);continue}for(let[c,a]of Object.entries(s.components)){let u=bl(c,a),l=t.get(c);if(l&&l.module!==u.module){let f=n.find(d=>d.name===c);f?f.modules.push(u.module):n.push({name:c,modules:[l.module,u.module]});continue}t.set(c,u)}}let i=new Map;return{resolve:s=>{if(i.has(s))return i.get(s);let c=t.get(s);if(!c)for(let a of r){let u=s.match(new RegExp(a.match.source,a.match.flags.replace("g","")));if(u){c={module:go(a.module,u),export:a.export?go(a.export,u):s};break}}return i.set(s,c),c},names:()=>[...t.keys()],conflicts:()=>n}}function bo(e){let t=e.split(/\r\n|\n|\r/),n=0;for(let i=0;i<t.length;i++)/[^ \t]/.test(t[i])&&(n=i);let r="";for(let i=0;i<t.length;i++){let o=t[i].replace(/\t/g," ");i!==0&&(o=o.replace(/^ +/,"")),i!==t.length-1&&(o=o.replace(/ +$/,"")),o&&(i!==n&&(o+=" "),r+=o)}return r}var wo=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);function Sl(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function So(e){return e.charAt(0).toUpperCase()+e.slice(1)}var kl=class{constructor(e,t,n,r){this.holes=e,this.used=t,this.sourceFile=n,this.positionAt=r}tagAt(e){let t=e.loc?.start;if(!this.sourceFile||!this.positionAt||t==null)return;let{line:n,column:r}=this.positionAt(t);return{file:this.sourceFile,line:n,column:r}}hole(e){return this.holes[e]??{code:"undefined",reactive:!1}}emit(e){let{code:t,imports:n,templates:r}=Io.emit(e,{});for(let i of n)this.used.add(i);return Do(t,r)}lowerRoot(e){let t=this.lowerChildren(e);return t.length===1?t[0]:{kind:"fragment",children:t}}lowerChildren(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.kind==="Element"||r.kind==="Component"){let o=r.attributes.find(s=>s.kind==="IfDirective");if(o&&o.kind==="IfDirective"){let s=n+1;s<e.length&&this.isBlankText(e[s])&&s++;let c=e[s],a=c&&(c.kind==="Element"||c.kind==="Component")&&c.attributes.some(u=>u.kind==="ElseDirective");t.push(this.lowerIf(r,o.hole,a?c:null)),a&&(n=s);continue}if(r.attributes.some(s=>s.kind==="EachDirective")){t.push(this.lowerEach(r));continue}}let i=this.lowerNode(r);i&&t.push(i)}return t}isBlankText(e){return e.kind==="Text"&&!e.raw&&bo(e.value)===""}lowerNode(e){switch(e.kind){case"Text":{if(e.raw)return{kind:"text",value:e.value};let t=bo(e.value);return t?{kind:"text",value:t}:null}case"Comment":return null;case"Expression":{let t=this.hole(e.hole);return{kind:"expr",code:t.code,reactive:t.reactive,...t.at?{at:t.at}:{}}}case"Fragment":return{kind:"fragment",children:this.lowerChildren(e.children)};case"Element":return this.lowerElement(e);case"Component":return this.lowerComponent(e);default:return null}}lowerElement(e){let t=e.attributes.find(r=>r.kind==="Attribute"&&r.name==="is");if(e.tag==="component"&&t&&t.value&&t.value.kind==="hole"){let r=e.attributes.filter(o=>o!==t),i=this.lowerComponent({...e,kind:"Component",tag:"Dynamic",tagHole:null,attributes:r});return i.props.unshift({name:"component",kind:"attr",expr:`() => ${C(this.hole(t.value.hole).code,"arrowBody")}`}),i}let n=this.tagAt(e);return{kind:"element",tag:e.tag,svg:e.namespace==="svg",props:this.lowerAttributes(e.attributes),children:this.lowerChildren(e.children),static:!1,...n?{at:n}:{}}}lowerComponent(e){let t=e.tagHole!=null?this.hole(e.tagHole).code:e.tag,n=this.lowerAttributes(e.attributes),{slots:r,rest:i}=this.partitionSlots(e.children);for(let[u,l]of r){let f=l.length===1?l[0]:{kind:"fragment",children:l},d={name:u,kind:"attr",expr:this.emit(f),jsxElement:!0},y=n.findIndex(b=>b.name===u);y>=0?n[y]=d:n.push(d)}let o=e.attributes.find(u=>u.kind==="LoadDirective"),s=o?Hu(`load:${o.strategy}`,o.modifier):void 0,c=n.find(u=>u.at&&u.reactive)?.at,a=this.tagAt(e);return{kind:"component",name:t,props:n,children:this.lowerChildren(i),...a?{at:a}:{},...c?{bindAt:c}:{},...s?{load:s}:{}}}partitionSlots(e){let t=new Map,n=[];for(let r of e){if(r.kind==="Element"||r.kind==="Component"){let i=r.attributes.find(o=>o.kind==="Attribute"&&o.name==="slot");if(i&&i.value&&i.value.kind==="static"){let o={...r,attributes:r.attributes.filter(a=>a!==i)},s=o.kind==="Element"?this.lowerElement(o):this.lowerComponent(o),c=t.get(i.value.value)??[];c.push(s),t.set(i.value.value,c);continue}}n.push(r)}return{slots:t,rest:n}}lowerIf(e,t,n){let r=this.hole(t),i=[{name:"when",kind:"attr",expr:r.code,reactive:r.reactive,...r.at?{at:r.at}:{}}];if(n){let c=this.stripAndLower(n,a=>a.kind==="ElseDirective");i.push({name:"fallback",kind:"attr",expr:this.emit(c),jsxElement:!0})}let o=this.stripAndLower(e,c=>c.kind==="IfDirective"),s=this.tagAt(e);return{kind:"component",name:"Show",props:i,children:[o],...s?{at:s}:{},...r.at?{bindAt:r.at}:{}}}lowerEach(e){let t=e.attributes.find(a=>a.kind==="EachDirective");if(!t||t.kind!=="EachDirective")return this.lowerNode(e);let n=this.hole(t.hole),r=[{name:"each",kind:"attr",expr:n.code,reactive:n.reactive,...n.at?{at:n.at}:{}}];if(t.key){let a="static"in t.key?`(item) => item[${JSON.stringify(t.key.static)}]`:this.hole(t.key.hole).code;r.push({name:"by",kind:"attr",expr:a})}let i=this.itemArrow(e),o;if(i){let a={kind:"expr",code:i.body,reactive:i.bodyReactive},u=this.rebuildWithChildren(e,[a]);o=`(${i.params.join(", ")}) => ${C(this.emit(u),"arrowBody")}`}else{let a=this.stripAndLower(e,u=>u.kind==="EachDirective");o=`() => ${C(this.emit(a),"arrowBody")}`}let s=[{kind:"expr",code:o,reactive:!1}],c=this.tagAt(e);return{kind:"component",name:"For",props:r,children:s,...c?{at:c}:{},...n.at?{bindAt:n.at}:{}}}itemArrow(e){let t=e.children.filter(n=>!this.isBlankText(n));return t.length!==1||t[0].kind!=="Expression"?null:this.hole(t[0].hole).arrow??null}stripAndLower(e,t){let n={...e,attributes:e.attributes.filter(r=>!t(r))};return n.kind==="Element"?this.lowerElement(n):this.lowerComponent(n)}rebuildWithChildren(e,t){let n=this.lowerAttributes(e.attributes.filter(r=>r.kind!=="EachDirective"));if(e.kind==="Element"){let r=this.tagAt(e);return{kind:"element",tag:e.tag,svg:e.namespace==="svg",props:n,children:t,static:!1,...r?{at:r}:{}}}return{kind:"component",name:e.tag,props:n,children:t}}lowerAttributes(e){let t=[],n=[],r=!1,i,o=[],s=!1,c,a=[];for(let u of e)switch(u.kind){case"IfDirective":case"EachDirective":case"ElseDirective":break;case"Attribute":t.push(this.plainAttr(u));break;case"PropertyBinding":t.push({name:u.name,kind:"prop",expr:this.hole(u.hole).code,reactive:this.hole(u.hole).reactive,...this.hole(u.hole).at?{at:this.hole(u.hole).at}:{}});break;case"EventBinding":t.push(this.eventProp(u));break;case"RefBinding":t.push({name:"ref",kind:"ref",expr:this.hole(u.hole).code,reactive:this.hole(u.hole).reactive,...this.hole(u.hole).at?{at:this.hole(u.hole).at}:{}});break;case"Spread":t.push({name:"",kind:"spread",expr:this.hole(u.hole).code});break;case"ClassDirective":{let l=this.hole(u.hole);n.push(`${JSON.stringify(u.name)}: ${l.code}`),r=r||l.reactive,i??=l.at;break}case"StyleDirective":{let l=this.hole(u.hole);o.push(`${JSON.stringify(u.name)}: ${l.code}`),s=s||l.reactive,c??=l.at;break}case"BindDirective":t.push(...this.bindProps(u.name,this.hole(u.hole)));break;case"UseDirective":{let l=u.name??(u.hole!=null?this.hole(u.hole).code:null);if(!l)break;a.push(u.name!=null&&u.hole!=null?`[${l}, () => ${C(this.hole(u.hole).code,"arrowBody")}]`:`[${l}]`);break}}return n.length>0&&t.push({name:"classList",kind:"attr",expr:`{ ${n.join(", ")} }`,reactive:r,...i?{at:i}:{}}),o.length>0&&t.push({name:"style",kind:"attr",expr:`{ ${o.join(", ")} }`,reactive:s,...c?{at:c}:{}}),a.length>0&&t.push({name:"use",kind:"attr",expr:`[${a.join(", ")}]`}),t}eventProp(e){let t=e.name.toLowerCase(),n=this.hole(e.hole).code;if(!(e.syntax==="colon"||e.modifiers.length>0))return{name:"on"+So(e.name),kind:"event",event:{name:t,delegated:wo.has(t)},expr:n};let i=this.wrapHandler(n,e.modifiers),o=this.eventOptions(e.modifiers),s=o?`[${i}, ${o}]`:i;return{name:"on:"+t,kind:"attr",expr:s}}wrapHandler(e,t){let n=t.includes("self")?"if (e.target !== e.currentTarget) return; ":"",r=[];return t.includes("prevent")&&r.push("e.preventDefault();"),t.includes("stop")&&r.push("e.stopPropagation();"),!n&&r.length===0?e:`(e) => { ${n}${r.join(" ")} return (${e})(e); }`}eventOptions(e){let t=[];return e.includes("capture")&&t.push("capture: true"),e.includes("once")&&t.push("once: true"),e.includes("passive")&&t.push("passive: true"),t.length?`{ ${t.join(", ")} }`:null}bindProps(e,t){let n=t.code,r=e==="checked",i=r?"change":"input",o=r?"checked":"value";this.used.add("bindPair");let s=`bindPair(${n})`;return[{name:e,kind:"attr",expr:`${s}[0]()`,reactive:!0,directive:`bind:${e}`,...t.at?{at:t.at}:{}},{name:"on"+So(i),kind:"event",event:{name:i,delegated:wo.has(i)},expr:`(e) => ${s}[1](e.target.${o})`}]}plainAttr(e){let t=e.value,n=e.name;e.name==="class"?n=t&&t.kind==="hole"&&this.hole(t.hole).object?"classList":"className":e.name==="html"&&(n="innerHTML");let i={name:n,kind:"attr"};if(t==null)return i.literal=!0,i;if(t.kind==="static")return i.literal=t.value,i;if(t.kind==="hole"){let a=this.hole(t.hole);return i.expr=a.code,i.reactive=a.reactive,a.at&&(i.at=a.at),i}let o=!1,s,c=t.parts.map(a=>{if("text"in a)return Sl(a.text);let u=this.hole(a.hole);return o=o||u.reactive,s??=u.at,"${"+u.code+"}"}).join("");return i.expr="`"+c+"`",i.reactive=o,s&&(i.at=s),i}};function xl(e,t,n,r={}){let{root:i}=$n(e,{svg:r.svg});return new kl(t,n,r.sourceFile,r.positionAt).lowerRoot(i.children)}function El(e){let t=[],n=0;return e.statics.forEach((r,i)=>{if(t.push({kind:"static",text:r,start:n}),n+=r.length,i<e.holes.length){let o=n+e.holes[i].code.length;t.push({kind:"hole",index:i,start:n,end:o}),n=o}}),t}function jo(e,t={}){if(e.statics.length!==e.holes.length+1)throw new Error(`[fluixi] compileTemplate: ${e.statics.length} static runs for ${e.holes.length} holes — a template always has exactly one more.`);return Al(El(e),e.holes,t)}function Al(e,t,n={}){let r=new Set,i=xl(e,[...t],r,{svg:n.svg,...n.sourceFile?{sourceFile:n.sourceFile}:{},...n.positionAt?{positionAt:n.positionAt}:{}});Iu(i),Fu(i,{resolver:wl(n.resolve??[]),modules:{controlFlowModule:n.controlFlowModule??"@fluixi/dom",coreModule:n.coreModule??"@fluixi/core",routerModule:n.routerModule??"@fluixi/core/router"},strategyFor:a=>a.load}),Bu(i);let{code:o,imports:s,templates:c}=Io.emit(i,{templateClone:n.templateClone,partialTemplates:n.partialTemplates});for(let a of s)r.add(a);return n.hoistTemplates?{code:o,imports:[...r],ir:i,templates:c}:{code:Do(o,c),imports:[...r],ir:i}}function _l(e,t){switch(e.kind){case"Attribute":if(e.value&&e.value.kind==="hole")t.set(e.value.hole,"attr");else if(e.value&&e.value.kind==="mixed")for(let n of e.value.parts)"hole"in n&&t.set(n.hole,"attr");return;case"PropertyBinding":t.set(e.hole,"attr");return;case"BindDirective":t.set(e.hole,"bind");return;case"EventBinding":t.set(e.hole,"event");return;case"RefBinding":t.set(e.hole,"ref");return;case"Spread":t.set(e.hole,"spread");return;case"IfDirective":t.set(e.hole,"control");return;case"EachDirective":t.set(e.hole,"control"),e.key&&"hole"in e.key&&t.set(e.key.hole,"attr");return;default:return}}function Dn(e,t,n){for(let r of e)switch(r.kind){case"Expression":t.has(r.hole)||t.set(r.hole,"text");break;case"Element":case"Component":{r.kind==="Component"&&(r.tagHole!==null?t.set(r.tagHole,"component"):r.tag&&n.add(r.tag.split(".")[0]));let i=r.attributes.some(o=>o.kind==="EachDirective");for(let o of r.attributes)_l(o,t);if(i)for(let o of r.children)o.kind==="Expression"&&t.set(o.hole,"render");Dn(r.children,t,n);break}case"Root":case"Fragment":Dn(r.children,t,n);break;default:break}}function Lo(e){let t=new Map,n=new Set;return Dn(e.root.children,t,n),{holes:t,components:n}}var In={..._n,createMemo:Vt},$l=["For","Index","Show","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense"],jn=new Map;function Wo(e){for(let[t,n]of Object.entries(e))jn.set(t,n)}function Tl(e){return e==="text"||e==="attr"||e==="control"}function Cl(e,t){return e.map((n,r)=>{let i=t.get(r)??"text";return i==="render"?{code:`$$v[${r}]`,reactive:!1,arrow:{params:["$$item"],body:`$$v[${r}]($$item)`,bodyReactive:!1}}:typeof n=="function"&&Tl(i)?{code:`$$v[${r}]()`,reactive:!0}:{code:`$$v[${r}]`,reactive:!1}})}function Nl(e){if(jn.has(e))return jn.get(e);let t=globalThis[e];if(t!==void 0)return t;throw new Error(`[fluixi] <${e}> is not defined. Pass it as a hole — <\${${e}} /> — or register it with define({ ${e} }).`)}function Ol(e,t,n){let r=e,i=fo(r,{svg:n}),o=i.diagnostics.filter(v=>v.severity==="error");if(o.length>0)throw new Error(`[fluixi] ${n?"svg":"html"}\`\`: ${o.map(v=>v.message).join("; ")}`);let{holes:s,components:c}=Lo(i),{code:a,imports:u}=jo({statics:r,holes:Cl(t,s)},{svg:n}),l=u.filter(v=>!(v in In));if(l.length>0)throw new Error(`[fluixi] no runtime binding for: ${l.join(", ")}`);let f=Array.from(new Set([...u,...$l])).filter(v=>v in In),d=Array.from(c).filter(v=>!f.includes(v)),y=[...f,...d],b=new Function(...y,"$$v",`return (${a});`);return{run:v=>b(...f.map(_=>In[_]),...d.map(Nl),v)}}var Ho=new WeakMap;function Rl(e){let t="";for(let n of e)t+=typeof n=="function"?"f":"v";return t}function qo(e){return(t,...n)=>{let r=Ho.get(t);r||(r=new Map,Ho.set(t,r));let i=Rl(n),o=r.get(i);return o||(o=Ol(t,n,e),r.set(i,o)),o.run(n)}}var Vo=qo(!1),Fo=qo(!0);return Go(Ml);})();