@fluixi/template-runtime 1.0.0-alpha.112 → 1.0.0-alpha.113

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.112 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
- "use strict";var Fluixi=(()=>{var ln=Object.defineProperty;var Sl=Object.getOwnPropertyDescriptor;var wl=Object.getOwnPropertyNames;var xl=Object.prototype.hasOwnProperty;var xo=(e,t)=>{for(var r in t)ln(e,r,{get:t[r],enumerable:!0})},El=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of wl(t))!xl.call(e,i)&&i!==r&&ln(e,i,{get:()=>t[i],enumerable:!(n=Sl(t,i))||n.enumerable});return e};var kl=e=>El(ln({},"__esModule",{value:!0}),e);var sp={};xo(sp,{Dynamic:()=>Hr,ErrorBoundary:()=>Wr,For:()=>qr,Index:()=>Br,Match:()=>Yt,Portal:()=>Vr,Show:()=>Xt,Switch:()=>Zt,batch:()=>I,define:()=>ml,effect:()=>Pn,html:()=>gl,hydrate:()=>Ce,insert:()=>_,memo:()=>In,onCleanup:()=>A,render:()=>$e,resource:()=>_n,signal:()=>Mn,store:()=>hi,svg:()=>vl,untrack:()=>x});var Gi={};xo(Gi,{ALWAYS_ATTRIBUTE:()=>Si,ClientOnly:()=>ei,Dynamic:()=>Hr,ErrorBoundary:()=>Wr,ErrorResetContext:()=>Wi,FX_DATA_ID:()=>Tt,For:()=>qr,HYDRATION_KEY:()=>Y,Index:()=>Br,Island:()=>Sc,JSX_PROPERTIES:()=>vt,Match:()=>Yt,NoSsr:()=>Ds,Portal:()=>Vr,SERVER_PROPS:()=>vi,SVG_ELEMENTS:()=>la,SVG_NAMESPACE:()=>yt,Show:()=>Xt,Switch:()=>Zt,VERSION:()=>ar,VERSION_ATTRIBUTE:()=>Fn,VOID_ELEMENTS:()=>ca,addClass:()=>wi,addDelegatedEventListener:()=>Nr,addNativeEventListener:()=>Dr,afterHydrationPass:()=>Os,appendChildren:()=>Ri,appendResponseHeader:()=>ls,applyElementProp:()=>gt,applyProps:()=>kt,applyUse:()=>Mr,asComponent:()=>dt,asContext:()=>Hs,asOutlet:()=>Ls,asProvider:()=>js,asRoute:()=>Ps,asRouter:()=>Ms,asRoutes:()=>Is,asSuspense:()=>Ws,beforeFirstRender:()=>os,beginAppHydration:()=>ws,bindPair:()=>Hi,captureHydrationCursor:()=>bs,checkRenderType:()=>qs,classMap:()=>Qo,cleanChildren:()=>Z,clearHydrationKeys:()=>hr,cloneTemplate:()=>_r,closest:()=>fa,createComponent:()=>xe,createDynamicElement:()=>jr,createElement:()=>$i,createNativeElement:()=>ke,createPortal:()=>ji,createRequestContext:()=>nt,createTemplate:()=>Or,createUniqueId:()=>As,css:()=>kc,default:()=>tf,deferElement:()=>Bs,delegate:()=>ga,delegateEvents:()=>St,endAppHydration:()=>xs,endRequestContext:()=>ot,endRequestScope:()=>Wn,errorResponseStatus:()=>ir,escapeFxJson:()=>Kr,escapeHTML:()=>Va,fnName:()=>Ia,generateID:()=>Oa,getAttribute:()=>ki,getGlobal:()=>Aa,getLocals:()=>cs,getOffset:()=>ya,getRequestContext:()=>B,getRequestEvent:()=>rr,getRequestLocals:()=>Bn,getServerData:()=>Ur,getStableElementId:()=>Na,getStyle:()=>da,handleRef:()=>Ae,hasClass:()=>pa,holeContent:()=>Et,holeEnd:()=>xt,holeScope:()=>wt,html:()=>xc,hydrate:()=>Ce,hydrateAdvancePast:()=>je,hydrateChildren:()=>vc,hydrateIslands:()=>wc,indexArray:()=>Me,initializeIntegration:()=>na,insert:()=>_,insertExpression:()=>ze,intergartionInitialized:()=>ia,isAccessor:()=>Fa,isAppHydrationPending:()=>Es,isAttributeOnlyName:()=>Be,isComponent:()=>J,isContext:()=>si,isCustomElement:()=>gi,isDOMNode:()=>Ea,isDelegatedEvent:()=>Da,isDomElement:()=>or,isDomNode:()=>Se,isDomText:()=>sr,isEventHandler:()=>sa,isFunction:()=>Ma,isHydrating:()=>_s,isIntegrationInitialized:()=>mi,isJSXTemplate:()=>xa,isNativeElement:()=>Ba,isOutlet:()=>ii,isPromise:()=>Fe,isProvider:()=>oi,isReactElement:()=>wa,isRoute:()=>ni,isRouter:()=>ti,isRoutes:()=>ri,isSVGElement:()=>Lr,isServer:()=>w,isSuspense:()=>ai,isVisible:()=>ha,iterateFn:()=>Pa,keepServerContent:()=>ja,keyArray:()=>De,makeArrayFlat:()=>Ii,mapArray:()=>_e,mergeProps:()=>Li,observeIntersection:()=>ba,observeResize:()=>Sa,onRequestEnd:()=>is,prepareRender:()=>ss,query:()=>Er,queryAll:()=>ua,registerCoreVersion:()=>ms,registerCreateComponent:()=>ra,registerGlobal:()=>ka,removeAttribute:()=>Ai,removeChildren:()=>Ci,removeClass:()=>xi,removeDelegatedEventListener:()=>bt,removeUnclaimedKeyed:()=>mr,render:()=>$e,renderStarted:()=>as,renderToString:()=>lc,renderToStringAsync:()=>fc,requestScope:()=>it,resetIntegration:()=>yi,resetOnNavigation:()=>qi,runHydrationAt:()=>Le,runWithRequestContext:()=>st,runWithoutHydration:()=>Ss,scrollIntoView:()=>ma,serializeNode:()=>Q,serializeResourceData:()=>Ui,serverCustomElementProp:()=>qe,setAttribute:()=>H,setClassList:()=>he,setClassName:()=>Ee,setDataRedactor:()=>uc,setDynamicAttribute:()=>Ke,setDynamicBoolAttribute:()=>Ir,setDynamicClassList:()=>qa,setDynamicProperty:()=>Ue,setDynamicStyle:()=>Wa,setKeyScope:()=>Ts,setProperty:()=>de,setRequestStore:()=>Hn,setRequestStoreIfUnset:()=>ns,setResponseRedirect:()=>fs,setResponseStatus:()=>nr,setServerMode:()=>be,setStyle:()=>oe,setStyles:()=>kr,shouldSetAsProperty:()=>aa,splitProps:()=>Pr,spread:()=>Pi,stampVersions:()=>cr,styleMap:()=>Zo,svg:()=>Ec,takeResponseHeaders:()=>us,takeResponseRedirect:()=>ds,takeResponseStatus:()=>ps,takesBooleanText:()=>bi,templateNode:()=>Mi,toAttributeName:()=>oa,toggleClass:()=>Ei,versionMark:()=>zn,versions:()=>V,waitForElement:()=>va,warnOnVersionSkew:()=>lr,whenAppHydrated:()=>ks});var Lt=Symbol.for("fluixi-proxy");var ce="1.0.0-alpha.112";var ko=ce.split(".")[0],Eo=`__fluixi_signal_state_v${ko}__`,Ao=`__fluixi_signal_builds_v${ko}__`,Al=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function $o(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:Al,onSuspend:null,onError:null,observer:null,hot:null}}var jt=globalThis;function $l(e){let t=$o(),r=e;for(let n of Object.keys(t))n in e||(r[n]=t[n]);return e}function Cl(){let e=jt[Eo];return e?$l(e):jt[Eo]=$o()}var m=Cl();(jt[Ao]??=[]).push(ce);function un(){return[...new Set(jt[Ao]??[])]}function fn(e){return m.observer=e,()=>{m.observer===e&&(m.observer=null)}}var L=[],Ht;function To(e,t){if(!m.observer)return t();let r=Ht;Ht=e;try{return t()}finally{Ht=r}}var Co;function ve(e){let t=m.observer;t&&t.created(e.parents===void 0?{...e,parents:L,origin:e.origin??Ht,scope:e.scope??Co}:{...e,scope:e.scope??Co})}function No(e){return m.observer?(L.push(e),!0):!1}function Oo(){L.pop()}function _o(e){m.observer?.ran?.(e)}function Do(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 Wt(e){let t=m.observer;!t?.props||!L.length||!e||t.props(L[L.length-1],e)}function W(e,t,r,n){let i=m.observer;!i?.directive||!L.length||i.directive(L[L.length-1],e,t,r,n)}function qt(e){m.observer?.contextCreated?.(e)}function Te(e,t,r){let n=m.observer;!n?.context||!L.length||n.context(L[L.length-1],e,t,r)}function pn(e,t,r){m.observer?.moved?.(e,t,r)}function le(e){m.observer?.disposed?.(e)}var Rl="__FLUIXI_DEVTOOLS_HOOK__",Ro=globalThis[Rl];if(typeof Ro?.inject=="function")try{Ro.inject({observeReactiveNodes:fn,version:ce})}catch{}function K(){return m.observer!=null}var Mo=0,Io=1,Ye=2,Po=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))}},Lo=class extends Po{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++,Do(this,m.consumer),this.observers)for(let t of[...this.observers])t.markDirty(Ye);dn(this)}}peek(){return this._value}},Bt=class extends Po{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this._disposed=!1,this.state=Ye,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===Io&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Ye)break}(this.state===Ye||!this._initialized)&&this.recompute(),this.state=Mo}}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=No(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&&Oo()}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,_o(this),s){if(this.version++,this.observers)for(let a of this.observers)a.markDirty(Ye);dn(this)}}markDirty(e){if(this.state>=e)return;let t=this.state===Mo;if(this.state=e,t){if(this.observers)for(let r of this.observers)r.markDirty(Io);dn(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function dn(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}function Vt(e){if(m.untracked)return e();m.untracked=!0;try{return e()}finally{m.untracked=!1}}function U(e){let t=Qe(e);return e&&(e.owned??=[]).push(t),t}function X(e,t=!0){Ze(e,t)}function Qe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Ft(e,t){let r=Symbol(t??"context");return qt(r),{id:r,defaultValue:e,Provider:i=>{Te(r,"provide",i.value);let o=m.owner,s=Qe(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 zt(e){let t=m.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id)){let r=t.contexts.get(e.id);return Te(e.id,"read",r),r}t=t.parent}return Te(e.id,"read",e.defaultValue),e.defaultValue}function jo(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 Kt(e,t,r){let n=Qe(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 Ho(e){return m.onSuspend?(m.onSuspend(e,m.owner),!0):!1}function Wo(e){m.onError=e}function E(){return m.owner}function $(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 Ze(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)Ze(e.owned[r]);e.owned=null}if(e.cleanups){for(let r=e.cleanups.length-1;r>=0;r--)e.cleanups[r]();e.cleanups=null}t&&(e.disposed=!0)}}function q(e){let t=Qe(m.owner);m.owner&&(m.owner.owned??=[]).push(t);let r=m.owner;m.owner=t;try{return Vt(()=>e(()=>Ze(t)))}finally{m.owner=r}}function qo(e){m.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function Tl(e){e.queued||(e.queued=!0,m.queue.push(e),!m.scheduled&&m.batchDepth===0&&(m.scheduled=!0,m.hostSchedule(et)))}function et(){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 Bo(){m.batchDepth===0&&et()}function Vo(e){m.batchDepth++;try{return e()}finally{--m.batchDepth===0&&et()}}var Nl=class extends Bt{constructor(e,t=!1,r){let n=null;super(()=>{Ze(n,!1),$(n,()=>{let s=e();typeof s=="function"&&(n.cleanups??=[]).push(s)})}),this.queued=!1,this.disposed=!1;let i=m.owner;this.owner=Qe(i),n=this.owner,K()&&ve({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&&Tl(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,le(this),super.dispose(),Ze(this.owner))}};function hn(e,t=!1,r){let n=new Nl(e,t,r);return()=>n.dispose()}function Ol(e){return!!e&&typeof e.then=="function"}qo(()=>{});var Fo=Symbol.for("signal"),_l=Symbol.for("memo"),Dl=Symbol.for("signal-node");function T(e,t){let r=m.hot,n=e;r&&(e=r.take("signal",e));let i=new Lo(e,{equals:t?.equals}),o=(()=>i.get()),s=(a=>{let c=typeof a=="function"?a(i.peek()):a;return i.set(c),Bo(),c});return o[Fo]=!0,o[Dl]=i,K()&&ve({kind:"signal",node:i,handle:o,name:t?.name,set:s}),K()&&A(()=>le(i)),r&&r.keep(()=>i.peek(),()=>s(()=>n)),[o,s]}function S(e,t,r){let n=t,i=E(),o=new Bt(()=>$(i,()=>{try{return n=e(n)}catch(a){if(Ol(a))return Ho(a),n;throw a}}),{equals:r?.equals}),s=(()=>o.get());return Object.defineProperty(s,Fo,{value:!0,enumerable:!0}),Object.defineProperty(s,_l,{value:!0,enumerable:!0}),K()&&ve({kind:"memo",node:o,handle:s,name:r?.name}),A(()=>{o.dispose(),K()&&le(o)}),s}function D(e,t,r){let n=t;return hn(()=>{n=e(n)},!0,r?.name)}function k(e,t){let r=t;return hn(()=>{r=e(r)})}function I(e){return Vo(e)}function x(e){return Vt(e)}var Ne=globalThis[Symbol.for("fluixi.transition")]??={depth:0,loads:new Set,pending:void 0};function Ml(){return Ne.pending??=T(0)}function zo(){return Ne.depth>0}function Ko(e){let[,t]=Ml();Ne.loads.add(e),t(Ne.loads.size);let r=()=>{Ne.loads.delete(e),t(Ne.loads.size)};e.then(r,r)}function Ut(){return et(),Promise.resolve()}var Uo=Ft();Wo((e,t)=>{let r=jo(t,Uo);return r?(r.caught=()=>e,m.consumer?queueMicrotask(()=>r.setError(e)):r.setError(e),!0):!1});function mn(){let[e,t]=T(void 0,{equals:!1}),r={error:e,caught:()=>{},reset:()=>{r.caught=()=>{},t(()=>{})},setError:n=>{r.caught=()=>n,t(()=>n)}};return r}function yn(e,t){return Kt(Uo,e,t)}var Il=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,Jt=typeof process>"u"?Il:!1,Pl=Symbol.for("signal");function R(e){return typeof e=="function"&&e[Pl]===!0}function Ll(e,t){return()=>{let r=U(t);return A(()=>{X(r);let n=t.owned,i=n?n.indexOf(r):-1;i>=0&&n.splice(i,1)}),$(r,e)}}function Jo(e,t){return typeof e=="function"?R(e)||e.length?e:Ll(e,t):Array.isArray(e)?e.map(r=>Jo(r,t)):e}function gn(e,t){let r=Ft(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 vn=null;function xn(e){vn=e}function En(e){vn&&vn(e)}var bn=null;function kn(e){bn=e}function An(e){return bn?bn(e):void 0}var Sn=null;function tt(e){Sn=e}function $n(){return Sn?Sn():void 0}var wn=null;function Cn(e){wn=e}function Rn(e,t){wn&&wn(e,t)}function Tn(){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 jl=null;function Nn(e){jl=e}function Hl(e){return!!e&&typeof e.then=="function"}var On=Symbol();function Go(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:$n(),s=o!==void 0?An(o):void 0,a=s!==void 0,c=m.hot;m.hot=null;let[u,l]=T(s!==void 0?s.value:r.initialValue,{equals:!1}),[f,p]=T(void 0,{equals:!1}),y=!1,[v,d]=T(s!==void 0||r.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[b,C]=T(void 0,{equals:!1}),[N,g]=T(void 0,{equals:!1});m.hot=c;let ee=On,te=!1;D(()=>{let O=n();if(N(),O===!1||O===null||O===void 0){ee=On,I(()=>{d("unresolved"),C(void 0),p(void 0)});return}let Mt=te;if(te=!1,ee!==On&&O===ee&&!Mt)return;if(ee=O,a){a=!1;return}let It=!1;A(()=>It=!0);let wo=x(v),bl=x(u),cn=wo==="ready"||wo==="refreshing";y=cn&&zo(),I(()=>{d(cn?"refreshing":"pending"),p(void 0)});try{let ae=i(O,{value:bl,refetching:cn});Hl(ae)?(C(ae),y&&Ko(ae),En(ae),ae.then(Pt=>{It||(o!==void 0&&Rn(o,Pt),I(()=>{l(()=>Pt),d("ready"),C(void 0)}))},Pt=>{It||I(()=>{p(Pt),d("errored"),C(void 0)})})):I(()=>{l(()=>ae),d("ready"),C(void 0)})}catch(ae){if(It)return;I(()=>{p(ae),d("errored"),C(void 0)})}});let ge=()=>{let O=v();return O==="pending"||O==="refreshing"},Xe=(()=>{let O=f();if(O)throw O;if(ge()&&!(y&&v()==="refreshing")){let Mt=b();if(Mt)throw Mt}return u()});return Object.defineProperties(Xe,{state:{get:v},loading:{get:ge},error:{get:f},latest:{get:u}}),Object.defineProperty(Xe,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(Xe,Symbol.for("signal"),{value:!0,enumerable:!0}),[Xe,{mutate:l,refetch:()=>{te=!0,g(void 0)}}]}function _n(...e){let[t,r]=Go(...e);return Object.assign(t,r)}function Dn(e){let t=m.hot;if(!t)return e();m.hot=null;try{return e()}finally{m.hot=t}}function Mn(e,t){let[r,n]=T(e,t);return r.set=n,r}function In(e,t,r){return S(e,t,r)}function Pn(e,t,r){return D(e,t,r)}function Gt(e){if(typeof e=="function"&&!e.length){let t=e();return R(t)?t:Gt(t)}if(Array.isArray(e)){let t=[];for(let r=0;r<e.length;r++){let n=Gt(e[r]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function Oe(e){let t=S(e);return Jt?S(()=>Gt(t()),void 0,{name:"children"}):S(()=>Gt(t()))}function Yo(e){let t=e,r=null;return{index:()=>(r||(r=T(t,{name:"row index"})),r[0]()),set:n=>{t=n,r&&r[1](n)}}}function _e(e,t,r){let n=[];return A(()=>{for(let i of n)i.dispose();n=[]}),S(()=>{let i=e()||[];return x(()=>{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;q(d=>{y=d;let b=Yo(c);p=b.set,f=t(u,b.index)});let v={item:u,rendered:f,dispose:y,setIndex:p};s.push(v),a.add(v)}}for(let c of n)a.has(c)||c.dispose();return n=s,s.map(c=>c.rendered)})},void 0,{name:"mapArray"})}function De(e,t,r,n){let i=[],o=[];return A(()=>{for(let s of o)s.dispose();i=[],o=[]}),S(()=>{let s=e()||[];return x(()=>{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 v,d,b,C;q(N=>{C=N;let g=Yo(f);d=g.set;let[ee,te]=T(s[f]);b=ge=>te(()=>ge),v=r(ee,g.index)}),c.push({rendered:v,dispose:C,setIndex:d,setItem:b})}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 Me(e,t,r){let n=[];return A(()=>{for(let i of n)i.dispose();n=[]}),S(()=>{let i=e()||[];return x(()=>{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];q(y=>{f=y;let[v,d]=T(p);l=d,u=t(v,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 ue(e){return()=>{let t=e();return typeof t=="function"?t():t}}function Xt(e){let t=ue(()=>e.when),r=S(t,void 0,{name:"Show.when"}),n=S(()=>!!r(),void 0,{name:"Show.cond"}),i=E(),o=null,s=null,a=c=>{c!==s&&(o&&X(o),o=U(i),s=c)};return S(()=>{let c=n();return a(c?"when":"fallback"),$(o,()=>{if(!c)return e.fallback;let u=e.children;if(typeof u=="function"){let l=u;if(l.length===0)return x(()=>l(x(r)));let f=r();return x(()=>l(f))}return u})},void 0,{name:"Show.result"})}function nu(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Zo(e){return S(()=>{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(`${nu(n)}: ${o}`)}return r.join("; ")},void 0,{name:"StyleMap"})}var Ln=Symbol("match");function Yt(e){return{[Ln]:!0,when:ue(()=>e.when),get children(){return e.children}}}function Zt(e){let t=Array.isArray(e.children)?e.children:[e.children],r=E(),n=null,i=-1,o=s=>{s!==i&&(n&&X(n),n=U(r),i=s)};return S(()=>{for(let s=0;s<t.length;s+=1){let c=t[s],u=0;for(;typeof c=="function"&&!c[Ln]&&u++<10;)c=c();if(!c||typeof c!="object"||c[Ln]!==!0)continue;let l=c.when();if(l)return o(s),$(n,()=>{let f=c.children;return typeof f=="function"?f(l):f})}return o(-2),$(n,()=>e.fallback??null)},void 0,{name:"Switch"})}function Qo(e){return S(()=>{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"})}var Qt,rs={getStore:()=>Qt,run(e,t){let r=Qt;Qt=e;try{return t()}finally{Qt=r}}},rt=globalThis[Symbol.for("fluixi.requestStore")]??={store:rs,async:!1};function Hn(e){rt.store=e??rs,rt.async=e!==null}function ns(e){rt.async||Hn(e)}function nt(e={}){if(e.request===void 0){let s=qn();s&&(e.request=s)}e.locals||(e.locals=e.request?Bn(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 er=globalThis[Symbol.for("fluixi.requestEndHooks")]??=new WeakMap;function is(e){let t=it();if(!t)return!1;let r=er.get(t);return r||er.set(t,r=[]),r.push(e),!0}function it(){return qn()??B()}var re=globalThis[Symbol.for("fluixi.beforeRender")]??={tasks:[],prepared:new WeakMap,page:void 0};function os(e){return re.tasks.push(e),()=>{let t=re.tasks.indexOf(e);t>=0&&re.tasks.splice(t,1)}}function ss(){let e=it();if(!e)return re.page??=es();let t=re.prepared.get(e);return t||re.prepared.set(e,t=es()),t}function as(){let e=it();return e?re.prepared.has(e):re.page!==void 0}async function es(){for(let e of[...re.tasks])await e()}function ot(e){Wn(e)}function Wn(e){let t=er.get(e);if(t){er.delete(e);for(let r of t.reverse())try{r()}catch(n){console.error("[fluixi] a request-end hook threw:",n)}}}function st(e,t){return rt.store.run(e,t)}function B(){return rt.store.getStore()}function rr(){return B()?.event}function cs(){let e=rr();return e?(e.locals||(e.locals={}),e.locals):{}}var ts=globalThis[Symbol.for("fluixi.requestLocals")]??=new WeakMap;function qn(){return globalThis[Symbol.for("fluixi.platformRequest")]?.getStore()}function Bn(e){let t=ts.get(e);return t||(t={},ts.set(e,t)),t}var Ie=globalThis[Symbol.for("fluixi.responseHeaders")]??=new WeakMap;function Vn(){let e=rr()?.request;return e&&typeof e=="object"?e:qn()}function ls(e,t,r=Vn()){if(!r)return!1;let n=Ie.get(r);return n||(n={headers:new Headers,sent:!1},Ie.set(r,n)),n.sent?!1:(n.headers.append(e,t),!0)}function us(e){let t=Ie.get(e);if(!t){t={headers:new Headers,sent:!0},Ie.set(e,t);return}return t.sent=!0,t.headers}var tr=globalThis[Symbol.for("fluixi.responseRedirects")]??=new WeakMap;function fs(e,t,r=Vn()){return!r||Ie.get(r)?.sent?!1:(tr.has(r)||tr.set(r,{location:e,status:t}),!0)}var jn=globalThis[Symbol.for("fluixi.responseStatuses")]??=new WeakMap;function nr(e,t=Vn()){return!t||Ie.get(t)?.sent?!1:(jn.set(t,e),!0)}function ir(e){let t=e?.status;return typeof t=="number"&&Number.isInteger(t)&&t>=400&&t<=599?t:500}function ps(e){let t=jn.get(e);return jn.delete(e),t}function ds(e){let t=tr.get(e);return tr.delete(e),t}var ct=Symbol.for("fluixi.server-node"),iu=Symbol.for("fluixi.dom.server-host"),ou=globalThis,at=ou[iu]??={server:typeof document>"u",nodes:null};function w(){return at.server}function be(e){at.server=e}function hs(e){at.nodes=e}function Pe(){if(!at.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return at.nodes}function Se(e){return e!=null&&e[ct]===!0?!0:typeof Node<"u"&&e instanceof Node}function or(e){return e!=null&&e[ct]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function sr(e){return e!=null&&e[ct]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var ar="1.0.0-alpha.112";var V={dom:ar,reactive:ce};function ms(e){V.core=e}var Fn="data-fluixi";function zn(){return lt()?"":V.core??V.dom}function lt(){try{return!0}catch{return!1}}function cr(e){if(e.setAttribute(Fn,zn()),typeof globalThis>"u")return;let t=globalThis.Fluixi;t&&typeof t=="object"&&Object.values(t).some(r=>typeof r=="function")?t.versions=V:globalThis.Fluixi=V}function lr(){let e=un();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=[V.core,V.dom,V.reactive].filter(r=>r!==void 0);new Set(t).size<=1||console.warn(`[fluixi] package versions disagree: core ${V.core??"(absent)"}, dom ${V.dom}, reactive ${V.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 h={active:!1,cursor:null,parents:[]},gs=null;function vs(e){gs=e}function ut(){return gs}function Un(e,t){return h.active&&t.parentNode===e}function pr(e){let t=h.parents.lastIndexOf(e);t!==-1&&(h.parents.length=t),h.cursor=e.nextSibling}function bs(){return h.active?h.cursor:null}function Le(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 Ss(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 je(e){if(!h.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&pr(t)}function dr(){let e=globalThis;return e[Symbol.for("fluixi.appHydration")]??={pending:0,waiting:new Set}}function ws(){dr().pending++}function xs(){let e=dr();if(e.pending>0&&e.pending--,e.pending>0)return;let t=[...e.waiting];e.waiting.clear();for(let r of t)r()}function Es(){return dr().pending>0}function ks(e){let t=dr();return t.waiting.add(e),()=>t.waiting.delete(e)}var ur=Symbol.for("fluixi.hydrationKeys"),Y="data-hk";function Jn(e){let t=e;for(;t;){let r=t.contexts?.get(ur);if(r)return r;if(!t.parent){let n={id:"",next:0};return(t.contexts??=new Map).set(ur,n),n}t=t.parent}return{id:"",next:0}}function ft(){return w()?B()?.hydrationKeys!==!1:h.active}function fr(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 Gn(e){if(!ft())return null;let t=Jn(E()),r=t.id+(t.next++).toString(36);return e?`${fr(r)}-${e}`:fr(r)}var su=0;function As(){if(!ft())return`fx-c${(su++).toString(36)}`;let e=Jn(E());return e.ids=(e.ids??0)+1,`fx-${fr(`${e.id}#${e.ids}`)}`}var ys=new Map;function $s(e){let t=ys.get(e);return t===void 0&&ys.set(e,t=fr(e).slice(0,6)),t}function Cs(e){let t=e.getAttribute(Y)??"",r=t.indexOf("-");return r<0?"":t.slice(r+1)}function Xn(e){let t=e.getAttribute(Y);t&&P?.get(t)===e&&P.delete(t)}function Rs(){if(!ft())return null;let e=E();if(!e)return null;let t=Jn(e),r={id:t.id+(t.next++).toString(36)+".",next:0},n=U(e);return(n.contexts=new Map).set(ur,r),n}function Ts(e){let t=E();t&&(t.contexts??=new Map).set(ur,{id:e,next:0})}var P=null;function Yn(e){P??=new Map;for(let t of e.querySelectorAll(`[${Y}]`)){let r=t.getAttribute(Y);P.has(r)||P.set(r,t)}}function hr(){P=null}function mr(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 Ns(e){if(!(!P||e.length===0))for(let[t,r]of P)e.some(n=>n===r||n.contains(r))&&P.delete(t)}var Kn=[];function Os(e){h.active?Kn.push(e):e()}function Zn(){for(;Kn.length>0;){let e=Kn.shift();try{e()}catch(t){console.error(t)}}}function pt(e,t){lt()||console.warn(`[fluixi] hydration mismatch: expected text ${JSON.stringify(t.slice(0,24))} but the server DOM has text ${JSON.stringify(e.slice(0,24))}. Server and client rendered different markup; keeping the node and writing the client's text. Check for non-deterministic render (Date.now(), Math.random(), browser-only branches, untransported data).`)}function _s(){return h.active}function Qn(e,t){if(!e||!P)return null;let r=P.get(e);return!r||r.localName!==t.toLowerCase()?null:(P.delete(e),r)}function ei(e){if(w())return e.fallback??null;let t=h.active,[r,n]=T(!t);return t&&queueMicrotask(()=>n(!0)),S(()=>r()?e.children:e.fallback??null,void 0,{name:"client-only"})}var Ds=ei;function Ms(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function Is(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Ps(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Ls(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function js(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function Hs(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function dt(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Ws(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function ti(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function ri(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function ni(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function ii(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function oi(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function si(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function J(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function ai(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function qs(e){return ti(e)?{type:"router",value:e}:ni(e)?{type:"route",value:e}:ri(e)?{type:"routes",value:e}:ii(e)?{type:"outlet",value:e}:J(e)?{type:"component",value:e}:ai(e)?{type:"suspense",value:e}:oi(e)?{type:"provider",value:e}:si(e)?{type:"context",value:e}:{type:"none",value:e}}function Bs(e){if(w()||!h.active)return e();let t=E();return dt(()=>$(t,e))}var vr=Symbol("store-raw"),Vs=Symbol("store-node"),Fs=Symbol("store-has"),zs=Symbol("store-self"),Ks=Symbol("store-track");var ht=new WeakMap,ci=new WeakMap,We=new WeakMap,br=new WeakMap;function au(e,t){if(!He(e)||!K())return;let r=new Set,n=s=>{if(!(!He(s)||r.has(s))){r.add(s);for(let a of Object.values(s))n(a)}};n(br.get(t)??t);let i=new Set,o=s=>{if(!He(s))return;let a=s;if(r.has(a)||i.has(a))return;i.add(a);let c=ht.get(a);if(c){for(let u of c.keys.values())le(u);c.all&&le(c.all),ht.delete(a),We.delete(a),ci.delete(a)}for(let u of Object.values(a))o(u)};o(e)}var Sr=(e,t,r)=>r?`${e}[${String(t)}]`:`${e}.${String(t)}`;function Ys(e,t,r){let n=t?.owner,i=n&&r!==void 0?Sr(n.name,r,t?.array):void 0,o=i?{name:i}:void 0,[s,a]=To(n?.store,()=>m.hot?Dn(()=>T(e,o)):T(e,o)),c=s;return c.$=a,c}function wr(e){let t=ht.get(e);return t?t.owner||(t.owner=We.get(e)):ht.set(e,t={keys:new Map,owner:We.get(e),array:Array.isArray(e)}),t}function Us(e,t,r){let n=e.keys.get(t);return n||e.keys.set(t,n=Ys(r,e,t)),n}function cu(e,t,r,n){let i=We.get(e);if(i&&i.store===t&&i.name===r)return;let o={store:t,name:r};We.set(e,o),br.set(e,br.get(n)??n);let s=ht.get(e);if(s&&(s.owner=o,!!K())){for(let[a,c]of s.keys)pn(c,t,Sr(r,a,s.array));s.all&&pn(s.all,t,Sr(r,"*",s.array))}}function Js(e){let t=wr(e);(t.all||(t.all=Ys(void 0,t,"*")))()}function Gs(e,t){e.$(typeof t=="function"?()=>t:t)}function He(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function yr(e){if(!He(e))return e;let t=ci.get(e);if(t)return t;let r=new Proxy(e,lu);return ci.set(e,r),r}var lu={get(e,t,r){if(t===vr||t===Vs)return e;if(t===Lt)return r;if(t===Fs)return c=>c in e;if(t==="__proxy")return!0;if(t===Ks||t===zs)return Js(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=wr(e),s=Us(o,t,n),a=s();return He(a)?(o.owner&&cu(a,s,Sr(o.owner.name,t,o.array),e),yr(a)):a},set(){return!0},deleteProperty(e,t){return t in e&&G(e,t,void 0),!0},has(e,t){return t===vr||t===Lt||t===Vs||t===Fs||t===zs||t===Ks?!0:(Us(wr(e),t,e[t])(),t in e)},ownKeys(e){return Js(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function Zs(e,t=new Set){if(e==null||typeof e!="object")return e;let r=e[vr]??e;if(t.has(r)||!He(r))return r;t.add(r);let n=!1,i=s=>{let a=Zs(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 G(e,t,r){let n=Zs(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=wr(e),c=a.keys.get(t);if(c&&Gs(c,n),au(i,e),o&&e.length!==s){let u=a.keys.get("length");u&&Gs(u,e.length)}a.all&&a.all.$(void 0)}function li(e,t){return typeof e=="function"?e(t):e}function ui(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)?ui(i,n):G(e,r,n)}}function xr(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])?[]:{},G(e,s,a)),e=a}let i=t[n];if(i==="*"){if(Array.isArray(e))for(let o=0;o<e.length;o++)G(e,o,li(r,e[o]));return}G(e,i,li(r,e[i]))}function Xs(e,t,r){Qs(e,xr(t),r)}function uu(e){return Array.isArray(e)&&e.length>0&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="string")}function gr(e,t){for(let r=e.length-1;r>=t.length;r--)G(e,String(r),void 0);e.length!==t.length&&G(e,"length",t.length);for(let r=0;r<t.length;r++)G(e,String(r),t[r])}function fu(e,t){let r=t[0];if(typeof r=="function"&&t.length===1){let n=r(e);n&&n!==e&&ui(e,n);return}if(Array.isArray(r)&&t.length===1){if(uu(r)){for(let n of r)Xs(e,n[0],n[1]);return}if(Array.isArray(e)){gr(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){ui(e,r);return}if(t.length>=3){fi(e,t.slice(0,-1),t[t.length-1]);return}Xs(e,String(r),t[1])}function pu(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 fi(e,t,r){if(e==null)return;let[n,...i]=t;if(typeof n=="string"){let s=xr(n);if(s.length>1){fi(e,[...s,...i],r);return}}let o=pu(e,n);if(i.length===0){for(let s of o)G(e,s,li(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))?[]:{},G(e,s,a)}fi(a,i,r)}}function pi(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(pi);let t={};for(let r of Object.keys(e))t[r]=pi(e[r]);return t}function fe(e,t){let r=e;for(let n of xr(t)){if(r==null)return;r=r[n]}return r}var ea=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...r)=>I(()=>fu(this.root,r))),e&&typeof e=="object"&&(We.set(e,{store:this,name:t.name??"store"}),br.set(e,e)),K()&&ve({kind:"store",node:this,handle:()=>this.root,name:t.name})}get state(){return yr(this.root)}get proxy(){return yr(this.root)}get accessor(){return(()=>yr(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return mt(this.state);let t=this.state;for(let r of xr(e)){if(t==null)return;t=t[r]}return mt(t)}select(e){return S(()=>e(this.state))}subscribe(e){return D(()=>e(this.state))}watch(e,t){let r;return D(()=>{let n=e(this.state);Object.is(n,r)||(t(n,r),r=n)})}reactive(e){return S(()=>this.state[e])}produce(e){this.set((t=>{let r=pi(t);return e(r),r}))}reconcile(e,t={}){this.set(e)}push(e,...t){let r=fe(this.root,e);this.set(e,r.concat(t))}pop(e){let t=fe(this.root,e).slice(),r=t.pop();return this.set(e,t),r}shift(e){let t=fe(this.root,e).slice(),r=t.shift();return this.set(e,t),r}splice(e,t,r,...n){let i=fe(this.root,e).slice(),o=i.splice(t,r,...n);return this.set(e,i),o}insert(e,t,r){let n=fe(this.root,e).slice();n.splice(t,0,r),this.set(e,n)}removeAt(e,t){let r=fe(this.root,e).slice(),n=r.splice(t,1);return this.set(e,r),n}replace(e,t){if(arguments.length>=2){let n=fe(this.root,String(e)),i=t;if(Array.isArray(n)&&Array.isArray(i)){gr(n,i);return}this.set(e,i);return}let r=this.root;if(Array.isArray(r)&&Array.isArray(e)){gr(r,e);return}this.set(e)}clear(e){let t=e===void 0?this.root:fe(this.root,e);if(Array.isArray(t)){gr(t,[]);return}if(t&&typeof t=="object")for(let r of Object.keys(t))G(t,r,void 0)}toObservable(){let[e]=Dn(()=>T(this.state));return e.toObservable()}dispose(){}},du=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","replace","clear","unwrap","toObservable"];function hu(e,t){for(let r of du)e[r]=t[r].bind(t);e.$=t.reactive.bind(t)}function di(e,t={immutable:!0}){let r=m.hot,n=new ea(r?r.take("store",e):e,t);return hu(n.set,n),r&&r.keep(()=>mt(n.proxy),()=>n.set(()=>e)),[n.proxy,n.set]}function mu(e,t={}){return new ea(e,{...t,immutable:!1})}function mt(e){if(e==null||typeof e!="object")return e;let t=e[vr];return t!==void 0?t:e}function yu(e){return x(()=>mt(e))}var nh=Object.freeze({createStore:di,createMutableStore:mu,batch:I,unwrap:mt,untrackStore:yu});function hi(e,t){let[r,n]=di(e,t);return new Proxy(r,{get:(i,o)=>o==="set"?n:i[o],has:(i,o)=>o==="set"||Reflect.has(i,o)})}var gu="__fx_dom_create_component__",we=globalThis[gu]??={fn:null};function ra(e){we.fn=e}function na(e={}){let t=e.signalSystem?.createComponent;t&&(we.fn=t)}function xe(e,t){let r=Rs();return r?$(r,()=>ta(e,t)):ta(e,t)}function ta(e,t){if(we.fn)return we.fn(e,t);t&&Wt(t);let r=typeof e=="function"?x(()=>e(t)):e,n=r!=null&&(typeof r=="function"||typeof r=="object");if(n)try{r.$name=e?.name}catch{}return n&&!R(r)?dt(r):r}var ia=()=>we.fn!==null,mi=()=>we.fn!==null;function yi(){we.fn=null}function oa(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function sa(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function aa(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 ca=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),la=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"]),yt="http://www.w3.org/2000/svg";function gi(e){return e.localName.includes("-")}function gt(e,t,r,n=!1){if(r==null){e.removeAttribute(t);return}if(gi(e)){if(w()){qe(e,t,r);return}e[t]=r;return}H(e,t,r,n)}var vi=Symbol.for("fluixi.serverProps");function qe(e,t,r){let n=e[vi]??={};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 vu=new Set(["draggable","spellcheck","contenteditable"]);function bi(e){return e.startsWith("aria-")||vu.has(e.toLowerCase())}var vt=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]),Si=new Set(["id","class","className","style","slot","part","exportparts","is","title","role","lang","dir","tabindex","hidden"]);function Be(e){return Si.has(e)||e.startsWith("aria-")||e.startsWith("data-")}function Er(e,t=document){return t.querySelector(e)}function ua(e,t=document){return Array.from(t.querySelectorAll(e))}function fa(e,t){return e.closest(t)}function wi(e,...t){e.classList.add(...t)}function xi(e,...t){e.classList.remove(...t)}function Ei(e,...t){t.forEach(r=>e.classList.toggle(r))}function pa(e,t){return e.classList.contains(t)}function H(e,t,r,n=!1){if(typeof r=="boolean"&&bi(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 ki(e,t){return e.getAttribute(t)}function Ai(e,t){e.removeAttribute(t)}function kr(e,t){Object.assign(e.style,t)}function da(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function $i(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")kr(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 Ci(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Ri(e,...t){t.forEach(r=>{typeof r=="string"?e.appendChild(document.createTextNode(r)):e.appendChild(r)})}function ha(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function ma(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function ya(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function ga(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 va(e,t=5e3){return new Promise((r,n)=>{let i=Er(e);if(i){r(i);return}let o=new MutationObserver(()=>{let a=Er(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 ba(e,t,r={}){let n=new IntersectionObserver(i=>{i.forEach(o=>{t(o.isIntersecting)})},r);return n.observe(e),()=>{n.disconnect()}}function Sa(e,t){let r=new ResizeObserver(n=>{n.forEach(t)});return r.observe(e),()=>{r.disconnect()}}var bu=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function wa(e){return typeof e=="object"&&e!==null&&e.$$typeof===bu}function xa(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function Ea(e){return e instanceof Node}function ka(e,t,r="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[r]>"u"&&(globalThis[r]={}),typeof globalThis[r][e]>"u"&&(globalThis[r][e]=t))}function Aa(e,t,r="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[r]<"u"&&typeof globalThis[r][e]<"u"?globalThis[r][e]:t}function Su(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 wu(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 Na(e){return wu(Su(e))}var Oa=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),$a={},Ar="__fx_at",_a="__fx_loc";function Ti(e,t){return t&&(e[_a]=t),e}var xu=Symbol.for("fluixi.owner");function $r(e){let t=E();t&&(e[xu]=t)}function Ca(e){if(e instanceof Element){e.localName.includes("-")&&$r(e);for(let t of e.querySelectorAll("*"))t.localName.includes("-")&&$r(t)}}var Ra=/<[a-z][\w.]*-/i,Ta=new Map,Eu="__fluixi_delegated_events__",Di=globalThis[Eu]??={names:new Set},Cr=Di.names,Tr=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function St(e){if(!w())for(let t of e)Cr.has(t)||Tr.has(t)||(Cr.add(t),Di.dispatch??=ku,document.addEventListener(t,Di.dispatch))}function ku(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 Nr(e,t,r){if(e[`$$${t}`]=r,Tr.has(t)){let n=`__fx_${t}`;if(!e[n]){let i=o=>{e[`$$${t}`]?.(o)};e.addEventListener(t,i),e[n]=i}return}Cr.has(t)||St([t])}function bt(e,t){delete e[`$$${t}`];let r=`__fx_${t}`,n=e[r];n&&(e.removeEventListener(t,n),delete e[r])}function Da(e){return!Tr.has(e)}function Ma(e){return typeof e=="function"}function pe(e,t=!1){if(w())return Pe().createText(e);if(h.active&&!t){let r=ut()?.hydrateText(e);if(r)return r}return document.createTextNode(e)}function ke(e,t=!1,r){let n=Gn();if(w()){let i=Pe().createElement(e,t);return n&&i.setAttribute(Y,n),i}if(h.active){let i=Qn(n,e);if(i)return ut()?.enterElement(i),e.includes("-")&&$r(i),r?Ti(i,r):i;let o=ut()?.hydrateElement(e);if(o)return e.includes("-")&&$r(o),r?Ti(o,r):o}return Ti(t?document.createElementNS(yt,e):document.createElement(e),r)}function Or(e,t=!1){let r=Ta.get(e);if(r)return r;let n=document.createElement("template");return t?n.innerHTML=`<svg>${e}</svg>`:n.innerHTML=e,Ta.set(e,n),n}function Mi(e,t,r=!1,n=!1,i){let o=$s(e),s=Gn(o);if(w()){let a=Pe();if(r){let c=a.parseTemplate(e,n);return s&&c.setAttribute(Y,s),c}return a.createRaw(s?Au(e,s):e)}if(h.active){let a=Qn(s,t);if(a)return h.cursor=a.nextSibling,Ra.test(e)&&Ca(a),Ni(a,i);let c=ut()?.hydrateStatic(t,o);if(c)return Ra.test(e)&&Ca(c),Ni(c,i)}return Ni(_r(Or(e,n),n).firstChild,i)}function Au(e,t){return e.replace(/^(\s*<[^\s/>]+)/,`$1 ${Y}="${t}"`)}function Ni(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][_a]={file:t.file,line:o,column:t.pos[i*2+1]})}return e}function wt(e,t){if(!h.active)return t();let r=Le(e.nextSibling,t);if(typeof r=="function"){let n=r;return $u(n,(...o)=>h.active?Le(e.nextSibling,()=>{let s=n(...o);for(;typeof s=="function";)s=s();return s}):n(...o))}return r}function $u(e,t){let r=e[Ar];return r!==void 0&&(t[Ar]=r),t}function xt(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 Et(e,t){let r=[];for(let n=e.nextSibling;n&&n!==t;n=n.nextSibling)r.push(n);return r}function _r(e,t=!1){let r=e.content.cloneNode(!0);return t?r.firstChild:r}function Ii(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?Ii(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function Ia(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Pa(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 ie=0,Cu=200;function Ru(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)){ie++;try{let f=e();a().set(e,f)}finally{ie--}}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;ie++;try{let y=p();a().set(p,y)}finally{ie--}}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(),ie++;try{o=ze(t,l,r,o,s),i(o)}finally{ie--}}}function _(e,t,r,n){if(ie>Cu)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=pe("",!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)){ie++;try{s=ze(e,t,r,s)}finally{ie--}return o(),()=>s}let u=Ru(c(t),e,r,s,l=>{s=l});return o(),()=>(u?.(),s)}var La=Symbol.for("fluixi.keepServerContent");function ja(e){return{[La]:!0,adopt:e}}function Tu(e){return!!e&&typeof e=="object"&&e[La]===!0}function ze(e,t,r,n,i){if(t==null||typeof t=="boolean")return Z(e,n,r);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return Z(e,n,r);if(Tu(t)){let s=n==null?[]:Array.isArray(n)?n:[n];return Ns(s),t.adopt?.(s),n??null}if(Fe(t)){let s=pe("",!0);return Array.isArray(n)?n.length>0?(e.replaceChild(s,n[0]),Z(e,n.slice(1),r)):F(e,s,r):n?e.replaceChild(s,n):F(e,s,r),t.then(a=>{s.parentNode===e&&ze(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=pe(t);return F(e,a,r),a}if(n.length===1&&n[0].nodeType===3){let a=n[0];return h.active&&a.data!==t&&pt(a.data,t),a.data=t,n}n=Z(e,n,r)}if(n&&sr(n))return h.active&&n.data!==t&&pt(n.data,t),n.data=t,n;let s=pe(t);return n&&n.parentNode===e?e.replaceChild(s,n):Un(e,s)||F(e,s,r),s}if(Se(t))return Un(e,t)?(pr(t),t):Array.isArray(n)?(n.length===0?F(e,t,r):n[0].parentNode===e?(e.replaceChild(t,n[0]),Z(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=()=>ne(t,s,e,r,!0,i,c,u);h.active&&a.length?Le(a[0],l):l();let f=Nu(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(()=>Z(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 ze(e,c,r,n)}}}return Z(e,n,r)}function ne(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"&&!Fe(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"&&!Fe(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=pe("",!0);if(t.push(p),h.active&&a&&h.cursor?.parentNode===r){let y=()=>h.cursor&&h.cursor.parentNode===r?h.cursor:null,v=y();r.insertBefore(p,v);let d=_(r,l,p),b=y();for(let C=v;C&&C!==b;C=C.nextSibling)a.add(C);r.insertBefore(p,b),A(()=>Z(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)?ne(f,t,r,n,i,o):ne([f],t,r,n,i,o);continue}continue}Array.isArray(l)?ne(l,t,r,n,i,o,s,a):ne([l],t,r,n,i,o,s,a);continue}if(Fe(u)){let l=pe("",!0);t.push(l),u.then(f=>{if(l.parentNode){let p=[];if(ne([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)){ne(u,t,r,n,i,o,s,a);continue}if(Se(u)){h.active&&(h.cursor===u||h.parents.includes(u))&&pr(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)?ne(f,t,r,n,!1,o):ne([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(pe(l));continue}t.push(pe(String(u)))}}}}function Nu(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 v=t[a];for(;c<f;)F(e,r[c++],v)}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 Z(e,t,r){if(t)if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n].parentNode===e&&e.removeChild(t[n]);else t.parentNode===e&&e.removeChild(t);return null}function F(e,t,r){h.active&&t.parentNode===e||(r&&r.parentNode===e?e.insertBefore(t,r):e.appendChild(t))}function de(e,t,r){r==null?delete e[t]:e[t]=r}function Dr(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 Ha(e,t){if(!t||typeof t!="function")return;let r=t[Ar]?.name;if(!r)return;let n=r.indexOf(":");n!==-1&&W(e,r.slice(0,n),r.slice(n+1),t)}function Rr(e,t,r){let n=typeof r=="function"?x(()=>r()):r;if(!(!n||typeof n!="object"))for(let i of Object.keys(n))W(e,t,i)}function Mr(e,t){let r=(n,i)=>{typeof n=="function"&&(W(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 Ke(e,t,r,n=!1){return Ha(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 Ue(e,t,r){return typeof r!="function"?(de(e,t,r),()=>{}):(Ha(e,r),k(()=>{j(e,"property",t,r);let n=typeof r=="function"?r():r;de(e,t,n)}))}function Ir(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 he(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 Oi(e,t,r){t.includes("-")?r==null?e.removeProperty(t):e.setProperty(t,String(r)):e[t]=r??""}function Ve(e){for(;typeof e=="function";)e=e();return e}var _i=new WeakMap;function oe(e,t,r){if(typeof t=="function"&&r){r.push(k(()=>oe(e,Ve(t))));return}let n=Ve(t),i=_i.get(e);if(n==null){_i.delete(e),e.removeAttribute("style");return}let o=new Set,s=a=>{if(typeof a=="function"&&r){r.push(k(()=>s(Ve(a))));return}if(a=Ve(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(()=>Oi(e.style,c,Ve(u)))):Oi(e.style,c,Ve(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)||Oi(e.style,a,null);_i.set(e,o)}function Wa(e,t){if(typeof t!="function"){oe(e,t,[]);return}k(()=>{j(e,"attribute","style",t),oe(e,t())})}function qa(e,t){if(typeof t!="function"){he(e,t,[]);return}k(()=>{j(e,"attribute","class",t),he(e,t())})}function Ou(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 Pi(e){let{element:t,props:r,prevProps:n=$a,isSVG:i=!1,skipChildren:o=!1,isCustomElement:s,accessors:a}=e;if(!t||!or(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===yt,u=(d,b,C,N)=>{if(d==="children"){o||N.push(_(t,()=>r.children));return}let g=r[d],ee=g===void 0&&C&&Ou(r,d);if(g===b&&!ee||ee&&(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"){Mr(t,g);return}if(d.startsWith("on:")){N.push(Dr(t,d.slice(3),g));return}if(d.startsWith("prop:")){W(t,"prop",d.slice(5),g),N.push(Ue(t,d.slice(5),g));return}if(d.startsWith("attr:")){W(t,"attr",d.slice(5),g),N.push(Ke(t,d.slice(5),g,c));return}if(d.startsWith("bool:")){W(t,"bool",d.slice(5),g),N.push(Ir(t,d.slice(5),g));return}if(d==="class"||d==="className"){typeof g=="function"?N.push(k(()=>{j(t,"attribute","class",g),Ee(t,g())})):Ee(t,g);return}if(d==="classList"){Rr(t,"class",g),typeof g=="function"?N.push(k(()=>{j(t,"attribute","class",g),he(t,g())})):he(t,g,N);return}if(d==="style"){Rr(t,"style",g),typeof g=="function"?N.push(k(()=>{j(t,"attribute","style",g),oe(t,g())})):oe(t,g,N);return}if(d.startsWith("on")){let O=d.slice(2).toLowerCase();b&&bt(t,O),g&&Nr(t,O,g);return}let te=s??t.localName.includes("-"),ge=vt.has(d)||!c&&d in t||te&&!c&&!Be(d);if(te&&!c&&!Be(d)&&a!==void 0&&typeof g=="function"&&!a.includes(d)){w()?qe(t,d,g):de(t,d,g);return}if(te&&!c&&!Be(d)&&w()){N.push(k(()=>{let O=typeof g=="function"?g():r[d];for(;typeof O=="function"&&O.length===0;)O=O();qe(t,d,O)}));return}typeof g=="function"?N.push(ge?Ue(t,d,g):Ke(t,d,g,c)):N.push(k(()=>ge?de(t,d,r[d]):H(t,d,r[d],c)))},l=d=>{d!=="children"&&(d.startsWith("on")?bt(t,d.slice(2).toLowerCase()):vt.has(d)?de(t,d,null):t.removeAttribute(d))},f=new Map,p=(d,b,C)=>{let N=[];f.set(d,N),u(d,b,C,N)};x(()=>{for(let d in r)p(d,n[d],n===$a);for(let d in n)d in r||l(d)});let y=E(),v=k(()=>{let d=new Set;for(let b in r)d.add(b);x(()=>$(y,()=>{for(let b of d)f.has(b)||p(b,void 0,!0);for(let[b,C]of f)d.has(b)||(C.forEach(N=>N()),f.delete(b),l(b))}))});return()=>{v();for(let d of f.values())d.forEach(b=>b())}}function kt(e,t,r=!1){for(let n in t){if(n==="children")continue;let i=t[n];if(n==="ref"){Ae(i,e);continue}if(n==="use"){Mr(e,i);continue}if(n.startsWith("on:")){Dr(e,n.slice(3),i);continue}if(n.startsWith("prop:")){W(e,"prop",n.slice(5),i),Ue(e,n.slice(5),i);continue}if(n.startsWith("attr:")){W(e,"attr",n.slice(5),i),Ke(e,n.slice(5),i,r);continue}if(n.startsWith("bool:")){W(e,"bool",n.slice(5),i),Ir(e,n.slice(5),i);continue}if(n.startsWith("on")&&n.length>2){let o=n.slice(2).toLowerCase();if(typeof i=="function")if(Tr.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,Cr.has(o)||St([o]);continue}if(n==="class"||n==="className"){Ee(e,i);continue}if(n==="classList"){Rr(e,"class",i),typeof i=="function"?k(()=>{j(e,"attribute","class",i),he(e,i())}):he(e,i,[]);continue}if(n==="style"){Rr(e,"style",i),typeof i=="function"?k(()=>{j(e,"attribute","style",i),oe(e,i())}):oe(e,i,[]);continue}if(n==="innerHTML"){if(typeof i=="function"){let o=D(()=>{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=D(()=>{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=D(()=>{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=D(()=>{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=D(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();gt(e,n,s,r)});A(()=>{o()})}else k(()=>gt(e,n,t[n],r))}}function Li(...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 Pr(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[Ar]?.name;if(W(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 ji(e,t,r){let n=t||document.body,i=Oe(()=>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 Ba(e){return typeof e=="string"&&e.toLowerCase()===e}function Lr(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 Va(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Fe(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Fa(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 q(s=>{I(()=>{h.active||(t.textContent=""),cr(t),lr(),_(t,e)}),i=s}),()=>{i?.(),n?.(),o.forEach(s=>s()),t.textContent=""}}function Hi(e){if(Array.isArray(e))return e;if(typeof e=="function"&&typeof e.set=="function")return[e,e.set];throw new TypeError("[fluixi] bind: needs a signal, either `signal(...)` or the `[get, set]` pair from `createSignal(...)`.")}function jr(e,t={}){if(typeof e=="function")return xe(e,t);if(typeof e!="string"||e.length===0)return null;let r=Lr(e),n=ke(e,r);return kt(n,t,r),Du(n,t),n}function _u(e){if(!e||!("children"in e))return!1;let t=Object.getOwnPropertyDescriptor(e,"children");return!t||"get"in t?!0:t.value!==void 0}function Du(e,t){if(!_u(t))return;if(w()&&!ft()){_(e,Oe(()=>t.children));return}let r=e.firstChild,n;h.active&&r?.nodeType===8&&r.data==="fx"?n=xt(r):(r=za("fx"),n=za("fx/"),e.appendChild(r),e.appendChild(n));let i=r;_(e,wt(i,()=>Oe(()=>t.children)),n,Et(i,n))}function za(e){return w()?Pe().createComment(e):document.createComment(e)}function Hr(e){let t=()=>{let a=e.component;return R(a)?a():a},[,r]=Pr(e,["component"]),n=E(),i=null,o,s;return S(()=>{let a=t();return a===o||(i&&X(i),i=U(n),o=a,s=a==null?null:$(i,()=>x(()=>typeof a=="string"?jr(a,r):xe(a,r)))),s},void 0,{name:"Dynamic"})}var Wi=gn(void 0);function qi(e,t){let r;D(()=>{t.error()===void 0?r=void 0:r??=x(e.current)}),D(()=>{let n=e.committed();x(()=>{r!==void 0&&n!==r&&t.error()!==void 0&&t.reset()})})}function Wr(e){let t=mn(),r=a=>!!a&&typeof a.then=="function",n=a=>(w()&&nr(ir(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=w()?t.caught():void 0;return l===void 0?u:x(()=>n(l))}catch(u){return w()&&!r(u)?(t.setError(u),x(()=>n(u))):i(u)}}},s=zt(Wi);return s&&qi(s,t),S(()=>{let a=t.error();if(a!==void 0)return n(a);try{let c=yn(t,()=>{let l=e.children;return o(typeof l=="function"?l():l)}),u=w()?t.caught():void 0;return u===void 0?c:x(()=>n(u))}catch(c){return i(c),n(c)}},void 0,{name:"ErrorBoundary"})}function qr(e){let t=ue(()=>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 je(a),a};return e.by?De(t,e.by,(i,o)=>n(i,o),{fallback:r}):_e(t,(i,o)=>n(i,o),{fallback:r})}function Br(e){let t=ue(()=>e.each);return Me(t,(r,n)=>{let i=e.children(r,n);return je(i),i},{fallback:()=>e.fallback??null})}function Vr(e){if(w())return null;let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,r,n,i=!1,o=E(),s=()=>$(o,()=>q(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}var Mu=Symbol.for("fluixi.owner"),$t=1,Bi=3,Vi=8,Iu=Symbol.for("fluixi.serverElementRenderer"),Ka=Symbol.for("fluixi.serverElementRendered");function At(e){if(e.nodeType!==$t)return;let t=e;if(typeof t.localName!="string"||!t.localName.includes("-")||t[Ka])return;let r=globalThis[Iu];r&&(t[Ka]=!0,r(t))}var Ua;Ua=ct;var Fr=class{constructor(){this[Ua]=!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),At(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),At(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,At(e)),t}addEventListener(){}removeEventListener(){}},Ct=class Ja extends Fr{constructor(t){super(),this.nodeType=Bi,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 Ja(this.data)}},Ga=class Xa extends Fr{constructor(t){super(),this.nodeType=$t,this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new Xa(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}},zr=class Ya extends Fr{constructor(t){super(),this.nodeType=Vi,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new Ya(this.data)}},Pu=class{constructor(){this.cssText=""}setProperty(e,t){this[e]=t}removeProperty(e){delete this[e]}},Lu=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}},Rt=class Za extends Fr{constructor(t,r=!1){if(super(),this.nodeType=$t,this.attributes=new Map,this.style=new Pu,this.classList=new Lu(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[Mu]=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}get dataset(){let t=r=>`data-${r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}`;return new Proxy({},{get:(r,n)=>typeof n=="string"?this.getAttribute(t(n))??void 0:void 0,set:(r,n,i)=>(typeof n=="string"&&this.setAttribute(t(n),String(i)),!0),deleteProperty:(r,n)=>(typeof n=="string"&&this.removeAttribute(t(n)),!0)})}toggleAttribute(t,r){let n=r??!this.hasAttribute(t);return n?this.setAttribute(t,""):this.removeAttribute(t),n}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 Ct(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 Za(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 ju=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Hu={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function Qa(e){return e.replace(/&(#?\w+);/g,(t,r)=>Hu[r]??t)}var se=class extends Error{};function ec(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 se(`unterminated comment at ${u}`);o(new zr(e.slice(u+4,l))),r=l+3;continue}if(e[u+1]==="/"){let l=e.indexOf(">",u);if(l===-1)throw new se(`unterminated closing tag at ${u}`);let f=e.slice(u+2,l).trim().toLowerCase(),p=i.pop();if(!p||p.localName!==f)throw new se(`</${f}> does not close <${p?.localName??"nothing"}>`);r=l+1;continue}r=c(u)}if(i.length>0)throw new se(`unclosed <${i[i.length-1].localName}>`);let s=n[0];if(n.length!==1||!(s instanceof Rt))throw new se(`expected exactly one root element, got ${n.length}`);return s;function a(u){u!==""&&o(new Ct(Qa(u)))}function c(u){let l=/[\s/>]/.exec(e.slice(u+1));if(!l)throw new se(`unterminated tag at ${u}`);let f=e.slice(u+1,u+1+l.index).toLowerCase(),p=new Rt(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 v=y;for(;y<e.length&&!/[\s=/>]/.test(e[y]);)y++;let d=e.slice(v,y);if(d==="")throw new se(`malformed attribute at ${y}`);if(e[y]==="="){if(e[y+1]!=='"')throw new se(`attribute ${d} must have a double-quoted value`);let b=e.indexOf('"',y+2);if(b===-1)throw new se(`unterminated value for ${d}`);p.setAttribute(d,Qa(e.slice(y+2,b))),y=b+1}else p.setAttribute(d,"")}return o(p),ju.has(f)||i.push(p),y}}var Wu=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),rc=/&/g,nc=/</g,ic=/>/g,qu=/"/g;function Fi(e){return e.replace(rc,"&amp;").replace(nc,"&lt;").replace(ic,"&gt;")}function tc(e){return e.replace(rc,"&amp;").replace(qu,"&quot;").replace(nc,"&lt;").replace(ic,"&gt;")}function Bu(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Vu(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(`${Bu(r)}: ${n}`)}return t.join("; ")}function Fu(e){let t="",r=Vu(e.style);for(let[n,i]of e.attributes)n==="style"&&r||(t+=` ${n}="${tc(i)}"`);if(r){let n=e.attributes.get("style"),i=n?`${n.replace(/;\s*$/,"")}; ${r}`:r;t+=` style="${tc(i)}"`}return t}function Q(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Fi(e);if(typeof e=="number")return Fi(String(e));if(typeof e=="function")return Q(e());if(Array.isArray(e))return e.map(Q).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case Bi:return Fi(e.data??"");case Vi:return`<!--${e.data??""}-->`;case $t:{At(e);let t=e.localName,r=`<${t}${Fu(e)}>`;if(Wu.has(t))return r;let n=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(Q).join("");return`${r}${n}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(Q).join(""):""}var Tt="__FX_DATA__";function Kr(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var zi;function Ur(){let e=globalThis.__FX_DATA__;if(e&&typeof e.nodeType!="number")return e;if(zi!==void 0)return zi;let t=null;if(typeof document<"u"){let r=document.getElementById(Tt)?.textContent;if(r)try{t=JSON.parse(r)}catch{t=null}}return zi=t}var oc=!1;function cc(){oc||(oc=!0,hs({createElement:(e,t)=>new Rt(e,t),createText:e=>new Ct(e),createRaw:e=>new Ga(e),parseTemplate:(e,t)=>ec(e,t),createComment:e=>new zr(e)}))}function lc(e,t={}){let r=w();cc(),be(!0);let n=nt(t.event);n.hydrationKeys=t.hydrationKeys!==!1;try{return st(n,()=>q(i=>{try{let o=typeof e=="function"?e():e;return Q(o)}finally{i()}}))}finally{ot(n),be(r)}}var sc=!1,ac=new WeakMap;function zu(){sc||(sc=!0,xn(e=>{B()?.pending.add(e)}),tt(()=>B()?.nextResourceId()??""),Cn((e,t)=>{e&&B()?.data.set(e,t)}),Nn(()=>{let e=B();if(!e)return;let t=ac.get(e);return t||ac.set(e,t=Tn()),t}))}var Ki=null;function uc(e){Ki=e}function Ui(e){if(e.data.size===0)return"";let t={};for(let[n,i]of e.data){let o=i;if(Ki)try{o=Ki(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=Kr(JSON.stringify(t));return r==="{}"?"":`<script type="application/json" id="${Tt}">${r}<\/script>`}var Ku=50;async function fc(e,t={}){let r=w();cc(),be(!0),zu();let n=nt(t.event);n.hydrationKeys=t.hydrationKeys!==!1;try{return await st(n,async()=>{t.preload&&await t.preload(t.event);let i,o=null,s=()=>{};q(l=>{s=l,o=E(),i=typeof e=="function"?e():e});let a=()=>{try{$(o,()=>Q(i))}catch{}};a();let c=0;for(;n.pending.size>0&&c++<Ku;){let l=Array.from(n.pending);n.pending.clear(),await Promise.allSettled(l),await Ut(),a()}let u=$(o,()=>Q(i))+Ui(n);return s(),u})}finally{ot(n),be(r)}}function Gr(){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 Jr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Nt=!lt();function Ot(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 Uu=Symbol.for("fluixi.ownsContent");function mc(e){return e.localName.includes("-")?e.hasAttribute("data-fx-ssr")||e[Uu]===!0:!1}var pc=Symbol.for("fluixi.serverContent");function yc(e){let t=e;t[pc]||(t[pc]=Array.from(e.childNodes))}function Ju(e){Gr();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(Xn(t),Jr.has(e.toLowerCase())||mc(t)?(Jr.has(e.toLowerCase())||yc(t),h.cursor=t.nextSibling):(h.parents.push(t),h.cursor=t.firstChild),t):(Nt&&t&&Ot(`<${e}>`,t),null)}function Gu(e){Jr.has(e.localName)||mc(e)?(Jr.has(e.localName)||yc(e),h.cursor=e.nextSibling):(h.parents.push(e),h.cursor=e.firstChild)}function Xu(e,t){Gr();let r=h.cursor;if(r&&r.nodeType===1&&r.tagName.toLowerCase()===e.toLowerCase()){let n=Cs(r);return t&&n&&n!==t?(Nt&&Ot(`<${e}> (another template)`,r),null):(Xn(r),h.cursor=r.nextSibling,r)}return Nt&&r&&Ot(`<${e}> (static)`,r),null}function Yu(e){if(e===""){let r=h.cursor;return r&&r.nodeType===3&&r.data!==""?(h.cursor=r.nextSibling,r.data="",r):null}Gr();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&&(pt(r,e),t.data=e),t)}return Nt&&t&&Ot(`text ${JSON.stringify(e.slice(0,24))}`,t),null}function Zu(e){Gr();let t=h.cursor;return t&&t.nodeType===8&&t.data===e?(h.cursor=t.nextSibling,t):(Nt&&t&&Ot(`marker <!--${e.slice(0,24)}-->`,t),null)}var dc=!1;function gc(){dc||(dc=!0,vs({hydrateElement:Ju,hydrateText:Yu,hydrateMarker:Zu,hydrateStatic:Xu,enterElement:Gu}))}var hc=()=>typeof location>"u"?null:`${location.pathname}${location.search}`;function Ce(e,t,r){gc(),h.active=!0,h.cursor=t.firstChild,h.parents=[],hr(),Yn(t);let n=Ur(),i=r?.resourceNamespace,o=0;tt(()=>i?`${i}:r${o++}`:`r${o++}`);let s=hc();kn(n?a=>a in n&&hc()===s?{value:n[a]}:void 0:null);try{return $e(e,t)}finally{h.active=!1,h.cursor=null,h.parents=[],Zn()}}function vc(e,t){gc(),Yn(e);let r={active:h.active,cursor:h.cursor,parents:h.parents};h.active=!0,h.cursor=e.firstChild,h.parents=[];try{_(e,t()),mr(e)}finally{h.active=r.active,h.cursor=r.cursor,h.parents=r.parents,r.active||Zn()}}var Ji="fluixi-island";function Sc(e){let t=e.component,r=e.props??{},n=e.name,i=ke(Ji),o=n??t.name??"Island";H(i,"name",o),H(i,"props",JSON.stringify(r??{}));let s=w()?B():void 0;if(s){let a=s.nextIslandNamespace(o);_(i,()=>s.withResourceScope(a,()=>t(r)))}else _(i,()=>t(r));return i}var bc=!1;function Qu(){if(bc||typeof document>"u")return;bc=!0;let e=document.createElement("style");e.textContent=`${Ji}{display:contents}`,document.head.appendChild(e)}function wc(e){if(typeof document>"u")return;Qu();let t=document.querySelectorAll(Ji),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 xc(e,...t){throw new Error("html`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function Ec(e,...t){throw new Error("svg`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function kc(e,...t){throw new Error("css`` was not compiled: component styles need @fluixi-css/vite next to the fluixi plugin.")}var ef={createComponent:xe,createElement:$i,createNativeElement:ke,createTemplate:Or,cloneTemplate:_r,templateNode:Mi,holeContent:Et,holeEnd:xt,holeScope:wt,createPortal:ji,render:$e,hydrate:Ce,insert:_,appendChildren:Ri,removeChildren:Ci,spread:Pi,applyProps:kt,mergeProps:Li,bindPair:Hi,setProperty:de,setDynamicProperty:Ue,setAttribute:H,setDynamicAttribute:Ke,removeAttribute:Ai,getAttribute:ki,setClassName:Ee,addClass:wi,removeClass:xi,toggleClass:Ei,setStyles:kr,delegateEvents:St,addDelegatedEventListener:Nr,removeDelegatedEventListener:bt,handleRef:Ae,resetIntegration:yi,isIntegrationInitialized:mi},tf=ef;var Xr={kind:"eager"},rf=["pointerdown","focusin","keydown"],Ac=new Set(["eager","idle","visible","interaction","media","never"]),Je=class extends Error{};function $c(e,t){let r=e.slice(5);if(!Ac.has(r))throw new Je(`Unknown load strategy 'load:${r}'. Expected one of ${[...Ac].join(", ")}.`);switch(r){case"eager":return Xr;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?nf(t):[...rf]};case"media":if(!t)throw new Je(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new Je(`Unhandled load strategy '${r}'.`)}}function nf(e){let t=e.split(/[\s,]+/).map(r=>r.trim()).filter(Boolean);if(t.length===0)throw new Je("'load:interaction' was given no event names.");return t}function Cc(e){return e.kind!=="eager"}var Xi=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],Yi=["Suspense","SuspenseList","Await"],Yr=["Router","Outlet","Redirect","Link"],by=[...Xi,...Yi,...Yr],Zi=new Set([...Xi,...Yi]);function Rc(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:r="@fluixi/core",routerModule:n="@fluixi/core/router"}=e,i={};for(let o of Xi)i[o]=t;for(let o of Yi)i[o]=r;for(let o of Yr)i[o]=n;return i}function Tc(e,t={}){let{resolver:r,isBound:n,modules:i,strategyFor:o}=t,s=Rc(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 v=y.origin==="builtin"&&Zi.has(p)?Xr:o?.(f)??Xr;f.source={...y,loading:v},a.set(p,f.source)},l=f=>{if(Zi.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(Yr.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 Nc(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;!Cc(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 Oc={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},of=/&(?:#[xX]([0-9a-fA-F]{1,6})|#([0-9]{1,7})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;function Qr(e){return e.includes("&")?e.replace(of,(t,r,n,i)=>{let o=r?parseInt(r,16):n?parseInt(n,10):Object.prototype.hasOwnProperty.call(Oc,i)?Oc[i]:void 0;return o!==void 0&&o<=1114111?String.fromCodePoint(o):t}):e}var z="@fluixi/reactive/signal",Qi={$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 Ry=new RegExp(`\\$(?:${Object.keys(Qi).map(e=>e.slice(1)).join("|")})\\s*\\(`);var _c="__fx_source";var sf="__fx_hole",Re=(e,t,r,n)=>`(globalThis.${sf} ?? ((f) => f))(${e},${t},${r}${n===void 0?"":`,${JSON.stringify(n)}`})`,af="__fx_props",Dc=(e,t)=>`(globalThis.${af} ?? ((p) => p))(${e},${JSON.stringify(t)})`;var eo={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},Hy={version:2,module:"@fluixi/dom",symbols:[...eo.symbols,"template","cloneTemplate","walk"]};var cf=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Mc={className:"class",htmlFor:"for"},to=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),lf=new Set(["script","style","textarea","title"]);function ro(e){return lf.has(e)}function no(e){return Mc[e]??e}function me(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!to.has(e.name)}function io(e){if(!e.static||ro(e.tag))return!1;for(let t of e.props)if(!me(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&io(t)))return!1;return!0}function _t(e){let t=e.props.map(df).filter(Boolean).join(""),r=`<${e.tag}${t}>`;return cf.has(e.tag)?r:`${r}${e.children.map(uf).join("")}</${e.tag}>`}function uf(e){if(e.kind==="text")return mf(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return _t(e)}var ff=new Set(["draggable","spellcheck","contenteditable"]);function pf(e){return e.startsWith("aria-")||ff.has(e.toLowerCase())}function df(e){let t=Mc[e.name]??e.name,r=e.literal;return(r===!0||r===!1||r===void 0)&&pf(t)?` ${t}="${r!==!1}"`:r===!0||r===void 0?` ${t}`:r===!1||r===null?"":` ${t}="${hf(String(r))}"`}function hf(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mf(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function oo(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 yf="<!--fx-->",gf="<!--fx/-->";function en(e){return e.kind==="expr"||e.kind==="component"||ao(e)}function ao(e){return e.kind==="element"&&e.tag.includes("-")}function co(e){return ao(e)?!0:"children"in e&&Array.isArray(e.children)&&e.children.some(co)}function vf(e){return e.kind==="text"||e.kind==="element"&&Ic(e)}var bf=new Set(["indeterminate"]);function Sf(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"?me(e)?"serialize":"class":t==="classList"?me(e)?"serialize":e.reactive?"classListDynamic":"classList":t==="style"?me(e)?"serialize":e.reactive?"styleDynamic":"style":t.includes(":")||to.has(t)?null:bf.has(t)?"property":e.expr===void 0?me(e)?"serialize":null:"attr"}function wf(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 tn(e){let t=e.tag.includes("-"),r={serialize:[],bindings:[]};for(let n of wf(e)){let i=Sf(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 Ic(e){return e.svg||ao(e)||ro(e.tag)||!tn(e)?!1:e.children.every(t=>vf(t)||en(t))}function Pc(e){if(en(e))return!0;let t=e.children;return t?t.some(Pc):!1}function Lc(e){if(e.kind!=="element")return!1;let t=tn(e);return t&&t.bindings.length>0?!0:e.children.some(Lc)}function so(e){return Pc(e)||Lc(e)}function jc(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"||jc(t))}function Hc(e){if(!Ic(e)||!jc(e)||!so(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:xf(e),tag:e.tag,steps:t,holes:r,bindings:n};function s(a,c){let u=tn(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)=>{so(p)&&(l=y)});let f=null;for(let p=0;p<=l;p++){let y=a.children[p],v=f?`${f}.nextSibling`:`${c}.firstChild`;if(en(y)){let b=o(v),C=o(`holeEnd(${b})`);r.push({parentRef:c,startRef:b,endRef:C,node:y}),f=C;continue}let d=o(v);y.kind==="element"&&so(y)&&s(y,d),f=d}}}function xf(e){return _t(Wc(e)).split(qc).join(yf+gf)}function Wc(e){let t=tn(e);return{...e,props:t?t.serialize:[],children:e.children.map(r=>en(r)?{kind:"text",value:qc}:r.kind==="element"?Wc(r):r)}}var qc="\0fx-hole\0";function Bc(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 Vc(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=Vc(e,r);if(s<0)return-1;r=s}else if(o==='"'||o==="'"){let s=Bc(e,r);if(s<0)return-1;r=s}else o==="{"?i++:o==="}"&&i--,r++}}else r++}}return-1}function Ef(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 kf(e){return e!==""&&/[A-Za-z0-9_$)\]]/.test(e)}function Af(e){let t=0,r="",n=0;for(;n<e.length;){let i=e[n];if(i==='"'||i==="'"){let o=Bc(e,n);if(o<0)return null;n=o,r=i}else if(i==="`"){let o=Vc(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==="/"&&!kf(r)){let o=Ef(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 M(e,t){let r=e.trim();return r===""?`(${e})`:t==="arrowBody"&&r[0]==="{"?`(${e})`:Af(r)===!1?e:`(${e})`}function $f(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function uo(e){return $f(e)?e:JSON.stringify(e)}function Fc(e){if(e.expr!==void 0){if(e.name==="ref"&&e.at)return Re(M(e.expr,"value"),e.at.line,e.at.column,e.expr);if(!e.reactive)return M(e.expr,"value");let t=`() => ${M(e.expr,"arrowBody")}`;return e.at?Re(t,e.at.line,e.at.column,e.directive):t}return JSON.stringify(e.literal??!0)}function Cf(e){return e.expr!==void 0?M(e.expr,"value"):JSON.stringify(e.literal??!0)}function zc(e){return e===void 0?String(e):/^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$/.test(e.trim())?e:`() => (${e})`}function Rf(e,t,r){let n=e.filter(a=>a.kind==="spread"),o=e.filter(a=>a.kind!=="spread").map(a=>`${uo(a.name)}: ${Fc(a)}`);t!=null&&o.push(`children: ${t}`);let s=`{ ${o.join(", ")} }`;return n.length>0?(r.add("mergeProps"),`mergeProps(${n.map(a=>zc(a.expr)).join(", ")}, ${s})`):s}function Tf(e,t){return t?Re(e,t.line,t.column):e}function Kc(e,t,r){if(e.length===1)return Dt(e[0],t,r);let n=!1;return`[${e.map(o=>{let s=Dt(o,t,r);return o.kind==="element"&&n?(t.add("deferElement"),`deferElement(() => ${M(s,"arrowBody")})`):((o.kind==="component"||o.kind==="expr"&&o.reactive)&&(n=!0),s)}).join(", ")}]`}function Nf(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,Cf(p)]);r.length>0&&c.push(["children",Kc(r,n,i)]);let u=`{ ${c.map(([p,y])=>`get ${uo(p)}() { return ${y}; }`).join(", ")} }`;if(c.some(([,p])=>/\bthis\b/.test(p))){let p=c.map(([v,d])=>`${JSON.stringify(v)}: () => (${d})`);u=`((_$t) => ({ ${c.map(([v])=>`get ${uo(v)}() { return _$t[${JSON.stringify(v)}](); }`).join(", ")} }))({ ${p.join(", ")} })`}s.length>0&&(n.add("mergeProps"),u=`mergeProps(${s.map(p=>zc(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=Dc(u,l));let f=o?`globalThis.${_c}?.(${JSON.stringify(o.file)},${o.line},${o.column},${JSON.stringify(e)}), `:"";return`createMemo(${M(`${f}() => createComponent(${e}, ${u})`,"value")})`}function lo(e){let t=e.prop.name;return e.kind==="boolAttr"||t.startsWith("prop:")||t.startsWith("attr:")?t.slice(5):no(t)}function Of(e,t){let{ref:r,prop:n,kind:i}=e,o=Fc(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(lo(e))}, ${o});`;case"property":return t.add("setDynamicProperty"),`setDynamicProperty(${r}, ${JSON.stringify(lo(e))}, ${o});`;case"boolAttr":return t.add("setDynamicBoolAttribute"),`setDynamicBoolAttribute(${r}, ${JSON.stringify(lo(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 _f(e,t){let r=no(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 Uc=!1;function Dt(e,t,r){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":{if(!e.reactive)return M(e.code,"value");let n=`() => ${M(e.code,"arrowBody")}`;return e.at?Re(n,e.at.line,e.at.column):n}case"fragment":return e.children.length===0?"null":Kc(e.children,t,r);case"component":return Tf(Nf(e.name,e.props,e.children,t,r,e.at),e.bindAt??e.at);case"element":{if(r&&e.static&&!e.svg&&io(e)&&!co(e)){t.add("templateNode");let a=`_tmpl$${r.length}`;r.push({id:a,html:_t(e),tag:e.tag,svg:!1});let c=oo(e);return c?`templateNode(${a}, ${JSON.stringify(e.tag)}, false, false, ${JSON.stringify(c)})`:`templateNode(${a}, ${JSON.stringify(e.tag)})`}if(r&&Uc){let a=Hc(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=oo(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(Of(f,t));for(let f of a.holes)l.push(`insert(${f.parentRef}, holeScope(${f.startRef}, () => ${M(Dt(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(me))for(let a of e.props)o.push(_f(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: ${Rf(e.props,null,t)}${a}${u}${l} });`)}for(let a of e.children){t.add("insert");let c=Dt(a,t,r),u=a.kind==="expr"&&(a.reactive||!Mf(a.code))||a.kind==="component";o.push(u?`insert(${i}, ${c}, null);`:`insert(${i}, ${c});`)}return o.push(`return ${i};`),`(() => { ${o.join(" ")} })()`}}}var Df=/^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/,Mf=e=>Df.test(e);function rn(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 nn={name:"imperative",contract:eo,emit(e,t){let r=new Set,n=t?.templateClone!==!1?[]:void 0;return Uc=t?.partialTemplates===!0,{code:Dt(e,r,n),imports:Array.from(r),templates:n}}};function fo(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 If=new Set(["a","button","input","select","textarea","summary","details","option","label"]),Pf=new Set(["keydown","keyup","keypress"]);function Ge(e,t){return e.attributes.find(r=>"name"in r&&r.name===t)}function Lf(e){return e.attributes.some(t=>t.kind==="Spread")}function on(e,t){let r=Ge(e,t);if(!r||r.kind!=="Attribute"||!r.value)return;let n=r.value;return n.kind==="static"?n.value:void 0}function jf(e){let t=on(e,"role");return t==="presentation"||t==="none"?!0:on(e,"aria-hidden")==="true"}function Jc(e,t){return e.attributes.some(r=>r.kind==="EventBinding"&&t(r.name))}function Gc(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"&&Hf(o,r);let s="children"in o?o.children:void 0;s&&n(s)}};return n(e.children),t}function Hf(e,t){if(Lf(e))return;let r=e.tag.toLowerCase();r==="img"&&!Ge(e,"alt")&&!jf(e)&&t(e,"a11y-img-alt",'An `img` needs an `alt`. Use `alt=""` when the image is decorative.'),r==="a"&&!Ge(e,"href")&&!Ge(e,"role")&&t(e,"a11y-anchor-href","An `a` without `href` is not a link. Use a `button` for an action."),r==="iframe"&&!Ge(e,"title")&&t(e,"a11y-iframe-title","An `iframe` needs a `title` describing its content.");let n=on(e,"tabindex")??on(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."),!If.has(r)&&Jc(e,i=>i==="click")&&!Ge(e,"role")&&!Jc(e,i=>Pf.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 po(e){let t=(r,n)=>{r.parent=n;let i=Xc(r);for(let o of i)t(o,r)};return t(e,null),e}function Xc(e){switch(e.kind){case"Root":case"Element":case"Component":case"Fragment":return e.children;default:return[]}}var Yc=new Set(["capture","once","passive","prevent","stop","self"]);function ye(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 Zc=(e,t)=>({kind:"Attribute",name:t?e.name.slice(1):e.name,value:e.value,boolean:t,loc:e.loc}),sn=[{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)Yc.has(s)||e.report("invalid-directive",`Unknown event modifier ".${s}" — expected one of ${[...Yc].join(", ")}`);return{kind:"EventBinding",name:o,syntax:t,modifiers:i,hole:ye(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:ye(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:ye(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:ye(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:ye(e,"if directive"),loc:e.loc})},{id:"each",elementOnly:!0,match:e=>e==="each",build:e=>({kind:"EachDirective",hole:ye(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:ye(e,"ref binding"),loc:e.loc})},{id:"property",match:e=>e[0]===".",build:e=>({kind:"PropertyBinding",name:e.name.slice(1),hole:ye(e,"property binding"),loc:e.loc})},{id:"boolean",match:e=>e[0]==="?",build:e=>Zc(e,!0)}];function ho(e,t=sn,r={component:!1}){for(let n of t)if(!(n.elementOnly&&r.component)&&n.match(e.name))return n.build(e);return Zc(e,!1)}var mo=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}mark(){return[this.pi,this.oi]}reset([e,t]){this.pi=e,this.oi=t}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 yo=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"]),Qc=new Set(["script","style","textarea","title"]),el=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function tl(e){return e.length>0&&(e[0]!==e[0].toLowerCase()||e.includes("."))}var Wf=/[A-Za-z0-9\-_:@.?]/,qf=class{constructor(e,t){this.diagnostics=[],this.open=[],this.r=new mo(e),this.svg=t.svg??!1,this.directives=t.directives??sn,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 po(r),this.validateTree(r),this.accessibility&&this.diagnostics.push(...Gc(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=tl(t),n=this.parseAttributes(r);this.foldEachKey(n,e),this.r.skipWhitespace();let i=t.toLowerCase(),o=!r&&Qc.has(i),s=!r&&el.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(this.open.push(t),c=o?this.parseRawText(t):this.parseChildren(),this.open.pop(),this.r.startsWith("</")){let f=this.r.mark(),p=this.consumeCloseTag();p&&p!==t&&(this.open.includes(p)?(this.r.reset(f),this.report("unclosed-tag","error",`Unclosed <${t}>`,this.r.span(e))):this.report("mismatched-close-tag","error",`Expected </${t}>, got </${p}>`,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||yo.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(ho(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&&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=>Wf.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 an(e,t={}){return new qf(e,t).parse()}function Bf(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 rl(e,t={}){return an(Bf(e),t)}var nl=new Set(["click","dblclick","input","change","submit","focus","blur","keydown","keyup","keypress","mousedown","mouseup"]);function Vf(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}var Ff="container";function il(e){return e.charAt(0).toUpperCase()+e.slice(1)}var zf=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}=nn.emit(e,{});for(let i of r)this.used.add(i);return rn(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&&fo(e.value)===""}lowerNode(e){switch(e.kind){case"Text":{if(e.raw)return{kind:"text",value:e.value};let t=Qr(fo(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:`() => ${M(this.hole(t.value.hole).code,"arrowBody")}`}),s}let r=this.lowerEach(e),n=r?[r]:this.lowerChildren(e.children);if(e.tag===Ff)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(v=>v.name===u);y>=0?r[y]=p:r.push(p)}let o=e.attributes.find(u=>u.kind==="LoadDirective");if(o?.dynamic)throw new Je(`'load:${o.strategy}' needs a literal value, not an expression: the strategy is compile-time.`);let s=o?$c(`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?`() => ${M(i.body,"arrowBody")}`:M(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=`() => ${M(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=`() => ${M(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}, () => ${M(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?`() => ${M(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"+il(e.name),kind:"event",event:{name:t,delegated:nl.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"+il(i),kind:"event",event:{name:i,delegated:nl.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=Qr(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 Vf(Qr(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 ol(e,t,r,n={}){let{root:i,diagnostics:o}=an(e,{svg:n.svg});for(let s of o){if(s.severity==="error"){let a=n.positionAt?.(s.loc.start);throw new Error(`html template${a?` (${a.line}:${a.column+1})`:""}: ${s.message}`)}n.onDiagnostic?.(s)}return new zf(t,r,n.sourceFile,n.positionAt).lowerRoot(i.children)}function Kf(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 sl(e){let t=[],r=new Map,n=i=>{switch(i.kind){case"text":return!0;case"expr":return!1;case"component":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=Kf(a),s)break;return!s&&!o&&(s=Uf(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 Uf(e){for(let t of e.children){if(t.kind==="expr")return"expression-child";if(t.kind==="component")return"component-child";if(t.kind==="element"&&!t.static||t.kind==="fragment")return"expression-child"}return"expression-child"}var Jf=e=>"components"in e;function al(e,t){return e.replace(/\$(\d+)/g,(r,n)=>t[Number(n)]??r)}function Gf(e,t){return typeof t=="string"?{module:t,export:e}:t}function cl(e=[]){let t=new Map,r=[],n=[];for(let s of e){if(!Jf(s)){n.push(s);continue}for(let[a,c]of Object.entries(s.components)){let u=Gf(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:al(c.module,u),export:c.export?al(c.export,u):s};break}}return i.set(s,a),a},names:()=>[...t.keys()],conflicts:()=>r}}var ll="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xf=new Uint8Array(64),Yf=new Uint8Array(128);for(let e=0;e<ll.length;e++){let t=ll.charCodeAt(e);Xf[e]=t,Yf[t]=e}var Tg=1024*16;var ul="data-fx-s";function fl(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===ul)&&n.props.unshift({name:ul,kind:"attr",literal:t.scope})};r(e)}function Zf(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 go(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 pl(Zf(e),e.holes,t)}function pl(e,t,r={}){let n=new Set,i=[],o=ol(e,[...t],n,{onDiagnostic:u=>i.push({code:u.code,message:u.message,offset:u.loc.start}),svg:r.svg,...r.sourceFile?{sourceFile:r.sourceFile}:{},...r.positionAt?{positionAt:r.positionAt}:{}});r.templateStyles&&fl(o,r.templateStyles),sl(o),Tc(o,{resolver:cl(r.resolve??[]),modules:{controlFlowModule:r.controlFlowModule??"@fluixi/dom",coreModule:r.coreModule??"@fluixi/core",routerModule:r.routerModule??"@fluixi/core/router"},strategyFor:u=>u.load}),Nc(o);let{code:s,imports:a,templates:c}=nn.emit(o,{templateClone:r.templateClone,partialTemplates:r.partialTemplates});for(let u of a)n.add(u);return r.hoistTemplates?{...i.length?{diagnostics:i}:{},code:s,imports:[...n],ir:o,templates:c}:{...i.length?{diagnostics:i}:{},code:rn(s,c),imports:[...n],ir:o}}function Qf(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 vo(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)Qf(o,t);if(i)for(let o of n.children)o.kind==="Expression"&&t.set(o.hole,"render");vo(n.children,t,r);break}case"Root":case"Fragment":vo(n.children,t,r);break;default:break}}function dl(e){let t=new Map,r=new Set;return vo(e.root.children,t,r),{holes:t,components:r}}var bo={...Gi,createMemo:S},ep=["For","Index","Show","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense"],So=new Map;function ml(e){for(let[t,r]of Object.entries(e))So.set(t,r)}function tp(e){return e==="text"||e==="attr"||e==="control"}function rp(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"&&tp(i)?{code:`$$v[${n}]()`,reactive:!0}:{code:`$$v[${n}]`,reactive:!1}})}function np(e){if(So.has(e))return So.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 ip(e,t,r){let n=e,i=rl(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}=dl(i),{code:c,imports:u}=go({statics:n,holes:rp(t,s)},{svg:r}),l=u.filter(d=>!(d in bo));if(l.length>0)throw new Error(`[fluixi] no runtime binding for: ${l.join(", ")}`);let f=Array.from(new Set([...u,...ep])).filter(d=>d in bo),p=Array.from(a).filter(d=>!f.includes(d)),y=[...f,...p],v=new Function(...y,"$$v",`return (${c});`);return{run:d=>v(...f.map(b=>bo[b]),...p.map(np),d)}}var hl=new WeakMap;function op(e){let t="";for(let r of e)t+=typeof r=="function"?"f":"v";return t}function yl(e){return(t,...r)=>{let n=hl.get(t);n||(n=new Map,hl.set(t,n));let i=op(r),o=n.get(i);return o||(o=ip(t,r,e),n.set(i,o)),o.run(r)}}var gl=yl(!1),vl=yl(!0);return kl(sp);})();
1
+ /*! @fluixi/template-runtime v1.0.0-alpha.113 | (c) 2026 Ibrahima Touré and Fluixi contributors | MIT */
2
+ "use strict";var Fluixi=(()=>{var rn=Object.defineProperty;var pl=Object.getOwnPropertyDescriptor;var dl=Object.getOwnPropertyNames;var hl=Object.prototype.hasOwnProperty;var ho=(e,t)=>{for(var r in t)rn(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&&rn(e,i,{get:()=>t[i],enumerable:!(n=pl(t,i))||n.enumerable});return e};var yl=e=>ml(rn({},"__esModule",{value:!0}),e);var sp={};ho(sp,{Dynamic:()=>xr,ErrorBoundary:()=>Tr,For:()=>Or,Index:()=>_r,Match:()=>pr,Portal:()=>ur,Show:()=>fr,Switch:()=>dr,batch:()=>I,define:()=>al,effect:()=>On,html:()=>ll,hydrate:()=>xe,insert:()=>N,memo:()=>Tn,onCleanup:()=>C,render:()=>be,resource:()=>An,signal:()=>Cn,store:()=>bi,svg:()=>ul,untrack:()=>x});var Vi={};ho(Vi,{ALWAYS_ATTRIBUTE:()=>In,ClientOnly:()=>pi,Dynamic:()=>xr,ErrorBoundary:()=>Tr,ErrorResetContext:()=>Ci,FX_DATA_ID:()=>Rt,For:()=>Or,HYDRATION_KEY:()=>K,Index:()=>_r,Island:()=>pc,JSX_PROPERTIES:()=>nt,Match:()=>pr,NoSsr:()=>ra,Portal:()=>ur,SERVER_PROPS:()=>Nn,SVG_ELEMENTS:()=>Jo,SVG_NAMESPACE:()=>tt,Show:()=>fr,Switch:()=>dr,VERSION:()=>Gt,VERSION_ATTRIBUTE:()=>it,VOID_ELEMENTS:()=>zo,addClass:()=>Mn,addDelegatedEventListener:()=>rr,addNativeEventListener:()=>ir,afterHydrationPass:()=>ks,appendChildren:()=>Bn,appendResponseHeader:()=>Ta,applyElementProp:()=>rt,applyProps:()=>mt,applyUse:()=>or,asComponent:()=>st,asContext:()=>_s,asOutlet:()=>Ts,asProvider:()=>Os,asRoute:()=>Cs,asRouter:()=>As,asRoutes:()=>Rs,asSuspense:()=>Ns,beforeFirstRender:()=>$a,beginAppHydration:()=>Ss,bindPair:()=>ui,captureHydrationCursor:()=>gs,checkRenderType:()=>Ds,classMap:()=>ta,cleanChildren:()=>Q,clearHydrationKeys:()=>Hr,cloneTemplate:()=>nr,closest:()=>Xo,createComponent:()=>we,createDynamicElement:()=>wr,createElement:()=>Wn,createNativeElement:()=>ve,createPortal:()=>li,createRequestContext:()=>bt,createTemplate:()=>ut,createUniqueId:()=>Ja,css:()=>yc,default:()=>Qu,deferElement:()=>Is,delegate:()=>rs,delegateEvents:()=>lt,endAppHydration:()=>ws,endRequestContext:()=>wt,endRequestScope:()=>ki,errorResponseStatus:()=>Cr,escapeFxJson:()=>Ir,escapeHTML:()=>Zs,fnName:()=>qs,generateID:()=>js,getAttribute:()=>jn,getGlobal:()=>us,getLocals:()=>Ca,getOffset:()=>ts,getRequestContext:()=>B,getRequestEvent:()=>Ar,getRequestLocals:()=>Ai,getServerData:()=>Mr,getStableElementId:()=>Ls,getStyle:()=>Zo,handleRef:()=>ge,hasClass:()=>Yo,holeContent:()=>dt,holeEnd:()=>pt,holeScope:()=>ft,html:()=>hc,hydrate:()=>xe,hydrateAdvancePast:()=>Ie,hydrateChildren:()=>uc,hydrateIslands:()=>dc,indexArray:()=>Ce,initializeIntegration:()=>va,insert:()=>N,insertExpression:()=>ht,installElementObjects:()=>zs,intergartionInitialized:()=>ga,isAccessor:()=>Qs,isAppHydrationPending:()=>xs,isAttributeOnlyName:()=>_e,isComponent:()=>U,isContext:()=>Zn,isCustomElement:()=>_n,isDOMNode:()=>cs,isDelegatedEvent:()=>Ws,isDomElement:()=>Ut,isDomNode:()=>he,isDomText:()=>Kt,isEventHandler:()=>Uo,isFunction:()=>Vs,isHydrating:()=>$s,isIntegrationInitialized:()=>Si,isJSXTemplate:()=>as,isNativeElement:()=>Ys,isOutlet:()=>Xn,isPromise:()=>lr,isProvider:()=>Yn,isReactElement:()=>ss,isRoute:()=>Gn,isRouter:()=>zn,isRoutes:()=>Jn,isSVGElement:()=>cr,isServer:()=>E,isSuspense:()=>Qn,isVisible:()=>Qo,iterateFn:()=>Fs,keepServerContent:()=>Ks,keyArray:()=>Re,makeArrayFlat:()=>si,mapArray:()=>Ae,mergeProps:()=>ci,observeIntersection:()=>is,observeResize:()=>os,onRequestEnd:()=>ka,prepareRender:()=>Aa,query:()=>zt,queryAll:()=>Go,registerCoreVersion:()=>fs,registerCreateComponent:()=>ya,registerGlobal:()=>ls,removeAttribute:()=>Hn,removeChildren:()=>Vn,removeClass:()=>Pn,removeDelegatedEventListener:()=>at,removeUnclaimedKeyed:()=>Wr,render:()=>be,renderStarted:()=>Ra,renderToString:()=>tc,renderToStringAsync:()=>nc,requestScope:()=>St,resetIntegration:()=>wi,resetOnNavigation:()=>Ti,runHydrationAt:()=>De,runWithRequestContext:()=>xt,runWithoutHydration:()=>bs,scrollIntoView:()=>es,serializeNode:()=>Y,serializeResourceData:()=>Hi,serverCustomElementProp:()=>Oe,setAttribute:()=>j,setClassList:()=>ae,setClassName:()=>ye,setDataRedactor:()=>rc,setDynamicAttribute:()=>Le,setDynamicBoolAttribute:()=>sr,setDynamicClassList:()=>Xs,setDynamicProperty:()=>je,setDynamicStyle:()=>Gs,setKeyScope:()=>Xa,setProperty:()=>se,setRequestStore:()=>Ei,setRequestStoreIfUnset:()=>Ea,setResponseRedirect:()=>_a,setResponseStatus:()=>Rr,setServerMode:()=>de,setStyle:()=>ee,setStyles:()=>Jt,shouldSetAsProperty:()=>Ko,splitProps:()=>ar,spread:()=>ai,stampVersions:()=>ps,styleMap:()=>ea,svg:()=>mc,takeResponseHeaders:()=>Oa,takeResponseRedirect:()=>Da,takeResponseStatus:()=>Na,takesBooleanText:()=>Dn,template:()=>oi,templateNode:()=>ii,toAttributeName:()=>Fo,toggleClass:()=>Ln,useHydrationKeys:()=>ue,versionMark:()=>qn,versions:()=>V,waitForElement:()=>ns,warnOnVersionSkew:()=>ds,whenAppHydrated:()=>Es});var Dt=Symbol.for("fluixi-proxy");var ie="1.0.0-alpha.113";var yo=ie.split(".")[0],mo=`__fluixi_signal_state_v${yo}__`,vo=`__fluixi_signal_builds_v${yo}__`,vl=e=>{typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e)};function go(){return{consumer:null,untracked:!1,owner:null,queue:[],scheduled:!1,flushing:!1,batchDepth:0,hostSchedule:vl,onSuspend:null,onError:null,observer:null,hot:null}}var It=globalThis;function gl(e){let t=go(),r=e;for(let n of Object.keys(t))n in e||(r[n]=t[n]);return e}function bl(){let e=It[mo];return e?gl(e):It[mo]=go()}var m=bl();(It[vo]??=[]).push(ie);function nn(){return[...new Set(It[vo]??[])]}function Sl(e){return m.observer=e,()=>{m.observer===e&&(m.observer=null)}}var wo=[],Mt;function xo(e,t){if(!m.observer)return t();let r=Mt;Mt=e;try{return t()}finally{Mt=r}}var bo;function Eo(e){let t=m.observer;t&&t.created(e.parents===void 0?{...e,parents:wo,origin:e.origin??Mt,scope:e.scope??bo}:{...e,scope:e.scope??bo})}function ko(){wo.pop()}function on(e,t,r){m.observer?.moved?.(e,t,r)}function sn(e){m.observer?.disposed?.(e)}var wl="__FLUIXI_DEVTOOLS_HOOK__",So=globalThis[wl];if(typeof So?.inject=="function")try{So.inject({observeReactiveNodes:Sl,version:ie})}catch{}function Pt(){return m.observer!=null}var $o=0,Ao=1,Je=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))}},Co=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++,this.observers)for(let t of[...this.observers])t.markDirty(Je);an(this)}}peek(){return this._value}},Lt=class extends Ro{constructor(e,t){super(),this._threw=!1,this._initialized=!1,this._disposed=!1,this.state=Je,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===Ao&&this.sources){for(let e of this.sources)if(e.updateIfNecessary(),this.state===Je)break}(this.state===Je||!this._initialized)&&this.recompute(),this.state=$o}}recompute(){if(this.sources){for(let s of this.sources)s.observers?.delete(this);this.sources.clear()}let e=m.consumer,t=m.untracked,r=!1;m.consumer=this,m.untracked=!1;let n,i=!1,o;try{n=this._fn()}catch(s){i=!0,o=s,n=this._value}finally{m.consumer=e,m.untracked=t,r&&ko()}let a=!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,a){if(this.version++,this.observers)for(let s of this.observers)s.markDirty(Je);an(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(Ao);an(this)}}peek(){if(this.updateIfNecessary(),this._threw)throw this._error;return this._value}};function an(e){if(e.watchers)for(let t of[...e.watchers])t._notify(e)}function jt(e){if(m.untracked)return e();m.untracked=!0;try{return e()}finally{m.untracked=!1}}function F(e){let t=Xe(e);return e&&(e.owned??=[]).push(t),t}function G(e,t=!0){Ge(e,t)}function Xe(e){return{cleanups:null,owned:null,parent:e,contexts:null}}function Ht(e,t){let r=Symbol(t??"context");return{id:r,defaultValue:e,Provider:i=>{let o=m.owner,a=Xe(o);(a.contexts=new Map).set(r,i.value),o&&(o.owned??=[]).push(a),m.owner=a;try{return i.children}finally{m.owner=o}}}}function Wt(e){let t=m.owner;for(;t;){if(t.contexts&&t.contexts.has(e.id))return t.contexts.get(e.id);t=t.parent}return 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 Vt(e,t,r){let n=Xe(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 k(){return m.owner}function R(e,t){let r=m.owner;m.owner=e;try{return t()}finally{m.owner=r}}function C(e){if(m.owner){if(m.owner.disposed){e();return}(m.owner.cleanups??=[]).push(e)}}function Ge(e,t=!0){if(!e.disposed){if(e.owned){for(let r=e.owned.length-1;r>=0;r--)Ge(e.owned[r]);e.owned=null}if(e.cleanups){for(let r=e.cleanups.length-1;r>=0;r--)e.cleanups[r]();e.cleanups=null}t&&(e.disposed=!0)}}function W(e){let t=Xe(m.owner);m.owner&&(m.owner.owned??=[]).push(t);let r=m.owner;m.owner=t;try{return jt(()=>e(()=>Ge(t)))}finally{m.owner=r}}function No(e){m.hostSchedule=e??(t=>{Promise.resolve().then(t)})}function xl(e){e.queued||(e.queued=!0,m.queue.push(e),!m.scheduled&&m.batchDepth===0&&(m.scheduled=!0,m.hostSchedule(Ye)))}function Ye(){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 Do(){m.batchDepth===0&&Ye()}function Io(e){m.batchDepth++;try{return e()}finally{--m.batchDepth===0&&Ye()}}var El=class extends Lt{constructor(e,t=!1,r){let n=null;super(()=>{Ge(n,!1),R(n,()=>{let a=e();typeof a=="function"&&(n.cleanups??=[]).push(a)})}),this.queued=!1,this.disposed=!1;let i=m.owner;this.owner=Xe(i),n=this.owner,this.run();let o=this.owner;if(!this.disposed&&!this.sources?.size&&!o.cleanups&&!o.owned&&!o.contexts){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&&xl(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,super.dispose(),Ge(this.owner))}};function cn(e,t=!1,r){let n=new El(e,t,r);return()=>n.dispose()}function kl(e){return!!e&&typeof e.then=="function"}No(()=>{});var Mo=Symbol.for("signal"),$l=Symbol.for("memo"),Al=Symbol.for("signal-node");function O(e,t){let r=m.hot,n=e;r&&(e=r.take("signal",e));let i=new Co(e,{equals:t?.equals}),o=(()=>i.get()),a=(s=>{let c=typeof s=="function"?s(i.peek()):s;return i.set(c),Do(),c});return o[Mo]=!0,o[Al]=i,r&&r.keep(()=>i.peek(),()=>a(()=>n)),[o,a]}function w(e,t,r){let n=t,i=k(),o=new Lt(()=>R(i,()=>{try{return n=e(n)}catch(s){if(kl(s))return Oo(s),n;throw s}}),{equals:r?.equals}),a=(()=>o.get());return Object.defineProperty(a,Mo,{value:!0,enumerable:!0}),Object.defineProperty(a,$l,{value:!0,enumerable:!0}),C(()=>{o.dispose()}),a}function D(e,t,r){let n=t;return cn(()=>{n=e(n)},!0,r?.name)}function $(e,t){let r=t;return cn(()=>{r=e(r)})}function I(e){return Io(e)}function x(e){return jt(e)}var ke=globalThis[Symbol.for("fluixi.transition")]??={depth:0,loads:new Set,pending:void 0};function Rl(){return ke.pending??=O(0)}function Po(){return ke.depth>0}function Lo(e){let[,t]=Rl();ke.loads.add(e),t(ke.loads.size);let r=()=>{ke.loads.delete(e),t(ke.loads.size)};e.then(r,r)}function Bt(){return Ye(),Promise.resolve()}var jo=Ht();_o((e,t)=>{let r=To(t,jo);return r?(r.caught=()=>e,m.consumer?queueMicrotask(()=>r.setError(e)):r.setError(e),!0):!1});function ln(){let[e,t]=O(void 0,{equals:!1}),r={error:e,caught:()=>{},reset:()=>{r.caught=()=>{},t(()=>{})},setError:n=>{r.caught=()=>n,t(()=>n)}};return r}function un(e,t){return Vt(jo,e,t)}var Cl=typeof window>"u"?!1:window.__FLUIXI_PROD__===!0,qt=typeof process>"u"?Cl:!1,Tl=Symbol.for("signal");function A(e){return typeof e=="function"&&e[Tl]===!0}function Ol(e,t){return()=>{let r=F(t);return C(()=>{G(r);let n=t.owned,i=n?n.indexOf(r):-1;i>=0&&n.splice(i,1)}),R(r,e)}}function Ho(e,t){return typeof e=="function"?A(e)||e.length?e:Ol(e,t):Array.isArray(e)?e.map(r=>Ho(r,t)):e}function fn(e,t){let r=Ht(e,t),n=r.Provider;return{...r,Provider:o=>n({get value(){return o.value},get debug(){return o.debug},get children(){let a=k(),s=o.children;return a?Ho(s,a):s}})}}var pn=null;function yn(e){pn=e}function vn(e){pn&&pn(e)}var dn=null;function gn(e){dn=e}function bn(e){return dn?dn(e):void 0}var hn=null;function Ze(e){hn=e}function Sn(){return hn?hn():void 0}var mn=null;function wn(e){mn=e}function xn(e,t){mn&&mn(e,t)}function En(){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 _l=null;function kn(e){_l=e}function Nl(e){return!!e&&typeof e.then=="function"}var $n=Symbol();function Wo(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:Sn(),a=o!==void 0?bn(o):void 0,s=a!==void 0,c=m.hot;m.hot=null;let[u,l]=O(a!==void 0?a.value:r.initialValue,{equals:!1}),[f,d]=O(void 0,{equals:!1}),y=!1,[v,p]=O(a!==void 0||r.initialValue!==void 0?"ready":"unresolved",{equals:!1}),[b,T]=O(void 0,{equals:!1}),[S,g]=O(void 0,{equals:!1});m.hot=c;let L=$n,H=!1;D(()=>{let _=n();if(S(),_===!1||_===null||_===void 0){L=$n,I(()=>{p("unresolved"),T(void 0),d(void 0)});return}let Ot=H;if(H=!1,L!==$n&&_===L&&!Ot)return;if(L=_,s){s=!1;return}let _t=!1;C(()=>_t=!0);let po=x(v),fl=x(u),tn=po==="ready"||po==="refreshing";y=tn&&Po(),I(()=>{p(tn?"refreshing":"pending"),d(void 0)});try{let ne=i(_,{value:fl,refetching:tn});Nl(ne)?(T(ne),y&&Lo(ne),vn(ne),ne.then(Nt=>{_t||(o!==void 0&&xn(o,Nt),I(()=>{l(()=>Nt),p("ready"),T(void 0)}))},Nt=>{_t||I(()=>{d(Nt),p("errored"),T(void 0)})})):I(()=>{l(()=>ne),p("ready"),T(void 0)})}catch(ne){if(_t)return;I(()=>{d(ne),p("errored"),T(void 0)})}});let J=()=>{let _=v();return _==="pending"||_==="refreshing"},ze=(()=>{let _=f();if(_)throw _;if(J()&&!(y&&v()==="refreshing")){let Ot=b();if(Ot)throw Ot}return u()});return Object.defineProperties(ze,{state:{get:v},loading:{get:J},error:{get:f},latest:{get:u}}),Object.defineProperty(ze,Symbol.for("resource"),{value:!0,enumerable:!0}),Object.defineProperty(ze,Symbol.for("signal"),{value:!0,enumerable:!0}),[ze,{mutate:l,refetch:()=>{H=!0,g(void 0)}}]}function An(...e){let[t,r]=Wo(...e);return Object.assign(t,r)}function Rn(e){let t=m.hot;if(!t)return e();m.hot=null;try{return e()}finally{m.hot=t}}function Cn(e,t){let[r,n]=O(e,t);return r.set=n,r}function Tn(e,t,r){return w(e,t,r)}function On(e,t,r){return D(e,t,r)}function Ft(e){if(typeof e=="function"&&!e.length){let t=e();return A(t)?t:Ft(t)}if(Array.isArray(e)){let t=[];for(let r=0;r<e.length;r++){let n=Ft(e[r]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function $e(e){let t=w(e);return qt?w(()=>Ft(t()),void 0,{name:"children"}):w(()=>Ft(t()))}function Bo(e){let t=e,r=null;return{index:()=>(r||(r=O(t,{name:"row index"})),r[0]()),set:n=>{t=n,r&&r[1](n)}}}function Ae(e,t,r){let n=[];return C(()=>{for(let i of n)i.dispose();n=[]}),w(()=>{let i=e()||[];return x(()=>{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 a=[],s=new Set;for(let c=0;c<i.length;c++){let u=i[c],l=o.get(u);if(l&&!s.has(l))l.setIndex(c),a.push(l),s.add(l);else{let f,d,y;W(p=>{y=p;let b=Bo(c);d=b.set,f=t(u,b.index)});let v={item:u,rendered:f,dispose:y,setIndex:d};a.push(v),s.add(v)}}for(let c of n)s.has(c)||c.dispose();return n=a,a.map(c=>c.rendered)})},void 0,{name:"mapArray"})}function Re(e,t,r,n){let i=[],o=[];return C(()=>{for(let a of o)a.dispose();i=[],o=[]}),w(()=>{let a=e()||[];return x(()=>{if(a.length===0){for(let f of o)f.dispose();return i=[],o=[],n?.fallback?n.fallback():[]}let s=new Map;for(let f=0;f<i.length;f++)s.set(i[f],o[f]);let c=[],u=[],l=new Set;for(let f=0;f<a.length;f++){let d=t(a[f]),y=s.get(d);if(y&&!l.has(d))y.setIndex(f),y.setItem(a[f]),c.push(y);else{let v,p,b,T;W(S=>{T=S;let g=Bo(f);p=g.set;let[L,H]=O(a[f]);b=J=>H(()=>J),v=r(L,g.index)}),c.push({rendered:v,dispose:T,setIndex:p,setItem:b})}u.push(d),l.add(d)}for(let[f,d]of s)l.has(f)||d.dispose();return i=u,o=c,c.map(f=>f.rendered)})},void 0,{name:"keyArray"})}function Ce(e,t,r){let n=[];return C(()=>{for(let i of n)i.dispose();n=[]}),w(()=>{let i=e()||[];return x(()=>{if(i.length===0){for(let c of n)c.dispose();return n=[],r?.fallback?r.fallback():[]}let o=n.length,a=i.length;for(let c=o;c<a;c++){let u,l,f,d=i[c];W(y=>{f=y;let[v,p]=O(d);l=p,u=t(v,c)}),n.push({rendered:u,setItem:l,dispose:f})}for(let c=a;c<o;c++)n[c].dispose();a<o&&(n=n.slice(0,a));let s=Math.min(o,a);for(let c=0;c<s;c++)n[c].setItem(i[c]);return n.map(c=>c.rendered)})},void 0,{name:"indexArray"})}var et=Symbol.for("fluixi.server-node"),Fl=Symbol.for("fluixi.dom.server-host"),Ul=globalThis,Qe=Ul[Fl]??={server:typeof document>"u",nodes:null};function E(){return Qe.server}function de(e){Qe.server=e}function qo(e){Qe.nodes=e}function Te(){if(!Qe.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return Qe.nodes}function he(e){return e!=null&&e[et]===!0?!0:typeof Node<"u"&&e instanceof Node}function Ut(e){return e!=null&&e[et]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Kt(e){return e!=null&&e[et]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}function Fo(e){return e.startsWith("aria-")||e.startsWith("data-")?e:/[A-Z]/.test(e)?e.replace(/([A-Z])/g,"-$1").toLowerCase():e}function Uo(e){return e.startsWith("@")||e.startsWith("on")&&e.length>2}function Ko(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 zo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Jo=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"]),tt="http://www.w3.org/2000/svg";function _n(e){return e.localName.includes("-")}function rt(e,t,r,n=!1){if(r==null){e.removeAttribute(t);return}if(_n(e)){if(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E()){Oe(e,t,r);return}e[t]=r;return}j(e,t,r,n)}var Nn=Symbol.for("fluixi.serverProps");function Oe(e,t,r){let n=e[Nn]??={};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 Kl=new Set(["draggable","spellcheck","contenteditable"]);function Dn(e){return e.startsWith("aria-")||Kl.has(e.toLowerCase())}var nt=new Set(["className","value","checked","selected","innerHTML","innerText","textContent","indeterminate","htmlFor"]),In=new Set(["id","class","className","style","slot","part","exportparts","is","title","role","lang","dir","tabindex","hidden"]);function _e(e){return In.has(e)||e.startsWith("aria-")||e.startsWith("data-")}function zt(e,t=document){return t.querySelector(e)}function Go(e,t=document){return Array.from(t.querySelectorAll(e))}function Xo(e,t){return e.closest(t)}function Mn(e,...t){e.classList.add(...t)}function Pn(e,...t){e.classList.remove(...t)}function Ln(e,...t){t.forEach(r=>e.classList.toggle(r))}function Yo(e,t){return e.classList.contains(t)}function j(e,t,r,n=!1){if(typeof r=="boolean"&&Dn(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 jn(e,t){return e.getAttribute(t)}function Hn(e,t){e.removeAttribute(t)}function Jt(e,t){Object.assign(e.style,t)}function Zo(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function Wn(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")Jt(n,o);else if(i.startsWith("on")&&typeof o=="function"){let a=i.slice(2).toLowerCase();n.addEventListener(a,o)}else j(n,i,o)}),r.forEach(i=>{typeof i=="string"?n.appendChild(document.createTextNode(i)):n.appendChild(i)}),n}function Vn(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Bn(e,...t){t.forEach(r=>{typeof r=="string"?e.appendChild(document.createTextNode(r)):e.appendChild(r)})}function Qo(e){let t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=window.innerHeight&&t.right<=window.innerWidth}function es(e,t={behavior:"smooth",block:"nearest"}){e.scrollIntoView(t)}function ts(e){let t=e.getBoundingClientRect();return{top:t.top+window.pageYOffset,left:t.left+window.pageXOffset}}function rs(e,t,r,n){let i=o=>{let a=o.target.closest(r);a&&e.contains(a)&&n(o,a)};return e.addEventListener(t,i),()=>{e.removeEventListener(t,i)}}function ns(e,t=5e3){return new Promise((r,n)=>{let i=zt(e);if(i){r(i);return}let o=new MutationObserver(()=>{let s=zt(e);s&&(o.disconnect(),clearTimeout(a),r(s))});o.observe(document.body,{childList:!0,subtree:!0});let a=setTimeout(()=>{o.disconnect(),n(new Error(`Element ${e} not found within ${t}ms`))},t)})}function is(e,t,r={}){let n=new IntersectionObserver(i=>{i.forEach(o=>{t(o.isIntersecting)})},r);return n.observe(e),()=>{n.disconnect()}}function os(e,t){let r=new ResizeObserver(n=>{n.forEach(t)});return r.observe(e),()=>{r.disconnect()}}var zl=typeof Symbol=="function"&&Symbol.for?Symbol.for("react.element"):60103;function ss(e){return typeof e=="object"&&e!==null&&e.$$typeof===zl}function as(e){return typeof e=="object"&&e!==null&&(e.$$typeof==="template"||typeof e.type=="function")}function cs(e){return e instanceof Node}function ls(e,t,r="Fluixi"){typeof globalThis<"u"&&(typeof globalThis[r]>"u"&&(globalThis[r]={}),typeof globalThis[r][e]>"u"&&(globalThis[r][e]=t))}function us(e,t,r="Fluixi"){return typeof globalThis<"u"&&typeof globalThis[r]<"u"&&typeof globalThis[r][e]<"u"?globalThis[r][e]:t}var Gt="1.0.0-alpha.113";var V={dom:Gt,reactive:ie};function fs(e){V.core=e}var it="data-fluixi";function qn(){return Jl()?"":V.core??V.dom}function Jl(){try{return!0}catch{return!1}}function ps(e){if(e.setAttribute(it,qn()),typeof globalThis>"u")return;let t=globalThis.Fluixi;t&&typeof t=="object"&&Object.values(t).some(r=>typeof r=="function")?t.versions=V:globalThis.Fluixi=V}function ds(){let e=nn();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=[V.core,V.dom,V.reactive].filter(r=>r!==void 0);new Set(t).size<=1||console.warn(`[fluixi] package versions disagree: core ${V.core??"(absent)"}, dom ${V.dom}, reactive ${V.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 h={active:!1,cursor:null,parents:[]},Ne="__fx_at",K="data-hk",hs=null;function ms(e){hs=e}function X(){return hs}var ys=null;function vs(e){ys=e}function ot(){return ys}function Un(e,t){return h.active&&t.parentNode===e}function Xt(e){let t=h.parents.lastIndexOf(e);t!==-1&&(h.parents.length=t),h.cursor=e.nextSibling}function gs(){return h.active?h.cursor:null}function De(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 bs(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 Ie(e){if(!h.active||e==null)return;let t=Array.isArray(e)?e[e.length-1]:e;t&&typeof t.nodeType=="number"&&Xt(t)}function Yt(){let e=globalThis;return e[Symbol.for("fluixi.appHydration")]??={pending:0,waiting:new Set}}function Ss(){Yt().pending++}function ws(){let e=Yt();if(e.pending>0&&e.pending--,e.pending>0)return;let t=[...e.waiting];e.waiting.clear();for(let r of t)r()}function xs(){return Yt().pending>0}function Es(e){let t=Yt();return t.waiting.add(e),()=>t.waiting.delete(e)}var Fn=[];function ks(e){h.active?Fn.push(e):e()}function Kn(){for(;Fn.length>0;){let e=Fn.shift();try{e()}catch(t){console.error(t)}}}function $s(){return h.active}function As(e){return Object.defineProperty(e,Symbol.for("fluixi-router"),{value:!0,enumerable:!0}),e}function Rs(e){return Object.defineProperty(e,Symbol.for("fluixi-routes"),{value:!0,enumerable:!0}),e}function Cs(e){return Object.defineProperty(e,Symbol.for("fluixi-route"),{value:!0,enumerable:!0}),e}function Ts(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-outlet"),{value:!0,enumerable:!0}),e}function Os(e){return Object.defineProperty(e,Symbol.for("fluixi-provider"),{value:!0,enumerable:!0}),e}function _s(e){return Object.defineProperty(e,Symbol.for("fluixi-context"),{value:!0,enumerable:!0}),e}function st(e){return typeof e!="function"||Object.defineProperty(e,Symbol.for("fluixi-component"),{value:!0,enumerable:!0}),e}function Ns(e){return Object.defineProperty(e,Symbol.for("fluixi-suspense"),{value:!0,enumerable:!0}),e}function zn(e){return typeof e=="function"&&e[Symbol.for("fluixi-router")]===!0}function Jn(e){return typeof e=="function"&&e[Symbol.for("fluixi-routes")]===!0}function Gn(e){return typeof e=="function"&&e[Symbol.for("fluixi-route")]===!0}function Xn(e){return typeof e=="function"&&e[Symbol.for("fluixi-outlet")]===!0}function Yn(e){return typeof e=="function"&&e[Symbol.for("fluixi-provider")]===!0}function Zn(e){return typeof e=="function"&&e[Symbol.for("fluixi-context")]===!0}function U(e){return typeof e=="function"&&e[Symbol.for("fluixi-component")]===!0}function Qn(e){return typeof e=="function"&&e[Symbol.for("fluixi-suspense")]===!0}function Ds(e){return zn(e)?{type:"router",value:e}:Gn(e)?{type:"route",value:e}:Jn(e)?{type:"routes",value:e}:Xn(e)?{type:"outlet",value:e}:U(e)?{type:"component",value:e}:Qn(e)?{type:"suspense",value:e}:Yn(e)?{type:"provider",value:e}:Zn(e)?{type:"context",value:e}:{type:"none",value:e}}function Is(e){if(E()||!h.active)return e();let t=k();return st(()=>R(t,e))}function Gl(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 Xl(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 Ls(e){return Xl(Gl(e))}var js=()=>"xxyxxxxxxy-4xx8".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Ms={},Hs="__fx_loc";function ei(e,t){return e}var Ps=new Map,Yl="__fluixi_delegated_events__",ni=globalThis[Yl]??={names:new Set},Qt=ni.names,tr=new Set(["scroll","focus","blur","load","error","resize","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture"]);function lt(e){if(!(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E()))for(let t of e)Qt.has(t)||tr.has(t)||(Qt.add(t),ni.dispatch??=Zl,document.addEventListener(t,ni.dispatch))}function Zl(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 rr(e,t,r){if(e[`$$${t}`]=r,tr.has(t)){let n=`__fx_${t}`;if(!e[n]){let i=o=>{e[`$$${t}`]?.(o)};e.addEventListener(t,i),e[n]=i}return}Qt.has(t)||lt([t])}function at(e,t){delete e[`$$${t}`];let r=`__fx_${t}`,n=e[r];n&&(e.removeEventListener(t,n),delete e[r])}function Ws(e){return!tr.has(e)}function Vs(e){return typeof e=="function"}function Pe(e,t=!1){if(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E())return Te().createText(e);if(h.active&&!t){let r=ot()?.hydrateText(e);if(r)return r}return document.createTextNode(e)}function ve(e,t=!1,r){let n=X(),i=n?n.next():null;if(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E()){let o=Te().createElement(e,t);return i&&o.setAttribute(K,i),o}if(h.active){let o=n?n.claim(i,e):null;if(o)return ot()?.enterElement(o),e.includes("-")&&n?.handOwner(o),r?ei(o,r):o;let a=ot()?.hydrateElement(e);if(a)return e.includes("-")&&n?.handOwner(a),r?ei(a,r):a}return ei(t?document.createElementNS(tt,e):document.createElement(e),r)}function ut(e,t=!1){let r=Ps.get(e);if(r)return r;let n=document.createElement("template");return t?n.innerHTML=`<svg>${e}</svg>`:n.innerHTML=e,Ps.set(e,n),n}function ii(e,t,r=!1,n=!1,i){let o=X(),a=o?o.salt(e):"",s=o?o.next(a):null;if(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E()){let c=Te();if(r){let u=c.parseTemplate(e,n);return s&&u.setAttribute(K,s),u}return c.createRaw(s?Ql(e,s):e)}if(h.active){let c=o?o.claim(s,t):null;if(c)return h.cursor=c.nextSibling,o?.handOwnerTree(c,e),Zt(c,i);let u=ot()?.hydrateStatic(t,a);if(u)return o?.handOwnerTree(u,e),Zt(u,i)}return Zt(nr(ut(e,n),n).firstChild,i)}function oi(e){let t;return r=>(t??=ut(e),Zt(Bs(t.content.firstChild),r))}function Bs(e){let t=typeof document>"u"?void 0:document;return t&&e.ownerDocument!==t?t.importNode(e,!0):e.cloneNode(!0)}function Ql(e,t){return e.replace(/^(\s*<[^\s/>]+)/,`$1 ${K}="${t}"`)}function Zt(e,t){return e}function ft(e,t){let r=h.active&&X();return r?r.holeScope(e,t):t()}function pt(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 dt(e,t){let r=[];for(let n=e.nextSibling;n&&n!==t;n=n.nextSibling)r.push(n);return r}function nr(e,t=!1){let r=Bs(e.content);return t?r.firstChild:r}function si(e){return Array.isArray(e)?e.length===2&&e[1]===" "?Array.isArray(e[0])?si(e[0]):(typeof e[0]=="function",e[0]):e.length===1&&typeof e[0]=="function"?e[0]:e:e}function qs(e){return typeof e!="function"?null:e._name||e.name||"anonymous"}function Fs(e){if(A(e)||U(e)||typeof e!="function")return e;let t=e();for(;typeof t=="function"&&!A(t)&&!U(t);)t=t();return t}var Z=0,eu=200;function tu(e,t,r,n,i){let o=n,a,s=()=>a??=new Map,c=!1;return $(()=>{let l=c&&h.active;if(c=!0,!l)return u();h.active=!1;try{return u()}finally{h.active=!0}});function u(){let l;if(U(e)&&!A(e)){if(!s().has(e)){Z++;try{let f=e();s().set(e,f)}finally{Z--}}for(l=s().get(e);typeof l=="function"&&A(l);)l=l()}else for(l=e();typeof l=="function"&&A(l);)l=l();{let f=0;for(;typeof l=="function"&&f++<50;)if(U(l)){if(!s().has(l)){let d=l;Z++;try{let y=d();s().set(d,y)}finally{Z--}}l=s().get(l)}else if(A(l))l=l();else if(l=l(),typeof l!="function"||!A(l)&&!U(l))break}Array.isArray(l)&&s(),Z++;try{o=ht(t,l,r,o,a),i(o)}finally{Z--}}}function N(e,t,r,n){if(Z>eu)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=Pe("",!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)},a=n??null,s=l=>Array.isArray(l)&&l.some(f=>typeof f=="function"),c=l=>typeof l=="function"?l:()=>l;if(typeof t!="function"&&!s(t)){Z++;try{a=ht(e,t,r,a)}finally{Z--}return o(),()=>a}let u=tu(c(t),e,r,a,l=>{a=l});return o(),()=>(u?.(),a)}var Us=Symbol.for("fluixi.keepServerContent");function Ks(e){return{[Us]:!0,adopt:e}}function ru(e){return!!e&&typeof e=="object"&&e[Us]===!0}function ht(e,t,r,n,i){if(t==null||typeof t=="boolean")return Q(e,n,r);if(typeof t=="function")for(;typeof t=="function";)t=t();if(t==null||typeof t=="boolean")return Q(e,n,r);if(ru(t)){let a=n==null?[]:Array.isArray(n)?n:[n];return X()?.keep(a),t.adopt?.(a),n??null}lr(t);let o=typeof t;if(o==="string"||o==="number"){if(o==="number"&&(t=String(t)),Array.isArray(n)){if(n.length===0){let s=Pe(t);return oe(e,s,r),s}if(n.length===1&&n[0].nodeType===3){let s=n[0];return h.active&&s.data,s.data=t,n}n=Q(e,n,r)}if(n&&Kt(n))return h.active&&n.data,n.data=t,n;let a=Pe(t);return n&&n.parentNode===e?e.replaceChild(a,n):Un(e,a)||oe(e,a,r),a}if(he(t))return Un(e,t)?(Xt(t),t):(n!==t&&iu(e,n,t,r),t);if(Array.isArray(t)){let a=[],s=Array.isArray(n)?n:n?[n]:[],c=[],u=new Set,l=()=>me(t,a,e,i,c,u),f=h.active&&s.length&&X();f?f.resume(s[0],l):l();let d=nu(e,u.size?s.filter(y=>!u.has(y)):s,a,r);for(let y of c){if(y.wired)continue;let v=N(e,y.sig,y.marker);C(()=>Q(e,v()))}return d}if(ct&&typeof t=="object"){let a=ct(t);if(a!==t)return ht(e,a,r,n)}return Q(e,n,r)}var ct=null;function zs(e){ct=e}function me(e,t,r,n,i,o){for(let a=0;a<e.length;a++){let s=e[a];if(!(s==null||typeof s=="boolean")){for(;!i&&typeof s=="function"&&!A(s)&&!U(s)&&(s=s(),!(s==null||typeof s=="boolean")););if(!(s==null||typeof s=="boolean")){if(typeof s=="function"){let c;for(U(s)&&!A(s)?(n||(n=new Map),n.has(s)||n.set(s,s()),c=n.get(s)):c=i?s:s();c!==s&&typeof c=="function"&&!A(c)&&!U(c);)n||(n=new Map),n.has(c)||n.set(c,c()),c=n.get(c);if(c==null||typeof c=="boolean")continue;if(typeof c=="function"){if(A(c)||c===s){if(i){let l=Pe("",!0);if(t.push(l),h.active&&o&&h.cursor?.parentNode===r){let f=()=>h.cursor&&h.cursor.parentNode===r?h.cursor:null,d=f();r.insertBefore(l,d);let y=N(r,c,l),v=f();for(let p=d;p&&p!==v;p=p.nextSibling)o.add(p);r.insertBefore(l,v),C(()=>Q(r,y())),i.push({marker:l,sig:c,wired:!0});continue}i.push({marker:l,sig:c});continue}let u=c();for(;typeof u=="function"&&A(u);)u=u();if(u==null||typeof u=="boolean")continue;Array.isArray(u)?me(u,t,r,n):me([u],t,r,n);continue}continue}Array.isArray(c)?me(c,t,r,n,i,o):me([c],t,r,n,i,o);continue}if(!lr(s)){if(Array.isArray(s)){me(s,t,r,n,i,o);continue}if(he(s)){h.active&&(h.cursor===s||h.parents.includes(s)||s.contains?.(h.cursor))&&Xt(s),t.push(s);continue}if(ct&&typeof s=="object"){let c=ct(s);if(c!==s){me(Array.isArray(c)?c:[c],t,r,n);continue}}if(typeof s=="string"||typeof s=="number"){let c=String(s);if(c.trim()===""&&c!==" ")continue;t.push(Pe(c));continue}t.push(Pe(String(s)))}}}}}function nu(e,t,r,n){for(let f=0;f<r.length;f++){let d=r[f].parentNode;d!==null&&d!==e&&d.nodeType!==11&&(r=r.slice(),r[f]=r[f].cloneNode(!0))}let i=r.length,o=t.length,a=i,s=0,c=0,u=o>0?t[o-1].nextSibling??void 0:n,l=null;for(;s<o||c<a;){if(t[s]===r[c]){s++,c++;continue}for(;o>s&&a>c&&t[o-1]===r[a-1];)o--,a--;if(o===s){let f=a<i?c?r[c-1].nextSibling??void 0:r[a-c]:u;for(;c<a;)oe(e,r[c++],f)}else if(a===c)for(;s<o;)(!l||!l.has(t[s]))&&t[s].parentNode===e&&e.removeChild(t[s]),s++;else if(t[s]===r[a-1]&&r[c]===t[o-1]){let f=t[--o].nextSibling;oe(e,r[c++],t[s++].nextSibling),oe(e,r[--a],f),t[o]=t[s-1]}else{if(!l){l=new Map;let d=c;for(;d<a;)l.set(r[d],d++)}let f=l.get(t[s]);if(f!=null)if(c<f&&f<a){let d=s,y=1;for(;++d<o&&d<a&&!(!l.has(t[d])||l.get(t[d])!==f+y);)y++;if(y>f-c){let v=t[s];for(;c<f;)oe(e,r[c++],v)}else t[s].parentNode===e?e.replaceChild(r[c++],t[s++]):(oe(e,r[c++],u),s++)}else s++;else t[s].parentNode===e&&e.removeChild(t[s]),s++}}return r}function iu(e,t,r,n){let i=Array.isArray(t)?t[0]:t;i&&i.parentNode===e?(e.replaceChild(r,i),Array.isArray(t)&&Q(e,t.slice(1),n)):oe(e,r,n)}function Q(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 oe(e,t,r){h.active&&t.parentNode===e||(r&&r.parentNode===e?e.insertBefore(t,r):e.appendChild(t))}function se(e,t,r){r==null?delete e[t]:e[t]=r}function ir(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 Js(e,t){if(!t||typeof t!="function")return;let r=t[Ne]?.name;!r||r.indexOf(":")}function er(e,t,r){let n=typeof r=="function"?x(()=>r()):r}function or(e,t){let r=(n,i)=>{typeof n=="function"&&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 Le(e,t,r,n=!1){return Js(e,r),typeof r!="function"?(j(e,t,r,n),()=>{}):$(()=>{let i=typeof r=="function"?r():r;j(e,t,i,n)})}function je(e,t,r){return typeof r!="function"?(se(e,t,r),()=>{}):(Js(e,r),$(()=>{let n=typeof r=="function"?r():r;se(e,t,n)}))}function sr(e,t,r){return typeof r!="function"?(j(e,t,!!r),()=>{}):$(()=>{let n=r();j(e,t,!!n)})}function ye(e,t){if(t==null){e.removeAttribute("class");return}if(typeof t=="function"){$(()=>{ye(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 ae(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($(()=>{let a=!!i();for(let s of o)e.classList.toggle(s,a)}));else{let a=!!(typeof i=="function"?i():i);for(let s of o)e.classList.toggle(s,a)}}}function ti(e,t,r){t.includes("-")?r==null?e.removeProperty(t):e.setProperty(t,String(r)):e[t]=r??""}function Me(e){for(;typeof e=="function";)e=e();return e}var ri=new WeakMap;function ee(e,t,r){if(typeof t=="function"&&r){r.push($(()=>ee(e,Me(t))));return}let n=Me(t),i=ri.get(e);if(n==null){ri.delete(e),e.removeAttribute("style");return}let o=new Set,a=s=>{if(typeof s=="function"&&r){r.push($(()=>a(Me(s))));return}if(s=Me(s),s!=null){if(typeof s=="string")e.style.cssText=s;else if(Array.isArray(s))for(let c of s)a(c);else if(typeof s=="object")for(let c in s){o.add(c);let u=s[c];typeof u=="function"&&r?r.push($(()=>ti(e.style,c,Me(u)))):ti(e.style,c,Me(u))}}};if(Array.isArray(n))for(let s of n)a(s);else a(n);if(i)for(let s of i)o.has(s)||ti(e.style,s,null);ri.set(e,o)}function Gs(e,t){if(typeof t!="function"){ee(e,t,[]);return}$(()=>{ee(e,t())})}function Xs(e,t){if(typeof t!="function"){ae(e,t,[]);return}$(()=>{ae(e,t())})}function ou(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 ai(e){let{element:t,props:r,prevProps:n=Ms,isSVG:i=!1,skipChildren:o=!1,isCustomElement:a,accessors:s}=e;if(!t||!Ut(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===tt,u=(p,b,T,S)=>{if(p==="children"){o||S.push(N(t,()=>r.children));return}let g=r[p],L=g===void 0&&T&&ou(r,p);if(g===b&&!L||L&&(p==="ref"||p==="use"||p.startsWith("on")||p.includes(":")||p==="class"||p==="className"||p==="classList"||p==="style"))return;if(p==="ref"){ge(g,t);return}if(p==="use"){or(t,g);return}if(p.startsWith("on:")){S.push(ir(t,p.slice(3),g));return}if(p.startsWith("prop:")){S.push(je(t,p.slice(5),g));return}if(p.startsWith("attr:")){S.push(Le(t,p.slice(5),g,c));return}if(p.startsWith("bool:")){S.push(sr(t,p.slice(5),g));return}if(p==="class"||p==="className"){typeof g=="function"?S.push($(()=>{ye(t,g())})):ye(t,g);return}if(p==="classList"){er(t,"class",g),typeof g=="function"?S.push($(()=>{ae(t,g())})):ae(t,g,S);return}if(p==="style"){er(t,"style",g),typeof g=="function"?S.push($(()=>{ee(t,g())})):ee(t,g,S);return}if(p.startsWith("on")){let _=p.slice(2).toLowerCase();b&&at(t,_),g&&rr(t,_,g);return}let H=a??t.localName.includes("-"),J=nt.has(p)||!c&&p in t||H&&!c&&!_e(p);if(H&&!c&&!_e(p)&&s!==void 0&&typeof g=="function"&&!s.includes(p)){(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E())?Oe(t,p,g):se(t,p,g);return}if(H&&!c&&!_e(p)&&(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E())){S.push($(()=>{let _=typeof g=="function"?g():r[p];for(;typeof _=="function"&&_.length===0;)_=_();Oe(t,p,_)}));return}typeof g=="function"?S.push(J?je(t,p,g):Le(t,p,g,c)):S.push($(()=>J?se(t,p,r[p]):j(t,p,r[p],c)))},l=p=>{p!=="children"&&(p.startsWith("on")?at(t,p.slice(2).toLowerCase()):nt.has(p)?se(t,p,null):t.removeAttribute(p))},f=new Map,d=(p,b,T)=>{let S=[];f.set(p,S),u(p,b,T,S)};x(()=>{for(let p in r)d(p,n[p],n===Ms);for(let p in n)p in r||l(p)});let y=k(),v=$(()=>{let p=new Set;for(let b in r)p.add(b);x(()=>R(y,()=>{for(let b of p)f.has(b)||d(b,void 0,!0);for(let[b,T]of f)p.has(b)||(T.forEach(S=>S()),f.delete(b),l(b))}))});return()=>{v();for(let p of f.values())p.forEach(b=>b())}}function mt(e,t,r=!1){for(let n in t){if(n==="children")continue;let i=t[n];if(n==="ref"){ge(i,e);continue}if(n==="use"){or(e,i);continue}if(n.startsWith("on:")){ir(e,n.slice(3),i);continue}if(n.startsWith("prop:")){je(e,n.slice(5),i);continue}if(n.startsWith("attr:")){Le(e,n.slice(5),i,r);continue}if(n.startsWith("bool:")){sr(e,n.slice(5),i);continue}if(n.startsWith("on")&&n.length>2){let o=n.slice(2).toLowerCase();if(typeof i=="function")if(tr.has(o)){e[`$$${o}`]=i;let a=`__fx_${o}`;if(!e[a]){let s=c=>{e[`$$${o}`]?.(c)};e.addEventListener(o,s),e[a]=s}}else e[`$$${o}`]=i,Qt.has(o)||lt([o]);continue}if(n==="class"||n==="className"){ye(e,i);continue}if(n==="classList"){er(e,"class",i),typeof i=="function"?$(()=>{ae(e,i())}):ae(e,i,[]);continue}if(n==="style"){er(e,"style",i),typeof i=="function"?$(()=>{ee(e,i())}):ee(e,i,[]);continue}if(n==="innerHTML"){if(typeof i=="function"){let o=D(()=>{let a=i();for(;typeof a=="function";)a=a();e.innerHTML=a});C(()=>o())}else e.innerHTML=i;continue}if(n==="value"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")){if(typeof i=="function"){let o=D(()=>{let a=i();for(;typeof a=="function"&&a.length===0;)a=a();document.activeElement!==e&&(e.value=a??"")});C(()=>{o()})}else $(()=>{document.activeElement!==e&&(e.value=t[n]??"")});continue}if(n==="checked"&&e.tagName==="INPUT"){if(typeof i=="function"){let o=D(()=>{let a=i();for(;typeof a=="function"&&a.length===0;)a=a();document.activeElement!==e&&(e.checked=a??"")});C(()=>{o()})}else $(()=>{document.activeElement!==e&&(e.checked=t[n]??"")});continue}if(n==="value"&&e.tagName==="SELECT"){if(typeof i=="function"){let o=!0,a=D(()=>{let s=i();for(;typeof s=="function"&&s.length===0;)s=s();o?(o=!1,queueMicrotask(()=>{e.value=s??""})):e.value=s??""});C(()=>{a()})}else{let o=!0;$(()=>{let a=t[n];o?(o=!1,queueMicrotask(()=>{e.value=a??""})):e.value=a??""})}continue}if(typeof i=="function"){let o=D(()=>{let a=i();for(;typeof a=="function"&&a.length===0;)a=a();rt(e,n,a,r)});C(()=>{o()})}else $(()=>rt(e,n,t[n],r))}}function ci(...e){let t=i=>typeof i=="function"?i():i,r=i=>{for(let o=e.length-1;o>=0;o--){let a=t(e[o]);if(!a||!(i in a))continue;let s=a[i];if(s!==void 0)return s}},n=i=>{for(let o of e){let a=t(o);if(a&&i in a)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 a=t(o);if(a)for(let s of Reflect.ownKeys(a))i.add(s)}return[...i]},getOwnPropertyDescriptor:(i,o)=>n(o)?{enumerable:!0,configurable:!0,get:()=>r(o)}:void 0})}function ar(e,...t){let r=new Set;for(let a of t)for(let s of a)r.add(s);let n=a=>({enumerable:!0,configurable:!0,get:()=>e[a]}),i=t.map(a=>{let s=new Set(a);return new Proxy({},{get:(c,u)=>s.has(u)?e[u]:void 0,has:(c,u)=>s.has(u)&&u in e,ownKeys:()=>Array.from(s).filter(c=>c in e),getOwnPropertyDescriptor:(c,u)=>s.has(u)&&u in e?n(u):void 0})}),o=new Proxy({},{get:(a,s)=>r.has(s)?void 0:e[s],has:(a,s)=>!r.has(s)&&s in e,ownKeys:()=>Reflect.ownKeys(e).filter(a=>!r.has(a)),getOwnPropertyDescriptor:(a,s)=>!r.has(s)&&s in e?n(s):void 0});return[...i,o]}function ge(e,t,r){if(!e){r?.(t);return}let n=e[Ne]?.name;if(he(e)){let i=t,o=e;if(!i)return;typeof i=="function"?i(o):typeof i=="object"&&"current"in i&&(i.current=o);return}typeof e=="function"?e(t):typeof e=="object"&&"current"in e?e.current=t:r?.(t)}function li(e,t,r){let n=t||document.body,i=$e(()=>e),o=[];return I(()=>{let a=$(()=>{let s=i();Array.isArray(s)?(s.forEach(c=>n.appendChild(c)),o.push(()=>{s.forEach(c=>{c.parentNode===n&&n.removeChild(c)})})):he(s)&&(n.appendChild(s),o.push(()=>{s.parentNode===n&&n.removeChild(s)}))});o.push(a),C(()=>{o.forEach(s=>s())})}),null}function Ys(e){return typeof e=="string"&&e.toLowerCase()===e}function cr(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 Zs(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function lr(e){return e!=null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"||e instanceof Promise}function Qs(e){return typeof e=="function"&&e.length===0&&A(e)}function be(e,t,r){if(!t)throw new Error("Container element is required");let n,i,o=[];return W(a=>{I(()=>{h.active||(t.textContent=""),t.setAttribute(it,"");let s=e;N(t,typeof s=="function"&&!A(s)?x(s):s)}),i=a}),()=>{i?.(),n?.(),o.forEach(a=>a()),t.textContent=""}}function ui(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 ur(e){if(E())return null;let t=()=>e.mount?typeof e.mount=="function"?e.mount():e.mount:document.body,r,n,i=!1,o=k(),a=()=>R(o,()=>W(s=>{r=s,n=document.createElement("div"),n.style.display="contents",t().appendChild(n),N(n,e.children)&&ge(e.ref,n)}));return h.active?queueMicrotask(()=>{i||a()}):a(),C(()=>{i=!0,r?.(),n?.remove()}),null}function ce(e){return()=>{let t=e();return typeof t=="function"?t():t}}function fr(e){let t=ce(()=>e.when),r=w(t,void 0,{name:"Show.when"}),n=w(()=>!!r(),void 0,{name:"Show.cond"}),i=k(),o=null,a=null,s=c=>{c!==a&&(o&&G(o),o=F(i),a=c)};return w(()=>{let c=n();return s(c?"when":"fallback"),R(o,()=>{if(!c)return e.fallback;let u=e.children;if(A(u))return u;if(typeof u=="function"){let l=u;if(l.length===0)return x(()=>l(x(r)));let f=r();return x(()=>l(f))}return u})},void 0,{name:"Show.result"})}function su(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function ea(e){return w(()=>{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(`${su(n)}: ${o}`)}return r.join("; ")},void 0,{name:"StyleMap"})}var fi=Symbol("match");function pr(e){return{[fi]:!0,when:ce(()=>e.when),get children(){return e.children}}}function dr(e){let t=e.children,r=Array.isArray(t)?t:[t],n=k(),i=null,o=-1,a=s=>{s!==o&&(i&&G(i),i=F(n),o=s)};return w(()=>{for(let s=0;s<r.length;s+=1){let u=r[s],l=0;for(;typeof u=="function"&&!u[fi]&&l++<10;)u=u();if(!u||typeof u!="object"||u[fi]!==!0)continue;let f=u.when();if(f)return a(s),R(i,()=>{let d=u.children;return typeof d=="function"?d(f):d})}return a(-2),R(i,()=>e.fallback??null)},void 0,{name:"Switch"})}function ta(e){return w(()=>{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 pi(e){if(E())return e.fallback??null;let t=h.active,[r,n]=O(!t);return t&&queueMicrotask(()=>n(!0)),w(()=>r()?e.children:e.fallback??null,void 0,{name:"client-only"})}var ra=pi;var yr=Symbol("store-raw"),na=Symbol("store-node"),ia=Symbol("store-has"),oa=Symbol("store-self"),sa=Symbol("store-track");var yt=new WeakMap,di=new WeakMap,We=new WeakMap,vr=new WeakMap;function au(e,t){if(!He(e)||!Pt())return;let r=new Set,n=a=>{if(!(!He(a)||r.has(a))){r.add(a);for(let s of Object.values(a))n(s)}};n(vr.get(t)??t);let i=new Set,o=a=>{if(!He(a))return;let s=a;if(r.has(s)||i.has(s))return;i.add(s);let c=yt.get(s);if(c){for(let u of c.keys.values())sn(u);c.all&&sn(c.all),yt.delete(s),We.delete(s),di.delete(s)}for(let u of Object.values(s))o(u)};o(e)}var gr=(e,t,r)=>r?`${e}[${String(t)}]`:`${e}.${String(t)}`;function fa(e,t,r){let n=t?.owner,i=n&&r!==void 0?gr(n.name,r,t?.array):void 0,o=i?{name:i}:void 0,[a,s]=xo(n?.store,()=>m.hot?Rn(()=>O(e,o)):O(e,o)),c=a;return c.$=s,c}function br(e){let t=yt.get(e);return t?t.owner||(t.owner=We.get(e)):yt.set(e,t={keys:new Map,owner:We.get(e),array:Array.isArray(e)}),t}function aa(e,t,r){let n=e.keys.get(t);return n||e.keys.set(t,n=fa(r,e,t)),n}function cu(e,t,r,n){let i=We.get(e);if(i&&i.store===t&&i.name===r)return;let o={store:t,name:r};We.set(e,o),vr.set(e,vr.get(n)??n);let a=yt.get(e);if(a&&(a.owner=o,!!Pt())){for(let[s,c]of a.keys)on(c,t,gr(r,s,a.array));a.all&&on(a.all,t,gr(r,"*",a.array))}}function ca(e){let t=br(e);(t.all||(t.all=fa(void 0,t,"*")))()}function la(e,t){e.$(typeof t=="function"?()=>t:t)}function He(e){if(e==null||typeof e!="object")return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function hr(e){if(!He(e))return e;let t=di.get(e);if(t)return t;let r=new Proxy(e,lu);return di.set(e,r),r}var lu={get(e,t,r){if(t===yr||t===na)return e;if(t===Dt)return r;if(t===ia)return c=>c in e;if(t==="__proxy")return!0;if(t===sa||t===oa)return ca(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=br(e),a=aa(o,t,n),s=a();return He(s)?(o.owner&&cu(s,a,gr(o.owner.name,t,o.array),e),hr(s)):s},set(){return!0},deleteProperty(e,t){return t in e&&z(e,t,void 0),!0},has(e,t){return t===yr||t===Dt||t===na||t===ia||t===oa||t===sa?!0:(aa(br(e),t,e[t])(),t in e)},ownKeys(e){return ca(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(e,t)}};function pa(e,t=new Set){if(e==null||typeof e!="object")return e;let r=e[yr]??e;if(t.has(r)||!He(r))return r;t.add(r);let n=!1,i=a=>{let s=pa(a,t);return s!==a&&(n=!0),s};if(Array.isArray(r)){let a=r.map(i);return n?a:r}let o={};for(let a of Object.keys(r))o[a]=i(r[a]);return n?o:r}function z(e,t,r){let n=pa(r),i=e[t];if(i===n&&(n!==void 0||t in e))return;let o=Array.isArray(e),a=o?e.length:0;n===void 0?delete e[t]:e[t]=n;let s=br(e),c=s.keys.get(t);if(c&&la(c,n),au(i,e),o&&e.length!==a){let u=s.keys.get("length");u&&la(u,e.length)}s.all&&s.all.$(void 0)}function hi(e,t){return typeof e=="function"?e(t):e}function mi(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)?mi(i,n):z(e,r,n)}}function Sr(e){let t=[],r=e.replace(/\[([^\]]*)\]/g,".$1");for(let n of r.split("."))n.length&&t.push(n);return t}function da(e,t,r){let n=t.length-1;for(let o=0;o<n;o++){let a=t[o];if(a==="*"){let c=t.slice(o+1);if(Array.isArray(e))for(let u=0;u<e.length;u++)da(e[u],c,r);return}let s=e[a];(s==null||typeof s!="object")&&(s=/^\d+$/.test(t[o+1])?[]:{},z(e,a,s)),e=s}let i=t[n];if(i==="*"){if(Array.isArray(e))for(let o=0;o<e.length;o++)z(e,o,hi(r,e[o]));return}z(e,i,hi(r,e[i]))}function ua(e,t,r){da(e,Sr(t),r)}function uu(e){return Array.isArray(e)&&e.length>0&&e.every(t=>Array.isArray(t)&&t.length>=2&&typeof t[0]=="string")}function mr(e,t){for(let r=e.length-1;r>=t.length;r--)z(e,String(r),void 0);e.length!==t.length&&z(e,"length",t.length);for(let r=0;r<t.length;r++)z(e,String(r),t[r])}function fu(e,t){let r=t[0];if(typeof r=="function"&&t.length===1){let n=r(e);n&&n!==e&&mi(e,n);return}if(Array.isArray(r)&&t.length===1){if(uu(r)){for(let n of r)ua(e,n[0],n[1]);return}if(Array.isArray(e)){mr(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){mi(e,r);return}if(t.length>=3){yi(e,t.slice(0,-1),t[t.length-1]);return}ua(e,String(r),t[1])}function pu(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 a=n;a<=i;a+=r)a>=0&&a<e.length&&o.push(a);return o}return t==="*"?Array.isArray(e)?e.map((r,n)=>n):Object.keys(e??{}):[t]}function yi(e,t,r){if(e==null)return;let[n,...i]=t;if(typeof n=="string"){let a=Sr(n);if(a.length>1){yi(e,[...a,...i],r);return}}let o=pu(e,n);if(i.length===0){for(let a of o)z(e,a,hi(r,e[a]));return}for(let a of o){let s=e[a];if(s==null||typeof s!="object"){let c=i[0];s=typeof c=="number"||/^\d+$/.test(String(c))?[]:{},z(e,a,s)}yi(s,i,r)}}function vi(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(vi);let t={};for(let r of Object.keys(e))t[r]=vi(e[r]);return t}function le(e,t){let r=e;for(let n of Sr(t)){if(r==null)return;r=r[n]}return r}var ha=class{constructor(e,t={immutable:!0}){this.options=t,this.root=e,this.set=((...r)=>I(()=>fu(this.root,r))),e&&typeof e=="object"&&(We.set(e,{store:this,name:t.name??"store"}),vr.set(e,e)),Pt()&&Eo({kind:"store",node:this,handle:()=>this.root,name:t.name})}get state(){return hr(this.root)}get proxy(){return hr(this.root)}get accessor(){return(()=>hr(this.root))}unwrap(){return this.root}getNode(e){return this.root&&this.root[e]}get(e){if(e==null||e==="")return vt(this.state);let t=this.state;for(let r of Sr(e)){if(t==null)return;t=t[r]}return vt(t)}select(e){return w(()=>e(this.state))}subscribe(e){return D(()=>e(this.state))}watch(e,t){let r;return D(()=>{let n=e(this.state);Object.is(n,r)||(t(n,r),r=n)})}reactive(e){return w(()=>this.state[e])}produce(e){this.set((t=>{let r=vi(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)){mr(n,i);return}this.set(e,i);return}let r=this.root;if(Array.isArray(r)&&Array.isArray(e)){mr(r,e);return}this.set(e)}clear(e){let t=e===void 0?this.root:le(this.root,e);if(Array.isArray(t)){mr(t,[]);return}if(t&&typeof t=="object")for(let r of Object.keys(t))z(t,r,void 0)}toObservable(){let[e]=Rn(()=>O(this.state));return e.toObservable()}dispose(){}},du=["get","select","watch","subscribe","produce","reconcile","push","pop","shift","splice","insert","removeAt","replace","clear","unwrap","toObservable"];function hu(e,t){for(let r of du)e[r]=t[r].bind(t);e.$=t.reactive.bind(t)}function gi(e,t={immutable:!0}){let r=m.hot,n=new ha(r?r.take("store",e):e,t);return hu(n.set,n),r&&r.keep(()=>vt(n.proxy),()=>n.set(()=>e)),[n.proxy,n.set]}function mu(e,t={}){return new ha(e,{...t,immutable:!1})}function vt(e){if(e==null||typeof e!="object")return e;let t=e[yr];return t!==void 0?t:e}function yu(e){return x(()=>vt(e))}var gh=Object.freeze({createStore:gi,createMutableStore:mu,batch:I,unwrap:vt,untrackStore:yu});function bi(e,t){let[r,n]=gi(e,t);return new Proxy(r,{get:(i,o)=>o==="set"?n:i[o],has:(i,o)=>o==="set"||Reflect.has(i,o)})}var vu="__fx_dom_create_component__",Se=globalThis[vu]??={fn:null};function ya(e){Se.fn=e}function va(e={}){let t=e.signalSystem?.createComponent;t&&(Se.fn=t)}function we(e,t){let r=X()?.scope();return r?R(r,()=>ma(e,t)):ma(e,t)}function ma(e,t){if(Se.fn)return Se.fn(e,t);let r=typeof e!="function"?e:x(()=>e(t)),n=r!=null&&(typeof r=="function"||typeof r=="object");if(n)try{r.$name=e?.name}catch{}return n&&!A(r)?st(r):r}var ga=()=>Se.fn!==null,Si=()=>Se.fn!==null;function wi(){Se.fn=null}function wr(e,t={}){if(typeof e=="function")return we(e,t);if(typeof e!="string"||e.length===0)return null;let r=cr(e),n=ve(e,r);return mt(n,t,r),bu(n,t),n}function gu(e){if(!e||!("children"in e))return!1;let t=Object.getOwnPropertyDescriptor(e,"children");return!t||"get"in t?!0:t.value!==void 0}function bu(e,t){if(!gu(t))return;if((typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E())&&!(X()?.keyed()??!1)){N(e,$e(()=>t.children));return}let r=e.firstChild,n;h.active&&r?.nodeType===8&&r.data==="fx"?n=pt(r):(r=ba("fx"),n=ba("fx/"),e.appendChild(r),e.appendChild(n));let i=r;N(e,ft(i,()=>$e(()=>t.children)),n,dt(i,n))}function ba(e){return(typeof __FLUIXI_SERVER__<"u"?__FLUIXI_SERVER__:E())?Te().createComment(e):document.createComment(e)}function xr(e){let t=()=>{let s=e.component;return A(s)?s():s},[,r]=ar(e,["component"]),n=k(),i=null,o,a;return w(()=>{let s=t();return s===o||(i&&G(i),i=F(n),o=s,a=s==null?null:R(i,()=>x(()=>typeof s=="string"?wr(s,r):we(s,r)))),a},void 0,{name:"Dynamic"})}var Er,xa={getStore:()=>Er,run(e,t){let r=Er;Er=e;try{return t()}finally{Er=r}}},gt=globalThis[Symbol.for("fluixi.requestStore")]??={store:xa,async:!1};function Ei(e){gt.store=e??xa,gt.async=e!==null}function Ea(e){gt.async||Ei(e)}function bt(e={}){if(e.request===void 0){let a=$i();a&&(e.request=a)}e.locals||(e.locals=e.request?Ai(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 a=i.get(n)??0;return i.set(n,a+1),`${n}:r${a}`},nextIslandNamespace:a=>{let s=o.get(a)??0;return o.set(a,s+1),`${a}#${s}`},withResourceScope(a,s){let c=n;n=a;try{return s()}finally{n=c}},pending:new Set,data:new Map}}var kr=globalThis[Symbol.for("fluixi.requestEndHooks")]??=new WeakMap;function ka(e){let t=St();if(!t)return!1;let r=kr.get(t);return r||kr.set(t,r=[]),r.push(e),!0}function St(){return $i()??B()}var te=globalThis[Symbol.for("fluixi.beforeRender")]??={tasks:[],prepared:new WeakMap,page:void 0};function $a(e){return te.tasks.push(e),()=>{let t=te.tasks.indexOf(e);t>=0&&te.tasks.splice(t,1)}}function Aa(){let e=St();if(!e)return te.page??=Sa();let t=te.prepared.get(e);return t||te.prepared.set(e,t=Sa()),t}function Ra(){let e=St();return e?te.prepared.has(e):te.page!==void 0}async function Sa(){for(let e of[...te.tasks])await e()}function wt(e){ki(e)}function ki(e){let t=kr.get(e);if(t){kr.delete(e);for(let r of t.reverse())try{r()}catch(n){console.error("[fluixi] a request-end hook threw:",n)}}}function xt(e,t){return gt.store.run(e,t)}function B(){return gt.store.getStore()}function Ar(){return B()?.event}function Ca(){let e=Ar();return e?(e.locals||(e.locals={}),e.locals):{}}var wa=globalThis[Symbol.for("fluixi.requestLocals")]??=new WeakMap;function $i(){return globalThis[Symbol.for("fluixi.platformRequest")]?.getStore()}function Ai(e){let t=wa.get(e);return t||(t={},wa.set(e,t)),t}var Ve=globalThis[Symbol.for("fluixi.responseHeaders")]??=new WeakMap;function Ri(){let e=Ar()?.request;return e&&typeof e=="object"?e:$i()}function Ta(e,t,r=Ri()){if(!r)return!1;let n=Ve.get(r);return n||(n={headers:new Headers,sent:!1},Ve.set(r,n)),n.sent?!1:(n.headers.append(e,t),!0)}function Oa(e){let t=Ve.get(e);if(!t){t={headers:new Headers,sent:!0},Ve.set(e,t);return}return t.sent=!0,t.headers}var $r=globalThis[Symbol.for("fluixi.responseRedirects")]??=new WeakMap;function _a(e,t,r=Ri()){return!r||Ve.get(r)?.sent?!1:($r.has(r)||$r.set(r,{location:e,status:t}),!0)}var xi=globalThis[Symbol.for("fluixi.responseStatuses")]??=new WeakMap;function Rr(e,t=Ri()){return!t||Ve.get(t)?.sent?!1:(xi.set(t,e),!0)}function Cr(e){let t=e?.status;return typeof t=="number"&&Number.isInteger(t)&&t>=400&&t<=599?t:500}function Na(e){let t=xi.get(e);return xi.delete(e),t}function Da(e){let t=$r.get(e);return $r.delete(e),t}var Ci=fn(void 0);function Ti(e,t){let r;D(()=>{t.error()===void 0?r=void 0:r??=x(e.current)}),D(()=>{let n=e.committed();x(()=>{r!==void 0&&n!==r&&t.error()!==void 0&&t.reset()})})}function Tr(e){let t=ln(),r=s=>!!s&&typeof s.then=="function",n=s=>(E()&&Rr(Cr(s)),typeof e.fallback=="function"?e.fallback(s,t.reset):e.fallback),i=s=>{if(r(s))throw s;return queueMicrotask(()=>t.setError(s)),null},o=s=>{if(Array.isArray(s))return s.map(o);if(typeof s!="function")return s;let c=s;return()=>{try{let u=o(c()),l=E()?t.caught():void 0;return l===void 0?u:x(()=>n(l))}catch(u){return E()&&!r(u)?(t.setError(u),x(()=>n(u))):i(u)}}},a=Wt(Ci);return a&&Ti(a,t),w(()=>{let s=t.error();if(s!==void 0)return n(s);try{let c=un(t,()=>{let l=e.children;return o(typeof l=="function"?l():l)}),u=E()?t.caught():void 0;return u===void 0?c:x(()=>n(u))}catch(c){return i(c),n(c)}},void 0,{name:"ErrorBoundary"})}function Or(e){let t=ce(()=>e.each),r=()=>e.fallback??null,n=(i,o)=>{let a=e.children,s=Array.isArray(a)?a.map(c=>typeof c=="function"?c(i,o):c):typeof a=="function"?a(i,o):a;return Ie(s),s};return e.by?Re(t,e.by,(i,o)=>n(i,o),{fallback:r}):Ae(t,(i,o)=>n(i,o),{fallback:r})}function _r(e){let t=ce(()=>e.each);return Ce(t,(r,n)=>{let i=e.children(r,n);return Ie(i),i},{fallback:()=>e.fallback??null})}var Su=Symbol.for("fluixi.owner"),kt=1,Oi=3,_i=8,wu=Symbol.for("fluixi.serverElementRenderer"),Ia=Symbol.for("fluixi.serverElementRendered");function Et(e){if(e.nodeType!==kt)return;let t=e;if(typeof t.localName!="string"||!t.localName.includes("-")||t[Ia])return;let r=globalThis[wu];r&&(t[Ia]=!0,r(t))}var Ma;Ma=et;var Nr=class{constructor(){this[Ma]=!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),Et(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),Et(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,Et(e)),t}addEventListener(){}removeEventListener(){}},$t=class Pa extends Nr{constructor(t){super(),this.nodeType=Oi,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 Pa(this.data)}},La=class ja extends Nr{constructor(t){super(),this.nodeType=kt,this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new ja(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}},Dr=class Ha extends Nr{constructor(t){super(),this.nodeType=_i,this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new Ha(this.data)}},xu=class{constructor(){this.cssText=""}setProperty(e,t){this[e]=t}removeProperty(e){delete this[e]}},Eu=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}},At=class Wa extends Nr{constructor(t,r=!1){if(super(),this.nodeType=kt,this.attributes=new Map,this.style=new xu,this.classList=new Eu(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=k();n&&(this[Su]=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}get dataset(){let t=r=>`data-${r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`)}`;return new Proxy({},{get:(r,n)=>typeof n=="string"?this.getAttribute(t(n))??void 0:void 0,set:(r,n,i)=>(typeof n=="string"&&this.setAttribute(t(n),String(i)),!0),deleteProperty:(r,n)=>(typeof n=="string"&&this.removeAttribute(t(n)),!0)})}toggleAttribute(t,r){let n=r??!this.hasAttribute(t);return n?this.setAttribute(t,""):this.removeAttribute(t),n}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 $t(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 Wa(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 ku=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),$u={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function Va(e){return e.replace(/&(#?\w+);/g,(t,r)=>$u[r]??t)}var re=class extends Error{};function Ba(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){s(e.slice(r));break}if(u>r&&s(e.slice(r,u)),e.startsWith("<!--",u)){let l=e.indexOf("-->",u);if(l===-1)throw new re(`unterminated comment at ${u}`);o(new Dr(e.slice(u+4,l))),r=l+3;continue}if(e[u+1]==="/"){let l=e.indexOf(">",u);if(l===-1)throw new re(`unterminated closing tag at ${u}`);let f=e.slice(u+2,l).trim().toLowerCase(),d=i.pop();if(!d||d.localName!==f)throw new re(`</${f}> does not close <${d?.localName??"nothing"}>`);r=l+1;continue}r=c(u)}if(i.length>0)throw new re(`unclosed <${i[i.length-1].localName}>`);let a=n[0];if(n.length!==1||!(a instanceof At))throw new re(`expected exactly one root element, got ${n.length}`);return a;function s(u){u!==""&&o(new $t(Va(u)))}function c(u){let l=/[\s/>]/.exec(e.slice(u+1));if(!l)throw new re(`unterminated tag at ${u}`);let f=e.slice(u+1,u+1+l.index).toLowerCase(),d=new At(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 v=y;for(;y<e.length&&!/[\s=/>]/.test(e[y]);)y++;let p=e.slice(v,y);if(p==="")throw new re(`malformed attribute at ${y}`);if(e[y]==="="){if(e[y+1]!=='"')throw new re(`attribute ${p} must have a double-quoted value`);let b=e.indexOf('"',y+2);if(b===-1)throw new re(`unterminated value for ${p}`);d.setAttribute(p,Va(e.slice(y+2,b))),y=b+1}else d.setAttribute(p,"")}return o(d),ku.has(f)||i.push(d),y}}var Au=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Fa=/&/g,Ua=/</g,Ka=/>/g,Ru=/"/g;function Ni(e){return e.replace(Fa,"&amp;").replace(Ua,"&lt;").replace(Ka,"&gt;")}function qa(e){return e.replace(Fa,"&amp;").replace(Ru,"&quot;").replace(Ua,"&lt;").replace(Ka,"&gt;")}function Cu(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Tu(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(`${Cu(r)}: ${n}`)}return t.join("; ")}function Ou(e){let t="",r=Tu(e.style);for(let[n,i]of e.attributes)n==="style"&&r||(t+=` ${n}="${qa(i)}"`);if(r){let n=e.attributes.get("style"),i=n?`${n.replace(/;\s*$/,"")}; ${r}`:r;t+=` style="${qa(i)}"`}return t}function Y(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return Ni(e);if(typeof e=="number")return Ni(String(e));if(typeof e=="function")return Y(e());if(Array.isArray(e))return e.map(Y).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case Oi:return Ni(e.data??"");case _i:return`<!--${e.data??""}-->`;case kt:{Et(e);let t=e.localName,r=`<${t}${Ou(e)}>`;if(Au.has(t))return r;let n=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(Y).join("");return`${r}${n}</${t}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(Y).join(""):""}var Rt="__FX_DATA__";function Ir(e){return e.replace(/[<>&\u2028\u2029]/g,t=>"\\u"+t.charCodeAt(0).toString(16).padStart(4,"0"))}var Di;function Mr(){let e=globalThis.__FX_DATA__;if(e&&typeof e.nodeType!="number")return e;if(Di!==void 0)return Di;let t=null;if(typeof document<"u"){let r=document.getElementById(Rt)?.textContent;if(r)try{t=JSON.parse(r)}catch{t=null}}return Di=t}var Pr=Symbol.for("fluixi.hydrationKeys");function Mi(e){let t=e;for(;t;){let r=t.contexts?.get(Pr);if(r)return r;if(!t.parent){let n={id:"",next:0};return(t.contexts??=new Map).set(Pr,n),n}t=t.parent}return{id:"",next:0}}function jr(){return E()?B()?.hydrationKeys!==!1:h.active}function Lr(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 _u(e){if(!jr())return null;let t=Mi(k()),r=t.id+(t.next++).toString(36);return e?`${Lr(r)}-${e}`:Lr(r)}var Nu=0;function Ja(){if(!jr())return`fx-c${(Nu++).toString(36)}`;let e=Mi(k());return e.ids=(e.ids??0)+1,`fx-${Lr(`${e.id}#${e.ids}`)}`}var za=new Map;function Du(e){let t=za.get(e);return t===void 0&&za.set(e,t=Lr(e).slice(0,6)),t}function Ga(e){let t=e.getAttribute(K)??"",r=t.indexOf("-");return r<0?"":t.slice(r+1)}function Pi(e){let t=e.getAttribute(K);t&&P?.get(t)===e&&P.delete(t)}function Iu(){if(!jr())return null;let e=k();if(!e)return null;let t=Mi(e),r={id:t.id+(t.next++).toString(36)+".",next:0},n=F(e);return(n.contexts=new Map).set(Pr,r),n}function Xa(e){let t=k();t&&(t.contexts??=new Map).set(Pr,{id:e,next:0})}var P=null;function Li(e){P??=new Map;for(let t of e.querySelectorAll(`[${K}]`)){let r=t.getAttribute(K);P.has(r)||P.set(r,t)}}function Hr(){P=null}function Wr(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 Mu(e){if(!(!P||e.length===0))for(let[t,r]of P)e.some(n=>n===r||n.contains(r))&&P.delete(t)}function Pu(e,t){if(!e||!P)return null;let r=P.get(e);return!r||r.localName!==t.toLowerCase()?null:(P.delete(e),r)}var Lu=Symbol.for("fluixi.owner");function Ii(e){let t=k();t&&(e[Lu]=t)}function ju(e){if(e instanceof Element){e.localName.includes("-")&&Ii(e);for(let t of e.querySelectorAll("*"))t.localName.includes("-")&&Ii(t)}}var Hu=/<[a-z][\w.]*-/i;function Wu(e,t){Hu.test(t)&&ju(e)}function Vu(e,t){let r=e[Ne];return r!==void 0&&(t[Ne]=r),t}function Bu(e,t){let r=De(e.nextSibling,t);if(typeof r=="function"){let n=r;return Vu(n,(...o)=>h.active?De(e.nextSibling,()=>{let a=n(...o);for(;typeof a=="function";)a=a();return a}):n(...o))}return r}function ue(){ms({keyed:jr,next:_u,salt:Du,claim:Pu,keep:Mu,scope:Iu,handOwner:Ii,handOwnerTree:Wu,holeScope:Bu,resume:De})}var Ya=!1;function ec(){Ya||(Ya=!0,qo({createElement:(e,t)=>new At(e,t),createText:e=>new $t(e),createRaw:e=>new La(e),parseTemplate:(e,t)=>Ba(e,t),createComment:e=>new Dr(e)}))}function tc(e,t={}){let r=E();ec(),ue(),de(!0);let n=bt(t.event);n.hydrationKeys=t.hydrationKeys!==!1;try{return xt(n,()=>W(i=>{try{let o=typeof e=="function"?e():e;return Y(o)}finally{i()}}))}finally{wt(n),de(r)}}var Za=!1,Qa=new WeakMap;function qu(){Za||(Za=!0,yn(e=>{B()?.pending.add(e)}),Ze(()=>B()?.nextResourceId()??""),wn((e,t)=>{e&&B()?.data.set(e,t)}),kn(()=>{let e=B();if(!e)return;let t=Qa.get(e);return t||Qa.set(e,t=En()),t}))}var ji=null;function rc(e){ji=e}function Hi(e){if(e.data.size===0)return"";let t={};for(let[n,i]of e.data){let o=i;if(ji)try{o=ji(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=Ir(JSON.stringify(t));return r==="{}"?"":`<script type="application/json" id="${Rt}">${r}<\/script>`}var Fu=50;async function nc(e,t={}){let r=E();ec(),ue(),de(!0),qu();let n=bt(t.event);n.hydrationKeys=t.hydrationKeys!==!1;try{return await xt(n,async()=>{t.preload&&await t.preload(t.event);let i,o=null,a=()=>{};W(l=>{a=l,o=k(),i=typeof e=="function"?e():e});let s=()=>{try{R(o,()=>Y(i))}catch{}};s();let c=0;for(;n.pending.size>0&&c++<Fu;){let l=Array.from(n.pending);n.pending.clear(),await Promise.allSettled(l),await Bt(),s()}let u=R(o,()=>Y(i))+Hi(n);return a(),u})}finally{wt(n),de(r)}}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 Vr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);var Uu=Symbol.for("fluixi.ownsContent");function ac(e){return e.localName.includes("-")?e.hasAttribute("data-fx-ssr")||e[Uu]===!0:!1}var ic=Symbol.for("fluixi.serverContent");function cc(e){let t=e;t[ic]||(t[ic]=Array.from(e.childNodes))}function Ku(e){Br();let t=h.cursor;return t&&t.nodeType===1&&t.tagName.toLowerCase()===e.toLowerCase()?(Pi(t),Vr.has(e.toLowerCase())||ac(t)?(Vr.has(e.toLowerCase())||cc(t),h.cursor=t.nextSibling):(h.parents.push(t),h.cursor=t.firstChild),t):null}function zu(e){Vr.has(e.localName)||ac(e)?(Vr.has(e.localName)||cc(e),h.cursor=e.nextSibling):(h.parents.push(e),h.cursor=e.firstChild)}function Ju(e,t){Br();let r=h.cursor;if(r&&r.nodeType===1&&r.tagName.toLowerCase()===e.toLowerCase()){let n=Ga(r);return t&&n&&n!==t?null:(Pi(r),h.cursor=r.nextSibling,r)}return null}function Gu(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 null}function Xu(e){Br();let t=h.cursor;return t&&t.nodeType===8&&t.data===e?(h.cursor=t.nextSibling,t):null}var oc=!1;function lc(){oc||(oc=!0,vs({hydrateElement:Ku,hydrateText:Gu,hydrateMarker:Xu,hydrateStatic:Ju,enterElement:zu}))}var sc=()=>typeof location>"u"?null:`${location.pathname}${location.search}`;function xe(e,t,r){lc(),h.active=!0,h.cursor=t.firstChild,h.parents=[],ue(),Hr(),Li(t);let n=Mr(),i=r?.resourceNamespace,o=0;Ze(()=>i?`${i}:r${o++}`:`r${o++}`);let a=sc();gn(n?s=>s in n&&sc()===a?{value:n[s]}:void 0:null);try{return be(e,t)}finally{h.active=!1,h.cursor=null,h.parents=[],Kn()}}function uc(e,t){ue(),lc(),Li(e);let r={active:h.active,cursor:h.cursor,parents:h.parents};h.active=!0,h.cursor=e.firstChild,h.parents=[];try{N(e,t()),Wr(e)}finally{h.active=r.active,h.cursor=r.cursor,h.parents=r.parents,r.active||Kn()}}var Wi="fluixi-island";function pc(e){let t=e.component,r=e.props??{},n=e.name,i=ve(Wi),o=n??t.name??"Island";j(i,"name",o),j(i,"props",JSON.stringify(r??{}));let a=E()?B():void 0;if(a){let s=a.nextIslandNamespace(o);N(i,()=>a.withResourceScope(s,()=>t(r)))}else N(i,()=>t(r));return i}var fc=!1;function Yu(){if(fc||typeof document>"u")return;fc=!0;let e=document.createElement("style");e.textContent=`${Wi}{display:contents}`,document.head.appendChild(e)}function dc(e){if(typeof document>"u")return;Yu();let t=document.querySelectorAll(Wi),r=new Map;t.forEach(n=>{let i=n.getAttribute("name")??"",o=r.get(i)??0;r.set(i,o+1);let a=e[i];if(!a){typeof process>"u"&&console.warn(`[fluixi] island "${i}" has no component in the registry, left static.`);return}let s={};try{s=JSON.parse(n.getAttribute("props")||"{}")}catch{}xe(()=>a(s),n,{resourceNamespace:`${i}#${o}`})})}function hc(e,...t){throw new Error("html`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function mc(e,...t){throw new Error("svg`` was not compiled, enable the html format: fluixi({ format: 'html' }).")}function yc(e,...t){throw new Error("css`` was not compiled: component styles need @fluixi-css/vite next to the fluixi plugin.")}var Zu={createComponent:we,createElement:Wn,createNativeElement:ve,createTemplate:ut,cloneTemplate:nr,templateNode:ii,template:oi,holeContent:dt,holeEnd:pt,holeScope:ft,createPortal:li,render:be,hydrate:xe,insert:N,appendChildren:Bn,removeChildren:Vn,spread:ai,applyProps:mt,mergeProps:ci,bindPair:ui,setProperty:se,setDynamicProperty:je,setAttribute:j,setDynamicAttribute:Le,removeAttribute:Hn,getAttribute:jn,setClassName:ye,addClass:Mn,removeClass:Pn,toggleClass:Ln,setStyles:Jt,delegateEvents:lt,addDelegatedEventListener:rr,removeDelegatedEventListener:at,handleRef:ge,resetIntegration:wi,isIntegrationInitialized:Si},Qu=Zu;var qr={kind:"eager"},ef=["pointerdown","focusin","keydown"],vc=new Set(["eager","idle","visible","interaction","media","never"]),Be=class extends Error{};function gc(e,t){let r=e.slice(5);if(!vc.has(r))throw new Be(`Unknown load strategy 'load:${r}'. Expected one of ${[...vc].join(", ")}.`);switch(r){case"eager":return qr;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?tf(t):[...ef]};case"media":if(!t)throw new Be(`'load:media' needs a query, e.g. load:media="(min-width: 1024px)".`);return{kind:"media",query:t};default:throw new Be(`Unhandled load strategy '${r}'.`)}}function tf(e){let t=e.split(/[\s,]+/).map(r=>r.trim()).filter(Boolean);if(t.length===0)throw new Be("'load:interaction' was given no event names.");return t}function bc(e){return e.kind!=="eager"}var Bi=["Show","For","Index","Switch","Match","Portal","Dynamic","ErrorBoundary"],qi=["Suspense","SuspenseList","Await"],Fr=["Router","Outlet","Redirect","Link"],Ty=[...Bi,...qi,...Fr],Fi=new Set([...Bi,...qi]);function Sc(e={}){let{controlFlowModule:t="@fluixi/dom",coreModule:r="@fluixi/core",routerModule:n="@fluixi/core/router"}=e,i={};for(let o of Bi)i[o]=t;for(let o of qi)i[o]=r;for(let o of Fr)i[o]=n;return i}function wc(e,t={}){let{resolver:r,isBound:n,modules:i,strategyFor:o}=t,a=Sc(i),s=new Map,c=new Set,u=f=>{let{name:d}=f;if(!d||d.includes(".")||n?.(d))return;let y=l(d);if(!y){c.add(d);return}let v=y.origin==="builtin"&&Fi.has(d)?qr:o?.(f)??qr;f.source={...y,loading:v},s.set(d,f.source)},l=f=>{if(Fi.has(f))return{module:a[f],export:f,origin:"builtin"};let d=r?.resolve(f);if(d)return{module:d.module,export:d.export,origin:"rule"};if(Fr.includes(f))return{module:a[f],export:f,origin:"builtin"}};return Ur(e,f=>{f.kind==="component"&&u(f)}),{resolved:s,unresolved:[...c]}}function Ur(e,t){let r=Array.isArray(e)?e:[e];for(let n of r){t(n);let i=n.children;i&&Ur(i,t)}}function xc(e){let t=[];Ur(e,o=>{o.kind==="component"&&o.source&&t.push(o)});let r=new Set,n=new Set;for(let o of t){let{module:a,loading:s}=o.source;s.kind==="eager"&&r.add(a),s.kind==="never"&&n.add(a)}let i=new Map;for(let o of t){let a=o.source;!bc(a.loading)||a.loading.kind==="never"||r.has(a.module)&&(a.loading={kind:"eager"},i.set(a.module,(i.get(a.module)??0)+1))}return{collapsed:i,conflicted:[...n].filter(o=>r.has(o))}}function rf(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 Ec(e){let t=[],r=new Map,n=i=>{switch(i.kind){case"text":return!0;case"expr":return!1;case"component":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 s of i.children)n(s)||(o=!1);let a;for(let s of i.props)if(a=rf(s),a)break;return!a&&!o&&(a=nf(i)),i.static=!a,a?r.set(i,a):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 nf(e){for(let t of e.children){if(t.kind==="expr")return"expression-child";if(t.kind==="component")return"component-child";if(t.kind==="element"&&!t.static||t.kind==="fragment")return"expression-child"}return"expression-child"}var kc={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},of=/&(?:#[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(of,(t,r,n,i)=>{let o=r?parseInt(r,16):n?parseInt(n,10):Object.prototype.hasOwnProperty.call(kc,i)?kc[i]:void 0;return o!==void 0&&o<=1114111?String.fromCodePoint(o):t}):e}var q="@fluixi/reactive/signal",Ui={$signal:{export:"signal",module:q,returns:"signal-handle"},$memo:{export:"memo",module:q,returns:"memo-handle"},$effect:{export:"effect",module:q,returns:"effect"},$store:{export:"store",module:"@fluixi/reactive/store",returns:"store-handle"},$resource:{export:"resource",module:q,returns:"resource-handle"},$cachedResource:{export:"cachedResource",module:"@fluixi/reactive/cached-resource",returns:"resource-handle"},$selector:{export:"createSelector",module:q,returns:"memo-accessor"},$deferred:{export:"createDeferred",module:q,returns:"memo-accessor"},$untrack:{export:"untrack",module:q,returns:"plain"},$untrackStore:{export:"untrackStore",module:"@fluixi/reactive/store",returns:"plain"},$batch:{export:"batch",module:q,returns:"plain"},$cleanup:{export:"onCleanup",module:q,returns:"plain"},$root:{export:"root",module:q,returns:"plain"},$context:{export:"context",module:q,returns:"plain"},$renderEffect:{export:"renderEffect",module:q,returns:"effect"},$computed:{export:"computed",module:q,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 Hy=new RegExp(`\\$(?:${Object.keys(Ui).map(e=>e.slice(1)).join("|")})\\s*\\(`);var $c="__fx_source";var sf="__fx_hole",Ee=(e,t,r,n)=>`(globalThis.${sf} ?? ((f) => f))(${e},${t},${r}${n===void 0?"":`,${JSON.stringify(n)}`})`,af="__fx_props",Ac=(e,t)=>`(globalThis.${af} ?? ((p) => p))(${e},${JSON.stringify(t)})`;var Ki={version:1,module:"@fluixi/dom",symbols:["createNativeElement","insert","spread","setAttribute","delegateEvents","createComponent","createMemo","untrack","Show","For","Index","Switch","Match","Dynamic","ErrorBoundary"]},Xy={version:2,module:"@fluixi/dom",symbols:[...Ki.symbols,"template","cloneTemplate","walk"]};var cf=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Rc={className:"class",htmlFor:"for"},zi=new Set(["innerHTML","outerHTML","innerText","textContent","value","checked","selected","muted","defaultValue","defaultChecked","children","ref"]),lf=new Set(["script","style","textarea","title"]);function Ji(e){return lf.has(e)}function Gi(e){return Rc[e]??e}function fe(e){return e.kind!=="attr"||e.expr!==void 0||e.name.includes(":")?!1:!zi.has(e.name)}function Xi(e){if(!e.static||Ji(e.tag))return!1;for(let t of e.props)if(!fe(t))return!1;for(let t of e.children)if(t.kind!=="text"&&!(t.kind==="element"&&Xi(t)))return!1;return!0}function qe(e){let t=e.props.map(df).filter(Boolean).join(""),r=`<${e.tag}${t}>`;return cf.has(e.tag)?r:`${r}${e.children.map(uf).join("")}</${e.tag}>`}function uf(e){if(e.kind==="text")return mf(e.value);if(e.kind!=="element")throw new Error(`serializeStatic: unexpected ${e.kind}`);return qe(e)}var ff=new Set(["draggable","spellcheck","contenteditable"]);function pf(e){return e.startsWith("aria-")||ff.has(e.toLowerCase())}function df(e){let t=Rc[e.name]??e.name,r=e.literal;return(r===!0||r===!1||r===void 0)&&pf(t)?` ${t}="${r!==!1}"`:r===!0||r===void 0?` ${t}`:r===!1||r===null?"":` ${t}="${hf(String(r))}"`}function hf(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mf(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zr(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 yf="<!--fx-->",vf="<!--fx/-->";function Fe(e){return e.kind==="expr"||e.kind==="component"||Yi(e)}function Yi(e){return e.kind==="element"&&e.tag.includes("-")}function Zi(e){return Yi(e)?!0:"children"in e&&Array.isArray(e.children)&&e.children.some(Zi)}function gf(e){return e.kind==="text"||e.kind==="element"&&Cc(e)}var bf=new Set(["indeterminate"]);function Sf(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"?fe(e)?"serialize":"class":t==="classList"?fe(e)?"serialize":e.reactive?"classListDynamic":"classList":t==="style"?fe(e)?"serialize":e.reactive?"styleDynamic":"style":t.includes(":")||zi.has(t)?null:bf.has(t)?"property":e.expr===void 0?fe(e)?"serialize":null:"attr"}function wf(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 Tt(e){let t=e.tag.includes("-"),r={serialize:[],bindings:[]};for(let n of wf(e)){let i=Sf(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 Cc(e){return e.svg||Yi(e)||Ji(e.tag)||!Tt(e)?!1:e.children.every(t=>gf(t)||Fe(t))}function Tc(e){if(Fe(e))return!0;let t=e.children;return t?t.some(Tc):!1}function Oc(e){if(e.kind!=="element")return!1;let t=Tt(e);return t&&t.bindings.length>0?!0:e.children.some(Oc)}function Ct(e){return Tc(e)||Oc(e)}function _c(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"||_c(t))}function Nc(e,t=!1){if(!Cc(e)||!_c(e)||!Ct(e))return null;let r=[],n=[],i=[],o=0,a=l=>{let f=`_n$${o++}`;return r.push({ref:f,expr:l}),f},s=new Set;return t?c(e,"_el$"):u(e,"_el$"),{html:t?Ef(e,s):xf(e),tag:e.tag,steps:r,holes:n,bindings:i};function c(l,f){let d=Tt(l);if(d)for(let S of d.bindings)i.push({ref:f,prop:S.prop,kind:S.kind});let y=-1;l.children.forEach((S,g)=>{Ct(S)&&(y=g)});let v=null,p=!1,b=null,T=()=>v?`${v}.nextSibling`:`${f}.firstChild`;for(let S=0;S<=y;S++){let g=l.children[S];if(Fe(g)){let H=l.children[S+1];if(!H){n.push({parentRef:f,node:g});continue}if(Fe(H)||H.kind==="text"&&p){s.add(g);let J=a(T());n.push({parentRef:f,anchorRef:J,node:g}),v=J,p=!1;continue}b=a(T()),n.push({parentRef:f,anchorRef:b,node:g});continue}let L=b??a(T());b=null,g.kind==="element"&&Ct(g)&&c(g,L),v=L,p=g.kind==="text"}}function u(l,f){let d=Tt(l);if(d)for(let p of d.bindings)i.push({ref:f,prop:p.prop,kind:p.kind});let y=-1;l.children.forEach((p,b)=>{Ct(p)&&(y=b)});let v=null;for(let p=0;p<=y;p++){let b=l.children[p],T=v?`${v}.nextSibling`:`${f}.firstChild`;if(Fe(b)){let g=a(T),L=a(`holeEnd(${g})`);n.push({parentRef:f,startRef:g,endRef:L,node:b}),v=L;continue}let S=a(T);b.kind==="element"&&Ct(b)&&u(b,S),v=S}}}function xf(e){return qe(Qi(e)).split(eo).join(yf+vf)}function Ef(e,t){return qe(Qi(e,t)).split(eo).join("<!>").split(Dc).join("")}function Qi(e,t){let r=Tt(e);return{...e,props:r?r.serialize:[],children:e.children.map(n=>Fe(n)?{kind:"text",value:!t||t.has(n)?eo:Dc}:n.kind==="element"?Qi(n,t):n)}}var eo="\0fx-hole\0",Dc="\0fx-none\0";function Ic(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 Mc(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 a=Mc(e,r);if(a<0)return-1;r=a}else if(o==='"'||o==="'"){let a=Ic(e,r);if(a<0)return-1;r=a}else o==="{"?i++:o==="}"&&i--,r++}}else r++}}return-1}function kf(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 $f(e){return e!==""&&/[A-Za-z0-9_$)\]]/.test(e)}function Af(e){let t=0,r="",n=0;for(;n<e.length;){let i=e[n];if(i==='"'||i==="'"){let o=Ic(e,n);if(o<0)return null;n=o,r=i}else if(i==="`"){let o=Mc(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==="/"&&!$f(r)){let o=kf(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 M(e,t){let r=e.trim();return r===""?`(${e})`:t==="arrowBody"&&r[0]==="{"?`(${e})`:Af(r)===!1?e:`(${e})`}function Rf(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)}function Jr(e){return Rf(e)?e:JSON.stringify(e)}function Lc(e){if(e.expr!==void 0){if(e.name==="ref"&&e.at)return Ee(M(e.expr,"value"),e.at.line,e.at.column,e.expr);if(!e.reactive)return M(e.expr,"value");let t=`() => ${M(e.expr,"arrowBody")}`;return e.at?Ee(t,e.at.line,e.at.column,e.directive):t}return JSON.stringify(e.literal??!0)}function Cf(e){return e.expr!==void 0?M(e.expr,"value"):JSON.stringify(e.literal??!0)}var Tf=/^(?:-?\d[\d_]*(?:\.\d+)?(?:e[+-]?\d+)?|"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*'|true|false|null)$/;function Of(e){return e.expr===void 0||Tf.test(e.expr.trim())}function jc(e){return e===void 0?String(e):/^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)*$/.test(e.trim())?e:`() => (${e})`}function _f(e,t,r){let n=e.filter(s=>s.kind==="spread"),o=e.filter(s=>s.kind!=="spread").map(s=>`${Jr(s.name)}: ${Lc(s)}`);t!=null&&o.push(`children: ${t}`);let a=`{ ${o.join(", ")} }`;return n.length>0?(r.add("mergeProps"),`mergeProps(${n.map(s=>jc(s.expr)).join(", ")}, ${a})`):a}function Nf(e,t){return t?Ee(e,t.line,t.column):e}function Hc(e,t,r){if(e.length===1)return Ue(e[0],t,r);let n=!1;return`[${e.map(o=>{let a=Ue(o,t,r);return o.kind==="element"&&n?(t.add("deferElement"),`deferElement(() => ${M(a,"arrowBody")})`):((o.kind==="component"||o.kind==="expr"&&o.reactive)&&(n=!0),a)}).join(", ")}]`}function Df(e,t,r,n,i,o){n.add("createComponent");let a=t.filter(v=>v.kind==="spread"),s=t.filter(v=>v.kind!=="spread"),c=[],u=[];for(let v of s)(Of(v)?c:u).push([v.name,Cf(v)]);r.length>0&&u.push(["children",Hc(r,n,i)]);let l=c.map(([v,p])=>`${Jr(v)}: ${p}`),f=`{ ${[...l,...u.map(([v,p])=>`get ${Jr(v)}() { return ${p}; }`)].join(", ")} }`;if(u.some(([,v])=>/\bthis\b/.test(v))){let v=u.map(([b,T])=>`${JSON.stringify(b)}: () => (${T})`),p=u.map(([b])=>`get ${Jr(b)}() { return _$t[${JSON.stringify(b)}](); }`);f=`((_$t) => ({ ${[...l,...p].join(", ")} }))({ ${v.join(", ")} })`}a.length>0&&(n.add("mergeProps"),f=`mergeProps(${a.map(v=>jc(v.expr)).join(", ")}, ${f})`);let d={};for(let v of s)v.at&&(d[v.name]=[v.at.line,v.at.column]);Object.keys(d).length&&(f=Ac(f,d));let y=o?`globalThis.${$c}?.(${JSON.stringify(o.file)},${o.line},${o.column},${JSON.stringify(e)}), `:"";return y?`(${y}createComponent(${e}, ${f}))`:`createComponent(${e}, ${f})`}function to(e){let t=e.prop.name;return e.kind==="boolAttr"||t.startsWith("prop:")||t.startsWith("attr:")?t.slice(5):Gi(t)}function Pc(e,t){let{ref:r,prop:n,kind:i}=e,o=Lc(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(to(e))}, ${o});`;case"property":return t.add("setDynamicProperty"),`setDynamicProperty(${r}, ${JSON.stringify(to(e))}, ${o});`;case"boolAttr":return t.add("setDynamicBoolAttribute"),`setDynamicBoolAttribute(${r}, ${JSON.stringify(to(e))}, ${o});`;case"event":return Vc&&n.event.delegated?`${r}.$$${n.event.name} = ${o};`:(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"),n.assign?`handleRef(${o}, ${r}, (_v) => (${n.expr} = _v));`:`handleRef(${o}, ${r});`;case"use":return t.add("applyUse"),`applyUse(${r}, ${o});`}}function If(e,t){let r=Gi(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 Wc=!1,Gr=!1,Vc=!1;function Ue(e,t,r){switch(e.kind){case"text":return JSON.stringify(e.value);case"expr":{if(!e.reactive)return M(e.code,"value");let n=`() => ${M(e.code,"arrowBody")}`;return e.at?Ee(n,e.at.line,e.at.column):n}case"fragment":return e.children.length===0?"null":Hc(e.children,t,r);case"component":return Nf(Df(e.name,e.props,e.children,t,r,e.at),e.bindAt??e.at);case"element":{if(r&&e.static&&!e.svg&&Xi(e)&&!Zi(e)){let s=`_tmpl$${r.length}`;r.push({id:s,html:qe(e),tag:e.tag,svg:!1});let c=zr(e);return Gr?`${s}(${c?JSON.stringify(c):""})`:(t.add("templateNode"),c?`templateNode(${s}, ${JSON.stringify(e.tag)}, false, false, ${JSON.stringify(c)})`:`templateNode(${s}, ${JSON.stringify(e.tag)})`)}if(r&&Wc){let s=Nc(e,Gr);if(s&&Gr){t.add("insert");let c=`_tmpl$${r.length}`;r.push({id:c,html:s.html,tag:s.tag,svg:!1});let u=zr(e),l=[`const _el$ = ${c}(${u?JSON.stringify(u):""});`];for(let f of s.steps)l.push(`const ${f.ref} = ${f.expr};`);for(let f of s.bindings)l.push(Pc(f,t));for(let f of s.holes){let d=f.anchorRef?`, ${f.anchorRef}`:"";l.push(`insert(${f.parentRef}, ${Ue(f.node,t,r)}${d});`)}return l.push("return _el$;"),`(() => { ${l.join(" ")} })()`}if(s){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:s.html,tag:s.tag,svg:!1});let u=zr(e),l=[`const _el$ = templateNode(${c}, ${JSON.stringify(s.tag)}, true${u?`, false, ${JSON.stringify(u)}`:""});`];for(let f of s.steps)l.push(`const ${f.ref} = ${f.expr};`);for(let f of s.bindings)l.push(Pc(f,t));for(let f of s.holes)l.push(`insert(${f.parentRef}, holeScope(${f.startRef}, () => ${M(Ue(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=[],a=e.at?`${n}, ${e.svg}, ${JSON.stringify(e.at)}`:e.svg?`${n}, true`:n;if(o.push(`const ${i} = createNativeElement(${a});`),e.props.length>0)if(!e.svg&&e.props.every(fe))for(let s of e.props)o.push(If(i,s));else{t.add("spread");let s=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: ${_f(e.props,null,t)}${s}${u}${l} });`)}for(let s of e.children){t.add("insert");let c=Ue(s,t,r),u=s.kind==="expr"&&(s.reactive||!Pf(s.code))||s.kind==="component";o.push(u?`insert(${i}, ${c}, null);`:`insert(${i}, ${c});`)}return o.push(`return ${i};`),`(() => { ${o.join(" ")} })()`}}}var Mf=/^\s*(?:'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`[^`$]*`|-?\d[\d_.eE+-]*|true|false|null|undefined)\s*$/,Pf=e=>Mf.test(e);function Xr(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 Yr={name:"imperative",contract:Ki,emit(e,t){let r=new Set,n=t?.templateClone!==!1?[]:void 0;return Wc=t?.partialTemplates===!0,Vc=t?.assignEvents===!0,Gr=t?.client===!0,{code:Ue(e,r,n),imports:Array.from(r),templates:n}}};var ro=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mousedown","mouseup"]);function no(e){let t=e.split(/\r\n|\n|\r/),r=0;for(let i=0;i<t.length;i++)/[^ \t]/.test(t[i])&&(r=i);let n="";for(let i=0;i<t.length;i++){let o=t[i].replace(/\t/g," ");i!==0&&(o=o.replace(/^ +/,"")),i!==t.length-1&&(o=o.replace(/ +$/,"")),o&&(i!==r&&(o+=" "),n+=o)}return n}var Lf=new Set(["a","button","input","select","textarea","summary","details","option","label"]),jf=new Set(["keydown","keyup","keypress"]);function Ke(e,t){return e.attributes.find(r=>"name"in r&&r.name===t)}function Hf(e){return e.attributes.some(t=>t.kind==="Spread")}function Zr(e,t){let r=Ke(e,t);if(!r||r.kind!=="Attribute"||!r.value)return;let n=r.value;return n.kind==="static"?n.value:void 0}function Wf(e){let t=Zr(e,"role");return t==="presentation"||t==="none"?!0:Zr(e,"aria-hidden")==="true"}function Bc(e,t){return e.attributes.some(r=>r.kind==="EventBinding"&&t(r.name))}function qc(e){let t=[],r=(i,o,a)=>{t.push({code:o,message:a,severity:"warning",loc:i.loc})},n=i=>{for(let o of i){o.kind==="Element"&&Vf(o,r);let a="children"in o?o.children:void 0;a&&n(a)}};return n(e.children),t}function Vf(e,t){if(Hf(e))return;let r=e.tag.toLowerCase();r==="img"&&!Ke(e,"alt")&&!Wf(e)&&t(e,"a11y-img-alt",'An `img` needs an `alt`. Use `alt=""` when the image is decorative.'),r==="a"&&!Ke(e,"href")&&!Ke(e,"role")&&t(e,"a11y-anchor-href","An `a` without `href` is not a link. Use a `button` for an action."),r==="iframe"&&!Ke(e,"title")&&t(e,"a11y-iframe-title","An `iframe` needs a `title` describing its content.");let n=Zr(e,"tabindex")??Zr(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."),!Lf.has(r)&&Bc(e,i=>i==="click")&&!Ke(e,"role")&&!Bc(e,i=>jf.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 io(e){let t=(r,n)=>{r.parent=n;let i=Fc(r);for(let o of i)t(o,r)};return t(e,null),e}function Fc(e){switch(e.kind){case"Root":case"Element":case"Component":case"Fragment":return e.children;default:return[]}}var Uc=new Set(["capture","once","passive","prevent","stop","self"]);function pe(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 Kc=(e,t)=>({kind:"Attribute",name:t?e.name.slice(1):e.name,value:e.value,boolean:t,loc:e.loc}),Qr=[{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 a of i)Uc.has(a)||e.report("invalid-directive",`Unknown event modifier ".${a}" — expected one of ${[...Uc].join(", ")}`);return{kind:"EventBinding",name:o,syntax:t,modifiers:i,hole:pe(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:pe(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:pe(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:pe(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:pe(e,"if directive"),loc:e.loc})},{id:"each",elementOnly:!0,match:e=>e==="each",build:e=>({kind:"EachDirective",hole:pe(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:pe(e,"ref binding"),loc:e.loc})},{id:"property",match:e=>e[0]===".",build:e=>({kind:"PropertyBinding",name:e.name.slice(1),hole:pe(e,"property binding"),loc:e.loc})},{id:"boolean",match:e=>e[0]==="?",build:e=>Kc(e,!0)}];function oo(e,t=Qr,r={component:!1}){for(let n of t)if(!(n.elementOnly&&r.component)&&n.match(e.name))return n.build(e);return Kc(e,!1)}var so=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}mark(){return[this.pi,this.oi]}reset([e,t]){this.pi=e,this.oi=t}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 ao=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"]),Jc=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Gc(e){return e.length>0&&(e[0]!==e[0].toLowerCase()||e.includes("."))}var Bf=/[A-Za-z0-9\-_:@.?]/,qf=class{constructor(e,t){this.diagnostics=[],this.open=[],this.r=new so(e),this.svg=t.svg??!1,this.directives=t.directives??Qr,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 io(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(a=>a.kind==="ElseDirective")&&(n!=null&&(n.kind==="Element"||n.kind==="Component")&&n.attributes.some(s=>s.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=Gc(t),n=this.parseAttributes(r);this.foldEachKey(n,e),this.r.skipWhitespace();let i=t.toLowerCase(),o=!r&&zc.has(i),a=!r&&Jc.has(i),s=!1,c=[];if(this.r.startsWith("/>"))this.r.advance(),this.r.advance(),s=!0;else if(this.r.peek()===">"&&this.r.advance(),!a)if(this.open.push(t),c=o?this.parseRawText(t):this.parseChildren(),this.open.pop(),this.r.startsWith("</")){let f=this.r.mark(),d=this.consumeCloseTag();d&&d!==t&&(this.open.includes(d)?(this.r.reset(f),this.report("unclosed-tag","error",`Unclosed <${t}>`,this.r.span(e))):this.report("mismatched-close-tag","error",`Expected </${t}>, got </${d}>`,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:s,loc:u};let l=this.svg||ao.has(t)?"svg":"html";return{kind:"Element",tag:t,namespace:l,attributes:n,children:c,selfClosing:s,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 a=this.r.takeHole();t.push({kind:"Expression",hole:a.index,loc:a.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 s=this.r.takeHole();t.push({kind:"Spread",hole:s.index,loc:s.loc});continue}if(this.r.startsWith("...")){let s=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(s)})}else this.report("invalid-binding","error","Spread `...` must be followed by ${…}",this.r.span(s));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 a={name:n,nameLoc:i,value:o,loc:this.r.span(r),report:(s,c)=>this.report(s,"error",c,this.r.span(r))};t.push(oo(a,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,a=0;for(let l of e)l.kind==="EachDirective"?(r=l,i++):l.kind==="IfDirective"?n++:l.kind==="ElseDirective"?o++:l.kind==="RefBinding"&&a++;let s=this.r.span(t);i>1&&this.report("duplicate-directive","error","Multiple `each` directives on one element",s),n>1&&this.report("duplicate-directive","error","Multiple `if` directives on one element",s),a>1&&this.report("duplicate-directive","error","Multiple `ref` bindings on one element",s),n>0&&o>0&&this.report("invalid-directive","error","`if` and `else` cannot be on the same element",s);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",s);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=>Bf.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 en(e,t={}){return new qf(e,t).parse()}function Ff(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 Xc(e,t={}){return en(Ff(e),t)}function Uf(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}var Kf="container";function Yc(e){return e.charAt(0).toUpperCase()+e.slice(1)}var zf=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}=Yr.emit(e,{});for(let i of r)this.used.add(i);return Xr(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(a=>a.kind==="IfDirective");if(o&&o.kind==="IfDirective"){let a=r+1;a<e.length&&this.isBlankText(e[a])&&a++;let s=e[a],c=s&&(s.kind==="Element"||s.kind==="Component")&&s.attributes.some(u=>u.kind==="ElseDirective");t.push(this.lowerIf(n,o.hole,c?s:null)),c&&(r=a);continue}}let i=this.lowerNode(n);i&&t.push(i)}return t}isBlankText(e){return e.kind==="Text"&&!e.raw&&no(e.value)===""}lowerNode(e){switch(e.kind){case"Text":{if(e.raw)return{kind:"text",value:e.value};let t=Kr(no(e.value));return t?{kind:"text",value:t}:null}case"Comment":return null;case"Expression":{let t=this.hole(e.hole);return{kind:"expr",code:t.code,reactive:t.reactive,...t.at?{at:t.at}:{}}}case"Fragment":return{kind:"fragment",children:this.lowerChildren(e.children)};case"Element":return this.lowerElement(e);case"Component":return this.lowerComponent(e);default:return null}}lowerElement(e){let t=e.attributes.find(o=>o.kind==="Attribute"&&o.name==="is");if(e.tag==="component"&&t&&t.value&&t.value.kind==="hole"){let o=e.attributes.filter(s=>s!==t),a=this.lowerComponent({...e,kind:"Component",tag:"Dynamic",tagHole:null,attributes:o});return a.props.unshift({name:"component",kind:"attr",expr:`() => ${M(this.hole(t.value.hole).code,"arrowBody")}`}),a}let r=this.lowerEach(e),n=r?[r]:this.lowerChildren(e.children);if(e.tag===Kf)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},d={name:u,kind:"attr",expr:this.emit(f),jsxElement:!0},y=r.findIndex(v=>v.name===u);y>=0?r[y]=d:r.push(d)}let o=e.attributes.find(u=>u.kind==="LoadDirective");if(o?.dynamic)throw new Be(`'load:${o.strategy}' needs a literal value, not an expression: the strategy is compile-time.`);let a=o?gc(`load:${o.strategy}`,o.modifier):void 0,s=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}:{},...s?{bindAt:s}:{},...a?{load:a}:{},...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)},a=o.kind==="Element"?this.lowerElement(o):this.lowerComponent(o),s=t.get(i.value.value)??[];s.push(a),t.set(i.value.value,s);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 s=this.stripAndLower(r,c=>c.kind==="ElseDirective");i.push({name:"fallback",kind:"attr",expr:this.emit(s),jsxElement:!0})}let o=this.stripAndLower(e,s=>s.kind==="IfDirective"),a=this.tagAt(e);return{kind:"component",name:"Show",props:i,children:[o],...a?{at:a}:{},...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?`() => ${M(i.body,"arrowBody")}`:M(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=`() => ${M(this.emit(u),"arrowBody")}`}let a=[{kind:"expr",code:o,reactive:!1}],s=this.tagAt(e);return{kind:"component",name:"For",props:n,children:a,...s?{at:s}:{},...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 d=`() => ${M(f.code,"arrowBody")}`;return`${JSON.stringify(l)}: ${f.at?Ee(d,f.at.line,f.at.column):d}`},i=[],o=[],a,s=[],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)),a??=f.at;break}case"StyleDirective":{let f=this.hole(l.hole);s.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}, () => ${M(this.hole(l.hole).code,"arrowBody")}]`:`[${f}]`);break}}if(o.length>0&&i.push({name:"classList",kind:"attr",expr:`{ ${o.join(", ")} }`,reactive:!t&&r,...a?{at:a}:{}}),s.length>0){let l=`{ ${s.join(", ")} }`,f=i.findIndex(d=>d.name==="style");if(f===-1)i.push({name:"style",kind:"attr",expr:l,reactive:!t&&r,...c?{at:c}:{}});else{let d=i[f],y=d.expr===void 0?JSON.stringify(d.literal):d.reactive?`() => ${M(d.expr,"arrowBody")}`:d.expr;i[f]={name:"style",kind:"attr",expr:`[${y}, ${l}]`,reactive:!1,...d.at?{at:d.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"+Yc(e.name),kind:"event",event:{name:t,delegated:ro.has(t)},expr:r};let i=this.wrapHandler(r,e.modifiers),o=this.eventOptions(e.modifiers),a=o?`[${i}, ${o}]`:i;return{name:"on:"+t,kind:"attr",expr:a}}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 a=`bindPair(${r})`;return[{name:e,kind:"attr",expr:`${a}[0]()`,reactive:!0,directive:`bind:${e}`,...t.at?{at:t.at}:{}},{name:"on"+Yc(i),kind:"event",event:{name:i,delegated:ro.has(i)},expr:`(e) => ${a}[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,a,s=t.parts.map(c=>{if("text"in c)return Uf(Kr(c.text));let u=this.hole(c.hole);return o=o||u.reactive,a??=u.at,"${"+u.code+"}"}).join("");return i.expr="`"+s+"`",i.reactive=o,a&&(i.at=a),i}};function Zc(e,t,r,n={}){let{root:i,diagnostics:o}=en(e,{svg:n.svg});for(let a of o){if(a.severity==="error"){let s=n.positionAt?.(a.loc.start);throw new Error(`html template${s?` (${s.line}:${s.column+1})`:""}: ${a.message}`)}n.onDiagnostic?.(a)}return new zf(t,r,n.sourceFile,n.positionAt).lowerRoot(i.children)}var Jf=e=>"components"in e;function Qc(e,t){return e.replace(/\$(\d+)/g,(r,n)=>t[Number(n)]??r)}function Gf(e,t){return typeof t=="string"?{module:t,export:e}:t}function el(e=[]){let t=new Map,r=[],n=[];for(let a of e){if(!Jf(a)){n.push(a);continue}for(let[s,c]of Object.entries(a.components)){let u=Gf(s,c),l=t.get(s);if(l&&l.module!==u.module){let f=r.find(d=>d.name===s);f?f.modules.push(u.module):r.push({name:s,modules:[l.module,u.module]});continue}t.set(s,u)}}let i=new Map;return{resolve:a=>{if(i.has(a))return i.get(a);let s=t.get(a);if(!s)for(let c of n){let u=a.match(new RegExp(c.match.source,c.match.flags.replace("g","")));if(u){s={module:Qc(c.module,u),export:c.export?Qc(c.export,u):a};break}}return i.set(a,s),s},names:()=>[...t.keys()],conflicts:()=>r}}var tl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xf=new Uint8Array(64),Yf=new Uint8Array(128);for(let e=0;e<tl.length;e++){let t=tl.charCodeAt(e);Xf[e]=t,Yf[t]=e}var Vv=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 a=i[o];a.kind==="element"&&a.tag==="style"&&t.owner?i.splice(o,1):r(a)}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 Zf(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 co(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(Zf(e),e.holes,t)}function il(e,t,r={}){let n=new Set,i=[],o=Zc(e,[...t],n,{onDiagnostic:u=>i.push({code:u.code,message:u.message,offset:u.loc.start}),svg:r.svg,...r.sourceFile?{sourceFile:r.sourceFile}:{},...r.positionAt?{positionAt:r.positionAt}:{}});r.templateStyles&&nl(o,r.templateStyles),Ec(o),wc(o,{resolver:el(r.resolve??[]),modules:{controlFlowModule:r.controlFlowModule??"@fluixi/dom",coreModule:r.coreModule??"@fluixi/core",routerModule:r.routerModule??"@fluixi/core/router"},strategyFor:u=>u.load}),xc(o);let{code:a,imports:s,templates:c}=Yr.emit(o,{templateClone:r.templateClone,partialTemplates:r.partialTemplates,assignEvents:r.assignEvents,client:r.client});for(let u of s)n.add(u);return r.hoistTemplates?{...i.length?{diagnostics:i}:{},code:a,imports:[...n],ir:o,templates:c}:{...i.length?{diagnostics:i}:{},code:Xr(a,c),imports:[...n],ir:o}}function Qf(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 lo(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)Qf(o,t);if(i)for(let o of n.children)o.kind==="Expression"&&t.set(o.hole,"render");lo(n.children,t,r);break}case"Root":case"Fragment":lo(n.children,t,r);break;default:break}}function ol(e){let t=new Map,r=new Set;return lo(e.root.children,t,r),{holes:t,components:r}}var uo={...Vi,createMemo:w},ep=["For","Index","Show","Switch","Match","Portal","Dynamic","ErrorBoundary","Suspense"],fo=new Map;function al(e){for(let[t,r]of Object.entries(e))fo.set(t,r)}function tp(e){return e==="text"||e==="attr"||e==="control"}function rp(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"&&tp(i)?{code:`$$v[${n}]()`,reactive:!0}:{code:`$$v[${n}]`,reactive:!1}})}function np(e){if(fo.has(e))return fo.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 ip(e,t,r){let n=e,i=Xc(n,{svg:r}),o=i.diagnostics.filter(p=>p.severity==="error");if(o.length>0)throw new Error(`[fluixi] ${r?"svg":"html"}\`\`: ${o.map(p=>p.message).join("; ")}`);let{holes:a,components:s}=ol(i),{code:c,imports:u}=co({statics:n,holes:rp(t,a)},{svg:r}),l=u.filter(p=>!(p in uo));if(l.length>0)throw new Error(`[fluixi] no runtime binding for: ${l.join(", ")}`);let f=Array.from(new Set([...u,...ep])).filter(p=>p in uo),d=Array.from(s).filter(p=>!f.includes(p)),y=[...f,...d],v=new Function(...y,"$$v",`return (${c});`);return{run:p=>v(...f.map(b=>uo[b]),...d.map(np),p)}}var sl=new WeakMap;function op(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=op(r),o=n.get(i);return o||(o=ip(t,r,e),n.set(i,o)),o.run(r)}}var ll=cl(!1),ul=cl(!0);return yl(sp);})();