@fluixi/template-runtime 1.0.0-alpha.107 → 1.0.0-alpha.109

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,4 +1,4 @@
1
- /*! @fluixi/template-runtime v1.0.0-alpha.107 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
- "use strict";var Fluixi=(()=>{var Vt=Object.defineProperty;var Qo=Object.getOwnPropertyDescriptor;var ec=Object.getOwnPropertyNames;var tc=Object.prototype.hasOwnProperty;var mr=(e,t)=>{for(var n in t)Vt(e,n,{get:t[n],enumerable:!0})},nc=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ec(t))!tc.call(e,i)&&i!==n&&Vt(e,i,{get:()=>t[i],enumerable:!(r=Qo(t,i))||r.enumerable});return e};var rc=e=>nc(Vt({},"__esModule",{value:!0}),e);var hd={};mr(hd,{Dynamic:()=>Jn,ErrorBoundary:()=>Yn,For:()=>Fn,Index:()=>zn,Match:()=>Un,Portal:()=>Gn,Show:()=>Vn,Switch:()=>Kn,batch:()=>ee,define:()=>Jo,effect:()=>Si,html:()=>Yo,hydrate:()=>Ve,insert:()=>I,memo:()=>wi,onCleanup:()=>Ne,render:()=>Be,resource:()=>xi,signal:()=>bi,store:()=>Oi,svg:()=>Xo,untrack:()=>ge});var Zn={};mr(Zn,{ALWAYS_ATTRIBUTE:()=>Yi,ClientOnly:()=>Js,Dynamic:()=>Jn,ErrorBoundary:()=>Yn,FX_DATA_ID:()=>Wn,For:()=>Fn,HYDRATION_KEY:()=>re,Index:()=>zn,Island:()=>ll,JSX_PROPERTIES:()=>mn,Match:()=>Un,NoSsr:()=>vl,Portal:()=>Gn,SERVER_PROPS:()=>Ji,SVG_ELEMENTS:()=>ja,SVG_NAMESPACE:()=>xn,Show:()=>Vn,Switch:()=>Kn,VERSION:()=>ss,VERSION_ATTRIBUTE:()=>os,VOID_ELEMENTS:()=>La,addClass:()=>Xi,addDelegatedEventListener:()=>Tn,addNativeEventListener:()=>Ln,appendChildren:()=>is,appendResponseHeader:()=>uu,applyElementProp:()=>pn,applyProps:()=>Hn,applyUse:()=>jn,asComponent:()=>Nn,asContext:()=>$u,asOutlet:()=>Au,asProvider:()=>_u,asRoute:()=>Eu,asRouter:()=>xu,asRoutes:()=>ku,asSuspense:()=>Ou,beginAppHydration:()=>pu,bindPair:()=>qs,captureHydrationCursor:()=>du,checkRenderType:()=>Cu,classMap:()=>gl,cleanChildren:()=>G,clearHydrationKeys:()=>ws,cloneTemplate:()=>In,closest:()=>Wa,createComponent:()=>Pt,createDynamicElement:()=>Ks,createElement:()=>ns,createNativeElement:()=>Mt,createPortal:()=>Ls,createRequestContext:()=>En,createTemplate:()=>Rn,css:()=>ml,default:()=>Hl,deferElement:()=>Nu,delegate:()=>Ka,delegateEvents:()=>Rt,endAppHydration:()=>mu,endRequestContext:()=>An,escapeFxJson:()=>Bs,escapeHTML:()=>Xu,fnName:()=>Vu,generateID:()=>Pu,getAttribute:()=>es,getGlobal:()=>nu,getLocals:()=>cu,getOffset:()=>Ua,getRequestContext:()=>X,getRequestEvent:()=>$n,getRequestLocals:()=>hs,getServerData:()=>Vs,getStableElementId:()=>Mu,getStyle:()=>Va,handleRef:()=>We,hasClass:()=>Ba,holeContent:()=>Dn,holeEnd:()=>Pn,holeScope:()=>Mn,html:()=>hl,hydrate:()=>Ve,hydrateAdvancePast:()=>Cn,hydrateChildren:()=>ul,hydrateIslands:()=>dl,indexArray:()=>tt,initializeIntegration:()=>tl,insert:()=>I,insertExpression:()=>De,intergartionInitialized:()=>nl,isAccessor:()=>Zu,isAppHydrationPending:()=>yu,isAttributeOnlyName:()=>mt,isComponent:()=>B,isContext:()=>Os,isCustomElement:()=>Ki,isDOMNode:()=>eu,isDelegatedEvent:()=>qu,isDomElement:()=>zi,isDomNode:()=>He,isDomText:()=>Ui,isEventHandler:()=>Da,isFunction:()=>Hu,isIntegrationInitialized:()=>Hs,isJSXTemplate:()=>Qa,isNativeElement:()=>Yu,isOutlet:()=>_s,isPromise:()=>Te,isProvider:()=>$s,isReactElement:()=>Za,isRoute:()=>As,isRouter:()=>ks,isRoutes:()=>Es,isSVGElement:()=>js,isServer:()=>$,isSuspense:()=>Cs,isVisible:()=>Fa,iterateFn:()=>Fu,keyArray:()=>et,makeArrayFlat:()=>Rs,mapArray:()=>Qe,mergeProps:()=>Ds,observeIntersection:()=>Ga,observeResize:()=>Ya,onRequestEnd:()=>ou,query:()=>yn,queryAll:()=>Ha,registerCoreVersion:()=>ru,registerCreateComponent:()=>el,registerGlobal:()=>tu,removeAttribute:()=>ts,removeChildren:()=>rs,removeClass:()=>Zi,removeDelegatedEventListener:()=>_t,removeUnclaimedKeyed:()=>Ss,render:()=>Be,renderToString:()=>Pl,renderToStringAsync:()=>jl,resetIntegration:()=>Ws,runHydrationAt:()=>St,runWithRequestContext:()=>_n,runWithoutHydration:()=>hu,scrollIntoView:()=>za,serializeNode:()=>ne,serializeResourceData:()=>co,serverCustomElementProp:()=>vt,setAttribute:()=>H,setClassList:()=>ae,setClassName:()=>Se,setDataRedactor:()=>Il,setDynamicAttribute:()=>Ie,setDynamicBoolAttribute:()=>qn,setDynamicClassList:()=>Gu,setDynamicProperty:()=>Le,setDynamicStyle:()=>Ju,setKeyScope:()=>Su,setProperty:()=>ce,setRequestStore:()=>fs,setRequestStoreIfUnset:()=>su,setServerMode:()=>Me,setStyle:()=>ie,setStyles:()=>kn,shouldSetAsProperty:()=>Ia,splitProps:()=>Is,spread:()=>Ps,stampVersions:()=>as,styleMap:()=>wl,svg:()=>pl,takeResponseHeaders:()=>lu,takesBooleanText:()=>Gi,templateNode:()=>Ts,toAttributeName:()=>Pa,toggleClass:()=>Qi,versionMark:()=>cs,versions:()=>q,waitForElement:()=>Ja,warnOnVersionSkew:()=>us,whenAppHydrated:()=>vu});var zt="1.0.0-alpha.107",Sr=zt.split(".")[0],yr=`__fluixi_signal_state_v${Sr}__`,xr=`__fluixi_signal_builds_v${Sr}__`,ic=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function kr(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:ic,onSuspend:null,onError:null,observer:null}}var Ye=globalThis;function sc(e){let t=kr(),n=e;for(let r of Object.keys(t))r in e||(n[r]=t[r]);return e}function oc(){let e=Ye[yr];return e?sc(e):Ye[yr]=kr()}var m=oc();(Ye[xr]??=[]).push(zt);function Er(){return[...new Set(Ye[xr]??[])]}function cc(e){return m.observer=e,()=>{m.observer===e&&(m.observer=null)}}var D=[],ac,vr;function Ut(e){let t=m.observer;t&&t.created(e.parents===void 0?{...e,parents:D,origin:e.origin??ac,scope:e.scope??vr}:{...e,scope:e.scope??vr})}function uc(e){return m.observer?(D.push(e),!0):!1}function lc(){D.pop()}function fc(e){m.observer?.ran?.(e)}function dc(e,t){m.observer?.wrote?.(e,t)}function N(e,t,n,r){let i=m.observer;!i?.bound||!D.length||i.bound(D[D.length-1],e,t,n,r)}function L(e,t,n,r){let i=m.observer;!i?.directive||!D.length||i.directive(D[D.length-1],e,t,n,r)}function hc(e){m.observer?.contextCreated?.(e)}function pc(e,t,n){let r=m.observer;!r?.context||!D.length||r.context(D[D.length-1],e,t,n)}function Kt(e){m.observer?.disposed?.(e)}var mc="__FLUIXI_DEVTOOLS_HOOK__",gr=globalThis[mc];if(typeof gr?.inject=="function")try{gr.inject({observeReactiveNodes:cc,version:zt})}catch{}function he(){return m.observer!=null}var br=0,wr=1,Ee=2,Ar=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(m.untracked)return;let e=m.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},yc=class extends Ar{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}get value(){return this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,dc(this,m.consumer),this.observers)for(let t of[...this.observers])t.markDirty(Ee);Ft(this)}}peek(){return this._value}},_r=class extends Ar{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this._disposed=!1,this.state=Ee,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(m.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}dispose(){if(!this._disposed&&(this._disposed=!0,this.sources)){for(let e of this.sources)e.observers?.delete(this);this.sources=null}}updateIfNecessary(){if(!this._disposed){if(this.state===wr&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Ee)break}(this.state===Ee||!this._initialized)&&this.recompute(),this.state=br}}recompute(){if(this.sources){for(let c of this.sources)c.observers?.delete(this);this.sources.clear()}let e=m.consumer,t=m.untracked,n=uc(this);m.consumer=this,m.untracked=!1;let r,i=!1,s;try{r=this._fn()}catch(c){i=!0,s=c,r=this._value}finally{m.consumer=e,m.untracked=t,n&&lc()}let o=!this._initialized||this._threw!==i||(i?s!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=i,this._error=s,this._value=r,fc(this),o){if(this.version++,this.observers)for(let c of this.observers)c.markDirty(Ee);Ft(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===br;if(this.state=e,t){if(this.observers)for(let n of this.observers)n.markDirty(wr);Ft(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function Ft(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}function $r(e){if(m.untracked)return e();m.untracked=!0;try{return e()}finally{m.untracked=!1}}function Z(e){let t=_e(e);return e&&(e.owned??=[]).push(t),t}function pe(e,t=!0){Ae(e,t)}function _e(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Or(e,t){let n=Symbol(t??"context");return hc(n),{id:n,defaultValue:e,Provider:i=>{pc(n,"provide",i.value);let s=m.owner,o=_e(s);(o.contexts=new Map).set(n,i.value),s&&(s.owned??=[]).push(o),m.owner=o;try{return i.children}finally{m.owner=s}}}}function Cr(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 vc(e,t,n){let r=_e(m.owner);(r.contexts=new Map).set(e.id,t),m.owner&&(m.owner.owned??=[]).push(r);let i=m.owner;m.owner=r;try{return n()}finally{m.owner=i}}function gc(e){m.onSuspend=e}function bc(e){return m.onSuspend?(m.onSuspend(e,m.owner),!0):!1}function wc(e){m.onError=e}function x(){return m.owner}function E(e,t){let n=m.owner;m.owner=e;try{return t()}finally{m.owner=n}}function A(e){if(m.owner){if(m.owner.disposed){e();return}(m.owner.cleanups??=[]).push(e)}}function Ae(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Ae(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 W(e){let t=_e(m.owner);m.owner&&(m.owner.owned??=[]).push(t);let n=m.owner;m.owner=t;try{return $r(()=>e(()=>Ae(t)))}finally{m.owner=n}}function Sc(e){m.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function xc(e){e.queued||(e.queued=!0,m.queue.push(e),!m.scheduled&&m.batchDepth===0&&(m.scheduled=!0,m.hostSchedule(Ze)))}function Ze(){if(m.scheduled=!1,m.flushing)return;m.flushing=!0;let e=0,t=!1,n;try{for(;m.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let r=m.queue;m.queue=[];for(let i of r)if(i.queued=!1,!i.disposed)try{i.run()}catch(s){t||(t=!0,n=s)}}}finally{m.flushing=!1}if(t)throw n}function kc(){m.batchDepth===0&&Ze()}function Ec(e){m.batchDepth++;try{return e()}finally{--m.batchDepth===0&&Ze()}}var Ac=class extends _r{constructor(e,t=!1,n){let r=null;super(()=>{Ae(r,!1),E(r,()=>{let o=e();typeof o=="function"&&(r.cleanups??=[]).push(o)})}),this.queued=!1,this.disposed=!1;let i=m.owner;this.owner=_e(i),r=this.owner,he()&&Ut({kind:"effect",node:this,handle:this,internal:!t,...n?{name:n}:{}}),this.run();let s=this.owner;if(!this.disposed&&!this.sources?.size&&!s.cleanups&&!s.owned&&!s.contexts&&!he()){this.disposed=!0;return}i&&(i.cleanups??=[]).push(()=>this.dispose())}markDirty(e){let t=this.state===0;super.markDirty(e),t&&this.state!==0&&!this.disposed&&xc(this)}run(){if(!this.disposed)try{this.get()}catch(e){if(e&&typeof e.then=="function"&&m.onSuspend){m.onSuspend(e,this.owner);return}if(m.onError&&m.onError(e,this.owner))return;throw e}}dispose(){this.disposed||(this.disposed=!0,Kt(this),super.dispose(),Ae(this.owner))}};function Nr(e,t=!1,n){let r=new Ac(e,t,n);return()=>r.dispose()}function _c(e){return!!e&&typeof e.then=="function"}Sc(()=>{});var Tr=Symbol.for("signal"),$c=Symbol.for("memo"),Oc=Symbol.for("signal-node");function V(e,t){let n=new yc(e,{equals:t?.equals}),r=(()=>n.get()),i=(s=>{let o=typeof s=="function"?s(n.peek()):s;return n.set(o),kc(),o});return r[Tr]=!0,r[Oc]=n,he()&&Ut({kind:"signal",node:n,handle:r,name:t?.name,set:i}),he()&&A(()=>Kt(n)),[r,i]}function w(e,t,n){let r=t,i=x(),s=new _r(()=>E(i,()=>{try{return r=e(r)}catch(c){if(_c(c))return bc(c),r;throw c}}),{equals:n?.equals}),o=(()=>s.get());return Object.defineProperty(o,Tr,{value:!0,enumerable:!0}),Object.defineProperty(o,$c,{value:!0,enumerable:!0}),he()&&Ut({kind:"memo",node:s,handle:o,name:n?.name}),A(()=>{s.dispose(),he()&&Kt(s)}),o}function F(e,t,n){let r=t;return Nr(()=>{r=e(r)},!0,n?.name)}function S(e,t){let n=t;return Nr(()=>{n=e(n)})}function me(e){return Ec(e)}function T(e){return $r(e)}function Rr(){return Ze(),Promise.resolve()}function Mr(e){let t=e,n=null;return{index:()=>(n||(n=V(t,{name:"row index"})),n[0]()),set:r=>{t=r,n&&n[1](r)}}}function Qe(e,t,n){let r=[];return A(()=>{for(let i of r)i.dispose();r=[]}),w(()=>{let i=e()||[];return T(()=>{if(i.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=new Map;for(let u of r)s.has(u.item)||s.set(u.item,u);let o=[],c=new Set;for(let u=0;u<i.length;u++){let l=i[u],a=s.get(l);if(a&&!c.has(a))a.setIndex(u),o.push(a),c.add(a);else{let f,d,p;W(v=>{p=v;let b=Mr(u);d=b.set,f=t(l,b.index)});let g={item:l,rendered:f,dispose:p,setIndex:d};o.push(g),c.add(g)}}for(let u of r)c.has(u)||u.dispose();return r=o,o.map(u=>u.rendered)})},void 0,{name:"mapArray"})}function et(e,t,n,r){let i=[],s=[];return A(()=>{for(let o of s)o.dispose();i=[],s=[]}),w(()=>{let o=e()||[];return T(()=>{if(o.length===0){for(let f of s)f.dispose();return i=[],s=[],r?.fallback?r.fallback():[]}let c=new Map;for(let f=0;f<i.length;f++)c.set(i[f],s[f]);let u=[],l=[],a=new Set;for(let f=0;f<o.length;f++){let d=t(o[f]),p=c.get(d);if(p&&!a.has(d))p.setIndex(f),p.setItem(o[f]),u.push(p);else{let g,v,b,C;W(le=>{C=le;let fe=Mr(f);v=fe.set;let[Ue,de]=V(o[f]);b=O=>de(()=>O),g=n(Ue,fe.index)}),u.push({rendered:g,dispose:C,setIndex:v,setItem:b})}l.push(d),a.add(d)}for(let[f,d]of c)a.has(f)||d.dispose();return i=l,s=u,u.map(f=>f.rendered)})},void 0,{name:"keyArray"})}function tt(e,t,n){let r=[];return A(()=>{for(let i of r)i.dispose();r=[]}),w(()=>{let i=e()||[];return T(()=>{if(i.length===0){for(let u of r)u.dispose();return r=[],n?.fallback?n.fallback():[]}let s=r.length,o=i.length;for(let u=s;u<o;u++){let l,a,f,d=i[u];W(p=>{f=p;let[g,v]=V(d);a=v,l=t(g,u)}),r.push({rendered:l,setItem:a,dispose:f})}for(let u=o;u<s;u++)r[u].dispose();o<s&&(r=r.slice(0,o));let c=Math.min(s,o);for(let u=0;u<c;u++)r[u].setItem(i[u]);return r.map(u=>u.rendered)})},void 0,{name:"indexArray"})}var Cc=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,Nc=typeof process>"u"?Cc:!1,Tc=Symbol.for("signal");function k(e){return typeof e=="function"&&e[Tc]===!0}var Rc=null;function Pr(e){Rc=e}var Mc=null;function Dr(e){Mc=e}var Pc=null;function nt(e){Pc=e}var Dc=null;function Ir(e){Dc=e}function Lr(){let e=new Map,t=new Map;return{get:n=>e.get(n),set:(n,r)=>{e.set(n,r)},delete:n=>{e.delete(n)},keys:()=>e.keys(),clear:()=>{e.clear(),t.clear()},inflight:t}}var Ic=null;function jr(e){Ic=e}function Xe(e){if(typeof e=="function"&&!e.length){let t=e();return k(t)?t:Xe(t)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=Xe(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function rt(e){let t=w(e);return Nc?w(()=>Xe(t()),void 0,{name:"children"}):w(()=>Xe(t()))}var Lc=Or();gc((e,t)=>{let n=Cr(t,Lc);n&&(n.increment(),e.finally(()=>n.decrement()))});var qr=Or();wc((e,t)=>{let n=Cr(t,qr);return n?(n.setError(e),!0):!1});function Hr(){let[e,t]=V(void 0,{equals:!1});return{error:e,reset:()=>t(()=>{}),setError:r=>t(()=>r)}}function Wr(e,t){return vc(qr,e,t)}var Jt=Symbol.for("fluixi-proxy");var Br="1.0.0-alpha.107";var sn="1.0.0-alpha.107";var ci=sn.split(".")[0],Vr=`__fluixi_signal_state_v${ci}__`,jc=`__fluixi_signal_builds_v${ci}__`,qc=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function ai(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:qc,onSuspend:null,onError:null,observer:null}}var Yt=globalThis;function Hc(e){let t=ai(),n=e;for(let r of Object.keys(t))r in e||(n[r]=t[r]);return e}function Wc(){let e=Yt[Vr];return e?Hc(e):Yt[Vr]=ai()}var y=Wc();(Yt[jc]??=[]).push(sn);function Bc(e){return y.observer=e,()=>{y.observer===e&&(y.observer=null)}}var z=[],it;function Vc(e,t){if(!y.observer)return t();let n=it;it=e;try{return t()}finally{it=n}}var Fr;function dt(e){let t=y.observer;t&&t.created(e.parents===void 0?{...e,parents:z,origin:e.origin??it,scope:e.scope??Fr}:{...e,scope:e.scope??Fr})}function Fc(e){return y.observer?(z.push(e),!0):!1}function zc(){z.pop()}function Uc(e){y.observer?.ran?.(e)}function Kc(e,t){y.observer?.wrote?.(e,t)}function ui(e){let t=y.observer;!t?.props||!z.length||!e||t.props(z[z.length-1],e)}function Jc(e){y.observer?.contextCreated?.(e)}function Gc(e,t,n){let r=y.observer;!r?.context||!z.length||r.context(z[z.length-1],e,t,n)}function zr(e,t,n){y.observer?.moved?.(e,t,n)}function Oe(e){y.observer?.disposed?.(e)}var Yc="__FLUIXI_DEVTOOLS_HOOK__",Ur=globalThis[Yc];if(typeof Ur?.inject=="function")try{Ur.inject({observeReactiveNodes:Bc,version:sn})}catch{}function U(){return y.observer!=null}var Kr=0,Jr=1,$e=2,li=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(y.untracked)return;let e=y.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},Xc=class extends li{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}get value(){return this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,Kc(this,y.consumer),this.observers)for(let t of[...this.observers])t.markDirty($e);Xt(this)}}peek(){return this._value}},fi=class extends li{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this._disposed=!1,this.state=$e,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(y.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}dispose(){if(!this._disposed&&(this._disposed=!0,this.sources)){for(let e of this.sources)e.observers?.delete(this);this.sources=null}}updateIfNecessary(){if(!this._disposed){if(this.state===Jr&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===$e)break}(this.state===$e||!this._initialized)&&this.recompute(),this.state=Kr}}recompute(){if(this.sources){for(let c of this.sources)c.observers?.delete(this);this.sources.clear()}let e=y.consumer,t=y.untracked,n=Fc(this);y.consumer=this,y.untracked=!1;let r,i=!1,s;try{r=this._fn()}catch(c){i=!0,s=c,r=this._value}finally{y.consumer=e,y.untracked=t,n&&zc()}let o=!this._initialized||this._threw!==i||(i?s!==this._error:!this._equals(this._value,r));if(this._initialized=!0,this._threw=i,this._error=s,this._value=r,Uc(this),o){if(this.version++,this.observers)for(let c of this.observers)c.markDirty($e);Xt(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Kr;if(this.state=e,t){if(this.observers)for(let n of this.observers)n.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)}function Zc(e){if(y.untracked)return e();y.untracked=!0;try{return e()}finally{y.untracked=!1}}function di(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function hi(e,t){let n=Symbol(t??"context");return Jc(n),{id:n,defaultValue:e,Provider:i=>{Gc(n,"provide",i.value);let s=y.owner,o=di(s);(o.contexts=new Map).set(n,i.value),s&&(s.owned??=[]).push(o),y.owner=o;try{return i.children}finally{y.owner=s}}}}function pi(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 Qc(e){y.onSuspend=e}function ea(e){return y.onSuspend?(y.onSuspend(e,y.owner),!0):!1}function ta(e){y.onError=e}function na(){return y.owner}function mi(e,t){let n=y.owner;y.owner=e;try{return t()}finally{y.owner=n}}function Ne(e){if(y.owner){if(y.owner.disposed){e();return}(y.owner.cleanups??=[]).push(e)}}function Zt(e,t=!0){if(!e.disposed){if(e.owned){for(let n=e.owned.length-1;n>=0;n--)Zt(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 ra(e){y.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function ia(e){e.queued||(e.queued=!0,y.queue.push(e),!y.scheduled&&y.batchDepth===0&&(y.scheduled=!0,y.hostSchedule(on)))}function on(){if(y.scheduled=!1,y.flushing)return;y.flushing=!0;let e=0,t=!1,n;try{for(;y.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let r=y.queue;y.queue=[];for(let i of r)if(i.queued=!1,!i.disposed)try{i.run()}catch(s){t||(t=!0,n=s)}}}finally{y.flushing=!1}if(t)throw n}function sa(){y.batchDepth===0&&on()}function oa(e){y.batchDepth++;try{return e()}finally{--y.batchDepth===0&&on()}}var ca=class extends fi{constructor(e,t=!1,n){let r=null;super(()=>{Zt(r,!1),mi(r,()=>{let o=e();typeof o=="function"&&(r.cleanups??=[]).push(o)})}),this.queued=!1,this.disposed=!1;let i=y.owner;this.owner=di(i),r=this.owner,U()&&dt({kind:"effect",node:this,handle:this,internal:!t,...n?{name:n}:{}}),this.run();let s=this.owner;if(!this.disposed&&!this.sources?.size&&!s.cleanups&&!s.owned&&!s.contexts&&!U()){this.disposed=!0;return}i&&(i.cleanups??=[]).push(()=>this.dispose())}markDirty(e){let t=this.state===0;super.markDirty(e),t&&this.state!==0&&!this.disposed&&ia(this)}run(){if(!this.disposed)try{this.get()}catch(e){if(e&&typeof e.then=="function"&&y.onSuspend){y.onSuspend(e,this.owner);return}if(y.onError&&y.onError(e,this.owner))return;throw e}}dispose(){this.disposed||(this.disposed=!0,Oe(this),super.dispose(),Zt(this.owner))}};function aa(e,t=!1,n){let r=new ca(e,t,n);return()=>r.dispose()}function ua(e){return!!e&&typeof e.then=="function"}ra(()=>{});var yi=Symbol.for("signal"),la=Symbol.for("memo"),fa=Symbol.for("signal-node");function ye(e,t){let n=new Xc(e,{equals:t?.equals}),r=(()=>n.get()),i=(s=>{let o=typeof s=="function"?s(n.peek()):s;return n.set(o),sa(),o});return r[yi]=!0,r[fa]=n,U()&&dt({kind:"signal",node:n,handle:r,name:t?.name,set:i}),U()&&Ne(()=>Oe(n)),[r,i]}function cn(e,t,n){let r=t,i=na(),s=new fi(()=>mi(i,()=>{try{return r=e(r)}catch(c){if(ua(c))return ea(c),r;throw c}}),{equals:n?.equals}),o=(()=>s.get());return Object.defineProperty(o,yi,{value:!0,enumerable:!0}),Object.defineProperty(o,la,{value:!0,enumerable:!0}),U()&&dt({kind:"memo",node:s,handle:o,name:n?.name}),Ne(()=>{s.dispose(),U()&&Oe(s)}),o}function vi(e,t,n){let r=t;return aa(()=>{r=e(r)},!0,n?.name)}function ee(e){return oa(e)}function ge(e){return Zc(e)}var Sd=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0;var da=Symbol.for("signal");function gi(e){return typeof e=="function"&&e[da]===!0}var Gr=null;function ha(e){Gr&&Gr(e)}var Yr=null;function pa(e){return Yr?Yr(e):void 0}var Xr=null;function ma(){return Xr?Xr():void 0}var Zr=null;function ya(e,t){Zr&&Zr(e,t)}function va(e){return!!e&&typeof e.then=="function"}var Gt=Symbol();function ga(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 s=n.transport===!1?void 0:ma(),o=s!==void 0?pa(s):void 0,c=o!==void 0,[u,l]=ye(o!==void 0?o.value:n.initialValue,{equals:!1}),[a,f]=ye(void 0,{equals:!1}),[d,p]=ye(o!==void 0||n.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[g,v]=ye(void 0,{equals:!1}),[b,C]=ye(void 0,{equals:!1}),le=Gt,fe=!1;vi(()=>{let O=r();if(b(),O===!1||O===null||O===void 0){le=Gt,ee(()=>{p("unresolved"),v(void 0),f(void 0)});return}let Ke=fe;if(fe=!1,le!==Gt&&O===le&&!Ke)return;if(le=O,c){c=!1;return}let Je=!1;Ne(()=>Je=!0);let hr=ge(d),Zo=ge(u),pr=hr==="ready"||hr==="refreshing";ee(()=>{p(pr?"refreshing":"pending"),f(void 0)});try{let oe=i(O,{value:Zo,refetching:pr});va(oe)?(v(oe),ha(oe),oe.then(Ge=>{Je||(s!==void 0&&ya(s,Ge),ee(()=>{l(()=>Ge),p("ready"),v(void 0)}))},Ge=>{Je||ee(()=>{f(Ge),p("errored"),v(void 0)})})):ee(()=>{l(()=>oe),p("ready"),v(void 0)})}catch(oe){if(Je)return;ee(()=>{f(oe),p("errored"),v(void 0)})}});let Ue=()=>{let O=d();return O==="pending"||O==="refreshing"},de=(()=>{let O=a();if(O)throw O;if(Ue()){let Ke=g();if(Ke)throw Ke}return u()});return Object.defineProperties(de,{state:{get:d},loading:{get:Ue},error:{get:a},latest:{get:u}}),Object.defineProperty(de,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(de,Symbol.for("signal"),{value:!0,enumerable:!0}),[de,{mutate:l,refetch:()=>{fe=!0,C(void 0)}}]}var ba=hi();Qc((e,t)=>{let n=pi(t,ba);n&&(n.increment(),e.finally(()=>n.decrement()))});var wa=hi();ta((e,t)=>{let n=pi(t,wa);return n?(n.setError(e),!0):!1});function bi(e,t){let[n,r]=ye(e,t);return n.set=r,n}function wi(e,t,n){return cn(e,t,n)}function Si(e,t,n){return vi(e,t,n)}function xi(...e){let[t,n]=ga(...e);return Object.assign(t,n)}var ct=Symbol("store-raw"),Qr=Symbol("store-node"),ei=Symbol("store-has"),ti=Symbol("store-self"),ni=Symbol("store-track");var Ce=new WeakMap,Qt=new WeakMap,be=new WeakMap,at=new WeakMap;function Sa(e,t){if(!ve(e)||!U())return;let n=new Set,r=o=>{if(!(!ve(o)||n.has(o))){n.add(o);for(let c of Object.values(o))r(c)}};r(at.get(t)??t);let i=new Set,s=o=>{if(!ve(o))return;let c=o;if(n.has(c)||i.has(c))return;i.add(c);let u=Ce.get(c);if(u){for(let l of u.keys.values())Oe(l);u.all&&Oe(u.all),Ce.delete(c),be.delete(c),Qt.delete(c)}for(let l of Object.values(c))s(l)};s(e)}var ut=(e,t,n)=>n?`${e}[${String(t)}]`:`${e}.${String(t)}`;function ki(e,t,n){let r=t?.owner,i=r&&n!==void 0?ut(r.name,n,t?.array):void 0,[s,o]=Vc(r?.store,()=>V(e,i?{name:i}:void 0)),c=s;return c.$=o,c}function lt(e){let t=Ce.get(e);return t?t.owner||(t.owner=be.get(e)):Ce.set(e,t={keys:new Map,owner:be.get(e),array:Array.isArray(e)}),t}function ri(e,t,n){let r=e.keys.get(t);return r||e.keys.set(t,r=ki(n,e,t)),r}function xa(e,t,n,r){let i=be.get(e);if(i&&i.store===t&&i.name===n)return;let s={store:t,name:n};be.set(e,s),at.set(e,at.get(r)??r);let o=Ce.get(e);if(o&&(o.owner=s,!!U())){for(let[c,u]of o.keys)zr(u,t,ut(n,c,o.array));o.all&&zr(o.all,t,ut(n,"*",o.array))}}function ii(e){let t=lt(e);(t.all||(t.all=ki(void 0,t,"*")))()}function si(e,t){e.$(typeof t=="function"?()=>t:t)}function ve(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 st(e){if(!ve(e))return e;let t=Qt.get(e);if(t)return t;let n=new Proxy(e,ka);return Qt.set(e,n),n}var ka={get(e,t,n){if(t===ct||t===Qr)return e;if(t===Jt)return n;if(t===ei)return u=>u in e;if(t==="__proxy")return!0;if(t===ni||t===ti)return ii(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 s=lt(e),o=ri(s,t,r),c=o();return ve(c)?(s.owner&&xa(c,o,ut(s.owner.name,t,s.array),e),st(c)):c},set(){return!0},deleteProperty(e,t){return t in e&&j(e,t,void 0),!0},has(e,t){return t===ct||t===Jt||t===Qr||t===ei||t===ti||t===ni?!0:(ri(lt(e),t,e[t])(),t in e)},ownKeys(e){return ii(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function Ei(e,t=new Set){if(e==null||typeof e!="object")return e;let n=e[ct]??e;if(t.has(n)||!ve(n))return n;t.add(n);let r=!1,i=o=>{let c=Ei(o,t);return c!==o&&(r=!0),c};if(Array.isArray(n)){let o=n.map(i);return r?o:n}let s={};for(let o of Object.keys(n))s[o]=i(n[o]);return r?s:n}function j(e,t,n){let r=Ei(n),i=e[t];if(i===r&&(r!==void 0||t in e))return;let s=Array.isArray(e),o=s?e.length:0;r===void 0?delete e[t]:e[t]=r;let c=lt(e),u=c.keys.get(t);if(u&&si(u,r),Sa(i,e),s&&e.length!==o){let l=c.keys.get("length");l&&si(l,e.length)}c.all&&c.all.$(void 0)}function en(e,t){return typeof e=="function"?e(t):e}function tn(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)?tn(i,r):j(e,n,r)}}function ht(e){let t=[],n=e.replace(/\[([^\]]*)\]/g,".$1");for(let r of n.split("."))r.length&&t.push(r);return t}function Ai(e,t,n){let r=t.length-1;for(let s=0;s<r;s++){let o=t[s];if(o==="*"){let u=t.slice(s+1);if(Array.isArray(e))for(let l=0;l<e.length;l++)Ai(e[l],u,n);return}let c=e[o];(c==null||typeof c!="object")&&(c=/^\d+$/.test(t[s+1])?[]:{},j(e,o,c)),e=c}let i=t[r];if(i==="*"){if(Array.isArray(e))for(let s=0;s<e.length;s++)j(e,s,en(n,e[s]));return}j(e,i,en(n,e[i]))}function oi(e,t,n){Ai(e,ht(t),n)}function Ea(e){return Array.isArray(e)&&e.length>0&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="string")}function ot(e,t){for(let n=e.length-1;n>=t.length;n--)j(e,String(n),void 0);e.length!==t.length&&j(e,"length",t.length);for(let n=0;n<t.length;n++)j(e,String(n),t[n])}function Aa(e,t){let n=t[0];if(typeof n=="function"&&t.length===1){let r=n(e);r&&r!==e&&tn(e,r);return}if(Array.isArray(n)&&t.length===1){if(Ea(n)){for(let r of n)oi(e,r[0],r[1]);return}if(Array.isArray(e)){ot(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){tn(e,n);return}if(t.length>=3){nn(e,t.slice(0,-1),t[t.length-1]);return}oi(e,String(n),t[1])}function _a(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,s=[];for(let o=r;o<=i;o+=n)o>=0&&o<e.length&&s.push(o);return s}return t==="*"?Array.isArray(e)?e.map((n,r)=>r):Object.keys(e??{}):[t]}function nn(e,t,n){if(e==null)return;let[r,...i]=t;if(typeof r=="string"){let o=ht(r);if(o.length>1){nn(e,[...o,...i],n);return}}let s=_a(e,r);if(i.length===0){for(let o of s)j(e,o,en(n,e[o]));return}for(let o of s){let c=e[o];if(c==null||typeof c!="object"){let u=i[0];c=typeof u=="number"||/^\d+$/.test(String(u))?[]:{},j(e,o,c)}nn(c,i,n)}}function rn(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(rn);let t={};for(let n of Object.keys(e))t[n]=rn(e[n]);return t}function Q(e,t){let n=e;for(let r of ht(t)){if(n==null)return;n=n[r]}return n}var _i=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...n)=>me(()=>Aa(this.root,n))),e&&typeof e=="object"&&(be.set(e,{store:this,name:t.name??"store"}),at.set(e,e)),U()&&dt({kind:"store",node:this,handle:()=>this.root,name:t.name})}get state(){return st(this.root)}get proxy(){return st(this.root)}get accessor(){return(()=>st(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return ft(this.state);let t=this.state;for(let n of ht(e)){if(t==null)return;t=t[n]}return ft(t)}select(e){return w(()=>e(this.state))}subscribe(e){return F(()=>e(this.state))}watch(e,t){let n;return F(()=>{let r=e(this.state);Object.is(r,n)||(t(r,n),n=r)})}reactive(e){return w(()=>this.state[e])}produce(e){this.set((t=>{let n=rn(t);return e(n),n}))}reconcile(e,t={}){this.set(e)}push(e,...t){let n=Q(this.root,e);this.set(e,n.concat(t))}pop(e){let t=Q(this.root,e).slice(),n=t.pop();return this.set(e,t),n}shift(e){let t=Q(this.root,e).slice(),n=t.shift();return this.set(e,t),n}splice(e,t,n,...r){let i=Q(this.root,e).slice(),s=i.splice(t,n,...r);return this.set(e,i),s}insert(e,t,n){let r=Q(this.root,e).slice();r.splice(t,0,n),this.set(e,r)}removeAt(e,t){let n=Q(this.root,e).slice(),r=n.splice(t,1);return this.set(e,n),r}replace(e,t){if(arguments.length>=2){let r=Q(this.root,String(e)),i=t;if(Array.isArray(r)&&Array.isArray(i)){ot(r,i);return}this.set(e,i);return}let n=this.root;if(Array.isArray(n)&&Array.isArray(e)){ot(n,e);return}this.set(e)}clear(e){let t=e===void 0?this.root:Q(this.root,e);if(Array.isArray(t)){ot(t,[]);return}if(t&&typeof t=="object")for(let n of Object.keys(t))j(t,n,void 0)}toObservable(){let[e]=V(this.state);return e.toObservable()}dispose(){}},$a=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","replace","clear","unwrap","toObservable"];function Oa(e,t){for(let n of $a)e[n]=t[n].bind(t);e.$=t.reactive.bind(t)}function $i(e,t={immutable:!0}){let n=new _i(e,t);return Oa(n.set,n),[n.proxy,n.set]}function Ca(e,t={}){return new _i(e,{...t,immutable:!1})}function ft(e){if(e==null||typeof e!="object")return e;let t=e[ct];return t!==void 0?t:e}function Na(e){return T(()=>ft(e))}var kd=Object.freeze({createStore:$i,createMutableStore:Ca,batch:me,unwrap:ft,untrackStore:Na});function Oi(e,t){let[n,r]=$i(e,t);return new Proxy(n,{get:(i,s)=>s==="set"?r:i[s],has:(i,s)=>s==="set"||Reflect.has(i,s)})}var Ot=Symbol.for("fluixi.server-node"),Ta=Symbol.for("fluixi.dom.server-host"),Ra=globalThis,Re=Ra[Ta]??={server:typeof document>"u",nodes:null};function $(){return Re.server}function Me(e){Re.server=e}function Ma(e){Re.nodes=e}function Ct(){if(!Re.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Re.nodes}function He(e){return e!=null&&e[Ot]===!0?!0:typeof Node<"u"&&e instanceof Node}function zi(e){return e!=null&&e[Ot]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Ui(e){return e!=null&&e[Ot]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}function Pa(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function Da(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function Ia(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 La=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ja=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"]),xn="http://www.w3.org/2000/svg";function Ki(e){return e.localName.includes("-")}function pn(e,t,n,r=!1){if(n==null){e.removeAttribute(t);return}if(Ki(e)){if($()){vt(e,t,n);return}e[t]=n;return}H(e,t,n,r)}var Ji=Symbol.for("fluixi.serverProps");function vt(e,t,n){let r=e[Ji]??={};r[t]=n,n==null||n===!1?e.removeAttribute(t):n===!0?e.setAttribute(t,""):(typeof n=="string"||typeof n=="number")&&e.setAttribute(t,String(n))}var qa=new Set(["draggable","spellcheck","contenteditable"]);function Gi(e){return e.startsWith("aria-")||qa.has(e.toLowerCase())}var mn=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]),Yi=new Set(["id","class","className","style","slot","part","exportparts","is","title","role","lang","dir","tabindex","hidden"]);function mt(e){return Yi.has(e)||e.startsWith("aria-")||e.startsWith("data-")}function yn(e,t=document){return t.querySelector(e)}function Ha(e,t=document){return Array.from(t.querySelectorAll(e))}function Wa(e,t){return e.closest(t)}function Xi(e,...t){e.classList.add(...t)}function Zi(e,...t){e.classList.remove(...t)}function Qi(e,...t){t.forEach(n=>e.classList.toggle(n))}function Ba(e,t){return e.classList.contains(t)}function H(e,t,n,r=!1){if(typeof n=="boolean"&&Gi(t)){e.setAttribute(t,String(n));return}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 es(e,t){return e.getAttribute(t)}function ts(e,t){e.removeAttribute(t)}function kn(e,t){Object.assign(e.style,t)}function Va(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function ns(e,t={},...n){let r=document.createElement(e);return Object.entries(t).forEach(([i,s])=>{if(i==="class"||i==="className")r.className=s;else if(i==="style"&&typeof s=="object")kn(r,s);else if(i.startsWith("on")&&typeof s=="function"){let o=i.slice(2).toLowerCase();r.addEventListener(o,s)}else H(r,i,s)}),n.forEach(i=>{typeof i=="string"?r.appendChild(document.createTextNode(i)):r.appendChild(i)}),r}function rs(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function is(e,...t){t.forEach(n=>{typeof n=="string"?e.appendChild(document.createTextNode(n)):e.appendChild(n)})}function Fa(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function za(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function Ua(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function Ka(e,t,n,r){let i=s=>{let o=s.target.closest(n);o&&e.contains(o)&&r(s,o)};return e.addEventListener(t,i),()=>{e.removeEventListener(t,i)}}function Ja(e,t=5e3){return new Promise((n,r)=>{let i=yn(e);if(i){n(i);return}let s=new MutationObserver(()=>{let c=yn(e);c&&(s.disconnect(),clearTimeout(o),n(c))});s.observe(document.body,{childList:!0,subtree:!0});let o=setTimeout(()=>{s.disconnect(),r(new Error(`Element ${e} not found within ${t}ms`))},t)})}function Ga(e,t,n={}){let r=new IntersectionObserver(i=>{i.forEach(s=>{t(s.isIntersecting)})},n);return r.observe(e),()=>{r.disconnect()}}function Ya(e,t){let n=new ResizeObserver(r=>{r.forEach(t)});return n.observe(e),()=>{n.disconnect()}}var Xa=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function Za(e){return typeof e=="object"&&e!==null&&e.$$typeof===Xa}function Qa(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function eu(e){return e instanceof Node}function tu(e,t,n="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[n]>"u"&&(globalThis[n]={}),typeof globalThis[n][e]>"u"&&(globalThis[n][e]=t))}function nu(e,t,n="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[n]<"u"&&typeof globalThis[n][e]<"u"?globalThis[n][e]:t}var ss="1.0.0-alpha.107",q={dom:ss,reactive:Br};function ru(e){q.core=e}var os="data-fluixi";function cs(){return iu()?"":q.core??q.dom}function iu(){try{return!0}catch{return!1}}function as(e){e.setAttribute(os,cs()),typeof globalThis<"u"&&(globalThis.Fluixi=q)}function us(){let e=Er();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=[q.core,q.dom,q.reactive].filter(n=>n!==void 0);new Set(t).size<=1||console.warn(`[fluixi] package versions disagree: core ${q.core??"(absent)"}, dom ${q.dom}, reactive ${q.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\`.`)}var pt,ls={getStore:()=>pt,run(e,t){let n=pt;pt=e;try{return t()}finally{pt=n}}},Pe=globalThis[Symbol.for("fluixi.requestStore")]??={store:ls,async:!1};function fs(e){Pe.store=e??ls,Pe.async=e!==null}function su(e){Pe.async||fs(e)}function En(e={}){if(e.request===void 0){let o=ds();o&&(e.request=o)}e.locals||(e.locals=e.request?hs(e.request):{});let t=0,n=0,r=null,i=new Map,s=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${t++}`,nextResourceId:()=>{if(r===null)return`r${n++}`;let o=i.get(r)??0;return i.set(r,o+1),`${r}:r${o}`},nextIslandNamespace:o=>{let c=s.get(o)??0;return s.set(o,c+1),`${o}#${c}`},withResourceScope(o,c){let u=r;r=o;try{return c()}finally{r=u}},pending:new Set,data:new Map}}var gt=globalThis[Symbol.for("fluixi.requestEndHooks")]??=new WeakMap;function ou(e){let t=X();if(!t)return!1;let n=gt.get(t);return n||gt.set(t,n=[]),n.push(e),!0}function An(e){let t=gt.get(e);if(t){gt.delete(e);for(let n of t.reverse())try{n()}catch(r){console.error("[fluixi] a request-end hook threw:",r)}}}function _n(e,t){return Pe.store.run(e,t)}function X(){return Pe.store.getStore()}function $n(){return X()?.event}function cu(){let e=$n();return e?(e.locals||(e.locals={}),e.locals):{}}var Ci=globalThis[Symbol.for("fluixi.requestLocals")]??=new WeakMap;function ds(){return globalThis[Symbol.for("fluixi.platformRequest")]?.getStore()}function hs(e){let t=Ci.get(e);return t||(t={},Ci.set(e,t)),t}var bt=globalThis[Symbol.for("fluixi.responseHeaders")]??=new WeakMap;function au(){let e=$n()?.request;return e&&typeof e=="object"?e:ds()}function uu(e,t,n=au()){if(!n)return!1;let r=bt.get(n);return r||(r={headers:new Headers,sent:!1},bt.set(n,r)),r.sent?!1:(r.headers.append(e,t),!0)}function lu(e){let t=bt.get(e);if(!t){t={headers:new Headers,sent:!0},bt.set(e,t);return}return t.sent=!0,t.headers}var h={active:!1,cursor:null,parents:[]},ps=null;function fu(e){ps=e}function wt(){return ps}function Ni(e,t){return h.active&&t.parentNode===e}function On(e){let t=h.parents.lastIndexOf(e);t!==-1&&(h.parents.length=t),h.cursor=e.nextSibling}function du(){return h.active?h.cursor:null}function St(e,t){if(!e||e.parentNode==null)return t();let n=h.active,r=h.cursor,i=h.parents;h.active=!0,h.cursor=e,h.parents=[];try{return t()}finally{h.active=n,h.cursor=r,h.parents=i}}function hu(e){if(!h.active)return e();let t=h.cursor,n=h.parents;h.active=!1,h.parents=[];try{return e()}finally{h.active=!0,h.cursor=t,h.parents=n}}function Cn(e){if(!h.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&On(t)}function Nt(){let e=globalThis;return e[Symbol.for("fluixi.appHydration")]??={pending:0,waiting:new Set}}function pu(){Nt().pending++}function mu(){let e=Nt();if(e.pending>0&&e.pending--,e.pending>0)return;let t=[...e.waiting];e.waiting.clear();for(let n of t)n()}function yu(){return Nt().pending>0}function vu(e){let t=Nt();return t.waiting.add(e),()=>t.waiting.delete(e)}var xt=Symbol.for("fluixi.hydrationKeys"),re="data-hk";function ms(e){let t=e;for(;t;){let n=t.contexts?.get(xt);if(n)return n;if(!t.parent){let r={id:"",next:0};return(t.contexts??=new Map).set(xt,r),r}t=t.parent}return{id:"",next:0}}function ys(){return $()?X()?.hydrationKeys!==!1:h.active}function vn(e){let t=3735928559,n=1103547991;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);t=Math.imul(t^i,2654435761),n=Math.imul(n^i,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(4294967296*(2097151&n)+(t>>>0)).toString(36)}function vs(e){if(!ys())return null;let t=ms(x()),n=t.id+(t.next++).toString(36);return e?`${vn(n)}-${e}`:vn(n)}var Ti=new Map;function gu(e){let t=Ti.get(e);return t===void 0&&Ti.set(e,t=vn(e).slice(0,6)),t}function bu(e){let t=e.getAttribute(re)??"",n=t.indexOf("-");return n<0?"":t.slice(n+1)}function gs(e){let t=e.getAttribute(re);t&&M?.get(t)===e&&M.delete(t)}function wu(){if(!ys())return null;let e=x();if(!e)return null;let t=ms(e),n={id:t.id+(t.next++).toString(36)+".",next:0},r=Z(e);return(r.contexts=new Map).set(xt,n),r}function Su(e){let t=x();t&&(t.contexts??=new Map).set(xt,{id:e,next:0})}var M=null;function bs(e){M??=new Map;for(let t of e.querySelectorAll(`[${re}]`)){let n=t.getAttribute(re);M.has(n)||M.set(n,t)}}function ws(){M=null}function Ss(e){if(!M)return 0;let t=0;for(let[n,r]of M){if(!r.isConnected){M.delete(n);continue}e&&!e.contains(r)||r.parentElement?.closest("[data-fx-ssr]")||(M.delete(n),r.remove(),t++)}return t}function xs(e,t){if(!e||!M)return null;let n=M.get(e);return!n||n.localName!==t.toLowerCase()?null:(M.delete(e),n)}function xu(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function ku(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Eu(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Au(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function _u(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function $u(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function Nn(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Ou(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function ks(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function Es(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function As(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function _s(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function $s(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Os(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function B(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function Cs(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function Cu(e){return ks(e)?{type:"router",value:e}:As(e)?{type:"route",value:e}:Es(e)?{type:"routes",value:e}:_s(e)?{type:"outlet",value:e}:B(e)?{type:"component",value:e}:Cs(e)?{type:"suspense",value:e}:$s(e)?{type:"provider",value:e}:Os(e)?{type:"context",value:e}:{type:"none",value:e}}function Nu(e){if($()||!h.active)return e();let t=x();return Nn(()=>E(t,e))}function Tu(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 Ru(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 Mu(e){return Ru(Tu(e))}var Pu=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Du={},kt="__fx_at",Ns="__fx_loc";function an(e,t){return t&&(e[Ns]=t),e}var Iu=Symbol.for("fluixi.owner");function Et(e){let t=x();t&&(e[Iu]=t)}function Ri(e){if(e instanceof Element){e.localName.includes("-")&&Et(e);for(let t of e.querySelectorAll("*"))t.localName.includes("-")&&Et(t)}}var Mi=/<[a-z][\w.]*-/i,Pi=new Map,Lu="__fluixi_delegated_events__",gn=globalThis[Lu]??={names:new Set},At=gn.names,Tt=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function Rt(e){if(!$())for(let t of e)At.has(t)||Tt.has(t)||(At.add(t),gn.dispatch??=ju,document.addEventListener(t,gn.dispatch))}function ju(e){let t=`$$${e.type}`,n=e.composedPath&&e.composedPath()[0]||e.target;Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>n??document});try{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}}finally{delete e.currentTarget}}function Tn(e,t,n){if(e[`$$${t}`]=n,Tt.has(t)){let r=`__fx_${t}`;if(!e[r]){let i=s=>{e[`$$${t}`]?.(s)};e.addEventListener(t,i),e[r]=i}return}At.has(t)||Rt([t])}function _t(e,t){delete e[`$$${t}`];let n=`__fx_${t}`,r=e[n];r&&(e.removeEventListener(t,r),delete e[n])}function qu(e){return!Tt.has(e)}function Hu(e){return typeof e=="function"}function te(e,t=!1){if($())return Ct().createText(e);if(h.active&&!t){let n=wt()?.hydrateText(e);if(n)return n}return document.createTextNode(e)}function Mt(e,t=!1,n){let r=vs();if($()){let i=Ct().createElement(e,t);return r&&i.setAttribute(re,r),i}if(h.active){let i=xs(r,e);if(i)return wt()?.enterElement(i),e.includes("-")&&Et(i),n?an(i,n):i;let s=wt()?.hydrateElement(e);if(s)return e.includes("-")&&Et(s),n?an(s,n):s}return an(t?document.createElementNS(xn,e):document.createElement(e),n)}function Rn(e,t=!1){let n=Pi.get(e);if(n)return n;let r=document.createElement("template");return t?r.innerHTML=`<svg>${e}</svg>`:r.innerHTML=e,Pi.set(e,r),r}function Ts(e,t,n=!1,r=!1,i){let s=gu(e),o=vs(s);if($()){let c=Ct();if(n){let u=c.parseTemplate(e,r);return o&&u.setAttribute(re,o),u}return c.createRaw(o?Wu(e,o):e)}if(h.active){let c=xs(o,t);if(c)return h.cursor=c.nextSibling,Mi.test(e)&&Ri(c),un(c,i);let u=wt()?.hydrateStatic(t,s);if(u)return Mi.test(e)&&Ri(u),un(u,i)}return un(In(Rn(e,r),r).firstChild,i)}function Wu(e,t){return e.replace(/^(\s*<[^\s/>]+)/,`$1 ${re}="${t}"`)}function un(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 s=t.pos[i*2];s&&(r[i][Ns]={file:t.file,line:s,column:t.pos[i*2+1]})}return e}function Mn(e,t){if(!h.active)return t();let n=St(e.nextSibling,t);if(typeof n=="function"){let r=n;return Bu(r,(...s)=>h.active?St(e.nextSibling,()=>{let o=r(...s);for(;typeof o=="function";)o=o();return o}):r(...s))}return n}function Bu(e,t){let n=e[kt];return n!==void 0&&(t[kt]=n),t}function Pn(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 Dn(e,t){let n=[];for(let r=e.nextSibling;r&&r!==t;r=r.nextSibling)n.push(r);return n}function In(e,t=!1){let n=e.content.cloneNode(!0);return t?n.firstChild:n}function Rs(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Rs(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function Vu(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Fu(e){if(k(e)||B(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!k(t)&&!B(t);)t=t();return t}var Y=0,zu=200;function Uu(e,t,n,r,i){let s=r,o,c=()=>o??=new Map,u=!1;return S(()=>{let a=u&&h.active;if(u=!0,!a)return l();h.active=!1;try{return l()}finally{h.active=!0}});function l(){N(n??t,"content",void 0,e);let a;if(B(e)&&!k(e)){if(!c().has(e)){Y++;try{let f=e();c().set(e,f)}finally{Y--}}for(a=c().get(e);typeof a=="function"&&k(a);)a=a()}else for(a=e();typeof a=="function"&&k(a);)a=a();{let f=0;for(;typeof a=="function"&&f++<50;)if(B(a)){if(!c().has(a)){let d=a;Y++;try{let p=d();c().set(d,p)}finally{Y--}}a=c().get(a)}else if(k(a))a=a();else if(a=a(),typeof a!="function"||!k(a)&&!B(a))break}Array.isArray(a)&&c(),Y++;try{s=De(t,a,n,s,o),i(s)}finally{Y--}}}function I(e,t,n,r){if(Y>zu)return console.error("[insert] Exceeded max call depth, possible infinite loop."),()=>null;let i=n!==void 0&&!n&&h.active;n!==void 0&&!n&&(n=te("",!0),i||e.appendChild(n));let s=()=>{if(!i||n.parentNode)return;let a=h.cursor;e.insertBefore(n,a&&a.parentNode===e?a:null)},o=r??null,c=a=>Array.isArray(a)&&a.some(f=>typeof f=="function"),u=a=>typeof a=="function"?a:()=>a;if(typeof t!="function"&&!c(t)){Y++;try{o=De(e,t,n,o)}finally{Y--}return s(),()=>o}let l=Uu(u(t),e,n,o,a=>{o=a});return s(),()=>(l?.(),o)}function De(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(Te(t)){let o=te("",!0);return Array.isArray(r)?r.length>0?(e.replaceChild(o,r[0]),G(e,r.slice(1),n)):R(e,o,n):r?e.replaceChild(o,r):R(e,o,n),t.then(c=>{o.parentNode===e&&De(e,c,o.nextSibling,o)}).catch(c=>{console.error("Error resolving promise in insertExpression:",c)}),o}let s=typeof t;if(s==="string"||s==="number"){if(s==="number"&&(t=String(t)),Array.isArray(r)){if(r.length===0){let c=te(t);return R(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&&Ui(r))return r.data=t,r;let o=te(t);return r&&r.parentNode===e?e.replaceChild(o,r):Ni(e,o)||R(e,o,n),o}if(He(t))return Ni(e,t)?(On(t),t):Array.isArray(r)?(r.length===0?R(e,t,n):r[0].parentNode===e?(e.replaceChild(t,r[0]),G(e,r.slice(1),n)):R(e,t,n),t):(r?r!==t&&(r.parentNode===e?e.replaceChild(t,r):R(e,t,n)):R(e,t,n),t);if(Array.isArray(t)){let o=[],c=Array.isArray(r)?r:r?[r]:[],u=[],l=new Set,a=()=>J(t,o,e,n,!0,i,u,l);h.active&&c.length?St(c[0],a):a();let f=Ku(e,l.size?c.filter(d=>!l.has(d)):c,o,n);for(let d of u){if(d.wired)continue;let p=I(e,d.sig,d.marker);A(()=>G(e,p()))}return f}if(s==="object"&&t!==null&&typeof t=="object"){let o=t;if("type"in o&&"props"in o){let c=o;if(typeof c.type=="function"){let u=c.type(c.props||{});return De(e,u,n,r)}}}return G(e,r,n)}function J(e,t,n,r,i=!0,s,o,c){for(let u=0;u<e.length;u++){let l=e[u];if(!(l==null||typeof l=="boolean")){for(;typeof l=="function"&&!Te(l)&&!k(l)&&!B(l)&&(l=l(),!(l==null||typeof l=="boolean")););if(!(l==null||typeof l=="boolean")){if(typeof l=="function"){let a;for(B(l)&&!k(l)?(s||(s=new Map),s.has(l)||s.set(l,l()),a=s.get(l)):a=l();typeof a=="function"&&!Te(a)&&!k(a)&&!B(a);)s||(s=new Map),s.has(a)||s.set(a,a()),a=s.get(a);if(a==null||typeof a=="boolean")continue;if(typeof a=="function"){if(k(a)){if(o){let d=te("",!0);if(t.push(d),h.active&&c&&h.cursor?.parentNode===n){let p=()=>h.cursor&&h.cursor.parentNode===n?h.cursor:null,g=p();n.insertBefore(d,g);let v=I(n,a,d),b=p();for(let C=g;C&&C!==b;C=C.nextSibling)c.add(C);n.insertBefore(d,b),A(()=>G(n,v())),o.push({marker:d,sig:a,wired:!0});continue}o.push({marker:d,sig:a});continue}let f=a();for(;typeof f=="function"&&k(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?J(f,t,n,r,i,s):J([f],t,n,r,i,s);continue}continue}Array.isArray(a)?J(a,t,n,r,i,s,o,c):J([a],t,n,r,i,s,o,c);continue}if(Te(l)){let a=te("",!0);t.push(a),l.then(f=>{if(a.parentNode){let d=[];if(J([f],d,a.parentNode,void 0,!1,s),d.length>0){a.parentNode.replaceChild(d[0],a);for(let p=1;p<d.length;p++)a.parentNode?.insertBefore(d[p],d[p-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(l)){J(l,t,n,r,i,s,o,c);continue}if(He(l)){h.active&&(h.cursor===l||h.parents.includes(l))&&On(l),t.push(l);continue}if(typeof l=="object"&&l!==null&&"type"in l&&"props"in l){let a=l;if(typeof a.type=="function"){let f=a.type(a.props||{});Array.isArray(f)?J(f,t,n,r,!1,s):J([f],t,n,r,!1,s);continue}}if(typeof l=="string"||typeof l=="number"){let a=String(l);if(a.trim()===""&&a!==" ")continue;t.push(te(a));continue}t.push(te(String(l)))}}}}function Ku(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,s=t.length,o=i,c=0,u=0,l=s>0?t[s-1].nextSibling??void 0:r,a=null;for(;c<s||u<o;){if(t[c]===n[u]){c++,u++;continue}for(;s>c&&o>u&&t[s-1]===n[o-1];)s--,o--;if(s===c){let f=o<i?u?n[u-1].nextSibling??void 0:n[o-u]:l;for(;u<o;)R(e,n[u++],f)}else if(o===u)for(;c<s;)(!a||!a.has(t[c]))&&t[c].parentNode===e&&e.removeChild(t[c]),c++;else if(t[c]===n[o-1]&&n[u]===t[s-1]){let f=t[--s].nextSibling;R(e,n[u++],t[c++].nextSibling),R(e,n[--o],f),t[s]=t[c-1]}else{if(!a){a=new Map;let d=u;for(;d<o;)a.set(n[d],d++)}let f=a.get(t[c]);if(f!=null)if(u<f&&f<o){let d=c,p=1;for(;++d<s&&d<o&&!(!a.has(t[d])||a.get(t[d])!==f+p);)p++;if(p>f-u){let g=t[c];for(;u<f;)R(e,n[u++],g)}else t[c].parentNode===e?e.replaceChild(n[u++],t[c++]):(R(e,n[u++],l),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 R(e,t,n){h.active&&t.parentNode===e||(n&&n.parentNode===e?e.insertBefore(t,n):e.appendChild(t))}function ce(e,t,n){n==null?delete e[t]:e[t]=n}function Ln(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 Ms(e,t){if(!t||typeof t!="function")return;let n=t[kt]?.name;if(!n)return;let r=n.indexOf(":");r!==-1&&L(e,n.slice(0,r),n.slice(r+1),t)}function $t(e,t,n){let r=typeof n=="function"?T(()=>n()):n;if(!(!r||typeof r!="object"))for(let i of Object.keys(r))L(e,t,i)}function jn(e,t){let n=(r,i)=>{typeof r=="function"&&(L(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 Ie(e,t,n,r=!1){return Ms(e,n),typeof n!="function"?(H(e,t,n,r),()=>{}):S(()=>{N(e,"attribute",t,n);let i=typeof n=="function"?n():n;H(e,t,i,r)})}function Le(e,t,n){return typeof n!="function"?(ce(e,t,n),()=>{}):(Ms(e,n),S(()=>{N(e,"property",t,n);let r=typeof n=="function"?n():n;ce(e,t,r)}))}function qn(e,t,n){return typeof n!="function"?(H(e,t,!!n),()=>{}):S(()=>{N(e,"attribute",t,n);let r=n();H(e,t,!!r)})}function Se(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){S(()=>{N(e,"attribute","class",t),Se(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 ae(e,t,n){if(!(!t||typeof t!="object"))for(let r in t){let i=t[r],s=r.split(/\s+/).filter(Boolean);if(typeof i=="function"&&n)n.push(S(()=>{let o=!!i();for(let c of s)e.classList.toggle(c,o)}));else{let o=!!(typeof i=="function"?i():i);for(let c of s)e.classList.toggle(c,o)}}}function ln(e,t,n){t.includes("-")?n==null?e.removeProperty(t):e.setProperty(t,String(n)):e[t]=n??""}function we(e){for(;typeof e=="function";)e=e();return e}var fn=new WeakMap;function ie(e,t,n){if(typeof t=="function"&&n){n.push(S(()=>ie(e,we(t))));return}let r=we(t),i=fn.get(e);if(r==null){fn.delete(e),e.removeAttribute("style");return}let s=new Set,o=c=>{if(typeof c=="function"&&n){n.push(S(()=>o(we(c))));return}if(c=we(c),c!=null){if(typeof c=="string")e.style.cssText=c;else if(Array.isArray(c))for(let u of c)o(u);else if(typeof c=="object")for(let u in c){s.add(u);let l=c[u];typeof l=="function"&&n?n.push(S(()=>ln(e.style,u,we(l)))):ln(e.style,u,we(l))}}};if(Array.isArray(r))for(let c of r)o(c);else o(r);if(i)for(let c of i)s.has(c)||ln(e.style,c,null);fn.set(e,s)}function Ju(e,t){if(typeof t!="function"){ie(e,t,[]);return}S(()=>{N(e,"attribute","style",t),ie(e,t())})}function Gu(e,t){if(typeof t!="function"){ae(e,t,[]);return}S(()=>{N(e,"attribute","class",t),ae(e,t())})}function Ps(e){let{element:t,props:n,prevProps:r=Du,isSVG:i=!1,skipChildren:s=!1,isCustomElement:o,accessors:c}=e;if(!t||!zi(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!n)return console.warn("[spread] Warning: props is undefined!"),()=>{};let u=i||t.namespaceURI===xn,l=[];for(let a in n){if(s&&a==="children")continue;let f=n[a],d=r[a];if(f===d)continue;if(a==="ref"){We(f,t);continue}if(a==="use"){jn(t,f);continue}if(a.startsWith("on:")){l.push(Ln(t,a.slice(3),f));continue}if(a.startsWith("prop:")){L(t,"prop",a.slice(5),f),l.push(Le(t,a.slice(5),f));continue}if(a.startsWith("attr:")){L(t,"attr",a.slice(5),f),l.push(Ie(t,a.slice(5),f,u));continue}if(a.startsWith("bool:")){L(t,"bool",a.slice(5),f),l.push(qn(t,a.slice(5),f));continue}if(a==="class"||a==="className"){typeof f=="function"?l.push(S(()=>{N(t,"attribute","class",f),Se(t,f())})):Se(t,f);continue}if(a==="classList"){$t(t,"class",f),typeof f=="function"?l.push(S(()=>{N(t,"attribute","class",f),ae(t,f())})):ae(t,f,l);continue}if(a==="style"){$t(t,"style",f),typeof f=="function"?l.push(S(()=>{N(t,"attribute","style",f),ie(t,f())})):ie(t,f,l);continue}if(a.startsWith("on")){let b=a.slice(2).toLowerCase();d&&_t(t,b),f&&Tn(t,b,f);continue}let p=o??t.localName.includes("-"),g=mn.has(a)||!u&&a in t||p&&!u&&!mt(a);if(p&&!u&&!mt(a)&&c!==void 0&&typeof f=="function"&&!c.includes(a)){$()?vt(t,a,f):ce(t,a,f);continue}if(p&&!u&&!mt(a)&&$()){l.push(S(()=>{let b=typeof f=="function"?f():n[a];for(;typeof b=="function"&&b.length===0;)b=b();vt(t,a,b)}));continue}typeof f=="function"?l.push(g?Le(t,a,f):Ie(t,a,f,u)):l.push(S(()=>g?ce(t,a,n[a]):H(t,a,n[a],u)))}for(let a in r)if(!(a in n))if(a.startsWith("on")){let f=a.slice(2).toLowerCase();_t(t,f)}else mn.has(a)?ce(t,a,null):t.removeAttribute(a);return()=>{l.forEach(a=>a())}}function Hn(e,t,n=!1){for(let r in t){let i=t[r];if(r==="ref"){We(i,e);continue}if(r!=="children"){if(r==="use"){jn(e,i);continue}if(r.startsWith("on:")){Ln(e,r.slice(3),i);continue}if(r.startsWith("prop:")){L(e,"prop",r.slice(5),i),Le(e,r.slice(5),i);continue}if(r.startsWith("attr:")){L(e,"attr",r.slice(5),i),Ie(e,r.slice(5),i,n);continue}if(r.startsWith("bool:")){L(e,"bool",r.slice(5),i),qn(e,r.slice(5),i);continue}if(r.startsWith("on")&&r.length>2){let s=r.slice(2).toLowerCase();if(typeof i=="function")if(Tt.has(s)){e[`$$${s}`]=i;let o=`__fx_${s}`;if(!e[o]){let c=u=>{e[`$$${s}`]?.(u)};e.addEventListener(s,c),e[o]=c}}else e[`$$${s}`]=i,At.has(s)||Rt([s]);continue}if(r==="class"||r==="className"){Se(e,i);continue}if(r==="classList"){$t(e,"class",i),typeof i=="function"?S(()=>{N(e,"attribute","class",i),ae(e,i())}):ae(e,i,[]);continue}if(r==="style"){$t(e,"style",i),typeof i=="function"?S(()=>{N(e,"attribute","style",i),ie(e,i())}):ie(e,i,[]);continue}if(r==="innerHTML"){if(typeof i=="function"){let s=F(()=>{let o=i();for(;typeof o=="function";)o=o();e.innerHTML=o});A(()=>s())}else e.innerHTML=i;continue}if(r==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let s=F(()=>{let o=i();for(;typeof o=="function"&&o.length===0;)o=o();document.activeElement!==e&&(e.value=o??"")});A(()=>{s()})}else S(()=>{document.activeElement!==e&&(e.value=t[r]??"")});continue}if(r==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let s=F(()=>{let o=i();for(;typeof o=="function"&&o.length===0;)o=o();document.activeElement!==e&&(e.checked=o??"")});A(()=>{s()})}else S(()=>{document.activeElement!==e&&(e.checked=t[r]??"")});continue}if(r==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let s=!0,o=F(()=>{let c=i();for(;typeof c=="function"&&c.length===0;)c=c();s?(s=!1,queueMicrotask(()=>{e.value=c??""})):e.value=c??""});A(()=>{o()})}else{let s=!0;S(()=>{let o=t[r];s?(s=!1,queueMicrotask(()=>{e.value=o??""})):e.value=o??""})}continue}if(typeof i=="function"){let s=F(()=>{let o=i();for(;typeof o=="function"&&o.length===0;)o=o();pn(e,r,o,n)});A(()=>{s()})}else S(()=>pn(e,r,t[r],n))}}}function Ds(...e){let t=r=>{for(let i=e.length-1;i>=0;i--){let s=e[i];if(!s||!(r in s))continue;let o=s[r];if(o!==void 0)return o}},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 s of Reflect.ownKeys(i))r.add(s);return[...r]},getOwnPropertyDescriptor:(r,i)=>n(i)?{enumerable:!0,configurable:!0,get:()=>t(i)}:void 0})}function Is(e,...t){let n=new Set;for(let o of t)for(let c of o)n.add(c);let r=o=>({enumerable:!0,configurable:!0,get:()=>e[o]}),i=t.map(o=>{let c=new Set(o);return new Proxy({},{get:(u,l)=>c.has(l)?e[l]:void 0,has:(u,l)=>c.has(l)&&l in e,ownKeys:()=>Array.from(c).filter(u=>u in e),getOwnPropertyDescriptor:(u,l)=>c.has(l)&&l in e?r(l):void 0})}),s=new Proxy({},{get:(o,c)=>n.has(c)?void 0:e[c],has:(o,c)=>!n.has(c)&&c in e,ownKeys:()=>Reflect.ownKeys(e).filter(o=>!n.has(o)),getOwnPropertyDescriptor:(o,c)=>!n.has(c)&&c in e?r(c):void 0});return[...i,s]}function We(e,t){if(!e)return;let n=e[kt]?.name;if(L(t,"ref",n||typeof e=="function"&&e.name||"ref",e),He(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 Ls(e,t,n){let r=t||document.body,i=rt(()=>e),s=[];return me(()=>{let o=S(()=>{let c=i();Array.isArray(c)?(c.forEach(u=>r.appendChild(u)),s.push(()=>{c.forEach(u=>{u.parentNode===r&&r.removeChild(u)})})):He(c)&&(r.appendChild(c),s.push(()=>{c.parentNode===r&&r.removeChild(c)}))});s.push(o),A(()=>{s.forEach(c=>c())})}),null}function Yu(e){return typeof e=="string"&&e.toLowerCase()===e}function js(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 Xu(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Te(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Zu(e){return typeof e=="function"&&e.length===0&&k(e)}function Be(e,t,n){if(!t)throw new Error("Container element is required");let r,i,s=[];return W(o=>{me(()=>{h.active||(t.textContent=""),as(t),us(),I(t,e)}),i=o}),()=>{i?.(),r?.(),s.forEach(o=>o()),t.textContent=""}}function qs(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 Qu="__fx_dom_create_component__",ue=globalThis[Qu]??={fn:null};function el(e){ue.fn=e}function tl(e={}){let t=e.signalSystem?.createComponent;t&&(ue.fn=t)}function Pt(e,t){let n=wu();return n?E(n,()=>Di(e,t)):Di(e,t)}function Di(e,t){if(ue.fn)return ue.fn(e,t);t&&ui(t);let n=typeof e=="function"?ge(()=>e(t)):e,r=n!=null&&(typeof n=="function"||typeof n=="object");if(r)try{n.$name=e?.name}catch{}return r&&!gi(n)?Nn(n):n}var nl=()=>ue.fn!==null,Hs=()=>ue.fn!==null;function Ws(){ue.fn=null}var Wn="__FX_DATA__";function Bs(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var dn;function Vs(){let e=globalThis.__FX_DATA__;if(e&&typeof e.nodeType!="number")return e;if(dn!==void 0)return dn;let t=null;if(typeof document<"u"){let n=document.getElementById(Wn)?.textContent;if(n)try{t=JSON.parse(n)}catch{t=null}}return dn=t}function Dt(){for(;;){for(;h.cursor&&h.cursor.nodeType===3&&h.cursor.data==="";)h.cursor=h.cursor.nextSibling;if(h.cursor!=null||!h.parents.length)return;h.cursor=h.parents.pop().nextSibling}}var Fs=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),je=typeof process<"u"&&process.env&&!1;function qe(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).`)}var rl=Symbol.for("fluixi.ownsContent");function zs(e){return e.localName.includes("-")?e.hasAttribute("data-fx-ssr")||e[rl]===!0:!1}function il(e){Dt();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(gs(t),Fs.has(e.toLowerCase())||zs(t)?h.cursor=t.nextSibling:(h.parents.push(t),h.cursor=t.firstChild),t):(je&&t&&qe(`<${e}>`,t),null)}function sl(e){Fs.has(e.localName)||zs(e)?h.cursor=e.nextSibling:(h.parents.push(e),h.cursor=e.firstChild)}function ol(e,t){Dt();let n=h.cursor;if(n&&n.nodeType===1&&n.tagName.toLowerCase()===e.toLowerCase()){let r=bu(n);return t&&r&&r!==t?(je&&qe(`<${e}> (another template)`,n),null):(gs(n),h.cursor=n.nextSibling,n)}return je&&n&&qe(`<${e}> (static)`,n),null}function cl(e){if(e===""){let n=h.cursor;return n&&n.nodeType===3&&n.data!==""?(h.cursor=n.nextSibling,n.data="",n):null}Dt();let t=h.cursor;if(t&&t.nodeType===3){let n=t.data;return n.length>e.length&&n.startsWith(e)?(h.cursor=t.splitText(e.length),t):(h.cursor=t.nextSibling,n!==e&&(t.data=e),t)}return je&&t&&qe(`text ${JSON.stringify(e.slice(0,24))}`,t),null}function al(e){Dt();let t=h.cursor;return t&&t.nodeType===8&&t.data===e?(h.cursor=t.nextSibling,t):(je&&t&&qe(`marker <!--${e.slice(0,24)}-->`,t),null)}var Ii=!1;function Us(){Ii||(Ii=!0,fu({hydrateElement:il,hydrateText:cl,hydrateMarker:al,hydrateStatic:ol,enterElement:sl}))}function Ve(e,t,n){Us(),h.active=!0,h.cursor=t.firstChild,h.parents=[],ws(),bs(t);let r=Vs(),i=n?.resourceNamespace,s=0;nt(()=>i?`${i}:r${s++}`:`r${s++}`),Dr(r?o=>o in r?{value:r[o]}:void 0:null);try{return Be(e,t)}finally{h.active=!1,h.cursor=null,h.parents=[]}}function ul(e,t){Us(),bs(e);let n={active:h.active,cursor:h.cursor,parents:h.parents};h.active=!0,h.cursor=e.firstChild,h.parents=[];try{I(e,t()),Ss(e)}finally{h.active=n.active,h.cursor=n.cursor,h.parents=n.parents}}var Bn="fluixi-island";function ll(e){let{component:t,props:n={},name:r}=e,i=Mt(Bn),s=r??t.name??"Island";H(i,"name",s),H(i,"props",JSON.stringify(n??{}));let o=$()?X():void 0;if(o){let c=o.nextIslandNamespace(s);I(i,()=>o.withResourceScope(c,()=>t(n)))}else I(i,()=>t(n));return i}var Li=!1;function fl(){if(Li||typeof document>"u")return;Li=!0;let e=document.createElement("style");e.textContent=`${Bn}{display:contents}`,document.head.appendChild(e)}function dl(e){if(typeof document>"u")return;fl();let t=document.querySelectorAll(Bn),n=new Map;t.forEach(r=>{let i=r.getAttribute("name")??"",s=n.get(i)??0;n.set(i,s+1);let o=e[i];if(!o){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{}Ve(()=>o(c),r,{resourceNamespace:`${i}#${s}`})})}function hl(e,...t){throw new Error("html`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function pl(e,...t){throw new Error("svg`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function ml(e,...t){throw new Error("css`` was not compiled: component styles need @fluixi-css/vite next to the fluixi plugin.")}function Ks(e,t={}){if(typeof e=="function")return Pt(e,t);if(typeof e!="string"||e.length===0)return null;let n=js(e),r=Mt(e,n);return Hn(r,t,n),yl(r,t),r}function yl(e,t){if(!t||t.children===void 0)return;let n=e.firstChild,r;h.active&&n?.nodeType===8&&n.data==="fx"?r=Pn(n):(n=ji("fx"),r=ji("fx/"),e.appendChild(n),e.appendChild(r));let i=n;I(e,Mn(i,()=>rt(()=>t.children)),r,Dn(i,r))}function ji(e){return $()?Ct().createComment(e):document.createComment(e)}function It(e){return()=>{let t=e();return typeof t=="function"?t():t}}function Vn(e){let t=It(()=>e.when),n=w(t,void 0,{name:"Show.when"}),r=w(()=>!!n(),void 0,{name:"Show.cond"}),i=x(),s=null,o=null,c=u=>{u!==o&&(s&&pe(s),s=Z(i),o=u)};return w(()=>{let u=r();return c(u?"when":"fallback"),E(s,()=>{if(!u)return e.fallback;let l=e.children;if(typeof l=="function"){let a=l;if(a.length===0)return T(()=>a(T(n)));let f=n();return T(()=>a(f))}return l})},void 0,{name:"Show.result"})}function Fn(e){let t=It(()=>e.each),n=()=>e.fallback??null,r=(i,s)=>{let o=e.children,c=Array.isArray(o)?o.map(u=>typeof u=="function"?u(i,s):u):typeof o=="function"?o(i,s):o;return Cn(c),c};return e.by?et(t,e.by,(i,s)=>r(i,s),{fallback:n}):Qe(t,(i,s)=>r(i,s),{fallback:n})}function zn(e){let t=It(()=>e.each);return tt(t,(n,r)=>{let i=e.children(n,r);return Cn(i),i},{fallback:()=>e.fallback??null})}var bn=Symbol("match");function Un(e){return{[bn]:!0,when:It(()=>e.when),get children(){return e.children}}}function Kn(e){let t=Array.isArray(e.children)?e.children:[e.children],n=x(),r=null,i=-1,s=o=>{o!==i&&(r&&pe(r),r=Z(n),i=o)};return w(()=>{for(let o=0;o<t.length;o+=1){let u=t[o],l=0;for(;typeof u=="function"&&!u[bn]&&l++<10;)u=u();if(!u||typeof u!="object"||u[bn]!==!0)continue;let a=u.when();if(a)return s(o),E(r,()=>{let f=u.children;return typeof f=="function"?f(a):f})}return s(-2),E(r,()=>e.fallback??null)},void 0,{name:"Switch"})}function Jn(e){let t=()=>{let c=e.component;return k(c)?c():c},[,n]=Is(e,["component"]),r=x(),i=null,s,o;return w(()=>{let c=t();return c===s||(i&&pe(i),i=Z(r),s=c,o=c==null?null:E(i,()=>T(()=>typeof c=="string"?Ks(c,n):Pt(c,n)))),o},void 0,{name:"Dynamic"})}function Gn(e){let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,n,r;return W(i=>{n=i,r=document.createElement("div"),r.style.display="contents",t().appendChild(r),I(r,e.children)&&We(e.ref,r)}),A(()=>{n(),r.remove()}),null}function Js(e){if($())return e.fallback??null;let t=h.active,[n,r]=V(!t);return t&&queueMicrotask(()=>r(!0)),w(()=>n()?e.children:e.fallback??null,void 0,{name:"client-only"})}var vl=Js;function Yn(e){let t=Hr(),n=o=>!!o&&typeof o.then=="function",r=o=>typeof e.fallback=="function"?e.fallback(o,t.reset):e.fallback,i=o=>{if(n(o))throw o;return queueMicrotask(()=>t.setError(o)),null},s=o=>{if(Array.isArray(o))return o.map(s);if(typeof o!="function")return o;let c=o;return()=>{try{return s(c())}catch(u){return i(u)}}};return w(()=>{let o=t.error();if(o!==void 0)return r(o);try{return Wr(t,()=>{let c=e.children;return s(typeof c=="function"?c():c)})}catch(c){return i(c),r(c)}},void 0,{name:"ErrorBoundary"})}function gl(e){return w(()=>{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 bl(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function wl(e){return w(()=>{let t=typeof e=="function"?e():e,n=[];for(let[r,i]of Object.entries(t)){if(!r)continue;let s=typeof i=="function"?i():i;s!=null&&n.push(`${bl(r)}: ${s}`)}return n.join("; ")},void 0,{name:"StyleMap"})}var Sl=Symbol.for("fluixi.owner"),Lt=1,Gs=3,Ys=8,xl=Symbol.for("fluixi.serverElementRenderer"),qi=Symbol.for("fluixi.serverElementRendered");function yt(e){if(e.nodeType!==Lt)return;let t=e;if(typeof t.localName!="string"||!t.localName.includes("-")||t[qi])return;let n=globalThis[xl];n&&(t[qi]=!0,n(t))}var Xs;Xs=Ot;var jt=class{constructor(){this[Xs]=!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),yt(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),yt(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,yt(e)),t}addEventListener(){}removeEventListener(){}},Xn=class Zs extends jt{constructor(t){super(),this.nodeType=Gs,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 Zs(this.data)}},kl=class Qs extends jt{constructor(t){super(),this.nodeType=Lt,this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new Qs(this.rawOuterHTML)}},eo=class to extends jt{constructor(t){super(),this.nodeType=Ys,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new to(this.data)}},El=class{constructor(){this.cssText=""}setProperty(e,t){this[e]=t}removeProperty(e){delete this[e]}},Al=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}},wn=class no extends jt{constructor(t,n=!1){if(super(),this.nodeType=Lt,this.attributes=new Map,this.style=new El,this.classList=new Al(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,this.localName.includes("-")){let r=x();r&&(this[Sl]=r)}}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 Xn(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 no(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}},_l=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ro=/&/g,io=/</g,so=/>/g,$l=/"/g;function hn(e){return e.replace(ro,"&amp;").replace(io,"&lt;").replace(so,"&gt;")}function Hi(e){return e.replace(ro,"&amp;").replace($l,"&quot;").replace(io,"&lt;").replace(so,"&gt;")}function Ol(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Cl(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(`${Ol(n)}: ${r}`)}return t.join("; ")}function Nl(e){let t="",n=Cl(e.style);for(let[r,i]of e.attributes)r==="style"&&n||(t+=` ${r}="${Hi(i)}"`);if(n){let r=e.attributes.get("style"),i=r?`${r.replace(/;\s*$/,"")}; ${n}`:n;t+=` style="${Hi(i)}"`}return t}function ne(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return hn(e);if(typeof e=="number")return hn(String(e));if(typeof e=="function")return ne(e());if(Array.isArray(e))return e.map(ne).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case Gs:return hn(e.data??"");case Ys:return`<!--${e.data??""}-->`;case Lt:{yt(e);let t=e.localName,n=`<${t}${Nl(e)}>`;if(_l.has(t))return n;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(ne).join("");return`${n}${r}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(ne).join(""):""}var Tl=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Rl={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function Wi(e){return e.replace(/&(#?\w+);/g,(t,n)=>Rl[n]??t)}var K=class extends Error{};function Ml(e,t=!1){let n=0,r=[],i=[],s=l=>{let a=i[i.length-1];a?a.appendChild(l):r.push(l)};for(;n<e.length;){let l=e.indexOf("<",n);if(l===-1){c(e.slice(n));break}if(l>n&&c(e.slice(n,l)),e.startsWith("<!--",l)){let a=e.indexOf("-->",l);if(a===-1)throw new K(`unterminated comment at ${l}`);s(new eo(e.slice(l+4,a))),n=a+3;continue}if(e[l+1]==="/"){let a=e.indexOf(">",l);if(a===-1)throw new K(`unterminated closing tag at ${l}`);let f=e.slice(l+2,a).trim().toLowerCase(),d=i.pop();if(!d||d.localName!==f)throw new K(`</${f}> does not close <${d?.localName??"nothing"}>`);n=a+1;continue}n=u(l)}if(i.length>0)throw new K(`unclosed <${i[i.length-1].localName}>`);let o=r[0];if(r.length!==1||!(o instanceof wn))throw new K(`expected exactly one root element, got ${r.length}`);return o;function c(l){l!==""&&s(new Xn(Wi(l)))}function u(l){let a=/[\s/>]/.exec(e.slice(l+1));if(!a)throw new K(`unterminated tag at ${l}`);let f=e.slice(l+1,l+1+a.index).toLowerCase(),d=new wn(f,t),p=l+1+a.index;for(;p<e.length;){for(;p<e.length&&/\s/.test(e[p]);)p++;if(e[p]===">"){p++;break}if(e[p]==="/"&&e[p+1]===">"){p+=2;break}let g=p;for(;p<e.length&&!/[\s=/>]/.test(e[p]);)p++;let v=e.slice(g,p);if(v==="")throw new K(`malformed attribute at ${p}`);if(e[p]==="="){if(e[p+1]!=='"')throw new K(`attribute ${v} must have a double-quoted value`);let b=e.indexOf('"',p+2);if(b===-1)throw new K(`unterminated value for ${v}`);d.setAttribute(v,Wi(e.slice(p+2,b))),p=b+1}else d.setAttribute(v,"")}return s(d),Tl.has(f)||i.push(d),p}}var Bi=!1;function oo(){Bi||(Bi=!0,Ma({createElement:(e,t)=>new wn(e,t),createText:e=>new Xn(e),createRaw:e=>new kl(e),parseTemplate:(e,t)=>Ml(e,t),createComment:e=>new eo(e)}))}function Pl(e,t={}){let n=$();oo(),Me(!0);let r=En(t.event);r.hydrationKeys=t.hydrationKeys!==!1;try{return _n(r,()=>W(i=>{try{let s=typeof e=="function"?e():e;return ne(s)}finally{i()}}))}finally{An(r),Me(n)}}var Vi=!1,Fi=new WeakMap;function Dl(){Vi||(Vi=!0,Pr(e=>{X()?.pending.add(e)}),nt(()=>X()?.nextResourceId()??""),Ir((e,t)=>{e&&X()?.data.set(e,t)}),jr(()=>{let e=X();if(!e)return;let t=Fi.get(e);return t||Fi.set(e,t=Lr()),t}))}var Sn=null;function Il(e){Sn=e}function co(e){if(e.data.size===0)return"";let t={};for(let[r,i]of e.data){let s=i;if(Sn)try{s=Sn(i,r)}catch{continue}s!==void 0&&(typeof s=="function"||typeof s=="symbol"||(t[r]=s))}if(Object.keys(t).length===0)return"";let n=Bs(JSON.stringify(t));return n==="{}"?"":`<script type="application/json" id="${Wn}">${n}<\/script>`}var Ll=50;async function jl(e,t={}){let n=$();oo(),Me(!0),Dl();let r=En(t.event);r.hydrationKeys=t.hydrationKeys!==!1;try{return await _n(r,async()=>{t.preload&&await t.preload(t.event);let i,s=null,o=()=>{};W(a=>{o=a,s=x(),i=typeof e=="function"?e():e});let c=()=>{try{E(s,()=>ne(i))}catch{}};c();let u=0;for(;r.pending.size>0&&u++<Ll;){let a=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(a),await Rr(),c()}let l=E(s,()=>ne(i))+co(r);return o(),l})}finally{An(r),Me(n)}}var ql={createComponent:Pt,createElement:ns,createNativeElement:Mt,createTemplate:Rn,cloneTemplate:In,templateNode:Ts,holeContent:Dn,holeEnd:Pn,holeScope:Mn,createPortal:Ls,render:Be,hydrate:Ve,insert:I,appendChildren:is,removeChildren:rs,spread:Ps,applyProps:Hn,mergeProps:Ds,bindPair:qs,setProperty:ce,setDynamicProperty:Le,setAttribute:H,setDynamicAttribute:Ie,removeAttribute:ts,getAttribute:es,setClassName:Se,addClass:Xi,removeClass:Zi,toggleClass:Qi,setStyles:kn,delegateEvents:Rt,addDelegatedEventListener:Tn,removeDelegatedEventListener:_t,handleRef:We,resetIntegration:Ws,isIntegrationInitialized:Hs},Hl=ql;function Wl(e){let t=(n,r)=>{n.parent=r;let i=Bl(n);for(let s of i)t(s,n)};return t(e,null),e}function Bl(e){switch(e.kind){case"Root":case"Element":case"Component":case"Fragment":return e.children;default:return[]}}var Vl=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()}}},ao=new Set(["capture","once","passive","prevent","stop","self"]);function se(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 lo=(e,t)=>({kind:"Attribute",name:t?e.name.slice(1):e.name,value:e.value,boolean:t,loc:e.loc}),fo=[{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("."),s=r.toLowerCase();for(let o of i)ao.has(o)||e.report("invalid-directive",`Unknown event modifier ".${o}" — expected one of ${[...ao].join(", ")}`);return{kind:"EventBinding",name:s,syntax:t,modifiers:i,hole:se(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:se(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:se(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:se(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:se(e,"if directive"),loc:e.loc})},{id:"each",elementOnly:!0,match:e=>e==="each",build:e=>({kind:"EachDirective",hole:se(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:se(e,"ref binding"),loc:e.loc})},{id:"property",match:e=>e[0]===".",build:e=>({kind:"PropertyBinding",name:e.name.slice(1),hole:se(e,"property binding"),loc:e.loc})},{id:"boolean",match:e=>e[0]==="?",build:e=>lo(e,!0)}];function Fl(e,t=fo,n={component:!1}){for(let r of t)if(!(r.elementOnly&&n.component)&&r.match(e.name))return r.build(e);return lo(e,!1)}var zl=new Set(["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","clipPath","text"]),Ul=new Set(["script","style","textarea","title"]),Kl=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Jl(e){return e.length>0&&(e[0]!==e[0].toLowerCase()||e.includes("."))}var Gl=new Set(["a","button","input","select","textarea","summary","details","option","label"]),Yl=new Set(["keydown","keyup","keypress"]);function xe(e,t){return e.attributes.find(n=>"name"in n&&n.name===t)}function Xl(e){return e.attributes.some(t=>t.kind==="Spread")}function qt(e,t){let n=xe(e,t);if(!n||n.kind!=="Attribute"||!n.value)return;let r=n.value;return r.kind==="static"?r.value:void 0}function Zl(e){let t=qt(e,"role");return t==="presentation"||t==="none"?!0:qt(e,"aria-hidden")==="true"}function uo(e,t){return e.attributes.some(n=>n.kind==="EventBinding"&&t(n.name))}function Ql(e){let t=[],n=(i,s,o)=>{t.push({code:s,message:o,severity:"warning",loc:i.loc})},r=i=>{for(let s of i){s.kind==="Element"&&ef(s,n);let o="children"in s?s.children:void 0;o&&r(o)}};return r(e.children),t}function ef(e,t){if(Xl(e))return;let n=e.tag.toLowerCase();n==="img"&&!xe(e,"alt")&&!Zl(e)&&t(e,"a11y-img-alt",'An `img` needs an `alt`. Use `alt=""` when the image is decorative.'),n==="a"&&!xe(e,"href")&&!xe(e,"role")&&t(e,"a11y-anchor-href","An `a` without `href` is not a link. Use a `button` for an action."),n==="iframe"&&!xe(e,"title")&&t(e,"a11y-iframe-title","An `iframe` needs a `title` describing its content.");let r=qt(e,"tabindex")??qt(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."),!Gl.has(n)&&uo(e,i=>i==="click")&&!xe(e,"role")&&!uo(e,i=>Yl.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 tf=/[A-Za-z0-9\-_:@.?]/,nf=class{constructor(e,t){this.diagnostics=[],this.r=new Vl(e),this.svg=t.svg??!1,this.directives=t.directives??fo,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 Wl(n),this.validateTree(n),this.accessibility&&this.diagnostics.push(...Ql(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(o=>o.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=Jl(t),r=this.parseAttributes(n);this.foldEachKey(r,e),this.r.skipWhitespace();let i=t.toLowerCase(),s=!n&&Ul.has(i),o=!n&&Kl.has(i),c=!1,u=[];if(this.r.startsWith("/>"))this.r.advance(),this.r.advance(),c=!0;else if(this.r.peek()===">"&&this.r.advance(),!o)if(u=s?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 l=this.r.span(e);if(n)return{kind:"Component",tag:t,tagHole:null,attributes:r,children:u,selfClosing:c,loc:l};let a=this.svg||zl.has(t)?"svg":"html";return{kind:"Element",tag:t,namespace:a,attributes:r,children:u,selfClosing:c,rawText:s,loc:l}}parseRawText(e){let t=[],n="</"+e.toLowerCase(),r="",i=this.r.pos(),s=()=>{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()){s();let o=this.r.takeHole();t.push({kind:"Expression",hole:o.index,loc:o.loc}),i=this.r.pos();continue}r||(i=this.r.pos()),r+=this.r.advance()}return s(),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 u=this.r.takeHole();t.push({kind:"Spread",hole:u.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 s=null;this.r.peek()==="="&&(this.r.advance(),this.r.skipWhitespace(),s=this.parseAttrValue());let o={name:r,nameLoc:i,value:s,loc:this.r.span(n),report:(c,u)=>this.report(c,"error",u,this.r.span(n))};t.push(Fl(o,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,s=0,o=0;for(let a of e)a.kind==="EachDirective"?(n=a,i++):a.kind==="IfDirective"?r++:a.kind==="ElseDirective"?s++:a.kind==="RefBinding"&&o++;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),o>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&&s>0&&this.report("invalid-directive","error","`if` and `else` cannot be on the same element",c);let u=e.findIndex(a=>a.kind==="Attribute"&&a.name==="key");if(!n){u!==-1&&this.report("invalid-directive","error","`key` requires an `each` directive on the same element",c);return}if(u===-1)return;let l=e[u];l.kind==="Attribute"&&l.value&&(l.value.kind==="static"?n.key={static:l.value.value}:l.value.kind==="hole"&&(n.key={hole:l.value.hole})),e.splice(u,1)}readName(){return this.r.readWhile(e=>tf.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 Qn(e,t={}){return new nf(e,t).parse()}function rf(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 ho(e,t={}){return Qn(rf(e),t)}var po="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",sf=new Uint8Array(64),of=new Uint8Array(128);for(let e=0;e<po.length;e++){let t=po.charCodeAt(e);sf[e]=t,of[t]=e}var ch=1024*16,mo="data-fx-s";function cf(e,t){let n=r=>{let i=r.children;if(i)for(let s=i.length-1;s>=0;s--){let o=i[s];o.kind==="element"&&o.tag==="style"&&t.owner?i.splice(s,1):n(o)}t.scope&&r.kind==="element"&&r.tag!=="style"&&r.props&&!r.props.some(s=>s.name===mo)&&r.props.unshift({name:mo,kind:"attr",literal:t.scope})};n(e)}function af(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 uf(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 s of i.children)r(s);return!1;case"fragment":for(let s of i.children)r(s);return!1;case"element":{let s=!0;for(let c of i.children)r(c)||(s=!1);let o;for(let c of i.props)if(o=af(c),o)break;return!o&&!s&&(o=lf(i)),i.static=!o,o?n.set(i,o):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 lf(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 rr={kind:"eager"},ff=["pointerdown","focusin","keydown"],yo=new Set(["eager","idle","visible","interaction","media","never"]),Ht=class extends Error{};function df(e,t){let n=e.slice(5);if(!yo.has(n))throw new Ht(`Unknown load strategy 'load:${n}'. Expected one of ${[...yo].join(", ")}.`);switch(n){case"eager":return rr;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?hf(t):[...ff]};case"media":if(!t)throw new Ht(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new Ht(`Unhandled load strategy '${n}'.`)}}function hf(e){let t=e.split(/[\s,]+/).map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new Ht("'load:interaction' was given no event names.");return t}function pf(e){return e.kind!=="eager"&&e.kind!=="never"}var sr=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],or=["Suspense","SuspenseList","Await"],cr=["Router","Outlet","Redirect","Link"],ah=[...sr,...or,...cr],vo=new Set([...sr,...or]);function mf(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:n="@fluixi/core",routerModule:r="@fluixi/core/router"}=e,i={};for(let s of sr)i[s]=t;for(let s of or)i[s]=n;for(let s of cr)i[s]=r;return i}function yf(e,t={}){let{resolver:n,isBound:r,modules:i,strategyFor:s}=t,o=mf(i),c=new Map,u=new Set,l=f=>{let{name:d}=f;if(!d||d.includes(".")||r?.(d))return;let p=a(d);if(!p){u.add(d);return}let g=p.origin==="builtin"&&vo.has(d)?rr:s?.(f)??rr;f.source={...p,loading:g},c.set(d,f.source)},a=f=>{if(vo.has(f))return{module:o[f],export:f,origin:"builtin"};let d=n?.resolve(f);if(d)return{module:d.module,export:d.export,origin:"rule"};if(cr.includes(f))return{module:o[f],export:f,origin:"builtin"}};return ar(e,f=>{f.kind==="component"&&l(f)}),{resolved:c,unresolved:[...u]}}function ar(e,t){let n=Array.isArray(e)?e:[e];for(let r of n){t(r);let i=r.children;i&&ar(i,t)}}function vf(e){let t=[];ar(e,s=>{s.kind==="component"&&s.source&&t.push(s)});let n=new Set,r=new Set;for(let s of t){let{module:o,loading:c}=s.source;c.kind==="eager"&&n.add(o),c.kind==="never"&&r.add(o)}let i=new Map;for(let s of t){let o=s.source;pf(o.loading)&&n.has(o.module)&&(o.loading={kind:"eager"},i.set(o.module,(i.get(o.module)??0)+1))}return{collapsed:i,conflicted:[...r].filter(s=>n.has(s))}}var gf=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_o={className:"class",htmlFor:"for"},$o=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),bf=new Set(["script","style","textarea","title"]);function Oo(e){return bf.has(e)}function Co(e){return _o[e]??e}function ke(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!$o.has(e.name)}function No(e){if(!e.static||Oo(e.tag))return!1;for(let t of e.props)if(!ke(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&No(t)))return!1;return!0}function ur(e){let t=e.props.map(kf).filter(Boolean).join(""),n=`<${e.tag}${t}>`;return gf.has(e.tag)?n:`${n}${e.children.map(wf).join("")}</${e.tag}>`}function wf(e){if(e.kind==="text")return Af(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return ur(e)}var Sf=new Set(["draggable","spellcheck","contenteditable"]);function xf(e){return e.startsWith("aria-")||Sf.has(e.toLowerCase())}function kf(e){let t=_o[e.name]??e.name,n=e.literal;return(n===!0||n===!1||n===void 0)&&xf(t)?` ${t}="${n!==!1}"`:n===!0||n===void 0?` ${t}`:n===!1||n===null?"":` ${t}="${Ef(String(n))}"`}function Ef(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Af(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function go(e){let t=[],n,r=i=>{n??=i.at?.file,t.push(i.at?.line??0,i.at?.column??0);for(let s of i.children)s.kind==="element"&&r(s)};return r(e),n&&t.some(i=>i!==0)?{file:n,pos:t}:void 0}var _f="<!--fx-->",$f="<!--fx/-->";function Wt(e){return e.kind==="expr"||e.kind==="component"||e.kind==="control"}function Of(e){return e.kind==="text"||e.kind==="element"&&To(e)}var Cf=new Set(["indeterminate"]);function Nf(e){if(e.kind==="spread")return null;if(e.name==="ref")return"ref";if(e.name==="use")return"use";if(e.kind==="event")return e.event?"event":null;if(e.kind==="prop")return"property";if(e.kind!=="attr")return null;let t=e.name;return t.startsWith("on:")?"nativeEvent":t.startsWith("prop:")?"property":t.startsWith("attr:")?"attr":t.startsWith("bool:")?"boolAttr":t==="className"||t==="class"?ke(e)?"serialize":"class":t==="classList"?ke(e)?"serialize":e.reactive?"classListDynamic":"classList":t==="style"?ke(e)?"serialize":e.reactive?"styleDynamic":"style":t.includes(":")||$o.has(t)?null:Cf.has(t)?"property":e.expr===void 0?ke(e)?"serialize":null:"attr"}function Tf(e){let t=[],n=new Map;for(let r of e.props)n.has(r.name)||t.push(r.name),n.set(r.name,r);return t.map(r=>n.get(r))}function Bt(e){let t=e.tag.includes("-"),n={serialize:[],bindings:[]};for(let r of Tf(e)){let i=Nf(r);if(i===null)return null;if(i==="serialize"){n.serialize.push(r);continue}if(t)return null;n.bindings.push({prop:r,kind:i})}return n}function To(e){return e.svg||Oo(e.tag)||!Bt(e)?!1:e.children.every(t=>Of(t)||Wt(t))}function Ro(e){if(Wt(e))return!0;let t=e.children;return t?t.some(Ro):!1}function Mo(e){if(e.kind!=="element")return!1;let t=Bt(e);return t&&t.bindings.length>0?!0:e.children.some(Mo)}function er(e){return Ro(e)||Mo(e)}function Po(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"||Po(t))}function Rf(e){if(!To(e)||!Po(e)||!er(e))return null;let t=[],n=[],r=[],i=0,s=c=>{let u=`_n$${i++}`;return t.push({ref:u,expr:c}),u};return o(e,"_el$"),{html:Mf(e),tag:e.tag,steps:t,holes:n,bindings:r};function o(c,u){let l=Bt(c);if(l)for(let d of l.bindings)r.push({ref:u,prop:d.prop,kind:d.kind});let a=-1;c.children.forEach((d,p)=>{er(d)&&(a=p)});let f=null;for(let d=0;d<=a;d++){let p=c.children[d],g=f?`${f}.nextSibling`:`${u}.firstChild`;if(Wt(p)){let b=s(g),C=s(`holeEnd(${b})`);n.push({parentRef:u,startRef:b,endRef:C,node:p}),f=C;continue}let v=s(g);p.kind==="element"&&er(p)&&o(p,v),f=v}}}function Mf(e){return ur(Do(e)).split(Io).join(_f+$f)}function Do(e){let t=Bt(e);return{...e,props:t?t.serialize:[],children:e.children.map(n=>Wt(n)?{kind:"text",value:Io}:n.kind==="element"?Do(n):n)}}var Io="\0fx-hole\0",Lo={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},uh={version:2,module:"@fluixi/dom",symbols:[...Lo.symbols,"template","cloneTemplate","walk"]},P="@fluixi/reactive/signal",Pf={$signal:{export:"signal",module:P,returns:"signal-handle"},$memo:{export:"memo",module:P,returns:"memo-handle"},$effect:{export:"effect",module:P,returns:"effect"},$store:{export:"store",module:"@fluixi/reactive/store",returns:"store-handle"},$resource:{export:"resource",module:P,returns:"resource-handle"},$cachedResource:{export:"cachedResource",module:"@fluixi/reactive/cached-resource",returns:"resource-handle"},$selector:{export:"createSelector",module:P,returns:"memo-accessor"},$deferred:{export:"createDeferred",module:P,returns:"memo-accessor"},$untrack:{export:"untrack",module:P,returns:"plain"},$untrackStore:{export:"untrackStore",module:"@fluixi/reactive/store",returns:"plain"},$batch:{export:"batch",module:P,returns:"plain"},$cleanup:{export:"onCleanup",module:P,returns:"plain"},$root:{export:"root",module:P,returns:"plain"},$context:{export:"context",module:P,returns:"plain"},$renderEffect:{export:"renderEffect",module:P,returns:"effect"},$computed:{export:"computed",module:P,returns:"effect"},$storage:{export:"useStorage",module:"@fluixi/core/storage",returns:"plain"},$asyncStorage:{export:"useAsyncStorage",module:"@fluixi/core/storage",returns:"plain"},$persisted:{export:"persisted",module:"@fluixi/core/storage",returns:"signal-handle"},$env:{export:"env",module:"@fluixi/start/env",returns:"plain"}},lh=new RegExp(`\\$(?:${Object.keys(Pf).map(e=>e.slice(1)).join("|")})\\s*\\(`),Df="__fx_source",If="__fx_hole",Fe=(e,t,n,r)=>`(globalThis.${If} ?? ((f) => f))(${e},${t},${n}${r===void 0?"":`,${JSON.stringify(r)}`})`,Lf="__fx_props",jf=(e,t)=>`(globalThis.${Lf} ?? ((p) => p))(${e},${JSON.stringify(t)})`;function jo(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 qo(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 s=e[n];if(s==="\\")n+=2;else if(s==="`"){let o=qo(e,n);if(o<0)return-1;n=o}else if(s==='"'||s==="'"){let o=jo(e,n);if(o<0)return-1;n=o}else s==="{"?i++:s==="}"&&i--,n++}}else n++}}return-1}function qf(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 s=r+1;for(;s<e.length&&/[a-z]/i.test(e[s]);)s++;return s}}}return-1}function Hf(e){return e!==""&&/[A-Za-z0-9_$)\]]/.test(e)}function Wf(e){let t=0,n="",r=0;for(;r<e.length;){let i=e[r];if(i==='"'||i==="'"){let s=jo(e,r);if(s<0)return null;r=s,n=i}else if(i==="`"){let s=qo(e,r);if(s<0)return null;r=s,n=i}else{if(i==="/"&&e[r+1]==="/")return null;if(i==="/"&&e[r+1]==="*"){let s=e.indexOf("*/",r+2);if(s<0)return null;r=s+2}else if(i==="/"&&!Hf(n)){let s=qf(e,r);if(s<0)return null;r=s,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 _(e,t){let n=e.trim();return n===""?`(${e})`:t==="arrowBody"&&n[0]==="{"?`(${e})`:Wf(n)===!1?e:`(${e})`}var Bf={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};function Vf(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function ir(e){return Vf(e)?e:JSON.stringify(e)}function Ho(e){if(e.expr!==void 0){if(e.name==="ref"&&e.at)return Fe(_(e.expr,"value"),e.at.line,e.at.column,e.expr);if(!e.reactive)return _(e.expr,"value");let t=`() => ${_(e.expr,"arrowBody")}`;return e.at?Fe(t,e.at.line,e.at.column,e.directive):t}return JSON.stringify(e.literal??!0)}function Ff(e){return e.expr!==void 0?_(e.expr,"value"):JSON.stringify(e.literal??!0)}function zf(e,t,n){let r=e.filter(c=>c.kind==="spread"),s=e.filter(c=>c.kind!=="spread").map(c=>`${ir(c.name)}: ${Ho(c)}`);t!=null&&s.push(`children: ${t}`);let o=`{ ${s.join(", ")} }`;return r.length>0?(n.add("mergeProps"),`mergeProps(${r.map(c=>c.expr).join(", ")}, ${o})`):o}function bo(e,t){return t?Fe(e,t.line,t.column):e}function Wo(e,t,n){if(e.length===1)return ze(e[0],t,n);let r=!1;return`[${e.map(s=>{let o=ze(s,t,n);return s.kind==="element"&&r?(t.add("deferElement"),`deferElement(() => ${_(o,"arrowBody")})`):((s.kind==="component"||s.kind==="control"||s.kind==="expr"&&s.reactive)&&(r=!0),o)}).join(", ")}]`}function wo(e,t,n,r,i,s){r.add("createMemo"),r.add("createComponent");let o=t.filter(d=>d.kind==="spread"),c=t.filter(d=>d.kind!=="spread"),u=c.map(d=>[d.name,Ff(d)]);n.length>0&&u.push(["children",Wo(n,r,i)]);let l=`{ ${u.map(([d,p])=>`get ${ir(d)}() { return ${p}; }`).join(", ")} }`;if(u.some(([,d])=>/\bthis\b/.test(d))){let d=u.map(([g,v])=>`${JSON.stringify(g)}: () => (${v})`);l=`((_$t) => ({ ${u.map(([g])=>`get ${ir(g)}() { return _$t[${JSON.stringify(g)}](); }`).join(", ")} }))({ ${d.join(", ")} })`}o.length>0&&(r.add("mergeProps"),l=`mergeProps(${o.map(d=>d.expr).join(", ")}, ${l})`);let a={};for(let d of c)d.at&&(a[d.name]=[d.at.line,d.at.column]);Object.keys(a).length&&(l=jf(l,a));let f=s?`globalThis.${Df}?.(${JSON.stringify(s.file)},${s.line},${s.column},${JSON.stringify(e)}), `:"";return`createMemo(${_(`${f}() => createComponent(${e}, ${l})`,"value")})`}function tr(e){let t=e.prop.name;return e.kind==="boolAttr"||t.startsWith("prop:")||t.startsWith("attr:")?t.slice(5):Co(t)}function Uf(e,t){let{ref:n,prop:r,kind:i}=e,s=Ho(r);switch(i){case"class":return t.add("setClassName"),`setClassName(${n}, ${s});`;case"classList":return t.add("setClassList"),`setClassList(${n}, ${s}, []);`;case"classListDynamic":return t.add("setDynamicClassList"),`setDynamicClassList(${n}, ${s});`;case"style":return t.add("setStyle"),`setStyle(${n}, ${s}, []);`;case"styleDynamic":return t.add("setDynamicStyle"),`setDynamicStyle(${n}, ${s});`;case"attr":return t.add("setDynamicAttribute"),`setDynamicAttribute(${n}, ${JSON.stringify(tr(e))}, ${s});`;case"property":return t.add("setDynamicProperty"),`setDynamicProperty(${n}, ${JSON.stringify(tr(e))}, ${s});`;case"boolAttr":return t.add("setDynamicBoolAttribute"),`setDynamicBoolAttribute(${n}, ${JSON.stringify(tr(e))}, ${s});`;case"event":return t.add("addDelegatedEventListener"),`addDelegatedEventListener(${n}, ${JSON.stringify(r.event.name)}, ${s});`;case"nativeEvent":return t.add("addNativeEventListener"),`addNativeEventListener(${n}, ${JSON.stringify(r.name.slice(3))}, ${s});`;case"ref":return t.add("handleRef"),`handleRef(${s}, ${n});`;case"use":return t.add("applyUse"),`applyUse(${n}, ${s});`}}function Kf(e,t){let n=Co(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 Bo=!1;function ze(e,t,n){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":{if(!e.reactive)return _(e.code,"value");let r=`() => ${_(e.code,"arrowBody")}`;return e.at?Fe(r,e.at.line,e.at.column):r}case"fragment":return e.children.length===0?"null":Wo(e.children,t,n);case"component":return bo(wo(e.name,e.props,e.children,t,n,e.at),e.bindAt??e.at);case"control":{let r=Bf[e.control]??e.control;return t.add(r),bo(wo(r,e.props,e.children,t,n),e.bindAt)}case"element":{if(n&&e.static&&!e.svg&&No(e)){t.add("templateNode");let c=`_tmpl$${n.length}`;n.push({id:c,html:ur(e),tag:e.tag,svg:!1});let u=go(e);return u?`templateNode(${c}, ${JSON.stringify(e.tag)}, false, false, ${JSON.stringify(u)})`:`templateNode(${c}, ${JSON.stringify(e.tag)})`}if(n&&Bo){let c=Rf(e);if(c){t.add("templateNode"),t.add("insert"),t.add("holeEnd"),t.add("holeContent"),t.add("holeScope");let u=`_tmpl$${n.length}`;n.push({id:u,html:c.html,tag:c.tag,svg:!1});let l=go(e),a=[`const _el$ = templateNode(${u}, ${JSON.stringify(c.tag)}, true${l?`, false, ${JSON.stringify(l)}`:""});`];for(let f of c.steps)a.push(`const ${f.ref} = ${f.expr};`);for(let f of c.bindings)a.push(Uf(f,t));for(let f of c.holes)a.push(`insert(${f.parentRef}, holeScope(${f.startRef}, () => ${_(ze(f.node,t,n),"arrowBody")}), ${f.endRef}, holeContent(${f.startRef}, ${f.endRef}));`);return a.push("return _el$;"),`(() => { ${a.join(" ")} })()`}}t.add("createNativeElement");let r=JSON.stringify(e.tag),i="_el$",s=[],o=e.at?`${r}, ${e.svg}, ${JSON.stringify(e.at)}`:e.svg?`${r}, true`:r;if(s.push(`const ${i} = createNativeElement(${o});`),e.props.length>0)if(!e.svg&&e.props.every(ke))for(let c of e.props)s.push(Kf(i,c));else{t.add("spread");let c=e.svg?", isSVG: true":"",u=e.props.filter(a=>a.kind!=="spread"&&a.expr!==void 0&&a.reactive&&a.name!=="ref").map(a=>a.name),l=e.tag.includes("-")?`, isCustomElement: true, accessors: ${JSON.stringify(u)}`:"";s.push(`spread({ element: ${i}, props: ${zf(e.props,null,t)}${c}${l} });`)}for(let c of e.children){t.add("insert");let u=ze(c,t,n),l=c.kind==="expr"&&(c.reactive||!Gf(c.code))||c.kind==="component"||c.kind==="control";s.push(l?`insert(${i}, ${u}, null);`:`insert(${i}, ${u});`)}return s.push(`return ${i};`),`(() => { ${s.join(" ")} })()`}}}var Jf=/^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/,Gf=e=>Jf.test(e);function Vo(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 Fo={name:"imperative",contract:Lo,emit(e,t){let n=new Set,r=t?.templateClone!==!1?[]:void 0;return Bo=t?.partialTemplates===!0,{code:ze(e,n,r),imports:Array.from(n),templates:r}}},Yf=e=>"components"in e;function So(e,t){return e.replace(/\$(\d+)/g,(n,r)=>t[Number(r)]??n)}function Xf(e,t){return typeof t=="string"?{module:t,export:e}:t}function Zf(e=[]){let t=new Map,n=[],r=[];for(let o of e){if(!Yf(o)){r.push(o);continue}for(let[c,u]of Object.entries(o.components)){let l=Xf(c,u),a=t.get(c);if(a&&a.module!==l.module){let f=n.find(d=>d.name===c);f?f.modules.push(l.module):n.push({name:c,modules:[a.module,l.module]});continue}t.set(c,l)}}let i=new Map;return{resolve:o=>{if(i.has(o))return i.get(o);let c=t.get(o);if(!c)for(let u of r){let l=o.match(new RegExp(u.match.source,u.match.flags.replace("g","")));if(l){c={module:So(u.module,l),export:u.export?So(u.export,l):o};break}}return i.set(o,c),c},names:()=>[...t.keys()],conflicts:()=>n}}function xo(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 s=t[i].replace(/\t/g," ");i!==0&&(s=s.replace(/^ +/,"")),i!==t.length-1&&(s=s.replace(/ +$/,"")),s&&(i!==n&&(s+=" "),r+=s)}return r}var ko={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Qf=/&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;function nr(e){return e.includes("&")?e.replace(Qf,(t,n,r,i)=>{let s=n?parseInt(n,16):r?parseInt(r,10):Object.prototype.hasOwnProperty.call(ko,i)?ko[i]:void 0;return s!==void 0&&s<=1114111?String.fromCodePoint(s):t}):e}var Eo=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);function ed(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}var td="container";function Ao(e){return e.charAt(0).toUpperCase()+e.slice(1)}var nd=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}=Fo.emit(e,{});for(let i of n)this.used.add(i);return Vo(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 s=r.attributes.find(o=>o.kind==="IfDirective");if(s&&s.kind==="IfDirective"){let o=n+1;o<e.length&&this.isBlankText(e[o])&&o++;let c=e[o],u=c&&(c.kind==="Element"||c.kind==="Component")&&c.attributes.some(l=>l.kind==="ElseDirective");t.push(this.lowerIf(r,s.hole,u?c:null)),u&&(n=o);continue}}let i=this.lowerNode(r);i&&t.push(i)}return t}isBlankText(e){return e.kind==="Text"&&!e.raw&&xo(e.value)===""}lowerNode(e){switch(e.kind){case"Text":{if(e.raw)return{kind:"text",value:e.value};let t=nr(xo(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(s=>s.kind==="Attribute"&&s.name==="is");if(e.tag==="component"&&t&&t.value&&t.value.kind==="hole"){let s=e.attributes.filter(c=>c!==t),o=this.lowerComponent({...e,kind:"Component",tag:"Dynamic",tagHole:null,attributes:s});return o.props.unshift({name:"component",kind:"attr",expr:`() => ${_(this.hole(t.value.hole).code,"arrowBody")}`}),o}let n=this.lowerEach(e),r=n?[n]:this.lowerChildren(e.children);if(e.tag===td)return r.length===1?r[0]:{kind:"fragment",children:r};let i=this.tagAt(e);return{kind:"element",tag:e.tag,svg:e.namespace==="svg",props:this.lowerAttributes(e.attributes,!0),children:r,static:!1,...i?{at:i}:{}}}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[l,a]of r){let f=a.length===1?a[0]:{kind:"fragment",children:a},d={name:l,kind:"attr",expr:this.emit(f),jsxElement:!0},p=n.findIndex(g=>g.name===l);p>=0?n[p]=d:n.push(d)}let s=e.attributes.find(l=>l.kind==="LoadDirective"),o=s?df(`load:${s.strategy}`,s.modifier):void 0,c=n.find(l=>l.at&&l.reactive)?.at,u=this.tagAt(e);return{kind:"component",name:t,props:n,children:this.lowerChildren(i),...u?{at:u}:{},...c?{bindAt:c}:{},...o?{load:o}:{}}}partitionSlots(e){let t=new Map,n=[];for(let r of e){if(r.kind==="Element"||r.kind==="Component"){let i=r.attributes.find(s=>s.kind==="Attribute"&&s.name==="slot");if(i&&i.value&&i.value.kind==="static"){let s={...r,attributes:r.attributes.filter(u=>u!==i)},o=s.kind==="Element"?this.lowerElement(s):this.lowerComponent(s),c=t.get(i.value.value)??[];c.push(o),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,u=>u.kind==="ElseDirective");i.push({name:"fallback",kind:"attr",expr:this.emit(c),jsxElement:!0})}let s=this.stripAndLower(e,c=>c.kind==="IfDirective"),o=this.tagAt(e);return{kind:"component",name:"Show",props:i,children:[s],...o?{at:o}:{},...r.at?{bindAt:r.at}:{}}}lowerEach(e){let t=e.attributes.find(u=>u.kind==="EachDirective");if(!t||t.kind!=="EachDirective")return null;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 u="static"in t.key?`(item) => item[${JSON.stringify(t.key.static)}]`:this.hole(t.key.hole).code;r.push({name:"by",kind:"attr",expr:u})}let i=this.itemArrow(e),s;if(i){let u=i.bodyReactive?`() => ${_(i.body,"arrowBody")}`:_(i.body,"arrowBody");s=`(${i.params.join(", ")}) => ${u}`}else{let u=this.lowerChildren(e.children),l=u.length===1?u[0]:{kind:"fragment",children:u};s=`() => ${_(this.emit(l),"arrowBody")}`}let o=[{kind:"expr",code:s,reactive:!1}],c=this.tagAt(e);return{kind:"component",name:"For",props:r,children:o,...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)}lowerAttributes(e,t=!1){let n=!1,r=(a,f)=>{if(n||=f.reactive,!t||!f.reactive)return`${JSON.stringify(a)}: ${f.code}`;let d=`() => ${_(f.code,"arrowBody")}`;return`${JSON.stringify(a)}: ${f.at?Fe(d,f.at.line,f.at.column):d}`},i=[],s=[],o,c=[],u,l=[];for(let a of e)switch(a.kind){case"IfDirective":case"EachDirective":case"ElseDirective":break;case"Attribute":i.push(this.plainAttr(a));break;case"PropertyBinding":i.push({name:a.name,kind:"prop",expr:this.hole(a.hole).code,reactive:this.hole(a.hole).reactive,...this.hole(a.hole).at?{at:this.hole(a.hole).at}:{}});break;case"EventBinding":i.push(this.eventProp(a));break;case"RefBinding":i.push({name:"ref",kind:"ref",expr:this.hole(a.hole).code,reactive:this.hole(a.hole).reactive,...this.hole(a.hole).at?{at:this.hole(a.hole).at}:{}});break;case"Spread":i.push({name:"",kind:"spread",expr:this.hole(a.hole).code});break;case"ClassDirective":{let f=this.hole(a.hole);s.push(r(a.name,f)),o??=f.at;break}case"StyleDirective":{let f=this.hole(a.hole);c.push(r(a.name,f)),u??=f.at;break}case"BindDirective":i.push(...this.bindProps(a.name,this.hole(a.hole)));break;case"UseDirective":{let f=a.name??(a.hole!=null?this.hole(a.hole).code:null);if(!f)break;l.push(a.name!=null&&a.hole!=null?`[${f}, () => ${_(this.hole(a.hole).code,"arrowBody")}]`:`[${f}]`);break}}if(s.length>0&&i.push({name:"classList",kind:"attr",expr:`{ ${s.join(", ")} }`,reactive:!t&&n,...o?{at:o}:{}}),c.length>0){let a=`{ ${c.join(", ")} }`,f=i.findIndex(d=>d.name==="style");if(f===-1)i.push({name:"style",kind:"attr",expr:a,reactive:!t&&n,...u?{at:u}:{}});else{let d=i[f],p=d.expr===void 0?JSON.stringify(d.literal):d.reactive?`() => ${_(d.expr,"arrowBody")}`:d.expr;i[f]={name:"style",kind:"attr",expr:`[${p}, ${a}]`,reactive:!1,...d.at?{at:d.at}:{}}}}return l.length>0&&i.push({name:"use",kind:"attr",expr:`[${l.join(", ")}]`}),i}eventProp(e){let t=e.name.toLowerCase(),n=this.hole(e.hole).code;if(!(e.syntax==="colon"||e.modifiers.length>0))return{name:"on"+Ao(e.name),kind:"event",event:{name:t,delegated:Eo.has(t)},expr:n};let i=this.wrapHandler(n,e.modifiers),s=this.eventOptions(e.modifiers),o=s?`[${i}, ${s}]`:i;return{name:"on:"+t,kind:"attr",expr:o}}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",s=r?"checked":"value";this.used.add("bindPair");let o=`bindPair(${n})`;return[{name:e,kind:"attr",expr:`${o}[0]()`,reactive:!0,directive:`bind:${e}`,...t.at?{at:t.at}:{}},{name:"on"+Ao(i),kind:"event",event:{name:i,delegated:Eo.has(i)},expr:`(e) => ${o}[1](e.target.${s})`}]}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=nr(t.value),i;if(t.kind==="hole"){let u=this.hole(t.hole);return i.expr=u.code,i.reactive=u.reactive,u.at&&(i.at=u.at),i}let s=!1,o,c=t.parts.map(u=>{if("text"in u)return ed(nr(u.text));let l=this.hole(u.hole);return s=s||l.reactive,o??=l.at,"${"+l.code+"}"}).join("");return i.expr="`"+c+"`",i.reactive=s,o&&(i.at=o),i}};function rd(e,t,n,r={}){let{root:i}=Qn(e,{svg:r.svg});return new nd(t,n,r.sourceFile,r.positionAt).lowerRoot(i.children)}function id(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 s=n+e.holes[i].code.length;t.push({kind:"hole",index:i,start:n,end:s}),n=s}}),t}function zo(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 sd(id(e),e.holes,t)}function sd(e,t,n={}){let r=new Set,i=rd(e,[...t],r,{svg:n.svg,...n.sourceFile?{sourceFile:n.sourceFile}:{},...n.positionAt?{positionAt:n.positionAt}:{}});n.templateStyles&&cf(i,n.templateStyles),uf(i),yf(i,{resolver:Zf(n.resolve??[]),modules:{controlFlowModule:n.controlFlowModule??"@fluixi/dom",coreModule:n.coreModule??"@fluixi/core",routerModule:n.routerModule??"@fluixi/core/router"},strategyFor:u=>u.load}),vf(i);let{code:s,imports:o,templates:c}=Fo.emit(i,{templateClone:n.templateClone,partialTemplates:n.partialTemplates});for(let u of o)r.add(u);return n.hoistTemplates?{code:s,imports:[...r],ir:i,templates:c}:{code:Vo(s,c),imports:[...r],ir:i}}function od(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 lr(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(s=>s.kind==="EachDirective");for(let s of r.attributes)od(s,t);if(i)for(let s of r.children)s.kind==="Expression"&&t.set(s.hole,"render");lr(r.children,t,n);break}case"Root":case"Fragment":lr(r.children,t,n);break;default:break}}function Uo(e){let t=new Map,n=new Set;return lr(e.root.children,t,n),{holes:t,components:n}}var fr={...Zn,createMemo:cn},cd=["For","Index","Show","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense"],dr=new Map;function Jo(e){for(let[t,n]of Object.entries(e))dr.set(t,n)}function ad(e){return e==="text"||e==="attr"||e==="control"}function ud(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"&&ad(i)?{code:`$$v[${r}]()`,reactive:!0}:{code:`$$v[${r}]`,reactive:!1}})}function ld(e){if(dr.has(e))return dr.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 fd(e,t,n){let r=e,i=ho(r,{svg:n}),s=i.diagnostics.filter(v=>v.severity==="error");if(s.length>0)throw new Error(`[fluixi] ${n?"svg":"html"}\`\`: ${s.map(v=>v.message).join("; ")}`);let{holes:o,components:c}=Uo(i),{code:u,imports:l}=zo({statics:r,holes:ud(t,o)},{svg:n}),a=l.filter(v=>!(v in fr));if(a.length>0)throw new Error(`[fluixi] no runtime binding for: ${a.join(", ")}`);let f=Array.from(new Set([...l,...cd])).filter(v=>v in fr),d=Array.from(c).filter(v=>!f.includes(v)),p=[...f,...d],g=new Function(...p,"$$v",`return (${u});`);return{run:v=>g(...f.map(b=>fr[b]),...d.map(ld),v)}}var Ko=new WeakMap;function dd(e){let t="";for(let n of e)t+=typeof n=="function"?"f":"v";return t}function Go(e){return(t,...n)=>{let r=Ko.get(t);r||(r=new Map,Ko.set(t,r));let i=dd(n),s=r.get(i);return s||(s=fd(t,n,e),r.set(i,s)),s.run(n)}}var Yo=Go(!1),Xo=Go(!0);return rc(hd);})();
1
+ /*! @fluixi/template-runtime v1.0.0-alpha.109 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+ "use strict";var Fluixi=(()=>{var en=Object.defineProperty;var pl=Object.getOwnPropertyDescriptor;var dl=Object.getOwnPropertyNames;var hl=Object.prototype.hasOwnProperty;var ho=(e,t)=>{for(var r in t)en(e,r,{get:t[r],enumerable:!0})},ml=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dl(t))!hl.call(e,i)&&i!==r&&en(e,i,{get:()=>t[i],enumerable:!(n=pl(t,i))||n.enumerable});return e};var yl=e=>ml(en({},"__esModule",{value:!0}),e);var Gf={};ho(Gf,{Dynamic:()=>Or,ErrorBoundary:()=>_r,For:()=>Dr,Index:()=>Mr,Match:()=>Bt,Portal:()=>Ir,Show:()=>Pr,Switch:()=>Vt,batch:()=>I,define:()=>al,effect:()=>Cn,html:()=>ll,hydrate:()=>Ce,insert:()=>_,memo:()=>$n,onCleanup:()=>A,render:()=>$e,resource:()=>kn,signal:()=>An,store:()=>ni,svg:()=>ul,untrack:()=>w});var Wi={};ho(Wi,{ALWAYS_ATTRIBUTE:()=>li,ClientOnly:()=>Vn,Dynamic:()=>Or,ErrorBoundary:()=>_r,ErrorResetContext:()=>Oi,FX_DATA_ID:()=>Et,For:()=>Dr,HYDRATION_KEY:()=>Q,Index:()=>Mr,Island:()=>uc,JSX_PROPERTIES:()=>pt,Match:()=>Bt,NoSsr:()=>ws,Portal:()=>Ir,SERVER_PROPS:()=>ai,SVG_ELEMENTS:()=>Ys,SVG_NAMESPACE:()=>ut,Show:()=>Pr,Switch:()=>Vt,VERSION:()=>hr,VERSION_ATTRIBUTE:()=>vi,VOID_ELEMENTS:()=>Xs,addClass:()=>ui,addDelegatedEventListener:()=>xr,addNativeEventListener:()=>Ar,afterHydrationPass:()=>bs,appendChildren:()=>gi,appendResponseHeader:()=>Yo,applyElementProp:()=>ft,applyProps:()=>vt,applyUse:()=>$r,asComponent:()=>ct,asContext:()=>Cs,asOutlet:()=>As,asProvider:()=>$s,asRoute:()=>ks,asRouter:()=>xs,asRoutes:()=>Es,asSuspense:()=>Rs,beforeFirstRender:()=>Jo,beginAppHydration:()=>cs,bindPair:()=>Ti,captureHydrationCursor:()=>ss,checkRenderType:()=>Ns,classMap:()=>tc,cleanChildren:()=>ee,clearHydrationKeys:()=>rr,cloneTemplate:()=>kr,closest:()=>Qs,createComponent:()=>xe,createDynamicElement:()=>Tr,createElement:()=>mi,createNativeElement:()=>ke,createPortal:()=>Ni,createRequestContext:()=>rt,createTemplate:()=>Er,css:()=>hc,default:()=>zu,deferElement:()=>Ts,delegate:()=>oa,delegateEvents:()=>ht,endAppHydration:()=>ls,endRequestContext:()=>nt,endRequestScope:()=>On,errorResponseStatus:()=>Xt,escapeFxJson:()=>Hr,escapeHTML:()=>_a,fnName:()=>ka,generateID:()=>Sa,getAttribute:()=>di,getGlobal:()=>da,getLocals:()=>Xo,getOffset:()=>ia,getRequestContext:()=>V,getRequestEvent:()=>Jt,getRequestLocals:()=>Dn,getServerData:()=>Wr,getStableElementId:()=>ba,getStyle:()=>ta,handleRef:()=>Ae,hasClass:()=>ea,holeContent:()=>gt,holeEnd:()=>yt,holeScope:()=>mt,html:()=>pc,hydrate:()=>Ce,hydrateAdvancePast:()=>Pe,hydrateChildren:()=>cc,hydrateIslands:()=>fc,indexArray:()=>_e,initializeIntegration:()=>zs,insert:()=>_,insertExpression:()=>Ve,intergartionInitialized:()=>Ks,isAccessor:()=>Da,isAppHydrationPending:()=>us,isAttributeOnlyName:()=>We,isComponent:()=>J,isContext:()=>Gn,isCustomElement:()=>si,isDOMNode:()=>fa,isDelegatedEvent:()=>xa,isDomElement:()=>Yt,isDomNode:()=>Se,isDomText:()=>Zt,isEventHandler:()=>Js,isFunction:()=>Ea,isHydrating:()=>Ss,isIntegrationInitialized:()=>ii,isJSXTemplate:()=>ua,isNativeElement:()=>Oa,isOutlet:()=>Un,isPromise:()=>Be,isProvider:()=>Jn,isReactElement:()=>la,isRoute:()=>Kn,isRouter:()=>Fn,isRoutes:()=>zn,isSVGElement:()=>Nr,isServer:()=>x,isSuspense:()=>Xn,isVisible:()=>ra,iterateFn:()=>Aa,keepServerContent:()=>Ca,keyArray:()=>Oe,makeArrayFlat:()=>$i,mapArray:()=>Te,mergeProps:()=>Ri,observeIntersection:()=>aa,observeResize:()=>ca,onRequestEnd:()=>Uo,prepareRender:()=>Go,query:()=>pr,queryAll:()=>Zs,registerCoreVersion:()=>ha,registerCreateComponent:()=>Fs,registerGlobal:()=>pa,removeAttribute:()=>hi,removeChildren:()=>yi,removeClass:()=>fi,removeDelegatedEventListener:()=>dt,removeUnclaimedKeyed:()=>nr,render:()=>$e,renderToString:()=>Za,renderToStringAsync:()=>ec,requestScope:()=>Ut,resetIntegration:()=>oi,resetOnNavigation:()=>_i,runHydrationAt:()=>Ie,runWithRequestContext:()=>it,runWithoutHydration:()=>as,scrollIntoView:()=>na,serializeNode:()=>te,serializeResourceData:()=>ji,serverCustomElementProp:()=>He,setAttribute:()=>H,setClassList:()=>pe,setClassName:()=>Ee,setDataRedactor:()=>Qa,setDynamicAttribute:()=>Fe,setDynamicBoolAttribute:()=>Cr,setDynamicClassList:()=>Ta,setDynamicProperty:()=>ze,setDynamicStyle:()=>Na,setKeyScope:()=>gs,setProperty:()=>fe,setRequestStore:()=>Tn,setRequestStoreIfUnset:()=>Ko,setResponseRedirect:()=>Qo,setResponseStatus:()=>Gt,setServerMode:()=>be,setStyle:()=>ie,setStyles:()=>dr,shouldSetAsProperty:()=>Gs,splitProps:()=>Rr,spread:()=>Ci,stampVersions:()=>mr,styleMap:()=>Bo,svg:()=>dc,takeResponseHeaders:()=>Zo,takeResponseRedirect:()=>ts,takeResponseStatus:()=>es,takesBooleanText:()=>ci,templateNode:()=>Ai,toAttributeName:()=>Us,toggleClass:()=>pi,versionMark:()=>bi,versions:()=>G,waitForElement:()=>sa,warnOnVersionSkew:()=>yr,whenAppHydrated:()=>fs});var Nt=Symbol.for("fluixi-proxy");var se="1.0.0-alpha.109";var yo=se.split(".")[0],mo=`__fluixi_signal_state_v${yo}__`,go=`__fluixi_signal_builds_v${yo}__`,gl=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function vo(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:gl,onSuspend:null,onError:null,observer:null}}var Tt=globalThis;function vl(e){let t=vo(),r=e;for(let n of Object.keys(t))n in e||(r[n]=t[n]);return e}function bl(){let e=Tt[mo];return e?vl(e):Tt[mo]=vo()}var m=bl();(Tt[go]??=[]).push(se);function tn(){return[...new Set(Tt[go]??[])]}function rn(e){return m.observer=e,()=>{m.observer===e&&(m.observer=null)}}var L=[],Ot;function wo(e,t){if(!m.observer)return t();let r=Ot;Ot=e;try{return t()}finally{Ot=r}}var bo;function ge(e){let t=m.observer;t&&t.created(e.parents===void 0?{...e,parents:L,origin:e.origin??Ot,scope:e.scope??bo}:{...e,scope:e.scope??bo})}function xo(e){return m.observer?(L.push(e),!0):!1}function Eo(){L.pop()}function ko(e){m.observer?.ran?.(e)}function Ao(e,t){m.observer?.wrote?.(e,t)}function j(e,t,r,n){let i=m.observer;!i?.bound||!L.length||i.bound(L[L.length-1],e,t,r,n)}function _t(e){let t=m.observer;!t?.props||!L.length||!e||t.props(L[L.length-1],e)}function q(e,t,r,n){let i=m.observer;!i?.directive||!L.length||i.directive(L[L.length-1],e,t,r,n)}function Dt(e){m.observer?.contextCreated?.(e)}function Ne(e,t,r){let n=m.observer;!n?.context||!L.length||n.context(L[L.length-1],e,t,r)}function nn(e,t,r){m.observer?.moved?.(e,t,r)}function ae(e){m.observer?.disposed?.(e)}var Sl="__FLUIXI_DEVTOOLS_HOOK__",So=globalThis[Sl];if(typeof So?.inject=="function")try{So.inject({observeReactiveNodes:rn,version:se})}catch{}function K(){return m.observer!=null}var $o=0,Co=1,Ge=2,Ro=class{constructor(){this.observers=null,this.watchers=null,this.version=0}updateIfNecessary(){}track(){if(m.untracked)return;let e=m.consumer;e&&((this.observers??=new Set).add(e),(e.sources??=new Set).add(this))}},No=class extends Ro{constructor(e,t){super(),this._value=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){return this.track(),this._value}get value(){return this._value}set(e){if(!this._equals(this._value,e)){if(this._value=e,this.version++,Ao(this,m.consumer),this.observers)for(let t of[...this.observers])t.markDirty(Ge);on(this)}}peek(){return this._value}},Mt=class extends Ro{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this._disposed=!1,this.state=Ge,this.sources=null,this._fn=e,this._equals=t?.equals===!1?()=>!1:t?.equals??Object.is}get(){if(m.consumer===this)throw new Error("Signal.Computed cannot read itself");if(this.track(),this.updateIfNecessary(),this._threw)throw this._error;return this._value}dispose(){if(!this._disposed&&(this._disposed=!0,this.sources)){for(let e of this.sources)e.observers?.delete(this);this.sources=null}}updateIfNecessary(){if(!this._disposed){if(this.state===Co&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Ge)break}(this.state===Ge||!this._initialized)&&this.recompute(),this.state=$o}}recompute(){if(this.sources){for(let a of this.sources)a.observers?.delete(this);this.sources.clear()}let e=m.consumer,t=m.untracked,r=xo(this);m.consumer=this,m.untracked=!1;let n,i=!1,o;try{n=this._fn()}catch(a){i=!0,o=a,n=this._value}finally{m.consumer=e,m.untracked=t,r&&Eo()}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,ko(this),s){if(this.version++,this.observers)for(let a of this.observers)a.markDirty(Ge);on(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===$o;if(this.state=e,t){if(this.observers)for(let r of this.observers)r.markDirty(Co);on(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function on(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}function It(e){if(m.untracked)return e();m.untracked=!0;try{return e()}finally{m.untracked=!1}}function U(e){let t=Ye(e);return e&&(e.owned??=[]).push(t),t}function Z(e,t=!0){Xe(e,t)}function Ye(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Pt(e,t){let r=Symbol(t??"context");return Dt(r),{id:r,defaultValue:e,Provider:i=>{Ne(r,"provide",i.value);let o=m.owner,s=Ye(o);(s.contexts=new Map).set(r,i.value),o&&(o.owned??=[]).push(s),m.owner=s;try{return i.children}finally{m.owner=o}}}}function Lt(e){let t=m.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id)){let r=t.contexts.get(e.id);return Ne(e.id,"read",r),r}t=t.parent}return Ne(e.id,"read",e.defaultValue),e.defaultValue}function To(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 jt(e,t,r){let n=Ye(m.owner);(n.contexts=new Map).set(e.id,t),m.owner&&(m.owner.owned??=[]).push(n);let i=m.owner;m.owner=n;try{return r()}finally{m.owner=i}}function Oo(e){return m.onSuspend?(m.onSuspend(e,m.owner),!0):!1}function _o(e){m.onError=e}function E(){return m.owner}function C(e,t){let r=m.owner;m.owner=e;try{return t()}finally{m.owner=r}}function A(e){if(m.owner){if(m.owner.disposed){e();return}(m.owner.cleanups??=[]).push(e)}}function Xe(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)Xe(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 B(e){let t=Ye(m.owner);m.owner&&(m.owner.owned??=[]).push(t);let r=m.owner;m.owner=t;try{return It(()=>e(()=>Xe(t)))}finally{m.owner=r}}function Do(e){m.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function wl(e){e.queued||(e.queued=!0,m.queue.push(e),!m.scheduled&&m.batchDepth===0&&(m.scheduled=!0,m.hostSchedule(Ze)))}function Ze(){if(m.scheduled=!1,m.flushing)return;m.flushing=!0;let e=0,t=!1,r;try{for(;m.queue.length;){if(++e>1e5)throw new Error("[fluixi] effect flush did not settle (cycle?)");let n=m.queue;m.queue=[];for(let i of n)if(i.queued=!1,!i.disposed)try{i.run()}catch(o){t||(t=!0,r=o)}}}finally{m.flushing=!1}if(t)throw r}function Mo(){m.batchDepth===0&&Ze()}function Io(e){m.batchDepth++;try{return e()}finally{--m.batchDepth===0&&Ze()}}var xl=class extends Mt{constructor(e,t=!1,r){let n=null;super(()=>{Xe(n,!1),C(n,()=>{let s=e();typeof s=="function"&&(n.cleanups??=[]).push(s)})}),this.queued=!1,this.disposed=!1;let i=m.owner;this.owner=Ye(i),n=this.owner,K()&&ge({kind:"effect",node:this,handle:this,internal:!t,...r?{name:r}:{}}),this.run();let o=this.owner;if(!this.disposed&&!this.sources?.size&&!o.cleanups&&!o.owned&&!o.contexts&&!K()){this.disposed=!0;return}i&&(i.cleanups??=[]).push(()=>this.dispose())}markDirty(e){let t=this.state===0;super.markDirty(e),t&&this.state!==0&&!this.disposed&&wl(this)}run(){if(!this.disposed)try{this.get()}catch(e){if(e&&typeof e.then=="function"&&m.onSuspend){m.onSuspend(e,this.owner);return}if(m.onError&&m.onError(e,this.owner))return;throw e}}dispose(){this.disposed||(this.disposed=!0,ae(this),super.dispose(),Xe(this.owner))}};function sn(e,t=!1,r){let n=new xl(e,t,r);return()=>n.dispose()}function El(e){return!!e&&typeof e.then=="function"}Do(()=>{});var Po=Symbol.for("signal"),kl=Symbol.for("memo"),Al=Symbol.for("signal-node");function N(e,t){let r=new No(e,{equals:t?.equals}),n=(()=>r.get()),i=(o=>{let s=typeof o=="function"?o(r.peek()):o;return r.set(s),Mo(),s});return n[Po]=!0,n[Al]=r,K()&&ge({kind:"signal",node:r,handle:n,name:t?.name,set:i}),K()&&A(()=>ae(r)),[n,i]}function b(e,t,r){let n=t,i=E(),o=new Mt(()=>C(i,()=>{try{return n=e(n)}catch(a){if(El(a))return Oo(a),n;throw a}}),{equals:r?.equals}),s=(()=>o.get());return Object.defineProperty(s,Po,{value:!0,enumerable:!0}),Object.defineProperty(s,kl,{value:!0,enumerable:!0}),K()&&ge({kind:"memo",node:o,handle:s,name:r?.name}),A(()=>{o.dispose(),K()&&ae(o)}),s}function O(e,t,r){let n=t;return sn(()=>{n=e(n)},!0,r?.name)}function k(e,t){let r=t;return sn(()=>{r=e(r)})}function I(e){return Io(e)}function w(e){return It(e)}function Ht(){return Ze(),Promise.resolve()}var Lo=Pt();_o((e,t)=>{let r=To(t,Lo);return r?(r.caught=()=>e,m.consumer?queueMicrotask(()=>r.setError(e)):r.setError(e),!0):!1});function an(){let[e,t]=N(void 0,{equals:!1}),r={error:e,caught:()=>{},reset:()=>{r.caught=()=>{},t(()=>{})},setError:n=>{r.caught=()=>n,t(()=>n)}};return r}function cn(e,t){return jt(Lo,e,t)}var $l=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,Wt=typeof process>"u"?$l:!1,Cl=Symbol.for("signal");function R(e){return typeof e=="function"&&e[Cl]===!0}function Rl(e,t){return()=>{let r=U(t);return A(()=>{Z(r);let n=t.owned,i=n?n.indexOf(r):-1;i>=0&&n.splice(i,1)}),C(r,e)}}function jo(e,t){return typeof e=="function"?R(e)||e.length?e:Rl(e,t):Array.isArray(e)?e.map(r=>jo(r,t)):e}function ln(e,t){let r=Pt(e,t),n=r.Provider;return{...r,Provider:o=>n({get value(){return o.value},get debug(){return o.debug},get children(){let s=E(),a=o.children;return s?jo(a,s):a}})}}var un=null;function hn(e){un=e}function mn(e){un&&un(e)}var fn=null;function yn(e){fn=e}function gn(e){return fn?fn(e):void 0}var pn=null;function Qe(e){pn=e}function vn(){return pn?pn():void 0}var dn=null;function bn(e){dn=e}function Sn(e,t){dn&&dn(e,t)}function wn(){let e=new Map,t=new Map;return{get:r=>e.get(r),set:(r,n)=>{e.set(r,n)},delete:r=>{e.delete(r)},keys:()=>e.keys(),clear:()=>{e.clear(),t.clear()},inflight:t}}var Nl=null;function xn(e){Nl=e}function Tl(e){return!!e&&typeof e.then=="function"}var En=Symbol();function Ho(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:vn(),s=o!==void 0?gn(o):void 0,a=s!==void 0,[c,u]=N(s!==void 0?s.value:r.initialValue,{equals:!1}),[l,f]=N(void 0,{equals:!1}),[p,y]=N(s!==void 0||r.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[S,d]=N(void 0,{equals:!1}),[v,T]=N(void 0,{equals:!1}),$=En,g=!1;O(()=>{let M=n();if(v(),M===!1||M===null||M===void 0){$=En,I(()=>{y("unresolved"),d(void 0),f(void 0)});return}let Je=g;if(g=!1,$!==En&&M===$&&!Je)return;if($=M,a){a=!1;return}let W=!1;A(()=>W=!0);let fo=w(p),fl=w(c),po=fo==="ready"||fo==="refreshing";I(()=>{y(po?"refreshing":"pending"),f(void 0)});try{let ye=i(M,{value:fl,refetching:po});Tl(ye)?(d(ye),mn(ye),ye.then(Rt=>{W||(o!==void 0&&Sn(o,Rt),I(()=>{u(()=>Rt),y("ready"),d(void 0)}))},Rt=>{W||I(()=>{f(Rt),y("errored"),d(void 0)})})):I(()=>{u(()=>ye),y("ready"),d(void 0)})}catch(ye){if(W)return;I(()=>{f(ye),y("errored"),d(void 0)})}});let me=()=>{let M=p();return M==="pending"||M==="refreshing"},Y=(()=>{let M=l();if(M)throw M;if(me()){let Je=S();if(Je)throw Je}return c()});return Object.defineProperties(Y,{state:{get:p},loading:{get:me},error:{get:l},latest:{get:c}}),Object.defineProperty(Y,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(Y,Symbol.for("signal"),{value:!0,enumerable:!0}),[Y,{mutate:u,refetch:()=>{g=!0,T(void 0)}}]}function kn(...e){let[t,r]=Ho(...e);return Object.assign(t,r)}function An(e,t){let[r,n]=N(e,t);return r.set=n,r}function $n(e,t,r){return b(e,t,r)}function Cn(e,t,r){return O(e,t,r)}function qt(e){if(typeof e=="function"&&!e.length){let t=e();return R(t)?t:qt(t)}if(Array.isArray(e)){let t=[];for(let r=0;r<e.length;r++){let n=qt(e[r]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function et(e){let t=b(e);return Wt?b(()=>qt(t()),void 0,{name:"children"}):b(()=>qt(t()))}function qo(e){let t=e,r=null;return{index:()=>(r||(r=N(t,{name:"row index"})),r[0]()),set:n=>{t=n,r&&r[1](n)}}}function Te(e,t,r){let n=[];return A(()=>{for(let i of n)i.dispose();n=[]}),b(()=>{let i=e()||[];return w(()=>{if(i.length===0){for(let c of n)c.dispose();return n=[],r?.fallback?r.fallback():[]}let o=new Map;for(let c of n)o.has(c.item)||o.set(c.item,c);let s=[],a=new Set;for(let c=0;c<i.length;c++){let u=i[c],l=o.get(u);if(l&&!a.has(l))l.setIndex(c),s.push(l),a.add(l);else{let f,p,y;B(d=>{y=d;let v=qo(c);p=v.set,f=t(u,v.index)});let S={item:u,rendered:f,dispose:y,setIndex:p};s.push(S),a.add(S)}}for(let c of n)a.has(c)||c.dispose();return n=s,s.map(c=>c.rendered)})},void 0,{name:"mapArray"})}function Oe(e,t,r,n){let i=[],o=[];return A(()=>{for(let s of o)s.dispose();i=[],o=[]}),b(()=>{let s=e()||[];return w(()=>{if(s.length===0){for(let f of o)f.dispose();return i=[],o=[],n?.fallback?n.fallback():[]}let a=new Map;for(let f=0;f<i.length;f++)a.set(i[f],o[f]);let c=[],u=[],l=new Set;for(let f=0;f<s.length;f++){let p=t(s[f]),y=a.get(p);if(y&&!l.has(p))y.setIndex(f),y.setItem(s[f]),c.push(y);else{let S,d,v,T;B($=>{T=$;let g=qo(f);d=g.set;let[me,Y]=N(s[f]);v=M=>Y(()=>M),S=r(me,g.index)}),c.push({rendered:S,dispose:T,setIndex:d,setItem:v})}u.push(p),l.add(p)}for(let[f,p]of a)l.has(f)||p.dispose();return i=u,o=c,c.map(f=>f.rendered)})},void 0,{name:"keyArray"})}function _e(e,t,r){let n=[];return A(()=>{for(let i of n)i.dispose();n=[]}),b(()=>{let i=e()||[];return w(()=>{if(i.length===0){for(let c of n)c.dispose();return n=[],r?.fallback?r.fallback():[]}let o=n.length,s=i.length;for(let c=o;c<s;c++){let u,l,f,p=i[c];B(y=>{f=y;let[S,d]=N(p);l=d,u=t(S,c)}),n.push({rendered:u,setItem:l,dispose:f})}for(let c=s;c<o;c++)n[c].dispose();s<o&&(n=n.slice(0,s));let a=Math.min(o,s);for(let c=0;c<a;c++)n[c].setItem(i[c]);return n.map(c=>c.rendered)})},void 0,{name:"indexArray"})}function Jl(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Bo(e){return b(()=>{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(`${Jl(n)}: ${o}`)}return r.join("; ")},void 0,{name:"StyleMap"})}function ce(e){return()=>{let t=e();return typeof t=="function"?t():t}}var Rn=Symbol("match");function Bt(e){return{[Rn]:!0,when:ce(()=>e.when),get children(){return e.children}}}function Vt(e){let t=Array.isArray(e.children)?e.children:[e.children],r=E(),n=null,i=-1,o=s=>{s!==i&&(n&&Z(n),n=U(r),i=s)};return b(()=>{for(let s=0;s<t.length;s+=1){let c=t[s],u=0;for(;typeof c=="function"&&!c[Rn]&&u++<10;)c=c();if(!c||typeof c!="object"||c[Rn]!==!0)continue;let l=c.when();if(l)return o(s),C(n,()=>{let f=c.children;return typeof f=="function"?f(l):f})}return o(-2),C(n,()=>e.fallback??null)},void 0,{name:"Switch"})}var Ft,zo={getStore:()=>Ft,run(e,t){let r=Ft;Ft=e;try{return t()}finally{Ft=r}}},tt=globalThis[Symbol.for("fluixi.requestStore")]??={store:zo,async:!1};function Tn(e){tt.store=e??zo,tt.async=e!==null}function Ko(e){tt.async||Tn(e)}function rt(e={}){if(e.request===void 0){let s=_n();s&&(e.request=s)}e.locals||(e.locals=e.request?Dn(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 a=o.get(s)??0;return o.set(s,a+1),`${s}#${a}`},withResourceScope(s,a){let c=n;n=s;try{return a()}finally{n=c}},pending:new Set,data:new Map}}var zt=globalThis[Symbol.for("fluixi.requestEndHooks")]??=new WeakMap;function Uo(e){let t=Ut();if(!t)return!1;let r=zt.get(t);return r||zt.set(t,r=[]),r.push(e),!0}function Ut(){return _n()??V()}var ve=globalThis[Symbol.for("fluixi.beforeRender")]??={tasks:[],prepared:new WeakMap,page:void 0};function Jo(e){return ve.tasks.push(e),()=>{let t=ve.tasks.indexOf(e);t>=0&&ve.tasks.splice(t,1)}}function Go(){let e=Ut();if(!e)return ve.page??=Vo();let t=ve.prepared.get(e);return t||ve.prepared.set(e,t=Vo()),t}async function Vo(){for(let e of[...ve.tasks])await e()}function nt(e){On(e)}function On(e){let t=zt.get(e);if(t){zt.delete(e);for(let r of t.reverse())try{r()}catch(n){console.error("[fluixi] a request-end hook threw:",n)}}}function it(e,t){return tt.store.run(e,t)}function V(){return tt.store.getStore()}function Jt(){return V()?.event}function Xo(){let e=Jt();return e?(e.locals||(e.locals={}),e.locals):{}}var Fo=globalThis[Symbol.for("fluixi.requestLocals")]??=new WeakMap;function _n(){return globalThis[Symbol.for("fluixi.platformRequest")]?.getStore()}function Dn(e){let t=Fo.get(e);return t||(t={},Fo.set(e,t)),t}var De=globalThis[Symbol.for("fluixi.responseHeaders")]??=new WeakMap;function Mn(){let e=Jt()?.request;return e&&typeof e=="object"?e:_n()}function Yo(e,t,r=Mn()){if(!r)return!1;let n=De.get(r);return n||(n={headers:new Headers,sent:!1},De.set(r,n)),n.sent?!1:(n.headers.append(e,t),!0)}function Zo(e){let t=De.get(e);if(!t){t={headers:new Headers,sent:!0},De.set(e,t);return}return t.sent=!0,t.headers}var Kt=globalThis[Symbol.for("fluixi.responseRedirects")]??=new WeakMap;function Qo(e,t,r=Mn()){return!r||De.get(r)?.sent?!1:(Kt.has(r)||Kt.set(r,{location:e,status:t}),!0)}var Nn=globalThis[Symbol.for("fluixi.responseStatuses")]??=new WeakMap;function Gt(e,t=Mn()){return!t||De.get(t)?.sent?!1:(Nn.set(t,e),!0)}function Xt(e){let t=e?.status;return typeof t=="number"&&Number.isInteger(t)&&t>=400&&t<=599?t:500}function es(e){let t=Nn.get(e);return Nn.delete(e),t}function ts(e){let t=Kt.get(e);return Kt.delete(e),t}var st=Symbol.for("fluixi.server-node"),Gl=Symbol.for("fluixi.dom.server-host"),Xl=globalThis,ot=Xl[Gl]??={server:typeof document>"u",nodes:null};function x(){return ot.server}function be(e){ot.server=e}function rs(e){ot.nodes=e}function Me(){if(!ot.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return ot.nodes}function Se(e){return e!=null&&e[st]===!0?!0:typeof Node<"u"&&e instanceof Node}function Yt(e){return e!=null&&e[st]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Zt(e){return e!=null&&e[st]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var h={active:!1,cursor:null,parents:[]},is=null;function os(e){is=e}function at(){return is}function Ln(e,t){return h.active&&t.parentNode===e}function er(e){let t=h.parents.lastIndexOf(e);t!==-1&&(h.parents.length=t),h.cursor=e.nextSibling}function ss(){return h.active?h.cursor:null}function Ie(e,t){if(!e||e.parentNode==null)return t();let r=h.active,n=h.cursor,i=h.parents;h.active=!0,h.cursor=e,h.parents=[];try{return t()}finally{h.active=r,h.cursor=n,h.parents=i}}function as(e){if(!h.active)return e();let t=h.cursor,r=h.parents;h.active=!1,h.parents=[];try{return e()}finally{h.active=!0,h.cursor=t,h.parents=r}}function Pe(e){if(!h.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&er(t)}function tr(){let e=globalThis;return e[Symbol.for("fluixi.appHydration")]??={pending:0,waiting:new Set}}function cs(){tr().pending++}function ls(){let e=tr();if(e.pending>0&&e.pending--,e.pending>0)return;let t=[...e.waiting];e.waiting.clear();for(let r of t)r()}function us(){return tr().pending>0}function fs(e){let t=tr();return t.waiting.add(e),()=>t.waiting.delete(e)}var Qt=Symbol.for("fluixi.hydrationKeys"),Q="data-hk";function ps(e){let t=e;for(;t;){let r=t.contexts?.get(Qt);if(r)return r;if(!t.parent){let n={id:"",next:0};return(t.contexts??=new Map).set(Qt,n),n}t=t.parent}return{id:"",next:0}}function ds(){return x()?V()?.hydrationKeys!==!1:h.active}function In(e){let t=3735928559,r=1103547991;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);t=Math.imul(t^i,2654435761),r=Math.imul(r^i,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(4294967296*(2097151&r)+(t>>>0)).toString(36)}function jn(e){if(!ds())return null;let t=ps(E()),r=t.id+(t.next++).toString(36);return e?`${In(r)}-${e}`:In(r)}var ns=new Map;function hs(e){let t=ns.get(e);return t===void 0&&ns.set(e,t=In(e).slice(0,6)),t}function ms(e){let t=e.getAttribute(Q)??"",r=t.indexOf("-");return r<0?"":t.slice(r+1)}function Hn(e){let t=e.getAttribute(Q);t&&P?.get(t)===e&&P.delete(t)}function ys(){if(!ds())return null;let e=E();if(!e)return null;let t=ps(e),r={id:t.id+(t.next++).toString(36)+".",next:0},n=U(e);return(n.contexts=new Map).set(Qt,r),n}function gs(e){let t=E();t&&(t.contexts??=new Map).set(Qt,{id:e,next:0})}var P=null;function Wn(e){P??=new Map;for(let t of e.querySelectorAll(`[${Q}]`)){let r=t.getAttribute(Q);P.has(r)||P.set(r,t)}}function rr(){P=null}function nr(e){if(!P)return 0;let t=0;for(let[r,n]of P){if(!n.isConnected){P.delete(r);continue}e&&!e.contains(n)||n.parentElement?.closest("[data-fx-ssr]")||(P.delete(r),n.remove(),t++)}return t}function vs(e){if(!(!P||e.length===0))for(let[t,r]of P)e.some(n=>n===r||n.contains(r))&&P.delete(t)}var Pn=[];function bs(e){h.active?Pn.push(e):e()}function qn(){for(;Pn.length>0;){let e=Pn.shift();try{e()}catch(t){console.error(t)}}}function Ss(){return h.active}function Bn(e,t){if(!e||!P)return null;let r=P.get(e);return!r||r.localName!==t.toLowerCase()?null:(P.delete(e),r)}function Vn(e){if(x())return e.fallback??null;let t=h.active,[r,n]=N(!t);return t&&queueMicrotask(()=>n(!0)),b(()=>r()?e.children:e.fallback??null,void 0,{name:"client-only"})}var ws=Vn;function xs(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function Es(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function ks(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function As(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function $s(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function Cs(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function ct(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Rs(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function Fn(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function zn(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function Kn(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function Un(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function Jn(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Gn(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 Xn(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function Ns(e){return Fn(e)?{type:"router",value:e}:Kn(e)?{type:"route",value:e}:zn(e)?{type:"routes",value:e}:Un(e)?{type:"outlet",value:e}:J(e)?{type:"component",value:e}:Xn(e)?{type:"suspense",value:e}:Jn(e)?{type:"provider",value:e}:Gn(e)?{type:"context",value:e}:{type:"none",value:e}}function Ts(e){if(x()||!h.active)return e();let t=E();return ct(()=>C(t,e))}var sr=Symbol("store-raw"),Os=Symbol("store-node"),_s=Symbol("store-has"),Ds=Symbol("store-self"),Ms=Symbol("store-track");var lt=new WeakMap,Yn=new WeakMap,je=new WeakMap,ar=new WeakMap;function Yl(e,t){if(!Le(e)||!K())return;let r=new Set,n=s=>{if(!(!Le(s)||r.has(s))){r.add(s);for(let a of Object.values(s))n(a)}};n(ar.get(t)??t);let i=new Set,o=s=>{if(!Le(s))return;let a=s;if(r.has(a)||i.has(a))return;i.add(a);let c=lt.get(a);if(c){for(let u of c.keys.values())ae(u);c.all&&ae(c.all),lt.delete(a),je.delete(a),Yn.delete(a)}for(let u of Object.values(a))o(u)};o(e)}var cr=(e,t,r)=>r?`${e}[${String(t)}]`:`${e}.${String(t)}`;function Hs(e,t,r){let n=t?.owner,i=n&&r!==void 0?cr(n.name,r,t?.array):void 0,[o,s]=wo(n?.store,()=>N(e,i?{name:i}:void 0)),a=o;return a.$=s,a}function lr(e){let t=lt.get(e);return t?t.owner||(t.owner=je.get(e)):lt.set(e,t={keys:new Map,owner:je.get(e),array:Array.isArray(e)}),t}function Is(e,t,r){let n=e.keys.get(t);return n||e.keys.set(t,n=Hs(r,e,t)),n}function Zl(e,t,r,n){let i=je.get(e);if(i&&i.store===t&&i.name===r)return;let o={store:t,name:r};je.set(e,o),ar.set(e,ar.get(n)??n);let s=lt.get(e);if(s&&(s.owner=o,!!K())){for(let[a,c]of s.keys)nn(c,t,cr(r,a,s.array));s.all&&nn(s.all,t,cr(r,"*",s.array))}}function Ps(e){let t=lr(e);(t.all||(t.all=Hs(void 0,t,"*")))()}function Ls(e,t){e.$(typeof t=="function"?()=>t:t)}function Le(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 ir(e){if(!Le(e))return e;let t=Yn.get(e);if(t)return t;let r=new Proxy(e,Ql);return Yn.set(e,r),r}var Ql={get(e,t,r){if(t===sr||t===Os)return e;if(t===Nt)return r;if(t===_s)return c=>c in e;if(t==="__proxy")return!0;if(t===Ms||t===Ds)return Ps(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=lr(e),s=Is(o,t,n),a=s();return Le(a)?(o.owner&&Zl(a,s,cr(o.owner.name,t,o.array),e),ir(a)):a},set(){return!0},deleteProperty(e,t){return t in e&&X(e,t,void 0),!0},has(e,t){return t===sr||t===Nt||t===Os||t===_s||t===Ds||t===Ms?!0:(Is(lr(e),t,e[t])(),t in e)},ownKeys(e){return Ps(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function Ws(e,t=new Set){if(e==null||typeof e!="object")return e;let r=e[sr]??e;if(t.has(r)||!Le(r))return r;t.add(r);let n=!1,i=s=>{let a=Ws(s,t);return a!==s&&(n=!0),a};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 X(e,t,r){let n=Ws(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 a=lr(e),c=a.keys.get(t);if(c&&Ls(c,n),Yl(i,e),o&&e.length!==s){let u=a.keys.get("length");u&&Ls(u,e.length)}a.all&&a.all.$(void 0)}function Zn(e,t){return typeof e=="function"?e(t):e}function Qn(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)?Qn(i,n):X(e,r,n)}}function fr(e){let t=[],r=e.replace(/\[([^\]]*)\]/g,".$1");for(let n of r.split("."))n.length&&t.push(n);return t}function qs(e,t,r){let n=t.length-1;for(let o=0;o<n;o++){let s=t[o];if(s==="*"){let c=t.slice(o+1);if(Array.isArray(e))for(let u=0;u<e.length;u++)qs(e[u],c,r);return}let a=e[s];(a==null||typeof a!="object")&&(a=/^\d+$/.test(t[o+1])?[]:{},X(e,s,a)),e=a}let i=t[n];if(i==="*"){if(Array.isArray(e))for(let o=0;o<e.length;o++)X(e,o,Zn(r,e[o]));return}X(e,i,Zn(r,e[i]))}function js(e,t,r){qs(e,fr(t),r)}function eu(e){return Array.isArray(e)&&e.length>0&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="string")}function or(e,t){for(let r=e.length-1;r>=t.length;r--)X(e,String(r),void 0);e.length!==t.length&&X(e,"length",t.length);for(let r=0;r<t.length;r++)X(e,String(r),t[r])}function tu(e,t){let r=t[0];if(typeof r=="function"&&t.length===1){let n=r(e);n&&n!==e&&Qn(e,n);return}if(Array.isArray(r)&&t.length===1){if(eu(r)){for(let n of r)js(e,n[0],n[1]);return}if(Array.isArray(e)){or(e,r);return}if(r.length===0)return;throw new TypeError("[fluixi] set() was given an array that is neither a batch of [path, value] pairs nor a replacement for an array root. Name the path you meant, as in set('items', [...]).")}if(r&&typeof r=="object"&&!Array.isArray(r)&&t.length===1){Qn(e,r);return}if(t.length>=3){ei(e,t.slice(0,-1),t[t.length-1]);return}js(e,String(r),t[1])}function ru(e,t){if(typeof t=="function"){if(!Array.isArray(e))return[];let r=[];for(let n=0;n<e.length;n++)t(e[n],n)&&r.push(n);return r}if(Array.isArray(t))return Array.isArray(e)?t.map(Number):t.map(String);if(t&&typeof t=="object"&&("from"in t||"to"in t||"by"in t)){if(!Array.isArray(e))return[];let r=t.by??1,n=t.from??0,i=t.to??e.length-1,o=[];for(let s=n;s<=i;s+=r)s>=0&&s<e.length&&o.push(s);return o}return t==="*"?Array.isArray(e)?e.map((r,n)=>n):Object.keys(e??{}):[t]}function ei(e,t,r){if(e==null)return;let[n,...i]=t;if(typeof n=="string"){let s=fr(n);if(s.length>1){ei(e,[...s,...i],r);return}}let o=ru(e,n);if(i.length===0){for(let s of o)X(e,s,Zn(r,e[s]));return}for(let s of o){let a=e[s];if(a==null||typeof a!="object"){let c=i[0];a=typeof c=="number"||/^\d+$/.test(String(c))?[]:{},X(e,s,a)}ei(a,i,r)}}function ti(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ti);let t={};for(let r of Object.keys(e))t[r]=ti(e[r]);return t}function le(e,t){let r=e;for(let n of fr(t)){if(r==null)return;r=r[n]}return r}var Bs=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...r)=>I(()=>tu(this.root,r))),e&&typeof e=="object"&&(je.set(e,{store:this,name:t.name??"store"}),ar.set(e,e)),K()&&ge({kind:"store",node:this,handle:()=>this.root,name:t.name})}get state(){return ir(this.root)}get proxy(){return ir(this.root)}get accessor(){return(()=>ir(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return ur(this.state);let t=this.state;for(let r of fr(e)){if(t==null)return;t=t[r]}return ur(t)}select(e){return b(()=>e(this.state))}subscribe(e){return O(()=>e(this.state))}watch(e,t){let r;return O(()=>{let n=e(this.state);Object.is(n,r)||(t(n,r),r=n)})}reactive(e){return b(()=>this.state[e])}produce(e){this.set((t=>{let r=ti(t);return e(r),r}))}reconcile(e,t={}){this.set(e)}push(e,...t){let r=le(this.root,e);this.set(e,r.concat(t))}pop(e){let t=le(this.root,e).slice(),r=t.pop();return this.set(e,t),r}shift(e){let t=le(this.root,e).slice(),r=t.shift();return this.set(e,t),r}splice(e,t,r,...n){let i=le(this.root,e).slice(),o=i.splice(t,r,...n);return this.set(e,i),o}insert(e,t,r){let n=le(this.root,e).slice();n.splice(t,0,r),this.set(e,n)}removeAt(e,t){let r=le(this.root,e).slice(),n=r.splice(t,1);return this.set(e,r),n}replace(e,t){if(arguments.length>=2){let n=le(this.root,String(e)),i=t;if(Array.isArray(n)&&Array.isArray(i)){or(n,i);return}this.set(e,i);return}let r=this.root;if(Array.isArray(r)&&Array.isArray(e)){or(r,e);return}this.set(e)}clear(e){let t=e===void 0?this.root:le(this.root,e);if(Array.isArray(t)){or(t,[]);return}if(t&&typeof t=="object")for(let r of Object.keys(t))X(t,r,void 0)}toObservable(){let[e]=N(this.state);return e.toObservable()}dispose(){}},nu=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","replace","clear","unwrap","toObservable"];function iu(e,t){for(let r of nu)e[r]=t[r].bind(t);e.$=t.reactive.bind(t)}function ri(e,t={immutable:!0}){let r=new Bs(e,t);return iu(r.set,r),[r.proxy,r.set]}function ou(e,t={}){return new Bs(e,{...t,immutable:!1})}function ur(e){if(e==null||typeof e!="object")return e;let t=e[sr];return t!==void 0?t:e}function su(e){return w(()=>ur(e))}var Cd=Object.freeze({createStore:ri,createMutableStore:ou,batch:I,unwrap:ur,untrackStore:su});function ni(e,t){let[r,n]=ri(e,t);return new Proxy(r,{get:(i,o)=>o==="set"?n:i[o],has:(i,o)=>o==="set"||Reflect.has(i,o)})}var au="__fx_dom_create_component__",we=globalThis[au]??={fn:null};function Fs(e){we.fn=e}function zs(e={}){let t=e.signalSystem?.createComponent;t&&(we.fn=t)}function xe(e,t){let r=ys();return r?C(r,()=>Vs(e,t)):Vs(e,t)}function Vs(e,t){if(we.fn)return we.fn(e,t);t&&_t(t);let r=typeof e=="function"?w(()=>e(t)):e,n=r!=null&&(typeof r=="function"||typeof r=="object");if(n)try{r.$name=e?.name}catch{}return n&&!R(r)?ct(r):r}var Ks=()=>we.fn!==null,ii=()=>we.fn!==null;function oi(){we.fn=null}function Us(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function Js(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function Gs(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 Xs=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ys=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"]),ut="http://www.w3.org/2000/svg";function si(e){return e.localName.includes("-")}function ft(e,t,r,n=!1){if(r==null){e.removeAttribute(t);return}if(si(e)){if(x()){He(e,t,r);return}e[t]=r;return}H(e,t,r,n)}var ai=Symbol.for("fluixi.serverProps");function He(e,t,r){let n=e[ai]??={};n[t]=r,r==null||r===!1?e.removeAttribute(t):r===!0?e.setAttribute(t,""):(typeof r=="string"||typeof r=="number")&&e.setAttribute(t,String(r))}var cu=new Set(["draggable","spellcheck","contenteditable"]);function ci(e){return e.startsWith("aria-")||cu.has(e.toLowerCase())}var pt=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]),li=new Set(["id","class","className","style","slot","part","exportparts","is","title","role","lang","dir","tabindex","hidden"]);function We(e){return li.has(e)||e.startsWith("aria-")||e.startsWith("data-")}function pr(e,t=document){return t.querySelector(e)}function Zs(e,t=document){return Array.from(t.querySelectorAll(e))}function Qs(e,t){return e.closest(t)}function ui(e,...t){e.classList.add(...t)}function fi(e,...t){e.classList.remove(...t)}function pi(e,...t){t.forEach(r=>e.classList.toggle(r))}function ea(e,t){return e.classList.contains(t)}function H(e,t,r,n=!1){if(typeof r=="boolean"&&ci(t)){e.setAttribute(t,String(r));return}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 di(e,t){return e.getAttribute(t)}function hi(e,t){e.removeAttribute(t)}function dr(e,t){Object.assign(e.style,t)}function ta(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function mi(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")dr(n,o);else if(i.startsWith("on")&&typeof o=="function"){let s=i.slice(2).toLowerCase();n.addEventListener(s,o)}else H(n,i,o)}),r.forEach(i=>{typeof i=="string"?n.appendChild(document.createTextNode(i)):n.appendChild(i)}),n}function yi(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function gi(e,...t){t.forEach(r=>{typeof r=="string"?e.appendChild(document.createTextNode(r)):e.appendChild(r)})}function ra(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function na(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function ia(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function oa(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 sa(e,t=5e3){return new Promise((r,n)=>{let i=pr(e);if(i){r(i);return}let o=new MutationObserver(()=>{let a=pr(e);a&&(o.disconnect(),clearTimeout(s),r(a))});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 aa(e,t,r={}){let n=new IntersectionObserver(i=>{i.forEach(o=>{t(o.isIntersecting)})},r);return n.observe(e),()=>{n.disconnect()}}function ca(e,t){let r=new ResizeObserver(n=>{n.forEach(t)});return r.observe(e),()=>{r.disconnect()}}var lu=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function la(e){return typeof e=="object"&&e!==null&&e.$$typeof===lu}function ua(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function fa(e){return e instanceof Node}function pa(e,t,r="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[r]>"u"&&(globalThis[r]={}),typeof globalThis[r][e]>"u"&&(globalThis[r][e]=t))}function da(e,t,r="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[r]<"u"&&typeof globalThis[r][e]<"u"?globalThis[r][e]:t}var hr="1.0.0-alpha.109";var G={dom:hr,reactive:se};function ha(e){G.core=e}var vi="data-fluixi";function bi(){return uu()?"":G.core??G.dom}function uu(){try{return!0}catch{return!1}}function mr(e){e.setAttribute(vi,bi()),typeof globalThis<"u"&&(globalThis.Fluixi=G)}function yr(){let e=tn();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=[G.core,G.dom,G.reactive].filter(r=>r!==void 0);new Set(t).size<=1||console.warn(`[fluixi] package versions disagree: core ${G.core??"(absent)"}, dom ${G.dom}, reactive ${G.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 fu(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 pu(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 ba(e){return pu(fu(e))}var Sa=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),ma={},gr="__fx_at",wa="__fx_loc";function Si(e,t){return t&&(e[wa]=t),e}var du=Symbol.for("fluixi.owner");function vr(e){let t=E();t&&(e[du]=t)}function ya(e){if(e instanceof Element){e.localName.includes("-")&&vr(e);for(let t of e.querySelectorAll("*"))t.localName.includes("-")&&vr(t)}}var ga=/<[a-z][\w.]*-/i,va=new Map,hu="__fluixi_delegated_events__",ki=globalThis[hu]??={names:new Set},br=ki.names,wr=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function ht(e){if(!x())for(let t of e)br.has(t)||wr.has(t)||(br.add(t),ki.dispatch??=mu,document.addEventListener(t,ki.dispatch))}function mu(e){let t=`$$${e.type}`,r=e.composedPath&&e.composedPath()[0]||e.target;Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>r??document});try{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}}finally{delete e.currentTarget}}function xr(e,t,r){if(e[`$$${t}`]=r,wr.has(t)){let n=`__fx_${t}`;if(!e[n]){let i=o=>{e[`$$${t}`]?.(o)};e.addEventListener(t,i),e[n]=i}return}br.has(t)||ht([t])}function dt(e,t){delete e[`$$${t}`];let r=`__fx_${t}`,n=e[r];n&&(e.removeEventListener(t,n),delete e[r])}function xa(e){return!wr.has(e)}function Ea(e){return typeof e=="function"}function ue(e,t=!1){if(x())return Me().createText(e);if(h.active&&!t){let r=at()?.hydrateText(e);if(r)return r}return document.createTextNode(e)}function ke(e,t=!1,r){let n=jn();if(x()){let i=Me().createElement(e,t);return n&&i.setAttribute(Q,n),i}if(h.active){let i=Bn(n,e);if(i)return at()?.enterElement(i),e.includes("-")&&vr(i),r?Si(i,r):i;let o=at()?.hydrateElement(e);if(o)return e.includes("-")&&vr(o),r?Si(o,r):o}return Si(t?document.createElementNS(ut,e):document.createElement(e),r)}function Er(e,t=!1){let r=va.get(e);if(r)return r;let n=document.createElement("template");return t?n.innerHTML=`<svg>${e}</svg>`:n.innerHTML=e,va.set(e,n),n}function Ai(e,t,r=!1,n=!1,i){let o=hs(e),s=jn(o);if(x()){let a=Me();if(r){let c=a.parseTemplate(e,n);return s&&c.setAttribute(Q,s),c}return a.createRaw(s?yu(e,s):e)}if(h.active){let a=Bn(s,t);if(a)return h.cursor=a.nextSibling,ga.test(e)&&ya(a),wi(a,i);let c=at()?.hydrateStatic(t,o);if(c)return ga.test(e)&&ya(c),wi(c,i)}return wi(kr(Er(e,n),n).firstChild,i)}function yu(e,t){return e.replace(/^(\s*<[^\s/>]+)/,`$1 ${Q}="${t}"`)}function wi(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][wa]={file:t.file,line:o,column:t.pos[i*2+1]})}return e}function mt(e,t){if(!h.active)return t();let r=Ie(e.nextSibling,t);if(typeof r=="function"){let n=r;return gu(n,(...o)=>h.active?Ie(e.nextSibling,()=>{let s=n(...o);for(;typeof s=="function";)s=s();return s}):n(...o))}return r}function gu(e,t){let r=e[gr];return r!==void 0&&(t[gr]=r),t}function yt(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 gt(e,t){let r=[];for(let n=e.nextSibling;n&&n!==t;n=n.nextSibling)r.push(n);return r}function kr(e,t=!1){let r=e.content.cloneNode(!0);return t?r.firstChild:r}function $i(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?$i(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function ka(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Aa(e){if(R(e)||J(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!R(t)&&!J(t);)t=t();return t}var ne=0,vu=200;function bu(e,t,r,n,i){let o=n,s,a=()=>s??=new Map,c=!1;return k(()=>{let l=c&&h.active;if(c=!0,!l)return u();h.active=!1;try{return u()}finally{h.active=!0}});function u(){j(r??t,"content",void 0,e);let l;if(J(e)&&!R(e)){if(!a().has(e)){ne++;try{let f=e();a().set(e,f)}finally{ne--}}for(l=a().get(e);typeof l=="function"&&R(l);)l=l()}else for(l=e();typeof l=="function"&&R(l);)l=l();{let f=0;for(;typeof l=="function"&&f++<50;)if(J(l)){if(!a().has(l)){let p=l;ne++;try{let y=p();a().set(p,y)}finally{ne--}}l=a().get(l)}else if(R(l))l=l();else if(l=l(),typeof l!="function"||!R(l)&&!J(l))break}Array.isArray(l)&&a(),ne++;try{o=Ve(t,l,r,o,s),i(o)}finally{ne--}}}function _(e,t,r,n){if(ne>vu)return console.error("[insert] Exceeded max call depth, possible infinite loop."),()=>null;let i=r!==void 0&&!r&&h.active;r!==void 0&&!r&&(r=ue("",!0),i||e.appendChild(r));let o=()=>{if(!i||r.parentNode)return;let l=h.cursor;e.insertBefore(r,l&&l.parentNode===e?l:null)},s=n??null,a=l=>Array.isArray(l)&&l.some(f=>typeof f=="function"),c=l=>typeof l=="function"?l:()=>l;if(typeof t!="function"&&!a(t)){ne++;try{s=Ve(e,t,r,s)}finally{ne--}return o(),()=>s}let u=bu(c(t),e,r,s,l=>{s=l});return o(),()=>(u?.(),s)}var $a=Symbol.for("fluixi.keepServerContent");function Ca(e){return{[$a]:!0,adopt:e}}function Su(e){return!!e&&typeof e=="object"&&e[$a]===!0}function Ve(e,t,r,n,i){if(t==null||typeof t=="boolean")return ee(e,n,r);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return ee(e,n,r);if(Su(t)){let s=n==null?[]:Array.isArray(n)?n:[n];return vs(s),t.adopt?.(s),n??null}if(Be(t)){let s=ue("",!0);return Array.isArray(n)?n.length>0?(e.replaceChild(s,n[0]),ee(e,n.slice(1),r)):F(e,s,r):n?e.replaceChild(s,n):F(e,s,r),t.then(a=>{s.parentNode===e&&Ve(e,a,s.nextSibling,s)}).catch(a=>{console.error("Error resolving promise in insertExpression:",a)}),s}let o=typeof t;if(o==="string"||o==="number"){if(o==="number"&&(t=String(t)),Array.isArray(n)){if(n.length===0){let a=ue(t);return F(e,a,r),a}if(n.length===1&&n[0].nodeType===3)return n[0].data=t,n;n=ee(e,n,r)}if(n&&Zt(n))return n.data=t,n;let s=ue(t);return n&&n.parentNode===e?e.replaceChild(s,n):Ln(e,s)||F(e,s,r),s}if(Se(t))return Ln(e,t)?(er(t),t):Array.isArray(n)?(n.length===0?F(e,t,r):n[0].parentNode===e?(e.replaceChild(t,n[0]),ee(e,n.slice(1),r)):F(e,t,r),t):(n?n!==t&&(n.parentNode===e?e.replaceChild(t,n):F(e,t,r)):F(e,t,r),t);if(Array.isArray(t)){let s=[],a=Array.isArray(n)?n:n?[n]:[],c=[],u=new Set,l=()=>re(t,s,e,r,!0,i,c,u);h.active&&a.length?Ie(a[0],l):l();let f=wu(e,u.size?a.filter(p=>!u.has(p)):a,s,r);for(let p of c){if(p.wired)continue;let y=_(e,p.sig,p.marker);A(()=>ee(e,y()))}return f}if(o==="object"&&t!==null&&typeof t=="object"){let s=t;if("type"in s&&"props"in s){let a=s;if(typeof a.type=="function"){let c=a.type(a.props||{});return Ve(e,c,r,n)}}}return ee(e,n,r)}function re(e,t,r,n,i=!0,o,s,a){for(let c=0;c<e.length;c++){let u=e[c];if(!(u==null||typeof u=="boolean")){for(;typeof u=="function"&&!Be(u)&&!R(u)&&!J(u)&&(u=u(),!(u==null||typeof u=="boolean")););if(!(u==null||typeof u=="boolean")){if(typeof u=="function"){let l;for(J(u)&&!R(u)?(o||(o=new Map),o.has(u)||o.set(u,u()),l=o.get(u)):l=u();typeof l=="function"&&!Be(l)&&!R(l)&&!J(l);)o||(o=new Map),o.has(l)||o.set(l,l()),l=o.get(l);if(l==null||typeof l=="boolean")continue;if(typeof l=="function"){if(R(l)){if(s){let p=ue("",!0);if(t.push(p),h.active&&a&&h.cursor?.parentNode===r){let y=()=>h.cursor&&h.cursor.parentNode===r?h.cursor:null,S=y();r.insertBefore(p,S);let d=_(r,l,p),v=y();for(let T=S;T&&T!==v;T=T.nextSibling)a.add(T);r.insertBefore(p,v),A(()=>ee(r,d())),s.push({marker:p,sig:l,wired:!0});continue}s.push({marker:p,sig:l});continue}let f=l();for(;typeof f=="function"&&R(f);)f=f();if(f==null||typeof f=="boolean")continue;Array.isArray(f)?re(f,t,r,n,i,o):re([f],t,r,n,i,o);continue}continue}Array.isArray(l)?re(l,t,r,n,i,o,s,a):re([l],t,r,n,i,o,s,a);continue}if(Be(u)){let l=ue("",!0);t.push(l),u.then(f=>{if(l.parentNode){let p=[];if(re([f],p,l.parentNode,void 0,!1,o),p.length>0){l.parentNode.replaceChild(p[0],l);for(let y=1;y<p.length;y++)l.parentNode?.insertBefore(p[y],p[y-1].nextSibling)}}}).catch(f=>console.error("Error resolving promise in array:",f));continue}if(Array.isArray(u)){re(u,t,r,n,i,o,s,a);continue}if(Se(u)){h.active&&(h.cursor===u||h.parents.includes(u))&&er(u),t.push(u);continue}if(typeof u=="object"&&u!==null&&"type"in u&&"props"in u){let l=u;if(typeof l.type=="function"){let f=l.type(l.props||{});Array.isArray(f)?re(f,t,r,n,!1,o):re([f],t,r,n,!1,o);continue}}if(typeof u=="string"||typeof u=="number"){let l=String(u);if(l.trim()===""&&l!==" ")continue;t.push(ue(l));continue}t.push(ue(String(u)))}}}}function wu(e,t,r,n){for(let f=0;f<r.length;f++){let p=r[f].parentNode;p!==null&&p!==e&&p.nodeType!==11&&(r=r.slice(),r[f]=r[f].cloneNode(!0))}let i=r.length,o=t.length,s=i,a=0,c=0,u=o>0?t[o-1].nextSibling??void 0:n,l=null;for(;a<o||c<s;){if(t[a]===r[c]){a++,c++;continue}for(;o>a&&s>c&&t[o-1]===r[s-1];)o--,s--;if(o===a){let f=s<i?c?r[c-1].nextSibling??void 0:r[s-c]:u;for(;c<s;)F(e,r[c++],f)}else if(s===c)for(;a<o;)(!l||!l.has(t[a]))&&t[a].parentNode===e&&e.removeChild(t[a]),a++;else if(t[a]===r[s-1]&&r[c]===t[o-1]){let f=t[--o].nextSibling;F(e,r[c++],t[a++].nextSibling),F(e,r[--s],f),t[o]=t[a-1]}else{if(!l){l=new Map;let p=c;for(;p<s;)l.set(r[p],p++)}let f=l.get(t[a]);if(f!=null)if(c<f&&f<s){let p=a,y=1;for(;++p<o&&p<s&&!(!l.has(t[p])||l.get(t[p])!==f+y);)y++;if(y>f-c){let S=t[a];for(;c<f;)F(e,r[c++],S)}else t[a].parentNode===e?e.replaceChild(r[c++],t[a++]):(F(e,r[c++],u),a++)}else a++;else t[a].parentNode===e&&e.removeChild(t[a]),a++}}return r}function ee(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 F(e,t,r){h.active&&t.parentNode===e||(r&&r.parentNode===e?e.insertBefore(t,r):e.appendChild(t))}function fe(e,t,r){r==null?delete e[t]:e[t]=r}function Ar(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 Ra(e,t){if(!t||typeof t!="function")return;let r=t[gr]?.name;if(!r)return;let n=r.indexOf(":");n!==-1&&q(e,r.slice(0,n),r.slice(n+1),t)}function Sr(e,t,r){let n=typeof r=="function"?w(()=>r()):r;if(!(!n||typeof n!="object"))for(let i of Object.keys(n))q(e,t,i)}function $r(e,t){let r=(n,i)=>{typeof n=="function"&&(q(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 Fe(e,t,r,n=!1){return Ra(e,r),typeof r!="function"?(H(e,t,r,n),()=>{}):k(()=>{j(e,"attribute",t,r);let i=typeof r=="function"?r():r;H(e,t,i,n)})}function ze(e,t,r){return typeof r!="function"?(fe(e,t,r),()=>{}):(Ra(e,r),k(()=>{j(e,"property",t,r);let n=typeof r=="function"?r():r;fe(e,t,n)}))}function Cr(e,t,r){return typeof r!="function"?(H(e,t,!!r),()=>{}):k(()=>{j(e,"attribute",t,r);let n=r();H(e,t,!!n)})}function Ee(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){k(()=>{j(e,"attribute","class",t),Ee(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 pe(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(k(()=>{let s=!!i();for(let a of o)e.classList.toggle(a,s)}));else{let s=!!(typeof i=="function"?i():i);for(let a of o)e.classList.toggle(a,s)}}}function xi(e,t,r){t.includes("-")?r==null?e.removeProperty(t):e.setProperty(t,String(r)):e[t]=r??""}function qe(e){for(;typeof e=="function";)e=e();return e}var Ei=new WeakMap;function ie(e,t,r){if(typeof t=="function"&&r){r.push(k(()=>ie(e,qe(t))));return}let n=qe(t),i=Ei.get(e);if(n==null){Ei.delete(e),e.removeAttribute("style");return}let o=new Set,s=a=>{if(typeof a=="function"&&r){r.push(k(()=>s(qe(a))));return}if(a=qe(a),a!=null){if(typeof a=="string")e.style.cssText=a;else if(Array.isArray(a))for(let c of a)s(c);else if(typeof a=="object")for(let c in a){o.add(c);let u=a[c];typeof u=="function"&&r?r.push(k(()=>xi(e.style,c,qe(u)))):xi(e.style,c,qe(u))}}};if(Array.isArray(n))for(let a of n)s(a);else s(n);if(i)for(let a of i)o.has(a)||xi(e.style,a,null);Ei.set(e,o)}function Na(e,t){if(typeof t!="function"){ie(e,t,[]);return}k(()=>{j(e,"attribute","style",t),ie(e,t())})}function Ta(e,t){if(typeof t!="function"){pe(e,t,[]);return}k(()=>{j(e,"attribute","class",t),pe(e,t())})}function xu(e,t){for(let r=e;r;r=Object.getPrototypeOf(r)){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return typeof n.get=="function"}return!1}function Ci(e){let{element:t,props:r,prevProps:n=ma,isSVG:i=!1,skipChildren:o=!1,isCustomElement:s,accessors:a}=e;if(!t||!Yt(t))return console.error("[spread] Error: element is not a DOM Element!"),()=>{};if(!r)return console.warn("[spread] Warning: props is undefined!"),()=>{};let c=i||t.namespaceURI===ut,u=(d,v,T,$)=>{if(d==="children"){o||$.push(_(t,()=>r.children));return}let g=r[d],me=g===void 0&&T&&xu(r,d);if(g===v&&!me||me&&(d==="ref"||d==="use"||d.startsWith("on")||d.includes(":")||d==="class"||d==="className"||d==="classList"||d==="style"))return;if(d==="ref"){Ae(g,t);return}if(d==="use"){$r(t,g);return}if(d.startsWith("on:")){$.push(Ar(t,d.slice(3),g));return}if(d.startsWith("prop:")){q(t,"prop",d.slice(5),g),$.push(ze(t,d.slice(5),g));return}if(d.startsWith("attr:")){q(t,"attr",d.slice(5),g),$.push(Fe(t,d.slice(5),g,c));return}if(d.startsWith("bool:")){q(t,"bool",d.slice(5),g),$.push(Cr(t,d.slice(5),g));return}if(d==="class"||d==="className"){typeof g=="function"?$.push(k(()=>{j(t,"attribute","class",g),Ee(t,g())})):Ee(t,g);return}if(d==="classList"){Sr(t,"class",g),typeof g=="function"?$.push(k(()=>{j(t,"attribute","class",g),pe(t,g())})):pe(t,g,$);return}if(d==="style"){Sr(t,"style",g),typeof g=="function"?$.push(k(()=>{j(t,"attribute","style",g),ie(t,g())})):ie(t,g,$);return}if(d.startsWith("on")){let W=d.slice(2).toLowerCase();v&&dt(t,W),g&&xr(t,W,g);return}let Y=s??t.localName.includes("-"),M=pt.has(d)||!c&&d in t||Y&&!c&&!We(d);if(Y&&!c&&!We(d)&&a!==void 0&&typeof g=="function"&&!a.includes(d)){x()?He(t,d,g):fe(t,d,g);return}if(Y&&!c&&!We(d)&&x()){$.push(k(()=>{let W=typeof g=="function"?g():r[d];for(;typeof W=="function"&&W.length===0;)W=W();He(t,d,W)}));return}typeof g=="function"?$.push(M?ze(t,d,g):Fe(t,d,g,c)):$.push(k(()=>M?fe(t,d,r[d]):H(t,d,r[d],c)))},l=d=>{d!=="children"&&(d.startsWith("on")?dt(t,d.slice(2).toLowerCase()):pt.has(d)?fe(t,d,null):t.removeAttribute(d))},f=new Map,p=(d,v,T)=>{let $=[];f.set(d,$),u(d,v,T,$)};w(()=>{for(let d in r)p(d,n[d],n===ma);for(let d in n)d in r||l(d)});let y=E(),S=k(()=>{let d=new Set;for(let v in r)d.add(v);w(()=>C(y,()=>{for(let v of d)f.has(v)||p(v,void 0,!0);for(let[v,T]of f)d.has(v)||(T.forEach($=>$()),f.delete(v),l(v))}))});return()=>{S();for(let d of f.values())d.forEach(v=>v())}}function vt(e,t,r=!1){for(let n in t){let i=t[n];if(n==="ref"){Ae(i,e);continue}if(n!=="children"){if(n==="use"){$r(e,i);continue}if(n.startsWith("on:")){Ar(e,n.slice(3),i);continue}if(n.startsWith("prop:")){q(e,"prop",n.slice(5),i),ze(e,n.slice(5),i);continue}if(n.startsWith("attr:")){q(e,"attr",n.slice(5),i),Fe(e,n.slice(5),i,r);continue}if(n.startsWith("bool:")){q(e,"bool",n.slice(5),i),Cr(e,n.slice(5),i);continue}if(n.startsWith("on")&&n.length>2){let o=n.slice(2).toLowerCase();if(typeof i=="function")if(wr.has(o)){e[`$$${o}`]=i;let s=`__fx_${o}`;if(!e[s]){let a=c=>{e[`$$${o}`]?.(c)};e.addEventListener(o,a),e[s]=a}}else e[`$$${o}`]=i,br.has(o)||ht([o]);continue}if(n==="class"||n==="className"){Ee(e,i);continue}if(n==="classList"){Sr(e,"class",i),typeof i=="function"?k(()=>{j(e,"attribute","class",i),pe(e,i())}):pe(e,i,[]);continue}if(n==="style"){Sr(e,"style",i),typeof i=="function"?k(()=>{j(e,"attribute","style",i),ie(e,i())}):ie(e,i,[]);continue}if(n==="innerHTML"){if(typeof i=="function"){let o=O(()=>{let s=i();for(;typeof s=="function";)s=s();e.innerHTML=s});A(()=>o())}else e.innerHTML=i;continue}if(n==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let o=O(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.value=s??"")});A(()=>{o()})}else k(()=>{document.activeElement!==e&&(e.value=t[n]??"")});continue}if(n==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let o=O(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();document.activeElement!==e&&(e.checked=s??"")});A(()=>{o()})}else k(()=>{document.activeElement!==e&&(e.checked=t[n]??"")});continue}if(n==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let o=!0,s=O(()=>{let a=i();for(;typeof a=="function"&&a.length===0;)a=a();o?(o=!1,queueMicrotask(()=>{e.value=a??""})):e.value=a??""});A(()=>{s()})}else{let o=!0;k(()=>{let s=t[n];o?(o=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""})}continue}if(typeof i=="function"){let o=O(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();ft(e,n,s,r)});A(()=>{o()})}else k(()=>ft(e,n,t[n],r))}}}function Ri(...e){let t=i=>typeof i=="function"?i():i,r=i=>{for(let o=e.length-1;o>=0;o--){let s=t(e[o]);if(!s||!(i in s))continue;let a=s[i];if(a!==void 0)return a}},n=i=>{for(let o of e){let s=t(o);if(s&&i in s)return!0}return!1};return new Proxy({},{get:(i,o)=>r(o),has:(i,o)=>n(o),ownKeys:()=>{let i=new Set;for(let o of e){let s=t(o);if(s)for(let a of Reflect.ownKeys(s))i.add(a)}return[...i]},getOwnPropertyDescriptor:(i,o)=>n(o)?{enumerable:!0,configurable:!0,get:()=>r(o)}:void 0})}function Rr(e,...t){let r=new Set;for(let s of t)for(let a of s)r.add(a);let n=s=>({enumerable:!0,configurable:!0,get:()=>e[s]}),i=t.map(s=>{let a=new Set(s);return new Proxy({},{get:(c,u)=>a.has(u)?e[u]:void 0,has:(c,u)=>a.has(u)&&u in e,ownKeys:()=>Array.from(a).filter(c=>c in e),getOwnPropertyDescriptor:(c,u)=>a.has(u)&&u in e?n(u):void 0})}),o=new Proxy({},{get:(s,a)=>r.has(a)?void 0:e[a],has:(s,a)=>!r.has(a)&&a in e,ownKeys:()=>Reflect.ownKeys(e).filter(s=>!r.has(s)),getOwnPropertyDescriptor:(s,a)=>!r.has(a)&&a in e?n(a):void 0});return[...i,o]}function Ae(e,t){if(!e)return;let r=e[gr]?.name;if(q(t,"ref",r||typeof e=="function"&&e.name||"ref",e),Se(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 Ni(e,t,r){let n=t||document.body,i=et(()=>e),o=[];return I(()=>{let s=k(()=>{let a=i();Array.isArray(a)?(a.forEach(c=>n.appendChild(c)),o.push(()=>{a.forEach(c=>{c.parentNode===n&&n.removeChild(c)})})):Se(a)&&(n.appendChild(a),o.push(()=>{a.parentNode===n&&n.removeChild(a)}))});o.push(s),A(()=>{o.forEach(a=>a())})}),null}function Oa(e){return typeof e=="string"&&e.toLowerCase()===e}function Nr(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 Be(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Da(e){return typeof e=="function"&&e.length===0&&R(e)}function $e(e,t,r){if(!t)throw new Error("Container element is required");let n,i,o=[];return B(s=>{I(()=>{h.active||(t.textContent=""),mr(t),yr(),_(t,e)}),i=s}),()=>{i?.(),n?.(),o.forEach(s=>s()),t.textContent=""}}function Ti(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(...)`.")}function Tr(e,t={}){if(typeof e=="function")return xe(e,t);if(typeof e!="string"||e.length===0)return null;let r=Nr(e),n=ke(e,r);return vt(n,t,r),Eu(n,t),n}function Eu(e,t){if(!t||t.children===void 0)return;let r=e.firstChild,n;h.active&&r?.nodeType===8&&r.data==="fx"?n=yt(r):(r=Ma("fx"),n=Ma("fx/"),e.appendChild(r),e.appendChild(n));let i=r;_(e,mt(i,()=>et(()=>t.children)),n,gt(i,n))}function Ma(e){return x()?Me().createComment(e):document.createComment(e)}function Or(e){let t=()=>{let a=e.component;return R(a)?a():a},[,r]=Rr(e,["component"]),n=E(),i=null,o,s;return b(()=>{let a=t();return a===o||(i&&Z(i),i=U(n),o=a,s=a==null?null:C(i,()=>w(()=>typeof a=="string"?Tr(a,r):xe(a,r)))),s},void 0,{name:"Dynamic"})}var Oi=ln(void 0);function _i(e,t){let r;O(()=>{t.error()===void 0?r=void 0:r??=w(e.current)}),O(()=>{let n=e.committed();w(()=>{r!==void 0&&n!==r&&t.error()!==void 0&&t.reset()})})}function _r(e){let t=an(),r=a=>!!a&&typeof a.then=="function",n=a=>(x()&&Gt(Xt(a)),typeof e.fallback=="function"?e.fallback(a,t.reset):e.fallback),i=a=>{if(r(a))throw a;return queueMicrotask(()=>t.setError(a)),null},o=a=>{if(Array.isArray(a))return a.map(o);if(typeof a!="function")return a;let c=a;return()=>{try{let u=o(c()),l=x()?t.caught():void 0;return l===void 0?u:w(()=>n(l))}catch(u){return x()&&!r(u)?(t.setError(u),w(()=>n(u))):i(u)}}},s=Lt(Oi);return s&&_i(s,t),b(()=>{let a=t.error();if(a!==void 0)return n(a);try{let c=cn(t,()=>{let l=e.children;return o(typeof l=="function"?l():l)}),u=x()?t.caught():void 0;return u===void 0?c:w(()=>n(u))}catch(c){return i(c),n(c)}},void 0,{name:"ErrorBoundary"})}function Dr(e){let t=ce(()=>e.each),r=()=>e.fallback??null,n=(i,o)=>{let s=e.children,a=Array.isArray(s)?s.map(c=>typeof c=="function"?c(i,o):c):typeof s=="function"?s(i,o):s;return Pe(a),a};return e.by?Oe(t,e.by,(i,o)=>n(i,o),{fallback:r}):Te(t,(i,o)=>n(i,o),{fallback:r})}function Mr(e){let t=ce(()=>e.each);return _e(t,(r,n)=>{let i=e.children(r,n);return Pe(i),i},{fallback:()=>e.fallback??null})}function Ir(e){if(x())return null;let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,r,n,i=!1,o=E(),s=()=>C(o,()=>B(a=>{r=a,n=document.createElement("div"),n.style.display="contents",t().appendChild(n),_(n,e.children)&&Ae(e.ref,n)}));return h.active?queueMicrotask(()=>{i||s()}):s(),A(()=>{i=!0,r?.(),n?.remove()}),null}function Pr(e){let t=ce(()=>e.when),r=b(t,void 0,{name:"Show.when"}),n=b(()=>!!r(),void 0,{name:"Show.cond"}),i=E(),o=null,s=null,a=c=>{c!==s&&(o&&Z(o),o=U(i),s=c)};return b(()=>{let c=n();return a(c?"when":"fallback"),C(o,()=>{if(!c)return e.fallback;let u=e.children;if(typeof u=="function"){let l=u;if(l.length===0)return w(()=>l(w(r)));let f=r();return w(()=>l(f))}return u})},void 0,{name:"Show.result"})}var ku=Symbol.for("fluixi.owner"),St=1,Di=3,Mi=8,Au=Symbol.for("fluixi.serverElementRenderer"),Ia=Symbol.for("fluixi.serverElementRendered");function bt(e){if(e.nodeType!==St)return;let t=e;if(typeof t.localName!="string"||!t.localName.includes("-")||t[Ia])return;let r=globalThis[Au];r&&(t[Ia]=!0,r(t))}var Pa;Pa=st;var Lr=class{constructor(){this[Pa]=!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),bt(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),bt(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,bt(e)),t}addEventListener(){}removeEventListener(){}},wt=class La extends Lr{constructor(t){super(),this.nodeType=Di,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 La(this.data)}},ja=class Ha extends Lr{constructor(t){super(),this.nodeType=St,this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new Ha(this.rawOuterHTML)}getAttribute(t){let r=/^\s*<[a-zA-Z][^\s/>]*([^>]*)>/.exec(this.rawOuterHTML)?.[1];if(!r)return null;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`(?:^|\\s)${n}(?:\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+)))?(?=\\s|/|$)`,"i").exec(r);return i?i[1]??i[2]??i[3]??"":null}hasAttribute(t){return this.getAttribute(t)!==null}},jr=class Wa extends Lr{constructor(t){super(),this.nodeType=Mi,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new Wa(this.data)}},$u=class{constructor(){this.cssText=""}setProperty(e,t){this[e]=t}removeProperty(e){delete this[e]}},Cu=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}},xt=class qa extends Lr{constructor(t,r=!1){if(super(),this.nodeType=St,this.attributes=new Map,this.style=new $u,this.classList=new Cu(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,this.localName.includes("-")){let n=E();n&&(this[ku]=n)}}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 wt(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 qa(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}};var Ru=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Nu={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function Ba(e){return e.replace(/&(#?\w+);/g,(t,r)=>Nu[r]??t)}var oe=class extends Error{};function Va(e,t=!1){let r=0,n=[],i=[],o=u=>{let l=i[i.length-1];l?l.appendChild(u):n.push(u)};for(;r<e.length;){let u=e.indexOf("<",r);if(u===-1){a(e.slice(r));break}if(u>r&&a(e.slice(r,u)),e.startsWith("<!--",u)){let l=e.indexOf("-->",u);if(l===-1)throw new oe(`unterminated comment at ${u}`);o(new jr(e.slice(u+4,l))),r=l+3;continue}if(e[u+1]==="/"){let l=e.indexOf(">",u);if(l===-1)throw new oe(`unterminated closing tag at ${u}`);let f=e.slice(u+2,l).trim().toLowerCase(),p=i.pop();if(!p||p.localName!==f)throw new oe(`</${f}> does not close <${p?.localName??"nothing"}>`);r=l+1;continue}r=c(u)}if(i.length>0)throw new oe(`unclosed <${i[i.length-1].localName}>`);let s=n[0];if(n.length!==1||!(s instanceof xt))throw new oe(`expected exactly one root element, got ${n.length}`);return s;function a(u){u!==""&&o(new wt(Ba(u)))}function c(u){let l=/[\s/>]/.exec(e.slice(u+1));if(!l)throw new oe(`unterminated tag at ${u}`);let f=e.slice(u+1,u+1+l.index).toLowerCase(),p=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 S=y;for(;y<e.length&&!/[\s=/>]/.test(e[y]);)y++;let d=e.slice(S,y);if(d==="")throw new oe(`malformed attribute at ${y}`);if(e[y]==="="){if(e[y+1]!=='"')throw new oe(`attribute ${d} must have a double-quoted value`);let v=e.indexOf('"',y+2);if(v===-1)throw new oe(`unterminated value for ${d}`);p.setAttribute(d,Ba(e.slice(y+2,v))),y=v+1}else p.setAttribute(d,"")}return o(p),Ru.has(f)||i.push(p),y}}var Tu=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),za=/&/g,Ka=/</g,Ua=/>/g,Ou=/"/g;function Ii(e){return e.replace(za,"&amp;").replace(Ka,"&lt;").replace(Ua,"&gt;")}function Fa(e){return e.replace(za,"&amp;").replace(Ou,"&quot;").replace(Ka,"&lt;").replace(Ua,"&gt;")}function _u(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Du(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(`${_u(r)}: ${n}`)}return t.join("; ")}function Mu(e){let t="",r=Du(e.style);for(let[n,i]of e.attributes)n==="style"&&r||(t+=` ${n}="${Fa(i)}"`);if(r){let n=e.attributes.get("style"),i=n?`${n.replace(/;\s*$/,"")}; ${r}`:r;t+=` style="${Fa(i)}"`}return t}function te(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Ii(e);if(typeof e=="number")return Ii(String(e));if(typeof e=="function")return te(e());if(Array.isArray(e))return e.map(te).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case Di:return Ii(e.data??"");case Mi:return`<!--${e.data??""}-->`;case St:{bt(e);let t=e.localName,r=`<${t}${Mu(e)}>`;if(Tu.has(t))return r;let n=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(te).join("");return`${r}${n}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(te).join(""):""}var Et="__FX_DATA__";function Hr(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var Pi;function Wr(){let e=globalThis.__FX_DATA__;if(e&&typeof e.nodeType!="number")return e;if(Pi!==void 0)return Pi;let t=null;if(typeof document<"u"){let r=document.getElementById(Et)?.textContent;if(r)try{t=JSON.parse(r)}catch{t=null}}return Pi=t}var Ja=!1;function Ya(){Ja||(Ja=!0,rs({createElement:(e,t)=>new xt(e,t),createText:e=>new wt(e),createRaw:e=>new ja(e),parseTemplate:(e,t)=>Va(e,t),createComment:e=>new jr(e)}))}function Za(e,t={}){let r=x();Ya(),be(!0);let n=rt(t.event);n.hydrationKeys=t.hydrationKeys!==!1;try{return it(n,()=>B(i=>{try{let o=typeof e=="function"?e():e;return te(o)}finally{i()}}))}finally{nt(n),be(r)}}var Ga=!1,Xa=new WeakMap;function Iu(){Ga||(Ga=!0,hn(e=>{V()?.pending.add(e)}),Qe(()=>V()?.nextResourceId()??""),bn((e,t)=>{e&&V()?.data.set(e,t)}),xn(()=>{let e=V();if(!e)return;let t=Xa.get(e);return t||Xa.set(e,t=wn()),t}))}var Li=null;function Qa(e){Li=e}function ji(e){if(e.data.size===0)return"";let t={};for(let[n,i]of e.data){let o=i;if(Li)try{o=Li(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=Hr(JSON.stringify(t));return r==="{}"?"":`<script type="application/json" id="${Et}">${r}<\/script>`}var Pu=50;async function ec(e,t={}){let r=x();Ya(),be(!0),Iu();let n=rt(t.event);n.hydrationKeys=t.hydrationKeys!==!1;try{return await it(n,async()=>{t.preload&&await t.preload(t.event);let i,o=null,s=()=>{};B(l=>{s=l,o=E(),i=typeof e=="function"?e():e});let a=()=>{try{C(o,()=>te(i))}catch{}};a();let c=0;for(;n.pending.size>0&&c++<Pu;){let l=Array.from(n.pending);n.pending.clear(),await Promise.allSettled(l),await Ht(),a()}let u=C(o,()=>te(i))+ji(n);return s(),u})}finally{nt(n),be(r)}}function tc(e){return b(()=>{let t=typeof e=="function"?e():e,r=[];for(let[n,i]of Object.entries(t)){if(!n)continue;(typeof i=="function"?i():i)&&r.push(n)}return r.join(" ")},void 0,{name:"ClassMap"})}function Br(){for(;;){for(;h.cursor&&h.cursor.nodeType===3&&h.cursor.data==="";)h.cursor=h.cursor.nextSibling;if(h.cursor!=null||!h.parents.length)return;h.cursor=h.parents.pop().nextSibling}}var qr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),kt=typeof process<"u"&&process.env&&!1;function At(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).`)}var Lu=Symbol.for("fluixi.ownsContent");function oc(e){return e.localName.includes("-")?e.hasAttribute("data-fx-ssr")||e[Lu]===!0:!1}var rc=Symbol.for("fluixi.serverContent");function sc(e){let t=e;t[rc]||(t[rc]=Array.from(e.childNodes))}function ju(e){Br();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(Hn(t),qr.has(e.toLowerCase())||oc(t)?(qr.has(e.toLowerCase())||sc(t),h.cursor=t.nextSibling):(h.parents.push(t),h.cursor=t.firstChild),t):(kt&&t&&At(`<${e}>`,t),null)}function Hu(e){qr.has(e.localName)||oc(e)?(qr.has(e.localName)||sc(e),h.cursor=e.nextSibling):(h.parents.push(e),h.cursor=e.firstChild)}function Wu(e,t){Br();let r=h.cursor;if(r&&r.nodeType===1&&r.tagName.toLowerCase()===e.toLowerCase()){let n=ms(r);return t&&n&&n!==t?(kt&&At(`<${e}> (another template)`,r),null):(Hn(r),h.cursor=r.nextSibling,r)}return kt&&r&&At(`<${e}> (static)`,r),null}function qu(e){if(e===""){let r=h.cursor;return r&&r.nodeType===3&&r.data!==""?(h.cursor=r.nextSibling,r.data="",r):null}Br();let t=h.cursor;if(t&&t.nodeType===3){let r=t.data;return r.length>e.length&&r.startsWith(e)?(h.cursor=t.splitText(e.length),t):(h.cursor=t.nextSibling,r!==e&&(t.data=e),t)}return kt&&t&&At(`text ${JSON.stringify(e.slice(0,24))}`,t),null}function Bu(e){Br();let t=h.cursor;return t&&t.nodeType===8&&t.data===e?(h.cursor=t.nextSibling,t):(kt&&t&&At(`marker <!--${e.slice(0,24)}-->`,t),null)}var nc=!1;function ac(){nc||(nc=!0,os({hydrateElement:ju,hydrateText:qu,hydrateMarker:Bu,hydrateStatic:Wu,enterElement:Hu}))}var ic=()=>typeof location>"u"?null:`${location.pathname}${location.search}`;function Ce(e,t,r){ac(),h.active=!0,h.cursor=t.firstChild,h.parents=[],rr(),Wn(t);let n=Wr(),i=r?.resourceNamespace,o=0;Qe(()=>i?`${i}:r${o++}`:`r${o++}`);let s=ic();yn(n?a=>a in n&&ic()===s?{value:n[a]}:void 0:null);try{return $e(e,t)}finally{h.active=!1,h.cursor=null,h.parents=[],qn()}}function cc(e,t){ac(),Wn(e);let r={active:h.active,cursor:h.cursor,parents:h.parents};h.active=!0,h.cursor=e.firstChild,h.parents=[];try{_(e,t()),nr(e)}finally{h.active=r.active,h.cursor=r.cursor,h.parents=r.parents,r.active||qn()}}var Hi="fluixi-island";function uc(e){let{component:t,props:r={},name:n}=e,i=ke(Hi),o=n??t.name??"Island";H(i,"name",o),H(i,"props",JSON.stringify(r??{}));let s=x()?V():void 0;if(s){let a=s.nextIslandNamespace(o);_(i,()=>s.withResourceScope(a,()=>t(r)))}else _(i,()=>t(r));return i}var lc=!1;function Vu(){if(lc||typeof document>"u")return;lc=!0;let e=document.createElement("style");e.textContent=`${Hi}{display:contents}`,document.head.appendChild(e)}function fc(e){if(typeof document>"u")return;Vu();let t=document.querySelectorAll(Hi),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 a={};try{a=JSON.parse(n.getAttribute("props")||"{}")}catch{}Ce(()=>s(a),n,{resourceNamespace:`${i}#${o}`})})}function pc(e,...t){throw new Error("html`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function dc(e,...t){throw new Error("svg`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function hc(e,...t){throw new Error("css`` was not compiled: component styles need @fluixi-css/vite next to the fluixi plugin.")}var Fu={createComponent:xe,createElement:mi,createNativeElement:ke,createTemplate:Er,cloneTemplate:kr,templateNode:Ai,holeContent:gt,holeEnd:yt,holeScope:mt,createPortal:Ni,render:$e,hydrate:Ce,insert:_,appendChildren:gi,removeChildren:yi,spread:Ci,applyProps:vt,mergeProps:Ri,bindPair:Ti,setProperty:fe,setDynamicProperty:ze,setAttribute:H,setDynamicAttribute:Fe,removeAttribute:hi,getAttribute:di,setClassName:Ee,addClass:ui,removeClass:fi,toggleClass:pi,setStyles:dr,delegateEvents:ht,addDelegatedEventListener:xr,removeDelegatedEventListener:dt,handleRef:Ae,resetIntegration:oi,isIntegrationInitialized:ii},zu=Fu;var Vr={kind:"eager"},Ku=["pointerdown","focusin","keydown"],mc=new Set(["eager","idle","visible","interaction","media","never"]),Ke=class extends Error{};function yc(e,t){let r=e.slice(5);if(!mc.has(r))throw new Ke(`Unknown load strategy 'load:${r}'. Expected one of ${[...mc].join(", ")}.`);switch(r){case"eager":return Vr;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?Uu(t):[...Ku]};case"media":if(!t)throw new Ke(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new Ke(`Unhandled load strategy '${r}'.`)}}function Uu(e){let t=e.split(/[\s,]+/).map(r=>r.trim()).filter(Boolean);if(t.length===0)throw new Ke("'load:interaction' was given no event names.");return t}function gc(e){return e.kind!=="eager"}var qi=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],Bi=["Suspense","SuspenseList","Await"],Fr=["Router","Outlet","Redirect","Link"],ey=[...qi,...Bi,...Fr],Vi=new Set([...qi,...Bi]);function vc(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:r="@fluixi/core",routerModule:n="@fluixi/core/router"}=e,i={};for(let o of qi)i[o]=t;for(let o of Bi)i[o]=r;for(let o of Fr)i[o]=n;return i}function bc(e,t={}){let{resolver:r,isBound:n,modules:i,strategyFor:o}=t,s=vc(i),a=new Map,c=new Set,u=f=>{let{name:p}=f;if(!p||p.includes(".")||n?.(p))return;let y=l(p);if(!y){c.add(p);return}let S=y.origin==="builtin"&&Vi.has(p)?Vr:o?.(f)??Vr;f.source={...y,loading:S},a.set(p,f.source)},l=f=>{if(Vi.has(f))return{module:s[f],export:f,origin:"builtin"};let p=r?.resolve(f);if(p)return{module:p.module,export:p.export,origin:"rule"};if(Fr.includes(f))return{module:s[f],export:f,origin:"builtin"}};return zr(e,f=>{f.kind==="component"&&u(f)}),{resolved:a,unresolved:[...c]}}function zr(e,t){let r=Array.isArray(e)?e:[e];for(let n of r){t(n);let i=n.children;i&&zr(i,t)}}function Sc(e){let t=[];zr(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:a}=o.source;a.kind==="eager"&&r.add(s),a.kind==="never"&&n.add(s)}let i=new Map;for(let o of t){let s=o.source;!gc(s.loading)||s.loading.kind==="never"||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 wc={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Ju=/&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;function Kr(e){return e.includes("&")?e.replace(Ju,(t,r,n,i)=>{let o=r?parseInt(r,16):n?parseInt(n,10):Object.prototype.hasOwnProperty.call(wc,i)?wc[i]:void 0;return o!==void 0&&o<=1114111?String.fromCodePoint(o):t}):e}var z="@fluixi/reactive/signal",Fi={$signal:{export:"signal",module:z,returns:"signal-handle"},$memo:{export:"memo",module:z,returns:"memo-handle"},$effect:{export:"effect",module:z,returns:"effect"},$store:{export:"store",module:"@fluixi/reactive/store",returns:"store-handle"},$resource:{export:"resource",module:z,returns:"resource-handle"},$cachedResource:{export:"cachedResource",module:"@fluixi/reactive/cached-resource",returns:"resource-handle"},$selector:{export:"createSelector",module:z,returns:"memo-accessor"},$deferred:{export:"createDeferred",module:z,returns:"memo-accessor"},$untrack:{export:"untrack",module:z,returns:"plain"},$untrackStore:{export:"untrackStore",module:"@fluixi/reactive/store",returns:"plain"},$batch:{export:"batch",module:z,returns:"plain"},$cleanup:{export:"onCleanup",module:z,returns:"plain"},$root:{export:"root",module:z,returns:"plain"},$context:{export:"context",module:z,returns:"plain"},$renderEffect:{export:"renderEffect",module:z,returns:"effect"},$computed:{export:"computed",module:z,returns:"effect"},$storage:{export:"useStorage",module:"@fluixi/core/storage",returns:"plain"},$asyncStorage:{export:"useAsyncStorage",module:"@fluixi/core/storage",returns:"plain"},$persisted:{export:"persisted",module:"@fluixi/core/storage",returns:"signal-handle"},$env:{export:"env",module:"@fluixi/start/env",returns:"plain"}};var ly=new RegExp(`\\$(?:${Object.keys(Fi).map(e=>e.slice(1)).join("|")})\\s*\\(`);var xc="__fx_source";var Gu="__fx_hole",Re=(e,t,r,n)=>`(globalThis.${Gu} ?? ((f) => f))(${e},${t},${r}${n===void 0?"":`,${JSON.stringify(n)}`})`,Xu="__fx_props",Ec=(e,t)=>`(globalThis.${Xu} ?? ((p) => p))(${e},${JSON.stringify(t)})`;var zi={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},Sy={version:2,module:"@fluixi/dom",symbols:[...zi.symbols,"template","cloneTemplate","walk"]};var Yu=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),kc={className:"class",htmlFor:"for"},Ki=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),Zu=new Set(["script","style","textarea","title"]);function Ui(e){return Zu.has(e)}function Ji(e){return kc[e]??e}function de(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!Ki.has(e.name)}function Gi(e){if(!e.static||Ui(e.tag))return!1;for(let t of e.props)if(!de(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&Gi(t)))return!1;return!0}function $t(e){let t=e.props.map(rf).filter(Boolean).join(""),r=`<${e.tag}${t}>`;return Yu.has(e.tag)?r:`${r}${e.children.map(Qu).join("")}</${e.tag}>`}function Qu(e){if(e.kind==="text")return of(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return $t(e)}var ef=new Set(["draggable","spellcheck","contenteditable"]);function tf(e){return e.startsWith("aria-")||ef.has(e.toLowerCase())}function rf(e){let t=kc[e.name]??e.name,r=e.literal;return(r===!0||r===!1||r===void 0)&&tf(t)?` ${t}="${r!==!1}"`:r===!0||r===void 0?` ${t}`:r===!1||r===null?"":` ${t}="${nf(String(r))}"`}function nf(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function of(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Xi(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 sf="<!--fx-->",af="<!--fx/-->";function Ur(e){return e.kind==="expr"||e.kind==="component"||e.kind==="control"||Zi(e)}function Zi(e){return e.kind==="element"&&e.tag.includes("-")}function Qi(e){return Zi(e)?!0:"children"in e&&Array.isArray(e.children)&&e.children.some(Qi)}function cf(e){return e.kind==="text"||e.kind==="element"&&Ac(e)}var lf=new Set(["indeterminate"]);function uf(e){if(e.kind==="spread")return null;if(e.name==="ref")return"ref";if(e.name==="use")return"use";if(e.kind==="event")return e.event?"event":null;if(e.kind==="prop")return"property";if(e.kind!=="attr")return null;let t=e.name;return t.startsWith("on:")?"nativeEvent":t.startsWith("prop:")?"property":t.startsWith("attr:")?"attr":t.startsWith("bool:")?"boolAttr":t==="className"||t==="class"?de(e)?"serialize":"class":t==="classList"?de(e)?"serialize":e.reactive?"classListDynamic":"classList":t==="style"?de(e)?"serialize":e.reactive?"styleDynamic":"style":t.includes(":")||Ki.has(t)?null:lf.has(t)?"property":e.expr===void 0?de(e)?"serialize":null:"attr"}function ff(e){let t=[],r=new Map;for(let n of e.props)r.has(n.name)||t.push(n.name),r.set(n.name,n);return t.map(n=>r.get(n))}function Jr(e){let t=e.tag.includes("-"),r={serialize:[],bindings:[]};for(let n of ff(e)){let i=uf(n);if(i===null)return null;if(i==="serialize"){r.serialize.push(n);continue}if(t)return null;r.bindings.push({prop:n,kind:i})}return r}function Ac(e){return e.svg||Zi(e)||Ui(e.tag)||!Jr(e)?!1:e.children.every(t=>cf(t)||Ur(t))}function $c(e){if(Ur(e))return!0;let t=e.children;return t?t.some($c):!1}function Cc(e){if(e.kind!=="element")return!1;let t=Jr(e);return t&&t.bindings.length>0?!0:e.children.some(Cc)}function Yi(e){return $c(e)||Cc(e)}function Rc(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"||Rc(t))}function Nc(e){if(!Ac(e)||!Rc(e)||!Yi(e))return null;let t=[],r=[],n=[],i=0,o=a=>{let c=`_n$${i++}`;return t.push({ref:c,expr:a}),c};return s(e,"_el$"),{html:pf(e),tag:e.tag,steps:t,holes:r,bindings:n};function s(a,c){let u=Jr(a);if(u)for(let p of u.bindings)n.push({ref:c,prop:p.prop,kind:p.kind});let l=-1;a.children.forEach((p,y)=>{Yi(p)&&(l=y)});let f=null;for(let p=0;p<=l;p++){let y=a.children[p],S=f?`${f}.nextSibling`:`${c}.firstChild`;if(Ur(y)){let v=o(S),T=o(`holeEnd(${v})`);r.push({parentRef:c,startRef:v,endRef:T,node:y}),f=T;continue}let d=o(S);y.kind==="element"&&Yi(y)&&s(y,d),f=d}}}function pf(e){return $t(Tc(e)).split(Oc).join(sf+af)}function Tc(e){let t=Jr(e);return{...e,props:t?t.serialize:[],children:e.children.map(r=>Ur(r)?{kind:"text",value:Oc}:r.kind==="element"?Tc(r):r)}}var Oc="\0fx-hole\0";function _c(e,t){let r=e[t];for(let n=t+1;n<e.length;n++){let i=e[n];if(i==="\\")n++;else{if(i===r)return n+1;if(i===`
3
+ `)return-1}}return-1}function Dc(e,t){let r=t+1;for(;r<e.length;){let n=e[r];if(n==="\\")r+=2;else{if(n==="`")return r+1;if(n==="$"&&e[r+1]==="{"){let i=1;for(r+=2;r<e.length&&i>0;){let o=e[r];if(o==="\\")r+=2;else if(o==="`"){let s=Dc(e,r);if(s<0)return-1;r=s}else if(o==='"'||o==="'"){let s=_c(e,r);if(s<0)return-1;r=s}else o==="{"?i++:o==="}"&&i--,r++}}else r++}}return-1}function df(e,t){let r=!1;for(let n=t+1;n<e.length;n++){let i=e[n];if(i==="\\")n++;else if(i==="[")r=!0;else if(i==="]")r=!1;else{if(i===`
4
+ `)return-1;if(i==="/"&&!r){let o=n+1;for(;o<e.length&&/[a-z]/i.test(e[o]);)o++;return o}}}return-1}function hf(e){return e!==""&&/[A-Za-z0-9_$)\]]/.test(e)}function mf(e){let t=0,r="",n=0;for(;n<e.length;){let i=e[n];if(i==='"'||i==="'"){let o=_c(e,n);if(o<0)return null;n=o,r=i}else if(i==="`"){let o=Dc(e,n);if(o<0)return null;n=o,r=i}else{if(i==="/"&&e[n+1]==="/")return null;if(i==="/"&&e[n+1]==="*"){let o=e.indexOf("*/",n+2);if(o<0)return null;n=o+2}else if(i==="/"&&!hf(r)){let o=df(e,n);if(o<0)return null;n=o,r="/"}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)||(r=i),n++}}}return t===0?!1:null}function D(e,t){let r=e.trim();return r===""?`(${e})`:t==="arrowBody"&&r[0]==="{"?`(${e})`:mf(r)===!1?e:`(${e})`}var yf={show:"Show",for:"For",index:"Index",switch:"Switch",match:"Match",dynamic:"Dynamic",errorBoundary:"ErrorBoundary",suspense:"Suspense"};function gf(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function to(e){return gf(e)?e:JSON.stringify(e)}function Pc(e){if(e.expr!==void 0){if(e.name==="ref"&&e.at)return Re(D(e.expr,"value"),e.at.line,e.at.column,e.expr);if(!e.reactive)return D(e.expr,"value");let t=`() => ${D(e.expr,"arrowBody")}`;return e.at?Re(t,e.at.line,e.at.column,e.directive):t}return JSON.stringify(e.literal??!0)}function vf(e){return e.expr!==void 0?D(e.expr,"value"):JSON.stringify(e.literal??!0)}function Lc(e){return e===void 0?String(e):/^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$/.test(e.trim())?e:`() => (${e})`}function bf(e,t,r){let n=e.filter(a=>a.kind==="spread"),o=e.filter(a=>a.kind!=="spread").map(a=>`${to(a.name)}: ${Pc(a)}`);t!=null&&o.push(`children: ${t}`);let s=`{ ${o.join(", ")} }`;return n.length>0?(r.add("mergeProps"),`mergeProps(${n.map(a=>Lc(a.expr)).join(", ")}, ${s})`):s}function Mc(e,t){return t?Re(e,t.line,t.column):e}function jc(e,t,r){if(e.length===1)return Ct(e[0],t,r);let n=!1;return`[${e.map(o=>{let s=Ct(o,t,r);return o.kind==="element"&&n?(t.add("deferElement"),`deferElement(() => ${D(s,"arrowBody")})`):((o.kind==="component"||o.kind==="control"||o.kind==="expr"&&o.reactive)&&(n=!0),s)}).join(", ")}]`}function Ic(e,t,r,n,i,o){n.add("createMemo"),n.add("createComponent");let s=t.filter(p=>p.kind==="spread"),a=t.filter(p=>p.kind!=="spread"),c=a.map(p=>[p.name,vf(p)]);r.length>0&&c.push(["children",jc(r,n,i)]);let u=`{ ${c.map(([p,y])=>`get ${to(p)}() { return ${y}; }`).join(", ")} }`;if(c.some(([,p])=>/\bthis\b/.test(p))){let p=c.map(([S,d])=>`${JSON.stringify(S)}: () => (${d})`);u=`((_$t) => ({ ${c.map(([S])=>`get ${to(S)}() { return _$t[${JSON.stringify(S)}](); }`).join(", ")} }))({ ${p.join(", ")} })`}s.length>0&&(n.add("mergeProps"),u=`mergeProps(${s.map(p=>Lc(p.expr)).join(", ")}, ${u})`);let l={};for(let p of a)p.at&&(l[p.name]=[p.at.line,p.at.column]);Object.keys(l).length&&(u=Ec(u,l));let f=o?`globalThis.${xc}?.(${JSON.stringify(o.file)},${o.line},${o.column},${JSON.stringify(e)}), `:"";return`createMemo(${D(`${f}() => createComponent(${e}, ${u})`,"value")})`}function eo(e){let t=e.prop.name;return e.kind==="boolAttr"||t.startsWith("prop:")||t.startsWith("attr:")?t.slice(5):Ji(t)}function Sf(e,t){let{ref:r,prop:n,kind:i}=e,o=Pc(n);switch(i){case"class":return t.add("setClassName"),`setClassName(${r}, ${o});`;case"classList":return t.add("setClassList"),`setClassList(${r}, ${o}, []);`;case"classListDynamic":return t.add("setDynamicClassList"),`setDynamicClassList(${r}, ${o});`;case"style":return t.add("setStyle"),`setStyle(${r}, ${o}, []);`;case"styleDynamic":return t.add("setDynamicStyle"),`setDynamicStyle(${r}, ${o});`;case"attr":return t.add("setDynamicAttribute"),`setDynamicAttribute(${r}, ${JSON.stringify(eo(e))}, ${o});`;case"property":return t.add("setDynamicProperty"),`setDynamicProperty(${r}, ${JSON.stringify(eo(e))}, ${o});`;case"boolAttr":return t.add("setDynamicBoolAttribute"),`setDynamicBoolAttribute(${r}, ${JSON.stringify(eo(e))}, ${o});`;case"event":return t.add("addDelegatedEventListener"),`addDelegatedEventListener(${r}, ${JSON.stringify(n.event.name)}, ${o});`;case"nativeEvent":return t.add("addNativeEventListener"),`addNativeEventListener(${r}, ${JSON.stringify(n.name.slice(3))}, ${o});`;case"ref":return t.add("handleRef"),`handleRef(${o}, ${r});`;case"use":return t.add("applyUse"),`applyUse(${r}, ${o});`}}function wf(e,t){let r=Ji(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 Hc=!1;function Ct(e,t,r){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":{if(!e.reactive)return D(e.code,"value");let n=`() => ${D(e.code,"arrowBody")}`;return e.at?Re(n,e.at.line,e.at.column):n}case"fragment":return e.children.length===0?"null":jc(e.children,t,r);case"component":return Mc(Ic(e.name,e.props,e.children,t,r,e.at),e.bindAt??e.at);case"control":{let n=yf[e.control]??e.control;return t.add(n),Mc(Ic(n,e.props,e.children,t,r),e.bindAt)}case"element":{if(r&&e.static&&!e.svg&&Gi(e)&&!Qi(e)){t.add("templateNode");let a=`_tmpl$${r.length}`;r.push({id:a,html:$t(e),tag:e.tag,svg:!1});let c=Xi(e);return c?`templateNode(${a}, ${JSON.stringify(e.tag)}, false, false, ${JSON.stringify(c)})`:`templateNode(${a}, ${JSON.stringify(e.tag)})`}if(r&&Hc){let a=Nc(e);if(a){t.add("templateNode"),t.add("insert"),t.add("holeEnd"),t.add("holeContent"),t.add("holeScope");let c=`_tmpl$${r.length}`;r.push({id:c,html:a.html,tag:a.tag,svg:!1});let u=Xi(e),l=[`const _el$ = templateNode(${c}, ${JSON.stringify(a.tag)}, true${u?`, false, ${JSON.stringify(u)}`:""});`];for(let f of a.steps)l.push(`const ${f.ref} = ${f.expr};`);for(let f of a.bindings)l.push(Sf(f,t));for(let f of a.holes)l.push(`insert(${f.parentRef}, holeScope(${f.startRef}, () => ${D(Ct(f.node,t,r),"arrowBody")}), ${f.endRef}, holeContent(${f.startRef}, ${f.endRef}));`);return l.push("return _el$;"),`(() => { ${l.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(de))for(let a of e.props)o.push(wf(i,a));else{t.add("spread");let a=e.svg?", isSVG: true":"",c=e.props.filter(f=>f.kind!=="spread"&&f.expr!==void 0&&f.reactive&&f.name!=="ref").map(f=>f.name),u=e.tag.includes("-")?`, isCustomElement: true, accessors: ${JSON.stringify(c)}`:"",l=e.children.length>0?", skipChildren: true":"";o.push(`spread({ element: ${i}, props: ${bf(e.props,null,t)}${a}${u}${l} });`)}for(let a of e.children){t.add("insert");let c=Ct(a,t,r),u=a.kind==="expr"&&(a.reactive||!Ef(a.code))||a.kind==="component"||a.kind==="control";o.push(u?`insert(${i}, ${c}, null);`:`insert(${i}, ${c});`)}return o.push(`return ${i};`),`(() => { ${o.join(" ")} })()`}}}var xf=/^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/,Ef=e=>xf.test(e);function Gr(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 Xr={name:"imperative",contract:zi,emit(e,t){let r=new Set,n=t?.templateClone!==!1?[]:void 0;return Hc=t?.partialTemplates===!0,{code:Ct(e,r,n),imports:Array.from(r),templates:n}}};function ro(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 kf=new Set(["a","button","input","select","textarea","summary","details","option","label"]),Af=new Set(["keydown","keyup","keypress"]);function Ue(e,t){return e.attributes.find(r=>"name"in r&&r.name===t)}function $f(e){return e.attributes.some(t=>t.kind==="Spread")}function Yr(e,t){let r=Ue(e,t);if(!r||r.kind!=="Attribute"||!r.value)return;let n=r.value;return n.kind==="static"?n.value:void 0}function Cf(e){let t=Yr(e,"role");return t==="presentation"||t==="none"?!0:Yr(e,"aria-hidden")==="true"}function Wc(e,t){return e.attributes.some(r=>r.kind==="EventBinding"&&t(r.name))}function qc(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"&&Rf(o,r);let s="children"in o?o.children:void 0;s&&n(s)}};return n(e.children),t}function Rf(e,t){if($f(e))return;let r=e.tag.toLowerCase();r==="img"&&!Ue(e,"alt")&&!Cf(e)&&t(e,"a11y-img-alt",'An `img` needs an `alt`. Use `alt=""` when the image is decorative.'),r==="a"&&!Ue(e,"href")&&!Ue(e,"role")&&t(e,"a11y-anchor-href","An `a` without `href` is not a link. Use a `button` for an action."),r==="iframe"&&!Ue(e,"title")&&t(e,"a11y-iframe-title","An `iframe` needs a `title` describing its content.");let n=Yr(e,"tabindex")??Yr(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."),!kf.has(r)&&Wc(e,i=>i==="click")&&!Ue(e,"role")&&!Wc(e,i=>Af.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.`)}function no(e){let t=(r,n)=>{r.parent=n;let i=Bc(r);for(let o of i)t(o,r)};return t(e,null),e}function Bc(e){switch(e.kind){case"Root":case"Element":case"Component":case"Fragment":return e.children;default:return[]}}var Vc=new Set(["capture","once","passive","prevent","stop","self"]);function he(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 Fc=(e,t)=>({kind:"Attribute",name:t?e.name.slice(1):e.name,value:e.value,boolean:t,loc:e.loc}),Zr=[{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)Vc.has(s)||e.report("invalid-directive",`Unknown event modifier ".${s}" — expected one of ${[...Vc].join(", ")}`);return{kind:"EventBinding",name:o,syntax:t,modifiers:i,hole:he(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:he(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:he(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:he(e,"style directive"),loc:e.loc})},{id:"load",match:e=>e.startsWith("load:"),build:e=>(e.value&&e.value.kind!=="static"&&e.report("invalid-binding",`'${e.name}' needs a literal value, not an expression: the strategy is compile-time.`),{kind:"LoadDirective",strategy:e.name.slice(5),modifier:e.value&&e.value.kind==="static"?e.value.value:null,...e.value&&e.value.kind!=="static"?{dynamic:!0}:{},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:he(e,"if directive"),loc:e.loc})},{id:"each",elementOnly:!0,match:e=>e==="each",build:e=>({kind:"EachDirective",hole:he(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:he(e,"ref binding"),loc:e.loc})},{id:"property",match:e=>e[0]===".",build:e=>({kind:"PropertyBinding",name:e.name.slice(1),hole:he(e,"property binding"),loc:e.loc})},{id:"boolean",match:e=>e[0]==="?",build:e=>Fc(e,!0)}];function io(e,t=Zr,r={component:!1}){for(let n of t)if(!(n.elementOnly&&r.component)&&n.match(e.name))return n.build(e);return Fc(e,!1)}var oo=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()}}};var so=new Set(["svg","g","defs","symbol","use","switch","view","desc","metadata","path","circle","ellipse","line","polygon","polyline","rect","image","text","tspan","textPath","linearGradient","radialGradient","stop","pattern","mask","clipPath","marker","foreignObject","animate","animateMotion","animateTransform","mpath","set","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),zc=new Set(["script","style","textarea","title"]),Kc=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Uc(e){return e.length>0&&(e[0]!==e[0].toLowerCase()||e.includes("."))}var Nf=/[A-Za-z0-9\-_:@.?]/,Tf=class{constructor(e,t){this.diagnostics=[],this.r=new oo(e),this.svg=t.svg??!1,this.directives=t.directives??Zr,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 no(r),this.validateTree(r),this.accessibility&&this.diagnostics.push(...qc(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(s=>s.kind==="ElseDirective")&&(n!=null&&(n.kind==="Element"||n.kind==="Component")&&n.attributes.some(a=>a.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=Uc(t),n=this.parseAttributes(r);this.foldEachKey(n,e),this.r.skipWhitespace();let i=t.toLowerCase(),o=!r&&zc.has(i),s=!r&&Kc.has(i),a=!1,c=[];if(this.r.startsWith("/>"))this.r.advance(),this.r.advance(),a=!0;else if(this.r.peek()===">"&&this.r.advance(),!s)if(c=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(r)return{kind:"Component",tag:t,tagHole:null,attributes:n,children:c,selfClosing:a,loc:u};let l=this.svg||so.has(t)?"svg":"html";return{kind:"Element",tag:t,namespace:l,attributes:n,children:c,selfClosing:a,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 a=this.r.takeHole();t.push({kind:"Spread",hole:a.index,loc:a.loc});continue}if(this.r.startsWith("...")){let a=this.r.pos();if(this.r.advance(),this.r.advance(),this.r.advance(),this.r.atHole()){let c=this.r.takeHole();t.push({kind:"Spread",hole:c.index,loc:this.r.span(a)})}else this.report("invalid-binding","error","Spread `...` must be followed by ${…}",this.r.span(a));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:(a,c)=>this.report(a,"error",c,this.r.span(r))};t.push(io(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(r=>!/[\s>]/.test(r))}}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 l of e)l.kind==="EachDirective"?(r=l,i++):l.kind==="IfDirective"?n++:l.kind==="ElseDirective"?o++:l.kind==="RefBinding"&&s++;let a=this.r.span(t);i>1&&this.report("duplicate-directive","error","Multiple `each` directives on one element",a),n>1&&this.report("duplicate-directive","error","Multiple `if` directives on one element",a),s>1&&this.report("duplicate-directive","error","Multiple `ref` bindings on one element",a),n>0&&i>0&&this.report("unsupported-combination","error","`if` and `each` cannot both apply to one element — wrap one in another element",a),n>0&&o>0&&this.report("invalid-directive","error","`if` and `else` cannot be on the same element",a);let c=e.findIndex(l=>l.kind==="Attribute"&&l.name==="key");if(!r){c!==-1&&this.report("invalid-directive","error","`key` requires an `each` directive on the same element",a);return}if(c===-1)return;let u=e[c];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(c,1)}readName(){return this.r.readWhile(e=>Nf.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 Qr(e,t={}){return new Tf(e,t).parse()}function Of(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 Jc(e,t={}){return Qr(Of(e),t)}var Gc=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);function _f(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}var Df="container";function Xc(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Mf=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}=Xr.emit(e,{});for(let i of r)this.used.add(i);return Gr(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 a=e[s],c=a&&(a.kind==="Element"||a.kind==="Component")&&a.attributes.some(u=>u.kind==="ElseDirective");t.push(this.lowerIf(n,o.hole,c?a:null)),c&&(r=s);continue}}let i=this.lowerNode(n);i&&t.push(i)}return t}isBlankText(e){return e.kind==="Text"&&!e.raw&&ro(e.value)===""}lowerNode(e){switch(e.kind){case"Text":{if(e.raw)return{kind:"text",value:e.value};let t=Kr(ro(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(o=>o.kind==="Attribute"&&o.name==="is");if(e.tag==="component"&&t&&t.value&&t.value.kind==="hole"){let o=e.attributes.filter(a=>a!==t),s=this.lowerComponent({...e,kind:"Component",tag:"Dynamic",tagHole:null,attributes:o});return s.props.unshift({name:"component",kind:"attr",expr:`() => ${D(this.hole(t.value.hole).code,"arrowBody")}`}),s}let r=this.lowerEach(e),n=r?[r]:this.lowerChildren(e.children);if(e.tag===Df)return n.length===1?n[0]:{kind:"fragment",children:n};let i=this.tagAt(e);return{kind:"element",tag:e.tag,svg:e.namespace==="svg",props:this.lowerAttributes(e.attributes,!0),children:n,static:!1,...i?{at:i}:{}}}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,l]of n){let f=l.length===1?l[0]:{kind:"fragment",children:l},p={name:u,kind:"attr",expr:this.emit(f),jsxElement:!0},y=r.findIndex(S=>S.name===u);y>=0?r[y]=p:r.push(p)}let o=e.attributes.find(u=>u.kind==="LoadDirective");if(o?.dynamic)throw new Ke(`'load:${o.strategy}' needs a literal value, not an expression: the strategy is compile-time.`);let s=o?yc(`load:${o.strategy}`,o.modifier):void 0,a=r.find(u=>u.at&&u.reactive)?.at,c=this.tagAt(e);return{kind:"component",name:t,props:r,children:this.lowerChildren(i),...c?{at:c}:{},...a?{bindAt:a}:{},...s?{load:s}:{},...e.tagHole!=null?{tagExpression:!0}:{}}}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(c=>c!==i)},s=o.kind==="Element"?this.lowerElement(o):this.lowerComponent(o),a=t.get(i.value.value)??[];a.push(s),t.set(i.value.value,a);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 a=this.stripAndLower(r,c=>c.kind==="ElseDirective");i.push({name:"fallback",kind:"attr",expr:this.emit(a),jsxElement:!0})}let o=this.stripAndLower(e,a=>a.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(c=>c.kind==="EachDirective");if(!t||t.kind!=="EachDirective")return null;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 c="static"in t.key?`(item) => item[${JSON.stringify(t.key.static)}]`:this.hole(t.key.hole).code;n.push({name:"by",kind:"attr",expr:c})}let i=this.itemArrow(e),o;if(i){let c=i.bodyReactive?`() => ${D(i.body,"arrowBody")}`:D(i.body,"arrowBody");o=`(${i.params.join(", ")}) => ${c}`}else{let c=this.lowerChildren(e.children),u=c.length===1?c[0]:{kind:"fragment",children:c};o=`() => ${D(this.emit(u),"arrowBody")}`}let s=[{kind:"expr",code:o,reactive:!1}],a=this.tagAt(e);return{kind:"component",name:"For",props:n,children:s,...a?{at:a}:{},...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)}lowerAttributes(e,t=!1){let r=!1,n=(l,f)=>{if(r||=f.reactive,!t||!f.reactive)return`${JSON.stringify(l)}: ${f.code}`;let p=`() => ${D(f.code,"arrowBody")}`;return`${JSON.stringify(l)}: ${f.at?Re(p,f.at.line,f.at.column):p}`},i=[],o=[],s,a=[],c,u=[];for(let l of e)switch(l.kind){case"IfDirective":case"EachDirective":case"ElseDirective":break;case"Attribute":i.push(this.plainAttr(l));break;case"PropertyBinding":i.push({name:l.name,kind:"prop",expr:this.hole(l.hole).code,reactive:this.hole(l.hole).reactive,...this.hole(l.hole).at?{at:this.hole(l.hole).at}:{}});break;case"EventBinding":i.push(this.eventProp(l));break;case"RefBinding":i.push({name:"ref",kind:"ref",expr:this.hole(l.hole).code,reactive:this.hole(l.hole).reactive,...this.hole(l.hole).at?{at:this.hole(l.hole).at}:{}});break;case"Spread":i.push({name:"",kind:"spread",expr:this.hole(l.hole).code});break;case"ClassDirective":{let f=this.hole(l.hole);o.push(n(l.name,f)),s??=f.at;break}case"StyleDirective":{let f=this.hole(l.hole);a.push(n(l.name,f)),c??=f.at;break}case"BindDirective":i.push(...this.bindProps(l.name,this.hole(l.hole)));break;case"UseDirective":{let f=l.name??(l.hole!=null?this.hole(l.hole).code:null);if(!f)break;u.push(l.name!=null&&l.hole!=null?`[${f}, () => ${D(this.hole(l.hole).code,"arrowBody")}]`:`[${f}]`);break}}if(o.length>0&&i.push({name:"classList",kind:"attr",expr:`{ ${o.join(", ")} }`,reactive:!t&&r,...s?{at:s}:{}}),a.length>0){let l=`{ ${a.join(", ")} }`,f=i.findIndex(p=>p.name==="style");if(f===-1)i.push({name:"style",kind:"attr",expr:l,reactive:!t&&r,...c?{at:c}:{}});else{let p=i[f],y=p.expr===void 0?JSON.stringify(p.literal):p.reactive?`() => ${D(p.expr,"arrowBody")}`:p.expr;i[f]={name:"style",kind:"attr",expr:`[${y}, ${l}]`,reactive:!1,...p.at?{at:p.at}:{}}}}return u.length>0&&i.push({name:"use",kind:"attr",expr:`[${u.join(", ")}]`}),i}eventProp(e){let t=e.name.toLowerCase(),r=this.hole(e.hole).code;if(!(e.syntax==="colon"||e.modifiers.length>0))return{name:"on"+Xc(e.name),kind:"event",event:{name:t,delegated:Gc.has(t)},expr:r};let i=this.wrapHandler(r,e.modifiers),o=this.eventOptions(e.modifiers),s=o?`[${i}, ${o}]`:i;return{name:"on:"+t,kind:"attr",expr:s}}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"+Xc(i),kind:"event",event:{name:i,delegated:Gc.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 i={name:r,kind:"attr"};if(t==null)return i.literal=!0,i;if(t.kind==="static")return i.literal=Kr(t.value),i;if(t.kind==="hole"){let c=this.hole(t.hole);return i.expr=c.code,i.reactive=c.reactive,c.at&&(i.at=c.at),i}let o=!1,s,a=t.parts.map(c=>{if("text"in c)return _f(Kr(c.text));let u=this.hole(c.hole);return o=o||u.reactive,s??=u.at,"${"+u.code+"}"}).join("");return i.expr="`"+a+"`",i.reactive=o,s&&(i.at=s),i}};function Yc(e,t,r,n={}){let{root:i}=Qr(e,{svg:n.svg});return new Mf(t,r,n.sourceFile,n.positionAt).lowerRoot(i.children)}function If(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 Zc(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 a of i.children)n(a)||(o=!1);let s;for(let a of i.props)if(s=If(a),s)break;return!s&&!o&&(s=Pf(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 Pf(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 Lf=e=>"components"in e;function Qc(e,t){return e.replace(/\$(\d+)/g,(r,n)=>t[Number(n)]??r)}function jf(e,t){return typeof t=="string"?{module:t,export:e}:t}function el(e=[]){let t=new Map,r=[],n=[];for(let s of e){if(!Lf(s)){n.push(s);continue}for(let[a,c]of Object.entries(s.components)){let u=jf(a,c),l=t.get(a);if(l&&l.module!==u.module){let f=r.find(p=>p.name===a);f?f.modules.push(u.module):r.push({name:a,modules:[l.module,u.module]});continue}t.set(a,u)}}let i=new Map;return{resolve:s=>{if(i.has(s))return i.get(s);let a=t.get(s);if(!a)for(let c of n){let u=s.match(new RegExp(c.match.source,c.match.flags.replace("g","")));if(u){a={module:Qc(c.module,u),export:c.export?Qc(c.export,u):s};break}}return i.set(s,a),a},names:()=>[...t.keys()],conflicts:()=>r}}var tl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Hf=new Uint8Array(64),Wf=new Uint8Array(128);for(let e=0;e<tl.length;e++){let t=tl.charCodeAt(e);Hf[e]=t,Wf[t]=e}var ug=1024*16;var rl="data-fx-s";function nl(e,t){let r=n=>{let i=n.children;if(i)for(let o=i.length-1;o>=0;o--){let s=i[o];s.kind==="element"&&s.tag==="style"&&t.owner?i.splice(o,1):r(s)}t.scope&&n.kind==="element"&&n.tag!=="style"&&n.props&&!n.props.some(o=>o.name===rl)&&n.props.unshift({name:rl,kind:"attr",literal:t.scope})};r(e)}function qf(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 ao(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 il(qf(e),e.holes,t)}function il(e,t,r={}){let n=new Set,i=Yc(e,[...t],n,{svg:r.svg,...r.sourceFile?{sourceFile:r.sourceFile}:{},...r.positionAt?{positionAt:r.positionAt}:{}});r.templateStyles&&nl(i,r.templateStyles),Zc(i),bc(i,{resolver:el(r.resolve??[]),modules:{controlFlowModule:r.controlFlowModule??"@fluixi/dom",coreModule:r.coreModule??"@fluixi/core",routerModule:r.routerModule??"@fluixi/core/router"},strategyFor:c=>c.load}),Sc(i);let{code:o,imports:s,templates:a}=Xr.emit(i,{templateClone:r.templateClone,partialTemplates:r.partialTemplates});for(let c of s)n.add(c);return r.hoistTemplates?{code:o,imports:[...n],ir:i,templates:a}:{code:Gr(o,a),imports:[...n],ir:i}}function Bf(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 co(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)Bf(o,t);if(i)for(let o of n.children)o.kind==="Expression"&&t.set(o.hole,"render");co(n.children,t,r);break}case"Root":case"Fragment":co(n.children,t,r);break;default:break}}function ol(e){let t=new Map,r=new Set;return co(e.root.children,t,r),{holes:t,components:r}}var lo={...Wi,createMemo:b},Vf=["For","Index","Show","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense"],uo=new Map;function al(e){for(let[t,r]of Object.entries(e))uo.set(t,r)}function Ff(e){return e==="text"||e==="attr"||e==="control"}function zf(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"&&Ff(i)?{code:`$$v[${n}]()`,reactive:!0}:{code:`$$v[${n}]`,reactive:!1}})}function Kf(e){if(uo.has(e))return uo.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 Uf(e,t,r){let n=e,i=Jc(n,{svg:r}),o=i.diagnostics.filter(d=>d.severity==="error");if(o.length>0)throw new Error(`[fluixi] ${r?"svg":"html"}\`\`: ${o.map(d=>d.message).join("; ")}`);let{holes:s,components:a}=ol(i),{code:c,imports:u}=ao({statics:n,holes:zf(t,s)},{svg:r}),l=u.filter(d=>!(d in lo));if(l.length>0)throw new Error(`[fluixi] no runtime binding for: ${l.join(", ")}`);let f=Array.from(new Set([...u,...Vf])).filter(d=>d in lo),p=Array.from(a).filter(d=>!f.includes(d)),y=[...f,...p],S=new Function(...y,"$$v",`return (${c});`);return{run:d=>S(...f.map(v=>lo[v]),...p.map(Kf),d)}}var sl=new WeakMap;function Jf(e){let t="";for(let r of e)t+=typeof r=="function"?"f":"v";return t}function cl(e){return(t,...r)=>{let n=sl.get(t);n||(n=new Map,sl.set(t,n));let i=Jf(r),o=n.get(i);return o||(o=Uf(t,r,e),n.set(i,o)),o.run(r)}}var ll=cl(!1),ul=cl(!0);return yl(Gf);})();