@stacksjs/stx 0.2.707 → 0.2.709

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.
Files changed (106) hide show
  1. package/dist/chunk-03xe9hxn.js +130 -0
  2. package/dist/chunk-20sv64qp.js +2 -0
  3. package/dist/{chunk-eqz0g5c5.js → chunk-2t59wh9y.js} +1 -1
  4. package/dist/{chunk-b2ajtmvk.js → chunk-2xp44gz3.js} +1 -1
  5. package/dist/chunk-40q04wnz.js +2 -0
  6. package/dist/{chunk-7ppbv5bc.js → chunk-4eatxb55.js} +6 -6
  7. package/dist/{chunk-p4s8hq38.js → chunk-4g152e86.js} +32 -16
  8. package/dist/chunk-5p1tvw02.js +2 -0
  9. package/dist/{chunk-wevcmbn6.js → chunk-5vejh42a.js} +4 -4
  10. package/dist/{chunk-nzyr320e.js → chunk-62qjy45q.js} +1 -1
  11. package/dist/{chunk-dzkg6cy5.js → chunk-659vn8hx.js} +1 -1
  12. package/dist/{chunk-txr51pkd.js → chunk-7d2astjj.js} +1 -1
  13. package/dist/{chunk-j9mpwt71.js → chunk-7f9mmtrs.js} +1 -1
  14. package/dist/{chunk-czy6hs6g.js → chunk-86b173cz.js} +2 -2
  15. package/dist/{chunk-t21ae4rx.js → chunk-89gemg31.js} +1 -1
  16. package/dist/{chunk-vjyrwvz0.js → chunk-8nfrqcd1.js} +1 -1
  17. package/dist/{chunk-1f4e06c2.js → chunk-8rvdpsjw.js} +1 -1
  18. package/dist/{chunk-r96wcqs6.js → chunk-8t9ws0ct.js} +1 -1
  19. package/dist/{chunk-2tqekz3d.js → chunk-9adx6f4k.js} +2 -2
  20. package/dist/{chunk-dmcjap96.js → chunk-9r5ntnef.js} +2 -2
  21. package/dist/chunk-bny1grrf.js +2 -0
  22. package/dist/chunk-c2dqq1mt.js +2 -0
  23. package/dist/{chunk-taste5sr.js → chunk-ck2kb6hd.js} +1 -1
  24. package/dist/{chunk-cam9je83.js → chunk-ck7e0yy2.js} +10 -10
  25. package/dist/{chunk-j3emvkjb.js → chunk-d7ayzcyg.js} +1 -1
  26. package/dist/{chunk-9v1t47d2.js → chunk-dcpgj3c6.js} +1 -1
  27. package/dist/{chunk-x8zekavj.js → chunk-dwda6jcc.js} +1 -1
  28. package/dist/{chunk-79p5580k.js → chunk-dyhzrdee.js} +1 -1
  29. package/dist/{chunk-7c7jnph2.js → chunk-e97h1wzd.js} +2 -2
  30. package/dist/{chunk-kqdzjgm6.js → chunk-fgjp28yp.js} +59 -58
  31. package/dist/{chunk-pfjsyvmj.js → chunk-g0eakxxe.js} +5 -5
  32. package/dist/{chunk-ktf42hmd.js → chunk-gkfm4v2a.js} +1 -1
  33. package/dist/chunk-gsn8mp7c.js +2 -0
  34. package/dist/{chunk-4m9qn8ps.js → chunk-h6pmg82p.js} +2 -2
  35. package/dist/{chunk-0v5nfhwg.js → chunk-hh3tgx1f.js} +2 -2
  36. package/dist/{chunk-4y73c35z.js → chunk-hjq5463c.js} +1 -1
  37. package/dist/chunk-hv7k0bmv.js +2 -0
  38. package/dist/{chunk-89s38bat.js → chunk-jbxyg5sc.js} +1 -1
  39. package/dist/{chunk-qprjkz11.js → chunk-jdgfzxyg.js} +2 -2
  40. package/dist/{chunk-cm8m2ygc.js → chunk-jh2jmbta.js} +4 -4
  41. package/dist/chunk-k4dehf34.js +2 -0
  42. package/dist/{chunk-0f12mv0z.js → chunk-k7e5nv70.js} +1 -1
  43. package/dist/chunk-kfzenpwm.js +2 -0
  44. package/dist/{chunk-g03tkxds.js → chunk-m8zahrwp.js} +1 -1
  45. package/dist/chunk-mg2zgvhz.js +2 -0
  46. package/dist/{chunk-2gny5jdt.js → chunk-mr3r8crk.js} +2 -2
  47. package/dist/chunk-n0dajrzk.js +2 -0
  48. package/dist/chunk-n3kbyt3h.js +2 -0
  49. package/dist/{chunk-t7ezw8cj.js → chunk-n7cw9ce3.js} +1 -1
  50. package/dist/{chunk-7hpwcwwh.js → chunk-nccxqcj2.js} +1 -1
  51. package/dist/{chunk-pgjqx3kg.js → chunk-nd9rs768.js} +1 -1
  52. package/dist/{chunk-3hhcea1p.js → chunk-p12nxr1r.js} +7 -7
  53. package/dist/{chunk-59k5ntkt.js → chunk-p3dkhz9v.js} +5 -5
  54. package/dist/{chunk-59g266vc.js → chunk-prhws9sn.js} +2 -2
  55. package/dist/{chunk-d21twmm2.js → chunk-qs2bt5vp.js} +1 -1
  56. package/dist/{chunk-sdpzaase.js → chunk-rdj74dqc.js} +1 -1
  57. package/dist/chunk-rnxrrhbv.js +2 -0
  58. package/dist/chunk-rtbkjq0y.js +2 -0
  59. package/dist/{chunk-c5tky2vf.js → chunk-t4ak76e6.js} +5 -5
  60. package/dist/{chunk-998zvkzr.js → chunk-tvcr9sct.js} +2 -2
  61. package/dist/{chunk-km5dpg5v.js → chunk-tzkyfw0p.js} +13 -13
  62. package/dist/{chunk-79vj1txq.js → chunk-vjqm4a5c.js} +1 -1
  63. package/dist/{chunk-6ms7rtqt.js → chunk-vpe6qaw2.js} +1 -1
  64. package/dist/chunk-w1bxxgm5.js +2 -0
  65. package/dist/{chunk-46s9ma3t.js → chunk-w7rczhn5.js} +1 -1
  66. package/dist/{chunk-qy1ss1en.js → chunk-wpfnbcvn.js} +1 -1
  67. package/dist/{chunk-zdpd29xd.js → chunk-wt18wv6x.js} +2 -2
  68. package/dist/{chunk-533g1b9b.js → chunk-x2gxx8eg.js} +2 -2
  69. package/dist/{chunk-f7a6nzx6.js → chunk-x91zfx03.js} +1 -1
  70. package/dist/chunk-xbbxa1t8.js +3 -0
  71. package/dist/{chunk-jx7q5cnv.js → chunk-xf3bt7xf.js} +1 -1
  72. package/dist/chunk-xnxj3z0t.js +2 -0
  73. package/dist/{chunk-jztsks2y.js → chunk-xz103bfc.js} +1 -1
  74. package/dist/chunk-zsfwzwsd.js +2 -0
  75. package/dist/cli.js +8 -8
  76. package/dist/client/signals-authoring-runtime.js +8 -1
  77. package/dist/client/signals-binding-utils-runtime.js +10 -1
  78. package/dist/craft-entry.js +1 -1
  79. package/dist/craft.js +1 -1
  80. package/dist/native/accessibility.d.ts +2 -2
  81. package/dist/native/accessibility.js +5 -3
  82. package/dist/native/compiler/html-to-ir.js +1 -1
  83. package/dist/native/runtime/native-host.js +5 -5
  84. package/dist/pwa.js +1 -1
  85. package/dist/ssg.js +8 -8
  86. package/dist/utils.js +41 -0
  87. package/package.json +5 -5
  88. package/dist/chunk-2dgbme86.js +0 -2
  89. package/dist/chunk-42t97n9v.js +0 -2
  90. package/dist/chunk-8ss2v7sw.js +0 -2
  91. package/dist/chunk-921gb49g.js +0 -2
  92. package/dist/chunk-9frqh3bj.js +0 -2
  93. package/dist/chunk-a35m0g7z.js +0 -2
  94. package/dist/chunk-bd9p1xmr.js +0 -2
  95. package/dist/chunk-d22sgyg2.js +0 -3
  96. package/dist/chunk-enssxcpa.js +0 -2
  97. package/dist/chunk-fen5nnc4.js +0 -2
  98. package/dist/chunk-gbkcc96c.js +0 -2
  99. package/dist/chunk-hs2sbkvk.js +0 -2
  100. package/dist/chunk-jef9mn1h.js +0 -2
  101. package/dist/chunk-pank9g6n.js +0 -2
  102. package/dist/chunk-pf427myt.js +0 -2
  103. package/dist/chunk-qf0bs4a5.js +0 -2
  104. package/dist/chunk-txjx2xd6.js +0 -2
  105. package/dist/chunk-w4vxhedk.js +0 -2
  106. package/dist/chunk-wj235n59.js +0 -130
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Fe,vn,Os,ai,O}from"./chunk-wp6q0geg.js";import{bn}from"./chunk-1f4e06c2.js";import{Rr,k,qc,ot,mi,Gc}from"./chunk-zdpd29xd.js";import{A}from"./chunk-zn3c0ew5.js";import{Ns,u,f,Mt,d,W,j,b,js,ke,He,Bs}from"./chunk-xyyt8v1r.js";import{s,ge}from"./chunk-vstvadc2.js";import{g}from"./chunk-0dve54ne.js";import{q}from"./chunk-ncs2j5kc.js";import Je from"path";import kt from"process";import{AsyncLocalStorage as wo}from"async_hooks";var ar=new wo;function fn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function cr(e,n){return ar.run(fn(e),n)}async function lr(e,n){let t=ar.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let c=JSON.stringify(l,(v,R)=>{if(R===void 0||typeof R==="function"||typeof R==="symbol"||typeof R==="bigint"||typeof R==="number"&&!Number.isFinite(R))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(R&&typeof R==="object"&&!Array.isArray(R)&&Object.getPrototypeOf(R)!==Object.prototype&&Object.getPrototypeOf(R)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return R}),y=JSON.parse(c);return t.values.set(e,y),y}).catch((l)=>{throw t.pending.delete(e),l});return t.pending.set(e,a),a}function vr(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function F(e,n=!1){let t=s(e),i=[],a=new Set,l=0,c=0,y=t.length,v=()=>{if(l!==0)return;let R=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(R){if(n&&R[1]==="const")return;let P=R[2];if(!a.has(P))i.push(P),a.add(P);return}let T=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(T){if(n&&t.slice(c).startsWith("const"))return;T[1].split(",").forEach((P)=>{let D=P.trim();if(!D)return;let G=D.indexOf(":"),B=(G>=0?D.slice(G+1).trim():D).split(/[\s=]/)[0];if(B&&!a.has(B))i.push(B),a.add(B)});return}let M=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(n&&t.slice(c).startsWith("const"))return;M[1].split(",").forEach((P)=>{let D=P.trim().replace(/^\.\.\./,"");if(!D)return;let G=D.split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}if(n)return;let N=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let P=N[1];if(!a.has(P))i.push(P),a.add(P);return}let L=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let P=L[1];if(!a.has(P))i.push(P),a.add(P)}};while(c<y){if(t[c]==="{"){l++,c++;continue}if(t[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function vs(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function So(e,n=F(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(F(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function ws(e,n){let t=`{ ${So(e,n)} }`;return F(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import An from"fs";import Ae from"path";function z(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ur=new Map;function xs(e,n=!0){let t=ur.get(e);if(n&&t)return t;let i=new Map,a=[Ae.join(e,"src"),Ae.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=An.readdirSync(c,{withFileTypes:!0})}catch{return}for(let R of v){let T=Ae.join(c,R.name);if(R.isDirectory()){if(R.name==="node_modules"||R.name.startsWith("."))continue;l(T,y+1)}else if(R.isFile()&&R.name.endsWith(".stx")){let M=R.name.slice(0,-4);if(!i.has(M))i.set(M,T);let N=M.toLowerCase();if(!i.has(N))i.set(N,T);let L=z(M);if(!i.has(L))i.set(L,T)}}}for(let c of a)if(l(c,0),i.size>0)break;if(n)ur.set(e,i);return i}function Ss(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let i=Ae.join(t,"node_modules",e);try{if(An.statSync(i).isDirectory())return i}catch{}let a=Ae.dirname(t);if(a===t)return null;t=a}}function ks(e,n,t={}){return[Ae.resolve(Ae.dirname(n),`${e}.stx`),Ae.resolve(Ae.dirname(n),e),Ae.resolve(t.componentsDir||"components",`${e}.stx`),Ae.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function fr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=z(n);return[n,t,i]}function Uo(e,n){let[t,i,a]=fr(e);for(let l of[t,t.toLowerCase(),i,a]){let c=n?.__importedComponents?.get(l);if(c!==void 0)return c}}function*Wo(e,n,t={},i){let a=fr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ae.resolve(Ae.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),y=[...i?.__originalFilePath?[Ae.join(Ae.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ae.join(Ae.dirname(n),"components"),Ae.resolve(c,"src/components"),Ae.resolve(c,"components"),...import.meta.dir?[Ae.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let R of l)yield Ae.join(v,R);try{for(let R of An.readdirSync(v,{withFileTypes:!0}))if(R.isDirectory())for(let T of l)yield Ae.join(v,R.name,T)}catch{}}}function pr(e,n,t={},i){let a=Uo(e,i);if(a!==void 0)return a;for(let l of Wo(e,n,t,i))try{if(An.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}import Js from"fs";import le from"path";import mt from"path";import Kt from"fs";var $o=new Set(["touchstart","touchmove","wheel","mousewheel"]);function rs(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return $o.has(e.toLowerCase())}var dr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),xr={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},vo=new Set(["ctrl","alt","shift","meta"]),$r={left:0,middle:1,right:2};function _r(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(vo.has(i))n.systemKeys.push(i);else if(i in $r)n.mouse=i;else if(i in xr||/^[a-z]$/.test(i))n.keys.push(xr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function Er(e,n=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,R=l.index,T=R+c.length,M=`__stx_evt_${n}${i++}`,N=[],L=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=L.exec(v))!==null){let[,G,K]=P,B=G.split("."),Q=B[0];if(!dr.has(Q))continue;N.push({attribute:`@${G}`,event:Q,handler:K,modifiers:_r(B.slice(1)),elementId:M})}let D=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=D.exec(v))!==null){let[,G,K]=P,B=G.split("."),Q=B[0];if(!dr.has(Q))continue;N.push({attribute:`@${G}`,event:Q,handler:K,modifiers:_r(B.slice(1)),elementId:M})}if(N.length>0)t.push({originalTag:c,elementId:M,events:N,startIndex:R,endIndex:T})}return t}function Eo(e){let n=[],{modifiers:t}=e;if(t.self)n.push("if ($event.target !== $el) return");for(let i of t.systemKeys)n.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=$r[t.mouse];n.push(`if ($event.button !== ${i}) return`)}if(t.prevent)n.push("$event.preventDefault()");if(t.stop)n.push("$event.stopPropagation()");return n.join("; ")}function ko(e,n){let t=e;if(n.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${n.debounce})`;else if(n.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${n.throttle})`;return t}function is(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Ro(e){let{modifiers:n}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Eo(e),a=ko(is(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(rs(e.event,n))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",y=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2
+ import{Fe,vn,Os,ai,O}from"./chunk-wp6q0geg.js";import{bn}from"./chunk-8rvdpsjw.js";import{Rr,k,qc,ot,mi,Kc}from"./chunk-wt18wv6x.js";import{A}from"./chunk-zn3c0ew5.js";import{Ns,u,f,Mt,d,W,j,b,js,ke,He,Bs}from"./chunk-xyyt8v1r.js";import{s,ge}from"./chunk-vstvadc2.js";import{g}from"./chunk-0dve54ne.js";import{q}from"./chunk-ncs2j5kc.js";import Je from"path";import kt from"process";import{AsyncLocalStorage as wo}from"async_hooks";var ar=new wo;function fn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function cr(e,n){return ar.run(fn(e),n)}async function lr(e,n){let t=ar.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let c=JSON.stringify(l,(v,R)=>{if(R===void 0||typeof R==="function"||typeof R==="symbol"||typeof R==="bigint"||typeof R==="number"&&!Number.isFinite(R))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(R&&typeof R==="object"&&!Array.isArray(R)&&Object.getPrototypeOf(R)!==Object.prototype&&Object.getPrototypeOf(R)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return R}),y=JSON.parse(c);return t.values.set(e,y),y}).catch((l)=>{throw t.pending.delete(e),l});return t.pending.set(e,a),a}function vr(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function F(e,n=!1){let t=s(e),i=[],a=new Set,l=0,c=0,y=t.length,v=()=>{if(l!==0)return;let R=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(R){if(n&&R[1]==="const")return;let P=R[2];if(!a.has(P))i.push(P),a.add(P);return}let T=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(T){if(n&&t.slice(c).startsWith("const"))return;T[1].split(",").forEach((P)=>{let N=P.trim();if(!N)return;let G=N.indexOf(":"),B=(G>=0?N.slice(G+1).trim():N).split(/[\s=]/)[0];if(B&&!a.has(B))i.push(B),a.add(B)});return}let M=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(n&&t.slice(c).startsWith("const"))return;M[1].split(",").forEach((P)=>{let N=P.trim().replace(/^\.\.\./,"");if(!N)return;let G=N.split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}if(n)return;let L=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let P=L[1];if(!a.has(P))i.push(P),a.add(P);return}let D=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(D){let P=D[1];if(!a.has(P))i.push(P),a.add(P)}};while(c<y){if(t[c]==="{"){l++,c++;continue}if(t[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function vs(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function So(e,n=F(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(F(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function ws(e,n){let t=`{ ${So(e,n)} }`;return F(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import An from"fs";import Ae from"path";function z(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ur=new Map;function xs(e,n=!0){let t=ur.get(e);if(n&&t)return t;let i=new Map,a=[Ae.join(e,"src"),Ae.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=An.readdirSync(c,{withFileTypes:!0})}catch{return}for(let R of v){let T=Ae.join(c,R.name);if(R.isDirectory()){if(R.name==="node_modules"||R.name.startsWith("."))continue;l(T,y+1)}else if(R.isFile()&&R.name.endsWith(".stx")){let M=R.name.slice(0,-4);if(!i.has(M))i.set(M,T);let L=M.toLowerCase();if(!i.has(L))i.set(L,T);let D=z(M);if(!i.has(D))i.set(D,T)}}}for(let c of a)if(l(c,0),i.size>0)break;if(n)ur.set(e,i);return i}function Ss(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let i=Ae.join(t,"node_modules",e);try{if(An.statSync(i).isDirectory())return i}catch{}let a=Ae.dirname(t);if(a===t)return null;t=a}}function ks(e,n,t={}){return[Ae.resolve(Ae.dirname(n),`${e}.stx`),Ae.resolve(Ae.dirname(n),e),Ae.resolve(t.componentsDir||"components",`${e}.stx`),Ae.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function fr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=z(n);return[n,t,i]}function Uo(e,n){let[t,i,a]=fr(e);for(let l of[t,t.toLowerCase(),i,a]){let c=n?.__importedComponents?.get(l);if(c!==void 0)return c}}function*Wo(e,n,t={},i){let a=fr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ae.resolve(Ae.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),y=[...i?.__originalFilePath?[Ae.join(Ae.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ae.join(Ae.dirname(n),"components"),Ae.resolve(c,"src/components"),Ae.resolve(c,"components"),...import.meta.dir?[Ae.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let R of l)yield Ae.join(v,R);try{for(let R of An.readdirSync(v,{withFileTypes:!0}))if(R.isDirectory())for(let T of l)yield Ae.join(v,R.name,T)}catch{}}}function pr(e,n,t={},i){let a=Uo(e,i);if(a!==void 0)return a;for(let l of Wo(e,n,t,i))try{if(An.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}import Js from"fs";import le from"path";import mt from"path";import Kt from"fs";var $o=new Set(["touchstart","touchmove","wheel","mousewheel"]);function rs(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return $o.has(e.toLowerCase())}var dr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),xr={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},vo=new Set(["ctrl","alt","shift","meta"]),$r={left:0,middle:1,right:2};function _r(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(vo.has(i))n.systemKeys.push(i);else if(i in $r)n.mouse=i;else if(i in xr||/^[a-z]$/.test(i))n.keys.push(xr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function Er(e,n=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,R=l.index,T=R+c.length,M=`__stx_evt_${n}${i++}`,L=[],D=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=D.exec(v))!==null){let[,G,K]=P,B=G.split("."),Q=B[0];if(!dr.has(Q))continue;L.push({attribute:`@${G}`,event:Q,handler:K,modifiers:_r(B.slice(1)),elementId:M})}let N=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=N.exec(v))!==null){let[,G,K]=P,B=G.split("."),Q=B[0];if(!dr.has(Q))continue;L.push({attribute:`@${G}`,event:Q,handler:K,modifiers:_r(B.slice(1)),elementId:M})}if(L.length>0)t.push({originalTag:c,elementId:M,events:L,startIndex:R,endIndex:T})}return t}function Eo(e){let n=[],{modifiers:t}=e;if(t.self)n.push("if ($event.target !== $el) return");for(let i of t.systemKeys)n.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=$r[t.mouse];n.push(`if ($event.button !== ${i}) return`)}if(t.prevent)n.push("$event.preventDefault()");if(t.stop)n.push("$event.stopPropagation()");return n.join("; ")}function ko(e,n){let t=e;if(n.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${n.debounce})`;else if(n.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${n.throttle})`;return t}function is(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Ro(e){let{modifiers:n}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Eo(e),a=ko(is(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(rs(e.event,n))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",y=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${t}');
5
5
  if (!$el) return;
@@ -111,8 +111,8 @@ else {
111
111
  ${e.map(Ro).join(`
112
112
  `)}
113
113
  })();
114
- </script>`}function To(e,n=""){let t=Er(e,n);if(t.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=t.length-1;l>=0;l--){let c=t[l],y=c.originalTag;if(!y.includes(" id="))y=y.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=y.match(/id=["']([^"']+)["']/);if(v)for(let R of c.events)R.elementId=v[1]}for(let v of c.events){let R=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),T=new RegExp(`\\s*${R}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${R}\\s*=\\s*'[^']*'`,"g");y=y.replace(T,""),y=y.replace(M,"")}i=i.slice(0,c.startIndex)+y+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Sr(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function dc(e,n,t){if(Gc(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:y,bindings:v}=To(e,Sr(n)),R=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...R,...v],y}let i=Er(e,Sr(n));if(i.length===0)return e;let a=e;for(let y=i.length-1;y>=0;y--){let v=i[y],R=v.originalTag;if(!R.includes(" id="))R=R.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let T=R.match(/id=["']([^"']+)["']/);if(T)for(let M of v.events)M.elementId=T[1]}for(let T of v.events){let M=T.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),N=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),L=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");R=R.replace(N,""),R=R.replace(L,"")}a=a.slice(0,v.startIndex)+R+a.slice(v.endIndex)}let l=qo(i.flatMap((y)=>y.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
115
- `+a.slice(c);else a+=l;return a}function kr(e,n){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Tt(e,n){let t=s(e),{depths:i,balanced:a}=ge(t),l=(y)=>!a||i[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let y of t.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&kr(y[1],!0).has(n))return!0;for(let y of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&kr(y[1],!1).has(n))return!0;return!1}var Tr="",In,at=/^[A-Za-z_$][\w$]*$/,Co=new Set(["if","for","while","switch","with"]),Cr=["(","[","{"],Ar=[")","]","}"],Ao=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Io(e){let n=s(e),t=[];for(let i of n.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:n,tokens:t}}function os(e){if(In&&e===Tr)return In;let{code:n,tokens:t}=Io(e),i=new Map,a=[];for(let P=0;P<t.length;P++){let D=t[P].text;if(["(","[","{"].includes(D))a.push(P);else if([")","]","}"].includes(D)){let G=a.at(-1);if(G!==void 0&&["()","[]","{}"].includes(t[G].text+D))a.pop(),i.set(G,P),i.set(P,G)}}function l(P,D){let G=[],K=P;for(let B=P;B<D;B++){if(["(","[","{"].includes(t[B].text)&&(i.get(B)??D)<D){B=i.get(B);continue}if(t[B].text===",")G.push([K,B]),K=B+1}return G.push([K,D]),G}let c=[];function y(P,D,G,K=!1){if(t[P]?.text==="...")P++;if(P>=D)return;let B=t[P].text;if(at.test(B)){if(G.add(B),G===T)c.push({name:B,token:P,functionScoped:K});return}if(B!=="{"&&B!=="[")return;let Q=i.get(P);if(Q===void 0||Q>=D)return;for(let[te,ne]of l(P+1,Q)){let ae=te;if(B==="{")for(let me=te;me<ne;me++){if(t[me].text===":"){ae=me+1;break}if(t[me].text==="=")break;if(["(","[","{"].includes(t[me].text)&&i.has(me))me=i.get(me)}y(ae,ne,G,K)}}function v(P,D){let G=new Set;for(let[K,B]of l(P,D))y(K,B,G);return G}function R(P){let D=P;for(;D<t.length;D++){let G=t[D].text;if(["(","[","{"].includes(G)&&i.has(D)){D=i.get(D);continue}if([",",";",")","]","}"].includes(G))break}return t[Math.max(P,D-1)]?.end??n.length}let T=new Set,M=[];for(let P=0;P<t.length;P++)if(t[P].text==="=>"){let D=P-1,G=D,K;if(t[D]?.text===")"&&i.has(D))G=i.get(D),K=v(G+1,D);else if(t[D]&&at.test(t[D].text))K=new Set([t[D].text]);else continue;let B=P+1,Q=t[B]?.text==="{"&&i.has(B)?t[i.get(B)].end:R(B);M.push({start:t[G].start,end:Q,bodyStart:t[B]?.start??Q,functionBody:!0,names:K})}else if(t[P].text==="("&&i.has(P)){let D=t[P-1]?.text;if(!D||Co.has(D)||!at.test(D)&&D!=="*"&&D!=="]")continue;let G=i.get(P),K=G+1;if(t[K]?.text===":"){K++;while(K<t.length&&!["{","=>",";","="].includes(t[K].text))K++}if(t[K]?.text!=="{"||!i.has(K))continue;M.push({start:t[P].start,end:t[i.get(K)].end,bodyStart:t[K].start,functionBody:D!=="catch",names:v(P+1,G)})}function N(P){let D=P;for(;D<t.length;D++){let G=t[D].text;if(Cr.includes(G)&&i.has(D)){D=i.get(D);continue}if(G===";"||Ar.includes(G))break;let K=t[D-1];if(D>P&&Ao.has(G)&&K.text!==".")break;if(D>P&&/[\n\r]/.test(n.slice(K.end,t[D].start))&&(/^[\w$]+$/.test(K.text)||Ar.includes(K.text)||['"',"'","`"].includes(K.text))&&at.test(G)&&!["in","of","instanceof"].includes(G))break}return D}let L=[];for(let P=0;P<t.length;P++){if(t[P].text!=="for")continue;let D=t[P+1]?.text==="await"?P+2:P+1;if(t[D]?.text!=="("||!i.has(D))continue;let G=i.get(D),K=G+1,B=t[K]?.text==="{"&&i.has(K)?i.get(K):N(K),Q=t[B]?.text===";"||t[B]?.text==="}"?t[B].end:t[Math.max(K,B-1)]?.end??n.length;L.push({headStart:D,headEnd:G,start:t[D].start,end:Q})}for(let P=0;P<t.length;P++){let D=t[P].text,G=t[P-1]?.text;if(G==="."||t[P+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(D==="const"||D==="let"||D==="var"){let K=N(P+1),B=P+1,Q=!1,te=!1,ne=0;for(let ae=P+1;ae<=K;ae++){let me=t[ae]?.text;if(ae<K&&Cr.includes(me)&&i.has(ae)&&i.get(ae)<K){ae=i.get(ae);continue}if(ae<K&&me===":"&&!te)Q=!0;else if(ae<K&&me==="="&&ne===0)Q=!1,te=!0;else if(ae<K&&Q&&me==="<")ne++;else if(ae<K&&Q&&me===">"&&ne>0)ne--;else if(ae===K||me===","&&ne===0)y(B,ae,T,D==="var"),B=ae+1,Q=!1,te=!1}}else if(D==="function"||D==="class"){let K=P+1;if(t[K]?.text==="*")K++;if(t[K]&&at.test(t[K].text)&&t[K].text!=="extends")T.add(t[K].text),c.push({name:t[K].text,token:K})}else if(D==="import"){let K=P+1;if(t[K]?.text==="*"&&t[K+1]?.text==="as")K+=2;let B=t[K]?.text;if(B&&at.test(B)&&B!=="type"&&t[K+1]?.text!=="("&&t[K+1]?.text!==".")T.add(B),c.push({name:B,token:K,file:!0});let Q=t[K]?.text==="{"?K:t[K+1]?.text===","&&t[K+2]?.text==="{"?K+2:-1;if(Q!==-1&&i.has(Q)){let te=i.get(Q);for(let[ne,ae]of l(Q+1,te)){let me=ae-1;while(me>=ne&&!at.test(t[me].text))me--;if(me>=ne&&t[me].text!=="type")c.push({name:t[me].text,token:me,file:!0})}}}}return Tr=e,In={code:n,scopes:M,loops:L,declarations:T,sites:c,tokens:t,pairs:i},In}function as(e){let n=os(e);return{code:n.code,shadows:(t,i)=>n.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function On(e){return new Set(os(e).declarations)}function cn(e,n){let{scopes:t,loops:i,sites:a,tokens:l,pairs:c}=os(e),y=Array.from({length:l.length},()=>-1),v=[];for(let L=0;L<l.length;L++){y[L]=v.length?v[v.length-1]:-1;let P=l[L].text;if(P==="{"&&c.has(L))v.push(L);else if(P==="}"&&v.length&&c.get(L)===v[v.length-1])v.pop()}let R=new Set,T=new Map;for(let L of a){if(!n.has(L.name))continue;R.add(L.token);let P=L.file?-1:y[L.token],D=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(L.functionScoped){let K=l[L.token].start,B=t.filter((Q)=>Q.functionBody&&K>=Q.bodyStart&&K<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];D=B?[B.bodyStart,B.end]:[0,Number.POSITIVE_INFINITY]}else if(!L.file){let K=i.filter((B)=>L.token>B.headStart&&L.token<B.headEnd).sort((B,Q)=>B.headEnd-B.headStart-(Q.headEnd-Q.headStart))[0];if(K)D=[K.start,K.end]}let G=T.get(L.name);if(G)G.push(D);else T.set(L.name,[D])}let M=new Set;for(let L=0;L<l.length;L++){if(l[L].text!=="import"||l[L-1]?.text===".")continue;let P=L+1;if(l[P]?.text==="type")P++;if(l[P]&&at.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let D=P+1;D<c.get(P);D++)M.add(D)}let N=new Set;for(let L=0;L<l.length;L++){let P=l[L].text;if(!n.has(P)||N.has(P)||R.has(L)||M.has(L))continue;let D=l[L-1]?.text;if(D==="#"||D==="."&&l[L-2]?.text!=="..")continue;if(l[L+1]?.text===":"&&(D==="{"||D===","))continue;let G=l[L].start;if(T.get(P)?.some(([K,B])=>G>=K&&G<B))continue;if(t.some((K)=>G>=K.start&&G<K.end&&K.names.has(P)))continue;N.add(P)}return N}var Pe="0.2.707";var Ir=Symbol.for(`stx.lazy-module-promises.${Pe}`);function Po(){let e=globalThis;return e[Ir]??=new Map,e[Ir]}function o(e,n){let t=Po(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let l=n();return t.set(i,l),l.catch(()=>{if(t.get(i)===l)t.delete(i)}),l}var Mo=/<\/(script)/gi;function ln(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Mo,"<\\/$1")}import Mr from"fs";class V{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(n):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,Do=500;function $t(e,n){if(n?.includes("g"))return new RegExp(e,n);let t=`${e}:${n||""}`;if(!St.has(t)){if(St.size>=Do){let i=St.keys().next().value;if(i)St.delete(i)}St.set(t,new RegExp(e,n))}return St.get(t)}class Or{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),t=n.sort().join(","),i=this.pool.find((y)=>y.context.join(",")===t);if(i)return i.func;let a=this.fnCache,l=this.fnCacheMaxSize,c=(...y)=>(v)=>{try{let R=`${t}:${v}`,T=a.get(R);if(!T){if(a.size>=l){let M=a.keys().next().value;if(M)a.delete(M)}T=Function(...n,`
114
+ </script>`}function To(e,n=""){let t=Er(e,n);if(t.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=t.length-1;l>=0;l--){let c=t[l],y=c.originalTag;if(!y.includes(" id="))y=y.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=y.match(/id=["']([^"']+)["']/);if(v)for(let R of c.events)R.elementId=v[1]}for(let v of c.events){let R=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),T=new RegExp(`\\s*${R}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${R}\\s*=\\s*'[^']*'`,"g");y=y.replace(T,""),y=y.replace(M,"")}i=i.slice(0,c.startIndex)+y+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Sr(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function dc(e,n,t){if(Kc(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:y,bindings:v}=To(e,Sr(n)),R=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...R,...v],y}let i=Er(e,Sr(n));if(i.length===0)return e;let a=e;for(let y=i.length-1;y>=0;y--){let v=i[y],R=v.originalTag;if(!R.includes(" id="))R=R.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let T=R.match(/id=["']([^"']+)["']/);if(T)for(let M of v.events)M.elementId=T[1]}for(let T of v.events){let M=T.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),L=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");R=R.replace(L,""),R=R.replace(D,"")}a=a.slice(0,v.startIndex)+R+a.slice(v.endIndex)}let l=qo(i.flatMap((y)=>y.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
115
+ `+a.slice(c);else a+=l;return a}function kr(e,n){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Tt(e,n){let t=s(e),{depths:i,balanced:a}=ge(t),l=(y)=>!a||i[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let y of t.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&kr(y[1],!0).has(n))return!0;for(let y of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&kr(y[1],!1).has(n))return!0;return!1}var Tr="",In,at=/^[A-Za-z_$][\w$]*$/,Co=new Set(["if","for","while","switch","with"]),Cr=["(","[","{"],Ar=[")","]","}"],Ao=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Io(e){let n=s(e),t=[];for(let i of n.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:n,tokens:t}}function os(e){if(In&&e===Tr)return In;let{code:n,tokens:t}=Io(e),i=new Map,a=[];for(let P=0;P<t.length;P++){let N=t[P].text;if(["(","[","{"].includes(N))a.push(P);else if([")","]","}"].includes(N)){let G=a.at(-1);if(G!==void 0&&["()","[]","{}"].includes(t[G].text+N))a.pop(),i.set(G,P),i.set(P,G)}}function l(P,N){let G=[],K=P;for(let B=P;B<N;B++){if(["(","[","{"].includes(t[B].text)&&(i.get(B)??N)<N){B=i.get(B);continue}if(t[B].text===",")G.push([K,B]),K=B+1}return G.push([K,N]),G}let c=[];function y(P,N,G,K=!1){if(t[P]?.text==="...")P++;if(P>=N)return;let B=t[P].text;if(at.test(B)){if(G.add(B),G===T)c.push({name:B,token:P,functionScoped:K});return}if(B!=="{"&&B!=="[")return;let Q=i.get(P);if(Q===void 0||Q>=N)return;for(let[te,ne]of l(P+1,Q)){let ae=te;if(B==="{")for(let me=te;me<ne;me++){if(t[me].text===":"){ae=me+1;break}if(t[me].text==="=")break;if(["(","[","{"].includes(t[me].text)&&i.has(me))me=i.get(me)}y(ae,ne,G,K)}}function v(P,N){let G=new Set;for(let[K,B]of l(P,N))y(K,B,G);return G}function R(P){let N=P;for(;N<t.length;N++){let G=t[N].text;if(["(","[","{"].includes(G)&&i.has(N)){N=i.get(N);continue}if([",",";",")","]","}"].includes(G))break}return t[Math.max(P,N-1)]?.end??n.length}let T=new Set,M=[];for(let P=0;P<t.length;P++)if(t[P].text==="=>"){let N=P-1,G=N,K;if(t[N]?.text===")"&&i.has(N))G=i.get(N),K=v(G+1,N);else if(t[N]&&at.test(t[N].text))K=new Set([t[N].text]);else continue;let B=P+1,Q=t[B]?.text==="{"&&i.has(B)?t[i.get(B)].end:R(B);M.push({start:t[G].start,end:Q,bodyStart:t[B]?.start??Q,functionBody:!0,names:K})}else if(t[P].text==="("&&i.has(P)){let N=t[P-1]?.text;if(!N||Co.has(N)||!at.test(N)&&N!=="*"&&N!=="]")continue;let G=i.get(P),K=G+1;if(t[K]?.text===":"){K++;while(K<t.length&&!["{","=>",";","="].includes(t[K].text))K++}if(t[K]?.text!=="{"||!i.has(K))continue;M.push({start:t[P].start,end:t[i.get(K)].end,bodyStart:t[K].start,functionBody:N!=="catch",names:v(P+1,G)})}function L(P){let N=P;for(;N<t.length;N++){let G=t[N].text;if(Cr.includes(G)&&i.has(N)){N=i.get(N);continue}if(G===";"||Ar.includes(G))break;let K=t[N-1];if(N>P&&Ao.has(G)&&K.text!==".")break;if(N>P&&/[\n\r]/.test(n.slice(K.end,t[N].start))&&(/^[\w$]+$/.test(K.text)||Ar.includes(K.text)||['"',"'","`"].includes(K.text))&&at.test(G)&&!["in","of","instanceof"].includes(G))break}return N}let D=[];for(let P=0;P<t.length;P++){if(t[P].text!=="for")continue;let N=t[P+1]?.text==="await"?P+2:P+1;if(t[N]?.text!=="("||!i.has(N))continue;let G=i.get(N),K=G+1,B=t[K]?.text==="{"&&i.has(K)?i.get(K):L(K),Q=t[B]?.text===";"||t[B]?.text==="}"?t[B].end:t[Math.max(K,B-1)]?.end??n.length;D.push({headStart:N,headEnd:G,start:t[N].start,end:Q})}for(let P=0;P<t.length;P++){let N=t[P].text,G=t[P-1]?.text;if(G==="."||t[P+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(N==="const"||N==="let"||N==="var"){let K=L(P+1),B=P+1,Q=!1,te=!1,ne=0;for(let ae=P+1;ae<=K;ae++){let me=t[ae]?.text;if(ae<K&&Cr.includes(me)&&i.has(ae)&&i.get(ae)<K){ae=i.get(ae);continue}if(ae<K&&me===":"&&!te)Q=!0;else if(ae<K&&me==="="&&ne===0)Q=!1,te=!0;else if(ae<K&&Q&&me==="<")ne++;else if(ae<K&&Q&&me===">"&&ne>0)ne--;else if(ae===K||me===","&&ne===0)y(B,ae,T,N==="var"),B=ae+1,Q=!1,te=!1}}else if(N==="function"||N==="class"){let K=P+1;if(t[K]?.text==="*")K++;if(t[K]&&at.test(t[K].text)&&t[K].text!=="extends")T.add(t[K].text),c.push({name:t[K].text,token:K})}else if(N==="import"){let K=P+1;if(t[K]?.text==="*"&&t[K+1]?.text==="as")K+=2;let B=t[K]?.text;if(B&&at.test(B)&&B!=="type"&&t[K+1]?.text!=="("&&t[K+1]?.text!==".")T.add(B),c.push({name:B,token:K,file:!0});let Q=t[K]?.text==="{"?K:t[K+1]?.text===","&&t[K+2]?.text==="{"?K+2:-1;if(Q!==-1&&i.has(Q)){let te=i.get(Q);for(let[ne,ae]of l(Q+1,te)){let me=ae-1;while(me>=ne&&!at.test(t[me].text))me--;if(me>=ne&&t[me].text!=="type")c.push({name:t[me].text,token:me,file:!0})}}}}return Tr=e,In={code:n,scopes:M,loops:D,declarations:T,sites:c,tokens:t,pairs:i},In}function as(e){let n=os(e);return{code:n.code,shadows:(t,i)=>n.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function On(e){return new Set(os(e).declarations)}function cn(e,n){let{scopes:t,loops:i,sites:a,tokens:l,pairs:c}=os(e),y=Array.from({length:l.length},()=>-1),v=[];for(let D=0;D<l.length;D++){y[D]=v.length?v[v.length-1]:-1;let P=l[D].text;if(P==="{"&&c.has(D))v.push(D);else if(P==="}"&&v.length&&c.get(D)===v[v.length-1])v.pop()}let R=new Set,T=new Map;for(let D of a){if(!n.has(D.name))continue;R.add(D.token);let P=D.file?-1:y[D.token],N=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(D.functionScoped){let K=l[D.token].start,B=t.filter((Q)=>Q.functionBody&&K>=Q.bodyStart&&K<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];N=B?[B.bodyStart,B.end]:[0,Number.POSITIVE_INFINITY]}else if(!D.file){let K=i.filter((B)=>D.token>B.headStart&&D.token<B.headEnd).sort((B,Q)=>B.headEnd-B.headStart-(Q.headEnd-Q.headStart))[0];if(K)N=[K.start,K.end]}let G=T.get(D.name);if(G)G.push(N);else T.set(D.name,[N])}let M=new Set;for(let D=0;D<l.length;D++){if(l[D].text!=="import"||l[D-1]?.text===".")continue;let P=D+1;if(l[P]?.text==="type")P++;if(l[P]&&at.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let N=P+1;N<c.get(P);N++)M.add(N)}let L=new Set;for(let D=0;D<l.length;D++){let P=l[D].text;if(!n.has(P)||L.has(P)||R.has(D)||M.has(D))continue;let N=l[D-1]?.text;if(N==="#"||N==="."&&l[D-2]?.text!=="..")continue;if(l[D+1]?.text===":"&&(N==="{"||N===","))continue;let G=l[D].start;if(T.get(P)?.some(([K,B])=>G>=K&&G<B))continue;if(t.some((K)=>G>=K.start&&G<K.end&&K.names.has(P)))continue;L.add(P)}return L}var Pe="0.2.709";var Ir=Symbol.for(`stx.lazy-module-promises.${Pe}`);function Po(){let e=globalThis;return e[Ir]??=new Map,e[Ir]}function o(e,n){let t=Po(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let l=n();return t.set(i,l),l.catch(()=>{if(t.get(i)===l)t.delete(i)}),l}var Mo=/<\/(script)/gi;function ln(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Mo,"<\\/$1")}import Mr from"fs";class V{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(n):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,Do=500;function $t(e,n){if(n?.includes("g"))return new RegExp(e,n);let t=`${e}:${n||""}`;if(!St.has(t)){if(St.size>=Do){let i=St.keys().next().value;if(i)St.delete(i)}St.set(t,new RegExp(e,n))}return St.get(t)}class Or{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),t=n.sort().join(","),i=this.pool.find((y)=>y.context.join(",")===t);if(i)return i.func;let a=this.fnCache,l=this.fnCacheMaxSize,c=(...y)=>(v)=>{try{let R=`${t}:${v}`,T=a.get(R);if(!T){if(a.size>=l){let M=a.keys().next().value;if(M)a.delete(M)}T=Function(...n,`
116
116
  'use strict';
117
117
  try {
118
118
  return ${v};
@@ -131,7 +131,7 @@ ${n.contents}
131
131
  `)}
132
132
  `}var Bf=k,jr=w(256);function Ot(e){let n=x(e),t=jr.get(n);if(!t)t=Ho(e),jr.set(n,t);return{code:t.code,imports:[...t.imports],models:[...t.models]}}function Ho(e){let n=s(e),t=new Set;for(let y of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let v of y[1].split(",")){let R=v.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(R)t.add(R)}let i=On(n),a=we.filter((y)=>{if(t.has(y)||i.has(y))return!1;return ni(n,y,!0)}),l=zr(n).filter((y)=>!t.has(y)&&!i.has(y));if(a.length===0&&l.length===0)return{code:e,imports:a,models:l};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
133
133
  `)}
134
- ${e}`,imports:a,models:l}}var ea=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function zr(e){let n=new Set,t=as(e),i=On(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let l of t.code.matchAll(a)){let c=l[1];if(ea.has(c)||i.has(c)||c.length<3)continue;if(t.shadows(c,l.index??0))continue;n.add(c)}return Array.from(n)}function ta(e){return On(e)}var Nr=w(128);function Ac(e){let n=x(e),t=Nr.get(n);if(!t)t=na(e),Nr.set(n,t);return{code:t.code,stxImports:[...t.stxImports],browserImports:[...t.browserImports]}}function na(e){let n=new Set,t=new Set,i=e;i=i.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,c;while((c=l.exec(e))!==null){let M=c[1],N=c[2];if(c[0].includes("import type"))continue;let L=[];for(let D of M.split(",")){let G=D.trim();if(!G||G.startsWith("type "))continue;let K=G.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!K)continue;let B=K[1],Q=K[2]||B;if(a.add(B),a.add(Q),N==="stx"||N==="@stacksjs/stx")n.add(B);else t.add(B);if(Q!==B)L.push(`${Q} = ${B}`)}let P=L.length>0?`var ${L.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(c[0],P)}let y=ta(i);for(let M of Bf){if(a.has(M)||y.has(M))continue;if(ni(i,M,!0))n.add(M)}let v=s(i),R=new Set;for(let M of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let N of M[1].split(",")){let L=N.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let P of L){let D=P.trim();if(D)R.add(D)}}for(let M of we){if(a.has(M)||y.has(M)||R.has(M))continue;if(ni(v,M))t.add(M)}let T=zr(v);for(let M of T)if(!a.has(M)&&!y.has(M))t.add(M);return{code:i,stxImports:Array.from(n),browserImports:Array.from(t)}}function ni(e,n,t=!1){let i=as(e);e=i.code;let a=new RegExp(`\\b${n.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of e.matchAll(a)){let c=l.index??0;if(i.shadows(n,c))continue;let y=c+n.length,v=c-1;while(v>=0&&/\s/.test(e[v]))v--;if(e[v]==="."&&e.slice(Math.max(0,v-2),v+1)!=="...")continue;let R=y;while(R<e.length&&/\s/.test(e[R]))R++;if(e[R]===":"&&e[R+1]!==":"&&(e[v]==="{"||e[v]===","))continue;if(t&&!/^\s*(?:<[^>]*>)?\s*\(/.test(e.slice(y)))continue;if(sa(e,y))continue;return!0}return!1}function sa(e,n){let t=n;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;if(e[t]!=="(")return!1;let i=0;for(;t<e.length;t++){let a=e[t];if(a==="(")i++;else if(a===")"){if(i--,i===0)break}}if(i!==0)return!1;t++;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;return e[t]==="{"}function Pc(e,n){let t=[];if(e.length>0)t.push(` var { ${e.join(", ")} } = window.stx || window;`);if(n.length>0)t.push(` var { ${n.join(", ")} } = window.StacksBrowser || {};`);if(t.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
134
+ ${e}`,imports:a,models:l}}var ea=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function zr(e){let n=new Set,t=as(e),i=On(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let l of t.code.matchAll(a)){let c=l[1];if(ea.has(c)||i.has(c)||c.length<3)continue;if(t.shadows(c,l.index??0))continue;n.add(c)}return Array.from(n)}function ta(e){return On(e)}var Nr=w(128);function Ac(e){let n=x(e),t=Nr.get(n);if(!t)t=na(e),Nr.set(n,t);return{code:t.code,stxImports:[...t.stxImports],browserImports:[...t.browserImports]}}function na(e){let n=new Set,t=new Set,i=e;i=i.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,c;while((c=l.exec(e))!==null){let M=c[1],L=c[2];if(c[0].includes("import type"))continue;let D=[];for(let N of M.split(",")){let G=N.trim();if(!G||G.startsWith("type "))continue;let K=G.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!K)continue;let B=K[1],Q=K[2]||B;if(a.add(B),a.add(Q),L==="stx"||L==="@stacksjs/stx")n.add(B);else t.add(B);if(Q!==B)D.push(`${Q} = ${B}`)}let P=D.length>0?`var ${D.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(c[0],P)}let y=ta(i);for(let M of Bf){if(a.has(M)||y.has(M))continue;if(ni(i,M,!0))n.add(M)}let v=s(i),R=new Set;for(let M of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let L of M[1].split(",")){let D=L.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let P of D){let N=P.trim();if(N)R.add(N)}}for(let M of we){if(a.has(M)||y.has(M)||R.has(M))continue;if(ni(v,M))t.add(M)}let T=zr(v);for(let M of T)if(!a.has(M)&&!y.has(M))t.add(M);return{code:i,stxImports:Array.from(n),browserImports:Array.from(t)}}function ni(e,n,t=!1){let i=as(e);e=i.code;let a=new RegExp(`\\b${n.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of e.matchAll(a)){let c=l.index??0;if(i.shadows(n,c))continue;let y=c+n.length,v=c-1;while(v>=0&&/\s/.test(e[v]))v--;if(e[v]==="."&&e.slice(Math.max(0,v-2),v+1)!=="...")continue;let R=y;while(R<e.length&&/\s/.test(e[R]))R++;if(e[R]===":"&&e[R+1]!==":"&&(e[v]==="{"||e[v]===","))continue;if(t&&!/^\s*(?:<[^>]*>)?\s*\(/.test(e.slice(y)))continue;if(sa(e,y))continue;return!0}return!1}function sa(e,n){let t=n;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;if(e[t]!=="(")return!1;let i=0;for(;t<e.length;t++){let a=e[t];if(a==="(")i++;else if(a===")"){if(i--,i===0)break}}if(i!==0)return!1;t++;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;return e[t]==="{"}function Pc(e,n){let t=[];if(e.length>0)t.push(` var { ${e.join(", ")} } = window.stx || window;`);if(n.length>0)t.push(` var { ${n.join(", ")} } = window.StacksBrowser || {};`);if(t.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
135
135
  ${t.join(`
136
136
  `)}
137
137
  ${ra(e,n)}`;return""}function vh(e,n=[]){let{browserImports:t}=Ac(e),i=new Set(n);return Pc([],t.filter((a)=>!i.has(a)))}function ra(e,n){let t=[...e.map((i)=>`['${i}', typeof ${i}, 'stx']`),...n.map((i)=>`['${i}', typeof ${i}, '@stacksjs/browser']`)];if(t.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
@@ -148,13 +148,13 @@ ${a.join(`
148
148
  `)}
149
149
  `}var aa={left:0,middle:1,right:2};function ca(e){let n=[];if(e.self)n.push("if ($event.target !== $el) return");for(let t of e.systemKeys)n.push(`if (!$event.${t}Key) return`);if(e.keys.length>0){let t=e.keys.map((i)=>`$event.key === '${i}'`).join(" || ");n.push(`if (!(${t})) return`)}if(e.mouse!==null){let t=aa[e.mouse];n.push(`if ($event.button !== ${t}) return`)}if(e.prevent)n.push("$event.preventDefault()");if(e.stop)n.push("$event.stopPropagation()");return n.join("; ")}function la(e,n){let{elementId:t,event:i,modifiers:a}=e,l=is(e.handler),c=ca(a),y=[];if(a.once)y.push("once: true");if(a.capture)y.push("capture: true");if(rs(i,a))y.push("passive: true");let v=y.length>0?`, { ${y.join(", ")} }`:"",R="";if(c)R+=`${c}; `;let T=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),M=`var $emit = function(name, detail) {
150
150
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
151
- };`;function N(L){if(/\$emit\s*\(/.test(L))return`${M}
152
- ${L}`;return`var scope = $el.closest('[data-stx-scope]');
151
+ };`;function L(D){if(/\$emit\s*\(/.test(D))return`${M}
152
+ ${D}`;return`var scope = $el.closest('[data-stx-scope]');
153
153
  if (scope && scope.__stx_execute) {
154
154
  scope.__stx_execute('${T}', $event, $el);
155
155
  }
156
156
  else {
157
- ${L}
157
+ ${D}
158
158
  }`}if(a.debounce!==null)return` ;(function() {
159
159
  // eslint-disable-next-line pickier/no-unused-vars
160
160
  var $el = document.getElementById('${t}')
@@ -162,7 +162,7 @@ else {
162
162
  var __timer
163
163
  $el.addEventListener('${i}', function($event) {
164
164
  ${c?c+"; ":""}clearTimeout(__timer)
165
- __timer = setTimeout(function() { ${N(l)} }, ${a.debounce})
165
+ __timer = setTimeout(function() { ${L(l)} }, ${a.debounce})
166
166
  }${v})
167
167
  })()`;if(a.throttle!==null)return` ;(function() {
168
168
  // eslint-disable-next-line pickier/no-unused-vars
@@ -173,7 +173,7 @@ else {
173
173
  ${c?c+"; ":""}var __now = Date.now()
174
174
  if (__now - __last >= ${a.throttle}) {
175
175
  __last = __now
176
- ${N(l)}
176
+ ${L(l)}
177
177
  }
178
178
  }${v})
179
179
  })()`;if(/\$emit\s*\(/.test(l))return` var $el = document.getElementById('${t}')
@@ -193,10 +193,10 @@ else {
193
193
  // STX: auto-generated event bindings
194
194
  ${e.map((t,i)=>la(t,i)).join(`
195
195
  `)}`}function Br(e){let n=[],t=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let y=i[c];if(y==="'"||y==='"'||y==="`"){let v=y;if(c++,v==="`"){let R=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&R===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){R++,c+=2;continue}if(i[c]==="}"&&R>0){R--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(y==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
196
- `)c++;continue}if(y==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),R=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let N=R[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=R[0].length;continue}let T=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(T){T[1].split(",").forEach((N)=>{let L=N.trim(),P=L.indexOf(":"),D=P>=0?L.slice(P+1).trim().split(/[\s=]/)[0]:L.split(/[\s=]/)[0];if(D&&!D.startsWith("_")&&!t.has(D))n.push(D),t.add(D)}),c+=T[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let N=M[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=M[0].length;continue}}c++}return n}var fa=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function pa(e){let n=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(N){let L;while((L=t.exec(N))!==null){let P=L[0];if(!fa.has(P))n.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=R.exec(e))!==null)i(l[1]);let T=/@model\s*=\s*["']([^"']*)["']/gi;while((l=T.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return n}async function Me(e,n={}){let t=e,i="",a=!1,l=[],c=ei(t,{filePath:n.filePath,projectRoot:n.projectRoot});t=c.code;let y=ti(c.styles),v=Ot(t);t=v.code,l=[...v.imports,...v.models];let{hasUserImports:R,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-f7a6nzx6.js"));if(R(t))t=await T(t,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let Q=Ac(t);t=Q.code,i=Pc(Q.stxImports,Q.browserImports.filter((te)=>!l.includes(te)))}if(i=`${mn(t,n.serverData)}${i}`,t=A(t),!a&&Le(n.attrs||""))t=je(t);let M=ua(n.eventBindings||[]),N=(n.attrs||"").trim(),L=/\btype\s*=\s*["']module["']/i.test(N),P=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(L){let Q=N.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${P}${Q?` ${Q}`:""}`;return`${y}<script ${te}>
196
+ `)c++;continue}if(y==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),R=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let L=R[1];if(!L.startsWith("_")&&!t.has(L))n.push(L),t.add(L);c+=R[0].length;continue}let T=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(T){T[1].split(",").forEach((L)=>{let D=L.trim(),P=D.indexOf(":"),N=P>=0?D.slice(P+1).trim().split(/[\s=]/)[0]:D.split(/[\s=]/)[0];if(N&&!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N)}),c+=T[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let L=M[1];if(!L.startsWith("_")&&!t.has(L))n.push(L),t.add(L);c+=M[0].length;continue}}c++}return n}var fa=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function pa(e){let n=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(L){let D;while((D=t.exec(L))!==null){let P=D[0];if(!fa.has(P))n.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=R.exec(e))!==null)i(l[1]);let T=/@model\s*=\s*["']([^"']*)["']/gi;while((l=T.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return n}async function Me(e,n={}){let t=e,i="",a=!1,l=[],c=ei(t,{filePath:n.filePath,projectRoot:n.projectRoot});t=c.code;let y=ti(c.styles),v=Ot(t);t=v.code,l=[...v.imports,...v.models];let{hasUserImports:R,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-x91zfx03.js"));if(R(t))t=await T(t,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let Q=Ac(t);t=Q.code,i=Pc(Q.stxImports,Q.browserImports.filter((te)=>!l.includes(te)))}if(i=`${mn(t,n.serverData)}${i}`,t=A(t),!a&&Le(n.attrs||""))t=je(t);let M=ua(n.eventBindings||[]),L=(n.attrs||"").trim(),D=/\btype\s*=\s*["']module["']/i.test(L),P=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(D){let Q=L.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${P}${Q?` ${Q}`:""}`;return`${y}<script ${te}>
197
197
  ${ln(`${i}${t}
198
198
  ${M}`)}
199
- </script>`}let D=mi(e),G=/function __stx_setup_/.test(t),K=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function B(Q){let te=Q.length>0?`
199
+ </script>`}let N=mi(e),G=/function __stx_setup_/.test(t),K=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function B(Q){let te=Q.length>0?`
200
200
  return ${ws(t,Q)};`:"",ne=JSON.stringify(`[stx] client block failed${n.filePath?` (${n.filePath})`:""}; this block will not hydrate`);return`${y}<script data-stx-scoped data-stx-run="always"${P}>
201
201
  window.stx.mount(function() {
202
202
  'use strict';
@@ -207,7 +207,7 @@ ${M}${te}`)}
207
207
  console.error(${ne}, error);
208
208
  return {};
209
209
  }
210
- })</script>`}if(!K&&!G){if(D)return B(Br(e));if(n.templateContent){let Q=Br(e);if(Q.length>0){let te=pa(n.templateContent);if(Q.some((ae)=>te.has(ae)))return B(Q)}}}return`${y}<script data-stx-scoped data-stx-run="always"${P}>
210
+ })</script>`}if(!K&&!G){if(N)return B(Br(e));if(n.templateContent){let Q=Br(e);if(Q.length>0){let te=pa(n.templateContent);if(Q.some((ae)=>te.has(ae)))return B(Q)}}}return`${y}<script data-stx-scoped data-stx-run="always"${P}>
211
211
  ;(function() {
212
212
  'use strict';
213
213
  try {
@@ -216,7 +216,7 @@ ${M}`)}
216
216
  } catch (error) {
217
217
  console.error(${JSON.stringify(`[stx] client block failed${n.filePath?` (${n.filePath})`:""}; this block will not hydrate`)}, error);
218
218
  }
219
- })()</script>`}import{createHash as ya}from"crypto";var Pn=/<script\b[^>]*>/iy,ps=/<\/script\s*>/ig,Mn=/<style\b[^>]*>/iy,ds=/<\/style\s*>/ig;function Wr(e,n,t,i){t.lastIndex=n;let a=t.exec(e);if(!a||a.index!==n)return-1;i.lastIndex=t.lastIndex;let l=i.exec(e);if(!l)return-1;return l.index+l[0].length}function U(e,n){return Wr(e,n,Pn,ps)}function un(e,n){return Wr(e,n,Mn,ds)}function Oe(e,n){if(!e.startsWith("<!--",n))return-1;let t=e.indexOf("-->",n+4);if(t===-1)return-1;return t+3}function Fr(e,n){if(e.startsWith("<!--",n)){let a=Oe(e,n);return a===-1?e.length:a}if(Pn.lastIndex=n,Pn.exec(e)?.index===n){ps.lastIndex=Pn.lastIndex;let a=ps.exec(e);return a?a.index+a[0].length:e.length}if(Mn.lastIndex=n,Mn.exec(e)?.index===n){ds.lastIndex=Mn.lastIndex;let a=ds.exec(e);return a?a.index+a[0].length:e.length}return-1}function C(e,n){let t=[],i=0,a=e.length,l=!1,c=null;while(i<a){let y=e[i];if(l){if(c){if(y===c)c=null}else if(y==='"'||y==="'")c=y;else if(y===">")l=!1;i++;continue}if(y!=="<"){let M=e.indexOf("<",i+1);if(M===-1)break;i=M;continue}let v=n(e,i);if(v>i){t.push({start:i,end:v,token:e.slice(i,v)}),i=v;continue}let R=Fr(e,i);if(R>i){i=R;continue}let T=e.charCodeAt(i+1);if(T>=65&&T<=90||T>=97&&T<=122)l=!0;i++}return t}function Vr(e){let n=0,t=0,i=0,a=!1,l=null;while(i<e.length){if(a){let M=e[i];if(l){if(M===l)l=null}else if(M==='"'||M==="'")l=M;else if(M===">")a=!1;i++;continue}let c=e.indexOf("<",i),y=c===-1?e.length:c;while(i<y){let M=e[i++];if(M==="{")n++;else if(M==="}")t++;if(n>=2&&t>=2)return!0}if(c===-1)break;let v=Fr(e,c);if(v>c){i=v;continue}let R=e.charCodeAt(c+1),T=R===47?e.charCodeAt(c+2):R;if(T>=65&&T<=90||T>=97&&T<=122)a=!0;i=c+1}return!1}function fc(e,n){while(e.size>=n){let t=e.keys().next();if(t.done)return;e.delete(t.value)}}var da=1024,ga=16777216,vt=new Map,ls=0;function ma(e,n){vt.set(e,n),ls+=e.length+n.output.length;for(let[t,i]of vt){if(ls<=ga)break;vt.delete(t),ls-=t.length+i.output.length}}function pe(e,n,t,i){let a=i!==void 0&&e.length>=da,l=a?`${i}\x00${e}`:"";if(a){let T=vt.get(l);if(T)return vt.delete(l),vt.set(l,T),{output:T.output,tokens:T.tokens.slice()}}let c=C(e,n);if(c.length===0)return{output:e,tokens:[]};let y=c.map((T)=>T.token),v="",R=0;for(let T=0;T<c.length;T++){let M=c[T];v+=e.slice(R,M.start),v+=t(M.token,T),R=M.end}if(v+=e.slice(R),a)return ma(l,{output:v,tokens:y}),{output:v,tokens:y.slice()};return{output:v,tokens:y}}var ha=1024,xa=16777216,Et=new Map,us=0;function ba(e,n){Et.set(e,n),us+=e.length+n.output.length;for(let[t,i]of Et){if(us<=xa)break;Et.delete(t),us-=t.length+i.output.length}}function fs(e,n,t){return{output:n,scripts:t,restore:(i)=>i===n?e:hr(i,t)}}function X(e){let n=e.length>=ha;if(n){let a=Et.get(e);if(a)return Et.delete(e),Et.set(e,a),fs(e,a.output,a.scripts.slice())}let{output:t,tokens:i}=pe(e,U,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(n)return ba(e,{output:t,scripts:i}),fs(e,t,i.slice());return fs(e,t,i)}function hr(e,n){if(n.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(t,i)=>n[+i]??"")}var Dn="__stx_component_client_factories";function jn(e){let n=e[Dn];return n instanceof Map?n:null}function Ec(e){e[Dn]=new Map}function gs(e,n){let t=jn(e);if(!t)return null;let i=ya("sha256").update(n).digest("hex").slice(0,16),a=t.get(i);if(a)a.instances++;else t.set(i,{body:n,instances:1});return i}function Tc(e,n){let t=jn(n);if(!t?.size)return e;let i=new Map;for(let[T,M]of t)if(M.instances===1)i.set(T,M.body);let a=[];if(i.size>0){let T=[...i.keys()].map((L)=>JSON.stringify(L).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),M=new RegExp(`window\\.__stxComponentFactories\\[(${T})\\]\\(("[^"]+")\\);`,"g"),N=M.exec(e);while(N!==null){let L=i.get(JSON.parse(N[1]));if(L!==void 0)a.push({start:N.index,end:N.index+N[0].length,replacement:`(${L})(${N[2]});`});N=M.exec(e)}}let l=[...t].filter(([,T])=>T.instances>1);if(l.length===0)return Ur(e,a);let y=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
219
+ })()</script>`}import{createHash as ya}from"crypto";var Pn=/<script\b[^>]*>/iy,ps=/<\/script\s*>/ig,Mn=/<style\b[^>]*>/iy,ds=/<\/style\s*>/ig;function Wr(e,n,t,i){t.lastIndex=n;let a=t.exec(e);if(!a||a.index!==n)return-1;i.lastIndex=t.lastIndex;let l=i.exec(e);if(!l)return-1;return l.index+l[0].length}function U(e,n){return Wr(e,n,Pn,ps)}function un(e,n){return Wr(e,n,Mn,ds)}function Oe(e,n){if(!e.startsWith("<!--",n))return-1;let t=e.indexOf("-->",n+4);if(t===-1)return-1;return t+3}function Fr(e,n){if(e.startsWith("<!--",n)){let a=Oe(e,n);return a===-1?e.length:a}if(Pn.lastIndex=n,Pn.exec(e)?.index===n){ps.lastIndex=Pn.lastIndex;let a=ps.exec(e);return a?a.index+a[0].length:e.length}if(Mn.lastIndex=n,Mn.exec(e)?.index===n){ds.lastIndex=Mn.lastIndex;let a=ds.exec(e);return a?a.index+a[0].length:e.length}return-1}function C(e,n){let t=[],i=0,a=e.length,l=!1,c=null;while(i<a){let y=e[i];if(l){if(c){if(y===c)c=null}else if(y==='"'||y==="'")c=y;else if(y===">")l=!1;i++;continue}if(y!=="<"){let M=e.indexOf("<",i+1);if(M===-1)break;i=M;continue}let v=n(e,i);if(v>i){t.push({start:i,end:v,token:e.slice(i,v)}),i=v;continue}let R=Fr(e,i);if(R>i){i=R;continue}let T=e.charCodeAt(i+1);if(T>=65&&T<=90||T>=97&&T<=122)l=!0;i++}return t}function Vr(e){let n=0,t=0,i=0,a=!1,l=null;while(i<e.length){if(a){let M=e[i];if(l){if(M===l)l=null}else if(M==='"'||M==="'")l=M;else if(M===">")a=!1;i++;continue}let c=e.indexOf("<",i),y=c===-1?e.length:c;while(i<y){let M=e[i++];if(M==="{")n++;else if(M==="}")t++;if(n>=2&&t>=2)return!0}if(c===-1)break;let v=Fr(e,c);if(v>c){i=v;continue}let R=e.charCodeAt(c+1),T=R===47?e.charCodeAt(c+2):R;if(T>=65&&T<=90||T>=97&&T<=122)a=!0;i=c+1}return!1}function fc(e,n){while(e.size>=n){let t=e.keys().next();if(t.done)return;e.delete(t.value)}}var da=1024,ga=16777216,vt=new Map,ls=0;function ma(e,n){vt.set(e,n),ls+=e.length+n.output.length;for(let[t,i]of vt){if(ls<=ga)break;vt.delete(t),ls-=t.length+i.output.length}}function pe(e,n,t,i){let a=i!==void 0&&e.length>=da,l=a?`${i}\x00${e}`:"";if(a){let T=vt.get(l);if(T)return vt.delete(l),vt.set(l,T),{output:T.output,tokens:T.tokens.slice()}}let c=C(e,n);if(c.length===0)return{output:e,tokens:[]};let y=c.map((T)=>T.token),v="",R=0;for(let T=0;T<c.length;T++){let M=c[T];v+=e.slice(R,M.start),v+=t(M.token,T),R=M.end}if(v+=e.slice(R),a)return ma(l,{output:v,tokens:y}),{output:v,tokens:y.slice()};return{output:v,tokens:y}}var ha=1024,xa=16777216,Et=new Map,us=0;function ba(e,n){Et.set(e,n),us+=e.length+n.output.length;for(let[t,i]of Et){if(us<=xa)break;Et.delete(t),us-=t.length+i.output.length}}function fs(e,n,t){return{output:n,scripts:t,restore:(i)=>i===n?e:hr(i,t)}}function X(e){let n=e.length>=ha;if(n){let a=Et.get(e);if(a)return Et.delete(e),Et.set(e,a),fs(e,a.output,a.scripts.slice())}let{output:t,tokens:i}=pe(e,U,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(n)return ba(e,{output:t,scripts:i}),fs(e,t,i.slice());return fs(e,t,i)}function hr(e,n){if(n.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(t,i)=>n[+i]??"")}var Dn="__stx_component_client_factories";function jn(e){let n=e[Dn];return n instanceof Map?n:null}function Ec(e){e[Dn]=new Map}function gs(e,n){let t=jn(e);if(!t)return null;let i=ya("sha256").update(n).digest("hex").slice(0,16),a=t.get(i);if(a)a.instances++;else t.set(i,{body:n,instances:1});return i}function Tc(e,n){let t=jn(n);if(!t?.size)return e;let i=new Map;for(let[T,M]of t)if(M.instances===1)i.set(T,M.body);let a=[];if(i.size>0){let T=[...i.keys()].map((D)=>JSON.stringify(D).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),M=new RegExp(`window\\.__stxComponentFactories\\[(${T})\\]\\(("[^"]+")\\);`,"g"),L=M.exec(e);while(L!==null){let D=i.get(JSON.parse(L[1]));if(D!==void 0)a.push({start:L.index,end:L.index+L[0].length,replacement:`(${D})(${L[2]});`});L=M.exec(e)}}let l=[...t].filter(([,T])=>T.instances>1);if(l.length===0)return Ur(e,a);let y=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
220
220
  (function() {
221
221
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
222
222
  ${l.map(([T,M])=>` try { factories[${JSON.stringify(T)}] = factories[${JSON.stringify(T)}] || ${M.body}; }
@@ -224,14 +224,14 @@ ${l.map(([T,M])=>` try { factories[${JSON.stringify(T)}] = factories[${JSON.str
224
224
  `)}
225
225
  })();
226
226
  </script>`,v,R=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return C(e,(T,M)=>{if(v===void 0){if(R.lastIndex=M,R.test(T))v=M}return-1}),a.push({start:v??0,end:v??0,replacement:`${y}
227
- `}),Ur(e,a)}function Ur(e,n){if(n.length===0)return e;n.sort((l,c)=>l.start-c.start||l.end-c.end);let t=Array(n.length*2+1),i=0,a=0;for(let l of n)t[a++]=e.slice(i,l.start),t[a++]=l.replacement,i=l.end;return t[a]=e.slice(i),t.join("")}function Hr(e){let n=jn(e),t=new Map;if(n)for(let[i,a]of n)t.set(i,a.instances);return t}function Kr(e,n){let t=jn(e);if(!t)return[];let i=[];for(let[a,l]of t){let c=l.instances-(n.get(a)??0);if(c>0)i.push({body:l.body,count:c})}return i}function Zr(e,n){for(let{body:t,count:i}of n)for(let a=0;a<i;a++)gs(e,t)}function ve(e,n,t=2){let i=0,a=null;for(let l=n+t;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){i++;continue}if(c==="}"){if(i>0){i--;continue}let y=0;while(e[l+y]==="}")y++;if(y>=t)return l}}return-1}import ci from"fs";var qr=0,ms=new Map;function Nc(){qr=0,ms.clear()}function Nn(e,n){let t=qr++,i=`<!--__STX_${e.toUpperCase()}_${t}__-->`;return ms.set(i,{type:e,expression:n}),i}function Dc(){let e={};for(let[n,t]of ms)e[n]={type:t.type,expression:t.expression};return e}function Mc(e,n){let t=e;for(let[i,a]of n)t=t.split(i).join(a);return t}function si(e){return e.includes("<!--__STX_")}var _a=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function wa(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Xr(e){return e.replace(/\{{2,}/g,(n)=>wa(n.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(_a,"&#64;")}function Cs(e,n,t=!1){let{openTag:i,tail:a}=t?Sa(e,n):$a(e).at(n);return Ea(a,i,t)}function Sa(e,n){let t="",i=0;for(let c=0;c<n;c++){if(!e.startsWith("{{",c))continue;let y=ve(e,c);if(y<0||y+2>n)break;t+=e.slice(i,c)+"x",c=y+1,i=y+2}t+=e.slice(i,n);let a=-1,l=null;for(let c=0;c<t.length;c++){let y=t[c];if(l){if(y===l)l=null;continue}if(y==='"'||y==="'"){l=y;continue}if(y===">"){a=-1;continue}if(y==="<")a=c}return{openTag:a,tail:a>=0?t.slice(a+1):t}}var Ln=null;function $a(e){if(Ln&&Ln.source===e)return Ln.scanner;let n=va(e);return Ln={source:e,scanner:n},n}function va(e){let n=0,t=-1,i=null,a=-1,l=(y,v)=>{let R=e[y];if(v.quote){if(R===v.quote)v.quote=null;return}if(v.openTag>=0){if(R==='"'||R==="'"){v.quote=R;return}if(R===">"){v.openTag=-1;return}}if(R==="<")v.openTag=y},c=(y,v)=>{if(v.openTag>=0||!e.startsWith("<!--",y))return-1;let R=e.indexOf("-->",y+4);return R<0?e.length:R+3};return{at(y){if(y<n)n=0,t=-1,i=null,a=-1;let v={openTag:t,quote:i},R=!1;while(n<y){if(a<0&&e.startsWith("{{",n)){let D=ve(e,n);if(D<0)a=n;else if(D+2<=y){n=D+2;continue}else break}let P=c(n,v);if(P>=0){if(P>y){R=!0;break}n=P;continue}l(n,v),n++}if(t=v.openTag,i=v.quote,R)return{openTag:-1,tail:""};let T=a>=0?a:n,M={openTag:t,quote:i};for(let P=n;P<y;P++){let D=c(P,M);if(D>=0){if(D>y)return{openTag:-1,tail:""};P=D-1;continue}l(P,M)}if(M.openTag<0)return{openTag:-1,tail:""};let N="",L=M.openTag+1;for(let P=L;P<Math.min(y,T);P++){if(!e.startsWith("{{",P))continue;let D=ve(e,P);N+=e.slice(L,P)+"x",P=D+1,L=D+2}return N+=e.slice(L,y),{openTag:M.openTag,tail:N}}}}function Ea(e,n,t){if(n<0&&!t)return null;if(n>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(n>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(n>=0)while(i<e.length&&!/\s/.test(e[i]))i++;while(i<e.length){while(/\s/.test(e[i]??"")&&i<e.length)i++;let a=i;while(i<e.length&&!/[\s=/>]/.test(e[i]))i++;let l=e.slice(a,i);if(!l)break;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="=")continue;i++;while(i<e.length&&/\s/.test(e[i]))i++;let c=e[i];if(c==='"'||c==="'"){let y=++i,v=e.indexOf(c,i);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(y)};i=v+1}else{let y=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(y)}}}return{kind:"tag"}}class ie extends Error{attribute;near;constructor(e,n){super(`Unsafe interpolation in ${e}: ${n}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,n){if(this.near===void 0)this.near=e.slice(Math.max(0,n-160),n).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Jr="unsafe:";var ka=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Ra=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Ta=/^data:(?:text\/html|application\/xhtml\+xml)/,Ca=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Aa(e){return e.replace(Ca,"").toLowerCase()}function hs(e){let n=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(n))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(n))return"fetched";return null}function Bn(e,n="navigable"){let t=Aa(e);if(ka.test(t))return!0;return n==="navigable"?Ra.test(t):Ta.test(t)}function mr(e,n="navigable"){return Bn(e,n)?"unsafe:"+e:e}function Ia(e){let n=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!n)return null;if(n[3].trim()!=="")return null;return hs(n[1])}function Gr(e,n,t=256){if(n<=t)return e.slice(0,n);let i=e.slice(n-t,n),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function Yr(e,n,t=n){let i=Ia(e);return i&&Bn(n,i)?"unsafe:"+t:t}function Rt(e){let n=e.indexOf(" as ");if(n!==-1){let l=e.slice(0,n).trim(),c=e.slice(n+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let i=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=t[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function zn(e){let n=[],t=0,i="",a=0;for(let l=0;l<e.length;l++){let c=e[l];if(i){if(c==="\\")l++;else if(c===i)i="";continue}if(c==="'"||c==='"'||c==="`")i=c;else if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)n.push(e.slice(a,l)),a=l+1}return n.push(e.slice(a)),n}function Qr(e,n){let t=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a===n&&t===0)return i}return-1}function ii(e){let n=0;for(let t=0;t<e.length;t++){let i=e[t];if(i==="("||i==="["||i==="{")n++;else if((i===")"||i==="]"||i==="}")&&--n===0)return t}return-1}function ht(e,n){let t=e.trim().replace(/^\.\.\./,"").trim(),i=Qr(t,"=");if(i!==-1&&t[i+1]!==">")t=t.slice(0,i).trim();if(!t)return;if(t.startsWith("{")&&t.endsWith("}")){for(let a of zn(t.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){ht(l,n);continue}let c=Qr(l,":");ht(c===-1?l:l.slice(c+1),n)}return}if(t.startsWith("[")&&t.endsWith("]")){for(let a of zn(t.slice(1,-1)))ht(a,n);return}if(/^[A-Z_$][\w$]*$/i.test(t))n.push(t)}function J(e){let n=e.trim(),t=[],i=0;for(let l=0;l<n.length;l++){let c=n[l];if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(i===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(n.slice(l)))continue;let v=n.slice(0,l).trim();if(v.startsWith("(")&&ii(v)===v.length-1)v=v.slice(1,-1);for(let R of zn(v))ht(R,t);if(t.length>0)return t;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(n);if(a){let l=a[1].trim();if(l.startsWith("(")&&ii(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)ht(c[2],t),ht(c[1],t);else for(let y of zn(l))ht(y,t)}return t}function I(e,n){let t=n instanceof Set?n:new Set(n);if(t.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let y of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(t.has(y))return!0;return!1}var Wn="__stx_client_loop_names";function tt(e){let n=e?.[Wn];return Array.isArray(n)?n:[]}function Fn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let n=[],t=[],i=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(i)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=t.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let y=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((T)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(T[1])),v=(y?.[2]??y?.[3])?.trim();if(v&&y?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let R=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(t.push(R),R)n.push(R)}}return n}var qt={},li=new Map;function Oa(e){let n=li.get(e);if(!n){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=new RegExp(`:${t}(?!\\w)`,"g"),li.set(e,n)}return n.lastIndex=0,n}var Is={uppercase:(e,n)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,n)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,n)=>{if(e===void 0||e===null)return"";let t=String(e);return t.charAt(0).toUpperCase()+t.slice(1)},number:(e,n,t=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(t),10))}catch{return""}},fmt:(e,n,t="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(t)}catch{return String(e)}},join:(e,n,t=",")=>{if(!Array.isArray(e))return"";return e.join(String(t))},escape:(e,n)=>{if(e===void 0||e===null)return"";return H(String(e))},translate:(e,n,t={})=>{if(!n||!n.__translations)return e;let i=n.__translations,a=n.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),c=i;for(let v of l){if(c===void 0||c===null)break;c=c[v]}if(c===void 0||c===null)return a?e:"";let y=String(c);return Object.entries(t).forEach(([v,R])=>{y=y.replace(Oa(v),()=>String(R))}),y},t:(e,n,t={})=>Is.translate(e,n,t),truncate:(e,n,t=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=t)return a;if(t<=i.length)return i.substring(0,t);return a.substring(0,t-i.length)+i},date:(e,n,t="short",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(t==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,l[t]||l.short).format(a)}catch{return String(e)}},currency:(e,n,t="USD",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(i,{style:"currency",currency:t}).format(a)}catch{return String(e)}},pluralize:(e,n,t,i)=>{let a=Number(e);if(Number.isNaN(a))return t;let l=i||`${t}s`;return a===1?t:l},first:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let t=String(e);return t.charAt(t.length-1)},length:(e,n)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,n,t=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return t?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,n,t="")=>e===void 0||e===null||e===""?t:e,reverse:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,n,t=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(t,i);return e},replace:(e,n,t,i="")=>{if(e===void 0||e===null)return"";let a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,n)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,n)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,n)=>{let t=Number(e);return Number.isNaN(t)?0:Math.abs(t)},round:(e,n,t=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**t;return Math.round(i*a)/a}};function Kf(e,n){if(e in Is)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);qt[e]=n}function xh(e){for(let[n,t]of Object.entries(e))Kf(n,t)}function Xf(){return{...Is,...qt}}function Sh(){for(let e of Object.keys(qt))delete qt[e]}function Nt(e,n,t=2){let i="{".repeat(t);if(!e.includes(i))return e;let a="",l=0;for(;;){let c=e.indexOf(i,l);if(c===-1)break;let y=ve(e,c,t);if(y===-1)break;a+=e.slice(l,c)+n(e.slice(c,y+t),e.slice(c+t,y),c),l=y+t}return l===0?e:a+e.slice(l)}function p(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function H(e){return Xr(p(e))}function Pa(e){return e.replace(/ /g,"&#32;").replace(/\t/g,"&#9;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;").replace(/\f/g,"&#12;").replace(/=/g,"&#61;").replace(/`/g,"&#96;")}function Ma(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(n,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function Da(e,n){let t=Ma(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(t))throw new ie(n,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(t))!==null){let l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),y=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!y)throw new ie(n,"CSS URLs must be local paths or base64 raster images")}}function Z(e,n,t,i=!1,a=0){try{return ja(e,n,t,i,a)}catch(l){if(l instanceof ie)l.locate(e,n);throw l}}function ja(e,n,t,i,a){let l=Cs(e,n,i),c=H(t);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(t))throw new ie("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return t}if(l.kind==="tag"){let R=e.slice(n+a).trimStart(),T=t.trim();if(!R.startsWith("=")&&(T===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(T)))return T;throw new ie("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let y=l.name.toLowerCase();if(/^on[a-z]/.test(y))throw new ie(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(y==="srcdoc")c=H(c);if(y==="style")Da(t,l.name);if(l.quote===null)c=Pa(c);let v=hs(y);if(v&&l.valuePrefix.trim()===""&&Bn(t,v))return Jr+c;return Yr(Gr(e,n),t,c)}function yn(e,n){let t=` ${e}="`;return Z(t,t.length,n,!0)}function hi(e){return e.flatMap((n)=>{let t=n.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!t||/\bserver\b|\bsrc\s*=/.test(t[1])?[]:[t[2]]})}function xe(e,n){let{scripts:t}=X(e);for(let i of hi(t)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i))return!0;if(Rr(i,n))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function Jf(e){let n=[],t=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=t.exec(e);i;i=t.exec(e)){let a=i[1].toLowerCase(),l=new Set(J(i[3]));if(l.size===0)continue;let c=i.index+i[0].length;if(i[0].endsWith("/>")){n.push({start:i.index,end:c,names:l});continue}let y=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");y.lastIndex=c;let v=1,R=e.length;for(let T=y.exec(e);T;T=y.exec(e)){if(T[2]==="/")continue;if(v+=T[1]==="/"?-1:1,v===0){R=T.index+T[0].length;break}}n.push({start:i.index,end:R,names:l})}return n}function ui(e,n,t){let i=s(t);for(let a of e){if(n<a.start||n>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function fi(e,n){let t=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,c=0;for(let R=0;R<i.length;R++){let T=i[R];if(!l&&T==="`"){l=!0,c=0;continue}if(l){if(T==="`"&&c===0){l=!1;continue}if(T==="$"&&i[R+1]==="{"){c++,R++,a+=" ";continue}if(T==="}"&&c>0){c--;continue}if(c>0){a+=T;continue}continue}a+=T}i=a;let y=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=y.exec(i))!==null){let R=v[1];if(!i.substring(0,v.index).trimEnd().endsWith(".")){if(!t.includes(R)&&!(R in n))return!1}}return!0}function Na(e,n){let t=s(e);for(let i of t.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof n[i[1]]==="function")return!0;return!1}function La(e,n){let t=n.__stx_serverDeclared;if(!t||t.size===0)return!1;let i=s(e);for(let a of t)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var pi=new Set;function di(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function gi(e,n){let t=`${n??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!pi.has(t))pi.add(t),console.warn(`[stx] {{ ${e} }} in a <script> in ${n??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function oi(e,n,t){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=E(l,n);if(c===void 0)return di(l)?gi(l.trim(),t):a;return c===null?"":String(c)}catch{return a}}),i=Nt(i,(a,l,c)=>{let y=l.trim();if(/^__[A-Z_]+__$/.test(y))return a;try{let v=E(l,n);if(v===void 0)return di(y)?gi(y,t):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(R)=>"\\u007b".repeat(R.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function Yf(e,n){if(!e.includes("{"))return e;let t=e;return t=t.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let l=E(a,n);if(l===void 0)return i;return l===null?"":String(l)}catch{return i}}),t=Nt(t,(i,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return i;try{let y=E(a,n);if(y===void 0)return i;if(y===null)return"";let v=String(y);return Z(t,l,v,!0,i.length)}catch(y){if(y instanceof ie)throw y;return i}}),t}function kh(e,n,t={}){let{output:i,scripts:a}=X(e),l=a.map((c)=>{let y=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=c.search(/<\/script\s*>$/i);if(!y||v===-1)return c;let R=y[1],T=c.slice(y[0].length,v);if(/\bdata-raw\b/.test(R))return c;if(t.skipServer&&/\bserver\b/.test(R))return c;let N=`<script${Yf(R,n)}>`;if(/\bsrc\s*=/.test(R)||/\btype\s*=\s*["']application\/json["']/.test(R))return N+T+c.slice(v);return N+oi(T,n)+c.slice(v)});return hr(i,l)}function S(e,n,t){let i=e,a=(P,D)=>{let G=un(P,D);if(G===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(P.slice(D,G))?-1:G},l=(P,D,G,K)=>{let B=G.length,{output:Q,tokens:te}=pe(P,D,(ne,ae)=>K(B+ae));return G.push(...te),Q},c=[];i=l(i,a,c,(P)=>`<!--__STX_STYLE_${P}__-->`);let y=[];i=l(i,U,y,(P)=>`<!--__STX_SCRIPT_EXPR_${P}__-->`);let v=n?.__stx_signals_gate===!0||xe(e),R=new Set([...Array.isArray(n?.__stx_client_signal_names)?n.__stx_client_signal_names:[],...ri(hi(y))]),T=new Set(Array.isArray(n?.__stx_preserved_client_expressions)?n.__stx_preserved_client_expressions:[]);i=Nt(i,(P,D,G)=>{if(I(D,R))return P;try{let K=E(D,n,!1,(B)=>bs(B,P,t,e));return K!==void 0&&K!==null?String(K):""}catch(K){let B=K instanceof Error?K.message:String(K);return h("Expression",`Error evaluating: {{{ ${D.trim()}}}}: ${B}`,t,e,G,P)}},3),i=i.replace(/\{!!([\s\S]*?)!!\}/g,(P,D,G)=>{if(I(D,R))return P;try{let K=E(D,n,!1,(B)=>bs(B,P,t,e));if(K===void 0&&n.__stx_buildMode==="compile")return Nn("raw",D.trim());return K!==void 0&&K!==null?String(K):""}catch(K){if(n.__stx_buildMode==="compile")return Nn("raw",D.trim());let B=K instanceof Error?K.message:String(K);return h("Expression",`Error evaluating: {!! ${D.trim()} !!}: ${B}`,t,e,G,P)}}),i=l(i,U,y,(P)=>`<!--__STX_SCRIPT_EXPR_${P}__-->`),i=l(i,a,c,(P)=>`<!--__STX_STYLE_${P}__-->`);let M=v?Jf(i):[],N=Fn(i).map((P)=>({...P,names:new Set(J(`${P.binding} in __slot`))})),L=new Set(tt(n));if(i=Nt(i,(P,D,G)=>{let K=D.trim();if(ui(N,G,K))return P;if(I(K,L))return P;if(M.length>0&&ui(M,G,K))return P;if(T.has(K))return P;let B=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],Q=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ne=K.match(Q)?.[1],ae=ne&&((ne in n)||B.includes(ne)),me=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Ee=K.match(me),Ce=Ee&&!B.includes(Ee[1])&&!(Ee[1]in n);if(/^__[A-Z_]+__$/.test(K))return"";if(I(K,R))return P;if(n.__stx_native_screen===!0&&Na(K,n))return P;let ze;try{let $e=E(D,n,!1,(ct)=>{ze=ct});if(v&&!fi(K,n))return P;if(ze)bs(ze,P,t,e);if(n.__stx_buildMode==="compile"&&!v&&($e===void 0||La(K,n)))return Nn("expr",K);if($e===void 0||$e===null)return"";let st=String($e);return Z(i,G,st,!1,P.length)}catch($e){if($e instanceof ie)throw $e;if(v&&!fi(K,n))return P;if(Ce)return P;let st=$e instanceof Error?$e.message:String($e);return h("Expression",`Error evaluating: {{ ${K} }}: ${st}`,t,e,G,P)}}),y.length>0)i=i.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(P,D)=>y[Number(D)]??P);if(c.length>0)i=i.replace(/<!--__STX_STYLE_(\d+)__-->/g,(P,D)=>c[Number(D)]??P);return i}function Zf(e,n,t){if(!n.trim())return e;let i=e,a=n.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let c=l[1];a=a.substring(c.length).trim();let y=qt[c]||Is[c];if(!y)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(Xf()).join(", ")}`);let v=[];if(a.startsWith(":")){let R=a.match(/^:([^|\s]+)/);if(R){let T=R[1].trim();try{let M=Number(T);v=[Number.isNaN(M)?T:M]}catch{v=[T]}a=a.substring(R[0].length).trim()}}else if(a.startsWith("(")){let R=1,T=1;while(R>0&&T<a.length){if(a[T]==="(")R++;if(a[T]===")")R--;T++}if(R===0){let M=a.substring(1,T-1).trim();if(M)try{if(M.startsWith("{")&&M.endsWith("}"))v=[E(`(${M})`,t,!0)];else{let N=[],L="",P=null,D=0,G=0,K=0,B=!1;for(let Q=0;Q<M.length;Q++){let te=M[Q];if(B){L+=te,B=!1;continue}if(te==="\\"){L+=te,B=!0;continue}if(P){if(L+=te,te===P)P=null;continue}if(te==='"'||te==="'"||te==="`"){P=te,L+=te;continue}if(te==="(")D++;else if(te===")")D--;else if(te==="[")G++;else if(te==="]")G--;else if(te==="{")K++;else if(te==="}")K--;if(te===","&&D===0&&G===0&&K===0){N.push(L),L="";continue}L+=te}if(L)N.push(L);v=N.map((Q)=>{let te=Q.trim();return E(te,t,!0)})}}catch{v=[M]}a=a.substring(T).trim()}}try{i=y(i,t,...v)}catch(R){let T=R instanceof Error?R.message:String(R);throw Error(`Error applying filter '${c}': ${T}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function Ba(e){let n=!1,t="",i=0,a=0,l=0,c=!1;for(let y=0;y<e.length;y++){let v=e[y],R=e[y+1];if(n&&c){c=!1;continue}if(n&&v==="\\"){c=!0;continue}if(c=!1,(v==='"'||v==="'"||v==="`")&&!c){if(!n)n=!0,t=v;else if(v===t)n=!1,t="";continue}if(n&&t==="`"&&v==="$"&&R==="{"){let T=1;y+=2;while(y<e.length&&T>0){if(e[y]==="{")T++;else if(e[y]==="}")T--;if(T>0)y++}continue}if(n)continue;if(v==="(")i++;else if(v===")")i--;else if(v==="[")a++;else if(v==="]")a--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&i===0&&a===0&&l===0){if(R==="|"){y++;continue}if(R==="="){y++;continue}return y}}return-1}var Zt=new Set,za=1000;function _h(){Zt.clear()}function bs(e,n,t,i){if(!q())return;let a=`${t}\x00${e.expression}`;if(Zt.has(a))return;if(Zt.size>=za)Zt.clear();Zt.add(a);let l=t,c=i;try{if(t&&ci.existsSync(t))c=ci.readFileSync(t,"utf8")}catch{}let y=c.indexOf(n);if(y>=0)l=`${t}:${c.slice(0,y).split(`
228
- `).length}`;console.warn(`${l}: stx warning: ${n} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function E(e,n,t=!1,i){try{let a=e.trim(),l=Ba(a);if(l>0){let y=a.substring(0,l).trim(),v=a.substring(l+1).trim(),R=E(y,n,!0,i);return Zf(R,v,n)}let c=Ns(a);if(c!==null){i?.({expression:a,rule:c});return}try{let y=Object.keys(n),v=Object.values(n);return d(a,y)(...v)}catch{return u(a,n)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let c=l[1],y=Wa(c,Object.keys(n));if(y&&y!==c)a.message=`${a.message} \u2014 did you mean '${y}'?`}}if(!t)console.error(`Error evaluating expression: ${e}`,a);throw a}}function Wa(e,n){let t=null;for(let a of n){if(a===e)continue;let l=Fa(e,a);if(t===null||l<t.dist)t={key:a,dist:l}}if(!t)return null;let i=Math.max(e.length,t.key.length);if(t.dist<=2||t.dist/i<=0.35)return t.key;return null}function Fa(e,n){if(e===n)return 0;if(e.length===0)return n.length;if(n.length===0)return e.length;let[t,i]=e.length<n.length?[e,n]:[n,e],a=Array(t.length+1),l=Array(t.length+1);for(let c=0;c<=t.length;c++)a[c]=c;for(let c=1;c<=i.length;c++){l[0]=c;for(let y=1;y<=t.length;y++){let v=t[y-1]===i[c-1]?0:1;l[y]=Math.min(l[y-1]+1,a[y]+1,a[y-1]+v)}for(let y=0;y<=t.length;y++)a[y]=l[y]}return a[t.length]}function Ch(e){if(!e)return"";return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import Va from"process";function _(e="STX_PUBLIC_"){let n={},t={};for(let[i,a]of Object.entries(Va.env)){if(!i.startsWith(e)||a===void 0)continue;n[`import.meta.env.${i}`]=JSON.stringify(a),t[i]=a}return n["import.meta.env"]=JSON.stringify(t),n}function xi(e,n=""){let t=`${e}${n}`,i=0;for(let a=0;a<t.length;a++){let l=t.charCodeAt(a);i=(i<<5)-i+l,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function bi(e,n,t={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:c=!1}=t;if(!e.trim())return"";let y=ys(e),v=[],R=new Map;if(l)for(let T of y){let M=T.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(M){let N=M[1],L=`${n}_${N}`;R.set(N,L)}}for(let T of y){let M=yi(T,n,i,a,R,c);v.push(M)}return v.join(`
227
+ `}),Ur(e,a)}function Ur(e,n){if(n.length===0)return e;n.sort((l,c)=>l.start-c.start||l.end-c.end);let t=Array(n.length*2+1),i=0,a=0;for(let l of n)t[a++]=e.slice(i,l.start),t[a++]=l.replacement,i=l.end;return t[a]=e.slice(i),t.join("")}function Hr(e){let n=jn(e),t=new Map;if(n)for(let[i,a]of n)t.set(i,a.instances);return t}function Kr(e,n){let t=jn(e);if(!t)return[];let i=[];for(let[a,l]of t){let c=l.instances-(n.get(a)??0);if(c>0)i.push({body:l.body,count:c})}return i}function Zr(e,n){for(let{body:t,count:i}of n)for(let a=0;a<i;a++)gs(e,t)}function ve(e,n,t=2){let i=0,a=null;for(let l=n+t;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){i++;continue}if(c==="}"){if(i>0){i--;continue}let y=0;while(e[l+y]==="}")y++;if(y>=t)return l}}return-1}import ci from"fs";var qr=0,ms=new Map;function Nc(){qr=0,ms.clear()}function Nn(e,n){let t=qr++,i=`<!--__STX_${e.toUpperCase()}_${t}__-->`;return ms.set(i,{type:e,expression:n}),i}function Dc(){let e={};for(let[n,t]of ms)e[n]={type:t.type,expression:t.expression};return e}function Mc(e,n){let t=e;for(let[i,a]of n)t=t.split(i).join(a);return t}function si(e){return e.includes("<!--__STX_")}var _a=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function wa(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Xr(e){return e.replace(/\{{2,}/g,(n)=>wa(n.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(_a,"&#64;")}function Cs(e,n,t=!1){let{openTag:i,tail:a}=t?Sa(e,n):$a(e).at(n);return Ea(a,i,t)}function Sa(e,n){let t="",i=0;for(let c=0;c<n;c++){if(!e.startsWith("{{",c))continue;let y=ve(e,c);if(y<0||y+2>n)break;t+=e.slice(i,c)+"x",c=y+1,i=y+2}t+=e.slice(i,n);let a=-1,l=null;for(let c=0;c<t.length;c++){let y=t[c];if(l){if(y===l)l=null;continue}if(y==='"'||y==="'"){l=y;continue}if(y===">"){a=-1;continue}if(y==="<")a=c}return{openTag:a,tail:a>=0?t.slice(a+1):t}}var Ln=null;function $a(e){if(Ln&&Ln.source===e)return Ln.scanner;let n=va(e);return Ln={source:e,scanner:n},n}function va(e){let n=0,t=-1,i=null,a=-1,l=(y,v)=>{let R=e[y];if(v.quote){if(R===v.quote)v.quote=null;return}if(v.openTag>=0){if(R==='"'||R==="'"){v.quote=R;return}if(R===">"){v.openTag=-1;return}}if(R==="<")v.openTag=y},c=(y,v)=>{if(v.openTag>=0||!e.startsWith("<!--",y))return-1;let R=e.indexOf("-->",y+4);return R<0?e.length:R+3};return{at(y){if(y<n)n=0,t=-1,i=null,a=-1;let v={openTag:t,quote:i},R=!1;while(n<y){if(a<0&&e.startsWith("{{",n)){let N=ve(e,n);if(N<0)a=n;else if(N+2<=y){n=N+2;continue}else break}let P=c(n,v);if(P>=0){if(P>y){R=!0;break}n=P;continue}l(n,v),n++}if(t=v.openTag,i=v.quote,R)return{openTag:-1,tail:""};let T=a>=0?a:n,M={openTag:t,quote:i};for(let P=n;P<y;P++){let N=c(P,M);if(N>=0){if(N>y)return{openTag:-1,tail:""};P=N-1;continue}l(P,M)}if(M.openTag<0)return{openTag:-1,tail:""};let L="",D=M.openTag+1;for(let P=D;P<Math.min(y,T);P++){if(!e.startsWith("{{",P))continue;let N=ve(e,P);L+=e.slice(D,P)+"x",P=N+1,D=N+2}return L+=e.slice(D,y),{openTag:M.openTag,tail:L}}}}function Ea(e,n,t){if(n<0&&!t)return null;if(n>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(n>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(n>=0)while(i<e.length&&!/\s/.test(e[i]))i++;while(i<e.length){while(/\s/.test(e[i]??"")&&i<e.length)i++;let a=i;while(i<e.length&&!/[\s=/>]/.test(e[i]))i++;let l=e.slice(a,i);if(!l)break;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="=")continue;i++;while(i<e.length&&/\s/.test(e[i]))i++;let c=e[i];if(c==='"'||c==="'"){let y=++i,v=e.indexOf(c,i);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(y)};i=v+1}else{let y=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(y)}}}return{kind:"tag"}}class ie extends Error{attribute;near;constructor(e,n){super(`Unsafe interpolation in ${e}: ${n}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,n){if(this.near===void 0)this.near=e.slice(Math.max(0,n-160),n).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Jr="unsafe:";var ka=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Ra=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Ta=/^data:(?:text\/html|application\/xhtml\+xml)/,Ca=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Aa(e){return e.replace(Ca,"").toLowerCase()}function hs(e){let n=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(n))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(n))return"fetched";return null}function Bn(e,n="navigable"){let t=Aa(e);if(ka.test(t))return!0;return n==="navigable"?Ra.test(t):Ta.test(t)}function mr(e,n="navigable"){return Bn(e,n)?"unsafe:"+e:e}function Ia(e){let n=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!n)return null;if(n[3].trim()!=="")return null;return hs(n[1])}function Gr(e,n,t=256){if(n<=t)return e.slice(0,n);let i=e.slice(n-t,n),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function Yr(e,n,t=n){let i=Ia(e);return i&&Bn(n,i)?"unsafe:"+t:t}function Rt(e){let n=e.indexOf(" as ");if(n!==-1){let l=e.slice(0,n).trim(),c=e.slice(n+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let i=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=t[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function zn(e){let n=[],t=0,i="",a=0;for(let l=0;l<e.length;l++){let c=e[l];if(i){if(c==="\\")l++;else if(c===i)i="";continue}if(c==="'"||c==='"'||c==="`")i=c;else if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)n.push(e.slice(a,l)),a=l+1}return n.push(e.slice(a)),n}function Qr(e,n){let t=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a===n&&t===0)return i}return-1}function ii(e){let n=0;for(let t=0;t<e.length;t++){let i=e[t];if(i==="("||i==="["||i==="{")n++;else if((i===")"||i==="]"||i==="}")&&--n===0)return t}return-1}function ht(e,n){let t=e.trim().replace(/^\.\.\./,"").trim(),i=Qr(t,"=");if(i!==-1&&t[i+1]!==">")t=t.slice(0,i).trim();if(!t)return;if(t.startsWith("{")&&t.endsWith("}")){for(let a of zn(t.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){ht(l,n);continue}let c=Qr(l,":");ht(c===-1?l:l.slice(c+1),n)}return}if(t.startsWith("[")&&t.endsWith("]")){for(let a of zn(t.slice(1,-1)))ht(a,n);return}if(/^[A-Z_$][\w$]*$/i.test(t))n.push(t)}function J(e){let n=e.trim(),t=[],i=0;for(let l=0;l<n.length;l++){let c=n[l];if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(i===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(n.slice(l)))continue;let v=n.slice(0,l).trim();if(v.startsWith("(")&&ii(v)===v.length-1)v=v.slice(1,-1);for(let R of zn(v))ht(R,t);if(t.length>0)return t;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(n);if(a){let l=a[1].trim();if(l.startsWith("(")&&ii(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)ht(c[2],t),ht(c[1],t);else for(let y of zn(l))ht(y,t)}return t}function I(e,n){let t=n instanceof Set?n:new Set(n);if(t.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let y of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(t.has(y))return!0;return!1}var Wn="__stx_client_loop_names";function tt(e){let n=e?.[Wn];return Array.isArray(n)?n:[]}function Fn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let n=[],t=[],i=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(i)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=t.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let y=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((T)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(T[1])),v=(y?.[2]??y?.[3])?.trim();if(v&&y?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let R=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(t.push(R),R)n.push(R)}}return n}var qt={},li=new Map;function Oa(e){let n=li.get(e);if(!n){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n=new RegExp(`:${t}(?!\\w)`,"g"),li.set(e,n)}return n.lastIndex=0,n}var Is={uppercase:(e,n)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,n)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,n)=>{if(e===void 0||e===null)return"";let t=String(e);return t.charAt(0).toUpperCase()+t.slice(1)},number:(e,n,t=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(t),10))}catch{return""}},fmt:(e,n,t="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(t)}catch{return String(e)}},join:(e,n,t=",")=>{if(!Array.isArray(e))return"";return e.join(String(t))},escape:(e,n)=>{if(e===void 0||e===null)return"";return H(String(e))},translate:(e,n,t={})=>{if(!n||!n.__translations)return e;let i=n.__translations,a=n.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),c=i;for(let v of l){if(c===void 0||c===null)break;c=c[v]}if(c===void 0||c===null)return a?e:"";let y=String(c);return Object.entries(t).forEach(([v,R])=>{y=y.replace(Oa(v),()=>String(R))}),y},t:(e,n,t={})=>Is.translate(e,n,t),truncate:(e,n,t=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=t)return a;if(t<=i.length)return i.substring(0,t);return a.substring(0,t-i.length)+i},date:(e,n,t="short",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(t==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,l[t]||l.short).format(a)}catch{return String(e)}},currency:(e,n,t="USD",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(i,{style:"currency",currency:t}).format(a)}catch{return String(e)}},pluralize:(e,n,t,i)=>{let a=Number(e);if(Number.isNaN(a))return t;let l=i||`${t}s`;return a===1?t:l},first:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let t=String(e);return t.charAt(t.length-1)},length:(e,n)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,n,t=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return t?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,n,t="")=>e===void 0||e===null||e===""?t:e,reverse:(e,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,n,t=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(t,i);return e},replace:(e,n,t,i="")=>{if(e===void 0||e===null)return"";let a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,n)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,n)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,n)=>{let t=Number(e);return Number.isNaN(t)?0:Math.abs(t)},round:(e,n,t=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**t;return Math.round(i*a)/a}};function Gf(e,n){if(e in Is)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);qt[e]=n}function xh(e){for(let[n,t]of Object.entries(e))Gf(n,t)}function Xf(){return{...Is,...qt}}function Sh(){for(let e of Object.keys(qt))delete qt[e]}function Nt(e,n,t=2){let i="{".repeat(t);if(!e.includes(i))return e;let a="",l=0;for(;;){let c=e.indexOf(i,l);if(c===-1)break;let y=ve(e,c,t);if(y===-1)break;a+=e.slice(l,c)+n(e.slice(c,y+t),e.slice(c+t,y),c),l=y+t}return l===0?e:a+e.slice(l)}function p(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function H(e){return Xr(p(e))}function Pa(e){return e.replace(/ /g,"&#32;").replace(/\t/g,"&#9;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;").replace(/\f/g,"&#12;").replace(/=/g,"&#61;").replace(/`/g,"&#96;")}function Ma(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(n,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function Da(e,n){let t=Ma(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(t))throw new ie(n,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(t))!==null){let l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),y=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!y)throw new ie(n,"CSS URLs must be local paths or base64 raster images")}}function Z(e,n,t,i=!1,a=0){try{return ja(e,n,t,i,a)}catch(l){if(l instanceof ie)l.locate(e,n);throw l}}function ja(e,n,t,i,a){let l=Cs(e,n,i),c=H(t);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(t))throw new ie("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return t}if(l.kind==="tag"){let R=e.slice(n+a).trimStart(),T=t.trim();if(!R.startsWith("=")&&(T===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(T)))return T;throw new ie("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let y=l.name.toLowerCase();if(/^on[a-z]/.test(y))throw new ie(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(y==="srcdoc")c=H(c);if(y==="style")Da(t,l.name);if(l.quote===null)c=Pa(c);let v=hs(y);if(v&&l.valuePrefix.trim()===""&&Bn(t,v))return Jr+c;return Yr(Gr(e,n),t,c)}function yn(e,n){let t=` ${e}="`;return Z(t,t.length,n,!0)}function hi(e){return e.flatMap((n)=>{let t=n.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!t||/\bserver\b|\bsrc\s*=/.test(t[1])?[]:[t[2]]})}function xe(e,n){let{scripts:t}=X(e);for(let i of hi(t)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i))return!0;if(Rr(i,n))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function Jf(e){let n=[],t=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=t.exec(e);i;i=t.exec(e)){let a=i[1].toLowerCase(),l=new Set(J(i[3]));if(l.size===0)continue;let c=i.index+i[0].length;if(i[0].endsWith("/>")){n.push({start:i.index,end:c,names:l});continue}let y=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");y.lastIndex=c;let v=1,R=e.length;for(let T=y.exec(e);T;T=y.exec(e)){if(T[2]==="/")continue;if(v+=T[1]==="/"?-1:1,v===0){R=T.index+T[0].length;break}}n.push({start:i.index,end:R,names:l})}return n}function ui(e,n,t){let i=s(t);for(let a of e){if(n<a.start||n>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function fi(e,n){let t=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,c=0;for(let R=0;R<i.length;R++){let T=i[R];if(!l&&T==="`"){l=!0,c=0;continue}if(l){if(T==="`"&&c===0){l=!1;continue}if(T==="$"&&i[R+1]==="{"){c++,R++,a+=" ";continue}if(T==="}"&&c>0){c--;continue}if(c>0){a+=T;continue}continue}a+=T}i=a;let y=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=y.exec(i))!==null){let R=v[1];if(!i.substring(0,v.index).trimEnd().endsWith(".")){if(!t.includes(R)&&!(R in n))return!1}}return!0}function Na(e,n){let t=s(e);for(let i of t.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof n[i[1]]==="function")return!0;return!1}function La(e,n){let t=n.__stx_serverDeclared;if(!t||t.size===0)return!1;let i=s(e);for(let a of t)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var pi=new Set;function di(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function gi(e,n){let t=`${n??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!pi.has(t))pi.add(t),console.warn(`[stx] {{ ${e} }} in a <script> in ${n??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function oi(e,n,t){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=E(l,n);if(c===void 0)return di(l)?gi(l.trim(),t):a;return c===null?"":String(c)}catch{return a}}),i=Nt(i,(a,l,c)=>{let y=l.trim();if(/^__[A-Z_]+__$/.test(y))return a;try{let v=E(l,n);if(v===void 0)return di(y)?gi(y,t):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(R)=>"\\u007b".repeat(R.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function Yf(e,n){if(!e.includes("{"))return e;let t=e;return t=t.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let l=E(a,n);if(l===void 0)return i;return l===null?"":String(l)}catch{return i}}),t=Nt(t,(i,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return i;try{let y=E(a,n);if(y===void 0)return i;if(y===null)return"";let v=String(y);return Z(t,l,v,!0,i.length)}catch(y){if(y instanceof ie)throw y;return i}}),t}function kh(e,n,t={}){let{output:i,scripts:a}=X(e),l=a.map((c)=>{let y=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=c.search(/<\/script\s*>$/i);if(!y||v===-1)return c;let R=y[1],T=c.slice(y[0].length,v);if(/\bdata-raw\b/.test(R))return c;if(t.skipServer&&/\bserver\b/.test(R))return c;let L=`<script${Yf(R,n)}>`;if(/\bsrc\s*=/.test(R)||/\btype\s*=\s*["']application\/json["']/.test(R))return L+T+c.slice(v);return L+oi(T,n)+c.slice(v)});return hr(i,l)}function S(e,n,t){let i=e,a=(P,N)=>{let G=un(P,N);if(G===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(P.slice(N,G))?-1:G},l=(P,N,G,K)=>{let B=G.length,{output:Q,tokens:te}=pe(P,N,(ne,ae)=>K(B+ae));return G.push(...te),Q},c=[];i=l(i,a,c,(P)=>`<!--__STX_STYLE_${P}__-->`);let y=[];i=l(i,U,y,(P)=>`<!--__STX_SCRIPT_EXPR_${P}__-->`);let v=n?.__stx_signals_gate===!0||xe(e),R=new Set([...Array.isArray(n?.__stx_client_signal_names)?n.__stx_client_signal_names:[],...ri(hi(y))]),T=new Set(Array.isArray(n?.__stx_preserved_client_expressions)?n.__stx_preserved_client_expressions:[]);i=Nt(i,(P,N,G)=>{if(I(N,R))return P;try{let K=E(N,n,!1,(B)=>bs(B,P,t,e));return K!==void 0&&K!==null?String(K):""}catch(K){let B=K instanceof Error?K.message:String(K);return h("Expression",`Error evaluating: {{{ ${N.trim()}}}}: ${B}`,t,e,G,P)}},3),i=i.replace(/\{!!([\s\S]*?)!!\}/g,(P,N,G)=>{if(I(N,R))return P;try{let K=E(N,n,!1,(B)=>bs(B,P,t,e));if(K===void 0&&n.__stx_buildMode==="compile")return Nn("raw",N.trim());return K!==void 0&&K!==null?String(K):""}catch(K){if(n.__stx_buildMode==="compile")return Nn("raw",N.trim());let B=K instanceof Error?K.message:String(K);return h("Expression",`Error evaluating: {!! ${N.trim()} !!}: ${B}`,t,e,G,P)}}),i=l(i,U,y,(P)=>`<!--__STX_SCRIPT_EXPR_${P}__-->`),i=l(i,a,c,(P)=>`<!--__STX_STYLE_${P}__-->`);let M=v?Jf(i):[],L=Fn(i).map((P)=>({...P,names:new Set(J(`${P.binding} in __slot`))})),D=new Set(tt(n));if(i=Nt(i,(P,N,G)=>{let K=N.trim();if(ui(L,G,K))return P;if(I(K,D))return P;if(M.length>0&&ui(M,G,K))return P;if(T.has(K))return P;let B=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],Q=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ne=K.match(Q)?.[1],ae=ne&&((ne in n)||B.includes(ne)),me=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Ee=K.match(me),Ce=Ee&&!B.includes(Ee[1])&&!(Ee[1]in n);if(/^__[A-Z_]+__$/.test(K))return"";if(I(K,R))return P;if(n.__stx_native_screen===!0&&Na(K,n))return P;let ze;try{let $e=E(N,n,!1,(ct)=>{ze=ct});if(v&&!fi(K,n))return P;if(ze)bs(ze,P,t,e);if(n.__stx_buildMode==="compile"&&!v&&($e===void 0||La(K,n)))return Nn("expr",K);if($e===void 0||$e===null)return"";let st=String($e);return Z(i,G,st,!1,P.length)}catch($e){if($e instanceof ie)throw $e;if(v&&!fi(K,n))return P;if(Ce)return P;let st=$e instanceof Error?$e.message:String($e);return h("Expression",`Error evaluating: {{ ${K} }}: ${st}`,t,e,G,P)}}),y.length>0)i=i.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(P,N)=>y[Number(N)]??P);if(c.length>0)i=i.replace(/<!--__STX_STYLE_(\d+)__-->/g,(P,N)=>c[Number(N)]??P);return i}function Zf(e,n,t){if(!n.trim())return e;let i=e,a=n.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let c=l[1];a=a.substring(c.length).trim();let y=qt[c]||Is[c];if(!y)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(Xf()).join(", ")}`);let v=[];if(a.startsWith(":")){let R=a.match(/^:([^|\s]+)/);if(R){let T=R[1].trim();try{let M=Number(T);v=[Number.isNaN(M)?T:M]}catch{v=[T]}a=a.substring(R[0].length).trim()}}else if(a.startsWith("(")){let R=1,T=1;while(R>0&&T<a.length){if(a[T]==="(")R++;if(a[T]===")")R--;T++}if(R===0){let M=a.substring(1,T-1).trim();if(M)try{if(M.startsWith("{")&&M.endsWith("}"))v=[E(`(${M})`,t,!0)];else{let L=[],D="",P=null,N=0,G=0,K=0,B=!1;for(let Q=0;Q<M.length;Q++){let te=M[Q];if(B){D+=te,B=!1;continue}if(te==="\\"){D+=te,B=!0;continue}if(P){if(D+=te,te===P)P=null;continue}if(te==='"'||te==="'"||te==="`"){P=te,D+=te;continue}if(te==="(")N++;else if(te===")")N--;else if(te==="[")G++;else if(te==="]")G--;else if(te==="{")K++;else if(te==="}")K--;if(te===","&&N===0&&G===0&&K===0){L.push(D),D="";continue}D+=te}if(D)L.push(D);v=L.map((Q)=>{let te=Q.trim();return E(te,t,!0)})}}catch{v=[M]}a=a.substring(T).trim()}}try{i=y(i,t,...v)}catch(R){let T=R instanceof Error?R.message:String(R);throw Error(`Error applying filter '${c}': ${T}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function Ba(e){let n=!1,t="",i=0,a=0,l=0,c=!1;for(let y=0;y<e.length;y++){let v=e[y],R=e[y+1];if(n&&c){c=!1;continue}if(n&&v==="\\"){c=!0;continue}if(c=!1,(v==='"'||v==="'"||v==="`")&&!c){if(!n)n=!0,t=v;else if(v===t)n=!1,t="";continue}if(n&&t==="`"&&v==="$"&&R==="{"){let T=1;y+=2;while(y<e.length&&T>0){if(e[y]==="{")T++;else if(e[y]==="}")T--;if(T>0)y++}continue}if(n)continue;if(v==="(")i++;else if(v===")")i--;else if(v==="[")a++;else if(v==="]")a--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&i===0&&a===0&&l===0){if(R==="|"){y++;continue}if(R==="="){y++;continue}return y}}return-1}var Zt=new Set,za=1000;function _h(){Zt.clear()}function bs(e,n,t,i){if(!q())return;let a=`${t}\x00${e.expression}`;if(Zt.has(a))return;if(Zt.size>=za)Zt.clear();Zt.add(a);let l=t,c=i;try{if(t&&ci.existsSync(t))c=ci.readFileSync(t,"utf8")}catch{}let y=c.indexOf(n);if(y>=0)l=`${t}:${c.slice(0,y).split(`
228
+ `).length}`;console.warn(`${l}: stx warning: ${n} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function E(e,n,t=!1,i){try{let a=e.trim(),l=Ba(a);if(l>0){let y=a.substring(0,l).trim(),v=a.substring(l+1).trim(),R=E(y,n,!0,i);return Zf(R,v,n)}let c=Ns(a);if(c!==null){i?.({expression:a,rule:c});return}try{let y=Object.keys(n),v=Object.values(n);return d(a,y)(...v)}catch{return u(a,n)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let c=l[1],y=Wa(c,Object.keys(n));if(y&&y!==c)a.message=`${a.message} \u2014 did you mean '${y}'?`}}if(!t)console.error(`Error evaluating expression: ${e}`,a);throw a}}function Wa(e,n){let t=null;for(let a of n){if(a===e)continue;let l=Fa(e,a);if(t===null||l<t.dist)t={key:a,dist:l}}if(!t)return null;let i=Math.max(e.length,t.key.length);if(t.dist<=2||t.dist/i<=0.35)return t.key;return null}function Fa(e,n){if(e===n)return 0;if(e.length===0)return n.length;if(n.length===0)return e.length;let[t,i]=e.length<n.length?[e,n]:[n,e],a=Array(t.length+1),l=Array(t.length+1);for(let c=0;c<=t.length;c++)a[c]=c;for(let c=1;c<=i.length;c++){l[0]=c;for(let y=1;y<=t.length;y++){let v=t[y-1]===i[c-1]?0:1;l[y]=Math.min(l[y-1]+1,a[y]+1,a[y-1]+v)}for(let y=0;y<=t.length;y++)a[y]=l[y]}return a[t.length]}function Ch(e){if(!e)return"";return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import Va from"process";function _(e="STX_PUBLIC_"){let n={},t={};for(let[i,a]of Object.entries(Va.env)){if(!i.startsWith(e)||a===void 0)continue;n[`import.meta.env.${i}`]=JSON.stringify(a),t[i]=a}return n["import.meta.env"]=JSON.stringify(t),n}function xi(e,n=""){let t=`${e}${n}`,i=0;for(let a=0;a<t.length;a++){let l=t.charCodeAt(a);i=(i<<5)-i+l,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function bi(e,n,t={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:c=!1}=t;if(!e.trim())return"";let y=ys(e),v=[],R=new Map;if(l)for(let T of y){let M=T.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(M){let L=M[1],D=`${n}_${L}`;R.set(L,D)}}for(let T of y){let M=yi(T,n,i,a,R,c);v.push(M)}return v.join(`
229
229
 
230
- `)}function ys(e){let n=[],t=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",l=!1,c="";for(let y=0;y<t.length;y++){let v=t[y];if(v==="@"&&i===0)l=!0;if(v==="{")i++;else if(v==="}"){if(i--,i===0){if(l){c+=v;let R=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(R){let[,T,M,N]=R;if(T==="keyframes")n.push({selector:`@keyframes ${M.trim()}`,declarations:N.trim()});else if(T==="media"||T==="supports"||T==="container"){let L=ys(N);n.push({selector:`@${T} ${M.trim()}`,declarations:L.map((P)=>`${P.selector} { ${P.declarations} }`).join(`
231
- `)})}else n.push({selector:`@${T} ${M.trim()}`,declarations:N.trim()})}c="",l=!1}else if(a.trim()){a+=v;let R=a.match(/([^{]+)\{([^}]*)\}/);if(R)n.push({selector:R[1].trim(),declarations:R[2].trim()});a=""}continue}}if(l)c+=v;else a+=v}return n}function yi(e,n,t,i,a,l){let{selector:c,declarations:y}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let T=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(T)||T} { ${y} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let M=ys(`x { ${y} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((N)=>yi(N,n,t,i,a,l)).join(`
230
+ `)}function ys(e){let n=[],t=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",l=!1,c="";for(let y=0;y<t.length;y++){let v=t[y];if(v==="@"&&i===0)l=!0;if(v==="{")i++;else if(v==="}"){if(i--,i===0){if(l){c+=v;let R=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(R){let[,T,M,L]=R;if(T==="keyframes")n.push({selector:`@keyframes ${M.trim()}`,declarations:L.trim()});else if(T==="media"||T==="supports"||T==="container"){let D=ys(L);n.push({selector:`@${T} ${M.trim()}`,declarations:D.map((P)=>`${P.selector} { ${P.declarations} }`).join(`
231
+ `)})}else n.push({selector:`@${T} ${M.trim()}`,declarations:L.trim()})}c="",l=!1}else if(a.trim()){a+=v;let R=a.match(/([^{]+)\{([^}]*)\}/);if(R)n.push({selector:R[1].trim(),declarations:R[2].trim()});a=""}continue}}if(l)c+=v;else a+=v}return n}function yi(e,n,t,i,a,l){let{selector:c,declarations:y}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let T=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(T)||T} { ${y} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let M=ys(`x { ${y} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((L)=>yi(L,n,t,i,a,l)).join(`
232
232
  `);return`${c} {
233
233
  ${M}
234
- }`}return`${c} { ${y} }`}let v=Ua(c,n,t,i),R=y;for(let[T,M]of a)R=R.replace(new RegExp(`\\b${T}\\b`,"g"),M);if(l)R=R.replace(/--([a-z-]+)/gi,`--${n}-$1`);return`${v} { ${R} }`}function Ua(e,n,t,i){let a=e.split(",").map((c)=>c.trim()),l=[];for(let c of a){if(c.startsWith(":host")){if(i)l.push(c);else{let R=c.replace(/:host(\([^)]*\))?/,`.${n}$1`);l.push(R)}continue}if(c.includes("::slotted")){l.push(c);continue}if(c===":root"){l.push(`:root .${n}`);continue}let y=t?`${t} .${n}`:`.${n}`;l.push(`${y} ${c}`);let v=Ha(c,n);if(v)l.push(t?`${t} ${v}`:v)}return l.join(", ")}function Ha(e,n){let t=0,i=e.length;for(let v=0;v<e.length;v++){let R=e[v];if(R==="["||R==="(")t++;else if(R==="]"||R===")")t--;else if(t===0&&(R===" "||R===">"||R==="+"||R==="~")){i=v;break}}let a=e.slice(0,i),l=e.slice(i);if(!a)return"";let c=a.length,y=0;for(let v=0;v<a.length;v++){let R=a[v];if(R==="["||R==="(")y++;else if(R==="]"||R===")")y--;else if(t===0&&y===0&&R===":"){c=v;break}}return`${a.slice(0,c)}.${n}${a.slice(c)}${l}`}var Si=String.raw`(?<![\w-])scoped(?![\w-])`,Ms=/<style\s+([^>]*)>/gi,_i=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,$i=new RegExp(Si,"i"),Ka=new RegExp(Si,"gi"),Ds=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Za(e){Ms.lastIndex=0;let n=Ms.exec(e);while(n!==null){if($i.test(n[1]))return!0;n=Ms.exec(e)}return!1}function Yo(e){let n=new Set,t=[];Ds.lastIndex=0;let i=Ds.exec(e);while(i!==null){let a=i[0].trim();if(n.has(a))t.push({start:i.index,end:i.index+i[0].length});else n.add(a);i=Ds.exec(e)}return t}function dn(e){let n=Yo(e);if(n.length===0)return e;let t=Array(n.length+1),i=0;for(let a=0;a<n.length;a++){let l=n[a];t[a]=e.slice(i,l.start),i=l.end}return t[n.length]=e.slice(i),t.join("")}function Ts(e,n){if(!Za(e))return{html:e,hasScoped:!1};let t=xi(n),i=`data-v-${t}`,a=e,l=!1;if(_i.lastIndex=0,a=a.replace(_i,(c,y,v)=>{if(!$i.test(y))return c;l=!0;let R=qa(v,i),T=y.replace(Ka,"").trim(),M=T?` ${T}`:"";return`<style data-stx-scoped="${t}"${M}>${R}</style>`}),!l)return{html:e,hasScoped:!1};return a=Ja(a,i),{html:a,hasScoped:!0}}function qa(e,n){return bi(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${n}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${n}]`)}var Xa=(e)=>`\x00stx-scope-mask-${e}\x00`,wi=/\u0000stx-scope-mask-(\d+)\u0000/g;function Ja(e,n){let t=pe(e,(a,l)=>{let c=U(a,l);return c>l?c:un(a,l)},(a,l)=>Xa(l)),i=Ga(t.output,n);return wi.lastIndex=0,i.replace(wi,(a,l)=>t.tokens[Number(l)])}function Ga(e,n){let t=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(i,a,l)=>{if(t.has(a.toLowerCase()))return i;if(i.includes(n))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(l)return i.replace(`<${a}${l}`,`<${a} ${n}${l}`);if(i.endsWith("/>"))return`<${a} ${n} />`;return`<${a} ${n}>`})}var Xt=/<\/?template\b[^>]*>/gi,Ya=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Qa(e){let n=e.replace(/^<template\b/i,"").replace(/>$/,"");return Ya.test(n)}function de(e){Xt.lastIndex=0;let n;while((n=Xt.exec(e))!==null){if(n[0].startsWith("</")||Qa(n[0]))continue;let t=n.index,i=Xt.lastIndex,a=1,l;while((l=Xt.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let c=l.index;return{start:t,openEnd:i,closeStart:c,end:Xt.lastIndex,content:e.slice(i,c)}}}else a++;return null}return null}function Rs(e,n){let t=e,i=/@json\s*\(/g,a;while((a=i.exec(t))!==null){let l=a.index,c=l+a[0].length-1,y=1,v=c+1,R=null,T=!1;while(v<t.length&&y>0){let Q=t[v];if(T){T=!1,v++;continue}if(Q==="\\"&&R){T=!0,v++;continue}if(R){if(Q===R)R=null;v++;continue}if(Q==='"'||Q==="'"||Q==="`"){R=Q,v++;continue}if(Q==="(")y++;else if(Q===")"){if(y--,y===0)break}v++}if(y!==0)break;let M=t.substring(c+1,v).trim(),N=t.substring(l,v+1),L=-1,P=0,D=null,G=!1;for(let Q=0;Q<M.length;Q++){let te=M[Q];if(G){G=!1;continue}if(te==="\\"&&D){G=!0;continue}if(D){if(te===D)D=null;continue}if(te==='"'||te==="'"||te==="`"){D=te;continue}if(te==="("||te==="["||te==="{")P++;else if(te===")"||te==="]"||te==="}")P--;if(te===","&&P===0){L=Q;break}}let K=L>=0?M.substring(0,L).trim():M,B=L>=0?M.substring(L+1).trim():void 0;try{let Q=K.trim(),te;if(f(Q))te=d(Q,Object.keys(n))(...Object.values(n));else te=void 0;let ne;if(B==="true")ne=JSON.stringify(te,null,2);else ne=JSON.stringify(te);let ae=ne.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");t=t.substring(0,l)+ae+t.substring(v+1),i.lastIndex=l+ae.length}catch(Q){j.log(Q instanceof Error?Q:Error(String(Q)),{directive:"@json"},"error"),i.lastIndex=l+N.length}}return t}function As(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function kc(e){let n=e,t=/@memo\s*\(/g,i,a=[];while((i=t.exec(n))!==null){let l=i.index,c=l+i[0].length,y=1,v=c;while(v<n.length&&y>0){if(n[v]==="(")y++;else if(n[v]===")")y--;v++}if(y!==0)continue;let R=n.slice(c,v-1).trim(),T=v,M=n.slice(T),N=M.indexOf("@endmemo");if(N===-1)continue;let L=M.slice(0,N),P=T+N+8,D=L.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),G=D?D[0].length:0,K=L.slice(G),B=L.match(/(\s*)$/),Q=B?B[0].length:0,te=K.slice(0,K.length-Q),ne=te.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),ae;if(ne){let[me,Ee,Ce="",ze]=ne,$e=`<${Ee}${Ce} data-stx-memo="${R}"${ze}>`;ae=L.slice(0,G)+$e+te.slice(me.length)+L.slice(G+te.length)}else ae=`${L.slice(0,G)}<div data-stx-memo="${R}">${te}</div>${L.slice(G+te.length)}`;a.push({start:l,end:P,replacement:ae}),t.lastIndex=P}for(let l=a.length-1;l>=0;l--){let c=a[l];n=n.slice(0,c.start)+c.replacement+n.slice(c.end)}return n.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Zo(e){let n=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return n=n.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),n}function Ri(e,n){if(!/\bref\s*=/.test(e))return e;let t=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=C(e,(v,R)=>{t.lastIndex=R;let T=t.exec(v);if(!T||/^(?:script|style)$/i.test(T[1]))return-1;return t.lastIndex}),a=[],l=0,c=0,y=[];for(let{start:v,end:R,token:T}of i){let M=/^<\/?([\w-]+)/.exec(T)[1].toLowerCase();if(T.startsWith("</")){let L;while(L=a.pop()){if(L.scoped)l--;if(L.name===M)break}continue}let N=/\sdata-stx-scope\s*=/.test(T);if(!l&&!N&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(T)&&!/\sdata-stx-ref-caller\s*=/.test(T))y.push(e.slice(c,v),T.replace(/\s*\/?>$/,(L)=>` data-stx-ref-caller="${n}"${L}`)),c=R;if(!Ti.has(M)&&!/\/>$/.test(T)){if(a.push({name:M,scoped:N}),N)l++}}return y.push(e.slice(c)),y.join("")}var Ti=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ci=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,vi=/<\/?\s*([a-z][\w-]*)/iy,ec=/\s/;function tc(e,n){let t=n-1;while(t>=0&&ec.test(e[t]))t--;return t>=0&&e[t]==="/"}function nc(e,n){let t=!1,i=!1;for(let a=n;a<e.length;a++){let l=e[a];if(t){if(l==="'")t=!1}else if(i){if(l==='"')i=!1}else if(l==="'")t=!0;else if(l==='"')i=!0;else if(l===">")return a}return-1}function sc(e,n){if(e.indexOf("{",n)===-1||e.indexOf("}",n)===-1)return!1;let t=0,i=n,a=!1,l=!1,c=!1;while(i<e.length){let y=e.indexOf("<",i),v=y===-1?e.length:y;if(v>i){if(t===0)while(i<v){let M=e.indexOf(l?"}":"{",i);if(M===-1||M>=v){if(l)c=!1;else a=!1;break}if(M>i)if(l)c=!1;else a=!1;if(l){if(c)return!0;c=!0}else if(a)l=!0,c=!1;else a=!0;i=M+1}i=v;continue}if(e.startsWith("<!--",i)){let M=e.indexOf("-->",i);i=M===-1?e.length:M+3;continue}let R=nc(e,i);if(R===-1)break;vi.lastIndex=i;let T=vi.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(t===0)break;t--}else if(!tc(e,R)&&!Ti.has(T))t++;i=R+1}return!1}var Ei=w(256);function _c(e){if(e.length<1024)return ki(e);let n=x(e),t=Ei.get(n);if(t!==void 0)return t;let i=ki(e);return Ei.set(n,i),i}function ki(e){if(e.length>=32768&&!Vr(e))return e;let t=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),i="",a=0,l;while((l=t.exec(e))!==null){let c=l.index,y=c+l[0].length,v=!1,R=!1,T=-1;while(y<e.length){let N=e[y];if(v){if(N==="'")v=!1}else if(R){if(N==='"')R=!1}else if(N==="'")v=!0;else if(N==='"')R=!0;else if(N===">"){T=y;break}y++}if(T===-1)continue;let M=e.slice(c,T+1);if(Ci.test(M))continue;if(M.includes("x-cloak"))continue;if(sc(e,T+1))i+=e.slice(a,T)+" x-cloak>",a=T+1}return i+=e.slice(a),i}var rc=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,ic=/<\/script>/gi,oc=/<\/style>/gi;function Cc(e){let n=/<[a-z][\w-]*/gi,t="",i=0,a;while((a=n.exec(e))!==null){let l=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let P=c==="script"?ic:oc;P.lastIndex=l;let D=P.exec(e);if(D!==null)n.lastIndex=D.index+D[0].length;continue}let y=l+a[0].length,v=!1,R=!1,T=-1;while(y<e.length){let P=e[y];if(v){if(P==="'")v=!1}else if(R){if(P==='"')R=!1}else if(P==="'")v=!0;else if(P==='"')R=!0;else if(P===">"){T=y;break}y++}if(T===-1)continue;let M=e.slice(l+a[0].length,T);if(Ci.test(M))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(M))continue;if(!rc.test(M))continue;let N=e[T-1]==="/",L=N?T-1:T;t+=`${e.slice(i,L)} x-cloak${N?" ":""}`,i=L}return t+=e.slice(i),t}import Fi from"path";import zs from"fs";import Jt from"path";function Ai(e,n,t,i){let a=0;for(let l=n;l<e.length;l++)if(e[l]===t)a++;else if(e[l]===i&&!(i===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function ac(e){let n=s(e),t=0,i=0,a=[];for(let l=0;l<n.length;l++)if("([{".includes(n[l]))t++;else if(")]}".includes(n[l]))t--;else if(n[l]===","&&t===0)a.push(e.slice(i,l).trim()),i=l+1;return a.push(e.slice(i).trim()),a}function Ls(e,n){let t=s(e),i=new RegExp(`\\b(?:${n.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of t.matchAll(i)){let l=a.index+a[0].length,c="";if(t[l]==="<"){let v=Ai(t,l,"<",">");if(v<0)continue;c=e.slice(l+1,v),l=v+1;while(/\s/.test(t[l]||"")&&l<t.length)l++}if(t[l]!=="(")continue;let y=Ai(t,l,"(",")");if(y>=0)return{type:c,args:ac(e.slice(l+1,y))}}return null}var Ii=`
234
+ }`}return`${c} { ${y} }`}let v=Ua(c,n,t,i),R=y;for(let[T,M]of a)R=R.replace(new RegExp(`\\b${T}\\b`,"g"),M);if(l)R=R.replace(/--([a-z-]+)/gi,`--${n}-$1`);return`${v} { ${R} }`}function Ua(e,n,t,i){let a=e.split(",").map((c)=>c.trim()),l=[];for(let c of a){if(c.startsWith(":host")){if(i)l.push(c);else{let R=c.replace(/:host(\([^)]*\))?/,`.${n}$1`);l.push(R)}continue}if(c.includes("::slotted")){l.push(c);continue}if(c===":root"){l.push(`:root .${n}`);continue}let y=t?`${t} .${n}`:`.${n}`;l.push(`${y} ${c}`);let v=Ha(c,n);if(v)l.push(t?`${t} ${v}`:v)}return l.join(", ")}function Ha(e,n){let t=0,i=e.length;for(let v=0;v<e.length;v++){let R=e[v];if(R==="["||R==="(")t++;else if(R==="]"||R===")")t--;else if(t===0&&(R===" "||R===">"||R==="+"||R==="~")){i=v;break}}let a=e.slice(0,i),l=e.slice(i);if(!a)return"";let c=a.length,y=0;for(let v=0;v<a.length;v++){let R=a[v];if(R==="["||R==="(")y++;else if(R==="]"||R===")")y--;else if(t===0&&y===0&&R===":"){c=v;break}}return`${a.slice(0,c)}.${n}${a.slice(c)}${l}`}var Si=String.raw`(?<![\w-])scoped(?![\w-])`,Ms=/<style\s+([^>]*)>/gi,_i=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,$i=new RegExp(Si,"i"),Ka=new RegExp(Si,"gi"),Ds=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Za(e){Ms.lastIndex=0;let n=Ms.exec(e);while(n!==null){if($i.test(n[1]))return!0;n=Ms.exec(e)}return!1}function Yo(e){let n=new Set,t=[];Ds.lastIndex=0;let i=Ds.exec(e);while(i!==null){let a=i[0].trim();if(n.has(a))t.push({start:i.index,end:i.index+i[0].length});else n.add(a);i=Ds.exec(e)}return t}function dn(e){let n=Yo(e);if(n.length===0)return e;let t=Array(n.length+1),i=0;for(let a=0;a<n.length;a++){let l=n[a];t[a]=e.slice(i,l.start),i=l.end}return t[n.length]=e.slice(i),t.join("")}function Ts(e,n){if(!Za(e))return{html:e,hasScoped:!1};let t=xi(n),i=`data-v-${t}`,a=e,l=!1;if(_i.lastIndex=0,a=a.replace(_i,(c,y,v)=>{if(!$i.test(y))return c;l=!0;let R=qa(v,i),T=y.replace(Ka,"").trim(),M=T?` ${T}`:"";return`<style data-stx-scoped="${t}"${M}>${R}</style>`}),!l)return{html:e,hasScoped:!1};return a=Ja(a,i),{html:a,hasScoped:!0}}function qa(e,n){return bi(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${n}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${n}]`)}var Xa=(e)=>`\x00stx-scope-mask-${e}\x00`,wi=/\u0000stx-scope-mask-(\d+)\u0000/g;function Ja(e,n){let t=pe(e,(a,l)=>{let c=U(a,l);return c>l?c:un(a,l)},(a,l)=>Xa(l)),i=Ga(t.output,n);return wi.lastIndex=0,i.replace(wi,(a,l)=>t.tokens[Number(l)])}function Ga(e,n){let t=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(i,a,l)=>{if(t.has(a.toLowerCase()))return i;if(i.includes(n))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(l)return i.replace(`<${a}${l}`,`<${a} ${n}${l}`);if(i.endsWith("/>"))return`<${a} ${n} />`;return`<${a} ${n}>`})}var Xt=/<\/?template\b[^>]*>/gi,Ya=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Qa(e){let n=e.replace(/^<template\b/i,"").replace(/>$/,"");return Ya.test(n)}function de(e){Xt.lastIndex=0;let n;while((n=Xt.exec(e))!==null){if(n[0].startsWith("</")||Qa(n[0]))continue;let t=n.index,i=Xt.lastIndex,a=1,l;while((l=Xt.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let c=l.index;return{start:t,openEnd:i,closeStart:c,end:Xt.lastIndex,content:e.slice(i,c)}}}else a++;return null}return null}function Rs(e,n){let t=e,i=/@json\s*\(/g,a;while((a=i.exec(t))!==null){let l=a.index,c=l+a[0].length-1,y=1,v=c+1,R=null,T=!1;while(v<t.length&&y>0){let Q=t[v];if(T){T=!1,v++;continue}if(Q==="\\"&&R){T=!0,v++;continue}if(R){if(Q===R)R=null;v++;continue}if(Q==='"'||Q==="'"||Q==="`"){R=Q,v++;continue}if(Q==="(")y++;else if(Q===")"){if(y--,y===0)break}v++}if(y!==0)break;let M=t.substring(c+1,v).trim(),L=t.substring(l,v+1),D=-1,P=0,N=null,G=!1;for(let Q=0;Q<M.length;Q++){let te=M[Q];if(G){G=!1;continue}if(te==="\\"&&N){G=!0;continue}if(N){if(te===N)N=null;continue}if(te==='"'||te==="'"||te==="`"){N=te;continue}if(te==="("||te==="["||te==="{")P++;else if(te===")"||te==="]"||te==="}")P--;if(te===","&&P===0){D=Q;break}}let K=D>=0?M.substring(0,D).trim():M,B=D>=0?M.substring(D+1).trim():void 0;try{let Q=K.trim(),te;if(f(Q))te=d(Q,Object.keys(n))(...Object.values(n));else te=void 0;let ne;if(B==="true")ne=JSON.stringify(te,null,2);else ne=JSON.stringify(te);let ae=ne.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");t=t.substring(0,l)+ae+t.substring(v+1),i.lastIndex=l+ae.length}catch(Q){j.log(Q instanceof Error?Q:Error(String(Q)),{directive:"@json"},"error"),i.lastIndex=l+L.length}}return t}function As(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function kc(e){let n=e,t=/@memo\s*\(/g,i,a=[];while((i=t.exec(n))!==null){let l=i.index,c=l+i[0].length,y=1,v=c;while(v<n.length&&y>0){if(n[v]==="(")y++;else if(n[v]===")")y--;v++}if(y!==0)continue;let R=n.slice(c,v-1).trim(),T=v,M=n.slice(T),L=M.indexOf("@endmemo");if(L===-1)continue;let D=M.slice(0,L),P=T+L+8,N=D.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),G=N?N[0].length:0,K=D.slice(G),B=D.match(/(\s*)$/),Q=B?B[0].length:0,te=K.slice(0,K.length-Q),ne=te.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),ae;if(ne){let[me,Ee,Ce="",ze]=ne,$e=`<${Ee}${Ce} data-stx-memo="${R}"${ze}>`;ae=D.slice(0,G)+$e+te.slice(me.length)+D.slice(G+te.length)}else ae=`${D.slice(0,G)}<div data-stx-memo="${R}">${te}</div>${D.slice(G+te.length)}`;a.push({start:l,end:P,replacement:ae}),t.lastIndex=P}for(let l=a.length-1;l>=0;l--){let c=a[l];n=n.slice(0,c.start)+c.replacement+n.slice(c.end)}return n.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Zo(e){let n=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return n=n.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),n}function Ri(e,n){if(!/\bref\s*=/.test(e))return e;let t=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=C(e,(v,R)=>{t.lastIndex=R;let T=t.exec(v);if(!T||/^(?:script|style)$/i.test(T[1]))return-1;return t.lastIndex}),a=[],l=0,c=0,y=[];for(let{start:v,end:R,token:T}of i){let M=/^<\/?([\w-]+)/.exec(T)[1].toLowerCase();if(T.startsWith("</")){let D;while(D=a.pop()){if(D.scoped)l--;if(D.name===M)break}continue}let L=/\sdata-stx-scope\s*=/.test(T);if(!l&&!L&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(T)&&!/\sdata-stx-ref-caller\s*=/.test(T))y.push(e.slice(c,v),T.replace(/\s*\/?>$/,(D)=>` data-stx-ref-caller="${n}"${D}`)),c=R;if(!Ti.has(M)&&!/\/>$/.test(T)){if(a.push({name:M,scoped:L}),L)l++}}return y.push(e.slice(c)),y.join("")}var Ti=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ci=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,vi=/<\/?\s*([a-z][\w-]*)/iy,ec=/\s/;function tc(e,n){let t=n-1;while(t>=0&&ec.test(e[t]))t--;return t>=0&&e[t]==="/"}function nc(e,n){let t=!1,i=!1;for(let a=n;a<e.length;a++){let l=e[a];if(t){if(l==="'")t=!1}else if(i){if(l==='"')i=!1}else if(l==="'")t=!0;else if(l==='"')i=!0;else if(l===">")return a}return-1}function sc(e,n){if(e.indexOf("{",n)===-1||e.indexOf("}",n)===-1)return!1;let t=0,i=n,a=!1,l=!1,c=!1;while(i<e.length){let y=e.indexOf("<",i),v=y===-1?e.length:y;if(v>i){if(t===0)while(i<v){let M=e.indexOf(l?"}":"{",i);if(M===-1||M>=v){if(l)c=!1;else a=!1;break}if(M>i)if(l)c=!1;else a=!1;if(l){if(c)return!0;c=!0}else if(a)l=!0,c=!1;else a=!0;i=M+1}i=v;continue}if(e.startsWith("<!--",i)){let M=e.indexOf("-->",i);i=M===-1?e.length:M+3;continue}let R=nc(e,i);if(R===-1)break;vi.lastIndex=i;let T=vi.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(t===0)break;t--}else if(!tc(e,R)&&!Ti.has(T))t++;i=R+1}return!1}var Ei=w(256);function _c(e){if(e.length<1024)return ki(e);let n=x(e),t=Ei.get(n);if(t!==void 0)return t;let i=ki(e);return Ei.set(n,i),i}function ki(e){if(e.length>=32768&&!Vr(e))return e;let t=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),i="",a=0,l;while((l=t.exec(e))!==null){let c=l.index,y=c+l[0].length,v=!1,R=!1,T=-1;while(y<e.length){let L=e[y];if(v){if(L==="'")v=!1}else if(R){if(L==='"')R=!1}else if(L==="'")v=!0;else if(L==='"')R=!0;else if(L===">"){T=y;break}y++}if(T===-1)continue;let M=e.slice(c,T+1);if(Ci.test(M))continue;if(M.includes("x-cloak"))continue;if(sc(e,T+1))i+=e.slice(a,T)+" x-cloak>",a=T+1}return i+=e.slice(a),i}var rc=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,ic=/<\/script>/gi,oc=/<\/style>/gi;function Cc(e){let n=/<[a-z][\w-]*/gi,t="",i=0,a;while((a=n.exec(e))!==null){let l=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let P=c==="script"?ic:oc;P.lastIndex=l;let N=P.exec(e);if(N!==null)n.lastIndex=N.index+N[0].length;continue}let y=l+a[0].length,v=!1,R=!1,T=-1;while(y<e.length){let P=e[y];if(v){if(P==="'")v=!1}else if(R){if(P==='"')R=!1}else if(P==="'")v=!0;else if(P==='"')R=!0;else if(P===">"){T=y;break}y++}if(T===-1)continue;let M=e.slice(l+a[0].length,T);if(Ci.test(M))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(M))continue;if(!rc.test(M))continue;let L=e[T-1]==="/",D=L?T-1:T;t+=`${e.slice(i,D)} x-cloak${L?" ":""}`,i=D}return t+=e.slice(i),t}import Fi from"path";import zs from"fs";import Jt from"path";function Ai(e,n,t,i){let a=0;for(let l=n;l<e.length;l++)if(e[l]===t)a++;else if(e[l]===i&&!(i===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function ac(e){let n=s(e),t=0,i=0,a=[];for(let l=0;l<n.length;l++)if("([{".includes(n[l]))t++;else if(")]}".includes(n[l]))t--;else if(n[l]===","&&t===0)a.push(e.slice(i,l).trim()),i=l+1;return a.push(e.slice(i).trim()),a}function Ls(e,n){let t=s(e),i=new RegExp(`\\b(?:${n.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of t.matchAll(i)){let l=a.index+a[0].length,c="";if(t[l]==="<"){let v=Ai(t,l,"<",">");if(v<0)continue;c=e.slice(l+1,v),l=v+1;while(/\s/.test(t[l]||"")&&l<t.length)l++}if(t[l]!=="(")continue;let y=Ai(t,l,"(",")");if(y>=0)return{type:c,args:ac(e.slice(l+1,y))}}return null}var Ii=`
235
235
  type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
236
236
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
237
237
  type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
@@ -239,55 +239,56 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
239
239
  type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
240
240
  type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
241
241
  type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
242
- `;function Oi(e,n){let t=[],i={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=s(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(N,L,P,D,G)=>{if(a.slice(G,G+6)!=="import")return N;if(D.endsWith(".stx"))return"";let K=`${n}Import${t.length}`;if(t.push(`import * as ${K} from ${JSON.stringify(D)};`),L.startsWith("*"))return`import ${L.replace(/^\*\s+as\s+/,"")} = ${K};`;if(!L.startsWith("{"))return`import ${L} = ${K}.default;`;return L.slice(1,-1).split(",").map((B)=>{let[Q,te=Q]=B.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!Q)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(D)&&Q in i)i[Q].push(te);return`import ${te} = ${K}.${Q};`}).join(`
243
- `)}),c=Ls(e,i.defineProps),y=Ls(e,i.defineEmits),v=Ls(e,i.withDefaults);if(!c&&!y)return{declarations:"",props:null,events:null};let R=[],T=null,M=null;if(c){R.push(`const __options = (${c.args[0]||"{}"}) as const;`),R.push(`const __defaults = (${v?.args[1]||"{}"});`);let N=c.type||"__StxOptions<typeof __options>";R.push(`export type __StxProps = __StxDefaults<${N}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),T=`${n}.__StxProps`}if(y)R.push(`const __events = (${y.args[0]||"[]"}) as const;`),R.push(`export type __StxEvents = ${y.type||"Record<(typeof __events)[number], any[]>"};`),M=`${n}.__StxEvents`;return{declarations:`${t.join(`
242
+ `;function Oi(e,n){let t=[],i={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=s(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(L,D,P,N,G)=>{if(a.slice(G,G+6)!=="import")return L;if(N.endsWith(".stx"))return"";let K=`${n}Import${t.length}`;if(t.push(`import * as ${K} from ${JSON.stringify(N)};`),D.startsWith("*"))return`import ${D.replace(/^\*\s+as\s+/,"")} = ${K};`;if(!D.startsWith("{"))return`import ${D} = ${K}.default;`;return D.slice(1,-1).split(",").map((B)=>{let[Q,te=Q]=B.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!Q)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(N)&&Q in i)i[Q].push(te);return`import ${te} = ${K}.${Q};`}).join(`
243
+ `)}),c=Ls(e,i.defineProps),y=Ls(e,i.defineEmits),v=Ls(e,i.withDefaults);if(!c&&!y)return{declarations:"",props:null,events:null};let R=[],T=null,M=null;if(c){R.push(`const __options = (${c.args[0]||"{}"}) as const;`),R.push(`const __defaults = (${v?.args[1]||"{}"});`);let L=c.type||"__StxOptions<typeof __options>";R.push(`export type __StxProps = __StxDefaults<${L}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),T=`${n}.__StxProps`}if(y)R.push(`const __events = (${y.args[0]||"[]"}) as const;`),R.push(`export type __StxEvents = ${y.type||"Record<(typeof __events)[number], any[]>"};`),M=`${n}.__StxEvents`;return{declarations:`${t.join(`
244
244
  `)}
245
245
  namespace ${n} {
246
246
  ${l}
247
247
  ${R.join(`
248
248
  `)}
249
- }`,props:T,events:M}}var yr=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function br(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...yr].some((n)=>n.toLowerCase()===e.toLowerCase());return yr.has(e)||/[A-Z]/.test(e)}function*cc(e){let n=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,t;while(t=n.exec(e)){let i=n.lastIndex,a=[];while(i<e.length){while(/\s/.test(e[i]||""))i++;if(e[i]===">"||e.slice(i,i+2)==="/>"){i+=e[i]===">"?1:2;break}let l=/^[^\s=/>]+/.exec(e.slice(i))?.[0];if(!l){i++;continue}let c=i;i+=l.length;while(/\s/.test(e[i]||""))i++;if(e[i]!=="="){a.push({name:l,value:!0,offset:c,braced:!1});continue}i++;while(/\s/.test(e[i]||""))i++;let y=e[i],v=y==="{",R=y==='"'||y==="'";if(R||v)i++;let T=i;if(v){let M=s(e.slice(i)),N=1,L=0;for(;L<M.length;L++){if(M[L]==="{")N++;if(M[L]==="}"&&--N===0)break}i+=L}else if(R)while(i<e.length&&e[i]!==y)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:l,value:e.slice(T,i),offset:T,braced:v}),R||v)i++}n.lastIndex=i,yield{name:t[1],offset:t.index,attributes:a}}}function Pi(e,n,t){let i=[],a=[Ii,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,c=new Map,y=new Map,v=t.scriptCode(e,t.filePath),R=s(v);for(let P of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(R.slice(P.index,P.index+6)!=="import")continue;let D=P[2],G=Jt.isAbsolute(D)||D.startsWith(".")?Jt.resolve(Jt.dirname(t.filePath),D):Ss(D,Jt.dirname(t.filePath));if(!G)continue;let K=G.endsWith(".stx")?G:zs.existsSync(`${G}.stx`)?`${G}.stx`:void 0,B=K?null:xs(G,!1),Q=P[1].startsWith("{")?P[1].slice(1,-1).split(","):[P[1]];for(let te of Q){let[ne,ae=ne]=te.trim().split(/\s+as\s+/),me=K||B?.get(ne)||B?.get(ne.toLowerCase());if(me)y.set(ae,me),y.set(ae.toLowerCase(),me),y.set(ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),me)}}for(let P of n.matchAll(/@import\s*\(([^)]+)\)/g))for(let D of P[1].matchAll(/['"]([^'"]+)['"]/g)){let G=ks(D[1],t.filePath,t).find((K)=>zs.statSync(K,{throwIfNoEntry:!1})?.isFile());if(G)y.set(Jt.basename(D[1]).replace(/\.stx$/,""),G)}let T={__importedComponents:y},M=new Map,N=(P,D,G)=>{let K=e.slice(0,P);return{code:D,offset:P,attribute:G,anchor:!0,kind:"directive",line:K.split(`
249
+ }`,props:T,events:M}}var yr=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function br(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...yr].some((n)=>n.toLowerCase()===e.toLowerCase());return yr.has(e)||/[A-Z]/.test(e)}function*cc(e){let n=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,t;while(t=n.exec(e)){let i=n.lastIndex,a=[];while(i<e.length){while(/\s/.test(e[i]||""))i++;if(e[i]===">"||e.slice(i,i+2)==="/>"){i+=e[i]===">"?1:2;break}let l=/^[^\s=/>]+/.exec(e.slice(i))?.[0];if(!l){i++;continue}let c=i;i+=l.length;while(/\s/.test(e[i]||""))i++;if(e[i]!=="="){a.push({name:l,value:!0,offset:c,braced:!1});continue}i++;while(/\s/.test(e[i]||""))i++;let y=e[i],v=y==="{",R=y==='"'||y==="'";if(R||v)i++;let T=i;if(v){let M=s(e.slice(i)),L=1,D=0;for(;D<M.length;D++){if(M[D]==="{")L++;if(M[D]==="}"&&--L===0)break}i+=D}else if(R)while(i<e.length&&e[i]!==y)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:l,value:e.slice(T,i),offset:T,braced:v}),R||v)i++}n.lastIndex=i,yield{name:t[1],offset:t.index,attributes:a}}}function Pi(e,n,t){let i=[],a=[Ii,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,c=new Map,y=new Map,v=t.scriptCode(e,t.filePath),R=s(v);for(let P of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(R.slice(P.index,P.index+6)!=="import")continue;let N=P[2],G=Jt.isAbsolute(N)||N.startsWith(".")?Jt.resolve(Jt.dirname(t.filePath),N):Ss(N,Jt.dirname(t.filePath));if(!G)continue;let K=G.endsWith(".stx")?G:zs.existsSync(`${G}.stx`)?`${G}.stx`:void 0,B=K?null:xs(G,!1),Q=P[1].startsWith("{")?P[1].slice(1,-1).split(","):[P[1]];for(let te of Q){let[ne,ae=ne]=te.trim().split(/\s+as\s+/),me=K||B?.get(ne)||B?.get(ne.toLowerCase());if(me)y.set(ae,me),y.set(ae.toLowerCase(),me),y.set(ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),me)}}for(let P of n.matchAll(/@import\s*\(([^)]+)\)/g))for(let N of P[1].matchAll(/['"]([^'"]+)['"]/g)){let G=ks(N[1],t.filePath,t).find((K)=>zs.statSync(K,{throwIfNoEntry:!1})?.isFile());if(G)y.set(Jt.basename(N[1]).replace(/\.stx$/,""),G)}let T={__importedComponents:y},M=new Map,L=(P,N,G)=>{let K=e.slice(0,P);return{code:N,offset:P,attribute:G,anchor:!0,kind:"directive",line:K.split(`
250
250
  `).length,column:P-K.lastIndexOf(`
251
- `)}},L=(P,D,G)=>i.push({expression:P,statement:{text:D+P.code+G,prefixLength:D.length}});for(let P of cc(n)){if(br(P.name)||P.name==="component")continue;let D=pr(P.name,t.filePath,t,T);if(!D)continue;let G=M.get(D);if(!G){let B;try{B=t.readComponent?t.readComponent(D):zs.readFileSync(D,"utf8")}catch{continue}if(B===void 0)continue;c.set(D,B),G=Oi(t.scriptCode(B,D),`__StxComponent${M.size}`),M.set(D,G),a.push(G.declarations)}let K=[];for(let B of P.attributes){let{name:Q,offset:te}=B,ne=B.value===!0?"true":B.value;if(Q.startsWith("@")||Q.startsWith("v-on:")){if(G.events&&B.value!==!0)l.set(te,`__StxEvent<${G.events}, ${JSON.stringify(Q.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let ae=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(Q);if(Q.startsWith("v-")&&!Q.startsWith("v-bind:")&&!ae)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(Q))continue;let me=(ae?ae[1]||"modelValue":Q.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(ze,$e)=>$e.toUpperCase());if(K.push(me),!G.props)continue;let Ce=Q.startsWith(":")||Q.startsWith("v-bind:")||!!ae||B.braced?ne:B.value!==!0?JSON.stringify(ne):"true";L(N(te,Ce,Q),";void ((",`) satisfies __StxProp<${G.props}, ${JSON.stringify(me)}>);`)}if(G.props){let B=[...new Set(K)].map((te)=>`${JSON.stringify(te)}: undefined as any`).join(", "),Q=N(P.offset,`<${P.name}>`);i.push({expression:Q,statement:{text:`;void ({ ${B} } satisfies ${G.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:M.size?a.join(`
252
- `):"",checks:i,events:l,dependencies:c}}var Mi=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function lc(e){let n=(t)=>t.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,n).replace(/\{\{--[\s\S]*?--\}\}/g,n)}function At(e){let n=[],t=lc(e);Mi.lastIndex=0;let i;while((i=Mi.exec(t))!==null){let a=(i[1]||"").trim(),l=(i[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(i[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,y=i.index+l,v=i.index+i[0].length-c,R=e.slice(y,v);if(/\bsrc\s*=/.test(a))continue;let T=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(T&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(T[1]))continue;let M=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",N=Gt(e,y);n.push({kind:M,code:R,startLine:N,startColumn:Yt(e,y),offset:y,attrs:a})}return n}function Gt(e,n){let t=1;for(let i=0;i<n&&i<e.length;i++)if(e.charCodeAt(i)===10)t++;return t}function Yt(e,n){let t=e.lastIndexOf(`
251
+ `)}},D=(P,N,G)=>i.push({expression:P,statement:{text:N+P.code+G,prefixLength:N.length}});for(let P of cc(n)){if(br(P.name)||P.name==="component")continue;let N=pr(P.name,t.filePath,t,T);if(!N)continue;let G=M.get(N);if(!G){let B;try{B=t.readComponent?t.readComponent(N):zs.readFileSync(N,"utf8")}catch{continue}if(B===void 0)continue;c.set(N,B),G=Oi(t.scriptCode(B,N),`__StxComponent${M.size}`),M.set(N,G),a.push(G.declarations)}let K=[];for(let B of P.attributes){let{name:Q,offset:te}=B,ne=B.value===!0?"true":B.value;if(Q.startsWith("@")||Q.startsWith("v-on:")){if(G.events&&B.value!==!0)l.set(te,`__StxEvent<${G.events}, ${JSON.stringify(Q.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let ae=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(Q);if(Q.startsWith("v-")&&!Q.startsWith("v-bind:")&&!ae)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(Q))continue;let me=(ae?ae[1]||"modelValue":Q.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(ze,$e)=>$e.toUpperCase());if(K.push(me),!G.props)continue;let Ce=Q.startsWith(":")||Q.startsWith("v-bind:")||!!ae||B.braced?ne:B.value!==!0?JSON.stringify(ne):"true";D(L(te,Ce,Q),";void ((",`) satisfies __StxProp<${G.props}, ${JSON.stringify(me)}>);`)}if(G.props){let B=[...new Set(K)].map((te)=>`${JSON.stringify(te)}: undefined as any`).join(", "),Q=L(P.offset,`<${P.name}>`);i.push({expression:Q,statement:{text:`;void ({ ${B} } satisfies ${G.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:M.size?a.join(`
252
+ `):"",checks:i,events:l,dependencies:c}}var Mi=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function lc(e){let n=(t)=>t.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,n).replace(/\{\{--[\s\S]*?--\}\}/g,n)}function At(e){let n=[],t=lc(e);Mi.lastIndex=0;let i;while((i=Mi.exec(t))!==null){let a=(i[1]||"").trim(),l=(i[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(i[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,y=i.index+l,v=i.index+i[0].length-c,R=e.slice(y,v);if(/\bsrc\s*=/.test(a))continue;let T=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(T&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(T[1]))continue;let M=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",L=Gt(e,y);n.push({kind:M,code:R,startLine:L,startColumn:Yt(e,y),offset:y,attrs:a})}return n}function Gt(e,n){let t=1;for(let i=0;i<n&&i<e.length;i++)if(e.charCodeAt(i)===10)t++;return t}function Yt(e,n){let t=e.lastIndexOf(`
253
253
  `,n-1)+1;return n-t+1}function Vn(e){let n=e.split(""),t=(a,l)=>{for(let c=a;c<l&&c<n.length;c++)if(n[c]!==`
254
- `)n[c]=" "},i=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let a of i){a.lastIndex=0;let l;while((l=a.exec(e))!==null)t(l.index,l.index+l[0].length)}return n.join("")}function uc(e){let n=0,t="";for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t="";continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{"){n++;continue}if(a===")"||a==="]"||a==="}"){n--;continue}if(a==="|"&&n===0){if(e[i+1]==="|"){i++;continue}if(e[i-1]==="|")continue;return e.slice(0,i)}}return e}var Vi=new Set([":for","x-for","v-for"]),Un=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Ws="__stx_interpolated",Di="__StxElement",Ui="__StxTemplateValue",jc=`type ${Ui}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function ji(e){return e.replace(/\{\{[\s\S]*?\}\}/g,Ws).replace(/\{!![\s\S]*?!!\}/g,Ws)}function Go(e){return e.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(n)=>{let t=n.split(`
254
+ `)n[c]=" "},i=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let a of i){a.lastIndex=0;let l;while((l=a.exec(e))!==null)t(l.index,l.index+l[0].length)}return n.join("")}function uc(e){let n=0,t="";for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t="";continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{"){n++;continue}if(a===")"||a==="]"||a==="}"){n--;continue}if(a==="|"&&n===0){if(e[i+1]==="|"){i++;continue}if(e[i-1]==="|")continue;return e.slice(0,i)}}return e}var Vi=new Set([":for","x-for","v-for"]),Un=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Ws="__stx_interpolated",Di="__StxElement",Ui="__StxTemplateValue",jc=`type ${Ui}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function ji(e){return e.replace(/\{\{[\s\S]*?\}\}/g,Ws).replace(/\{!![\s\S]*?!!\}/g,Ws)}function Ko(e){return e.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(n)=>{let t=n.split(`
255
255
  `).length-1,i=n.length-t;return`0${" ".repeat(Math.max(0,i-1))}${`
256
- `.repeat(t)}`})}var Lc=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],Bc=new RegExp(String.raw`^[ \t]*@(?:${Lc.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Ko(e){return e.replace(Bc,(n)=>n.replace(/[^\n]/g," "))}var Ni=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Pf(e){let n=Vn(e),t=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(n))!==null){if(a[1]||a[3])continue;let y=a[2]??a[4]??"",v=a[2]!==void 0?2:3,R=uc(y);if(!R.trim())continue;let T=a.index+v+(R.length-R.trimStart().length);t.push({code:R.trim(),line:Gt(n,T),column:Yt(n,T),offset:T,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(n))!==null){let c=a.index+a[0].length-1,y=0,v=c;for(;v<n.length;v++){let N=n[v];if(N==="(")y++;else if(N===")"){if(y--,y===0)break}}if(y!==0)continue;let R=n.slice(c+1,v),T=R.trim();if(l.lastIndex=v+1,!T)continue;let M=c+1+(R.length-R.trimStart().length);t.push({code:T,line:Gt(n,M),column:Yt(n,M),offset:a.index,kind:"condition"})}Un.lastIndex=0;while((a=Un.exec(n))!==null){let c=a[1],y=a[3]??"",v=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Ni.has(v)||Ni.has(c))continue;if(!y.trim())continue;let R=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(Vi.has(v)){let M=y.match(/\s+(?:in|of)\s+/);if(!M||M.index===void 0)continue;let N=y.slice(M.index+M[0].length),L=M.index+M[0].length+(N.length-N.trimStart().length);t.push({code:ji(N.trim()),line:Gt(n,R+L),column:Yt(n,R+L),offset:R+L,kind:"directive",attribute:v});continue}let T=y.length-y.trimStart().length;t.push({code:ji(y.trim()),line:Gt(n,R+T),column:Yt(n,R+T),offset:R+T,kind:"directive",attribute:v})}return t.sort((c,y)=>c.line-y.line||c.column-y.column),t}var zc=2000;function Wc(e,n){let t=0,i=Math.min(e.length,n+zc);for(let a=n;a<i;a++){let l=e[a];if(l==="(")t++;else if(l===")"){if(t--,t===0)return e.slice(n+1,a)}}return null}function Fc(e){let n=new Map,t=(y,v)=>{let R=y.split(/[,[\]{}()\s]+/).filter(Boolean);for(let T of R){let M=T.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(M))continue;let N=R.length===1?v:void 0,L=n.get(M);if(!L)n.set(M,{name:M,iterable:N});else if(L.iterable!==N)L.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(y)=>{let v=y.trim();return i.test(v)?v:void 0};for(let y of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=Wc(e,y.index+y[0].length-1);if(v===null)continue;let R=Rt(v);if(!R)continue;t(R.itemVar.replace(/=>/g," "),a(R.arrayExpr))}for(let y of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))t(y[1],y[2]==="of"?a(y[3]):void 0);for(let y of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))t(y[1]);let l=Vn(e);Un.lastIndex=0;let c;while((c=Un.exec(l))!==null){let y=c[1].replace(/\..*$/,"");if(!Vi.has(y))continue;let v=c[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;t(c[3].slice(0,v.index),a(c[3].slice(v.index+v[0].length)))}for(let y of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let v of y[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))t(v[1]);return[...n.values()].sort((y,v)=>y.name.localeCompare(v.name))}function Ne(e){let n=new Set;for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let i of t[1].split(",")){let a=i.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))n.add(a)}return[...n].sort()}var Fs=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Vc={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string",$native:"declare var $native: boolean"};function gc(e=new Set){return[...Fs.filter((n)=>!e.has(n)).map((n)=>`declare var ${n}: any`),...Object.entries(Vc).filter(([n])=>!e.has(n)).map(([,n])=>n)].join(`
256
+ `.repeat(t)}`})}var Lc=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],Bc=new RegExp(String.raw`^[ \t]*@(?:${Lc.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Go(e){return e.replace(Bc,(n)=>n.replace(/[^\n]/g," "))}var Ni=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Pf(e){let n=Vn(e),t=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(n))!==null){if(a[1]||a[3])continue;let y=a[2]??a[4]??"",v=a[2]!==void 0?2:3,R=uc(y);if(!R.trim())continue;let T=a.index+v+(R.length-R.trimStart().length);t.push({code:R.trim(),line:Gt(n,T),column:Yt(n,T),offset:T,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(n))!==null){let c=a.index+a[0].length-1,y=0,v=c;for(;v<n.length;v++){let L=n[v];if(L==="(")y++;else if(L===")"){if(y--,y===0)break}}if(y!==0)continue;let R=n.slice(c+1,v),T=R.trim();if(l.lastIndex=v+1,!T)continue;let M=c+1+(R.length-R.trimStart().length);t.push({code:T,line:Gt(n,M),column:Yt(n,M),offset:a.index,kind:"condition"})}Un.lastIndex=0;while((a=Un.exec(n))!==null){let c=a[1],y=a[3]??"",v=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Ni.has(v)||Ni.has(c))continue;if(!y.trim())continue;let R=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(Vi.has(v)){let M=y.match(/\s+(?:in|of)\s+/);if(!M||M.index===void 0)continue;let L=y.slice(M.index+M[0].length),D=M.index+M[0].length+(L.length-L.trimStart().length);t.push({code:ji(L.trim()),line:Gt(n,R+D),column:Yt(n,R+D),offset:R+D,kind:"directive",attribute:v});continue}let T=y.length-y.trimStart().length;t.push({code:ji(y.trim()),line:Gt(n,R+T),column:Yt(n,R+T),offset:R+T,kind:"directive",attribute:v})}return t.sort((c,y)=>c.line-y.line||c.column-y.column),t}var zc=2000;function Wc(e,n){let t=0,i=Math.min(e.length,n+zc);for(let a=n;a<i;a++){let l=e[a];if(l==="(")t++;else if(l===")"){if(t--,t===0)return e.slice(n+1,a)}}return null}function Fc(e){let n=new Map,t=(y,v)=>{let R=y.split(/[,[\]{}()\s]+/).filter(Boolean);for(let T of R){let M=T.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(M))continue;let L=R.length===1?v:void 0,D=n.get(M);if(!D)n.set(M,{name:M,iterable:L});else if(D.iterable!==L)D.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(y)=>{let v=y.trim();return i.test(v)?v:void 0};for(let y of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=Wc(e,y.index+y[0].length-1);if(v===null)continue;let R=Rt(v);if(!R)continue;t(R.itemVar.replace(/=>/g," "),a(R.arrayExpr))}for(let y of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))t(y[1],y[2]==="of"?a(y[3]):void 0);for(let y of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))t(y[1]);let l=Vn(e);Un.lastIndex=0;let c;while((c=Un.exec(l))!==null){let y=c[1].replace(/\..*$/,"");if(!Vi.has(y))continue;let v=c[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;t(c[3].slice(0,v.index),a(c[3].slice(v.index+v[0].length)))}for(let y of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let v of y[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))t(v[1]);return[...n.values()].sort((y,v)=>y.name.localeCompare(v.name))}function Ne(e){let n=new Set;for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))n.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let i of t[1].split(",")){let a=i.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))n.add(a)}return[...n].sort()}var Fs=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Vc={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string",$native:"declare var $native: boolean"};function gc(e=new Set){return[...Fs.filter((n)=>!e.has(n)).map((n)=>`declare var ${n}: any`),...Object.entries(Vc).filter(([n])=>!e.has(n)).map(([,n])=>n)].join(`
257
257
  `)}function mc(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((n)=>n[1]))}function Hi(e){let n=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,t,i=!1,a=new Set,l=s(e);while((t=n.exec(l))!==null){i=!0;for(let c of Uc(t[1])){let y=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(y))a.add(y)}}return i?[...a]:null}function Uc(e){let n=[],t=0,i="";for(let a of e){if(a===","&&t===0){n.push(i),i="";continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;i+=a}return n.push(i),n.filter((a)=>a.trim().length>0)}function Hc(e){let n=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,t=[],i=e.replace(n,(a)=>(t.push(a.trim()),a.split(`
258
258
  `).map(()=>"").join(`
259
259
  `)));return{imports:t.join(`
260
- `),body:i}}function Ki(e){let n=s(e),t=Array(n.length),i=0;for(let y=0;y<n.length;y++){let v=n[y];if(v==="}"||v===")"||v==="]")i=Math.max(0,i-1);if(t[y]=i,v==="{"||v==="("||v==="[")i++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=l.exec(n))!==null){if(t[c.index]!==0)continue;let y=c[1],v=c[2],R;if(y==="interface"){let T=n.indexOf("{",c.index);if(T===-1)continue;let M=0;R=-1;for(let N=T;N<n.length;N++)if(n[N]==="{")M++;else if(n[N]==="}"&&--M===0){R=N+1;break}if(R===-1)continue}else{let T=0;R=n.length;for(let M=n.indexOf("=",c.index)+1;M<n.length;M++){let N=n[M];if(N==="{"||N==="["||N==="("||N==="<")T++;else if(N==="}"||N==="]"||N===")"||N===">")T--;else if(T<=0&&(N===";"||N===`
261
- `&&!/[=|&,<([{]\s*$/.test(n.slice(Math.max(0,M-40),M)))){R=N===";"?M+1:M;break}}}a.push({name:v,text:e.slice(c.index,R).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=R}return a}function Kc(e){return new Set(Ki(e).map((n)=>n.name))}function hc(e,n=""){let t=Hi(e),i=Kc(n),a=Ki(e).filter((R)=>!i.has(R.name)).map((R)=>R.text);if(!t){let R=Ne(e).filter((T)=>!Tt(n,T));if(R.length===0&&a.length===0)return"";return["",`// ${Zc}`,...a,...R.map((T)=>`declare var ${T}: any`)].join(`
260
+ `),body:i}}function Ki(e){let n=s(e),t=Array(n.length),i=0;for(let y=0;y<n.length;y++){let v=n[y];if(v==="}"||v===")"||v==="]")i=Math.max(0,i-1);if(t[y]=i,v==="{"||v==="("||v==="[")i++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=l.exec(n))!==null){if(t[c.index]!==0)continue;let y=c[1],v=c[2],R;if(y==="interface"){let T=n.indexOf("{",c.index);if(T===-1)continue;let M=0;R=-1;for(let L=T;L<n.length;L++)if(n[L]==="{")M++;else if(n[L]==="}"&&--M===0){R=L+1;break}if(R===-1)continue}else{let T=0;R=n.length;for(let M=n.indexOf("=",c.index)+1;M<n.length;M++){let L=n[M];if(L==="{"||L==="["||L==="("||L==="<")T++;else if(L==="}"||L==="]"||L===")"||L===">")T--;else if(T<=0&&(L===";"||L===`
261
+ `&&!/[=|&,<([{]\s*$/.test(n.slice(Math.max(0,M-40),M)))){R=L===";"?M+1:M;break}}}a.push({name:v,text:e.slice(c.index,R).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=R}return a}function Zc(e){return new Set(Ki(e).map((n)=>n.name))}function hc(e,n=""){let t=Hi(e),i=Zc(n),a=Ki(e).filter((R)=>!i.has(R.name)).map((R)=>R.text);if(!t){let R=Ne(e).filter((T)=>!Tt(n,T));if(R.length===0&&a.length===0)return"";return["",`// ${Xc}`,...a,...R.map((T)=>`declare var ${T}: any`)].join(`
262
262
  `)}if(t.length===0)return a.length>0?["",`// ${Li}`,...a].join(`
263
263
  `):"";let{imports:l,body:c}=Hc(e),y=c.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${Li}`];if(l)v.push(l);return v.push(...a),v.push(`async function ${Bi}() {`,y,` return { ${t.join(", ")} }`,"}",`type ${zi} = Awaited<ReturnType<typeof ${Bi}>>`,...t.map((R)=>`declare var ${R}: ${zi}[${JSON.stringify(R)}]`)),v.join(`
264
264
  `)}function Xo(e){let t=s(e).split(""),i=0;for(let a=0;a<t.length;a++){let l=t[a];if(l==="{"||l==="("||l==="["){i++;continue}if(l==="}"||l===")"||l==="]"){i=Math.max(0,i-1);continue}if(i>0&&l!==`
265
- `)t[a]=" "}return Ne(t.join(""))}function yc(e,n){if(Hi(e)!==null)return[];let t=Xo(e),i=cn(n,new Set(t)),a=new Set(k);return t.filter((l)=>{if(a.has(l))return!1;if(Tt(n,l))return!1;return i.has(l)})}var Li="stx: types for the declared client payload (#1868)",Zc="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Bi="__stxServerScope",zi="__StxClientPayload";var Wi=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Xc=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Jc(e){let n=new Map,t=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=s(i),{depths:l,balanced:c}=ge(a);if(!c)continue;let y=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of a.matchAll(y)){let R=v.index??0;if(l[R+v[1].length]!==0)continue;let T=v[2],M=R+v[0].length-v[3].length,N=i.slice(M,R+v[0].length).trim().replace(/;$/,"").trim(),L=v[3],P=t.test(L)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(L)&&!/[,+\-*/%&|?:=]$/.test(N)&&ge(L).balanced;n.set(T,n.has(T)||!P?null:N)}}return new Map([...n].filter((i)=>i[1]!==null))}function Zi(e,n,t=0,i=new Set){if(n.size===0||t>=5)return e;let a=s(e),l="",c=0;for(let y of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=y.index??0,R=y[0],T=n.get(R);if(!T||i.has(R))continue;let M=a.slice(0,v).trimEnd(),N=a.slice(v+R.length).trimStart();if(M.endsWith(".")||/^:(?!:)/.test(N)&&/[{,]$/.test(M))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(c,v)}(${Zi(T,n,t+1,new Set([...i,R]))})`,c=v+R.length}return l+e.slice(c)}function Yc(e,n){let t=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=t.exec(e))!==null){if(a.index>n)break;let l=a[1];if(a.index===n){if(l==="elseif"){let y=i[i.length-1];if(y?.current)y.seen.push(y.current);if(y)y.current=null}break}if(l==="endif"||l==="endunless"){i.pop();continue}let c="";if(a[2]==="("){let y=0,v=a.index+a[0].length-1,R=v+1;for(;v<e.length;v++){let T=e[v];if(T==="(")y++;else if(T===")"){if(y--,y===0)break}}c=e.slice(R,v).trim(),t.lastIndex=v+1}if(l==="if")i.push({seen:[],current:c});else if(l==="unless")i.push({seen:[],current:`!(${c})`});else if(l==="elseif"||l==="else"){let y=i[i.length-1];if(!y)continue;if(y.current)y.seen.push(y.current);y.current=l==="elseif"?c:null}}return i.flatMap((l)=>[...l.seen.map((c)=>`!(${c})`),...l.current?[l.current]:[]]).filter(Boolean)}function Qc(e){let n=e.code.trim();if(!n)return null;if(e.attribute?.startsWith("@")){if(Xc.test(n))return null;let i=";(($event: any): void => { ";return{text:`${i}${n} });`,prefixLength:i.length}}let t=";void ((";return{text:`${t}${n}));`,prefixLength:t.length}}var el=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Es(e,n){if(!n)return e;return e.replace(el,(t,i,a,l)=>{let c=Fi.resolve(n,l).replace(/\\/g,"/");return`${i}${a}${c}${a}`})}function Jo(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function tl(e){let n=new Set,t=s(e);for(let i of t.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],l=/\{([^}]*)\}/.exec(a);for(let R of l?.[1].split(",")??[]){let T=R.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(T&&/^[A-Z_$][\w$]*$/i.test(T))n.add(T)}let c=a.replace(/\{[^}]*\}/,""),y=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(y)n.add(y[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(v&&v[1]!=="type")n.add(v[1])}return[...n].sort()}function bc(e,n={}){let t=At(e),i=e.split(`
266
- `),a=Array.from({length:i.length},()=>""),l=new Map,c=n.filePath&&n.templateExpressions!==!1?Pi(e,Vn(e),{filePath:n.filePath,componentsDir:n.componentsDir,projectRoot:n.projectRoot,readComponent:n.readComponent,scriptCode:(M,N)=>At(M).map((L)=>Es(L.code,Fi.dirname(N))).join(`
267
- `)}):void 0,y=new Set,v=[];for(let M of t){let N=Ko(Go(M.code)),L=Es(N,n.originDir??"").split(`
268
- `);L.forEach((P,D)=>{let G=M.startLine-1+D;if(G<a.length)a[G]=D===0?Jo(M)+P:P,y.add(G)}),v.push(M.startLine-1+L.length-1)}for(let M of v){let N=a[M]?.trim()===""?M:M+1;if(N<a.length&&a[N].trim()===""&&(N===M||!y.has(N)))a[N]=";"}let R=(M,N)=>{for(let[L,P]of M.split(`
269
- `).entries())if(a.push(P),N)l.set(a.length,L===0?N:{...N,line:N.line+L,column:1,prefixLength:0})};if(n.globals!==!1){R("");let M=new Set([...t.flatMap((D)=>Ne(D.code)),...t.flatMap((D)=>tl(D.code))]),N=(D)=>{if(!M.has(D))R(`declare var ${D}: any`)};if(n.runtimeGlobals!==!1){if(!M.has("window"))R("declare var window: any");for(let D of k)N(D)}let L=[...new Set([...Fs,...we,...Wi])].filter((D)=>n.runtimeGlobals!==!1||!k.includes(D));if(n.contextScope==="global"){R("declare global {");for(let D of L)R(` var ${D}: any`);R("}")}else{for(let D of Fs)N(D);for(let D of we)N(D);for(let D of Wi)N(D)}R(`declare var ${Ws}: any`);let P=new Set(t.flatMap((D)=>Ne(D.code)));R(`type ${Di}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let D of Fc(e)){if(P.has(D.name))continue;let G=D.iterable&&P.has(D.iterable)?`${Di}<typeof ${D.iterable}>`:"any";R(`declare var ${D.name}: ${G}`)}}if(n.templateExpressions!==!1){if(c?.declarations)for(let N of c.declarations.split(`
270
- `))R(N);let M=Pf(e).map((N)=>{let L=c?.events.get(N.offset??-1);if(L){N.anchor=!0;let P=N.code.trim(),D=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(P),G=D?`void ((${D[2]}) satisfies __StxAssignedValue<typeof ${D[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(P)?`${P} satisfies (($event: ${L}) => unknown)`:P,K=`;(($event: ${L}): void => { `;return{expression:N,statement:{text:`${K}${G} });`,prefixLength:K.length}}}return{expression:N,statement:Qc(N)}}).filter((N)=>N.statement!==null);if(M.push(...c?.checks||[]),M.length>0){let N=Vn(e),L=Fn(N),P=Jc(t.map((B)=>B.code)),G=[...new Set(t.flatMap((B)=>Ne(B.code)))].filter((B)=>/^[A-Z_$][\w$]*$/i.test(B)),K=0;if(G.length>0){R(jc);for(let B of G)R(`function __StxRead_${B}() { return ${B} }`),R(`type __StxT_${B} = ${Ui}<ReturnType<typeof __StxRead_${B}>>`);R(`;((${G.map((B)=>`${B}: __StxT_${B}`).join(", ")}) => {`),K=1}for(let{expression:B,statement:Q}of M){let te=" ".repeat(K),ne=B.offset===void 0?[]:L.filter(($e)=>B.offset>=$e.start&&B.offset<$e.end),ae=ne.map(($e)=>`;((${$e.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),me=" });".repeat(ne.length),Ee=B.offset===void 0?[]:Yc(N,B.offset),Ce=Ee.length>0?`${Ee.map(($e)=>`if (${Zi($e,P)}) `).join("")}{ `:"",ze=Ee.length>0?" }":"";R(te+ae+Ce+Q.text+ze+me,{line:B.line,column:B.column,expression:B,prefixLength:Q.prefixLength+te.length+ae.length+Ce.length,guardPrefixLength:te.length+ae.length+Ce.length})}if(K>0)R("});")}}let T=!1;if(n.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(n.reference.replace(/\\/g,"/"))} />`,T=!0;return R("export {}"),{text:a.join(`
265
+ `)t[a]=" "}return Ne(t.join(""))}function yc(e,n){if(Hi(e)!==null)return[];let t=Xo(e),i=cn(n,new Set(t)),a=new Set(k);return t.filter((l)=>{if(a.has(l))return!1;if(Tt(n,l))return!1;return i.has(l)})}var Li="stx: types for the declared client payload (#1868)",Xc="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Bi="__stxServerScope",zi="__StxClientPayload";var Wi=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Jc=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Gc(e){let n=new Map,t=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=s(i),{depths:l,balanced:c}=ge(a);if(!c)continue;let y=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of a.matchAll(y)){let R=v.index??0;if(l[R+v[1].length]!==0)continue;let T=v[2],M=R+v[0].length-v[3].length,L=i.slice(M,R+v[0].length).trim().replace(/;$/,"").trim(),D=v[3],P=t.test(D)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(D)&&!/[,+\-*/%&|?:=]$/.test(L)&&ge(D).balanced;n.set(T,n.has(T)||!P?null:L)}}return new Map([...n].filter((i)=>i[1]!==null))}function Zi(e,n,t=0,i=new Set){if(n.size===0||t>=5)return e;let a=s(e),l="",c=0;for(let y of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=y.index??0,R=y[0],T=n.get(R);if(!T||i.has(R))continue;let M=a.slice(0,v).trimEnd(),L=a.slice(v+R.length).trimStart();if(M.endsWith(".")||/^:(?!:)/.test(L)&&/[{,]$/.test(M))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(c,v)}(${Zi(T,n,t+1,new Set([...i,R]))})`,c=v+R.length}return l+e.slice(c)}function Yc(e,n){let t=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=t.exec(e))!==null){if(a.index>n)break;let l=a[1];if(a.index===n){if(l==="elseif"){let y=i[i.length-1];if(y?.current)y.seen.push(y.current);if(y)y.current=null}break}if(l==="endif"||l==="endunless"){i.pop();continue}let c="";if(a[2]==="("){let y=0,v=a.index+a[0].length-1,R=v+1;for(;v<e.length;v++){let T=e[v];if(T==="(")y++;else if(T===")"){if(y--,y===0)break}}c=e.slice(R,v).trim(),t.lastIndex=v+1}if(l==="if")i.push({seen:[],current:c});else if(l==="unless")i.push({seen:[],current:`!(${c})`});else if(l==="elseif"||l==="else"){let y=i[i.length-1];if(!y)continue;if(y.current)y.seen.push(y.current);y.current=l==="elseif"?c:null}}return i.flatMap((l)=>[...l.seen.map((c)=>`!(${c})`),...l.current?[l.current]:[]]).filter(Boolean)}function Qc(e){let n=e.code.trim();if(!n)return null;if(e.attribute?.startsWith("@")){if(Jc.test(n))return null;let i=";(($event: any): void => { ";return{text:`${i}${n} });`,prefixLength:i.length}}let t=";void ((";return{text:`${t}${n}));`,prefixLength:t.length}}var el=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Es(e,n){if(!n)return e;return e.replace(el,(t,i,a,l)=>{let c=Fi.resolve(n,l).replace(/\\/g,"/");return`${i}${a}${c}${a}`})}function Jo(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function tl(e){let n=new Set,t=s(e);for(let i of t.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],l=/\{([^}]*)\}/.exec(a);for(let R of l?.[1].split(",")??[]){let T=R.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(T&&/^[A-Z_$][\w$]*$/i.test(T))n.add(T)}let c=a.replace(/\{[^}]*\}/,""),y=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(y)n.add(y[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(v&&v[1]!=="type")n.add(v[1])}return[...n].sort()}function bc(e,n={}){let t=At(e),i=e.split(`
266
+ `),a=Array.from({length:i.length},()=>""),l=new Map,c=n.filePath&&n.templateExpressions!==!1?Pi(e,Vn(e),{filePath:n.filePath,componentsDir:n.componentsDir,projectRoot:n.projectRoot,readComponent:n.readComponent,scriptCode:(M,L)=>At(M).map((D)=>Es(D.code,Fi.dirname(L))).join(`
267
+ `)}):void 0,y=new Set,v=[];for(let M of t){let L=Go(Ko(M.code)),D=Es(L,n.originDir??"").split(`
268
+ `);D.forEach((P,N)=>{let G=M.startLine-1+N;if(G<a.length)a[G]=N===0?Jo(M)+P:P,y.add(G)}),v.push(M.startLine-1+D.length-1)}for(let M of v){let L=a[M]?.trim()===""?M:M+1;if(L<a.length&&a[L].trim()===""&&(L===M||!y.has(L)))a[L]=";"}let R=(M,L)=>{for(let[D,P]of M.split(`
269
+ `).entries())if(a.push(P),L)l.set(a.length,D===0?L:{...L,line:L.line+D,column:1,prefixLength:0})};if(n.globals!==!1){R("");let M=new Set([...t.flatMap((N)=>Ne(N.code)),...t.flatMap((N)=>tl(N.code))]),L=(N)=>{if(!M.has(N))R(`declare var ${N}: any`)};if(n.runtimeGlobals!==!1){if(!M.has("window"))R("declare var window: any");for(let N of k)L(N)}let D=[...new Set([...Fs,...we,...Wi])].filter((N)=>n.runtimeGlobals!==!1||!k.includes(N));if(n.contextScope==="global"){R("declare global {");for(let N of D)R(` var ${N}: any`);R("}")}else{for(let N of Fs)L(N);for(let N of we)L(N);for(let N of Wi)L(N)}R(`declare var ${Ws}: any`);let P=new Set(t.flatMap((N)=>Ne(N.code)));R(`type ${Di}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let N of Fc(e)){if(P.has(N.name))continue;let G=N.iterable&&P.has(N.iterable)?`${Di}<typeof ${N.iterable}>`:"any";R(`declare var ${N.name}: ${G}`)}}if(n.templateExpressions!==!1){if(c?.declarations)for(let L of c.declarations.split(`
270
+ `))R(L);let M=Pf(e).map((L)=>{let D=c?.events.get(L.offset??-1);if(D){L.anchor=!0;let P=L.code.trim(),N=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(P),G=N?`void ((${N[2]}) satisfies __StxAssignedValue<typeof ${N[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(P)?`${P} satisfies (($event: ${D}) => unknown)`:P,K=`;(($event: ${D}): void => { `;return{expression:L,statement:{text:`${K}${G} });`,prefixLength:K.length}}}return{expression:L,statement:Qc(L)}}).filter((L)=>L.statement!==null);if(M.push(...c?.checks||[]),M.length>0){let L=Vn(e),D=Fn(L),P=Gc(t.map((B)=>B.code)),G=[...new Set(t.flatMap((B)=>Ne(B.code)))].filter((B)=>/^[A-Z_$][\w$]*$/i.test(B)),K=0;if(G.length>0){R(jc);for(let B of G)R(`function __StxRead_${B}() { return ${B} }`),R(`type __StxT_${B} = ${Ui}<ReturnType<typeof __StxRead_${B}>>`);R(`;((${G.map((B)=>`${B}: __StxT_${B}`).join(", ")}) => {`),K=1}for(let{expression:B,statement:Q}of M){let te=" ".repeat(K),ne=B.offset===void 0?[]:D.filter(($e)=>B.offset>=$e.start&&B.offset<$e.end),ae=ne.map(($e)=>`;((${$e.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),me=" });".repeat(ne.length),Ee=B.offset===void 0?[]:Yc(L,B.offset),Ce=Ee.length>0?`${Ee.map(($e)=>`if (${Zi($e,P)}) `).join("")}{ `:"",ze=Ee.length>0?" }":"";R(te+ae+Ce+Q.text+ze+me,{line:B.line,column:B.column,expression:B,prefixLength:Q.prefixLength+te.length+ae.length+Ce.length,guardPrefixLength:te.length+ae.length+Ce.length})}if(K>0)R("});")}}let T=!1;if(n.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(n.reference.replace(/\\/g,"/"))} />`,T=!0;return R("export {}"),{text:a.join(`
271
271
  `),lineMap:l,sourceLineCount:i.length,componentDependencies:c?.dependencies,referenced:T}}function vc(e,n){if(!e.expression)return!1;return e.inGuard===!0||n===2774}function wc(e,n,t){let i=e.lineMap.get(n);if(!i)return n<=e.sourceLineCount?{line:n,column:t}:null;let a=i.expression?.anchor?0:Math.max(0,t-1-(i.prefixLength??0));return{line:i.line,column:i.column+a,expression:i.expression,inGuard:t<=(i.guardPrefixLength??0)}}var Vs=w(256),nl=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or, where this must run before first paint and the runtime does not exist yet, the colorMode config for a light/dark theme, or @appearanceBootstrap when there is a second appearance axis"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}],qi=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function sl(e){let n=Array.from(e,(a)=>a===`
272
272
  `?`
273
273
  `:" "),t=0,i="";while(t<e.length){let a=e[t],l=e[t+1];if(i){if(a==="\\"){t+=2;continue}if(a===i)i="";t++;continue}if(a==='"'||a==="'"||a==="`"){i=a,t++;continue}if(a==="/"&&l==="/"){while(t<e.length&&e[t]!==`
274
274
  `)n[t]=e[t],t++;continue}if(a==="/"&&l==="*"){let c=e.indexOf("*/",t+2),y=c===-1?e.length:c+2;for(;t<y;t++)n[t]=e[t];continue}if(a==="{"&&l==="{"&&e.slice(t,t+4)==="{{--"){let c=e.indexOf("--}}",t+4),y=c===-1?e.length:c+4;for(;t<y;t++)n[t]=e[t];continue}t++}return n.join("")}function rl(e){let n=new Map,t=sl(e).split(`
275
275
  `),i=e.split(`
276
- `);return t.forEach((a,l)=>{qi.lastIndex=0;for(let c of a.matchAll(qi)){let y=c[1]==="-next-line",v=(i[l]??"").slice(0,c.index).trim(),R=y||v===""?l+2:l+1,M=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),N=M.filter((P)=>/\w/.test(P));if(M.length>0&&N.length===0)continue;let L=n.get(R);if(L&&L.size===0)continue;if(N.length===0){n.set(R,new Set);continue}if(L)N.forEach((P)=>L.add(P));else n.set(R,new Set(N))}}),n}function il(e,n,t){let i=e.get(n);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>t.includes(a))}function Ie(e,n,t,i){let a=typeof t==="boolean"?{enabled:t,failOnViolation:t}:t??{enabled:!1};if(!a.enabled)return;let l=x(e,n,i,JSON.stringify(a)),c=Vs.get(l);if(c!==void 0){if(c&&a.failOnViolation)throw new W(c,i??n);return}let y=a.allowPatterns??[],v=rl(e),R=[],T=s(e.replace(/\{\{--[\s\S]*?--\}\}/g,(P)=>P.replace(/[^\n]/g," ")));for(let{pattern:P,message:D,suggestion:G}of nl){if(y.some((B)=>/\w/.test(B)&&D.includes(B)))continue;P.lastIndex=0;let K=T.match(P);if(K&&K.length>0){let B=T.split(`
276
+ `);return t.forEach((a,l)=>{qi.lastIndex=0;for(let c of a.matchAll(qi)){let y=c[1]==="-next-line",v=(i[l]??"").slice(0,c.index).trim(),R=y||v===""?l+2:l+1,M=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),L=M.filter((P)=>/\w/.test(P));if(M.length>0&&L.length===0)continue;let D=n.get(R);if(D&&D.size===0)continue;if(L.length===0){n.set(R,new Set);continue}if(D)L.forEach((P)=>D.add(P));else n.set(R,new Set(L))}}),n}function il(e,n,t){let i=e.get(n);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>t.includes(a))}function Ie(e,n,t,i){let a=typeof t==="boolean"?{enabled:t,failOnViolation:t}:t??{enabled:!1};if(!a.enabled)return;let l=x(e,n,i,JSON.stringify(a)),c=Vs.get(l);if(c!==void 0){if(c&&a.failOnViolation)throw new W(c,i??n);return}let y=a.allowPatterns??[],v=rl(e),R=[],T=s(e.replace(/\{\{--[\s\S]*?--\}\}/g,(P)=>P.replace(/[^\n]/g," ")));for(let{pattern:P,message:N,suggestion:G}of nl){if(y.some((B)=>/\w/.test(B)&&N.includes(B)))continue;P.lastIndex=0;let K=T.match(P);if(K&&K.length>0){let B=T.split(`
277
277
  `),Q=e.split(`
278
- `),te=[];if(B.forEach((Ee,Ce)=>{if(P.lastIndex=0,P.test(Ee)&&!il(v,Ce+1,D))te.push(Ce+1)}),te.length===0&&B.some((Ee)=>(P.lastIndex=0,P.test(Ee))))continue;let ne=te.length>0?` (script line${te.length>1?"s":""} ${te.join(", ")})`:"",ae=te.slice(0,3).map((Ee)=>` ${Ee} | ${(Q[Ee-1]??"").trim().slice(0,100)}`).join(`
278
+ `),te=[];if(B.forEach((Ee,Ce)=>{if(P.lastIndex=0,P.test(Ee)&&!il(v,Ce+1,N))te.push(Ce+1)}),te.length===0&&B.some((Ee)=>(P.lastIndex=0,P.test(Ee))))continue;let ne=te.length>0?` (script line${te.length>1?"s":""} ${te.join(", ")})`:"",ae=te.slice(0,3).map((Ee)=>` ${Ee} | ${(Q[Ee-1]??"").trim().slice(0,100)}`).join(`
279
279
  `),me=ae?`
280
- ${ae}`:"";R.push(` \u2717 ${D}${ne}
281
- \u2192 ${G}${me}`)}}if(R.length===0){Vs.set(l,"");return}let M=(P)=>{let D=`${process.cwd()}/`;return P.startsWith(D)?P.slice(D.length):P},L=`[STX] DOM API violation in ${i&&i!==n?`${M(i)} (composed into ${M(n)})`:M(n)}:
280
+ ${ae}`:"";R.push(` \u2717 ${N}${ne}
281
+ \u2192 ${G}${me}`)}}if(R.length===0){Vs.set(l,"");return}let M=(P)=>{let N=`${process.cwd()}/`;return P.startsWith(N)?P.slice(N.length):P},D=`[STX] DOM API violation in ${i&&i!==n?`${M(i)} (composed into ${M(n)})`:M(n)}:
282
282
  ${R.join(`
283
283
  `)}
284
- Tip: prefer useRef(), navigate(), and composables for component code`;if(Vs.set(l,L),console.warn(L),a.failOnViolation)throw new W(L,i??n)}var ol=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],al=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],cl=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function Ff(e){let n=[],t=[];return ll(e,n),ul(e,n,t),fl(e,t),pl(e,n),{valid:n.length===0,errors:n,warnings:t}}function ll(e,n){let t=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(t!==i)n.push({type:"expression",message:`Unclosed expression brackets: found ${t} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function ul(e,n,t){for(let i of ol){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),l=new RegExp(i.close,"g"),c=(e.match(a)||[]).length,y=(e.match(l)||[]).length;if(i.altClose){let v=new RegExp(i.altClose,"g");y+=(e.match(v)||[]).length}if(c>y)n.push({type:"directive",message:`Unclosed @${i.name} directive: found ${c} opening and ${y} closing`,suggestion:`Add ${c-y} missing ${i.close} tag(s)`});else if(y>c)t.push({type:"directive",message:`Extra ${i.close} found: ${y-c} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function fl(e,n){for(let t of al)if(t.pattern.test(e))n.push({type:"syntax",message:t.message,suggestion:t.suggestion})}function pl(e,n){for(let t of cl)if(t.pattern.test(e))n.push({type:"expression",message:`Security warning: ${t.message}`,suggestion:"Remove dangerous code from template expressions"})}function zf(e,n){let t=e.slice(0,n).split(`
285
- `);return{line:t.length,column:t[t.length-1].length+1}}function Hf(e,n,t){let i=[];switch(e){case"if":case"elseif":case"unless":if(t.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(t.length===0||!t[0].includes(" as "))i.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(t.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(t.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(t.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(t.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function Vf(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function Uf(e){let n=e.matchAll(/@([a-z]+)/gi),t=new Set;for(let i of n){let a=i[1].toLowerCase();if(!a.startsWith("end"))t.add(a)}return Array.from(t)}function Xi(e,n,t){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return S(i[0],n,t)+e.slice(i[0].length)}var Qt=new V(500),Kn=new V(1000),Ks=new V(2000),Zs=new V(500),no=33554432,qs=no;function dl(e){let n=e.componentRenderCacheBytes;if(typeof n!=="number"||n<0||n===qs)return;qs=n,Zn.setMaxBytes(n)}var Zn=new V(2000,{maxBytes:no,sizeOf:(e)=>e.output.length});function gl(e){let n=new WeakSet;try{let t=(i)=>{if(i===void 0)return{__stxType:"undefined"};if(typeof i==="bigint")return{__stxType:"bigint",value:i.toString()};if(typeof i==="function"||typeof i==="symbol")throw TypeError("Non-serializable component input");if(i===null||typeof i!=="object")return i;if(n.has(i))throw TypeError("Circular component input");n.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(t);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let c of Object.keys(i).sort())l[c]=t(i[c]);return l}finally{n.delete(i)}};return JSON.stringify(t(e))}catch{return null}}function ml(e){let n={};for(let[t,i]of Object.entries(e))if(!t.startsWith("__")||t==="__stxServeContext")n[t]=i;return n}function Us(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ps(e){let n=process.cwd(),t=`${n}\x00${e}`,i=Ji.get(t);if(i===void 0)i=Bun.hash(so(e,n).split(le.sep).join("/")).toString(36).slice(0,6),Ji.set(t,i);return i}var Ji=new Map;function so(e,n){if(!le.isAbsolute(e))return e;let t=(i)=>{try{return Js.realpathSync(i)}catch{return i}};return le.relative(t(n),t(e))}function Wf(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Le(e){return!Wf(e)}var Hn=new Map;function Y(e){let n;try{n=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let t=Hn.get(n);if(t)return t;if(Hn.size>=16)Hn.clear();let i=new Bun.Transpiler(e);return Hn.set(n,i),i}var Gi=new WeakMap,hl=256;function je(e){try{let n=Y({loader:"ts",target:"browser",define:_()}),t=Gi.get(n);if(!t)t=new Map,Gi.set(n,t);let i=t.get(e);if(i!==void 0)return i;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`});let c=n.transformSync(a);for(let y=0;y<l.length;y++)c=c.replace(`"__STX_EXPR_${y}__"`,l[y]),c=c.replace(`'__STX_EXPR_${y}__'`,l[y]);if(t.size>=hl){let y=t.keys().next();if(!y.done)t.delete(y.value)}return t.set(e,c),c}catch(n){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",n);return e}}function xl(e){let n=[],t=new Set,i=0,a=0,l=e.length,c=(T)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===T){a++;return}a++}},y=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let T=1;while(a<l&&T>0)if(e[a]==="{")T++,a++;else if(e[a]==="}")T--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")y();else a++;continue}a++}},v=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
286
- `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<l-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},R=()=>{if(i!==0)return;let T=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(T){let P=T[2].split(",").map((D)=>{let G=D.trim().split(":");return G[G.length-1].trim()});for(let D of P)if(D&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(D)&&!t.has(D))n.push(D),t.add(D);return}let M=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(M){let P=M[2];if(!t.has(P))n.push(P),t.add(P);return}let N=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let P=N[1];if(!t.has(P))n.push(P),t.add(P);return}let L=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let P=L[1];if(!t.has(P))n.push(P),t.add(P)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){y();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))R();a++}return n}function bl(e){let n=[],t=0,i=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)n.push(e.slice(i,l)),i=l+1}if(i<e.length)n.push(e.slice(i));return n}function yl(e){let n=0,t=null;for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a==="="&&n===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function _l(e,n){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let i=t.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=i;break}}}if(c===-1)return;let y=e.slice(c+1,a);for(let v of bl(y)){let R=v.trim();if(!R||R.startsWith("..."))continue;let T=yl(R);if(T===-1)continue;let M=R.slice(0,T).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(n[M]!==void 0)continue;let N=R.slice(T+1).trim();if(!N)continue;try{let L=Object.keys(n).filter(Mt),P=Function(...L,`"use strict"; return (${N});`);n[M]=P(...L.map((D)=>n[D]))}catch{}}}catch{}}var wl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function qf(e,n){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let i=t[2].toLowerCase();if(!wl.has(i))return null;let a=new RegExp(`<\\/?${i}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=C(e,(R,T)=>(a.lastIndex=T,a.exec(R)?.index===T?a.lastIndex:-1));if(i==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,y=!1;for(let R of l){if(c+=R.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(R.end).trim())return null;y=!0;break}}if(!y)return null;let v=t[0].length;return e.slice(0,v)+n+e.slice(v)}async function wr(e,n,t,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(ne)=>ne.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""),y=t.__importedComponents;if(y){for(let ne of[l,l.toLowerCase(),c(l),z(l)])if(y.has(ne))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${z(l)}.stx`])],R=typeof a.root==="string"?le.resolve(a.root):void 0,T=R??le.dirname(i),M=[],N=(ne)=>{if(ne&&!M.includes(ne))M.push(ne)},L=t.__originalFilePath;if(L)N(le.join(le.dirname(L),"components"));N(n),N(a._rootComponentsDir),N(le.join(le.dirname(i),"components")),N(a.componentsDir);let P=a._targetComponentFallbackNames?.some((ne)=>ne.toLowerCase()===l.toLowerCase());if(!P)for(let ne of a._targetComponentDirs??[])N(ne);if(R)N(le.resolve(R,"resources/views/components")),N(le.resolve(R,"resources/components")),N(le.resolve(R,"src/components")),N(le.resolve(R,"components"));for(let ne of a._layerComponentDirs??[])N(ne);let D=a._pluginComponentDirs;if(Array.isArray(D))for(let ne of D)N(typeof ne==="string"?ne:null);if(N(a.fallbackComponentsDir),P)for(let ne of a._targetComponentDirs??[])N(ne);if(l.startsWith("./")||l.startsWith("../"))return r(le.resolve(le.dirname(i),`${l}.stx`));let G=Yi(le.resolve(import.meta.dir,"components")),K=M.map((ne)=>le.isAbsolute(ne)?ne:le.resolve(T,ne)),B=`${v.join("\x00")}\x00\x00${K.join("\x00")}`,Q=Ks.get(B);if(Q!==void 0)return Q;let te=!1;e:for(let ne of K){if(Yi(ne)===G)continue;for(let ae of v)if(await r(le.join(ne,ae))){te=!0;break e}}return Ks.set(B,te),te}function Yi(e){let n=Zs.get(e);if(n!==void 0)return n;let t=e;try{t=Js.realpathSync(e)}catch{}return Zs.set(e,t),t}function Gf(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Ic(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function Sl(e,n,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=E(a,n)}catch{return l}if(c===void 0||c===null)return"";let y=String(c);if(/<\/style/i.test(y))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return y};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var Qi=new Set;function eo(e,n,t,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&Qi.has(a))return;Qi.add(a);let l=n?` used in ${n}`:"",c=i?` Cause: ${i}.`:"",y=t.length>0?`
284
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Vs.set(l,D),console.warn(D),a.failOnViolation)throw new W(D,i??n)}var ol=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],al=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],cl=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function Ff(e){let n=[],t=[];return ll(e,n),ul(e,n,t),fl(e,t),pl(e,n),{valid:n.length===0,errors:n,warnings:t}}function ll(e,n){let t=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(t!==i)n.push({type:"expression",message:`Unclosed expression brackets: found ${t} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function ul(e,n,t){for(let i of ol){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),l=new RegExp(i.close,"g"),c=(e.match(a)||[]).length,y=(e.match(l)||[]).length;if(i.altClose){let v=new RegExp(i.altClose,"g");y+=(e.match(v)||[]).length}if(c>y)n.push({type:"directive",message:`Unclosed @${i.name} directive: found ${c} opening and ${y} closing`,suggestion:`Add ${c-y} missing ${i.close} tag(s)`});else if(y>c)t.push({type:"directive",message:`Extra ${i.close} found: ${y-c} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function fl(e,n){for(let t of al)if(t.pattern.test(e))n.push({type:"syntax",message:t.message,suggestion:t.suggestion})}function pl(e,n){for(let t of cl)if(t.pattern.test(e))n.push({type:"expression",message:`Security warning: ${t.message}`,suggestion:"Remove dangerous code from template expressions"})}function zf(e,n){let t=e.slice(0,n).split(`
285
+ `);return{line:t.length,column:t[t.length-1].length+1}}function Hf(e,n,t){let i=[];switch(e){case"if":case"elseif":case"unless":if(t.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(t.length===0||!t[0].includes(" as "))i.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(t.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(t.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(t.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(t.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function Vf(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function Uf(e){let n=e.matchAll(/@([a-z]+)/gi),t=new Set;for(let i of n){let a=i[1].toLowerCase();if(!a.startsWith("end"))t.add(a)}return Array.from(t)}function Xi(e,n,t){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return S(i[0],n,t)+e.slice(i[0].length)}var Qt=new V(500),Kn=new V(1000),Ks=new V(2000),Zs=new V(500),no=33554432,qs=no;function dl(e){let n=e.componentRenderCacheBytes;if(typeof n!=="number"||n<0||n===qs)return;qs=n,Zn.setMaxBytes(n)}var Zn=new V(2000,{maxBytes:no,sizeOf:(e)=>e.output.length});function gl(e){let n=new WeakSet;try{let t=(i)=>{if(i===void 0)return{__stxType:"undefined"};if(typeof i==="bigint")return{__stxType:"bigint",value:i.toString()};if(typeof i==="function"||typeof i==="symbol")throw TypeError("Non-serializable component input");if(i===null||typeof i!=="object")return i;if(n.has(i))throw TypeError("Circular component input");n.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(t);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let c of Object.keys(i).sort())l[c]=t(i[c]);return l}finally{n.delete(i)}};return JSON.stringify(t(e))}catch{return null}}function ml(e){let n={};for(let[t,i]of Object.entries(e))if(!t.startsWith("__")||t==="__stxServeContext")n[t]=i;return n}function Us(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ps(e){let n=process.cwd(),t=`${n}\x00${e}`,i=Ji.get(t);if(i===void 0)i=Bun.hash(so(e,n).split(le.sep).join("/")).toString(36).slice(0,6),Ji.set(t,i);return i}var Ji=new Map;function so(e,n){if(!le.isAbsolute(e))return e;let t=(i)=>{try{return Js.realpathSync(i)}catch{return i}};return le.relative(t(n),t(e))}function Wf(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Le(e){return!Wf(e)}var Hn=new Map;function Y(e){let n;try{n=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let t=Hn.get(n);if(t)return t;if(Hn.size>=16)Hn.clear();let i=new Bun.Transpiler(e);return Hn.set(n,i),i}var Gi=new WeakMap,hl=256;function je(e){try{let n=Y({loader:"ts",target:"browser",define:_()}),t=Gi.get(n);if(!t)t=new Map,Gi.set(n,t);let i=t.get(e);if(i!==void 0)return i;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`});let c=n.transformSync(a);for(let y=0;y<l.length;y++)c=c.replace(`"__STX_EXPR_${y}__"`,l[y]),c=c.replace(`'__STX_EXPR_${y}__'`,l[y]);if(t.size>=hl){let y=t.keys().next();if(!y.done)t.delete(y.value)}return t.set(e,c),c}catch(n){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",n);return e}}function xl(e){let n=[],t=new Set,i=0,a=0,l=e.length,c=(D)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===D){a++;return}a++}},y=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let D=1;while(a<l&&D>0)if(e[a]==="{")D++,a++;else if(e[a]==="}")D--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")y();else a++;continue}a++}},v=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
286
+ `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<l-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},R=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),T=()=>{let D=a-1;while(D>=0&&/\s/.test(e[D]))D--;if(D<0)return!0;let P=e[D];if("(,=:[!&|?{};+-*%<>~^".includes(P))return!0;if(!/[\w$]/.test(P))return!1;let N=D;while(N>0&&/[\w$]/.test(e[N-1]))N--;return R.has(e.slice(N,D+1))},M=()=>{a++;let D=!1;while(a<l&&e[a]!==`
287
+ `){let P=e[a];if(P==="\\"){a+=2;continue}if(P==="[")D=!0;else if(P==="]")D=!1;else if(P==="/"&&!D){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},L=()=>{if(i!==0)return;let D=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(D){let K=D[2].split(",").map((B)=>{let Q=B.trim().split(":");return Q[Q.length-1].trim()});for(let B of K)if(B&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(B)&&!t.has(B))n.push(B),t.add(B);return}let P=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(P){let K=P[2];if(!t.has(K))n.push(K),t.add(K);return}let N=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let K=N[1];if(!t.has(K))n.push(K),t.add(K);return}let G=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(G){let K=G[1];if(!t.has(K))n.push(K),t.add(K)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){y();continue}if(e[a]==="/"&&T()){M();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))L();a++}return n}function bl(e){let n=[],t=0,i=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)n.push(e.slice(i,l)),i=l+1}if(i<e.length)n.push(e.slice(i));return n}function yl(e){let n=0,t=null;for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a==="="&&n===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function _l(e,n){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let i=t.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=i;break}}}if(c===-1)return;let y=e.slice(c+1,a);for(let v of bl(y)){let R=v.trim();if(!R||R.startsWith("..."))continue;let T=yl(R);if(T===-1)continue;let M=R.slice(0,T).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(n[M]!==void 0)continue;let L=R.slice(T+1).trim();if(!L)continue;try{let D=Object.keys(n).filter(Mt),P=Function(...D,`"use strict"; return (${L});`);n[M]=P(...D.map((N)=>n[N]))}catch{}}}catch{}}var wl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function qf(e,n){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let i=t[2].toLowerCase();if(!wl.has(i))return null;let a=new RegExp(`<\\/?${i}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=C(e,(R,T)=>(a.lastIndex=T,a.exec(R)?.index===T?a.lastIndex:-1));if(i==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,y=!1;for(let R of l){if(c+=R.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(R.end).trim())return null;y=!0;break}}if(!y)return null;let v=t[0].length;return e.slice(0,v)+n+e.slice(v)}async function wr(e,n,t,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(ne)=>ne.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""),y=t.__importedComponents;if(y){for(let ne of[l,l.toLowerCase(),c(l),z(l)])if(y.has(ne))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${z(l)}.stx`])],R=typeof a.root==="string"?le.resolve(a.root):void 0,T=R??le.dirname(i),M=[],L=(ne)=>{if(ne&&!M.includes(ne))M.push(ne)},D=t.__originalFilePath;if(D)L(le.join(le.dirname(D),"components"));L(n),L(a._rootComponentsDir),L(le.join(le.dirname(i),"components")),L(a.componentsDir);let P=a._targetComponentFallbackNames?.some((ne)=>ne.toLowerCase()===l.toLowerCase());if(!P)for(let ne of a._targetComponentDirs??[])L(ne);if(R)L(le.resolve(R,"resources/views/components")),L(le.resolve(R,"resources/components")),L(le.resolve(R,"src/components")),L(le.resolve(R,"components"));for(let ne of a._layerComponentDirs??[])L(ne);let N=a._pluginComponentDirs;if(Array.isArray(N))for(let ne of N)L(typeof ne==="string"?ne:null);if(L(a.fallbackComponentsDir),P)for(let ne of a._targetComponentDirs??[])L(ne);if(l.startsWith("./")||l.startsWith("../"))return r(le.resolve(le.dirname(i),`${l}.stx`));let G=Yi(le.resolve(import.meta.dir,"components")),K=M.map((ne)=>le.isAbsolute(ne)?ne:le.resolve(T,ne)),B=`${v.join("\x00")}\x00\x00${K.join("\x00")}`,Q=Ks.get(B);if(Q!==void 0)return Q;let te=!1;e:for(let ne of K){if(Yi(ne)===G)continue;for(let ae of v)if(await r(le.join(ne,ae))){te=!0;break e}}return Ks.set(B,te),te}function Yi(e){let n=Zs.get(e);if(n!==void 0)return n;let t=e;try{t=Js.realpathSync(e)}catch{}return Zs.set(e,t),t}function Kf(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Ic(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function Sl(e,n,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=E(a,n)}catch{return l}if(c===void 0||c===null)return"";let y=String(c);if(/<\/style/i.test(y))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return y};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var Qi=new Set;function eo(e,n,t,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&Qi.has(a))return;Qi.add(a);let l=n?` used in ${n}`:"",c=i?` Cause: ${i}.`:"",y=t.length>0?`
287
288
  searched:
288
289
  ${t.map((v)=>` - ${v}`).join(`
289
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function to(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function ri(e){let n=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let i of e){let a;while((a=t.exec(i))!==null)n.add(a[1]);t.lastIndex=0}return[...n]}async function Be(e,n,t,i,a,l,c,y=new Set,v,R=tt(a),T,M=e){let{extractVariables:N}=await o("stx/variable-extractor",()=>import("./chunk-nzyr320e.js")),L=y??new Set;if(L.has(e))return`[Circular component reference: ${e}]`;let P=new Set(L);P.add(e);let D=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let G=D&&D!=="load"&&Gf(D)?D:"";try{let K=(ce)=>ce.split("-").map((re)=>re.charAt(0).toUpperCase()+re.slice(1)).join(""),B=M.endsWith(".stx")?M.slice(0,-4):M,Q=null,te=a.__importedComponents;if(te){let ce=[B,B.toLowerCase(),K(B),z(B)];for(let re of ce)if(te.has(re)){Q=te.get(re);break}}let ne=[];if(!Q){let ce=[`${B}.stx`,`${K(B)}.stx`,`${z(B)}.stx`],re=[...new Set(ce)],he=a.__originalFilePath,be=[];if(be.push(...c._layerComponentDirs??[]),he){let ye=le.join(le.dirname(he),"components");be.push(ye)}if(i)be.push(i);let Ke=c._rootComponentsDir;if(typeof Ke==="string"&&!be.includes(Ke))be.push(Ke);let Te=le.join(le.dirname(l),"components");if(!be.includes(Te))be.push(Te);if(c.componentsDir&&c.componentsDir!==i&&!be.includes(c.componentsDir))be.push(c.componentsDir);let it=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(B),et=(T?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Ut=Object.hasOwn(n,"checked")||Boolean(T?.reactiveProps?.includes("checked")),Qn=Object.hasOwn(n,"value")||Boolean(T?.reactiveProps?.includes("value")),dt=!et.includes("valuechange")&&(Ut||et.includes("change")&&!Qn),yt=c._nativeHostAttrs&&/^textinput$/i.test(B),_n=et.includes("update:value")&&!et.includes("input"),wn=c._nativeHostAttrs&&/^video$/i.test(B),Sn=Object.hasOwn(n,"src")||Boolean(T?.reactiveProps?.includes("src")),_t=Object.hasOwn(n,"source")||Boolean(T?.reactiveProps?.includes("source")),$n=wn&&Sn&&!_t&&(T?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),gt=(ye)=>Object.hasOwn(n,ye)||Boolean(T?.reactiveProps?.includes(ye)),En=c._nativeHostAttrs&&/^button$/i.test(B)&&(gt("symbol")||gt("iconOnly")||gt("title")&&!gt("label")&&!t.trim()),Ht=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===B.toLowerCase())&&(!it||dt)&&(!yt||_n)&&(!wn||$n)&&!En;for(let ye of Ht?[]:c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let nt=typeof c.root==="string"?le.resolve(c.root):void 0,bo=nt??le.dirname(l),wt=[];if(nt)wt.push(le.resolve(nt,"resources/views/components")),wt.push(le.resolve(nt,"resources/components")),wt.push(le.resolve(nt,"src/components")),wt.push(le.resolve(nt,"components"));wt.push(le.resolve(import.meta.dir,"components"));for(let ye of wt)if(!be.includes(ye))be.push(ye);let sr=c._pluginComponentDirs;if(Array.isArray(sr)){for(let ye of sr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(Ht){for(let ye of c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let rr=[...new Set(be.map((ye)=>{if(!ye)return ye;return le.isAbsolute(ye)?ye:le.resolve(bo,ye)}))];be.length=0,be.push(...rr);let es=`${B}\x00${l}\x00${rr.join("\x00")}`,ts=Kn.get(es);if(ts)if(await r(ts))Q=ts;else Kn.delete(es);if(!Q&&(B.startsWith("./")||B.startsWith("../")))Q=le.resolve(le.dirname(l),`${B}.stx`),ne.push(Q);else if(!Q)for(let ye of be){if(!ye)continue;for(let kn of re){let Rn=le.join(ye,kn);if(ne.push(Rn),await r(Rn)){Q=Rn;break}}if(Q)break;if(!Q)try{let kn=await import("fs");if(!kn.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let yo=8,ns=[{path:ye,depth:0}];while(ns.length>0&&!Q){let Tn=ns.pop();if(Tn.depth>=yo)continue;let ir;try{ir=kn.readdirSync(Tn.path,{withFileTypes:!0})}catch{continue}for(let Cn of ir){if(!Cn.isDirectory())continue;if(Cn.name==="node_modules"||Cn.name.startsWith("."))continue;let or=le.join(Tn.path,Cn.name);for(let _o of re){let ss=le.join(or,_o);if(ne.push(ss),await r(ss)){Q=ss;break}}if(Q)break;ns.push({path:or,depth:Tn.depth+1})}}}catch{}if(Q)break}if(Q)Kn.set(es,Q)}if(!Q||!await r(Q))return eo(e,l,ne),to(e);v.add(Q);let ae;if(Qt.has(Q))ae=Qt.get(Q);else try{ae=await Bun.file(Q).text(),Qt.set(Q,ae)}catch(ce){let re=ce instanceof Error?ce.message:String(ce);return eo(e,l,[Q],re),to(e)}if(T)for(let ce of new Set([...Object.keys(n),...T.reactiveProps??[]])){let re=ce.toLowerCase();if(re.startsWith("aria-")||re.startsWith("data-"))continue;let he=ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${he}\\b`).test(ae))T.declaredProps.add(ce);if(new RegExp(`\\$props\\s*(?:\\.\\s*${he}\\b|\\[\\s*['"]${he}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${he}['"]`).test(ae))T.consumedProps?.add(ce)}let me=new Set(["__originalFilePath","__importedComponents",Dn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[ce,re]of Object.entries(a))if(!ce.startsWith("__")||me.has(ce))Ee[ce]=re;let Ce=R.length>0?{[Wn]:[...R]}:{},ze=t;if(t.includes("@include")){let{processIncludes:ce}=await o("stx/includes",()=>import("./chunk-8ss2v7sw.js"));ze=await ce(t,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(ze)){let{processComponents:ce}=await o("stx/component-renderer",()=>import("./chunk-j3emvkjb.js"));ze=await ce(ze,{...a,__processedComponents:L,...Ce},l,c,v)}let $e=[];if(Ic(ze)){let{processExpressions:ce}=await o("stx/expressions",()=>import("./chunk-b2ajtmvk.js")),re=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ce}:R.length>0?{...a,...Ce}:a;ze=ce(ze,re,l);for(let he of ze.matchAll(/\{\{([\s\S]*?)\}\}/g))$e.push(he[1].trim())}let st=X(ze),ct=[],tn=st.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ce,re)=>{let he=st.scripts[Number(re)]||"",be=he.match(/^<script\b([^>]*)>/i)?.[1]||"",Ke=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Ke||["module","text/javascript","application/javascript"].includes(Ke),it=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!it)return ct.push(he),"";return he}),{extractSlotContent:Xn}=await o("stx/slots",()=>import("./chunk-txjx2xd6.js")),lt=Xn(tn),ut={};if(lt.defaultSlot?.trim())ut.default=lt.defaultSlot;for(let[ce,re]of lt.namedSlots)ut[ce]=re.content;let ft=a.__stx_scope_seq??={n:0,key:Ps(String(a.__filename??l))},Ct=so(e,process.cwd()),rt=`stx_${(Ct.endsWith(".stx")?Ct.slice(0,-4):Ct).replace(/[^a-zA-Z0-9]/g,"_")}_${++ft.n}_${ft.key}`,We={...Ee,$uid:rt,$native:c._nativeHostAttrs===!0,...n,props:n,slot:tn,$slots:ut,__processedComponents:P,__sections:{},__stx_signals_gate:xe(ae)||Ic(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...$e]};_l(ae,We);let Dt=ae,nn=de(Dt);if(nn)Dt=nn.content.trim();let Jn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,jt=[...ae.matchAll(Jn)];for(let[,ce,re]of jt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ce))Ie(re,Q,c.strict);let Xe=[],Lt=null,Gn=jt.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),xt=null,Ge=null,Bt=null,sn=0,zt=null;if(dl(c),Gn&&qs>0){let ce=gl({props:n,slot:ze,slotContext:t.trim()?ml(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...R].sort(),layers:c._layerGraph?.layers.map((re)=>re.configFile),uid:rt});if(ce!==null){xt=`${Q}\x00${x(ae)}\x00${ce}`;let re=Zn.get(xt);if(re){for(let he of re.dependencies)v.add(he);if(Zr(a,re.clientFactories),ft.n+=re.uidsConsumed,re.preservedClientExpressions.length>0){let he=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of re.preservedClientExpressions)he.add(be);a.__stx_preserved_client_expressions=[...he]}return re.output}Ge=new Set(v),Bt=Hr(a),sn=ft.n,zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Wt=new Set;for(let ce of jt){let re=ce[1]||"",he=ce[2]||"",be=re.includes("server");if(Le(re)&&he.trim())he=je(he);if(be&&he){for(let Te of Ne(he))Wt.add(Te);try{await N(he,We,Q,{onFailure:(Te)=>{if(Te.kind!=="unknown")Lt=Te.kind}})}catch(Te){}}if(!be){let Te=he.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),it=Te.includes("{{")&&Te.includes("}}"),et=Te.includes("{!!")&&Te.includes("!!}");if(it||et)Te=oi(Te,We,Q);let Ut=re.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Xe.push(`<script${Ut}>${Te}</script>`)}}let Ze=X(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=Ze?Ze[1]:"",Yn=Ze?Ze[2]:"",Ye="",ee=Ft&&/\bscoped\b/i.test(Ft);if(Ze)Ye=`<style${Ft}>${Sl(Yn,We,Q)}</style>`;let se=Dt;if(se=se.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ze)se=se.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,re=[];if(se=se.replace(ce,(he,be)=>{let Ke=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ke)re.push(`<style${Ke[1]}>${Ke[2]}</style>`);return""}),se=se.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),re.length>0)Ye=`${Ye}${re.join(`
290
- `)}`}if(t&&se.includes("{{ text || slot }}"))se=se.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:ue}=await o("stx/slots",()=>import("./chunk-txjx2xd6.js")),{defaultSlot:_e,namedSlots:Re}=lt,Ve=c._nativeHostAttrs===!0&&Xe.length>0||Xe.some((ce)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ce)),pt=(ce)=>Ve?Ri(ce,rt):ce,nr=new Map([...Re].map(([ce,re])=>[ce,{...re,content:pt(re.content)}]));se=await ue(se,pt(_e),nr,We,Ve?rt:"");let rn=ri(Xe),on=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((ce)=>!Wt.has(ce));if(rn.length>0||on.length>0)We.__stx_client_signal_names=[...new Set([...on,...rn])];else delete We.__stx_client_signal_names;let Vt=R.filter((ce)=>!Wt.has(ce)&&!(ce in n));if(Vt.length>0)We[Wn]=Vt;let an={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:le.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||Ve||Xe.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:xn}=await o("stx/process",()=>import("./chunk-9frqh3bj.js")),Qe=await xn(se,We,Q,an,v),bt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ce of Qe.matchAll(/\{\{([\s\S]*?)\}\}/g))bt.add(ce[1].trim());if(bt.size>0)a.__stx_preserved_client_expressions=[...bt];let qe=rt,Ue=Qe;if(Ve){let ce="";if(Object.keys(n).length>0)try{ce=` data-stx-props="${Us(JSON.stringify(n))}"`}catch{}let re=G?` stx-hydrate="${Us(G)}"`:"",he=Object.fromEntries(Object.entries(ut).map(([dt,yt])=>[dt,Boolean(yt)])),be=Object.keys(he).length>0?` data-stx-slots="${Us(JSON.stringify(he))}"`:"",Ke=` data-stx-scope="${qe}"${ce}${be}${re}`,Te=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Qe),it=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Qe),et=Te?"span":"div",Ut=it&&c._nativeHostAttrs?' style="display:flex;flex:1;min-height:0;min-width:0"':Te||it?' style="display:contents"':"";Ue=qf(Qe,Ke)??`<${et}${Ke} data-stx-component-wrapper${Ut}>${Qe}</${et}>`;let Qn=await Promise.all(Xe.map(async(dt)=>{let yt=dt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!yt)return dt;let[,_n,wn]=yt,Sn=Xi(dt,We,Q);if(Sn!==null)return Sn;let _t=await El(wn,Q,c.buildMode==="compile"),$n=mn(_t.clientCode,De(We)),{vendorStyleTags:gt}=_t,En=$n?`function(__scopeId) {
290
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function to(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function ri(e){let n=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let i of e){let a;while((a=t.exec(i))!==null)n.add(a[1]);t.lastIndex=0}return[...n]}async function Be(e,n,t,i,a,l,c,y=new Set,v,R=tt(a),T,M=e){let{extractVariables:L}=await o("stx/variable-extractor",()=>import("./chunk-62qjy45q.js")),D=y??new Set;if(D.has(e))return`[Circular component reference: ${e}]`;let P=new Set(D);P.add(e);let N=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let G=N&&N!=="load"&&Kf(N)?N:"";try{let K=(ce)=>ce.split("-").map((re)=>re.charAt(0).toUpperCase()+re.slice(1)).join(""),B=M.endsWith(".stx")?M.slice(0,-4):M,Q=null,te=a.__importedComponents;if(te){let ce=[B,B.toLowerCase(),K(B),z(B)];for(let re of ce)if(te.has(re)){Q=te.get(re);break}}let ne=[];if(!Q){let ce=[`${B}.stx`,`${K(B)}.stx`,`${z(B)}.stx`],re=[...new Set(ce)],he=a.__originalFilePath,be=[];if(be.push(...c._layerComponentDirs??[]),he){let ye=le.join(le.dirname(he),"components");be.push(ye)}if(i)be.push(i);let Ke=c._rootComponentsDir;if(typeof Ke==="string"&&!be.includes(Ke))be.push(Ke);let Te=le.join(le.dirname(l),"components");if(!be.includes(Te))be.push(Te);if(c.componentsDir&&c.componentsDir!==i&&!be.includes(c.componentsDir))be.push(c.componentsDir);let it=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(B),et=(T?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Ut=Object.hasOwn(n,"checked")||Boolean(T?.reactiveProps?.includes("checked")),Qn=Object.hasOwn(n,"value")||Boolean(T?.reactiveProps?.includes("value")),dt=!et.includes("valuechange")&&(Ut||et.includes("change")&&!Qn),yt=c._nativeHostAttrs&&/^textinput$/i.test(B),_n=et.includes("update:value")&&!et.includes("input"),wn=c._nativeHostAttrs&&/^video$/i.test(B),Sn=Object.hasOwn(n,"src")||Boolean(T?.reactiveProps?.includes("src")),_t=Object.hasOwn(n,"source")||Boolean(T?.reactiveProps?.includes("source")),$n=wn&&Sn&&!_t&&(T?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),gt=(ye)=>Object.hasOwn(n,ye)||Boolean(T?.reactiveProps?.includes(ye)),En=c._nativeHostAttrs&&/^button$/i.test(B)&&(gt("symbol")||gt("iconOnly")||gt("title")&&!gt("label")&&!t.trim()),Ht=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===B.toLowerCase())&&(!it||dt)&&(!yt||_n)&&(!wn||$n)&&!En;for(let ye of Ht?[]:c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let nt=typeof c.root==="string"?le.resolve(c.root):void 0,bo=nt??le.dirname(l),wt=[];if(nt)wt.push(le.resolve(nt,"resources/views/components")),wt.push(le.resolve(nt,"resources/components")),wt.push(le.resolve(nt,"src/components")),wt.push(le.resolve(nt,"components"));wt.push(le.resolve(import.meta.dir,"components"));for(let ye of wt)if(!be.includes(ye))be.push(ye);let sr=c._pluginComponentDirs;if(Array.isArray(sr)){for(let ye of sr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(Ht){for(let ye of c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let rr=[...new Set(be.map((ye)=>{if(!ye)return ye;return le.isAbsolute(ye)?ye:le.resolve(bo,ye)}))];be.length=0,be.push(...rr);let es=`${B}\x00${l}\x00${rr.join("\x00")}`,ts=Kn.get(es);if(ts)if(await r(ts))Q=ts;else Kn.delete(es);if(!Q&&(B.startsWith("./")||B.startsWith("../")))Q=le.resolve(le.dirname(l),`${B}.stx`),ne.push(Q);else if(!Q)for(let ye of be){if(!ye)continue;for(let kn of re){let Rn=le.join(ye,kn);if(ne.push(Rn),await r(Rn)){Q=Rn;break}}if(Q)break;if(!Q)try{let kn=await import("fs");if(!kn.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let yo=8,ns=[{path:ye,depth:0}];while(ns.length>0&&!Q){let Tn=ns.pop();if(Tn.depth>=yo)continue;let ir;try{ir=kn.readdirSync(Tn.path,{withFileTypes:!0})}catch{continue}for(let Cn of ir){if(!Cn.isDirectory())continue;if(Cn.name==="node_modules"||Cn.name.startsWith("."))continue;let or=le.join(Tn.path,Cn.name);for(let _o of re){let ss=le.join(or,_o);if(ne.push(ss),await r(ss)){Q=ss;break}}if(Q)break;ns.push({path:or,depth:Tn.depth+1})}}}catch{}if(Q)break}if(Q)Kn.set(es,Q)}if(!Q||!await r(Q))return eo(e,l,ne),to(e);v.add(Q);let ae;if(Qt.has(Q))ae=Qt.get(Q);else try{ae=await Bun.file(Q).text(),Qt.set(Q,ae)}catch(ce){let re=ce instanceof Error?ce.message:String(ce);return eo(e,l,[Q],re),to(e)}if(T)for(let ce of new Set([...Object.keys(n),...T.reactiveProps??[]])){let re=ce.toLowerCase();if(re.startsWith("aria-")||re.startsWith("data-"))continue;let he=ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${he}\\b`).test(ae))T.declaredProps.add(ce);if(new RegExp(`\\$props\\s*(?:\\.\\s*${he}\\b|\\[\\s*['"]${he}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${he}['"]`).test(ae))T.consumedProps?.add(ce)}let me=new Set(["__originalFilePath","__importedComponents",Dn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[ce,re]of Object.entries(a))if(!ce.startsWith("__")||me.has(ce))Ee[ce]=re;let Ce=R.length>0?{[Wn]:[...R]}:{},ze=t;if(t.includes("@include")){let{processIncludes:ce}=await o("stx/includes",()=>import("./chunk-c2dqq1mt.js"));ze=await ce(t,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(ze)){let{processComponents:ce}=await o("stx/component-renderer",()=>import("./chunk-d7ayzcyg.js"));ze=await ce(ze,{...a,__processedComponents:D,...Ce},l,c,v)}let $e=[];if(Ic(ze)){let{processExpressions:ce}=await o("stx/expressions",()=>import("./chunk-2xp44gz3.js")),re=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Ce}:R.length>0?{...a,...Ce}:a;ze=ce(ze,re,l);for(let he of ze.matchAll(/\{\{([\s\S]*?)\}\}/g))$e.push(he[1].trim())}let st=X(ze),ct=[],tn=st.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ce,re)=>{let he=st.scripts[Number(re)]||"",be=he.match(/^<script\b([^>]*)>/i)?.[1]||"",Ke=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Ke||["module","text/javascript","application/javascript"].includes(Ke),it=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!it)return ct.push(he),"";return he}),{extractSlotContent:Xn}=await o("stx/slots",()=>import("./chunk-kfzenpwm.js")),lt=Xn(tn),ut={};if(lt.defaultSlot?.trim())ut.default=lt.defaultSlot;for(let[ce,re]of lt.namedSlots)ut[ce]=re.content;let ft=a.__stx_scope_seq??={n:0,key:Ps(String(a.__filename??l))},Ct=so(e,process.cwd()),rt=`stx_${(Ct.endsWith(".stx")?Ct.slice(0,-4):Ct).replace(/[^a-zA-Z0-9]/g,"_")}_${++ft.n}_${ft.key}`,We={...Ee,$uid:rt,$native:c._nativeHostAttrs===!0,...n,props:n,slot:tn,$slots:ut,__processedComponents:P,__sections:{},__stx_signals_gate:xe(ae)||Ic(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...$e]};_l(ae,We);let Dt=ae,nn=de(Dt);if(nn)Dt=nn.content.trim();let Jn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,jt=[...ae.matchAll(Jn)];for(let[,ce,re]of jt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ce))Ie(re,Q,c.strict);let Xe=[],Lt=null,Gn=jt.some((ce)=>/\bserver\b/.test(ce[1]||"")&&/\bcache\b/.test(ce[1]||"")),xt=null,Ge=null,Bt=null,sn=0,zt=null;if(dl(c),Gn&&qs>0){let ce=gl({props:n,slot:ze,slotContext:t.trim()?ml(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...R].sort(),layers:c._layerGraph?.layers.map((re)=>re.configFile),uid:rt});if(ce!==null){xt=`${Q}\x00${x(ae)}\x00${ce}`;let re=Zn.get(xt);if(re){for(let he of re.dependencies)v.add(he);if(Zr(a,re.clientFactories),ft.n+=re.uidsConsumed,re.preservedClientExpressions.length>0){let he=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of re.preservedClientExpressions)he.add(be);a.__stx_preserved_client_expressions=[...he]}return re.output}Ge=new Set(v),Bt=Hr(a),sn=ft.n,zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Wt=new Set;for(let ce of jt){let re=ce[1]||"",he=ce[2]||"",be=re.includes("server");if(Le(re)&&he.trim())he=je(he);if(be&&he){for(let Te of Ne(he))Wt.add(Te);try{await L(he,We,Q,{onFailure:(Te)=>{if(Te.kind!=="unknown")Lt=Te.kind}})}catch(Te){}}if(!be){let Te=he.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),it=Te.includes("{{")&&Te.includes("}}"),et=Te.includes("{!!")&&Te.includes("!!}");if(it||et)Te=oi(Te,We,Q);let Ut=re.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Xe.push(`<script${Ut}>${Te}</script>`)}}let Ze=X(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=Ze?Ze[1]:"",Yn=Ze?Ze[2]:"",Ye="",ee=Ft&&/\bscoped\b/i.test(Ft);if(Ze)Ye=`<style${Ft}>${Sl(Yn,We,Q)}</style>`;let se=Dt;if(se=se.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ze)se=se.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ce=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,re=[];if(se=se.replace(ce,(he,be)=>{let Ke=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ke)re.push(`<style${Ke[1]}>${Ke[2]}</style>`);return""}),se=se.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),re.length>0)Ye=`${Ye}${re.join(`
291
+ `)}`}if(t&&se.includes("{{ text || slot }}"))se=se.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:ue}=await o("stx/slots",()=>import("./chunk-kfzenpwm.js")),{defaultSlot:_e,namedSlots:Re}=lt,Ve=c._nativeHostAttrs===!0&&Xe.length>0||Xe.some((ce)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ce)),pt=(ce)=>Ve?Ri(ce,rt):ce,nr=new Map([...Re].map(([ce,re])=>[ce,{...re,content:pt(re.content)}]));se=await ue(se,pt(_e),nr,We,Ve?rt:"");let rn=ri(Xe),on=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((ce)=>!Wt.has(ce));if(rn.length>0||on.length>0)We.__stx_client_signal_names=[...new Set([...on,...rn])];else delete We.__stx_client_signal_names;let Vt=R.filter((ce)=>!Wt.has(ce)&&!(ce in n));if(Vt.length>0)We[Wn]=Vt;let an={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:le.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||Ve||Xe.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:xn}=await o("stx/process",()=>import("./chunk-40q04wnz.js")),Qe=await xn(se,We,Q,an,v),bt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ce of Qe.matchAll(/\{\{([\s\S]*?)\}\}/g))bt.add(ce[1].trim());if(bt.size>0)a.__stx_preserved_client_expressions=[...bt];let qe=rt,Ue=Qe;if(Ve){let ce="";if(Object.keys(n).length>0)try{ce=` data-stx-props="${Us(JSON.stringify(n))}"`}catch{}let re=G?` stx-hydrate="${Us(G)}"`:"",he=Object.fromEntries(Object.entries(ut).map(([dt,yt])=>[dt,Boolean(yt)])),be=Object.keys(he).length>0?` data-stx-slots="${Us(JSON.stringify(he))}"`:"",Ke=` data-stx-scope="${qe}"${ce}${be}${re}`,Te=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Qe),it=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Qe),et=Te?"span":"div",Ut=it&&c._nativeHostAttrs?' style="display:flex;flex:1;min-height:0;min-width:0"':Te||it?' style="display:contents"':"";Ue=qf(Qe,Ke)??`<${et}${Ke} data-stx-component-wrapper${Ut}>${Qe}</${et}>`;let Qn=await Promise.all(Xe.map(async(dt)=>{let yt=dt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!yt)return dt;let[,_n,wn]=yt,Sn=Xi(dt,We,Q);if(Sn!==null)return Sn;let _t=await El(wn,Q,c.buildMode==="compile"),$n=mn(_t.clientCode,De(We)),{vendorStyleTags:gt}=_t,En=$n?`function(__scopeId) {
291
292
  ${$n}
292
293
  return (${_t.factoryBody})(__scopeId);
293
294
  }`:_t.factoryBody,Ht=G?null:gs(a,En),nt=Ht?`window.__stxComponentFactories[${JSON.stringify(Ht)}](${JSON.stringify(qe)});`:`(${En})(${JSON.stringify(qe)});`;if(G)return`${gt}<script type="stx/island" data-stx-island="${qe}" data-stx-scoped data-stx-owner="${qe}"${_n}>${nt}</script>`;return`${gt}<script data-stx-scoped data-stx-run="always" data-stx-owner="${qe}"${_n}>${nt}</script>`}));if(Ue=Ue+`
@@ -298,8 +299,8 @@ return (${_t.factoryBody})(__scopeId);
298
299
  `+he.join(`
299
300
  `),We.__stx_event_bindings=[]}}if(ee){let ce=Ts(Ue,Q);if(ce.hasScoped)Ue=ce.html}if(xt&&Ge){let ce=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];Zn.set(xt,{output:Ue,dependencies:[...v].filter((re)=>!Ge.has(re)),clientFactories:Bt?Kr(a,Bt):[],uidsConsumed:ft.n-sn,preservedClientExpressions:zt?ce.filter((re)=>!zt.has(re)):[]})}if(Lt)Ue=`<!--stx-render-failed:${Lt}-->${Ue}`;return ct.length>0?`${Ue}
300
301
  ${ct.join(`
301
- `)}`:Ue}catch(K){if(K instanceof W)throw K;return`[Error processing component: ${K instanceof Error?K.message:String(K)}]`}finally{L.delete(e)}}async function r(e){return Bun.file(e).exists()}function Xs(e,n){let t=le.resolve(n),i=le.resolve(e),a=t.endsWith(le.sep)?t:t+le.sep;if(i===t||i.startsWith(a))return i;return null}async function $l(e,n,t,i){let a=n.startsWith("layouts/")?n.slice(8):n,l=le.join(e,a);for(let c of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await r(c)){if(i)console.log(`Found layout in ${e}: ${c}`);return t?.add(c),c}return null}async function hn(e,n,t,i){let a=await vl(e,n,t,i);if(a===null)return null;let l=Xs(a,process.cwd());if(l)return l;let c=[t.root,t.layoutsDir,t.fallbackLayoutsDir,t.componentsDir,t.partialsDir,t.pagesDir,...t._layerLayoutDirs??[]].filter((y)=>typeof y==="string"&&y.length>0);for(let y of c){let v=le.isAbsolute(y)?y:le.resolve(process.cwd(),y);if(Xs(a,v))return le.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${n})`),null}async function vl(e,n,t,i){if(t.debug)console.log(`Resolving template path: ${e} from ${n}`);let a=le.dirname(n),l=process.cwd();if(e.startsWith("/")){let N=le.join(l,e),L=Xs(N,l);if(!L)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${n})`),null;if(t.debug)console.log(`Checking absolute path: ${L}`);if(await r(L)&&i)i.add(L);return L}let c=le.join(a,e);if(await r(c)){if(t.debug)console.log(`Found direct path: ${c}`);if(i)i.add(c);return c}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let N of[".stx",".tsx",".jsx"]){let L=`${c}${N}`;if(await r(L)){if(t.debug)console.log(`Found direct path with extension: ${L}`);if(i)i.add(L);return L}}let y=[];if(y.push(...t._layerLayoutDirs??[]),t.layoutsDir)y.push(le.isAbsolute(t.layoutsDir)?t.layoutsDir:le.resolve(process.cwd(),t.layoutsDir));let v=le.resolve(a),R=process.cwd();for(let N=0;N<10;N++){let L=le.join(v,"layouts"),P=!1;try{P=Js.statSync(L,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(P){y.push(L);break}let D=le.dirname(v);if(D===v||D.length<R.length)break;v=D}for(let N of y){let L=await $l(N,e,i,t.debug);if(L)return L}if(t.fallbackLayoutsDir){let N=le.isAbsolute(t.fallbackLayoutsDir)?t.fallbackLayoutsDir:le.resolve(process.cwd(),t.fallbackLayoutsDir),L=e.startsWith("layouts/")?e.slice(8):e,P=[le.join(N,L)];if(!e.endsWith(".stx"))P.push(`${P[0]}.stx`);for(let D of P)if(await r(D)){if(t.debug)console.log(`Found in options.fallbackLayoutsDir: ${D}`);if(i)i.add(D);return D}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let N=e.split("layouts/"),L=le.join(t.partialsDir||a,"layouts",N[1]);if(await r(L)){if(t.debug)console.log(`Found in layouts path: ${L}`);if(i)i.add(L);return L}if(!L.endsWith(".stx")){let P=`${L}.stx`;if(await r(P)){if(t.debug)console.log(`Found in layouts path with extension: ${P}`);if(i)i.add(P);return P}}}if(t.partialsDir){let N=le.join(t.partialsDir,"layouts");if(await r(N)){let L=le.join(N,e);if(await r(L)){if(t.debug)console.log(`Found in partials layouts dir: ${L}`);if(i)i.add(L);return L}if(!e.endsWith(".stx")){let P=`${L}.stx`;if(await r(P)){if(t.debug)console.log(`Found in partials layouts dir with extension: ${P}`);if(i)i.add(P);return P}}}}let T=t.partialsDir||le.join(process.cwd(),"views"),M=le.join(T,e);if(await r(M)){if(t.debug)console.log(`Found in views path: ${M}`);if(i)i.add(M);return M}if(!e.endsWith(".stx")){let N=`${M}.stx`;if(await r(N)){if(t.debug)console.log(`Found in views path with extension: ${N}`);if(i)i.add(N);return N}}if(a.includes("temp")){let N=le.join(le.dirname(a),"layouts",e);if(await r(N)){if(t.debug)console.log(`Found in temp layouts dir: ${N}`);if(i)i.add(N);return N}if(!e.endsWith(".stx")){let L=`${N}.stx`;if(await r(L)){if(t.debug)console.log(`Found in temp layouts dir with extension: ${L}`);if(i)i.add(L);return L}}}if(t.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${n})`);else console.warn(`Template not found: ${e} (referenced from ${n})`);return null}function Oc(e,n,t){let i=0,a="",l="";try{if(typeof n==="number"&&n>=0){let c=e.split(`
302
- `),y=0;for(let v=0;v<c.length;v++)if(y+=c[v].length+1,y>=n){i=v+1,a=c[v].trim();let R=Math.max(0,v-2),T=Math.min(c.length,v+3);l=c.slice(R,T).map((M,N)=>{let L=R+N+1;return`${L===i?"> ":" "}${L}: ${M}`}).join(`
302
+ `)}`:Ue}catch(K){if(K instanceof W)throw K;return`[Error processing component: ${K instanceof Error?K.message:String(K)}]`}finally{D.delete(e)}}async function r(e){return Bun.file(e).exists()}function Xs(e,n){let t=le.resolve(n),i=le.resolve(e),a=t.endsWith(le.sep)?t:t+le.sep;if(i===t||i.startsWith(a))return i;return null}async function $l(e,n,t,i){let a=n.startsWith("layouts/")?n.slice(8):n,l=le.join(e,a);for(let c of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await r(c)){if(i)console.log(`Found layout in ${e}: ${c}`);return t?.add(c),c}return null}async function hn(e,n,t,i){let a=await vl(e,n,t,i);if(a===null)return null;let l=Xs(a,process.cwd());if(l)return l;let c=[t.root,t.layoutsDir,t.fallbackLayoutsDir,t.componentsDir,t.partialsDir,t.pagesDir,...t._layerLayoutDirs??[]].filter((y)=>typeof y==="string"&&y.length>0);for(let y of c){let v=le.isAbsolute(y)?y:le.resolve(process.cwd(),y);if(Xs(a,v))return le.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${n})`),null}async function vl(e,n,t,i){if(t.debug)console.log(`Resolving template path: ${e} from ${n}`);let a=le.dirname(n),l=process.cwd();if(e.startsWith("/")){let L=le.join(l,e),D=Xs(L,l);if(!D)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${n})`),null;if(t.debug)console.log(`Checking absolute path: ${D}`);if(await r(D)&&i)i.add(D);return D}let c=le.join(a,e);if(await r(c)){if(t.debug)console.log(`Found direct path: ${c}`);if(i)i.add(c);return c}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let L of[".stx",".tsx",".jsx"]){let D=`${c}${L}`;if(await r(D)){if(t.debug)console.log(`Found direct path with extension: ${D}`);if(i)i.add(D);return D}}let y=[];if(y.push(...t._layerLayoutDirs??[]),t.layoutsDir)y.push(le.isAbsolute(t.layoutsDir)?t.layoutsDir:le.resolve(process.cwd(),t.layoutsDir));let v=le.resolve(a),R=process.cwd();for(let L=0;L<10;L++){let D=le.join(v,"layouts"),P=!1;try{P=Js.statSync(D,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(P){y.push(D);break}let N=le.dirname(v);if(N===v||N.length<R.length)break;v=N}for(let L of y){let D=await $l(L,e,i,t.debug);if(D)return D}if(t.fallbackLayoutsDir){let L=le.isAbsolute(t.fallbackLayoutsDir)?t.fallbackLayoutsDir:le.resolve(process.cwd(),t.fallbackLayoutsDir),D=e.startsWith("layouts/")?e.slice(8):e,P=[le.join(L,D)];if(!e.endsWith(".stx"))P.push(`${P[0]}.stx`);for(let N of P)if(await r(N)){if(t.debug)console.log(`Found in options.fallbackLayoutsDir: ${N}`);if(i)i.add(N);return N}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let L=e.split("layouts/"),D=le.join(t.partialsDir||a,"layouts",L[1]);if(await r(D)){if(t.debug)console.log(`Found in layouts path: ${D}`);if(i)i.add(D);return D}if(!D.endsWith(".stx")){let P=`${D}.stx`;if(await r(P)){if(t.debug)console.log(`Found in layouts path with extension: ${P}`);if(i)i.add(P);return P}}}if(t.partialsDir){let L=le.join(t.partialsDir,"layouts");if(await r(L)){let D=le.join(L,e);if(await r(D)){if(t.debug)console.log(`Found in partials layouts dir: ${D}`);if(i)i.add(D);return D}if(!e.endsWith(".stx")){let P=`${D}.stx`;if(await r(P)){if(t.debug)console.log(`Found in partials layouts dir with extension: ${P}`);if(i)i.add(P);return P}}}}let T=t.partialsDir||le.join(process.cwd(),"views"),M=le.join(T,e);if(await r(M)){if(t.debug)console.log(`Found in views path: ${M}`);if(i)i.add(M);return M}if(!e.endsWith(".stx")){let L=`${M}.stx`;if(await r(L)){if(t.debug)console.log(`Found in views path with extension: ${L}`);if(i)i.add(L);return L}}if(a.includes("temp")){let L=le.join(le.dirname(a),"layouts",e);if(await r(L)){if(t.debug)console.log(`Found in temp layouts dir: ${L}`);if(i)i.add(L);return L}if(!e.endsWith(".stx")){let D=`${L}.stx`;if(await r(D)){if(t.debug)console.log(`Found in temp layouts dir with extension: ${D}`);if(i)i.add(D);return D}}}if(t.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${n})`);else console.warn(`Template not found: ${e} (referenced from ${n})`);return null}function Oc(e,n,t){let i=0,a="",l="";try{if(typeof n==="number"&&n>=0){let c=e.split(`
303
+ `),y=0;for(let v=0;v<c.length;v++)if(y+=c[v].length+1,y>=n){i=v+1,a=c[v].trim();let R=Math.max(0,v-2),T=Math.min(c.length,v+3);l=c.slice(R,T).map((M,L)=>{let D=R+L+1;return`${D===i?"> ":" "}${D}: ${M}`}).join(`
303
304
  `);break}}else if(t){let c=e.indexOf(t);if(c>=0)return Oc(e,c)}}catch{}return{lineNumber:i,lineContent:a,context:l}}var Se={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function h(e,n,t,i,a,l){let{lineNumber:c,context:y}=Oc(i,a,l),v=t.split("/").pop(),R=0;if(typeof a==="number"&&a>=0&&i){let M=i.lastIndexOf(`
304
305
  `,Math.max(0,a-1));R=a-(M+1)+1}let T="";if(c>0)T+=`
305
306
  ${t}:${c}${R>0?`:${R}`:""}: ${e.toLowerCase()} error: ${n}
@@ -313,8 +314,8 @@ ${Se.yellow}${Se.bold}Message:${Se.reset} ${n}
313
314
  `,y)T+=`
314
315
  ${Se.blue}${Se.bold}Context:${Se.reset}
315
316
  ${Se.dim}${y}${Se.reset}
316
- `;return T}function fe(){Qt.clear(),Kn.clear(),Ks.clear(),Zs.clear(),Zn.clear()}function wh(){return{size:Qt.size,maxSize:500}}var Hs=w(128);async function El(e,n,t){let i=x(e,n,t),a=Hs.get(i);if(a){if(_s(a.deps))return a;Hs.delete(i)}let l=ei(e,{filePath:n,projectRoot:process.cwd()}),c=l.code,y=ti(l.styles);c=Ot(c).code;let{hasUserImports:v,bundleClientScript:R}=await o("stx/client-script-bundler",()=>import("./chunk-f7a6nzx6.js")),T=[],M=!1;if(v(c)){let B=c;c=await R(B,n,{projectRoot:process.cwd(),minify:t,collectInputs:T}),M=c===B}let{stripStxRuntimeImports:N}=await o("stx/signal-processing",()=>import("./chunk-46s9ma3t.js"));c=N(c);let L=A(c),P=xl(L),D=new Set(F(L,!0).split(",").map((B)=>B.trim())),G=`function(__scopeId) {
317
- ${ot("const",[...qc,...P],L)}
317
+ `;return T}function fe(){Qt.clear(),Kn.clear(),Ks.clear(),Zs.clear(),Zn.clear()}function wh(){return{size:Qt.size,maxSize:500}}var Hs=w(128);async function El(e,n,t){let i=x(e,n,t),a=Hs.get(i);if(a){if(_s(a.deps))return a;Hs.delete(i)}let l=ei(e,{filePath:n,projectRoot:process.cwd()}),c=l.code,y=ti(l.styles);c=Ot(c).code;let{hasUserImports:v,bundleClientScript:R}=await o("stx/client-script-bundler",()=>import("./chunk-x91zfx03.js")),T=[],M=!1;if(v(c)){let B=c;c=await R(B,n,{projectRoot:process.cwd(),minify:t,collectInputs:T}),M=c===B}let{stripStxRuntimeImports:L}=await o("stx/signal-processing",()=>import("./chunk-w7rczhn5.js"));c=L(c);let D=A(c),P=xl(D),N=new Set(F(D,!0).split(",").map((B)=>B.trim())),G=`function(__scopeId) {
318
+ ${ot("const",[...qc,...P],D)}
318
319
  const __scope = window.stx._scopes = window.stx._scopes || {};
319
320
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
320
321
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -374,12 +375,12 @@ ${Se.dim}${y}${Se.reset}
374
375
  const __endEffects = window.stx._beginEffects ? window.stx._beginEffects() : null;
375
376
 
376
377
  try {
377
- ${L}
378
+ ${D}
378
379
 
379
380
  // Register all defined signals and functions in this scope
380
381
  const __localVars = {};
381
382
  try {
382
- ${P.map((B)=>D.has(B)?`Object.defineProperty(__localVars, '${B}', ${vs(B)});`:`if (typeof ${B} !== 'undefined') __localVars['${B}'] = ${B};`).join(`
383
+ ${P.map((B)=>N.has(B)?`Object.defineProperty(__localVars, '${B}', ${vs(B)});`:`if (typeof ${B} !== 'undefined') __localVars['${B}'] = ${B};`).join(`
383
384
  `)}
384
385
  }
385
386
  catch (e) {}
@@ -398,24 +399,24 @@ finally {
398
399
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
399
400
  window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
400
401
  }
401
- }`,K={vendorStyleTags:y,factoryBody:G,clientCode:L,deps:gr([...T,...l.styles.map((B)=>B.resolvedPath)])};if(!M&&l.unresolved.length===0)Hs.set(i,K);return K}var gn=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];var kl=100,Rl=599,Ys="__stxResponseStatus",en="__stxResponseHeaders";function qn(e){return typeof e==="number"&&Number.isInteger(e)&&e>=kl&&e<=Rl}function pn(e){for(let n of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let t=n[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!t)continue;let i=Number(t[1]);if(qn(i))return i}return}function Gs(e,n){if(!e||typeof e!=="object")return!1;let t=typeof n==="string"&&/^\d+$/.test(n.trim())?Number(n.trim()):n;if(!qn(t))return!1;return e[Ys]=t,!0}function Tl(e,n,t){if(!e||typeof e!=="object")return;let i=String(n??"").trim();if(!i)return;e[en]={...e[en],[i]:String(t)}}function Pt(e){let n=e?.[Ys];return qn(n)?n:void 0}function It(e){let n=e?.[en];if(!n||typeof n!=="object")return;let t=Object.entries(n).map(([i,a])=>[i,String(a)]);return t.length>0?Object.fromEntries(t):void 0}function xc(e,n){if(!e||!n||e===n||typeof n!=="object")return;let t=Pt(e);if(t!==void 0)n[Ys]=t;let i=It(e);if(i)n[en]={...n[en],...i}}function $s(e){return{setResponseStatus:(n)=>{Gs(e,n)},notFound:(n=404)=>{let t=qn(n)&&n>=400?n:404;Gs(e,t)},setResponseHeader:(n,t)=>{Tl(e,n,t)}}}function Sc(e,n,t={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=t,l=a==="compile",c="",y=0,v=/@status\s*\(/g,R;while((R=v.exec(e))!==null){let T=Cl(e,R.index+R[0].length-1);if(T<0)break;let M=e.slice(R.index+R[0].length,T).trim(),N=/^\d+$/.test(M)?Number(M):u(M,n),L=i?` in ${i}`:"";if(l)console.warn(`[stx] @status(${M})${L} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${M}) from <script server> instead \u2014 that runs per request.`);else if(!Gs(n,N))console.warn(`[stx] @status(${M})${L} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(y,R.index),y=T+1+(e.slice(T+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=y}return y===0?e:c+e.slice(y)}function Cl(e,n){let t=1,i=null,a=!1;for(let l=n+1;l<e.length;l++){let c=e[l];if(a){a=!1;continue}if(i){if(c==="\\")a=!0;else if(c===i)i=null;continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="(")t++;else if(c===")"&&--t===0)return l}return-1}var ro=new Set(gn),Al=new Set(["props","$props","defineProps"]),Il=new Set(["stx","@stacksjs/stx"]),io=w(128),oo=w(64);function Ol(e){let n=[],t=0,i=e.split(`
402
- `);for(let a of i){let l=t,c=null,y=!1;for(let v=0;v<a.length;v++){let R=a[v];if(y){y=!1;continue}if(R==="\\"){y=!0;continue}if(c){if(R===c)c=null;continue}if(R==="'"||R==='"'||R==="`"){c=R;continue}if(R==="/"&&v+1<a.length&&a[v+1]==="/")break;if(R==="{")t++;else if(R==="}")t--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)n.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let R=a.match(/(?:const|let|var)\s+(\w+)/);if(R)n.push(R[1])}else{let R=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(R){let M=R[1].slice(1,-1).split(",").map((N)=>{let L=N.split(":");return(L.length>1?L[1]:L[0]).trim()}).filter((N)=>/^\w+$/.test(N));n.push(...M)}}}}return[...new Set(n)]}function If(e){let n=e;n=n.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),n=n.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),n=n.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),n=n.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),n=n.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function t(i){if(!i.includes(":"))return i;let a=[],l="",c=0,y=0,v=null;for(let R=0;R<i.length;R++){let T=i[R];if(v){if(l+=T,T===v)v=null;continue}if(T==='"'||T==="'"||T==="`"){v=T,l+=T;continue}if(T==="<")c++;else if(T===">"&&c>0)c--;else if(T==="(")y++;else if(T===")")y--;if(T===","&&c===0&&y===0){a.push(l),l="";continue}l+=T}if(l)a.push(l);return a.map((R)=>{let T=R.trim(),M=T.startsWith("..."),N=M?T.slice(3):T,L=-1,P=0;for(let ne=0;ne<N.length;ne++)if(N[ne]==="<")P++;else if(N[ne]===">")P--;else if(N[ne]===":"&&P===0){L=ne;break}if(L===-1)return R;let G=N.substring(0,L).trim().replace(/\?$/,""),K=N.substring(L+1),B=-1,Q=0;for(let ne=0;ne<K.length;ne++)if(K[ne]==="<")Q++;else if(K[ne]===">")Q--;else if(K[ne]==="="&&Q===0){B=ne;break}let te=M?"...":"";if(B!==-1)return`${te}${G} = ${K.substring(B+1).trim()}`;return`${te}${G}`}).join(", ")}n=n.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,l)=>{if(!l.includes(":"))return i;return`${a}(${t(l)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=i.exec(n))!==null){let c=a.index+a[0].length-1,y=1,v=c+1,R=0,T=null;while(v<n.length&&y>0){let L=n[v];if(T){if(L===T)T=null;v++;continue}if(L==='"'||L==="'"||L==="`"){T=L,v++;continue}if(L==="<")R++;else if(L===">"&&R>0)R--;else if(R===0){if(L==="(")y++;else if(L===")")y--}if(y>0)v++}if(y!==0)continue;let M=n.substring(c+1,v);if(!M.includes(":"))continue;let N=t(M);l.push({start:c+1,end:v,replacement:N})}for(let c=l.length-1;c>=0;c--){let{start:y,end:v,replacement:R}=l[c];n=n.substring(0,y)+R+n.substring(v)}}return n=n.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(i,a)=>{if(!a.includes(":"))return i;if(a.includes("{")||a.includes("}"))return i;return`(${a.split(",").map((c)=>{let[y,...v]=c.split("="),R=y.split(":")[0].trim();if(v.length>0)return`${R} = ${v.join("=").trim()}`;return R}).join(", ")}) =>`}),n=n.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),n=n.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),n=n.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),n=n.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),n=n.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),n=n.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),n=n.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),n=n.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),n=n.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),n=n.replace(/\n\s*\n\s*\n/g,`
402
+ }`,K={vendorStyleTags:y,factoryBody:G,clientCode:D,deps:gr([...T,...l.styles.map((B)=>B.resolvedPath)])};if(!M&&l.unresolved.length===0)Hs.set(i,K);return K}var gn=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];var kl=100,Rl=599,Ys="__stxResponseStatus",en="__stxResponseHeaders";function qn(e){return typeof e==="number"&&Number.isInteger(e)&&e>=kl&&e<=Rl}function pn(e){for(let n of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let t=n[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!t)continue;let i=Number(t[1]);if(qn(i))return i}return}function Gs(e,n){if(!e||typeof e!=="object")return!1;let t=typeof n==="string"&&/^\d+$/.test(n.trim())?Number(n.trim()):n;if(!qn(t))return!1;return e[Ys]=t,!0}function Tl(e,n,t){if(!e||typeof e!=="object")return;let i=String(n??"").trim();if(!i)return;e[en]={...e[en],[i]:String(t)}}function Pt(e){let n=e?.[Ys];return qn(n)?n:void 0}function It(e){let n=e?.[en];if(!n||typeof n!=="object")return;let t=Object.entries(n).map(([i,a])=>[i,String(a)]);return t.length>0?Object.fromEntries(t):void 0}function xc(e,n){if(!e||!n||e===n||typeof n!=="object")return;let t=Pt(e);if(t!==void 0)n[Ys]=t;let i=It(e);if(i)n[en]={...n[en],...i}}function $s(e){return{setResponseStatus:(n)=>{Gs(e,n)},notFound:(n=404)=>{let t=qn(n)&&n>=400?n:404;Gs(e,t)},setResponseHeader:(n,t)=>{Tl(e,n,t)}}}function Sc(e,n,t={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=t,l=a==="compile",c="",y=0,v=/@status\s*\(/g,R;while((R=v.exec(e))!==null){let T=Cl(e,R.index+R[0].length-1);if(T<0)break;let M=e.slice(R.index+R[0].length,T).trim(),L=/^\d+$/.test(M)?Number(M):u(M,n),D=i?` in ${i}`:"";if(l)console.warn(`[stx] @status(${M})${D} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${M}) from <script server> instead \u2014 that runs per request.`);else if(!Gs(n,L))console.warn(`[stx] @status(${M})${D} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(y,R.index),y=T+1+(e.slice(T+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=y}return y===0?e:c+e.slice(y)}function Cl(e,n){let t=1,i=null,a=!1;for(let l=n+1;l<e.length;l++){let c=e[l];if(a){a=!1;continue}if(i){if(c==="\\")a=!0;else if(c===i)i=null;continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="(")t++;else if(c===")"&&--t===0)return l}return-1}var ro=new Set(gn),Al=new Set(["props","$props","defineProps"]),Il=new Set(["stx","@stacksjs/stx"]),io=w(128),oo=w(64);function Ol(e){let n=[],t=0,i=e.split(`
403
+ `);for(let a of i){let l=t,c=null,y=!1;for(let v=0;v<a.length;v++){let R=a[v];if(y){y=!1;continue}if(R==="\\"){y=!0;continue}if(c){if(R===c)c=null;continue}if(R==="'"||R==='"'||R==="`"){c=R;continue}if(R==="/"&&v+1<a.length&&a[v+1]==="/")break;if(R==="{")t++;else if(R==="}")t--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)n.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let R=a.match(/(?:const|let|var)\s+(\w+)/);if(R)n.push(R[1])}else{let R=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(R){let M=R[1].slice(1,-1).split(",").map((L)=>{let D=L.split(":");return(D.length>1?D[1]:D[0]).trim()}).filter((L)=>/^\w+$/.test(L));n.push(...M)}}}}return[...new Set(n)]}function If(e){let n=e;n=n.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),n=n.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),n=n.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),n=n.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),n=n.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function t(i){if(!i.includes(":"))return i;let a=[],l="",c=0,y=0,v=null;for(let R=0;R<i.length;R++){let T=i[R];if(v){if(l+=T,T===v)v=null;continue}if(T==='"'||T==="'"||T==="`"){v=T,l+=T;continue}if(T==="<")c++;else if(T===">"&&c>0)c--;else if(T==="(")y++;else if(T===")")y--;if(T===","&&c===0&&y===0){a.push(l),l="";continue}l+=T}if(l)a.push(l);return a.map((R)=>{let T=R.trim(),M=T.startsWith("..."),L=M?T.slice(3):T,D=-1,P=0;for(let ne=0;ne<L.length;ne++)if(L[ne]==="<")P++;else if(L[ne]===">")P--;else if(L[ne]===":"&&P===0){D=ne;break}if(D===-1)return R;let G=L.substring(0,D).trim().replace(/\?$/,""),K=L.substring(D+1),B=-1,Q=0;for(let ne=0;ne<K.length;ne++)if(K[ne]==="<")Q++;else if(K[ne]===">")Q--;else if(K[ne]==="="&&Q===0){B=ne;break}let te=M?"...":"";if(B!==-1)return`${te}${G} = ${K.substring(B+1).trim()}`;return`${te}${G}`}).join(", ")}n=n.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,l)=>{if(!l.includes(":"))return i;return`${a}(${t(l)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=i.exec(n))!==null){let c=a.index+a[0].length-1,y=1,v=c+1,R=0,T=null;while(v<n.length&&y>0){let D=n[v];if(T){if(D===T)T=null;v++;continue}if(D==='"'||D==="'"||D==="`"){T=D,v++;continue}if(D==="<")R++;else if(D===">"&&R>0)R--;else if(R===0){if(D==="(")y++;else if(D===")")y--}if(y>0)v++}if(y!==0)continue;let M=n.substring(c+1,v);if(!M.includes(":"))continue;let L=t(M);l.push({start:c+1,end:v,replacement:L})}for(let c=l.length-1;c>=0;c--){let{start:y,end:v,replacement:R}=l[c];n=n.substring(0,y)+R+n.substring(v)}}return n=n.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(i,a)=>{if(!a.includes(":"))return i;if(a.includes("{")||a.includes("}"))return i;return`(${a.split(",").map((c)=>{let[y,...v]=c.split("="),R=y.split(":")[0].trim();if(v.length>0)return`${R} = ${v.join("=").trim()}`;return R}).join(", ")}) =>`}),n=n.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),n=n.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),n=n.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),n=n.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),n=n.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),n=n.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),n=n.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),n=n.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),n=n.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),n=n.replace(/\n\s*\n\s*\n/g,`
403
404
 
404
- `),n}function Of(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(n,...t)=>{let[,i,a]=t,l=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":n})}function Nf(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function Df(e){if(e instanceof SyntaxError)return!0;let n=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(n)}function Mf(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}var ao=new Set;async function m(e,n,t,i={}){if(!e.trim())return;let a=_(),l=x(e,JSON.stringify(a)),c=io.get(l);if(c===void 0){try{let ee=Y({loader:"ts",target:"browser",define:a}),se=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");se=se.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=ee.transformSync(se)}catch{c=If(e)}io.set(l,c)}let y={exports:{}},v=y.exports,R=kt.cwd(),T={},M=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((ee)=>ee[1]).filter((ee)=>!ee.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ee)),N=new Map;for(let ee of M)try{if(ee.startsWith(".")){T[ee]=await import(Je.resolve(Je.dirname(t),ee));continue}let se=Je.resolve(R,"node_modules",ee),ue=Je.join(se,"package.json"),_e=JSON.parse(g("fs").readFileSync(ue,"utf8")),Re=_e.main||"index.js";if(_e.exports){let Ve=typeof _e.exports==="string"?_e.exports:_e.exports["."];if(typeof Ve==="string")Re=Ve;else if(Ve?.bun)Re=Ve.bun;else if(Ve?.import)Re=Ve.import;else if(Ve?.default)Re=Ve.default}T[ee]=await import(Je.resolve(se,Re))}catch(se){if(ee.startsWith("."))N.set(ee,se instanceof Error?se.message:String(se))}let L=(ee)=>{if(T[ee])return T[ee];let se=N.get(ee);if(se!==void 0)throw Error(`Cannot require '${ee}' from ${t}: ${se}`);return g(ee)},P=n.props||{},D=(ee)=>{if(!ee)return P;let se={};for(let[ue,_e]of Object.entries(ee)){let Re=P[ue];if(Re!==void 0)se[ue]=Re;else if(typeof _e==="function")se[ue]=_e();else se[ue]=_e}return se};for(let[ee,se]of Object.entries(P))Object.defineProperty(D,ee,{value:se,enumerable:!0,configurable:!0,writable:!0});let G=(ee,se=!1)=>{if(ee===void 0||ee===null)return se;if(typeof ee==="string"){let ue=ee.trim().toLowerCase();if(ue===""||ue==="true"||ue==="1"||ue==="on"||ue==="yes")return!0;if(ue==="false"||ue==="0"||ue==="off"||ue==="no")return!1;return!0}return Boolean(ee)},K=(ee,se=0)=>{if(ee===void 0||ee===null)return se;if(typeof ee==="string"){let _e=ee.trim();if(_e==="")return se;let Re=Number(_e);return Number.isFinite(Re)?Re:se}let ue=Number(ee);return Number.isFinite(ue)?ue:se};for(let ee of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(P,ee))continue;try{Object.defineProperty(D,ee,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(ee)=>{if(!ee)return P;let se={...P};for(let[ue,_e]of Object.entries(ee)){let Re=_e&&typeof _e==="object"&&!Array.isArray(_e)?_e:{type:_e};if(se[ue]===void 0&&Re.default!==void 0)se[ue]=typeof Re.default==="function"?Re.default():Re.default}return se},Q=()=>n.slots||{},te=(ee,se)=>{let ue={...ee};for(let[_e,Re]of Object.entries(se))if(ue[_e]===void 0)if(typeof Re==="function")ue[_e]=Re();else ue[_e]=Re;return ue},ne=(ee)=>{let se=()=>ee;return se.set=(ue)=>{},se.update=(ue)=>{},se},ae=(ee)=>{let se,ue=!1;return()=>{if(!ue)try{se=ee(),ue=!0}catch{se=void 0}return se}},me=(ee)=>{},Ee=(ee)=>ee(),Ce=(ee)=>{},ze=(ee)=>{},$e=$s(n);function st(ee){let se=ee||{};if(se.title!==void 0||se.description!==void 0)ut({title:se.title,description:se.description})}function ct(ee){if(!ee||typeof ee!=="object")return;let se=n.__stxClientPayload??{};Object.assign(se,ee),n.__stxClientPayload=se}let tn=()=>{let ee=n.__stxServeContext,se=n.__stxServeSearch??ee?.search??"",ue=ee?.path??"",_e=Object.fromEntries(new URLSearchParams(se)),Re=n.query,Ve=Object.keys(_e).length>0?_e:Re??{},pt=se||(Object.keys(Ve).length>0?`?${new URLSearchParams(Ve).toString()}`:"");return{params:n.params??{},query:Ve,path:ue,name:"",fullPath:ue+pt,hash:"",matched:[]}},Xn=()=>({push:(ee)=>{},replace:(ee)=>{},back:()=>{},forward:()=>{},go:(ee)=>{}}),lt=(ee)=>{let se=n.__stx_runtime_head||{};n.__stx_runtime_head=He(se,ke(ee||{},{known:js,source:"useHead()"}))},ut=(ee)=>{lt(Bs(ee||{}))},ft=(ee)=>({value:ee}),Ct=(ee)=>ee,er=(ee)=>({value:typeof ee==="function"?ee():ee}),rt=(ee,se)=>{},We=(ee)=>{},Dt=(ee)=>{},nn=(ee)=>ee?ee():Promise.resolve(),Jn=(ee)=>(se,...ue)=>{},jt=(ee)=>{},Xe=(ee,se)=>{},Lt=(ee,se)=>se,Gn=()=>({value:"light"}),xt=()=>ne(!1),Ge=(ee)=>ne(!1),Bt=()=>ne(!1),sn=()=>Ge("(prefers-color-scheme: dark)"),zt=()=>Ge("(prefers-color-scheme: light)"),Wt=()=>Ge("(prefers-reduced-motion: reduce)"),tr=()=>Ge("(prefers-contrast: more)"),Ze={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},Ft=new Proxy(Ze,{get(ee,se){if(se in ee)return ee[se];return},set(ee,se,ue){return ee[se]=ue,!0}}),Yn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Ye=console;try{let ee=Qo(c,t),se=new Set(Object.keys(P)),ue=Object.keys(n).filter((re)=>!se.has(re)&&!Al.has(re)&&Mt(re)),_e=ue.map((re)=>n[re]);if(!ue.includes("__stxServeContext"))ue.push("__stxServeContext"),_e.push(void 0);if(!se.has("cookies")){let re=n.cookies??n.__stxServeContext?.cookies??{},he=ue.indexOf("cookies");if(he<0)ue.push("cookies"),_e.push(re);else _e[he]=re}let Re=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ve=[],pt=[];for(let[re,he]of Object.entries(P)){if(!Mt(re))continue;if(Re.has(re))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${re}\\b`).test(ee))continue;Ve.push(re),pt.push(he)}let rn=Ol(ee).map((re)=>`module.exports.${re} = typeof ${re} !== 'undefined' ? ${re} : module.exports.${re};`).join(`
405
+ `),n}function Of(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(n,...t)=>{let[,i,a]=t,l=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":n})}function Nf(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function Df(e){if(e instanceof SyntaxError)return!0;let n=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(n)}function Mf(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}var ao=new Set;async function m(e,n,t,i={}){if(!e.trim())return;let a=_(),l=x(e,JSON.stringify(a)),c=io.get(l);if(c===void 0){try{let ee=Y({loader:"ts",target:"browser",define:a}),se=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");se=se.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=ee.transformSync(se)}catch{c=If(e)}io.set(l,c)}let y={exports:{}},v=y.exports,R=kt.cwd(),T={},M=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((ee)=>ee[1]).filter((ee)=>!ee.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ee)),L=new Map;for(let ee of M)try{if(ee.startsWith(".")){T[ee]=await import(Je.resolve(Je.dirname(t),ee));continue}let se=Je.resolve(R,"node_modules",ee),ue=Je.join(se,"package.json"),_e=JSON.parse(g("fs").readFileSync(ue,"utf8")),Re=_e.main||"index.js";if(_e.exports){let Ve=typeof _e.exports==="string"?_e.exports:_e.exports["."];if(typeof Ve==="string")Re=Ve;else if(Ve?.bun)Re=Ve.bun;else if(Ve?.import)Re=Ve.import;else if(Ve?.default)Re=Ve.default}T[ee]=await import(Je.resolve(se,Re))}catch(se){if(ee.startsWith("."))L.set(ee,se instanceof Error?se.message:String(se))}let D=(ee)=>{if(T[ee])return T[ee];let se=L.get(ee);if(se!==void 0)throw Error(`Cannot require '${ee}' from ${t}: ${se}`);return g(ee)},P=n.props||{},N=(ee)=>{if(!ee)return P;let se={};for(let[ue,_e]of Object.entries(ee)){let Re=P[ue];if(Re!==void 0)se[ue]=Re;else if(typeof _e==="function")se[ue]=_e();else se[ue]=_e}return se};for(let[ee,se]of Object.entries(P))Object.defineProperty(N,ee,{value:se,enumerable:!0,configurable:!0,writable:!0});let G=(ee,se=!1)=>{if(ee===void 0||ee===null)return se;if(typeof ee==="string"){let ue=ee.trim().toLowerCase();if(ue===""||ue==="true"||ue==="1"||ue==="on"||ue==="yes")return!0;if(ue==="false"||ue==="0"||ue==="off"||ue==="no")return!1;return!0}return Boolean(ee)},K=(ee,se=0)=>{if(ee===void 0||ee===null)return se;if(typeof ee==="string"){let _e=ee.trim();if(_e==="")return se;let Re=Number(_e);return Number.isFinite(Re)?Re:se}let ue=Number(ee);return Number.isFinite(ue)?ue:se};for(let ee of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(P,ee))continue;try{Object.defineProperty(N,ee,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(ee)=>{if(!ee)return P;let se={...P};for(let[ue,_e]of Object.entries(ee)){let Re=_e&&typeof _e==="object"&&!Array.isArray(_e)?_e:{type:_e};if(se[ue]===void 0&&Re.default!==void 0)se[ue]=typeof Re.default==="function"?Re.default():Re.default}return se},Q=()=>n.slots||{},te=(ee,se)=>{let ue={...ee};for(let[_e,Re]of Object.entries(se))if(ue[_e]===void 0)if(typeof Re==="function")ue[_e]=Re();else ue[_e]=Re;return ue},ne=(ee)=>{let se=()=>ee;return se.set=(ue)=>{},se.update=(ue)=>{},se},ae=(ee)=>{let se,ue=!1;return()=>{if(!ue)try{se=ee(),ue=!0}catch{se=void 0}return se}},me=(ee)=>{},Ee=(ee)=>ee(),Ce=(ee)=>{},ze=(ee)=>{},$e=$s(n);function st(ee){let se=ee||{};if(se.title!==void 0||se.description!==void 0)ut({title:se.title,description:se.description})}function ct(ee){if(!ee||typeof ee!=="object")return;let se=n.__stxClientPayload??{};Object.assign(se,ee),n.__stxClientPayload=se}let tn=()=>{let ee=n.__stxServeContext,se=n.__stxServeSearch??ee?.search??"",ue=ee?.path??"",_e=Object.fromEntries(new URLSearchParams(se)),Re=n.query,Ve=Object.keys(_e).length>0?_e:Re??{},pt=se||(Object.keys(Ve).length>0?`?${new URLSearchParams(Ve).toString()}`:"");return{params:n.params??{},query:Ve,path:ue,name:"",fullPath:ue+pt,hash:"",matched:[]}},Xn=()=>({push:(ee)=>{},replace:(ee)=>{},back:()=>{},forward:()=>{},go:(ee)=>{}}),lt=(ee)=>{let se=n.__stx_runtime_head||{};n.__stx_runtime_head=He(se,ke(ee||{},{known:js,source:"useHead()"}))},ut=(ee)=>{lt(Bs(ee||{}))},ft=(ee)=>({value:ee}),Ct=(ee)=>ee,er=(ee)=>({value:typeof ee==="function"?ee():ee}),rt=(ee,se)=>{},We=(ee)=>{},Dt=(ee)=>{},nn=(ee)=>ee?ee():Promise.resolve(),Jn=(ee)=>(se,...ue)=>{},jt=(ee)=>{},Xe=(ee,se)=>{},Lt=(ee,se)=>se,Gn=()=>({value:"light"}),xt=()=>ne(!1),Ge=(ee)=>ne(!1),Bt=()=>ne(!1),sn=()=>Ge("(prefers-color-scheme: dark)"),zt=()=>Ge("(prefers-color-scheme: light)"),Wt=()=>Ge("(prefers-reduced-motion: reduce)"),tr=()=>Ge("(prefers-contrast: more)"),Ze={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},Ft=new Proxy(Ze,{get(ee,se){if(se in ee)return ee[se];return},set(ee,se,ue){return ee[se]=ue,!0}}),Yn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Ye=console;try{let ee=Qo(c,t),se=new Set(Object.keys(P)),ue=Object.keys(n).filter((re)=>!se.has(re)&&!Al.has(re)&&Mt(re)),_e=ue.map((re)=>n[re]);if(!ue.includes("__stxServeContext"))ue.push("__stxServeContext"),_e.push(void 0);if(!se.has("cookies")){let re=n.cookies??n.__stxServeContext?.cookies??{},he=ue.indexOf("cookies");if(he<0)ue.push("cookies"),_e.push(re);else _e[he]=re}let Re=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ve=[],pt=[];for(let[re,he]of Object.entries(P)){if(!Mt(re))continue;if(Re.has(re))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${re}\\b`).test(ee))continue;Ve.push(re),pt.push(he)}let rn=Ol(ee).map((re)=>`module.exports.${re} = typeof ${re} !== 'undefined' ? ${re} : module.exports.${re};`).join(`
405
406
  `),on=n.params??{},Vt=[],an=[];for(let re=0;re<ue.length;re++){if(ue[re]==="params")continue;Vt.push(ue[re]),an.push(_e[re])}let xn=[...gn,...Ve,...Vt],Qe=`return (async () => {
406
407
  ${ee}
407
408
  ${rn}
408
409
  return module.exports
409
- })()`,bt=x(Qe,xn.join("\x00")),qe=oo.get(bt);if(!qe)qe=Function(...xn,Qe),oo.set(bt,qe);let Ue=n.__stx_options?.runtimeConfig;if(Ue||/\buse(?:Server)?RuntimeConfig\b/.test(c))await bn(n,t,Ue);let ce=await Fe(n.__stx_runtime_config??vn()??O(),()=>cr(n,()=>qe(y,v,L,P,D,G,K,B,te,ct,lr,ai,Os,ne,ae,me,Ee,Ce,ze,st,tn,Xn,lt,ut,$e.setResponseStatus,$e.setResponseHeader,$e.notFound,ft,Ct,er,rt,We,Dt,nn,Jn,jt,Q,Xe,Lt,Gn,xt,Ge,Bt,sn,zt,Wt,tr,Ft,Yn,Ye,Ze.confirm,Ze.alert,Ze.fetch,on,...pt,...an)));if(i.preserveExisting){for(let[re,he]of Object.entries(ce))if(!(re in n)||n[re]===void 0)n[re]=he}else Object.assign(n,ce);for(let[re,he]of Object.entries(P))if(!(re in n))n[re]=he}catch(ee){if(n.__stx_strict_hydration)throw ee;let se=Of(ee instanceof Error?ee.message:String(ee));if(Nf(se))console.warn(`[stx] server <script> in ${t??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${se}`),i.onFailure?.({kind:"module-resolution",message:se,error:ee});else if(Df(ee))console.warn(`[stx] server <script> in ${t??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${se}`),i.onFailure?.({kind:"syntax",message:se,error:ee});else if(Mf(se))console.warn(`[stx] server <script> in ${t??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${se}`),i.onFailure?.({kind:"missing-binding",message:se,error:ee});else{let ue=`${t??"<unknown>"}\x00${se}`;if(kt.env.STX_DEBUG||!ao.has(ue))ao.add(ue),console.warn(`[stx] server <script> in ${t??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${se}`);i.onFailure?.({kind:"unknown",message:se,error:ee})}try{await Ll(c,n,t)}catch(ue){if(kt.env.STX_DEBUG){let _e=ue instanceof Error?ue.message:String(ue);console.warn(`[stx] fallback extraction also failed in ${t??"<unknown>"}: ${_e}`)}}}}function Lf(e){let n=0,t=null,i=!1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(t){if(c===t){if(t=null,i||n===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){t=c;continue}if(c==="{")n++;else if(c==="}")n--;else if(e.startsWith("from",l)&&n===0)i=!0}return t===null&&n===0&&a}var Pl=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Qo(e,n){let t=n?Je.dirname(n):kt.cwd(),i=kt.cwd(),a=e.split(`
410
- `),l=[],c=0;while(c<a.length){let y=a[c].trim();if(y.startsWith("interface ")||y.startsWith("export interface ")||y.startsWith("type ")||y.startsWith("export type ")){if(y.includes("{")&&!y.includes("}")){let v=0;for(;c<a.length;c++){for(let R of a[c])if(R==="{")v++;else if(R==="}")v--;if(v<=0)break}}c++;continue}if(y.startsWith("definePageMeta(")){let v=0,R=!1,T=c;for(let L=c;L<a.length&&!R;L++){let P=null,D=!1,G=a[L];for(let K=0;K<G.length;K++){let B=G[K];if(D){D=!1;continue}if(B==="\\"){D=!0;continue}if(P){if(B===P)P=null;continue}if(B==='"'||B==="'"||B==="`"){P=B;continue}if(B==="(")v++;else if(B===")"){if(v--,v===0){c=L+1,R=!0;break}}}}if(!R)c=a.length;let M=a.slice(T,c).join(`
411
- `),N=[];for(let L of["title","description"]){let P=new RegExp(`\\b${L}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(M);if(P)N.push(`${L}: ${JSON.stringify(P[2])}`)}if(N.length>0)l.push(`useSeoMeta({ ${N.join(", ")} });`);continue}if(y.startsWith("import ")||y==="import"||y.startsWith("import{")||/^import['"]/.test(y)){let v=y,R=0;while(!Lf(v)&&c+R+1<a.length)R++,v=`${v} ${a[c+R].trim()}`;c+=R;let T=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),M=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),N=v.match(/^import\s*['"](.+?)['"]/),L=v,P=(D)=>{if(D.startsWith("."))return Je.resolve(t,D);if(D.startsWith("~/")||D.startsWith("@/"))return Je.resolve(i,D.slice(2));try{return Bun.resolveSync(D,t)}catch{return D}};if(T){let[,D,G]=T,K=P(G);l.push(`const ${D} = (await import('${K}')).default`),l.push(`module.exports.${D} = ${D};`)}else if(M){let[,D,G]=M,K=P(G),B=[],Q=[],te=Il.has(G);for(let ne of D.split(",")){let ae=ne.trim();if(!ae)continue;let me=ae.split(/\s+as\s+/);if(me.length===2){let[Ee,Ce]=[me[0].trim(),me[1].trim()];if(te&&ro.has(Ee)){l.push(`const ${Ce} = ${Ee};`);continue}B.push(`${Ee}: ${Ce}`),Q.push(Ce)}else{if(te&&ro.has(ae))continue;B.push(ae),Q.push(ae)}}if(B.length>0)l.push(`const { ${B.join(", ")} } = await import('${K}')`);for(let ne of Q)l.push(`module.exports.${ne} = ${ne};`)}else if(N){let D=P(N[1]);l.push(`await import('${D}')`)}else l.push(L);c++;continue}if(Pl.test(y))l.push(a[c]),c++;else if(y.startsWith("export const ")||y.startsWith("export let ")||y.startsWith("export var ")){let v=lo(a,c),{type:R,name:T,value:M}=v;l.push(`${R} ${T} = ${M};`),l.push(`module.exports.${T} = ${T};`),c=v.nextIndex}else if(y.startsWith("export function ")||y.startsWith("export async function ")){let v=Qs(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(y.startsWith("const ")||y.startsWith("let ")||y.startsWith("var ")){let v=lo(a,c),{type:R,name:T,value:M}=v;l.push(`${R} ${T} = ${M};`),l.push(`module.exports.${T} = ${T};`),c=v.nextIndex}else if(y.startsWith("function ")||y.startsWith("async function ")){let v=Qs(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(y.startsWith("export default function ")||y.startsWith("export default async function ")){let v=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),R=[...a];R[c]=v;let T=Qs(R,c);if(l.push(T.functionCode),T.name)l.push(`module.exports.default = ${T.name};`);c=T.nextIndex}else if(y.startsWith("export default ")){let v=y.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),c++}else if(y.startsWith("class ")||y.startsWith("export class ")){let v=y.match(/(?:export\s+)?class\s+(\w+)/);if(v){let R=v[1],T=a[c].replace(/^export\s+/,""),M=0,N=c;for(;N<a.length;N++){let L=a[N];for(let P of L)if(P==="{")M++;else if(P==="}")M--;if(N>c)T+=`
412
- `+L;if(M<=0&&N>=c)break}l.push(T),l.push(`module.exports.${R} = ${R};`),c=N+1}else l.push(y),c++}else if(y.includes("module.exports"))l.push(y),c++;else if(y.trim()&&!y.startsWith("//"))l.push(y),c++;else c++}return Ml(l.join(`
410
+ })()`,bt=x(Qe,xn.join("\x00")),qe=oo.get(bt);if(!qe)qe=Function(...xn,Qe),oo.set(bt,qe);let Ue=n.__stx_options?.runtimeConfig;if(Ue||/\buse(?:Server)?RuntimeConfig\b/.test(c))await bn(n,t,Ue);let ce=await Fe(n.__stx_runtime_config??vn()??O(),()=>cr(n,()=>qe(y,v,D,P,N,G,K,B,te,ct,lr,ai,Os,ne,ae,me,Ee,Ce,ze,st,tn,Xn,lt,ut,$e.setResponseStatus,$e.setResponseHeader,$e.notFound,ft,Ct,er,rt,We,Dt,nn,Jn,jt,Q,Xe,Lt,Gn,xt,Ge,Bt,sn,zt,Wt,tr,Ft,Yn,Ye,Ze.confirm,Ze.alert,Ze.fetch,on,...pt,...an)));if(i.preserveExisting){for(let[re,he]of Object.entries(ce))if(!(re in n)||n[re]===void 0)n[re]=he}else Object.assign(n,ce);for(let[re,he]of Object.entries(P))if(!(re in n))n[re]=he}catch(ee){if(n.__stx_strict_hydration)throw ee;let se=Of(ee instanceof Error?ee.message:String(ee));if(Nf(se))console.warn(`[stx] server <script> in ${t??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${se}`),i.onFailure?.({kind:"module-resolution",message:se,error:ee});else if(Df(ee))console.warn(`[stx] server <script> in ${t??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${se}`),i.onFailure?.({kind:"syntax",message:se,error:ee});else if(Mf(se))console.warn(`[stx] server <script> in ${t??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${se}`),i.onFailure?.({kind:"missing-binding",message:se,error:ee});else{let ue=`${t??"<unknown>"}\x00${se}`;if(kt.env.STX_DEBUG||!ao.has(ue))ao.add(ue),console.warn(`[stx] server <script> in ${t??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${se}`);i.onFailure?.({kind:"unknown",message:se,error:ee})}try{await Ll(c,n,t)}catch(ue){if(kt.env.STX_DEBUG){let _e=ue instanceof Error?ue.message:String(ue);console.warn(`[stx] fallback extraction also failed in ${t??"<unknown>"}: ${_e}`)}}}}function Lf(e){let n=0,t=null,i=!1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(t){if(c===t){if(t=null,i||n===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){t=c;continue}if(c==="{")n++;else if(c==="}")n--;else if(e.startsWith("from",l)&&n===0)i=!0}return t===null&&n===0&&a}var Pl=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Qo(e,n){let t=n?Je.dirname(n):kt.cwd(),i=kt.cwd(),a=e.split(`
411
+ `),l=[],c=0;while(c<a.length){let y=a[c].trim();if(y.startsWith("interface ")||y.startsWith("export interface ")||y.startsWith("type ")||y.startsWith("export type ")){if(y.includes("{")&&!y.includes("}")){let v=0;for(;c<a.length;c++){for(let R of a[c])if(R==="{")v++;else if(R==="}")v--;if(v<=0)break}}c++;continue}if(y.startsWith("definePageMeta(")){let v=0,R=!1,T=c;for(let D=c;D<a.length&&!R;D++){let P=null,N=!1,G=a[D];for(let K=0;K<G.length;K++){let B=G[K];if(N){N=!1;continue}if(B==="\\"){N=!0;continue}if(P){if(B===P)P=null;continue}if(B==='"'||B==="'"||B==="`"){P=B;continue}if(B==="(")v++;else if(B===")"){if(v--,v===0){c=D+1,R=!0;break}}}}if(!R)c=a.length;let M=a.slice(T,c).join(`
412
+ `),L=[];for(let D of["title","description"]){let P=new RegExp(`\\b${D}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(M);if(P)L.push(`${D}: ${JSON.stringify(P[2])}`)}if(L.length>0)l.push(`useSeoMeta({ ${L.join(", ")} });`);continue}if(y.startsWith("import ")||y==="import"||y.startsWith("import{")||/^import['"]/.test(y)){let v=y,R=0;while(!Lf(v)&&c+R+1<a.length)R++,v=`${v} ${a[c+R].trim()}`;c+=R;let T=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),M=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),L=v.match(/^import\s*['"](.+?)['"]/),D=v,P=(N)=>{if(N.startsWith("."))return Je.resolve(t,N);if(N.startsWith("~/")||N.startsWith("@/"))return Je.resolve(i,N.slice(2));try{return Bun.resolveSync(N,t)}catch{return N}};if(T){let[,N,G]=T,K=P(G);l.push(`const ${N} = (await import('${K}')).default`),l.push(`module.exports.${N} = ${N};`)}else if(M){let[,N,G]=M,K=P(G),B=[],Q=[],te=Il.has(G);for(let ne of N.split(",")){let ae=ne.trim();if(!ae)continue;let me=ae.split(/\s+as\s+/);if(me.length===2){let[Ee,Ce]=[me[0].trim(),me[1].trim()];if(te&&ro.has(Ee)){l.push(`const ${Ce} = ${Ee};`);continue}B.push(`${Ee}: ${Ce}`),Q.push(Ce)}else{if(te&&ro.has(ae))continue;B.push(ae),Q.push(ae)}}if(B.length>0)l.push(`const { ${B.join(", ")} } = await import('${K}')`);for(let ne of Q)l.push(`module.exports.${ne} = ${ne};`)}else if(L){let N=P(L[1]);l.push(`await import('${N}')`)}else l.push(D);c++;continue}if(Pl.test(y))l.push(a[c]),c++;else if(y.startsWith("export const ")||y.startsWith("export let ")||y.startsWith("export var ")){let v=lo(a,c),{type:R,name:T,value:M}=v;l.push(`${R} ${T} = ${M};`),l.push(`module.exports.${T} = ${T};`),c=v.nextIndex}else if(y.startsWith("export function ")||y.startsWith("export async function ")){let v=Qs(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(y.startsWith("const ")||y.startsWith("let ")||y.startsWith("var ")){let v=lo(a,c),{type:R,name:T,value:M}=v;l.push(`${R} ${T} = ${M};`),l.push(`module.exports.${T} = ${T};`),c=v.nextIndex}else if(y.startsWith("function ")||y.startsWith("async function ")){let v=Qs(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(y.startsWith("export default function ")||y.startsWith("export default async function ")){let v=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),R=[...a];R[c]=v;let T=Qs(R,c);if(l.push(T.functionCode),T.name)l.push(`module.exports.default = ${T.name};`);c=T.nextIndex}else if(y.startsWith("export default ")){let v=y.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),c++}else if(y.startsWith("class ")||y.startsWith("export class ")){let v=y.match(/(?:export\s+)?class\s+(\w+)/);if(v){let R=v[1],T=a[c].replace(/^export\s+/,""),M=0,L=c;for(;L<a.length;L++){let D=a[L];for(let P of D)if(P==="{")M++;else if(P==="}")M--;if(L>c)T+=`
413
+ `+D;if(M<=0&&L>=c)break}l.push(T),l.push(`module.exports.${R} = ${R};`),c=L+1}else l.push(y),c++}else if(y.includes("module.exports"))l.push(y),c++;else if(y.trim()&&!y.startsWith("//"))l.push(y),c++;else c++}return Ml(l.join(`
413
414
  `),t,i)}function Ml(e,n,t){let i=e.length,a="",l=0,c=null,y=!1,v=!1,R=0;while(l<i){let T=e[l],M=e[l+1];if(y){if(a+=T,T===`
414
- `)y=!1;l++;continue}if(v){if(a+=T,T==="*"&&M==="/"){a+=M,l+=2,v=!1;continue}l++;continue}if(!c&&T==="/"&&M==="/"){y=!0,a+=T,l++;continue}if(!c&&T==="/"&&M==="*"){v=!0,a+=T,l++;continue}if(c){if(a+=T,T==="\\"){a+=M,l+=2;continue}if(T===c&&c!=="`"){c=null,l++;continue}if(c==="`"){if(T==="$"&&M==="{"){R++,a+=M,l+=2;continue}if(T==="`"){c=null,l++;continue}}l++;continue}if(R>0){if(T==="{")R++;else if(T==="}")R--}if(T==='"'||T==="'"||T==="`"){c=T,a+=T,l++;continue}if(T==="a"&&e.startsWith("await",l)){let N=Dl(e,l);if(N){let{quote:L,path:P,end:D}=N;if(P.startsWith(".")||P.startsWith("~/")||P.startsWith("@/")){let G=P.startsWith(".")?Je.resolve(n,P):Je.resolve(t,P.slice(2));a+=`await import(${L}${G}${L})`,l=D;continue}}}a+=T,l++}return a}function Dl(e,n){let t=n+5;if(t>=e.length)return null;if(!/\s/.test(e[t]))return null;while(t<e.length&&/\s/.test(e[t]))t++;if(!e.startsWith("import",t))return null;t+=6;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!=="(")return null;t++;while(t<e.length&&/\s/.test(e[t]))t++;let i=e[t];if(i!=="'"&&i!=='"')return null;t++;let a=t;while(t<e.length&&e[t]!==i)if(e[t]==="\\")t+=2;else t++;if(t>=e.length)return null;let l=e.slice(a,t);t++;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!==")")return null;return{quote:i,path:l,end:t+1}}function go(e,n){let t=e[n];if(t!=="{"&&t!=="[")return null;let a=b(e,t,t==="{"?"}":"]",n);if(a===-1)return null;return{pattern:e.slice(n,a+1),endPos:a+1}}function mo(e){let n=[],t=e.slice(1,-1).trim();if(!t)return n;let i=0,a=0,l="";while(i<t.length){let c=t[i];if(c==="{"||c==="["){let y=a===0?go(t,i):null;if(y){n.push(...mo(y.pattern)),i=y.endPos,l="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){i++;continue}if(c===","){if(l.trim())n.push(l.trim());l="",i++;continue}if(c===":"){l="",i++;continue}if(c==="="){if(l.trim())n.push(l.trim());l="",i++;while(i<t.length&&t[i]!==","&&a===0){if(t[i]==="{"||t[i]==="[")a++;else if(t[i]==="}"||t[i]==="]")a--;i++}continue}if(/[\w$]/.test(c))l+=c;i++}if(l.trim())n.push(l.trim());return n}function jf(e){let n=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!n)return null;let t=n[0].length,i=(a)=>a===" "||a==="\t";while(t<e.length&&i(e[t]))t++;if(e[t]===":"){let a=0,l=null;t++;for(;t<e.length;t++){let c=e[t];if(l){if(c==="\\"){t++;continue}if(c===l)l=null;continue}if(c==="'"||c==='"'||c==="`"){l=c;continue}if(c==="("||c==="["||c==="{"||c==="<"){a++;continue}if(c===")"||c==="]"||c==="}"||c===">"){a--;continue}if(c==="="&&a<=0){let y=e[t+1],v=e[t-1];if(y!=="="&&y!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")break}}if(e[t]!=="=")return null}while(t<e.length&&i(e[t]))t++;if(e[t]!=="=")return null;return{type:n[1],name:n[2],value:e.slice(t+1).trim()}}function co(e,n,t,i){let a=null,l=!1;for(let c of e){if(l){l=!1;continue}if(c==="\\"){l=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c===n)i++;else if(c===t)i--}return i}function lo(e,n){let t=e[n].trim(),i=jf(t),a=i?[t,i.type,i.name,i.value]:null;if(!a){let T=t.match(/^(?:export\s+)?(const|let|var)\s+/);if(T){let M=t.slice(T[0].length),N=n;if(M.startsWith("{")||M.startsWith("[")){let P=M[0],D=P==="{"?"}":"]",G=co(M,P,D,0),K=M;for(let B=n+1;B<e.length&&G>0;B++)K+=` ${e[B].trim()}`,N=B,G=co(e[B],P,D,G);if(G>0)K=M,N=n;M=K}let L=go(M,0);if(L){let P=T[1],D=L.pattern,G=M.slice(L.endPos).trim();if(G.startsWith("=")){let K=G.slice(1).trim(),B=K,Q=Math.max(N,n);if(uo(K)){let me=fo(e,Q,K);B=me.value,Q=me.nextIndex}else Q=Q+1;B=B.trim().replace(/;$/,"");let te=mo(D),ne=`__stx_src_${n}`,ae=te.map((me)=>`module.exports.${me} = ${me};`).join(`
415
- `);return{type:P,name:ne,value:`${B}; ${P} ${D} = ${ne};
415
+ `)y=!1;l++;continue}if(v){if(a+=T,T==="*"&&M==="/"){a+=M,l+=2,v=!1;continue}l++;continue}if(!c&&T==="/"&&M==="/"){y=!0,a+=T,l++;continue}if(!c&&T==="/"&&M==="*"){v=!0,a+=T,l++;continue}if(c){if(a+=T,T==="\\"){a+=M,l+=2;continue}if(T===c&&c!=="`"){c=null,l++;continue}if(c==="`"){if(T==="$"&&M==="{"){R++,a+=M,l+=2;continue}if(T==="`"){c=null,l++;continue}}l++;continue}if(R>0){if(T==="{")R++;else if(T==="}")R--}if(T==='"'||T==="'"||T==="`"){c=T,a+=T,l++;continue}if(T==="a"&&e.startsWith("await",l)){let L=Dl(e,l);if(L){let{quote:D,path:P,end:N}=L;if(P.startsWith(".")||P.startsWith("~/")||P.startsWith("@/")){let G=P.startsWith(".")?Je.resolve(n,P):Je.resolve(t,P.slice(2));a+=`await import(${D}${G}${D})`,l=N;continue}}}a+=T,l++}return a}function Dl(e,n){let t=n+5;if(t>=e.length)return null;if(!/\s/.test(e[t]))return null;while(t<e.length&&/\s/.test(e[t]))t++;if(!e.startsWith("import",t))return null;t+=6;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!=="(")return null;t++;while(t<e.length&&/\s/.test(e[t]))t++;let i=e[t];if(i!=="'"&&i!=='"')return null;t++;let a=t;while(t<e.length&&e[t]!==i)if(e[t]==="\\")t+=2;else t++;if(t>=e.length)return null;let l=e.slice(a,t);t++;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!==")")return null;return{quote:i,path:l,end:t+1}}function go(e,n){let t=e[n];if(t!=="{"&&t!=="[")return null;let a=b(e,t,t==="{"?"}":"]",n);if(a===-1)return null;return{pattern:e.slice(n,a+1),endPos:a+1}}function mo(e){let n=[],t=e.slice(1,-1).trim();if(!t)return n;let i=0,a=0,l="";while(i<t.length){let c=t[i];if(c==="{"||c==="["){let y=a===0?go(t,i):null;if(y){n.push(...mo(y.pattern)),i=y.endPos,l="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){i++;continue}if(c===","){if(l.trim())n.push(l.trim());l="",i++;continue}if(c===":"){l="",i++;continue}if(c==="="){if(l.trim())n.push(l.trim());l="",i++;while(i<t.length&&t[i]!==","&&a===0){if(t[i]==="{"||t[i]==="[")a++;else if(t[i]==="}"||t[i]==="]")a--;i++}continue}if(/[\w$]/.test(c))l+=c;i++}if(l.trim())n.push(l.trim());return n}function jf(e){let n=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!n)return null;let t=n[0].length,i=(a)=>a===" "||a==="\t";while(t<e.length&&i(e[t]))t++;if(e[t]===":"){let a=0,l=null;t++;for(;t<e.length;t++){let c=e[t];if(l){if(c==="\\"){t++;continue}if(c===l)l=null;continue}if(c==="'"||c==='"'||c==="`"){l=c;continue}if(c==="("||c==="["||c==="{"||c==="<"){a++;continue}if(c===")"||c==="]"||c==="}"||c===">"){a--;continue}if(c==="="&&a<=0){let y=e[t+1],v=e[t-1];if(y!=="="&&y!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")break}}if(e[t]!=="=")return null}while(t<e.length&&i(e[t]))t++;if(e[t]!=="=")return null;return{type:n[1],name:n[2],value:e.slice(t+1).trim()}}function co(e,n,t,i){let a=null,l=!1;for(let c of e){if(l){l=!1;continue}if(c==="\\"){l=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c===n)i++;else if(c===t)i--}return i}function lo(e,n){let t=e[n].trim(),i=jf(t),a=i?[t,i.type,i.name,i.value]:null;if(!a){let T=t.match(/^(?:export\s+)?(const|let|var)\s+/);if(T){let M=t.slice(T[0].length),L=n;if(M.startsWith("{")||M.startsWith("[")){let P=M[0],N=P==="{"?"}":"]",G=co(M,P,N,0),K=M;for(let B=n+1;B<e.length&&G>0;B++)K+=` ${e[B].trim()}`,L=B,G=co(e[B],P,N,G);if(G>0)K=M,L=n;M=K}let D=go(M,0);if(D){let P=T[1],N=D.pattern,G=M.slice(D.endPos).trim();if(G.startsWith("=")){let K=G.slice(1).trim(),B=K,Q=Math.max(L,n);if(uo(K)){let me=fo(e,Q,K);B=me.value,Q=me.nextIndex}else Q=Q+1;B=B.trim().replace(/;$/,"");let te=mo(N),ne=`__stx_src_${n}`,ae=te.map((me)=>`module.exports.${me} = ${me};`).join(`
416
+ `);return{type:P,name:ne,value:`${B}; ${P} ${N} = ${ne};
416
417
  ${ae}`,nextIndex:Q}}}}throw Error(`Failed to parse variable declaration: ${t}`)}let[,l,c,y]=a,v=y,R=n;if(uo(y)){let T=fo(e,n,y);v=T.value,R=T.nextIndex}else R=n+1;while(R<e.length){let T=e[R].trim();if(T.startsWith(".")||T.startsWith("?."))v+=`
417
418
  ${e[R]}`,R++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:c,value:v,nextIndex:R}}function Qs(e,n){let t=e[n].trim(),i=t.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!i)throw Error(`Failed to parse function declaration: ${t}`);let[,a]=i,l=t.replace(/^export\s+/,""),c=n;if(jl(t)){let y=Nl(e,n,l);l=y.functionCode,c=y.nextIndex}else c=n+1;return{name:a,functionCode:l,nextIndex:c}}function uo(e){let n=e.trim();if(n.startsWith("{"))return b(n,"{","}",0)===-1;if(n.startsWith("["))return b(n,"[","]",0)===-1;return!ho(n)}function ho(e){let n={paren:0,bracket:0,brace:0},t=null,i=0;for(let a=0;a<e.length;a++){let l=e[a];if((a>0?e[a-1]:"")==="\\"&&t)continue;if((l==='"'||l==="'")&&!t){t=l;continue}if(l===t&&t!=="`"){t=null;continue}if(l==="`"&&!t){t="`";continue}if(l==="`"&&t==="`"&&i===0){t=null;continue}if(t==="`"&&l==="$"&&e[a+1]==="{"){i++,a++;continue}if(i>0&&l==="{"){i++;continue}if(i>0&&l==="}"){i--;continue}if(t)continue;if(l==="(")n.paren++;else if(l===")")n.paren--;else if(l==="[")n.bracket++;else if(l==="]")n.bracket--;else if(l==="{")n.brace++;else if(l==="}")n.brace--}return n.paren===0&&n.bracket===0&&n.brace===0&&t===null}function xo(e){let n=e.indexOf("(");if(n===-1)return e.indexOf("{");let t=b(e,"(",")",n);if(t===-1)return-1;return e.indexOf("{",t)}function jl(e){let n=xo(e);if(n===-1)return!0;return b(e,"{","}",n)===-1}function fo(e,n,t){let i=t,a=n+1;while(a<e.length&&!ho(i)){let l=e[a];i+=`
418
419
  ${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))i+=`
419
420
  ${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function Nl(e,n,t){let i=t,a=n+1;while(a<e.length){let l=xo(i);if(l!==-1){if(b(i,"{","}",l)!==-1)break}let c=e[a];i+=`
420
421
  ${c}`,a++}return{functionCode:i,nextIndex:a}}function po(e,n){let t=u(e,n)??u(`(${e})`,n);if(t!==void 0)return t;if(!/\bprocess\b/.test(e))return;let i={...n,process:Object.freeze({env:{...kt.env}})},a=Object.keys(i).filter(Mt),l=a.map((c)=>i[c]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function Ll(e,n,t){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of i){let[,,c,y]=l;try{let v=y.trim().replace(/;$/,""),R=po(v,n);if(R!==void 0)n[c]=R}catch(v){console.warn(`Failed to parse export ${c} in fallback:`,v)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let l of a){let[,,c,y]=l;if(!(c in n))try{let v=y.trim().replace(/;$/,""),R=po(v,n);if(R!==void 0)n[c]=R}catch{}}}function $c(e){let n=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),t=n?n[1]:"",i=n?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:t,templateWithoutScript:i}}function Rc(e){let n=e.trim();if(!n)return!1;return/(?:const|let|var|function)\s+\w+/.test(n)}
421
- export{Pe,ve,F,vs,ws,z,xs,Ss,ks,Uo,Wo,qo,dc,Tt,cn,o,ln,V,$t,oe,w,pc,x,gr,_s,we,_,Ie,de,mr,U,un,Oe,C,fc,pe,X,hr,Cs,ie,Rt,J,I,tt,yr,br,At,Go,Ko,Pf,Ne,gc,mc,hc,Xo,yc,Es,Jo,bc,vc,wc,Yo,dn,Ts,pn,Pt,It,xc,$s,Sc,fn,vr,Rs,As,kc,Zo,_c,Cc,Ec,Tc,gn,If,Of,Nf,Df,Mf,m,Lf,Qo,jf,$c,Rc,ei,ti,Bf,Ot,Ac,ni,Pc,vh,De,mn,Me,Ff,zf,Hf,Vf,Uf,Ps,Wf,Le,Y,je,qf,wr,Gf,Ic,ri,Be,r,hn,Oc,h,fe,wh,Nc,Dc,Mc,si,Is,Kf,xh,Xf,Sh,Nt,p,H,Z,yn,xe,Jf,oi,Yf,kh,S,Zf,_h,E,Ch};
422
+ export{Pe,ve,F,vs,ws,z,xs,Ss,ks,Uo,Wo,qo,dc,Tt,cn,o,ln,V,$t,oe,w,pc,x,gr,_s,we,_,Ie,de,mr,U,un,Oe,C,fc,pe,X,hr,Cs,ie,Rt,J,I,tt,yr,br,At,Ko,Go,Pf,Ne,gc,mc,hc,Xo,yc,Es,Jo,bc,vc,wc,Yo,dn,Ts,pn,Pt,It,xc,$s,Sc,fn,vr,Rs,As,kc,Zo,_c,Cc,Ec,Tc,gn,If,Of,Nf,Df,Mf,m,Lf,Qo,jf,$c,Rc,ei,ti,Bf,Ot,Ac,ni,Pc,vh,De,mn,Me,Ff,zf,Hf,Vf,Uf,Ps,Wf,Le,Y,je,qf,wr,Kf,Ic,ri,Be,r,hn,Oc,h,fe,wh,Nc,Dc,Mc,si,Is,Gf,xh,Xf,Sh,Nt,p,H,Z,yn,xe,Jf,oi,Yf,kh,S,Zf,_h,E,Ch};