@stacksjs/stx 0.2.817 → 0.2.819
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-pyytr30r.js → chunk-035m9ada.js} +3 -3
- package/dist/chunk-03mtfndv.js +2 -0
- package/dist/chunk-0633xsmx.js +2 -0
- package/dist/{chunk-hhazm0cs.js → chunk-0s93s6ep.js} +3 -3
- package/dist/chunk-0wrmcexg.js +2 -0
- package/dist/chunk-12sd0ep5.js +1327 -0
- package/dist/chunk-18qxd18d.js +2 -0
- package/dist/{chunk-d47m4qat.js → chunk-1a8qtvs1.js} +2 -2
- package/dist/{chunk-s9xs2ff4.js → chunk-1ae3megp.js} +5 -5
- package/dist/chunk-1cd0w20k.js +2 -0
- package/dist/{chunk-549end3k.js → chunk-1hg0zb3p.js} +2 -2
- package/dist/{chunk-ccxphr19.js → chunk-1p3vmy65.js} +2 -2
- package/dist/{chunk-p8wq37hd.js → chunk-1rvgv1fr.js} +5 -5
- package/dist/{chunk-n761hp6d.js → chunk-1tzqqr0p.js} +2 -2
- package/dist/chunk-2k3ga51z.js +2 -0
- package/dist/{chunk-n9av365c.js → chunk-3dg2zg8d.js} +1 -1
- package/dist/{chunk-5efv1fhk.js → chunk-4fbg7gq8.js} +2 -2
- package/dist/{chunk-agxjwnz0.js → chunk-4gg9594a.js} +8 -8
- package/dist/{chunk-y3p6w1e0.js → chunk-4jaet63w.js} +5 -5
- package/dist/chunk-54kn2jtw.js +2 -0
- package/dist/chunk-54mc7876.js +2 -0
- package/dist/{chunk-2p3eaj16.js → chunk-6a0ekt1n.js} +3 -3
- package/dist/chunk-6e76tz09.js +2 -0
- package/dist/{chunk-bphwhfbd.js → chunk-6n11z33h.js} +5 -5
- package/dist/{chunk-7rk7wfm6.js → chunk-72jt897s.js} +13 -13
- package/dist/chunk-72w08sh9.js +2 -0
- package/dist/{chunk-dy7yccxm.js → chunk-7c5b0th8.js} +7 -7
- package/dist/chunk-7p7hdn42.js +2 -0
- package/dist/chunk-88mhhbqj.js +2 -0
- package/dist/{chunk-a0r4dpzs.js → chunk-8dmey36n.js} +2 -2
- package/dist/{chunk-gtfs96f2.js → chunk-93f6kwht.js} +2 -2
- package/dist/chunk-9736003n.js +2 -0
- package/dist/chunk-9b52cnzm.js +2 -0
- package/dist/chunk-9bhvh2dc.js +2 -0
- package/dist/{chunk-17wb2x3z.js → chunk-9egd7tx3.js} +2 -2
- package/dist/{chunk-2ws2qe1k.js → chunk-9gwhs0gk.js} +2 -2
- package/dist/chunk-9y1dm510.js +2 -0
- package/dist/chunk-a4yzet7p.js +2 -0
- package/dist/chunk-abzrvxct.js +2 -0
- package/dist/chunk-avbvedyx.js +2 -0
- package/dist/{chunk-cm5cp3m0.js → chunk-ax16vnn5.js} +4 -4
- package/dist/{chunk-3vpgr6nk.js → chunk-b9d70mgr.js} +3 -3
- package/dist/{chunk-pdnyhs63.js → chunk-bnewgd23.js} +1 -1
- package/dist/{chunk-4ws3yz5q.js → chunk-brbqz5he.js} +8 -8
- package/dist/{chunk-5hxvhmg3.js → chunk-cbt1dchd.js} +4 -4
- package/dist/chunk-cvq4bz8y.js +2 -0
- package/dist/chunk-d7p5jr31.js +2 -0
- package/dist/chunk-dh1f8ga0.js +2 -0
- package/dist/{chunk-6cw072n5.js → chunk-dq9djbgq.js} +4 -4
- package/dist/chunk-dzp2a775.js +2 -0
- package/dist/{chunk-tb4wmzzd.js → chunk-e3t2bqyf.js} +5 -5
- package/dist/{chunk-fcvyk047.js → chunk-e4d0jgcw.js} +7 -7
- package/dist/{chunk-rxt4jj9b.js → chunk-e758jz81.js} +6 -6
- package/dist/{chunk-1fc6rax4.js → chunk-ek5ynvqh.js} +2 -2
- package/dist/{chunk-jg9f5nqf.js → chunk-em2yy1te.js} +6 -6
- package/dist/{chunk-m0x96g8e.js → chunk-f6nk205v.js} +1 -1
- package/dist/chunk-f86ehf7n.js +2 -0
- package/dist/{chunk-f54t0qar.js → chunk-fmawgk87.js} +1 -1
- package/dist/chunk-fn2cqvb1.js +2 -0
- package/dist/chunk-fzj3e3zk.js +2 -0
- package/dist/{chunk-gqjb1y7c.js → chunk-g7mjv276.js} +2 -2
- package/dist/{chunk-p5ez40kf.js → chunk-gahpv8ce.js} +2 -2
- package/dist/{chunk-r6dtrd7y.js → chunk-gcje06er.js} +30 -30
- package/dist/chunk-gsc617cx.js +2 -0
- package/dist/{chunk-1bgv727x.js → chunk-gtd6qs1r.js} +2 -2
- package/dist/chunk-h8kbcz9t.js +2 -0
- package/dist/{chunk-rc424p1c.js → chunk-he8rmsdq.js} +24 -24
- package/dist/chunk-hx575xy8.js +2 -0
- package/dist/{chunk-0jcady6w.js → chunk-j476jghg.js} +1 -1
- package/dist/chunk-j58z3y2g.js +2 -0
- package/dist/chunk-j5t40n2g.js +2 -0
- package/dist/{chunk-kvhsdyfg.js → chunk-j8r0am39.js} +1 -1
- package/dist/chunk-jcz6rd9n.js +2 -0
- package/dist/{chunk-yvqe0pzk.js → chunk-jdddw8en.js} +2 -2
- package/dist/{chunk-kjjvs3sc.js → chunk-jgj16jmg.js} +2 -2
- package/dist/{chunk-nmkkfpmh.js → chunk-jw7cakxt.js} +6 -6
- package/dist/{chunk-0h99mrb0.js → chunk-k3t72x38.js} +2 -2
- package/dist/{chunk-0svj1nfa.js → chunk-k3zcadcc.js} +2 -2
- package/dist/chunk-k5nd8zqh.js +2 -0
- package/dist/{chunk-df60fpgx.js → chunk-kz6qw9fm.js} +3 -3
- package/dist/{chunk-crmxg1c0.js → chunk-m7kct2sg.js} +4 -4
- package/dist/{chunk-jtx9x3as.js → chunk-m9dyqae7.js} +6 -6
- package/dist/{chunk-r5nt1bcx.js → chunk-mbhvf0sv.js} +2 -2
- package/dist/chunk-mcgqgheq.js +2 -0
- package/dist/{chunk-fn3q1gtr.js → chunk-mjg9cx5a.js} +3 -3
- package/dist/{chunk-xrd1md4j.js → chunk-mr2ke5km.js} +6 -6
- package/dist/chunk-mz1mgfq3.js +3 -0
- package/dist/chunk-n1tbc7da.js +2 -0
- package/dist/chunk-n7dm6prj.js +2 -0
- package/dist/{chunk-sa0nkpx9.js → chunk-ngh1aeff.js} +2 -2
- package/dist/chunk-nknpr8cy.js +2 -0
- package/dist/{chunk-jham85mf.js → chunk-nqdh7z2d.js} +1 -1
- package/dist/chunk-nqn4dvqd.js +2 -0
- package/dist/chunk-nt5dh56c.js +2 -0
- package/dist/chunk-p04dabqm.js +2 -0
- package/dist/{chunk-b5ckg7zq.js → chunk-p3dc6rg2.js} +5 -5
- package/dist/{chunk-cj1p3qdh.js → chunk-p7hy0seh.js} +1 -1
- package/dist/chunk-pe89ztq6.js +2 -0
- package/dist/chunk-pe9npaby.js +2 -0
- package/dist/chunk-pmq2pdr9.js +2 -0
- package/dist/chunk-r2v042ym.js +2 -0
- package/dist/chunk-r3zmbpv2.js +2 -0
- package/dist/chunk-r57s8jqs.js +2 -0
- package/dist/{chunk-133vw0ae.js → chunk-rccv14mn.js} +4 -4
- package/dist/chunk-rjzp7za8.js +2 -0
- package/dist/{chunk-yts2b9d8.js → chunk-s6mte5vy.js} +11 -6
- package/dist/{chunk-vkn133cs.js → chunk-s9b6abkb.js} +2 -2
- package/dist/chunk-sata7rh2.js +2 -0
- package/dist/{chunk-8h3jv8dd.js → chunk-sh1hbhhb.js} +2 -2
- package/dist/{chunk-5gxneecs.js → chunk-sjd6rt97.js} +3 -3
- package/dist/{chunk-ntn6bnjv.js → chunk-skht06a2.js} +1 -1
- package/dist/{chunk-s90m43sm.js → chunk-sxad7x2s.js} +4 -4
- package/dist/{chunk-w6n4y2xg.js → chunk-tj6zvs8f.js} +2 -2
- package/dist/chunk-tsb5h4e2.js +2 -0
- package/dist/{chunk-hg67a15h.js → chunk-v041eh5f.js} +3 -3
- package/dist/chunk-v7h8vd9n.js +2 -0
- package/dist/chunk-v8h2kns0.js +2 -0
- package/dist/chunk-vhzngsmd.js +709 -0
- package/dist/{chunk-ncyjaxyz.js → chunk-vmxzktdr.js} +1 -1
- package/dist/{chunk-1wdv3zj2.js → chunk-vvcfrsjg.js} +1 -1
- package/dist/chunk-vyw40ym7.js +2 -0
- package/dist/chunk-whq40bdm.js +2 -0
- package/dist/{chunk-vbrn4w81.js → chunk-x46hqa74.js} +3 -3
- package/dist/{chunk-0ekdbagy.js → chunk-xc7nynb9.js} +2 -2
- package/dist/{chunk-gc7pykfq.js → chunk-xka9fdye.js} +2 -2
- package/dist/chunk-xsck49x5.js +2 -0
- package/dist/chunk-z0c35c5c.js +2 -0
- package/dist/{chunk-e39nkbt4.js → chunk-zhvmcj78.js} +4 -4
- package/dist/{chunk-sphc7xzx.js → chunk-znx5m1jv.js} +1 -1
- package/dist/chunk-zwp7n01x.js +2 -0
- package/dist/cli.js +12 -12
- package/dist/client/signals-expression-runtime.js +6 -2
- package/dist/client/signals-public-api-runtime.js +1 -0
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/process.js +2 -2
- package/dist/pwa.js +3 -3
- package/dist/reactive.d.ts +12 -2
- package/dist/reactive.js +69 -32
- package/dist/ssg.js +10 -10
- package/dist/utils.js +6 -1
- package/package.json +5 -5
- package/dist/chunk-0yjm4j26.js +0 -2
- package/dist/chunk-1kz70290.js +0 -2
- package/dist/chunk-1rwfgmmk.js +0 -2
- package/dist/chunk-2k3qtmn8.js +0 -2
- package/dist/chunk-2vget8rh.js +0 -2
- package/dist/chunk-3e85etrf.js +0 -2
- package/dist/chunk-3eqs0rpv.js +0 -2
- package/dist/chunk-3ftaegqg.js +0 -2
- package/dist/chunk-3jd5ak8h.js +0 -2
- package/dist/chunk-4ypwqrj2.js +0 -2
- package/dist/chunk-5eqna31h.js +0 -2
- package/dist/chunk-6a97a9wk.js +0 -2
- package/dist/chunk-7agp0wj2.js +0 -2
- package/dist/chunk-7hch54b2.js +0 -2
- package/dist/chunk-7pb9fepg.js +0 -2
- package/dist/chunk-8g8h2xwz.js +0 -2
- package/dist/chunk-9mtw71xy.js +0 -2
- package/dist/chunk-9ttf7k5e.js +0 -2
- package/dist/chunk-9wmjmas8.js +0 -2
- package/dist/chunk-a350jjd3.js +0 -2
- package/dist/chunk-aqydav9y.js +0 -2
- package/dist/chunk-ar7w1kx0.js +0 -2
- package/dist/chunk-aya8nv31.js +0 -2
- package/dist/chunk-b9ntt41z.js +0 -2
- package/dist/chunk-bj6ax0he.js +0 -2
- package/dist/chunk-cxpnkgvw.js +0 -2
- package/dist/chunk-d3gncxq1.js +0 -2
- package/dist/chunk-da886asf.js +0 -2
- package/dist/chunk-dnemxdvy.js +0 -2
- package/dist/chunk-dnqt6y8v.js +0 -3
- package/dist/chunk-f0bwetnx.js +0 -421
- package/dist/chunk-gzhrtymg.js +0 -1592
- package/dist/chunk-h9yvb9qn.js +0 -2
- package/dist/chunk-hsmwzzy2.js +0 -2
- package/dist/chunk-jsvc264s.js +0 -2
- package/dist/chunk-k98nt4pk.js +0 -2
- package/dist/chunk-ka1hrt56.js +0 -2
- package/dist/chunk-m477m5dp.js +0 -2
- package/dist/chunk-mkr46mzz.js +0 -2
- package/dist/chunk-mmyrdbxx.js +0 -2
- package/dist/chunk-p4f1hrvn.js +0 -2
- package/dist/chunk-py244ymg.js +0 -2
- package/dist/chunk-rp6b7awz.js +0 -2
- package/dist/chunk-rqfg21xk.js +0 -2
- package/dist/chunk-rxc1076r.js +0 -2
- package/dist/chunk-rzwyaqgg.js +0 -2
- package/dist/chunk-s5pegavh.js +0 -2
- package/dist/chunk-sj4vw93g.js +0 -2
- package/dist/chunk-snfjvd94.js +0 -2
- package/dist/chunk-syvsj91a.js +0 -2
- package/dist/chunk-tzb0n60s.js +0 -2
- package/dist/chunk-w8xvkbt9.js +0 -2
- package/dist/chunk-x5rt4kpx.js +0 -2
- package/dist/chunk-xbknqp19.js +0 -2
- package/dist/chunk-xgqyzkt2.js +0 -2
- package/dist/chunk-yd0074ks.js +0 -2
- package/dist/chunk-yd1zsy7t.js +0 -2
- package/dist/chunk-yjezsy4p.js +0 -2
- package/dist/chunk-yjvwp1s6.js +0 -2
|
@@ -0,0 +1,709 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ze,xn,Ws,xi,N}from"./chunk-m7hfcxt3.js";import{vn}from"./chunk-bnewgd23.js";import{Or,k,ul,at,Ri,dl}from"./chunk-1tzqqr0p.js";import{P}from"./chunk-r9e0r6jx.js";import{T,qs,u,f,jt,d,q,F,x,Js,_e,Ve,Ys}from"./chunk-72jt897s.js";import{r,ge}from"./chunk-b9d70mgr.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-c5vzr1va.js";import nt from"path";import Ct from"process";import{AsyncLocalStorage as Ko}from"async_hooks";var dr=new Ko;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function gr(e,t){return dr.run(mn(e),t)}async function mr(e,t){let i=dr.getStore();if(!i)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 n=i.pending.get(e);if(n)return n;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),y=JSON.parse(c);return i.values.set(e,y),y}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,a),a}function _r(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function H(e,t=!1){let i=r(e),n=[],a=new Set,l=0,c=0,y=i.length,v=()=>{if(l!==0)return;let E=i.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let I=E[2];if(!a.has(I))n.push(I),a.add(I);return}let A=i.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(c).startsWith("const"))return;A[1].split(",").forEach((I)=>{let z=I.trim();if(!z)return;let L=z.indexOf(":"),Q=(L>=0?z.slice(L+1).trim():z).split(/[\s=]/)[0];if(Q&&!a.has(Q))n.push(Q),a.add(Q)});return}let j=i.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(t&&i.slice(c).startsWith("const"))return;j[1].split(",").forEach((I)=>{let z=I.trim().replace(/^\.\.\./,"");if(!z)return;let L=z.split(/[\s=]/)[0];if(L&&!a.has(L))n.push(L),a.add(L)});return}if(t)return;let X=i.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(X){let I=X[1];if(!a.has(I))n.push(I),a.add(I);return}let M=i.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!a.has(I))n.push(I),a.add(I)}};while(c<y){if(i[c]==="{"){l++,c++;continue}if(i[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(i[c])&&(c===0||/\s|[;{}()]/.test(i[c-1])))v();c++}return n.join(", ")}function Ps(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Xo(e,t=H(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(H(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Is(e,t){let i=`{ ${Xo(e,t)} }`;return H(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import vt from"fs";import Ee from"path";function V(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var hr=new Map;function yr(e,t=!0){let i=hr.get(e);if(t&&i)return i;let n=new Map,a=[Ee.join(e,"src"),Ee.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=vt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let A=Ee.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let j=E.name.slice(0,-4);if(!n.has(j))n.set(j,A);let X=j.toLowerCase();if(!n.has(X))n.set(X,A);let M=V(j);if(!n.has(M))n.set(M,A)}}}for(let c of a)if(l(c,0),n.size>0)break;if(t)hr.set(e,n);return n}function Os(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=Ee.join(i,"node_modules",e);try{if(vt.statSync(n).isDirectory())return n}catch{}let a=Ee.dirname(i);if(a===i)return null;i=a}}function Ns(e,t,i={}){return[Ee.resolve(Ee.dirname(t),`${e}.stx`),Ee.resolve(Ee.dirname(t),e),Ee.resolve(i.componentsDir||"components",`${e}.stx`),Ee.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function $r(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),n=V(t);return[t,i,n]}function oi(e,t){let[i,n,a]=$r(e);for(let l of[i,i.toLowerCase(),n,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function Jo(e,t){let i=t?Ee.resolve(t):void 0,n=Ee.dirname(Ee.resolve(e));for(;;){if(vt.existsSync(Ee.join(n,"package.json")))return i&&n===i?void 0:n;let a=Ee.dirname(n);if(a===n)return;n=a}}var Go=["src/ui","src/components","components","dist"];function cs(e,t){let i=Ee.resolve(e);if(!t&&!i.split(Ee.sep).includes("node_modules"))return[];let n=Jo(i,t);if(!n)return[];let a=[];try{let y=JSON.parse(vt.readFileSync(Ee.join(n,"package.json"),"utf8")).stx?.components;if(Array.isArray(y))a=y.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:Go;return[Ee.dirname(Ee.resolve(e)),...l.map((c)=>Ee.resolve(n,c))]}function*ii(e,t,i={},n){let a=$r(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ee.resolve(Ee.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=i.projectRoot||process.cwd(),y=[...cs(t,i.projectRoot),...n?.__originalFilePath?[Ee.join(Ee.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],Ee.join(Ee.dirname(t),"components"),Ee.resolve(c,"src/components"),Ee.resolve(c,"components"),...import.meta.dir?[Ee.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield Ee.join(v,E);try{for(let E of vt.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield Ee.join(v,E.name,A)}catch{}}}function Er(e,t,i={},n){let a=oi(e,n);if(a!==void 0)return a;for(let l of ii(e,t,i,n))try{if(vt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ms(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")||!n.has("alt")&&!n.has("decorative"))return!1;let a=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=a.get("alt"),c=a.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import Kn from"fs";import ae from"path";import ht from"path";import Kt from"fs";var Yo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ls(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return Yo.has(e.toLowerCase())}var Rr=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"]),Ar={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"},Qo=new Set(["ctrl","alt","shift","meta"]),Pr={left:0,middle:1,right:2};function Tr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(Qo.has(n))t.systemKeys.push(n);else if(n in Pr)t.mouse=n;else if(n in Ar||/^[a-z]$/.test(n))t.keys.push(Ar[n]||n.toUpperCase());else if(n.startsWith("debounce")){let a=n.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(n.startsWith("throttle")){let a=n.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Mr(e,t=""){let i=[],n=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,E=l.index,A=E+c.length,j=`__stx_evt_${t}${n++}`,X=[],M=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=M.exec(v))!==null){let[,L,B]=I,Q=L.split("."),D=Q[0];if(!Rr.has(D))continue;X.push({attribute:`@${L}`,event:D,handler:B,modifiers:Tr(Q.slice(1)),elementId:j})}let z=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=z.exec(v))!==null){let[,L,B]=I,Q=L.split("."),D=Q[0];if(!Rr.has(D))continue;X.push({attribute:`@${L}`,event:D,handler:B,modifiers:Tr(Q.slice(1)),elementId:j})}if(X.length>0)i.push({originalTag:c,elementId:j,events:X,startIndex:E,endIndex:A})}return i}function ea(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=Pr[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ta(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function us(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function na(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=ea(e),a=ta(us(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(ls(e.event,t))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
|
+
(function() {
|
|
4
|
+
var $el = document.getElementById('${i}');
|
|
5
|
+
if (!$el) return;
|
|
6
|
+
// Run mounted handler immediately (DOM is ready)
|
|
7
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
8
|
+
if (scope && scope.__stx_execute) {
|
|
9
|
+
scope.__stx_execute('${y}', null, $el);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
__stx_runHandler('${y}', null, $el);
|
|
13
|
+
}
|
|
14
|
+
})();`;if(e.event==="unmounted")return`
|
|
15
|
+
(function() {
|
|
16
|
+
var $el = document.getElementById('${i}');
|
|
17
|
+
if (!$el) return;
|
|
18
|
+
// Set up MutationObserver to detect removal
|
|
19
|
+
var observer = new MutationObserver(function(mutations) {
|
|
20
|
+
for (var m of mutations) {
|
|
21
|
+
for (var node of m.removedNodes) {
|
|
22
|
+
if (node === $el || (node.contains && node.contains($el))) {
|
|
23
|
+
observer.disconnect();
|
|
24
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
25
|
+
if (scope && scope.__stx_execute) {
|
|
26
|
+
scope.__stx_execute('${y}', null, $el);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
__stx_runHandler('${y}', null, $el);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
37
|
+
// Store observer for cleanup
|
|
38
|
+
$el.__stx_unmount_observer = observer;
|
|
39
|
+
})();`;return`
|
|
40
|
+
(function() {
|
|
41
|
+
var $el = document.getElementById('${i}');
|
|
42
|
+
if (!$el) return;
|
|
43
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
44
|
+
$el.addEventListener('${e.event}', function($event) {
|
|
45
|
+
${n?n+";":""}
|
|
46
|
+
// Find the closest reactive scope and execute within its context
|
|
47
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
48
|
+
if (scope && scope.__stx_execute) {
|
|
49
|
+
scope.__stx_execute('${y}', $event, $el);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Fallback for non-reactive context (entity-safe; decoded + run in memory)
|
|
53
|
+
__stx_runHandler('${y}', $event, $el);
|
|
54
|
+
}
|
|
55
|
+
}${c});
|
|
56
|
+
})();`}function ai(e){if(e.length===0)return"";return`
|
|
57
|
+
<script data-stx-events>
|
|
58
|
+
(function() {
|
|
59
|
+
'use strict';
|
|
60
|
+
|
|
61
|
+
// Utility functions
|
|
62
|
+
function __stx_debounce(fn, delay) {
|
|
63
|
+
var timeout;
|
|
64
|
+
return function() {
|
|
65
|
+
var args = arguments;
|
|
66
|
+
var ctx = this;
|
|
67
|
+
clearTimeout(timeout);
|
|
68
|
+
timeout = setTimeout(function() { fn.apply(ctx, args); }, delay);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function __stx_throttle(fn, delay) {
|
|
73
|
+
var last = 0;
|
|
74
|
+
return function() {
|
|
75
|
+
var now = Date.now();
|
|
76
|
+
if (now - last >= delay) {
|
|
77
|
+
last = now;
|
|
78
|
+
fn.apply(this, arguments);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Non-reactive fallback runner. The handler is embedded HTML-entity-encoded
|
|
84
|
+
// so the surrounding script element can never contain raw markup, including
|
|
85
|
+
// its own closing tag; we decode it to JS only in memory here, then run it
|
|
86
|
+
// with $event/$el in scope.
|
|
87
|
+
//
|
|
88
|
+
// This comment must not spell that closing tag out. It used to, as an
|
|
89
|
+
// example, and a browser ends the script element at the FIRST one it sees \u2014
|
|
90
|
+
// so everything below this line, __stx_runHandler included, was emitted as
|
|
91
|
+
// page text and no listener was ever bound. The comment about escaping was
|
|
92
|
+
// the thing that needed escaping.
|
|
93
|
+
function __stx_runHandler(h, $event, $el) {
|
|
94
|
+
var code = h
|
|
95
|
+
.replace(/</g, '<')
|
|
96
|
+
.replace(/>/g, '>')
|
|
97
|
+
.replace(/"/g, '"')
|
|
98
|
+
.replace(/'/g, "'")
|
|
99
|
+
.replace(/'/g, "'")
|
|
100
|
+
.replace(/&/g, '&');
|
|
101
|
+
try {
|
|
102
|
+
// eslint-disable-next-line no-new-func
|
|
103
|
+
(new Function('$event', '$el', code)).call($el, $event, $el);
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
if (typeof console !== 'undefined') console.error('[stx] event handler error:', e);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Event listeners
|
|
111
|
+
${e.map(na).join(`
|
|
112
|
+
`)}
|
|
113
|
+
})();
|
|
114
|
+
</script>`}function sa(e,t=""){let i=Mr(e,t);if(i.length===0)return{template:e,bindings:[]};let n=e,a=[];for(let l=i.length-1;l>=0;l--){let c=i[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 E of c.events)E.elementId=v[1]}for(let v of c.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");y=y.replace(A,""),y=y.replace(j,"")}n=n.slice(0,c.startIndex)+y+n.slice(c.endIndex),a.push(...c.events)}return{template:n,bindings:a}}function Ir(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function $c(e,t,i){if(dl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:y,bindings:v}=sa(e,Ir(t)),E=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...E,...v],y}let n=Mr(e,Ir(t));if(n.length===0)return e;let a=e;for(let y=n.length-1;y>=0;y--){let v=n[y],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let A=E.match(/id=["']([^"']+)["']/);if(A)for(let j of v.events)j.elementId=A[1]}for(let A of v.events){let j=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");E=E.replace(X,""),E=E.replace(M,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let l=ai(n.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 jr(e,t){let i=new Set;for(let n of e.split(",")){let a=n.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){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))i.add(a)}return i}function Rt(e,t){let i=r(e),{depths:n,balanced:a}=ge(i),l=(y)=>!a||n[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let y of i.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&jr(y[1],!0).has(t))return!0;for(let y of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&jr(y[1],!1).has(t))return!0;return!1}var Dr=new T(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),dt=/^[A-Za-z_$][\w$]*$/,ra=new Set(["if","for","while","switch","with"]),Nr=["(","[","{"],Lr=[")","]","}"],ia=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function oa(e){let t=r(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=n.index??0;i.push({text:n[0],start:a,end:a+n[0].length})}return{code:t,tokens:i}}function fs(e){let t=Dr.get(e);if(t)return t;let{code:i,tokens:n}=oa(e),a=new Map,l=[];for(let L=0;L<n.length;L++){let B=n[L].text;if(["(","[","{"].includes(B))l.push(L);else if([")","]","}"].includes(B)){let Q=l.at(-1);if(Q!==void 0&&["()","[]","{}"].includes(n[Q].text+B))l.pop(),a.set(Q,L),a.set(L,Q)}}function c(L,B){let Q=[],D=L;for(let ee=L;ee<B;ee++){if(["(","[","{"].includes(n[ee].text)&&(a.get(ee)??B)<B){ee=a.get(ee);continue}if(n[ee].text===",")Q.push([D,ee]),D=ee+1}return Q.push([D,B]),Q}let y=[];function v(L,B,Q,D=!1){if(n[L]?.text==="...")L++;if(L>=B)return;let ee=n[L].text;if(dt.test(ee)){if(Q.add(ee),Q===j)y.push({name:ee,token:L,functionScoped:D});return}if(ee!=="{"&&ee!=="[")return;let ne=a.get(L);if(ne===void 0||ne>=B)return;for(let[te,le]of c(L+1,ne)){let he=te;if(ee==="{")for(let ue=te;ue<le;ue++){if(n[ue].text===":"){he=ue+1;break}if(n[ue].text==="=")break;if(["(","[","{"].includes(n[ue].text)&&a.has(ue))ue=a.get(ue)}v(he,le,Q,D)}}function E(L,B){let Q=new Set;for(let[D,ee]of c(L,B))v(D,ee,Q);return Q}function A(L){let B=L;for(;B<n.length;B++){let Q=n[B].text;if(["(","[","{"].includes(Q)&&a.has(B)){B=a.get(B);continue}if([",",";",")","]","}"].includes(Q))break}return n[Math.max(L,B-1)]?.end??i.length}let j=new Set,X=[];for(let L=0;L<n.length;L++)if(n[L].text==="=>"){let B=L-1,Q=B,D;if(n[B]?.text===")"&&a.has(B))Q=a.get(B),D=E(Q+1,B);else if(n[B]&&dt.test(n[B].text))D=new Set([n[B].text]);else continue;let ee=L+1,ne=n[ee]?.text==="{"&&a.has(ee)?n[a.get(ee)].end:A(ee);X.push({start:n[Q].start,end:ne,bodyStart:n[ee]?.start??ne,functionBody:!0,names:D})}else if(n[L].text==="("&&a.has(L)){let B=n[L-1]?.text;if(!B||ra.has(B)||!dt.test(B)&&B!=="*"&&B!=="]")continue;let Q=a.get(L),D=Q+1;if(n[D]?.text===":"){D++;while(D<n.length&&!["{","=>",";","="].includes(n[D].text))D++}if(n[D]?.text!=="{"||!a.has(D))continue;X.push({start:n[L].start,end:n[a.get(D)].end,bodyStart:n[D].start,functionBody:B!=="catch",names:E(L+1,Q)})}function M(L){let B=L;for(;B<n.length;B++){let Q=n[B].text;if(Nr.includes(Q)&&a.has(B)){B=a.get(B);continue}if(Q===";"||Lr.includes(Q))break;let D=n[B-1];if(B>L&&ia.has(Q)&&D.text!==".")break;if(B>L&&/[\n\r]/.test(i.slice(D.end,n[B].start))&&(/^[\w$]+$/.test(D.text)||Lr.includes(D.text)||['"',"'","`"].includes(D.text))&&dt.test(Q)&&!["in","of","instanceof"].includes(Q))break}return B}let I=[];for(let L=0;L<n.length;L++){if(n[L].text!=="for")continue;let B=n[L+1]?.text==="await"?L+2:L+1;if(n[B]?.text!=="("||!a.has(B))continue;let Q=a.get(B),D=Q+1,ee=n[D]?.text==="{"&&a.has(D)?a.get(D):M(D),ne=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(D,ee-1)]?.end??i.length;I.push({headStart:B,headEnd:Q,start:n[B].start,end:ne})}for(let L=0;L<n.length;L++){let B=n[L].text,Q=n[L-1]?.text;if(Q==="."||n[L+1]?.text===":")continue;if(Q==="as"||Q==="<")continue;if(B==="const"||B==="let"||B==="var"){let D=M(L+1),ee=L+1,ne=!1,te=!1,le=0;for(let he=L+1;he<=D;he++){let ue=n[he]?.text;if(he<D&&Nr.includes(ue)&&a.has(he)&&a.get(he)<D){he=a.get(he);continue}if(he<D&&ue===":"&&!te)ne=!0;else if(he<D&&ue==="="&&le===0)ne=!1,te=!0;else if(he<D&&ne&&ue==="<")le++;else if(he<D&&ne&&ue===">"&&le>0)le--;else if(he===D||ue===","&&le===0)v(ee,he,j,B==="var"),ee=he+1,ne=!1,te=!1}}else if(B==="function"||B==="class"){let D=L+1;if(n[D]?.text==="*")D++;if(n[D]&&dt.test(n[D].text)&&n[D].text!=="extends")j.add(n[D].text),y.push({name:n[D].text,token:D})}else if(B==="import"){let D=L+1;if(n[D]?.text==="*"&&n[D+1]?.text==="as")D+=2;let ee=n[D]?.text;if(ee&&dt.test(ee)&&ee!=="type"&&n[D+1]?.text!=="("&&n[D+1]?.text!==".")j.add(ee),y.push({name:ee,token:D,file:!0});let ne=n[D]?.text==="{"?D:n[D+1]?.text===","&&n[D+2]?.text==="{"?D+2:-1;if(ne!==-1&&a.has(ne)){let te=a.get(ne);for(let[le,he]of c(ne+1,te)){let ue=he-1;while(ue>=le&&!dt.test(n[ue].text))ue--;if(ue>=le&&n[ue].text!=="type")y.push({name:n[ue].text,token:ue,file:!0})}}}}let z={code:i,scopes:X,loops:I,declarations:j,sites:y,tokens:n,pairs:a};return Dr.set(e,z),z}function Zt(e){let t=fs(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((a)=>n>=a.start&&n<a.end&&a.names.has(i))}}function In(e){return new Set(fs(e).declarations)}function Ie(e,t){let{scopes:i,loops:n,sites:a,tokens:l,pairs:c}=fs(e),y=Array.from({length:l.length},()=>-1),v=[];for(let M=0;M<l.length;M++){y[M]=v.length?v[v.length-1]:-1;let I=l[M].text;if(I==="{"&&c.has(M))v.push(M);else if(I==="}"&&v.length&&c.get(M)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let M of a){if(!t.has(M.name))continue;E.add(M.token);let I=M.file?-1:y[M.token],z=I===-1?[0,Number.POSITIVE_INFINITY]:[l[I].start,l[c.get(I)].end];if(M.functionScoped){let B=l[M.token].start,Q=i.filter((D)=>D.functionBody&&B>=D.bodyStart&&B<D.end).sort((D,ee)=>D.end-D.bodyStart-(ee.end-ee.bodyStart))[0];z=Q?[Q.bodyStart,Q.end]:[0,Number.POSITIVE_INFINITY]}else if(!M.file){let B=n.filter((Q)=>M.token>Q.headStart&&M.token<Q.headEnd).sort((Q,D)=>Q.headEnd-Q.headStart-(D.headEnd-D.headStart))[0];if(B)z=[B.start,B.end]}let L=A.get(M.name);if(L)L.push(z);else A.set(M.name,[z])}let j=new Set;for(let M=0;M<l.length;M++){if(l[M].text!=="import"||l[M-1]?.text===".")continue;let I=M+1;if(l[I]?.text==="type")I++;if(l[I]&&dt.test(l[I].text)&&l[I+1]?.text===",")I+=2;if(l[I]?.text==="{"&&c.has(I))for(let z=I+1;z<c.get(I);z++)j.add(z)}let X=new Set;for(let M=0;M<l.length;M++){let I=l[M].text;if(!t.has(I)||X.has(I)||E.has(M)||j.has(M))continue;let z=l[M-1]?.text;if(z==="#"||z==="."&&l[M-2]?.text!=="..")continue;if(l[M+1]?.text===":"&&(z==="{"||z===","))continue;let L=l[M].start;if(A.get(I)?.some(([B,Q])=>L>=B&&L<Q))continue;if(i.some((B)=>L>=B.start&&L<B.end&&B.names.has(I)))continue;X.add(I)}return X}var Pe="0.2.819";var zr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function ca(){let e=globalThis;return e[zr]??=new Map,e[zr]}function o(e,t){let i=ca(),n=`${import.meta.url}\x00${e}`,a=i.get(n);if(a)return a;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var la=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(la,"<\\/$1")}import Br from"fs";var Wr=[];function b(e){let t=new T(e);return Wr.push(t),t}function Rc(){for(let e of Wr)e.clear()}function S(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Br.statSync(i).mtimeMs})}catch{}return t}function Ds(e){for(let t of e)try{if(Br.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var xe=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var ua=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function fa(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function pa(e,t){let i=t;while(!0){let n=ht.join(i,"node_modules",e,"package.json");if(Kt.existsSync(n))return ht.dirname(n);let a=ht.dirname(i);if(a===i)return null;i=a}}function da(e,t){if(!e||typeof e!=="object")return null;let i=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return i(a.import);if(typeof a.default==="object")return i(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),y=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(y))continue;if(t.length<c.length+y.length)continue;if(!n||c.length>n.prefix.length)n={pattern:a,prefix:c,suffix:y}}if(n){let a=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",a)}return null}function ga(e,t){let i=fa(e);if(!i||!i.subpath)return null;let n=pa(i.pkg,t);if(!n)return null;let a;try{a=JSON.parse(Kt.readFileSync(ht.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,c=da(a.exports,l);if(!c)return null;let y=ht.resolve(n,c);return Kt.existsSync(y)?y:null}function mi(e,t){let i=t.filePath?ht.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(ua,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:ht.resolve(i,E),!Kt.existsSync(A))throw Error(`file not found: ${A}`)}else{let j=null;try{j=Bun.resolveSync(E,n)}catch{j=ga(E,n)}if(!j)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=j}}catch(j){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${j?.message||j}`),c.push(E),""}if(a.has(A))return"";a.add(A);try{let j=Kt.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:j})}catch(j){console.warn(`[stx:vendor-css] could not read ${A}: ${j?.message||j}`),c.push(E)}return""}),styles:l,unresolved:c}}function ma(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function hi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${ma(t.source)}" data-stx-layer="vendor">
|
|
116
|
+
@layer vendor {
|
|
117
|
+
${t.contents}
|
|
118
|
+
}
|
|
119
|
+
</style>`).join(`
|
|
120
|
+
`)}
|
|
121
|
+
`}var og=k,Fr=b(256);function Nt(e){let t=S(e),i=Fr.get(t);if(!i)i=ha(e),Fr.set(t,i);return{code:i.code,imports:[...i.imports],models:[...i.models]}}function ha(e){let t=r(e),i=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 E=v.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(E)i.add(E)}let n=In(t),a=xe.filter((y)=>{if(i.has(y)||n.has(y))return!1;return ig(t,y,!0)}),l=qr(t).filter((y)=>!i.has(y)&&!n.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(`
|
|
122
|
+
`)}
|
|
123
|
+
${e}`,imports:a,models:l}}var xa=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 qr(e,t=Zt(e)){let i=new Set,n=In(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(xa.has(c)||n.has(c)||c.length<3)continue;if(t.shadows(c,l.index??0))continue;i.add(c)}return Array.from(i)}function ba(e){return In(e)}var Vr=b(128);function Kc(e){let t=S(e),i=Vr.get(t);if(!i)i=ya(e),Vr.set(t,i);return{code:i.code,stxImports:[...i.stxImports],browserImports:[...i.browserImports]}}function ya(e){let t=new Set,i=new Set,n=e;n=n.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],I=c[2];if(c[0].includes("import type"))continue;let z=[];for(let B of M.split(",")){let Q=B.trim();if(!Q||Q.startsWith("type "))continue;let D=Q.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!D)continue;let ee=D[1],ne=D[2]||ee;if(a.add(ee),a.add(ne),I==="stx"||I==="@stacksjs/stx")t.add(ee);else i.add(ee);if(ne!==ee)z.push(`${ne} = ${ee}`)}let L=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";n=n.replace(c[0],L)}let y=ba(n),v=Zt(n);for(let M of og){if(a.has(M)||y.has(M))continue;if(ps(v,M,!0))t.add(M)}let E=r(n),A=Zt(E),j=new Set;for(let M of n.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let I of M[1].split(",")){let z=I.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let L of z){let B=L.trim();if(B)j.add(B)}}for(let M of xe){if(a.has(M)||y.has(M)||j.has(M))continue;if(ps(A,M))i.add(M)}let X=qr(E,A);for(let M of X)if(!a.has(M)&&!y.has(M))i.add(M);return{code:n,stxImports:Array.from(t),browserImports:Array.from(i)}}function ig(e,t,i=!1){return ps(Zt(e),t,i)}function ps(e,t,i=!1){let n=e.code,a=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of n.matchAll(a)){let c=l.index??0;if(e.shadows(t,c))continue;let y=c+t.length,v=c-1;while(v>=0&&/\s/.test(n[v]))v--;if(n[v]==="."&&n.slice(Math.max(0,v-2),v+1)!=="...")continue;let E=y;while(E<n.length&&/\s/.test(n[E]))E++;if(n[E]===":"&&n[E+1]!==":"&&(n[v]==="{"||n[v]===","))continue;if(i&&!/^\s*(?:<[^>]*>)?\s*\(/.test(n.slice(y)))continue;if(_a(n,y))continue;return!0}return!1}function _a(e,t){let i=t;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;if(e[i]!=="(")return!1;let n=0;for(;i<e.length;i++){let a=e[i];if(a==="(")n++;else if(a===")"){if(n--,n===0)break}}if(n!==0)return!1;i++;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;return e[i]==="{"}function Xc(e,t){let i=[];if(e.length>0)i.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)i.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(i.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
124
|
+
${i.join(`
|
|
125
|
+
`)}
|
|
126
|
+
${wa(e,t)}`;return""}function Xh(e,t=[]){let{browserImports:i}=Kc(e),n=new Set(t);return Xc([],i.filter((a)=>!n.has(a)))}function wa(e,t){let i=[...e.map((n)=>`['${n}', typeof ${n}, 'stx']`),...t.map((n)=>`['${n}', typeof ${n}, '@stacksjs/browser']`)];if(i.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
127
|
+
[${i.join(", ")}].forEach(function (e) {
|
|
128
|
+
if (e[1] !== 'undefined') return;
|
|
129
|
+
console.error(
|
|
130
|
+
'[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
|
|
131
|
+
+ 'but the client runtime does not provide it. Either it is not exported to the browser, '
|
|
132
|
+
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
`}function De(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let n={};for(let a in t){let l=t[a];if(typeof l==="function")continue;n[a]=l}return n.__stxDeclaredPayload=!0,n}let i={};for(let n in e){if(n.startsWith("__")||n.startsWith("$"))continue;let a=e[n];if(typeof a==="function")continue;i[n]=a}return i}var Sa=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Ur=new Set;function $a(e,t){let i=Sa.test(e),n=t.length>32768;if(!i&&!n)return;if(Ur.has(e))return;if(Ur.add(e),i)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(n)console.warn(`[stx] server\u2192client bridge is publishing ${(t.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function yn(e,t){if(!t)return"";let i=Ie(e,new Set(Object.keys(t))),n=t.__stxDeclaredPayload===!0,a=[],l=Object.entries(t).sort(([c],[y])=>c<y?-1:c>y?1:0);for(let[c,y]of l){if(!/^[A-Za-z_$][\w$]*$/.test(c))continue;if(c.startsWith("__")||c.startsWith("$"))continue;if(!n&&!i.has(c))continue;if(Rt(e,c)){if(n)console.warn(`[stx] defineClientPayload declares "${c}", but this client block also declares "${c}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${c}" from defineClientPayload.`);continue}let v;try{v=JSON.stringify(y)}catch{continue}if(v===void 0)continue;$a(c,v),a.push(` var ${c} = ${v.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
136
|
+
${a.join(`
|
|
137
|
+
`)}
|
|
138
|
+
`}var va={left:0,middle:1,right:2};function Ea(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let i of e.systemKeys)t.push(`if (!$event.${i}Key) return`);if(e.keys.length>0){let i=e.keys.map((n)=>`$event.key === '${n}'`).join(" || ");t.push(`if (!(${i})) return`)}if(e.mouse!==null){let i=va[e.mouse];t.push(`if ($event.button !== ${i}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ka(e,t){let{elementId:i,event:n,modifiers:a}=e,l=us(e.handler),c=Ea(a),y=[];if(a.once)y.push("once: true");if(a.capture)y.push("capture: true");if(ls(n,a))y.push("passive: true");let v=y.length>0?`, { ${y.join(", ")} }`:"",E="";if(c)E+=`${c}; `;let A=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),j=`var $emit = function(name, detail) {
|
|
139
|
+
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
140
|
+
};`;function X(M){if(/\$emit\s*\(/.test(M))return`${j}
|
|
141
|
+
${M}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
142
|
+
if (scope && scope.__stx_execute) {
|
|
143
|
+
scope.__stx_execute('${A}', $event, $el);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
${M}
|
|
147
|
+
}`}if(a.debounce!==null)return` ;(function() {
|
|
148
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
149
|
+
var $el = document.getElementById('${i}')
|
|
150
|
+
if (!$el) return
|
|
151
|
+
var __timer
|
|
152
|
+
$el.addEventListener('${n}', function($event) {
|
|
153
|
+
${c?c+"; ":""}clearTimeout(__timer)
|
|
154
|
+
__timer = setTimeout(function() { ${X(l)} }, ${a.debounce})
|
|
155
|
+
}${v})
|
|
156
|
+
})()`;if(a.throttle!==null)return` ;(function() {
|
|
157
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
158
|
+
var $el = document.getElementById('${i}')
|
|
159
|
+
if (!$el) return
|
|
160
|
+
var __last = 0
|
|
161
|
+
$el.addEventListener('${n}', function($event) {
|
|
162
|
+
${c?c+"; ":""}var __now = Date.now()
|
|
163
|
+
if (__now - __last >= ${a.throttle}) {
|
|
164
|
+
__last = __now
|
|
165
|
+
${X(l)}
|
|
166
|
+
}
|
|
167
|
+
}${v})
|
|
168
|
+
})()`;if(/\$emit\s*\(/.test(l))return` var $el = document.getElementById('${i}')
|
|
169
|
+
if ($el) $el.addEventListener('${n}', function($event) {
|
|
170
|
+
${E}${j}
|
|
171
|
+
${l}
|
|
172
|
+
}${v})`;return` var $el = document.getElementById('${i}')
|
|
173
|
+
if ($el) $el.addEventListener('${n}', function($event) {
|
|
174
|
+
${E}var scope = $el.closest('[data-stx-scope]');
|
|
175
|
+
if (scope && scope.__stx_execute) {
|
|
176
|
+
scope.__stx_execute('${A}', $event, $el);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
${l}
|
|
180
|
+
}
|
|
181
|
+
}${v})`}function Ra(e){if(e.length===0)return"";return`
|
|
182
|
+
// STX: auto-generated event bindings
|
|
183
|
+
${e.map((i,n)=>ka(i,n)).join(`
|
|
184
|
+
`)}`}function Hr(e){let t=[],i=new Set,n=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=n.length,c=0;while(c<l){let y=n[c];if(y==="'"||y==='"'||y==="`"){let v=y;if(c++,v==="`"){let E=0;while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]==="`"&&E===0){c++;break}if(n[c]==="$"&&n[c+1]==="{"){E++,c+=2;continue}if(n[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]===v){c++;break}c++}continue}if(y==="/"&&n[c+1]==="/"){while(c<l&&n[c]!==`
|
|
185
|
+
`)c++;continue}if(y==="/"&&n[c+1]==="*"){c+=2;while(c<l-1&&!(n[c]==="*"&&n[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=n.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let X=E[1];if(!X.startsWith("_")&&!i.has(X))t.push(X),i.add(X);c+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((X)=>{let M=X.trim(),I=M.indexOf(":"),z=I>=0?M.slice(I+1).trim().split(/[\s=]/)[0]:M.split(/[\s=]/)[0];if(z&&!z.startsWith("_")&&!i.has(z))t.push(z),i.add(z)}),c+=A[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let X=j[1];if(!X.startsWith("_")&&!i.has(X))t.push(X),i.add(X);c+=j[0].length;continue}}c++}return t}var Ca=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 Aa(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(X){let M;while((M=i.exec(X))!==null){let I=M[0];if(!Ca.has(I))t.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)n(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)n(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)n(l[1]);return t}async function Le(e,t={}){let i=e,n="",a=!1,l=[],c=mi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=c.code;let y=hi(c.styles),v=Nt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-0633xsmx.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let D=Kc(i);i=D.code,n=Xc(D.stxImports,D.browserImports.filter((ee)=>!l.includes(ee)))}if(n=`${yn(i,t.serverData)}${n}`,i=P(i),!a&&je(t.attrs||""))i=Be(i);let j=Ra(t.eventBindings||[]),X=(t.attrs||"").trim(),M=/\btype\s*=\s*["']module["']/i.test(X),I=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(M){let D=X.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${I}${D?` ${D}`:""}`;return`${y}<script ${ee}>
|
|
186
|
+
${dn(`${n}${i}
|
|
187
|
+
${j}`)}
|
|
188
|
+
</script>`}let z=Ri(e),L=/function __stx_setup_/.test(i),B=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function Q(D){let ee=D.length>0?`
|
|
189
|
+
return ${Is(i,D)};`:"",ne=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${y}<script data-stx-scoped data-stx-run="always"${I}>
|
|
190
|
+
window.stx.mount(function() {
|
|
191
|
+
'use strict';
|
|
192
|
+
try {
|
|
193
|
+
${dn(`${n}${i}
|
|
194
|
+
${j}${ee}`)}
|
|
195
|
+
} catch (error) {
|
|
196
|
+
console.error(${ne}, error);
|
|
197
|
+
return {};
|
|
198
|
+
}
|
|
199
|
+
})</script>`}if(!B&&!L){if(z)return Q(Hr(e));if(t.templateContent){let D=Hr(e);if(D.length>0){let ee=Aa(t.templateContent);if(D.some((te)=>ee.has(te)))return Q(D)}}}return`${y}<script data-stx-scoped data-stx-run="always"${I}>
|
|
200
|
+
;(function() {
|
|
201
|
+
'use strict';
|
|
202
|
+
try {
|
|
203
|
+
${dn(`${n}${i}
|
|
204
|
+
${j}`)}
|
|
205
|
+
} catch (error) {
|
|
206
|
+
console.error(${JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`)}, error);
|
|
207
|
+
}
|
|
208
|
+
})()</script>`}import{createHash as Da}from"crypto";var Pn=/<script\b[^>]*>/iy,hs=/<\/script\s*>/ig,On=/<style\b[^>]*>/iy,xs=/<\/style\s*>/ig;function Zr(e,t,i,n){i.lastIndex=t;let a=i.exec(e);if(!a||a.index!==t)return-1;n.lastIndex=i.lastIndex;let l=n.exec(e);if(!l)return-1;return l.index+l[0].length}function W(e,t){return Zr(e,t,Pn,hs)}function pn(e,t){return Zr(e,t,On,xs)}function Ne(e,t){if(!e.startsWith("<!--",t))return-1;let i=e.indexOf("-->",t+4);if(i===-1)return-1;return i+3}function Kr(e,t){if(e.startsWith("<!--",t)){let a=Ne(e,t);return a===-1?e.length:a}if(Pn.lastIndex=t,Pn.exec(e)?.index===t){hs.lastIndex=Pn.lastIndex;let a=hs.exec(e);return a?a.index+a[0].length:e.length}if(On.lastIndex=t,On.exec(e)?.index===t){xs.lastIndex=On.lastIndex;let a=xs.exec(e);return a?a.index+a[0].length:e.length}return-1}function w(e,t){let i=[],n=0,a=e.length,l=!1,c=null;while(n<a){let y=e[n];if(l){if(c){if(y===c)c=null}else if(y==='"'||y==="'")c=y;else if(y===">")l=!1;n++;continue}if(y!=="<"){let j=e.indexOf("<",n+1);if(j===-1)break;n=j;continue}let v=t(e,n);if(v>n){i.push({start:n,end:v,token:e.slice(n,v)}),n=v;continue}let E=Kr(e,n);if(E>n){n=E;continue}let A=e.charCodeAt(n+1);if(A>=65&&A<=90||A>=97&&A<=122)l=!0;n++}return i}function Xr(e){let t=0,i=0,n=0,a=!1,l=null;while(n<e.length){if(a){let j=e[n];if(l){if(j===l)l=null}else if(j==='"'||j==="'")l=j;else if(j===">")a=!1;n++;continue}let c=e.indexOf("<",n),y=c===-1?e.length:c;while(n<y){let j=e[n++];if(j==="{")t++;else if(j==="}")i++;if(t>=2&&i>=2)return!0}if(c===-1)break;let v=Kr(e,c);if(v>c){n=v;continue}let E=e.charCodeAt(c+1),A=E===47?e.charCodeAt(c+2):E;if(A>=65&&A<=90||A>=97&&A<=122)a=!0;n=c+1}return!1}function Ac(e,t){while(e.size>=t){let i=e.keys().next();if(i.done)return;e.delete(i.value)}}var Ta=1024,Ia=16777216,Et=new Map,ds=0;function Pa(e,t){Et.set(e,t),ds+=e.length+t.output.length;for(let[i,n]of Et){if(ds<=Ia)break;Et.delete(i),ds-=i.length+n.output.length}}function pe(e,t,i,n){let a=n!==void 0&&e.length>=Ta,l=a?`${n}\x00${e}`:"";if(a){let A=Et.get(l);if(A)return Et.delete(l),Et.set(l,A),{output:A.output,tokens:A.tokens.slice()}}let c=w(e,t);if(c.length===0)return{output:e,tokens:[]};let y=c.map((A)=>A.token),v="",E=0;for(let A=0;A<c.length;A++){let j=c[A];v+=e.slice(E,j.start),v+=i(j.token,A),E=j.end}if(v+=e.slice(E),a)return Pa(l,{output:v,tokens:y}),{output:v,tokens:y.slice()};return{output:v,tokens:y}}var Oa=1024,Ma=16777216,kt=new Map,gs=0;function ja(e,t){kt.set(e,t),gs+=e.length+t.output.length;for(let[i,n]of kt){if(gs<=Ma)break;kt.delete(i),gs-=i.length+n.output.length}}function ms(e,t,i){return{output:t,scripts:i,restore:(n)=>n===t?e:vr(n,i)}}function G(e){let t=e.length>=Oa;if(t){let a=kt.get(e);if(a)return kt.delete(e),kt.set(e,a),ms(e,a.output,a.scripts.slice())}let{output:i,tokens:n}=pe(e,W,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(t)return ja(e,{output:i,scripts:n}),ms(e,i,n.slice());return ms(e,i,n)}function vr(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(i,n)=>t[+n]??"")}var Mn="__stx_component_client_factories";function jn(e){let t=e[Mn];return t instanceof Map?t:null}function Vc(e){e[Mn]=new Map}function bs(e,t){let i=jn(e);if(!i)return null;let n=Da("sha256").update(t).digest("hex").slice(0,16),a=i.get(n);if(a)a.instances++;else i.set(n,{body:t,instances:1});return n}function Uc(e,t){let i=jn(t);if(!i?.size)return e;let n=new Map;for(let[A,j]of i)if(j.instances===1)n.set(A,j.body);let a=[];if(n.size>0){let A=[...n.keys()].map((M)=>JSON.stringify(M).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),j=new RegExp(`window\\.__stxComponentFactories\\[(${A})\\]\\(("[^"]+")\\);`,"g"),X=j.exec(e);while(X!==null){let M=n.get(JSON.parse(X[1]));if(M!==void 0)a.push({start:X.index,end:X.index+X[0].length,replacement:`(${M})(${X[2]});`});X=j.exec(e)}}let l=[...i].filter(([,A])=>A.instances>1);if(l.length===0)return Jr(e,a);let y=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
209
|
+
(function() {
|
|
210
|
+
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
211
|
+
${l.map(([A,j])=>` try { factories[${JSON.stringify(A)}] = factories[${JSON.stringify(A)}] || ${j.body}; }
|
|
212
|
+
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(A)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
213
|
+
`)}
|
|
214
|
+
})();
|
|
215
|
+
</script>`,v,E=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return w(e,(A,j)=>{if(v===void 0){if(E.lastIndex=j,E.test(A))v=j}return-1}),a.push({start:v??0,end:v??0,replacement:`${y}
|
|
216
|
+
`}),Jr(e,a)}function Jr(e,t){if(t.length===0)return e;t.sort((l,c)=>l.start-c.start||l.end-c.end);let i=Array(t.length*2+1),n=0,a=0;for(let l of t)i[a++]=e.slice(n,l.start),i[a++]=l.replacement,n=l.end;return i[a]=e.slice(n),i.join("")}function Gr(e){let t=jn(e),i=new Map;if(t)for(let[n,a]of t)i.set(n,a.instances);return i}function Yr(e,t){let i=jn(e);if(!i)return[];let n=[];for(let[a,l]of i){let c=l.instances-(t.get(a)??0);if(c>0)n.push({body:l.body,count:c})}return n}function Qr(e,t){for(let{body:i,count:n}of t)for(let a=0;a<n;a++)bs(e,i)}function ve(e,t,i=2){let n=0,a=null;for(let l=t+i;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==="{"){n++;continue}if(c==="}"){if(n>0){n--;continue}let y=0;while(e[l+y]==="}")y++;if(y>=i)return l}}return-1}import $i from"fs";var ei=0,ys=new Map;function Zc(){ei=0,ys.clear()}function Dn(e,t){let i=ei++,n=`<!--__STX_${e.toUpperCase()}_${i}__-->`;return ys.set(n,{type:e,expression:t}),n}function Qc(){let e={};for(let[t,i]of ys)e[t]={type:i.type,expression:i.expression};return e}function el(e,t){let i=e;for(let[n,a]of t)i=i.split(n).join(a);return i}function bi(e){return e.includes("<!--__STX_")}var Na=/@(?=[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 La(e){return Array.from({length:e},()=>"{").join("⁠")}function ti(e){return e.replace(/\{{2,}/g,(t)=>La(t.length)).replace(/\{(?=!)/g,"{⁠").replace(Na,"@")}function xr(e,t,i=!1){let{openTag:n,tail:a}=i?za(e,t):Ba(e).at(t);return Fa(a,n,i)}function za(e,t){let i="",n=0;for(let c=0;c<t;c++){if(!e.startsWith("{{",c))continue;let y=ve(e,c);if(y<0||y+2>t)break;i+=e.slice(n,c)+"x",c=y+1,n=y+2}i+=e.slice(n,t);let a=-1,l=null;for(let c=0;c<i.length;c++){let y=i[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?i.slice(a+1):i}}var Nn=null;function Ba(e){if(Nn&&Nn.source===e)return Nn.scanner;let t=Wa(e);return Nn={source:e,scanner:t},t}function Wa(e){let t=0,i=-1,n=null,a=-1,l=(y,v)=>{let E=e[y];if(v.quote){if(E===v.quote)v.quote=null;return}if(v.openTag>=0){if(E==='"'||E==="'"){v.quote=E;return}if(E===">"){v.openTag=-1;return}}if(E==="<")v.openTag=y},c=(y,v)=>{if(v.openTag>=0||!e.startsWith("<!--",y))return-1;let E=e.indexOf("-->",y+4);return E<0?e.length:E+3};return{at(y){if(y<t)t=0,i=-1,n=null,a=-1;let v={openTag:i,quote:n},E=!1;while(t<y){if(a<0&&e.startsWith("{{",t)){let z=ve(e,t);if(z<0)a=t;else if(z+2<=y){t=z+2;continue}else break}let I=c(t,v);if(I>=0){if(I>y){E=!0;break}t=I;continue}l(t,v),t++}if(i=v.openTag,n=v.quote,E)return{openTag:-1,tail:""};let A=a>=0?a:t,j={openTag:i,quote:n};for(let I=t;I<y;I++){let z=c(I,j);if(z>=0){if(z>y)return{openTag:-1,tail:""};I=z-1;continue}l(I,j)}if(j.openTag<0)return{openTag:-1,tail:""};let X="",M=j.openTag+1;for(let I=M;I<Math.min(y,A);I++){if(!e.startsWith("{{",I))continue;let z=ve(e,I);X+=e.slice(M,I)+"x",I=z+1,M=z+2}return X+=e.slice(M,y),{openTag:j.openTag,tail:X}}}}function Fa(e,t,i){if(t<0&&!i)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let n=0;if(t>=0)while(n<e.length&&!/\s/.test(e[n]))n++;while(n<e.length){while(/\s/.test(e[n]??"")&&n<e.length)n++;let a=n;while(n<e.length&&!/[\s=/>]/.test(e[n]))n++;let l=e.slice(a,n);if(!l)break;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="=")continue;n++;while(n<e.length&&/\s/.test(e[n]))n++;let c=e[n];if(c==='"'||c==="'"){let y=++n,v=e.indexOf(c,n);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(y)};n=v+1}else{let y=n;while(n<e.length&&!/\s/.test(e[n]))n++;if(n===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(y)}}}return{kind:"tag"}}class oe extends Error{attribute;near;constructor(e,t){super(`Unsafe interpolation in ${e}: ${t}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,t){if(this.near===void 0)this.near=e.slice(Math.max(0,t-160),t).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var ni="unsafe:";var Va=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Ua=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Ha=/^data:(?:text\/html|application\/xhtml\+xml)/,qa=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Za(e){return e.replace(qa,"").toLowerCase()}function _s(e){let t=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(t))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(t))return"fetched";return null}function Ln(e,t="navigable"){let i=Za(e);if(Va.test(i))return!0;return t==="navigable"?Ua.test(i):Ha.test(i)}function wr(e,t="navigable"){return Ln(e,t)?"unsafe:"+e:e}function Ka(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return _s(t[1])}function si(e,t,i=256){if(t<=i)return e.slice(0,t);let n=e.slice(t-i,t),a=n.search(/[\s"'`/]/);return a===-1?"":n.slice(a)}function ri(e,t,i=t){let n=Ka(e);return n&&Ln(t,n)?"unsafe:"+i:i}function At(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),c=e.slice(t+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let i=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!i)return null;let n=i[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=i[2].trim();return n&&a?{arrayExpr:a,itemVar:n}:null}function zn(e){let t=[],i=0,n="",a=0;for(let l=0;l<e.length;l++){let c=e[l];if(n){if(c==="\\")l++;else if(c===n)n="";continue}if(c==="'"||c==='"'||c==="`")n=c;else if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===","&&i===0)t.push(e.slice(a,l)),a=l+1}return t.push(e.slice(a)),t}function _i(e,t){let i=0;for(let n=0;n<e.length;n++){let a=e[n];if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a===t&&i===0)return n}return-1}function Si(e){let t=0;for(let i=0;i<e.length;i++){let n=e[i];if(n==="("||n==="["||n==="{")t++;else if((n===")"||n==="]"||n==="}")&&--t===0)return i}return-1}function xt(e,t){let i=e.trim().replace(/^\.\.\./,"").trim(),n=_i(i,"=");if(n!==-1&&i[n+1]!==">")i=i.slice(0,n).trim();if(!i)return;if(i.startsWith("{")&&i.endsWith("}")){for(let a of zn(i.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){xt(l,t);continue}let c=_i(l,":");xt(c===-1?l:l.slice(c+1),t)}return}if(i.startsWith("[")&&i.endsWith("]")){for(let a of zn(i.slice(1,-1)))xt(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(i))t.push(i)}function J(e){let t=e.trim(),i=[],n=0;for(let l=0;l<t.length;l++){let c=t[l];if(c==="("||c==="["||c==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(n===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(t.slice(l)))continue;let v=t.slice(0,l).trim();if(v.startsWith("(")&&Si(v)===v.length-1)v=v.slice(1,-1);for(let E of zn(v))xt(E,i);if(i.length>0)return i;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let l=a[1].trim();if(l.startsWith("(")&&Si(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)xt(c[2],i),xt(c[1],i);else for(let y of zn(l))xt(y,i)}return i}function O(e,t){let i=t instanceof Set?t:new Set(t);if(i.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(i.has(y))return!0;return!1}var Bn="__stx_client_loop_names";function rt(e){let t=e?.[Bn];return Array.isArray(t)?t:[]}function Wn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],i=[],n=/<!--[\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(n)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=i.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((A)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(A[1])),v=(y?.[2]??y?.[3])?.trim();if(v&&y?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let E=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(i.push(E),E)t.push(E)}}return t}var Jt={},vi=new Map;function Xa(e){let t=vi.get(e);if(!t){let i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${i}(?!\\w)`,"g"),vi.set(e,t)}return t.lastIndex=0,t}var Us={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let i=String(e);return i.charAt(0).toUpperCase()+i.slice(1)},number:(e,t,i=0)=>{if(e===void 0||e===null)return"";try{let n=Number(e);return Number.isNaN(n)?"":n.toFixed(Number.parseInt(String(i),10))}catch{return""}},fmt:(e,t,i="en-US")=>{if(e===void 0||e===null)return"";try{let n=Number(e);if(Number.isNaN(n))return String(e);return n.toLocaleString(i)}catch{return String(e)}},join:(e,t,i=",")=>{if(!Array.isArray(e))return"";return e.join(String(i))},escape:(e,t)=>{if(e===void 0||e===null)return"";return U(String(e))},translate:(e,t,i={})=>{if(!t||!t.__translations)return e;let n=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),c=n;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(i).forEach(([v,E])=>{y=y.replace(Xa(v),()=>String(E))}),y},t:(e,t,i={})=>Us.translate(e,t,i),truncate:(e,t,i=50,n="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=i)return a;if(i<=n.length)return n.substring(0,i);return a.substring(0,i-n.length)+n},date:(e,t,i="short",n="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(i==="iso")return a.toISOString();return new Intl.DateTimeFormat(n,l[i]||l.short).format(a)}catch{return String(e)}},currency:(e,t,i="USD",n="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(n,{style:"currency",currency:i}).format(a)}catch{return String(e)}},pluralize:(e,t,i,n)=>{let a=Number(e);if(Number.isNaN(a))return i;let l=n||`${i}s`;return a===1?i:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let i=String(e);return i.charAt(i.length-1)},length:(e,t)=>{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,t,i=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return i?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,i="")=>e===void 0||e===null||e===""?i:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,i=0,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(i,n);return e},replace:(e,t,i,n="")=>{if(e===void 0||e===null)return"";let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>n)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let i=Number(e);return Number.isNaN(i)?0:Math.abs(i)},round:(e,t,i=0)=>{let n=Number(e);if(Number.isNaN(n))return 0;let a=10**i;return Math.round(n*a)/a}};function mg(e,t){if(e in Us)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);Jt[e]=t}function Jh(e){for(let[t,i]of Object.entries(e))mg(t,i)}function hg(){return{...Us,...Jt}}function Yh(){for(let e of Object.keys(Jt))delete Jt[e]}function Mt(e,t,i=2){let n="{".repeat(i);if(!e.includes(n))return e;let a="",l=0;for(;;){let c=e.indexOf(n,l);if(c===-1)break;let y=ve(e,c,i);if(y===-1)break;a+=e.slice(l,c)+t(e.slice(c,y+i),e.slice(c+i,y),c),l=y+i}return l===0?e:a+e.slice(l)}function Ja(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let a=xr(e,t);if(!a||a.kind!=="attribute"||a.quote===n)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let c=0;c<a.valuePrefix.length;c++)if(a.valuePrefix[c]==="\\")c++;else if(a.valuePrefix[c]===n)l++;return l%2===1}function p(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function U(e){return ti(p(e))}function Ga(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function Ya(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,i)=>String.fromCodePoint(Number.parseInt(i,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function Qa(e,t){let i=Ya(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(i))throw new oe(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let n=/url\(([^)]*)\)/g,a;while((a=n.exec(i))!==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 oe(t,"CSS URLs must be local paths or base64 raster images")}}function Z(e,t,i,n=!1,a=0){try{return ec(e,t,i,n,a)}catch(l){if(l instanceof oe)l.locate(e,t);throw l}}function ec(e,t,i,n,a){let l=xr(e,t,n),c=U(i);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(i))throw new oe("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return i}if(l.kind==="tag"){let E=e.slice(t+a).trimStart(),A=i.trim();if(!E.startsWith("=")&&(A===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(A)))return A;throw new oe("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 oe(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(y==="srcdoc")c=U(c);if(y==="style")Qa(i,l.name);if(l.quote===null)c=Ga(c);let v=_s(y);if(v&&l.valuePrefix.trim()===""&&Ln(i,v))return ni+c;return ri(si(e,t),i,c)}function wn(e,t){let i=` ${e}="`;return Z(i,i.length,t,!0)}function Ii(e){return e.flatMap((t)=>{let i=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!i||/\bserver\b|\bsrc\s*=/.test(i[1])?[]:[i[2]]})}function Se(e,t){let{scripts:i}=G(e);for(let n of Ii(i)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(n)||Jc.test(n))return!0;if(Or(n,t))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 yg(e){let t=[],i=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let n=i.exec(e);n;n=i.exec(e)){let a=n[1].toLowerCase(),l=new Set(J(n[3]));if(l.size===0)continue;let c=n.index+n[0].length;if(n[0].endsWith("/>")){t.push({start:n.index,end:c,names:l});continue}let y=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");y.lastIndex=c;let v=1,E=e.length;for(let A=y.exec(e);A;A=y.exec(e)){if(A[2]==="/")continue;if(v+=A[1]==="/"?-1:1,v===0){E=A.index+A[0].length;break}}t.push({start:n.index,end:E,names:l})}return t}function Ei(e,t,i){let n=r(i);for(let a of e){if(t<a.start||t>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(n))return!0}return!1}function ki(e,t){let i=["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"],n=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,c=0;for(let E=0;E<n.length;E++){let A=n[E];if(!l&&A==="`"){l=!0,c=0;continue}if(l){if(A==="`"&&c===0){l=!1;continue}if(A==="$"&&n[E+1]==="{"){c++,E++,a+=" ";continue}if(A==="}"&&c>0){c--;continue}if(c>0){a+=A;continue}continue}a+=A}n=a;let y=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=y.exec(n))!==null){let E=v[1];if(!n.substring(0,v.index).trimEnd().endsWith(".")){if(!i.includes(E)&&!(E in t))return!1}}return!0}function tc(e,t){let i=r(e);for(let n of i.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[n[1]]==="function")return!0;return!1}function nc(e,t){let i=t.__stx_serverDeclared;if(!i||i.size===0)return!1;let n=r(e);for(let a of i)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(n))return!0;return!1}var Ci=new Set;function Ai(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function sc(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
|
|
217
|
+
`,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===n)a++;return a%2===1}function Ti(e,t){let i=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Ci.has(i))Ci.add(i),console.warn(`[stx] {{ ${e} }} in a <script> in ${t??"<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 wi(e,t,i){let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=R(l,t);if(c===void 0)return Ai(l)?Ti(l.trim(),i):a;return c===null?"":String(c)}catch{return a}}),n=Mt(n,(a,l,c)=>{let y=l.trim();if(sc(n,c,l))return a;if(/^__[A-Z_]+__$/.test(y))return a;try{let v=R(l,t);if(v===void 0)return Ai(y)?Ti(y,i):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(E)=>"\\u007b".repeat(E.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),n}function bg(e,t){if(!e.includes("{"))return e;let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(n,a)=>{try{let l=R(a,t);if(l===void 0)return n;return l===null?"":String(l)}catch{return n}}),i=Mt(i,(n,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return n;try{let y=R(a,t);if(y===void 0)return n;if(y===null)return"";let v=String(y);return Z(i,l,v,!0,n.length)}catch(y){if(y instanceof oe)throw y;return n}}),i}function Zh(e,t,i={}){let{output:n,scripts:a}=G(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 E=y[1],A=c.slice(y[0].length,v);if(/\bdata-raw\b/.test(E))return c;if(i.skipServer&&/\bserver\b/.test(E))return c;let X=`<script${bg(E,t)}>`;if(/\bsrc\s*=/.test(E)||/\btype\s*=\s*["']application\/json["']/.test(E))return X+A+c.slice(v);return X+wi(A,t)+c.slice(v)});return vr(n,l)}function _(e,t,i){let n=e,a=(I,z)=>{let L=pn(I,z);if(L===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(I.slice(z,L))?-1:L},l=(I,z,L,B)=>{let Q=L.length,{output:D,tokens:ee}=pe(I,z,(ne,te)=>B(Q+te));return L.push(...ee),D},c=[];n=l(n,a,c,(I)=>`<!--__STX_STYLE_${I}__-->`);let y=[];n=l(n,W,y,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`);let v=t?.__stx_signals_gate===!0||Se(e),E=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...yi(Ii(y))]),A=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);n=Mt(n,(I,z,L)=>{if(O(z,E))return I;try{let B=R(z,t,!1,(Q)=>ws(Q,I,i,e));return B!==void 0&&B!==null?String(B):""}catch(B){let Q=B instanceof Error?B.message:String(B);return h("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${Q}`,i,e,L,I)}},3),n=n.replace(/\{!!([\s\S]*?)!!\}/g,(I,z,L)=>{if(O(z,E))return I;try{let B=R(z,t,!1,(Q)=>ws(Q,I,i,e));if(B===void 0&&t.__stx_buildMode==="compile")return Dn("raw",z.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(t.__stx_buildMode==="compile")return Dn("raw",z.trim());let Q=B instanceof Error?B.message:String(B);return h("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${Q}`,i,e,L,I)}}),n=l(n,W,y,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`),n=l(n,a,c,(I)=>`<!--__STX_STYLE_${I}__-->`);let j=v?yg(n):[],X=Wn(n).map((I)=>({...I,names:new Set(J(`${I.binding} in __slot`))})),M=new Set(rt(t));if(n=Mt(n,(I,z,L)=>{let B=z.trim();if(Ja(n,L,z))return I;if(Ei(X,L,B))return I;if(O(B,M))return I;if(j.length>0&&Ei(j,L,B))return I;if(A.has(B))return I;let Q=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],D=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ne=B.match(D)?.[1],te=ne&&((ne in t)||Q.includes(ne)),le=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,he=B.match(le),ue=he&&!Q.includes(he[1])&&!(he[1]in t);if(/^__[A-Z_]+__$/.test(B))return"";if(O(B,E))return I;if(t.__stx_native_screen===!0&&tc(B,t))return I;let Re;try{let Ae=R(z,t,!1,(Ke)=>{Re=Ke});if(v&&!ki(B,t))return I;if(Re)ws(Re,I,i,e);if(t.__stx_buildMode==="compile"&&!v&&(Ae===void 0||nc(B,t)))return Dn("expr",B);if(Ae===void 0||Ae===null)return"";let Ue=String(Ae);return Z(n,L,Ue,!1,I.length)}catch(Ae){if(Ae instanceof oe)throw Ae;if(v&&!ki(B,t))return I;if(ue)return I;let Ue=Ae instanceof Error?Ae.message:String(Ae);return h("Expression",`Error evaluating: {{ ${B} }}: ${Ue}`,i,e,L,I)}}),y.length>0)n=n.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(I,z)=>y[Number(z)]??I);if(c.length>0)n=n.replace(/<!--__STX_STYLE_(\d+)__-->/g,(I,z)=>c[Number(z)]??I);return n}function wg(e,t,i){if(!t.trim())return e;let n=e,a=t.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=Jt[c]||Us[c];if(!y)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(hg()).join(", ")}`);let v=[];if(a.startsWith(":")){let E=a.match(/^:([^|\s]+)/);if(E){let A=E[1].trim();try{let j=Number(A);v=[Number.isNaN(j)?A:j]}catch{v=[A]}a=a.substring(E[0].length).trim()}}else if(a.startsWith("(")){let E=1,A=1;while(E>0&&A<a.length){if(a[A]==="(")E++;if(a[A]===")")E--;A++}if(E===0){let j=a.substring(1,A-1).trim();if(j)try{if(j.startsWith("{")&&j.endsWith("}"))v=[R(`(${j})`,i,!0)];else{let X=[],M="",I=null,z=0,L=0,B=0,Q=!1;for(let D=0;D<j.length;D++){let ee=j[D];if(Q){M+=ee,Q=!1;continue}if(ee==="\\"){M+=ee,Q=!0;continue}if(I){if(M+=ee,ee===I)I=null;continue}if(ee==='"'||ee==="'"||ee==="`"){I=ee,M+=ee;continue}if(ee==="(")z++;else if(ee===")")z--;else if(ee==="[")L++;else if(ee==="]")L--;else if(ee==="{")B++;else if(ee==="}")B--;if(ee===","&&z===0&&L===0&&B===0){X.push(M),M="";continue}M+=ee}if(M)X.push(M);v=X.map((D)=>{let ee=D.trim();return R(ee,i,!0)})}}catch{v=[j]}a=a.substring(A).trim()}}try{n=y(n,i,...v)}catch(E){let A=E instanceof Error?E.message:String(E);throw Error(`Error applying filter '${c}': ${A}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return n}function rc(e){let t=!1,i="",n=0,a=0,l=0,c=!1;for(let y=0;y<e.length;y++){let v=e[y],E=e[y+1];if(t&&c){c=!1;continue}if(t&&v==="\\"){c=!0;continue}if(c=!1,(v==='"'||v==="'"||v==="`")&&!c){if(!t)t=!0,i=v;else if(v===i)t=!1,i="";continue}if(t&&i==="`"&&v==="$"&&E==="{"){let A=1;y+=2;while(y<e.length&&A>0){if(e[y]==="{")A++;else if(e[y]==="}")A--;if(A>0)y++}continue}if(t)continue;if(v==="(")n++;else if(v===")")n--;else if(v==="[")a++;else if(v==="]")a--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&n===0&&a===0&&l===0){if(E==="|"){y++;continue}if(E==="="){y++;continue}return y}}return-1}var Xt=new Set,ic=1000;function Qh(){Xt.clear()}function ws(e,t,i,n){if(!K())return;let a=`${i}\x00${e.expression}`;if(Xt.has(a))return;if(Xt.size>=ic)Xt.clear();Xt.add(a);let l=i,c=n;try{if(i&&$i.existsSync(i))c=$i.readFileSync(i,"utf8")}catch{}let y=c.indexOf(t);if(y>=0)l=`${i}:${c.slice(0,y).split(`
|
|
218
|
+
`).length}`;console.warn(`${l}: stx warning: ${t} 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 R(e,t,i=!1,n){try{let a=e.trim(),l=rc(a);if(l>0){let y=a.substring(0,l).trim(),v=a.substring(l+1).trim(),E=R(y,t,!0,n);return wg(E,v,t)}let c=qs(a);if(c!==null){n?.({expression:a,rule:c});return}try{let y=Object.keys(t),v=Object.values(t);return d(a,y)(...v)}catch{return u(a,t)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let c=l[1],y=oc(c,Object.keys(t));if(y&&y!==c)a.message=`${a.message} \u2014 did you mean '${y}'?`}}if(!i)console.error(`Error evaluating expression: ${e}`,a);throw a}}function oc(e,t){let i=null;for(let a of t){if(a===e)continue;let l=ac(e,a);if(i===null||l<i.dist)i={key:a,dist:l}}if(!i)return null;let n=Math.max(e.length,i.key.length);if(i.dist<=2||i.dist/n<=0.35)return i.key;return null}function ac(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[i,n]=e.length<t.length?[e,t]:[t,e],a=Array(i.length+1),l=Array(i.length+1);for(let c=0;c<=i.length;c++)a[c]=c;for(let c=1;c<=n.length;c++){l[0]=c;for(let y=1;y<=i.length;y++){let v=i[y-1]===n[c-1]?0:1;l[y]=Math.min(l[y-1]+1,a[y]+1,a[y-1]+v)}for(let y=0;y<=i.length;y++)a[y]=l[y]}return a[i.length]}function ey(e){if(!e)return"";return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import cc from"process";function C(e="STX_PUBLIC_"){let t={},i={};for(let[n,a]of Object.entries(cc.env)){if(!n.startsWith(e)||a===void 0)continue;t[`import.meta.env.${n}`]=JSON.stringify(a),i[n]=a}return t["import.meta.env"]=JSON.stringify(i),t}function Pi(e,t=""){let i=`${e}${t}`,n=0;for(let a=0;a<i.length;a++){let l=i.charCodeAt(a);n=(n<<5)-n+l,n=n&n}return`stx-${Math.abs(n).toString(36)}`}function Oi(e,t,i={}){let{prefix:n="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:c=!1}=i;if(!e.trim())return"";let y=Ss(e),v=[],E=new Map;if(l)for(let A of y){let j=A.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(j){let X=j[1],M=`${t}_${X}`;E.set(X,M)}}for(let A of y){let j=Mi(A,t,n,a,E,c);v.push(j)}return v.join(`
|
|
219
|
+
|
|
220
|
+
`)}function Ss(e){let t=[],i=e.replace(/\/\*[\s\S]*?\*\//g,""),n=0,a="",l=!1,c="";for(let y=0;y<i.length;y++){let v=i[y];if(v==="@"&&n===0)l=!0;if(v==="{")n++;else if(v==="}"){if(n--,n===0){if(l){c+=v;let E=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(E){let[,A,j,X]=E;if(A==="keyframes")t.push({selector:`@keyframes ${j.trim()}`,declarations:X.trim()});else if(A==="media"||A==="supports"||A==="container"){let M=Ss(X);t.push({selector:`@${A} ${j.trim()}`,declarations:M.map((I)=>`${I.selector} { ${I.declarations} }`).join(`
|
|
221
|
+
`)})}else t.push({selector:`@${A} ${j.trim()}`,declarations:X.trim()})}c="",l=!1}else if(a.trim()){a+=v;let E=a.match(/([^{]+)\{([^}]*)\}/);if(E)t.push({selector:E[1].trim(),declarations:E[2].trim()});a=""}continue}}if(l)c+=v;else a+=v}return t}function Mi(e,t,i,n,a,l){let{selector:c,declarations:y}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let A=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(A)||A} { ${y} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let j=Ss(`x { ${y} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((X)=>Mi(X,t,i,n,a,l)).join(`
|
|
222
|
+
`);return`${c} {
|
|
223
|
+
${j}
|
|
224
|
+
}`}return`${c} { ${y} }`}let v=lc(c,t,i,n),E=y;for(let[A,j]of a)E=E.replace(new RegExp(`\\b${A}\\b`,"g"),j);if(l)E=E.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${v} { ${E} }`}function lc(e,t,i,n){let a=e.split(",").map((c)=>c.trim()),l=[];for(let c of a){if(c.startsWith(":host")){if(n)l.push(c);else{let E=c.replace(/:host(\([^)]*\))?/,`.${t}$1`);l.push(E)}continue}if(c.includes("::slotted")){l.push(c);continue}if(c===":root"){l.push(`:root .${t}`);continue}let y=i?`${i} .${t}`:`.${t}`;l.push(`${y} ${c}`);let v=uc(c,t);if(v)l.push(i?`${i} ${v}`:v)}return l.join(", ")}function uc(e,t){let i=0,n=e.length;for(let v=0;v<e.length;v++){let E=e[v];if(E==="["||E==="(")i++;else if(E==="]"||E===")")i--;else if(i===0&&(E===" "||E===">"||E==="+"||E==="~")){n=v;break}}let a=e.slice(0,n),l=e.slice(n);if(!a)return"";let c=a.length,y=0;for(let v=0;v<a.length;v++){let E=a[v];if(E==="["||E==="(")y++;else if(E==="]"||E===")")y--;else if(i===0&&y===0&&E===":"){c=v;break}}return`${a.slice(0,c)}.${t}${a.slice(c)}${l}`}var Ni=String.raw`(?<![\w-])scoped(?![\w-])`,$s=/<style\s+([^>]*)>/gi,ji=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Li=new RegExp(Ni,"i"),fc=new RegExp(Ni,"gi"),vs=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function pc(e){$s.lastIndex=0;let t=$s.exec(e);while(t!==null){if(Li.test(t[1]))return!0;t=$s.exec(e)}return!1}function pi(e){let t=new Set,i=[];vs.lastIndex=0;let n=vs.exec(e);while(n!==null){let a=n[0].trim();if(t.has(a))i.push({start:n.index,end:n.index+n[0].length});else t.add(a);n=vs.exec(e)}return i}function fn(e){let t=pi(e);if(t.length===0)return e;let i=Array(t.length+1),n=0;for(let a=0;a<t.length;a++){let l=t[a];i[a]=e.slice(n,l.start),n=l.end}return i[t.length]=e.slice(n),i.join("")}function Bs(e,t){if(!pc(e))return{html:e,hasScoped:!1};let i=Pi(t),n=`data-v-${i}`,a=e,l=!1;if(ji.lastIndex=0,a=a.replace(ji,(c,y,v)=>{if(!Li.test(y))return c;l=!0;let E=dc(v,n),A=y.replace(fc,"").trim(),j=A?` ${A}`:"";return`<style data-stx-scoped="${i}"${j}>${E}</style>`}),!l)return{html:e,hasScoped:!1};return a=mc(a,n),{html:a,hasScoped:!0}}function dc(e,t){return Oi(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var gc=(e)=>`\x00stx-scope-mask-${e}\x00`,Di=/\u0000stx-scope-mask-(\d+)\u0000/g;function mc(e,t){let i=pe(e,(a,l)=>{let c=W(a,l);return c>l?c:pn(a,l)},(a,l)=>gc(l)),n=hc(i.output,t);return Di.lastIndex=0,n.replace(Di,(a,l)=>i.tokens[Number(l)])}function hc(e,t){let i=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,(n,a,l)=>{if(i.has(a.toLowerCase()))return n;if(n.includes(t))return n;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return n;if(l)return n.replace(`<${a}${l}`,`<${a} ${t}${l}`);if(n.endsWith("/>"))return`<${a} ${t} />`;return`<${a} ${t}>`})}var Gt=/<\/?template\b[^>]*>/gi,xc=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function bc(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return xc.test(t)}function de(e){Gt.lastIndex=0;let t;while((t=Gt.exec(e))!==null){if(t[0].startsWith("</")||bc(t[0]))continue;let i=t.index,n=Gt.lastIndex,a=1,l;while((l=Gt.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let c=l.index;return{start:i,openEnd:n,closeStart:c,end:Gt.lastIndex,content:e.slice(n,c)}}}else a++;return null}return null}var yc=0,_c=0;function Fn(e,t){let i=/(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;for(let n of e.matchAll(i))if(n[1].toLowerCase()===t.toLowerCase())return n[2]??n[3]??n[4]??null;return null}function Bi(e){let t=[],i=/<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;return w(e,(n,a)=>{i.lastIndex=a;let l=i.exec(n);if(!l||!Fn(l[2],"x-data"))return-1;return t.push({fullMatch:l[0],tagName:l[1],attributes:l[2],startIndex:a,endIndex:i.lastIndex}),i.lastIndex}),t}function wc(e){let t=[];for(let{fullMatch:i,tagName:n,attributes:a,startIndex:l}of Bi(e)){let c=Fn(a,"x-data");if(!c)continue;let y=`__stx_scope_${yc++}`,v=Fn(a,"x-init"),E=Sc(e,n,l+i.length),A=e.slice(l,E.endIndex),j=vc(A);t.push({id:y,selector:`[data-stx-scope="${y}"]`,stateExpr:c,initExpr:v,bindings:[],refs:j})}return t}function Sc(e,t,i){let n=1,a=i,l=new RegExp(`<${t}(?:\\s|>)`,"gi"),c=new RegExp(`</${t}>`,"gi"),y=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(n>0&&a<e.length){l.lastIndex=a,c.lastIndex=a,y.lastIndex=a;let v=l.exec(e),E=c.exec(e),A=y.exec(e);if(A&&A.index<(v?.index??1/0)){a=A.index+A[0].length;continue}if(!E)return{endIndex:e.length};if(v&&v.index<E.index)n++,a=v.index+v[0].length;else{if(n--,n===0)return{endIndex:E.index+E[0].length};a=E.index+E[0].length}}return{endIndex:e.length}}function vc(e){let t=new Map,i=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),n=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,a;while((a=n.exec(i))!==null){let[,l,c]=a,y=Ec(l);t.set(c,y)}return t}function Ec(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${_c++}`}function kc(){return`
|
|
225
|
+
// STX Reactive Runtime - x-cloak and transition CSS
|
|
226
|
+
(function() {
|
|
227
|
+
var style = document.createElement('style');
|
|
228
|
+
style.textContent = [
|
|
229
|
+
'[x-cloak] { display: none !important; }',
|
|
230
|
+
// Default transition classes
|
|
231
|
+
'.stx-enter { opacity: 0; transform: scale(0.95); }',
|
|
232
|
+
'.stx-enter-start { opacity: 0; transform: scale(0.95); }',
|
|
233
|
+
'.stx-enter-active { transition: opacity 150ms ease-out, transform 150ms ease-out; }',
|
|
234
|
+
'.stx-enter-to { opacity: 1; transform: scale(1); }',
|
|
235
|
+
'.stx-leave { opacity: 1; transform: scale(1); }',
|
|
236
|
+
'.stx-leave-start { opacity: 1; transform: scale(1); }',
|
|
237
|
+
'.stx-leave-active { transition: opacity 100ms ease-in, transform 100ms ease-in; }',
|
|
238
|
+
'.stx-leave-to { opacity: 0; transform: scale(0.95); }'
|
|
239
|
+
].join('\\n');
|
|
240
|
+
document.head.appendChild(style);
|
|
241
|
+
})();
|
|
242
|
+
|
|
243
|
+
// STX Reactive Runtime
|
|
244
|
+
/* eslint-disable pickier/no-unused-vars, no-console, prefer-const */
|
|
245
|
+
window.__stx_reactive = (function() {
|
|
246
|
+
'use strict';
|
|
247
|
+
|
|
248
|
+
// Deep reactive proxy that triggers onChange for any mutation
|
|
249
|
+
function reactive(obj, onChange) {
|
|
250
|
+
if (!obj || typeof obj !== 'object') return obj;
|
|
251
|
+
return new Proxy(obj, {
|
|
252
|
+
get(target, prop) {
|
|
253
|
+
const value = target[prop];
|
|
254
|
+
if (value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Promise)) {
|
|
255
|
+
return reactive(value, onChange);
|
|
256
|
+
}
|
|
257
|
+
return value;
|
|
258
|
+
},
|
|
259
|
+
set(target, prop, value) {
|
|
260
|
+
target[prop] = value;
|
|
261
|
+
onChange(prop, value);
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
|
|
268
|
+
// then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
|
|
269
|
+
function initScope(scopeEl, initialState, bindings, refs, initExpr, deferInit) {
|
|
270
|
+
// Parse initial state (may contain methods including async init())
|
|
271
|
+
var state;
|
|
272
|
+
try {
|
|
273
|
+
state = new Function('return (' + initialState + ')')();
|
|
274
|
+
} catch (e) {
|
|
275
|
+
console.error('[stx-reactive] Invalid x-data:', initialState, e);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Build $refs object
|
|
280
|
+
var $refs = {};
|
|
281
|
+
for (var name in refs) {
|
|
282
|
+
if (Object.prototype.hasOwnProperty.call(refs, name)) {
|
|
283
|
+
(function(refName, refId) {
|
|
284
|
+
Object.defineProperty($refs, refName, {
|
|
285
|
+
get: function() { return document.getElementById(refId); }
|
|
286
|
+
});
|
|
287
|
+
})(name, refs[name]);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Extract init method from state if present (Alpine.js convention)
|
|
292
|
+
var initMethod = state.init;
|
|
293
|
+
if (typeof initMethod === 'function') {
|
|
294
|
+
delete state.init;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Make state reactive \u2014 mutations trigger re-render via signals
|
|
298
|
+
var scopeId = scopeEl.getAttribute('data-stx-scope');
|
|
299
|
+
var stx = window.stx;
|
|
300
|
+
|
|
301
|
+
// Create signals for each state property so the signals runtime can track dependencies
|
|
302
|
+
var signalState = {};
|
|
303
|
+
var rawState = {};
|
|
304
|
+
var derivedState = {};
|
|
305
|
+
var accessors = {};
|
|
306
|
+
// A getter must NOT be read here. Reading one calls it, and the old loop did
|
|
307
|
+
// exactly that: the returned value is not a function, so it was wrapped as a
|
|
308
|
+
// plain state() -- a snapshot of the answer at construction time, frozen
|
|
309
|
+
// forever while plain properties beside it updated (#2053). A getter is a
|
|
310
|
+
// derived value, so it is registered as one below, once ctxProxy exists for
|
|
311
|
+
// it to read through.
|
|
312
|
+
var ownDescriptors = Object.getOwnPropertyDescriptors ? Object.getOwnPropertyDescriptors(state) : {};
|
|
313
|
+
for (var key in state) {
|
|
314
|
+
if (Object.prototype.hasOwnProperty.call(state, key)) {
|
|
315
|
+
var descriptor = ownDescriptors[key];
|
|
316
|
+
if (descriptor && typeof descriptor.get === 'function') {
|
|
317
|
+
accessors[key] = descriptor;
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
if (typeof state[key] === 'function') {
|
|
321
|
+
// Methods \u2014 bind to a proxy so 'this.prop = val' triggers signal updates
|
|
322
|
+
signalState[key] = state[key];
|
|
323
|
+
} else {
|
|
324
|
+
// Data properties \u2014 wrap in signals for reactivity
|
|
325
|
+
signalState[key] = stx.state(state[key]);
|
|
326
|
+
rawState[key] = true;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Create a proxy context that auto-unwraps signals and writes back through them.
|
|
332
|
+
// Methods get 'this' bound to this proxy so this.foo = bar triggers reactivity.
|
|
333
|
+
var ctx = {};
|
|
334
|
+
var ctxProxy = new Proxy(ctx, {
|
|
335
|
+
get: function(target, prop) {
|
|
336
|
+
if (prop === '$refs') return $refs;
|
|
337
|
+
if (prop === '$el') return scopeEl;
|
|
338
|
+
if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
|
|
339
|
+
if (prop === Symbol.unscopables) return undefined;
|
|
340
|
+
if (!(prop in signalState)) {
|
|
341
|
+
var owner = stx._scopeForBinding(scopeEl, prop);
|
|
342
|
+
return owner ? owner[prop] : undefined;
|
|
343
|
+
}
|
|
344
|
+
var s = signalState[prop];
|
|
345
|
+
if (!s) return undefined;
|
|
346
|
+
if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
|
|
347
|
+
return s.value; // unwrap signal
|
|
348
|
+
}
|
|
349
|
+
if (typeof s === 'function' && !rawState[prop]) {
|
|
350
|
+
return s.bind(ctxProxy); // bind methods to proxy
|
|
351
|
+
}
|
|
352
|
+
return s;
|
|
353
|
+
},
|
|
354
|
+
set: function(target, prop, value) {
|
|
355
|
+
var accessor = derivedState[prop];
|
|
356
|
+
if (accessor) {
|
|
357
|
+
// A getter/setter pair writes through its setter. A getter alone has
|
|
358
|
+
// nowhere to put the value: a derived has no .value setter, so the
|
|
359
|
+
// assignment would be a silent no-op, which is the same class of
|
|
360
|
+
// failure as the stale read this replaces.
|
|
361
|
+
if (typeof accessor.set === 'function') {
|
|
362
|
+
accessor.set.call(ctxProxy, value);
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
console.warn('[stx-reactive] cannot assign to ' + String(prop) + ': it is a getter in x-data, so its value comes from what it reads. Give it a setter, or make it a plain property.');
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
var s = signalState[prop];
|
|
369
|
+
if (rawState[prop] && s && typeof s === 'function') {
|
|
370
|
+
s.value = value; // write through signal \u2014 triggers effects
|
|
371
|
+
} else {
|
|
372
|
+
signalState[prop] = value;
|
|
373
|
+
}
|
|
374
|
+
return true;
|
|
375
|
+
},
|
|
376
|
+
has: function(target, prop) {
|
|
377
|
+
return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick' || !!stx._scopeForBinding(scopeEl, prop);
|
|
378
|
+
},
|
|
379
|
+
ownKeys: function() {
|
|
380
|
+
return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
|
|
381
|
+
},
|
|
382
|
+
getOwnPropertyDescriptor: function(target, prop) {
|
|
383
|
+
if (prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick') {
|
|
384
|
+
return { configurable: true, enumerable: true, writable: true, value: ctxProxy[prop] };
|
|
385
|
+
}
|
|
386
|
+
return undefined;
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// Now that ctxProxy exists, a getter becomes a derived that reads through it,
|
|
391
|
+
// so it tracks whatever it touches and recomputes when that changes. derived()
|
|
392
|
+
// is lazy, so nothing is evaluated until a binding actually reads it.
|
|
393
|
+
//
|
|
394
|
+
// Marked rawState as well: that is what makes the proxy unwrap it and what
|
|
395
|
+
// exposes the signal itself to the runtime below, which is where dependency
|
|
396
|
+
// tracking comes from. A getter needs both, exactly like a data property.
|
|
397
|
+
for (var accessorKey in accessors) {
|
|
398
|
+
if (Object.prototype.hasOwnProperty.call(accessors, accessorKey)) {
|
|
399
|
+
(function(name, descriptor) {
|
|
400
|
+
signalState[name] = stx.derived(function() {
|
|
401
|
+
return descriptor.get.call(ctxProxy);
|
|
402
|
+
});
|
|
403
|
+
rawState[name] = true;
|
|
404
|
+
derivedState[name] = descriptor;
|
|
405
|
+
})(accessorKey, accessors[accessorKey]);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// Build scope vars for the signals runtime \u2014 it reads these for expression evaluation.
|
|
410
|
+
// We need to provide getter/setter descriptors so signals track properly.
|
|
411
|
+
var scopeVars = {};
|
|
412
|
+
for (var k in signalState) {
|
|
413
|
+
if (Object.prototype.hasOwnProperty.call(signalState, k)) {
|
|
414
|
+
if (rawState[k]) {
|
|
415
|
+
// Data: expose the signal directly so expressions trigger dependency tracking
|
|
416
|
+
scopeVars[k] = signalState[k];
|
|
417
|
+
} else {
|
|
418
|
+
// Method: bind to ctxProxy so 'this' works
|
|
419
|
+
scopeVars[k] = (typeof signalState[k] === 'function') ? signalState[k].bind(ctxProxy) : signalState[k];
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
scopeVars.$refs = $refs;
|
|
424
|
+
scopeVars.$el = scopeEl;
|
|
425
|
+
scopeVars.$nextTick = function(fn) { requestAnimationFrame(fn); };
|
|
426
|
+
|
|
427
|
+
// Register scope \u2014 merge with any existing vars from partial signal scripts
|
|
428
|
+
if (!stx._scopes) stx._scopes = {};
|
|
429
|
+
var registered = stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
|
|
430
|
+
registered.__el = scopeEl;
|
|
431
|
+
|
|
432
|
+
// Store on element for findElementScope
|
|
433
|
+
scopeEl.__stx_scope = scopeVars;
|
|
434
|
+
|
|
435
|
+
// Run init() if present (supports async)
|
|
436
|
+
function runInit() {
|
|
437
|
+
var maybePromise;
|
|
438
|
+
if (initMethod) {
|
|
439
|
+
maybePromise = initMethod.call(ctxProxy);
|
|
440
|
+
}
|
|
441
|
+
if (initExpr) {
|
|
442
|
+
try {
|
|
443
|
+
var fn = new Function('with(this){' + initExpr + ';}');
|
|
444
|
+
var result = fn.call(ctxProxy);
|
|
445
|
+
if (result && typeof result.then === 'function') maybePromise = result;
|
|
446
|
+
} catch (e) {
|
|
447
|
+
console.warn('[stx-reactive] init expression error:', e);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
// If init is async, signal updates will trigger effects automatically
|
|
451
|
+
// when init() resolves and sets this.prop = value (writes through signal)
|
|
452
|
+
if (maybePromise && typeof maybePromise.then === 'function') {
|
|
453
|
+
maybePromise.catch(function(e) {
|
|
454
|
+
console.error('[stx-reactive] async init() error:', e);
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// A component's helper setup follows its markup. Its own mount queue
|
|
460
|
+
// starts the initializer after all component factories have registered.
|
|
461
|
+
// Standalone x-data retains synchronous initialization.
|
|
462
|
+
if (deferInit) {
|
|
463
|
+
registered.__mountCallbacks = registered.__mountCallbacks || [];
|
|
464
|
+
registered.__mountCallbacks.push(runInit);
|
|
465
|
+
} else {
|
|
466
|
+
runInit();
|
|
467
|
+
}
|
|
468
|
+
var destroyExpr = scopeEl.getAttribute('data-stx-xdestroy') || scopeEl.getAttribute('x-destroy');
|
|
469
|
+
if (destroyExpr) {
|
|
470
|
+
registered.__destroyCallbacks = registered.__destroyCallbacks || [];
|
|
471
|
+
var teardown = function() { scopeEl.__stx_execute(destroyExpr); };
|
|
472
|
+
registered.__destroyCallbacks.push(teardown);
|
|
473
|
+
registered.__destroyHooks = registered.__destroyHooks || [];
|
|
474
|
+
registered.__destroyHooks.push(teardown);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Expose for debugging
|
|
478
|
+
scopeEl.__stx_state = ctxProxy;
|
|
479
|
+
scopeEl.__stx_execute = function(stmt, $event, $el) {
|
|
480
|
+
try {
|
|
481
|
+
// Run the statement with the reactive proxy as the lexical scope.
|
|
482
|
+
// Wrapping in a with-block on the proxy makes bare reads/writes go
|
|
483
|
+
// through it (so foo = bar triggers signal.set()) instead of treating
|
|
484
|
+
// each state key as a local function parameter \u2014 bare assignments
|
|
485
|
+
// would otherwise just rebind the local and never reach the signal.
|
|
486
|
+
var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
|
|
487
|
+
fn.call(ctxProxy, $event, $el);
|
|
488
|
+
} catch (e) {
|
|
489
|
+
console.warn('[stx-reactive] execute error:', e);
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
return { initScope: initScope, reactive: reactive };
|
|
495
|
+
})();
|
|
496
|
+
`}function zi(e,t){let i=e.replace(/\{!!([\s\S]*?)!!\}/g,(y,v)=>{try{let E=R(v,t,!0);if(E===void 0)return y;return String(E)}catch{return y}}),n="",a=0,l=null;while(a<i.length){let y=i[a];if(l&&y==="\\"){n+=y+(i[a+1]??""),a+=2;continue}if(y==="{"&&i[a+1]==="{"){let v=i.indexOf("}}",a+2);if(v!==-1){let E=i.slice(a,v+2);n+=c(i.slice(a+2,v),E,l),a=v+2;continue}}if(l){if(y===l)l=null}else if(y==="'"||y==='"'||y==="`")l=y;n+=y,a++}return n;function c(y,v,E){let A;try{A=R(y,t,!0)}catch{return v}if(A===void 0)return v;if(E){let j=String(A).replace(/\\/g,"\\\\").replace(new RegExp(E==="`"?"`":E,"g"),`\\${E}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return E==="`"?j.replace(/\$\{/g,"\\${"):j}if(typeof A==="string"){let j=A.trim();if(j.startsWith("{")&&j.endsWith("}")||j.startsWith("[")&&j.endsWith("]"))try{return JSON.parse(j),j}catch{}}return JSON.stringify(A)}}function Cc(e,t,i){if(e.length===0)return"";let n=e.map((a)=>{let l=JSON.stringify(Object.fromEntries(a.refs)),c=zi(a.stateExpr,t),y=a.initExpr?zi(a.initExpr,t):null,v=JSON.stringify(c),E=y?JSON.stringify(y):"null";return`
|
|
497
|
+
(function() {
|
|
498
|
+
var scopeEl = document.querySelector('${a.selector}');
|
|
499
|
+
if (!scopeEl) return;
|
|
500
|
+
var refs = ${l};
|
|
501
|
+
window.__stx_reactive.initScope(scopeEl, ${v}, [], refs, ${E}${i?", true":""});
|
|
502
|
+
})();`}).join(`
|
|
503
|
+
`);return`
|
|
504
|
+
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
505
|
+
${kc()}
|
|
506
|
+
${n}
|
|
507
|
+
</script>`}function Bc(e,t,i,n=!1){if(!Es(e))return e;let a=wc(e);if(a.length===0)return e;let l=Tc(e,a),c=Cc(a,t,n),y=l.lastIndexOf("</body>");if(y!==-1)l=l.slice(0,y)+c+`
|
|
508
|
+
`+l.slice(y);else l+=c;return l}function Tc(e,t){let i=[],n=0;for(let[l,c]of Bi(e).entries()){let y=t[l];if(!y)break;i.push(e.slice(n,c.startIndex));let v=Fn(c.attributes,"data-stx-scope");if(v)y.id=v,y.selector=`[data-stx-scope="${y.id}"]`,i.push(c.fullMatch);else i.push(`<${c.tagName} data-stx-scope="${y.id}"${c.attributes}>`);n=c.endIndex}i.push(e.slice(n));let a=i.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function Es(e){return/x-data\s*=\s*["']/.test(e)}function zs(e,t){let i=e,n=/@json\s*\(/g,a;while((a=n.exec(i))!==null){let l=a.index,c=l+a[0].length-1,y=1,v=c+1,E=null,A=!1;while(v<i.length&&y>0){let D=i[v];if(A){A=!1,v++;continue}if(D==="\\"&&E){A=!0,v++;continue}if(E){if(D===E)E=null;v++;continue}if(D==='"'||D==="'"||D==="`"){E=D,v++;continue}if(D==="(")y++;else if(D===")"){if(y--,y===0)break}v++}if(y!==0)break;let j=i.substring(c+1,v).trim(),X=i.substring(l,v+1),M=-1,I=0,z=null,L=!1;for(let D=0;D<j.length;D++){let ee=j[D];if(L){L=!1;continue}if(ee==="\\"&&z){L=!0;continue}if(z){if(ee===z)z=null;continue}if(ee==='"'||ee==="'"||ee==="`"){z=ee;continue}if(ee==="("||ee==="["||ee==="{")I++;else if(ee===")"||ee==="]"||ee==="}")I--;if(ee===","&&I===0){M=D;break}}let B=M>=0?j.substring(0,M).trim():j,Q=M>=0?j.substring(M+1).trim():void 0;try{let D=B.trim(),ee;if(f(D))ee=d(D,Object.keys(t))(...Object.values(t));else ee=void 0;let ne;if(Q==="true")ne=JSON.stringify(ee,null,2);else ne=JSON.stringify(ee);let te=ne.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");i=i.substring(0,l)+te+i.substring(v+1),n.lastIndex=l+te.length}catch(D){F.log(D instanceof Error?D:Error(String(D)),{directive:"@json"},"error"),n.lastIndex=l+X.length}}return i}function Hs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Fc(e){let t=e,i=/@memo\s*\(/g,n,a=[];while((n=i.exec(t))!==null){let l=n.index,c=l+n[0].length,y=1,v=c;while(v<t.length&&y>0){if(t[v]==="(")y++;else if(t[v]===")")y--;v++}if(y!==0)continue;let E=t.slice(c,v-1).trim(),A=v,j=t.slice(A),X=j.indexOf("@endmemo");if(X===-1)continue;let M=j.slice(0,X),I=A+X+8,z=M.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=z?z[0].length:0,B=M.slice(L),Q=M.match(/(\s*)$/),D=Q?Q[0].length:0,ee=B.slice(0,B.length-D),ne=ee.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),te;if(ne){let[le,he,ue="",Re]=ne,Ae=`<${he}${ue} data-stx-memo="${E}"${Re}>`;te=M.slice(0,L)+Ae+ee.slice(le.length)+M.slice(L+ee.length)}else te=`${M.slice(0,L)}<div data-stx-memo="${E}">${ee}</div>${M.slice(L+ee.length)}`;a.push({start:l,end:I,replacement:te}),i.lastIndex=I}for(let l=a.length-1;l>=0;l--){let c=a[l];t=t.slice(0,c.start)+c.replacement+t.slice(c.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function fi(e){let t=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return t=t.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),t}function Ui(e,t){if(!/\bref\s*=/.test(e))return e;let i=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,n=w(e,(v,E)=>{i.lastIndex=E;let A=i.exec(v);if(!A||/^(?:script|style)$/i.test(A[1]))return-1;return i.lastIndex}),a=[],l=0,c=0,y=[];for(let{start:v,end:E,token:A}of n){let j=/^<\/?([\w-]+)/.exec(A)[1].toLowerCase();if(A.startsWith("</")){let z;while(z=a.pop()){if(z.scoped)l--;if(z.name===j)break}continue}let X=/\sdata-stx-scope\s*=/.test(A),M=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(A),I=a.find((z)=>z.scoped)?.scopeId;if(M&&I&&M[2]===I)y.push(e.slice(c,v),A.replace(M[0],` data-stx-ref-caller="${t}"`)),c=E;else if(!l&&!X&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(A)&&!/\sdata-stx-ref-caller\s*=/.test(A))y.push(e.slice(c,v),A.replace(/\s*\/?>$/,(z)=>` data-stx-ref-caller="${t}"${z}`)),c=E;if(!Hi.has(j)&&!/\/>$/.test(A)){let z=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(A);if(a.push({name:j,scoped:X,scopeId:z?.[1]??z?.[2]}),X)l++}}return y.push(e.slice(c)),y.join("")}var Hi=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),qi=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Wi=/<\/?\s*([a-z][\w-]*)/iy,tl=/\s/;function nl(e,t){let i=t-1;while(i>=0&&tl.test(e[i]))i--;return i>=0&&e[i]==="/"}function sl(e,t){let i=!1,n=!1;for(let a=t;a<e.length;a++){let l=e[a];if(i){if(l==="'")i=!1}else if(n){if(l==='"')n=!1}else if(l==="'")i=!0;else if(l==='"')n=!0;else if(l===">")return a}return-1}function rl(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let i=0,n=t,a=!1,l=!1,c=!1;while(n<e.length){let y=e.indexOf("<",n),v=y===-1?e.length:y;if(v>n){if(i===0)while(n<v){let j=e.indexOf(l?"}":"{",n);if(j===-1||j>=v){if(l)c=!1;else a=!1;break}if(j>n)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;n=j+1}n=v;continue}if(e.startsWith("<!--",n)){let j=e.indexOf("-->",n);n=j===-1?e.length:j+3;continue}let E=sl(e,n);if(E===-1)break;Wi.lastIndex=n;let A=Wi.exec(e)?.[1]?.toLowerCase()??"";if(e[n+1]==="/"){if(i===0)break;i--}else if(!nl(e,E)&&!Hi.has(A))i++;n=E+1}return!1}var Fi=b(256);function zc(e){if(e.length<1024)return Vi(e);let t=S(e),i=Fi.get(t);if(i!==void 0)return i;let n=Vi(e);return Fi.set(t,n),n}function Vi(e){if(e.length>=32768&&!Xr(e))return e;let i=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"),n="",a=0,l;while((l=i.exec(e))!==null){let c=l.index,y=c+l[0].length,v=!1,E=!1,A=-1;while(y<e.length){let X=e[y];if(v){if(X==="'")v=!1}else if(E){if(X==='"')E=!1}else if(X==="'")v=!0;else if(X==='"')E=!0;else if(X===">"){A=y;break}y++}if(A===-1)continue;let j=e.slice(c,A+1);if(qi.test(j))continue;if(j.includes("x-cloak"))continue;if(rl(e,A+1))n+=e.slice(a,A)+" x-cloak>",a=A+1}return n+=e.slice(a),n}var il=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,ol=/<\/script>/gi,al=/<\/style>/gi;function Hc(e){let t=/<[a-z][\w-]*/gi,i="",n=0,a;while((a=t.exec(e))!==null){let l=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let I=c==="script"?ol:al;I.lastIndex=l;let z=I.exec(e);if(z!==null)t.lastIndex=z.index+z[0].length;continue}let y=l+a[0].length,v=!1,E=!1,A=-1;while(y<e.length){let I=e[y];if(v){if(I==="'")v=!1}else if(E){if(I==='"')E=!1}else if(I==="'")v=!0;else if(I==='"')E=!0;else if(I===">"){A=y;break}y++}if(A===-1)continue;let j=e.slice(l+a[0].length,A);if(qi.test(j))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(j))continue;if(!il.test(j))continue;let X=e[A-1]==="/",M=X?A-1:A;i+=`${e.slice(n,M)} x-cloak${X?" ":""}`,n=M}return i+=e.slice(n),i}import ao from"path";import Rs from"fs";import Yt from"path";function Zi(e,t,i,n){let a=0;for(let l=t;l<e.length;l++)if(e[l]===i)a++;else if(e[l]===n&&!(n===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function cl(e){let t=r(e),i=0,n=0,a=[];for(let l=0;l<t.length;l++)if("([{".includes(t[l]))i++;else if(")]}".includes(t[l]))i--;else if(t[l]===","&&i===0)a.push(e.slice(n,l).trim()),n=l+1;return a.push(e.slice(n).trim()),a}function ks(e,t){let i=r(e),n=new RegExp(`\\b(?:${t.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of i.matchAll(n)){let l=a.index+a[0].length,c="";if(i[l]==="<"){let v=Zi(i,l,"<",">");if(v<0)continue;c=e.slice(l+1,v),l=v+1;while(/\s/.test(i[l]||"")&&l<i.length)l++}if(i[l]!=="(")continue;let y=Zi(i,l,"(",")");if(y>=0)return{type:c,args:cl(e.slice(l+1,y))}}return null}var Ki=`
|
|
509
|
+
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;
|
|
510
|
+
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
511
|
+
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>;
|
|
512
|
+
type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
|
|
513
|
+
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
514
|
+
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]> };
|
|
515
|
+
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
516
|
+
`;function Xi(e,t){let i=[],n={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=r(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(X,M,I,z,L)=>{if(a.slice(L,L+6)!=="import")return X;if(z.endsWith(".stx"))return"";let B=`${t}Import${i.length}`;if(i.push(`import * as ${B} from ${JSON.stringify(z)};`),M.startsWith("*"))return`import ${M.replace(/^\*\s+as\s+/,"")} = ${B};`;if(!M.startsWith("{"))return`import ${M} = ${B}.default;`;return M.slice(1,-1).split(",").map((Q)=>{let[D,ee=D]=Q.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!D)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(z)&&D in n)n[D].push(ee);return`import ${ee} = ${B}.${D};`}).join(`
|
|
517
|
+
`)}),c=ks(e,n.defineProps),y=ks(e,n.defineEmits),v=ks(e,n.withDefaults);if(!c&&!y)return{declarations:"",props:null,events:null};let E=[],A=null,j=null;if(c){E.push(`const __options = (${c.args[0]||"{}"}) as const;`),E.push(`const __defaults = (${v?.args[1]||"{}"});`);let X=c.type||"__StxOptions<typeof __options>";E.push(`export type __StxProps = __StxDefaults<${X}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),A=`${t}.__StxProps`}if(y)E.push(`const __events = (${y.args[0]||"[]"}) as const;`),E.push(`export type __StxEvents = ${y.type||"Record<(typeof __events)[number], any[]>"};`),j=`${t}.__StxEvents`;return{declarations:`${i.join(`
|
|
518
|
+
`)}
|
|
519
|
+
namespace ${t} {
|
|
520
|
+
${l}
|
|
521
|
+
${E.join(`
|
|
522
|
+
`)}
|
|
523
|
+
}`,props:A,events:j}}var Sr=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 kr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Sr].some((t)=>t.toLowerCase()===e.toLowerCase());return Sr.has(e)||/[A-Z]/.test(e)}function*ll(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,i;while(i=t.exec(e)){let n=t.lastIndex,a=[];while(n<e.length){while(/\s/.test(e[n]||""))n++;if(e[n]===">"||e.slice(n,n+2)==="/>"){n+=e[n]===">"?1:2;break}let l=/^[^\s=/>]+/.exec(e.slice(n))?.[0];if(!l){n++;continue}let c=n;n+=l.length;while(/\s/.test(e[n]||""))n++;if(e[n]!=="="){a.push({name:l,value:!0,offset:c,braced:!1});continue}n++;while(/\s/.test(e[n]||""))n++;let y=e[n],v=y==="{",E=y==='"'||y==="'";if(E||v)n++;let A=n;if(v){let j=r(e.slice(n)),X=1,M=0;for(;M<j.length;M++){if(j[M]==="{")X++;if(j[M]==="}"&&--X===0)break}n+=M}else if(E)while(n<e.length&&e[n]!==y)n++;else while(n<e.length&&!/[\s/>]/.test(e[n]))n++;if(a.push({name:l,value:e.slice(A,n),offset:A,braced:v}),E||v)n++}t.lastIndex=n,yield{name:i[1],offset:i.index,attributes:a}}}function Ji(e,t,i){let n=[],a=[Ki,"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 __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : 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=i.scriptCode(e,i.filePath),E=r(v);for(let I of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(E.slice(I.index,I.index+6)!=="import")continue;let z=I[2],L=Yt.isAbsolute(z)||z.startsWith(".")?Yt.resolve(Yt.dirname(i.filePath),z):Os(z,Yt.dirname(i.filePath));if(!L)continue;let B=L.endsWith(".stx")?L:Rs.existsSync(`${L}.stx`)?`${L}.stx`:void 0,Q=B?null:yr(L,!1),D=I[1].startsWith("{")?I[1].slice(1,-1).split(","):[I[1]];for(let ee of D){let[ne,te=ne]=ee.trim().split(/\s+as\s+/),le=B||Q?.get(ne)||Q?.get(ne.toLowerCase());if(le)y.set(te,le),y.set(te.toLowerCase(),le),y.set(te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),le)}}for(let I of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let z of I[1].matchAll(/['"]([^'"]+)['"]/g)){let L=Ns(z[1],i.filePath,i).find((B)=>Rs.statSync(B,{throwIfNoEntry:!1})?.isFile());if(L)y.set(Yt.basename(z[1]).replace(/\.stx$/,""),L)}let A={__importedComponents:y},j=new Map,X=(I,z,L)=>{let B=e.slice(0,I);return{code:z,offset:I,attribute:L,anchor:!0,kind:"directive",line:B.split(`
|
|
524
|
+
`).length,column:I-B.lastIndexOf(`
|
|
525
|
+
`)}},M=(I,z,L)=>n.push({expression:I,statement:{text:z+I.code+L,prefixLength:z.length}});for(let I of ll(t)){if(kr(I.name)||I.name==="component")continue;let z=Er(I.name,i.filePath,i,A);if(!z)continue;let L=j.get(z);if(!L){let Q;try{Q=i.readComponent?i.readComponent(z):Rs.readFileSync(z,"utf8")}catch{continue}if(Q===void 0)continue;c.set(z,Q),L=Xi(i.scriptCode(Q,z),`__StxComponent${j.size}`),j.set(z,L),a.push(L.declarations)}let B=[];for(let Q of I.attributes){let{name:D,offset:ee}=Q,ne=Q.value===!0?"true":Q.value;if(D.startsWith("@")||D.startsWith("v-on:")){if(L.events&&Q.value!==!0)l.set(ee,`__StxEvent<${L.events}, ${JSON.stringify(D.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let te=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(D);if(D.startsWith("v-")&&!D.startsWith("v-bind:")&&!te)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(D))continue;let le=(te?te[1]||"modelValue":D.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ae,Ue)=>Ue.toUpperCase());if(B.push(le),!L.props)continue;let he=D.startsWith(":")||D.startsWith("v-bind:")||!!te||Q.braced,ue=he?ne:Q.value!==!0?JSON.stringify(ne):"true",Re=!he&&Q.value!==!0&&(ne==="true"||ne==="false");M(X(ee,ue,D),";void ((",`) satisfies ${Re?"__StxStaticProp":"__StxProp"}<${L.props}, ${JSON.stringify(le)}>);`)}if(L.props){let Q=[...new Set(B)].map((ee)=>`${JSON.stringify(ee)}: undefined as any`).join(", "),D=X(I.offset,`<${I.name}>`);n.push({expression:D,statement:{text:`;void ({ ${Q} } satisfies ${L.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:j.size?a.join(`
|
|
526
|
+
`):"",checks:n,events:l,dependencies:c}}var Gi=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function fl(e){let t=(i)=>i.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function Pt(e){let t=[],i=fl(e);Gi.lastIndex=0;let n;while((n=Gi.exec(i))!==null){let a=(n[1]||"").trim(),l=(n[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(n[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,y=n.index+l,v=n.index+n[0].length-c,E=e.slice(y,v);if(/\bsrc\s*=/.test(a))continue;let A=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(A&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(A[1]))continue;let j=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",X=Qt(e,y);t.push({kind:j,code:E,startLine:X,startColumn:en(e,y),offset:y,attrs:a})}return t}function Qt(e,t){let i=1;for(let n=0;n<t&&n<e.length;n++)if(e.charCodeAt(n)===10)i++;return i}function en(e,t){let i=e.lastIndexOf(`
|
|
527
|
+
`,t-1)+1;return t-i+1}function Vn(e){let t=e.split(""),i=(a,l)=>{for(let c=a;c<l&&c<t.length;c++)if(t[c]!==`
|
|
528
|
+
`)t[c]=" "},n=[/<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 n){a.lastIndex=0;let l;while((l=a.exec(e))!==null)i(l.index,l.index+l[0].length)}return t.join("")}function co(e){let t=0,i="";for(let n=0;n<e.length;n++){let a=e[n];if(i){if(a==="\\"){n++;continue}if(a===i)i="";continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{"){t++;continue}if(a===")"||a==="]"||a==="}"){t--;continue}if(a==="|"&&t===0){if(e[n+1]==="|"){n++;continue}if(e[n-1]==="|")continue;return e.slice(0,n)}}return e}var lo=new Set([":for","x-for","v-for"]),Un=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Cs="__stx_interpolated",Yi="__StxElement",uo="__StxTemplateValue",pl=`type ${uo}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Qi(e){return e.replace(/\{\{[\s\S]*?\}\}/g,Cs).replace(/\{!![\s\S]*?!!\}/g,Cs)}function gl(e,t,i){let n=0;for(let a=t;a<e.length;a++){let l=e[a];if(l==="{"){n++;continue}if(l!=="}"&&l!=="!")continue;if(e.startsWith(i,a)&&n===0)return a;if(l==="}"&&n>0)n--}return-1}function ci(e,t,i="0"){let n=`__stxScript${i}`;while((e+t).includes(n))n+="_";let a=new Map,l=[],c=[],y=r(e),v=ho(e),E=[],A=0;for(let L=0;L<y.length;L++){let B=y.startsWith("{{",L);if(!B&&!y.startsWith("{!!",L))continue;let Q=B?2:3,D=B?"}}":"!!}",ee=gl(y,L+Q,D);if(ee<0)continue;let ne=L,te=e.slice(ne,ee+D.length),le=te.slice(Q,-D.length);L=ee+D.length-1;let he=c.length,ue=Ts(v,ne),Re=Ts(v,ne+(B?2:3));c.push({code:co(le),...Re});let Ae=`${n}_${he}`,Ue=te.split(`
|
|
529
|
+
`),Ke=Ue[0].length;Ue[0]=Ae+" ".repeat(Math.max(0,Ke-Ae.length));for(let Je=1;Je<Ue.length;Je++)Ue[Je]=Ue[Je].replace(/[^\r]/g," ");let Ye=a.get(ue.line)??[],Xe=Ye.at(-1),et=ue.column+(Xe?Xe.generatedEnd-Xe.sourceEnd:0);Ye.push({sourceStart:ue.column,sourceEnd:ue.column+Ke,generatedStart:et,generatedEnd:et+Ue[0].length}),a.set(ue.line,Ye),E.push(e.slice(A,ne),Ue.join(`
|
|
530
|
+
`)),A=ne+te.length}E.push(e.slice(A));let j=E.join("");if(!c.length)return{code:j,columns:a,declarations:l};let{imports:X,body:M}=po(t),I=[],z=0;for(let L of X.split(/\n(?=import\b)/)){if(!L.trim())continue;let B=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(L);if(!B){l.push({text:L});continue}let Q=`${n}Module${z++}`;l.push({text:`import * as ${Q} from ${B[2]}`});let D=B[1],ee=/\{([\s\S]*?)\}/.exec(D);for(let he of ee?.[1].split(",")??[]){let[ue,Re=ue]=he.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(ue==="default")I.push(`const ${Re} = ${Q}.default; type ${Re} = import(${B[2]}).default`);else if(ue)I.push(`import ${Re} = ${Q}.${ue}`)}let ne=D.replace(/\{[\s\S]*?\}/,""),te=/\*\s+as\s+(\w+)/.exec(ne);if(te)I.push(`import ${te[1]} = ${Q}`);let le=/^\s*([\w$]+)/.exec(ne)?.[1];if(le)I.push(`const ${le} = ${Q}.default; type ${le} = import(${B[2]}).default`)}l.push({text:`namespace ${n}Scope {
|
|
531
|
+
${I.join(`
|
|
532
|
+
`)}
|
|
533
|
+
export async function read() {
|
|
534
|
+
${Ls(M).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
|
|
535
|
+
return {`});for(let[L,B]of c.entries())l.push({text:`value${L}: (`}),l.push({text:B.code,origin:{line:B.line,column:B.column}}),l.push({text:"),"});l.push({text:`}
|
|
536
|
+
}
|
|
537
|
+
}`});for(let L=0;L<c.length;L++)l.push({text:`declare var ${n}_${L}: Awaited<ReturnType<typeof ${n}Scope.read>>['value${L}']`});return{code:j,columns:a,declarations:l}}function eo(e,t){let i=0;for(let n of e){if(t<n.generatedStart)break;if(t<n.generatedEnd)return n.sourceStart+Math.min(t-n.generatedStart,n.sourceEnd-n.sourceStart);i=n.sourceEnd-n.generatedEnd}return t+i}var ml=["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"],hl=new RegExp(String.raw`^[ \t]*@(?:${ml.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Ls(e){return e.replace(hl,(t)=>t.replace(/[^\n]/g," "))}var to=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Yf(e){let t=Vn(e),i=[],n=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=n.exec(t))!==null){if(a[1]||a[3])continue;let y=a[2]??a[4]??"",v=a[2]!==void 0?2:3,E=co(y);if(!E.trim())continue;let A=a.index+v+(E.length-E.trimStart().length);i.push({code:E.trim(),line:Qt(t,A),column:en(t,A),offset:A,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(t))!==null){let c=a.index+a[0].length-1,y=0,v=c;for(;v<t.length;v++){let X=t[v];if(X==="(")y++;else if(X===")"){if(y--,y===0)break}}if(y!==0)continue;let E=t.slice(c+1,v),A=E.trim();if(l.lastIndex=v+1,!A)continue;let j=c+1+(E.length-E.trimStart().length);i.push({code:A,line:Qt(t,j),column:en(t,j),offset:a.index,kind:"condition"})}Un.lastIndex=0;while((a=Un.exec(t))!==null){let c=a[1],y=a[3]??"",v=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(to.has(v)||to.has(c))continue;if(!y.trim())continue;let E=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(lo.has(v)){let j=y.match(/\s+(?:in|of)\s+/);if(!j||j.index===void 0)continue;let X=y.slice(j.index+j[0].length),M=j.index+j[0].length+(X.length-X.trimStart().length);i.push({code:Qi(X.trim()),line:Qt(t,E+M),column:en(t,E+M),offset:E+M,kind:"directive",attribute:v});continue}let A=y.length-y.trimStart().length;i.push({code:Qi(y.trim()),line:Qt(t,E+A),column:en(t,E+A),offset:E+A,kind:"directive",attribute:v})}return i.sort((c,y)=>c.line-y.line||c.column-y.column),i}var xl=2000;function bl(e,t){let i=0,n=Math.min(e.length,t+xl);for(let a=t;a<n;a++){let l=e[a];if(l==="(")i++;else if(l===")"){if(i--,i===0)return e.slice(t+1,a)}}return null}function yl(e){let t=new Map,i=(y,v)=>{let E=y.split(/[,[\]{}()\s]+/).filter(Boolean);for(let A of E){let j=A.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(j))continue;let X=E.length===1?v:void 0,M=t.get(j);if(!M)t.set(j,{name:j,iterable:X});else if(M.iterable!==X)M.iterable=void 0}},n=/^\$?[A-Z_$][\w$]*$/i,a=(y)=>{let v=y.trim();return n.test(v)?v:void 0};for(let y of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=bl(e,y.index+y[0].length-1);if(v===null)continue;let E=At(v);if(!E)continue;i(E.itemVar.replace(/=>/g," "),a(E.arrayExpr))}for(let y of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))i(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))i(y[1]);let l=Vn(e);Un.lastIndex=0;let c;while((c=Un.exec(l))!==null){let y=c[1].replace(/\..*$/,"");if(!lo.has(y))continue;let v=c[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;i(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))i(v[1]);return[...t.values()].sort((y,v)=>y.name.localeCompare(v.name))}function Me(e){let t=new Set;for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let n of i[1].split(",")){let a=n.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))t.add(a)}return[...t].sort()}var As=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],_l={$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 Pc(e=new Set){return[...As.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(_l).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
|
|
538
|
+
`)}function Ic(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function fo(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,i,n=!1,a=new Set,l=r(e);while((i=t.exec(l))!==null){n=!0;for(let c of wl(i[1])){let y=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(y))a.add(y)}}return n?[...a]:null}function wl(e){let t=[],i=0,n="";for(let a of e){if(a===","&&i===0){t.push(n),n="";continue}if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;n+=a}return t.push(n),t.filter((a)=>a.trim().length>0)}function po(e){let t=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,i=[],n=e.replace(t,(a)=>(i.push(a.trim()),a.split(`
|
|
539
|
+
`).map(()=>"").join(`
|
|
540
|
+
`)));return{imports:i.join(`
|
|
541
|
+
`),body:n}}function go(e){let t=r(e),i=Array(t.length),n=0;for(let y=0;y<t.length;y++){let v=t[y];if(v==="}"||v===")"||v==="]")n=Math.max(0,n-1);if(i[y]=n,v==="{"||v==="("||v==="[")n++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=l.exec(t))!==null){if(i[c.index]!==0)continue;let y=c[1],v=c[2],E;if(y==="interface"){let A=t.indexOf("{",c.index);if(A===-1)continue;let j=0;E=-1;for(let X=A;X<t.length;X++)if(t[X]==="{")j++;else if(t[X]==="}"&&--j===0){E=X+1;break}if(E===-1)continue}else{let A=0;E=t.length;for(let j=t.indexOf("=",c.index)+1;j<t.length;j++){let X=t[j];if(X==="{"||X==="["||X==="("||X==="<")A++;else if(X==="}"||X==="]"||X===")"||X===">")A--;else if(A<=0&&(X===";"||X===`
|
|
542
|
+
`&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,j-40),j)))){E=X===";"?j+1:j;break}}}a.push({name:v,text:e.slice(c.index,E).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=E}return a}function Sl(e){return new Set(go(e).map((t)=>t.name))}function Oc(e,t=""){let i=fo(e),n=Sl(t),a=go(e).filter((E)=>!n.has(E.name)).map((E)=>E.text);if(!i){let E=Me(e).filter((A)=>!Rt(t,A));if(E.length===0&&a.length===0)return"";return["",`// ${$l}`,...a,...E.map((A)=>`declare var ${A}: any`)].join(`
|
|
543
|
+
`)}if(i.length===0)return a.length>0?["",`// ${no}`,...a].join(`
|
|
544
|
+
`):"";let{imports:l,body:c}=po(e),y=c.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${no}`];if(l)v.push(l);return v.push(...a),v.push(`async function ${so}() {`,y,` return { ${i.join(", ")} }`,"}",`type ${ro} = Awaited<ReturnType<typeof ${so}>>`,...i.map((E)=>`declare var ${E}: ${ro}[${JSON.stringify(E)}]`)),v.join(`
|
|
545
|
+
`)}function li(e){let i=r(e).split(""),n=0;for(let a=0;a<i.length;a++){let l=i[a];if(l==="{"||l==="("||l==="["){n++;continue}if(l==="}"||l===")"||l==="]"){n=Math.max(0,n-1);continue}if(n>0&&l!==`
|
|
546
|
+
`)i[a]=" "}return Me(i.join(""))}function Nc(e,t){if(fo(e)!==null)return[];let i=li(e),n=Ie(t,new Set(i)),a=new Set(k);return i.filter((l)=>{if(a.has(l))return!1;if(Rt(t,l))return!1;return n.has(l)})}var no="stx: types for the declared client payload (#1868)",$l="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",so="__stxServerScope",ro="__StxClientPayload";var io=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var vl=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function El(e){let t=new Map,i=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let n of e){let a=r(n),{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 E=v.index??0;if(l[E+v[1].length]!==0)continue;let A=v[2],j=E+v[0].length-v[3].length,X=n.slice(j,E+v[0].length).trim().replace(/;$/,"").trim(),M=v[3],I=i.test(M)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(M)&&!/[,+\-*/%&|?:=]$/.test(X)&&ge(M).balanced;t.set(A,t.has(A)||!I?null:X)}}return new Map([...t].filter((n)=>n[1]!==null))}function mo(e,t,i=0,n=new Set){if(t.size===0||i>=5)return e;let a=r(e),l="",c=0;for(let y of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=y.index??0,E=y[0],A=t.get(E);if(!A||n.has(E))continue;let j=a.slice(0,v).trimEnd(),X=a.slice(v+E.length).trimStart();if(j.endsWith(".")||/^:(?!:)/.test(X)&&/[{,]$/.test(j))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(c,v)}(${mo(A,t,i+1,new Set([...n,E]))})`,c=v+E.length}return l+e.slice(c)}function kl(e,t){let i=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,n=[],a;while((a=i.exec(e))!==null){if(a.index>t)break;let l=a[1];if(a.index===t){if(l==="elseif"){let y=n[n.length-1];if(y?.current)y.seen.push(y.current);if(y)y.current=null}break}if(l==="endif"||l==="endunless"){n.pop();continue}let c="";if(a[2]==="("){let y=0,v=a.index+a[0].length-1,E=v+1;for(;v<e.length;v++){let A=e[v];if(A==="(")y++;else if(A===")"){if(y--,y===0)break}}c=e.slice(E,v).trim(),i.lastIndex=v+1}if(l==="if")n.push({seen:[],current:c});else if(l==="unless")n.push({seen:[],current:`!(${c})`});else if(l==="elseif"||l==="else"){let y=n[n.length-1];if(!y)continue;if(y.current)y.seen.push(y.current);y.current=l==="elseif"?c:null}}return n.flatMap((l)=>[...l.seen.map((c)=>`!(${c})`),...l.current?[l.current]:[]]).filter(Boolean)}function Rl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(vl.test(t))return null;let n=";(($event: any): void => { ";return{text:`${n}${t} });`,prefixLength:n.length}}let i=";void ((";return{text:`${i}${t}));`,prefixLength:i.length}}var Cl=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function oo(e,t){return js(e,t).code}function js(e,t){let i=new Map;if(!t)return{code:e,columns:i};let n=ho(e),a=[],l=0;for(let c of e.matchAll(Cl)){let y=c.index,[v,E,A,j]=c,X=ao.resolve(t,j).replace(/\\/g,"/"),M=`${E}${A}${X}${A}`;if(a.push(e.slice(l,y),M),l=y+v.length,v.includes(`
|
|
547
|
+
`))continue;let I=Ts(n,y),z=i.get(I.line)??[],L=z.at(-1),B=I.column+(L?L.generatedEnd-L.sourceEnd:0);z.push({sourceStart:I.column,sourceEnd:I.column+v.length,generatedStart:B,generatedEnd:B+M.length}),i.set(I.line,z)}return a.push(e.slice(l)),{code:a.join(""),columns:i}}function Al(e,t,i){let n=eo(e.importColumns?.get(t)??[],i);return eo(e.scriptColumns?.get(t)??[],n)}function ui(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function Tl(e){let t=new Set,i=r(e);for(let n of i.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=n[1],l=/\{([^}]*)\}/.exec(a);for(let E of l?.[1].split(",")??[]){let A=E.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(A&&/^[A-Z_$][\w$]*$/i.test(A))t.add(A)}let c=a.replace(/\{[^}]*\}/,""),y=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(y)t.add(y[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(v&&v[1]!=="type")t.add(v[1])}return[...t].sort()}function Mc(e,t={}){let i=Pt(e),n=e.split(`
|
|
548
|
+
`),a=Array.from({length:n.length},()=>""),l=new Map,c=new Map,y=new Map,v=[],E=i.filter((z)=>z.kind==="server").map((z)=>z.code).join(`
|
|
549
|
+
`),A=t.filePath&&t.templateExpressions!==!1?Ji(e,Vn(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(z,L)=>Pt(z).map((B)=>oo(B.code,ao.dirname(L))).join(`
|
|
550
|
+
`)}):void 0,j=new Set,X=[];for(let[z,L]of i.entries()){let B=ci(ui(L)+L.code,E,String(z));for(let[ne,te]of B.columns)c.set(L.startLine+ne-1,te);for(let ne of B.declarations)v.push({text:oo(ne.text,t.originDir??""),origin:ne.origin?{...ne.origin,line:ne.origin.line+L.startLine-1}:void 0});let Q=Ls(B.code),D=js(Q,t.originDir??"");for(let[ne,te]of D.columns)y.set(L.startLine+ne-1,te);let ee=D.code.split(`
|
|
551
|
+
`);ee.forEach((ne,te)=>{let le=L.startLine-1+te;if(le<a.length)a[le]=ne,j.add(le)}),X.push(L.startLine-1+ee.length-1)}for(let z of X){let L=a[z]?.trim()===""?z:z+1;if(L<a.length&&a[L].trim()===""&&(L===z||!j.has(L)))a[L]=";"}let M=(z,L)=>{for(let[B,Q]of z.split(`
|
|
552
|
+
`).entries())if(a.push(Q),L)l.set(a.length,B===0?L:{...L,line:L.line+B,column:1,prefixLength:0})};for(let z of v)M(z.text,z.origin);if(t.globals!==!1){M("");let z=new Set([...i.flatMap((D)=>Me(D.code)),...i.flatMap((D)=>Tl(D.code))]),L=(D)=>{if(!z.has(D))M(`declare var ${D}: any`)};if(t.runtimeGlobals!==!1){if(!z.has("window"))M("declare var window: any");for(let D of k)L(D)}let B=[...new Set([...As,...xe,...io])].filter((D)=>t.runtimeGlobals!==!1||!k.includes(D));if(t.contextScope==="global"){M("declare global {");for(let D of B)M(` var ${D}: any`);M("}")}else{for(let D of As)L(D);for(let D of xe)L(D);for(let D of io)L(D)}M(`declare var ${Cs}: any`);let Q=new Set(i.flatMap((D)=>Me(D.code)));M(`type ${Yi}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let D of yl(e)){if(Q.has(D.name))continue;let ee=D.iterable&&Q.has(D.iterable)?`${Yi}<typeof ${D.iterable}>`:"any";M(`declare var ${D.name}: ${ee}`)}}if(t.templateExpressions!==!1){if(A?.declarations)for(let L of A.declarations.split(`
|
|
553
|
+
`))M(L);let z=Yf(e).map((L)=>{let B=A?.events.get(L.offset??-1);if(B){L.anchor=!0;let Q=L.code.trim(),D=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(Q),ee=D?`void ((${D[2]}) satisfies __StxAssignedValue<typeof ${D[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(Q)?`${Q} satisfies (($event: ${B}) => unknown)`:Q,ne=`;(($event: ${B}): void => { `;return{expression:L,statement:{text:`${ne}${ee} });`,prefixLength:ne.length}}}return{expression:L,statement:Rl(L)}}).filter((L)=>L.statement!==null);if(z.push(...A?.checks||[]),z.length>0){let L=Vn(e),B=Wn(L),Q=El(i.map((te)=>te.code)),ee=[...new Set(i.flatMap((te)=>Me(te.code)))].filter((te)=>/^[A-Z_$][\w$]*$/i.test(te)),ne=0;if(ee.length>0){M(pl);for(let te of ee)M(`function __StxRead_${te}() { return ${te} }`),M(`type __StxT_${te} = ${uo}<ReturnType<typeof __StxRead_${te}>>`);M(`;((${ee.map((te)=>`${te}: __StxT_${te}`).join(", ")}) => {`),ne=1}for(let{expression:te,statement:le}of z){let he=" ".repeat(ne),ue=te.offset===void 0?[]:B.filter((Xe)=>te.offset>=Xe.start&&te.offset<Xe.end),Re=ue.map((Xe)=>`;((${Xe.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ae=" });".repeat(ue.length),Ue=te.offset===void 0?[]:kl(L,te.offset),Ke=Ue.length>0?`${Ue.map((Xe)=>`if (${mo(Xe,Q)}) `).join("")}{ `:"",Ye=Ue.length>0?" }":"";M(he+Re+Ke+le.text+Ye+Ae,{line:te.line,column:te.column,expression:te,prefixLength:le.prefixLength+he.length+Re.length+Ke.length,guardPrefixLength:he.length+Re.length+Ke.length})}if(ne>0)M("});")}}let I=!1;if(t.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,I=!0;return M("export {}"),{text:a.join(`
|
|
554
|
+
`),lineMap:l,sourceLineCount:n.length,componentDependencies:A?.dependencies,referenced:I,scriptColumns:c,importColumns:y}}function ho(e){let t=[0];for(let i=0;i<e.length;i++)if(e.charCodeAt(i)===10)t.push(i+1);return t}function Ts(e,t){let i=0,n=e.length-1;while(i<n){let a=Math.ceil((i+n)/2);if(e[a]<=t)i=a;else n=a-1}return{line:i+1,column:t-e[i]+1}}function Dc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function di(e,t,i){let n=e.lineMap.get(t);if(!n)return t<=e.sourceLineCount?{line:t,column:Al(e,t,i)}:null;let a=n.expression?.anchor?0:Math.max(0,i-1-(n.prefixLength??0));return{line:n.line,column:n.column+a,expression:n.expression,inGuard:i<=(n.guardPrefixLength??0)}}var Zs=b(256),Il=[{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"}],xo=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Pl(e){let t=Array.from(e,(a)=>a===`
|
|
555
|
+
`?`
|
|
556
|
+
`:" "),i=0,n="";while(i<e.length){let a=e[i],l=e[i+1];if(n){if(a==="\\"){i+=2;continue}if(a===n)n="";i++;continue}if(a==='"'||a==="'"||a==="`"){n=a,i++;continue}if(a==="/"&&l==="/"){while(i<e.length&&e[i]!==`
|
|
557
|
+
`)t[i]=e[i],i++;continue}if(a==="/"&&l==="*"){let c=e.indexOf("*/",i+2),y=c===-1?e.length:c+2;for(;i<y;i++)t[i]=e[i];continue}if(a==="{"&&l==="{"&&e.slice(i,i+4)==="{{--"){let c=e.indexOf("--}}",i+4),y=c===-1?e.length:c+4;for(;i<y;i++)t[i]=e[i];continue}i++}return t.join("")}function Ol(e){let t=new Map,i=Pl(e).split(`
|
|
558
|
+
`),n=e.split(`
|
|
559
|
+
`);return i.forEach((a,l)=>{xo.lastIndex=0;for(let c of a.matchAll(xo)){let y=c[1]==="-next-line",v=(n[l]??"").slice(0,c.index).trim(),E=y||v===""?l+2:l+1,j=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),X=j.filter((I)=>/\w/.test(I));if(j.length>0&&X.length===0)continue;let M=t.get(E);if(M&&M.size===0)continue;if(X.length===0){t.set(E,new Set);continue}if(M)X.forEach((I)=>M.add(I));else t.set(E,new Set(X))}}),t}function Ml(e,t,i){let n=e.get(t);if(!n)return!1;if(n.size===0)return!0;return[...n].some((a)=>i.includes(a))}function Oe(e,t,i,n){let a=typeof i==="boolean"?{enabled:i,failOnViolation:i}:i??{enabled:!1};if(!a.enabled)return;let l=S(e,t,n,JSON.stringify(a)),c=Zs.get(l);if(c!==void 0){if(c&&a.failOnViolation)throw new q(c,n??t);return}let y=a.allowPatterns??[],v=Ol(e),E=[],A=r(e.replace(/\{\{--[\s\S]*?--\}\}/g,(I)=>I.replace(/[^\n]/g," ")));for(let{pattern:I,message:z,suggestion:L}of Il){if(y.some((Q)=>/\w/.test(Q)&&z.includes(Q)))continue;I.lastIndex=0;let B=A.match(I);if(B&&B.length>0){let Q=A.split(`
|
|
560
|
+
`),D=e.split(`
|
|
561
|
+
`),ee=[];if(Q.forEach((he,ue)=>{if(I.lastIndex=0,I.test(he)&&!Ml(v,ue+1,z))ee.push(ue+1)}),ee.length===0&&Q.some((he)=>(I.lastIndex=0,I.test(he))))continue;let ne=ee.length>0?` (script line${ee.length>1?"s":""} ${ee.join(", ")})`:"",te=ee.slice(0,3).map((he)=>` ${he} | ${(D[he-1]??"").trim().slice(0,100)}`).join(`
|
|
562
|
+
`),le=te?`
|
|
563
|
+
${te}`:"";E.push(` \u2717 ${z}${ne}
|
|
564
|
+
\u2192 ${L}${le}`)}}if(E.length===0){Zs.set(l,"");return}let j=(I)=>{let z=`${process.cwd()}/`;return I.startsWith(z)?I.slice(z.length):I},M=`[STX] DOM API violation in ${n&&n!==t?`${j(n)} (composed into ${j(t)})`:j(t)}:
|
|
565
|
+
${E.join(`
|
|
566
|
+
`)}
|
|
567
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(Zs.set(l,M),console.warn(M),a.failOnViolation)throw new q(M,n??t)}var jl=[{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"}],Dl=[{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')"}],Nl=[{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 ag(e){let t=[],i=[];return Ll(e,t),zl(e,t,i),Bl(e,i),Wl(e,t),{valid:t.length===0,errors:t,warnings:i}}function Ll(e,t){let i=(e.match(/\{\{/g)||[]).length,n=(e.match(/\}\}/g)||[]).length;if(i!==n)t.push({type:"expression",message:`Unclosed expression brackets: found ${i} opening '{{' and ${n} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function zl(e,t,i){for(let n of jl){let a=new RegExp(`${n.open}(?:\\s|\\()`,"g"),l=new RegExp(n.close,"g"),c=(e.match(a)||[]).length,y=(e.match(l)||[]).length;if(n.altClose){let v=new RegExp(n.altClose,"g");y+=(e.match(v)||[]).length}if(c>y)t.push({type:"directive",message:`Unclosed @${n.name} directive: found ${c} opening and ${y} closing`,suggestion:`Add ${c-y} missing ${n.close} tag(s)`});else if(y>c)i.push({type:"directive",message:`Extra ${n.close} found: ${y-c} more closing than opening`,suggestion:`Check for orphaned ${n.close} tags`})}}function Bl(e,t){for(let i of Dl)if(i.pattern.test(e))t.push({type:"syntax",message:i.message,suggestion:i.suggestion})}function Wl(e,t){for(let i of Nl)if(i.pattern.test(e))t.push({type:"expression",message:`Security warning: ${i.message}`,suggestion:"Remove dangerous code from template expressions"})}function cg(e,t){let i=e.slice(0,t).split(`
|
|
568
|
+
`);return{line:i.length,column:i[i.length-1].length+1}}function lg(e,t,i){let n=[];switch(e){case"if":case"elseif":case"unless":if(i.length===0)n.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(i.length===0||!i[0].includes(" as "))n.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(i.length===0)n.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(i.length===0)n.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(i.length===0)n.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(i.length===0)n.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return n}function ug(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function dg(e){let t=e.matchAll(/@([a-z]+)/gi),i=new Set;for(let n of t){let a=n[1].toLowerCase();if(!a.startsWith("end"))i.add(a)}return Array.from(i)}function bo(e,t,i){let n=/^<script\b([^>]*)>/i.exec(e);if(!n||!/(?:^|\s)src\s*=/i.test(n[1]??""))return null;return _(n[0],t,i)+e.slice(n[0].length)}var tn=new T(500),Gs=new Map;function yo(e){try{let t=Kn.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var qn=new T(1000),Qs=new T(2000),er=new T(500),Co=33554432,tr=Co;function Fl(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===tr)return;tr=t,Zn.setMaxBytes(t)}var Zn=new T(2000,{maxBytes:Co,sizeOf:(e)=>e.output.length});function Vl(e){let t=new WeakSet;try{let i=(n)=>{if(n===void 0)return{__stxType:"undefined"};if(typeof n==="bigint")return{__stxType:"bigint",value:n.toString()};if(typeof n==="function"||typeof n==="symbol")throw TypeError("Non-serializable component input");if(n===null||typeof n!=="object")return n;if(t.has(n))throw TypeError("Circular component input");t.add(n);try{if(n instanceof Date)return{__stxType:"date",value:n.toISOString()};if(Array.isArray(n))return n.map(i);let a=Object.getPrototypeOf(n);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let c of Object.keys(n).sort())l[c]=i(n[c]);return l}finally{t.delete(n)}};return JSON.stringify(i(e))}catch{return null}}function Ul(e){let t={};for(let[i,n]of Object.entries(e))if(!i.startsWith("__")||i==="__stxServeContext")t[i]=n;return t}function Ks(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Vs(e){let t=process.cwd(),i=`${t}\x00${e}`,n=_o.get(i);if(n===void 0)n=Bun.hash(Ao(e,t).split(ae.sep).join("/")).toString(36).slice(0,6),_o.set(i,n);return n}var _o=new Map;function Ao(e,t){if(!ae.isAbsolute(e))return e;let i=(n)=>{try{return Kn.realpathSync(n)}catch{return n}};return ae.relative(i(t),i(e))}function pg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function je(e){return!pg(e)}var Hn=new Map;function Y(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let i=Hn.get(t);if(i)return i;if(Hn.size>=16)Hn.clear();let n=new Bun.Transpiler(e);return Hn.set(t,n),n}var wo=new WeakMap,Hl=256;function Be(e){try{let t=Y({loader:"ts",target:"browser",define:C()}),i=wo.get(t);if(!i)i=new Map,wo.set(t,i);let n=i.get(e);if(n!==void 0)return n;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=t.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(i.size>=Hl){let y=i.keys().next();if(!y.done)i.delete(y.value)}return i.set(e,c),c}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function ql(e){let t=[],i=new Set,n=0,a=0,l=e.length,c=(M)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===M){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 M=1;while(a<l&&M>0)if(e[a]==="{")M++,a++;else if(e[a]==="}")M--,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]!==`
|
|
569
|
+
`)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},E=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),A=()=>{let M=a-1;while(M>=0&&/\s/.test(e[M]))M--;if(M<0)return!0;let I=e[M];if("(,=:[!&|?{};+-*%<>~^".includes(I))return!0;if(!/[\w$]/.test(I))return!1;let z=M;while(z>0&&/[\w$]/.test(e[z-1]))z--;return E.has(e.slice(z,M+1))},j=()=>{a++;let M=!1;while(a<l&&e[a]!==`
|
|
570
|
+
`){let I=e[a];if(I==="\\"){a+=2;continue}if(I==="[")M=!0;else if(I==="]")M=!1;else if(I==="/"&&!M){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},X=()=>{if(n!==0)return;let M=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(M){let B=M[2].split(",").map((Q)=>{let D=Q.trim().split(":");return D[D.length-1].trim()});for(let Q of B)if(Q&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(Q)&&!i.has(Q))t.push(Q),i.add(Q);return}let I=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(I){let B=I[2];if(!i.has(B))t.push(B),i.add(B);return}let z=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[1];if(!i.has(B))t.push(B),i.add(B);return}let L=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let B=L[1];if(!i.has(B))t.push(B),i.add(B)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){y();continue}if(e[a]==="/"&&A()){j();continue}if(e[a]==="{"){n++,a++;continue}if(e[a]==="}"){n--,a++;continue}if(n===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))X();a++}return t}function Zl(e){let t=[],i=0,n=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==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===","&&i===0)t.push(e.slice(n,l)),n=l+1}if(n<e.length)t.push(e.slice(n));return t}function Kl(e){let t=0,i=null;for(let n=0;n<e.length;n++){let a=e[n];if(i){if(a==="\\"){n++;continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[n-1],c=e[n+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return n}}return-1}function Xl(e,t){try{let i=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!i)return;let n=i.index-1;while(n>=0&&/\s/.test(e[n]))n--;if(e[n]!=="}")return;let a=n,l=0,c=-1;for(;n>=0;n--){let v=e[n];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=n;break}}}if(c===-1)return;let y=e.slice(c+1,a);for(let v of Zl(y)){let E=v.trim();if(!E||E.startsWith("..."))continue;let A=Kl(E);if(A===-1)continue;let j=E.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(j))continue;if(t[j]!==void 0)continue;let X=E.slice(A+1).trim();if(!X)continue;try{let M=Object.keys(t).filter(jt),I=Function(...M,`"use strict"; return (${X});`);t[j]=I(...M.map((z)=>t[z]))}catch{}}}catch{}}var Jl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function fg(e,t){let i=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!i)return null;let n=i[2].toLowerCase();if(!Jl.has(n))return null;let a=new RegExp(`<\\/?${n}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=w(e,(E,A)=>(a.lastIndex=A,a.exec(E)?.index===A?a.lastIndex:-1));if(n==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,y=!1;for(let E of l){if(c+=E.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(E.end).trim())return null;y=!0;break}}if(!y)return null;let v=i[0].length;return e.slice(0,v)+t+e.slice(v)}function To(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((n)=>{let a=ae.relative(ae.resolve(n),ae.resolve(e));return!a.startsWith("..")&&!ae.isAbsolute(a)})}async function Cr(e,t,i,n,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(te)=>te.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),y=i.__importedComponents;if(y){for(let te of[l,l.toLowerCase(),c(l),V(l)])if(y.has(te))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${V(l)}.stx`])],E=typeof a.root==="string"?ae.resolve(a.root):void 0,A=E??ae.dirname(n),j=[],X=(te)=>{if(te&&!j.includes(te))j.push(te)};for(let te of cs(n,E))X(te);let M=i.__originalFilePath;if(M)X(ae.join(ae.dirname(M),"components"));if(To(t,a))X(a._rootComponentsDir);X(t),X(a._rootComponentsDir),X(ae.join(ae.dirname(n),"components")),X(a.componentsDir);for(let te of a.additionalComponentsDirs??[])X(te);let I=a._targetComponentFallbackNames?.some((te)=>te.toLowerCase()===l.toLowerCase());if(!I)for(let te of a._targetComponentDirs??[])X(te);if(E)X(ae.resolve(E,"resources/views/components")),X(ae.resolve(E,"resources/components")),X(ae.resolve(E,"src/components")),X(ae.resolve(E,"components"));for(let te of a._layerComponentDirs??[])X(te);let z=a._pluginComponentDirs;if(Array.isArray(z))for(let te of z)X(typeof te==="string"?te:null);if(X(a.fallbackComponentsDir),I)for(let te of a._targetComponentDirs??[])X(te);let L=a._nativePrimitivesFallback;if(L&&!L.except.some((te)=>te.toLowerCase()===l.toLowerCase()))X(L.dir);if(l.startsWith("./")||l.startsWith("../"))return s(ae.resolve(ae.dirname(n),`${l}.stx`));let B=So(ae.resolve(import.meta.dir,"components")),Q=j.map((te)=>ae.isAbsolute(te)?te:ae.resolve(A,te)),D=`${v.join("\x00")}\x00\x00${Q.join("\x00")}`,ee=Qs.get(D);if(ee!==void 0)return ee;let ne=!1;e:for(let te of Q){if(So(te)===B)continue;for(let le of v)if(await s(ae.join(te,le))){ne=!0;break e}}return Qs.set(D,ne),ne}function So(e){let t=er.get(e);if(t!==void 0)return t;let i=e;try{i=Kn.realpathSync(e)}catch{}return er.set(e,i),i}function gg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Gc(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function Gl(e,t,i){if(!e.includes("{{")&&!e.includes("{!!"))return e;let n=(a,l)=>{let c;try{c=R(a,t)}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 ${i??"<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)=>n(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>n(l,a))}var $o=new Set;function vo(e,t,i,n){let a=`${e}\x00${t}\x00${n??""}`;if(!process.env.STX_DEBUG&&$o.has(a))return;$o.add(a);let l=t?` used in ${t}`:"",c=n?` Cause: ${n}.`:"",y=i.length>0?`
|
|
571
|
+
searched:
|
|
572
|
+
${i.map((v)=>` - ${v}`).join(`
|
|
573
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function Eo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Yl=new Set(["for","if","show","key","ref","class","className","style"]),ko=new Set,Io="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Jc=new RegExp(`\\b(?:${Io})\\s*(?:<[^>]*>)?\\s*\\(`);function yi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Io})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let a;while((a=i.exec(n))!==null)t.add(a[1]);i.lastIndex=0}return[...t]}async function Fe(e,t,i,n,a,l,c,y=new Set,v,E=rt(a),A,j=e){let{extractVariables:X}=await o("stx/variable-extractor",()=>import("./chunk-r57s8jqs.js")),M=y??new Set;if(M.has(e))return`[Circular component reference: ${e}]`;let I=new Set(M);I.add(e);let z=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let L=z&&z!=="load"&&gg(z)?z:"";try{let B=(re)=>re.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),Q=j.endsWith(".stx")?j.slice(0,-4):j,D=null,ee=a.__importedComponents;if(ee){let re=[Q,Q.toLowerCase(),B(Q),V(Q)];for(let ce of re)if(ee.has(ce)){D=ee.get(ce);break}}let ne=[];if(!D){let re=[`${Q}.stx`,`${B(Q)}.stx`,`${V(Q)}.stx`],ce=[...new Set(re)],we=a.__originalFilePath,be=[];if(be.push(...c._layerComponentDirs??[]),we){let ye=ae.join(ae.dirname(we),"components");be.push(ye)}let He=c._rootComponentsDir;if(typeof He==="string"&&To(n,c)&&!be.includes(He))be.push(He);if(n&&!be.includes(n))be.push(n);if(typeof He==="string"&&!be.includes(He))be.push(He);let Te=ae.join(ae.dirname(l),"components");if(!be.includes(Te))be.push(Te);if(c.componentsDir&&c.componentsDir!==n&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let ye of c.additionalComponentsDirs??[])if(ye&&!be.includes(ye))be.push(ye);let ft=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(Q),pt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ts=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),ns=!pt.includes("valuechange")&&(yt||pt.includes("change")&&!ts),mt=c._nativeHostAttrs&&/^textinput$/i.test(Q),_t=pt.includes("update:value")&&!pt.includes("input"),qt=c._nativeHostAttrs&&/^video$/i.test(Q),ss=c._nativeHostAttrs&&/^image$/i.test(Q),ln=Ms([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),wt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),un=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),_n=qt&&(wt||un)&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),Sn=new Set(["","primary","secondary","outline","ghost","danger"]),$n=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",En=c._nativeHostAttrs&&/^button$/i.test(Q)&&!Sn.has($n),cr=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===Q.toLowerCase())&&(!ft||ns)&&(!mt||_t)&&(!qt||_n)&&(!ss||ln)&&!En;for(let ye of cr?[]:c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let St=typeof c.root==="string"?ae.resolve(c.root):void 0,Ho=St??ae.dirname(l),$t=[];if(St)$t.push(ae.resolve(St,"resources/views/components")),$t.push(ae.resolve(St,"resources/components")),$t.push(ae.resolve(St,"src/components")),$t.push(ae.resolve(St,"components"));$t.push(ae.resolve(import.meta.dir,"components"));for(let ye of $t)if(!be.includes(ye))be.push(ye);let lr=c._pluginComponentDirs;if(Array.isArray(lr)){for(let ye of lr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(cr){for(let ye of c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let kn=c._nativePrimitivesFallback;if(kn&&!kn.except.some((ye)=>ye.toLowerCase()===Q.toLowerCase())&&!be.includes(kn.dir))be.push(kn.dir);let ur=[...new Set(be.map((ye)=>{if(!ye)return ye;return ae.isAbsolute(ye)?ye:ae.resolve(Ho,ye)}))];be.length=0,be.push(...ur);let rs=`${Q}\x00${l}\x00${ur.join("\x00")}`,is=qn.get(rs);if(is)if(await s(is))D=is;else qn.delete(rs);if(!D&&(Q.startsWith("./")||Q.startsWith("../")))D=ae.resolve(ae.dirname(l),`${Q}.stx`),ne.push(D);else if(!D)for(let ye of be){if(!ye)continue;for(let Rn of ce){let Cn=ae.join(ye,Rn);if(ne.push(Cn),await s(Cn)){D=Cn;break}}if(D)break;if(!D)try{let Rn=await import("fs");if(!Rn.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let qo=8,os=[{path:ye,depth:0}];while(os.length>0&&!D){let An=os.pop();if(An.depth>=qo)continue;let fr;try{fr=Rn.readdirSync(An.path,{withFileTypes:!0})}catch{continue}for(let Tn of fr){if(!Tn.isDirectory())continue;if(Tn.name==="node_modules"||Tn.name.startsWith("."))continue;let pr=ae.join(An.path,Tn.name);for(let Zo of ce){let as=ae.join(pr,Zo);if(ne.push(as),await s(as)){D=as;break}}if(D)break;os.push({path:pr,depth:An.depth+1})}}}catch{}if(D)break}if(D)qn.set(rs,D)}if(!D||!await s(D))return vo(e,l,ne),Eo(e);v.add(D);let te;if(tn.has(D)&&Gs.get(D)===yo(D))te=tn.get(D);else try{let re=yo(D);te=await Bun.file(D).text(),tn.set(D,te),Gs.set(D,re)}catch(re){let ce=re instanceof Error?re.message:String(re);return vo(e,l,[D],ce),Eo(e)}if(A)for(let re of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ce=re.toLowerCase();if(ce.startsWith("aria-")||ce.startsWith("data-"))continue;let we=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(te))A.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(te))A.consumedProps?.add(re)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let re of A.reactiveProps){if(Yl.has(re)||A.consumedProps?.has(re))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ce=`${D}\x00${re}`;if(ko.has(ce))continue;ko.add(ce),console.warn(`[stx] ${ae.basename(D)} reads \`${re}\` with defineProps(), which is not live, but ${ae.basename(l)} binds it (:${re}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${re}').`)}let le=new Set(["__originalFilePath","__importedComponents",Mn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[re,ce]of Object.entries(a))if(!re.startsWith("__")||le.has(re))he[re]=ce;let ue=E.length>0?{[Bn]:[...E]}:{},Re=i;if(i.includes("@include")){let{processIncludes:re}=await o("stx/includes",()=>import("./chunk-pmq2pdr9.js"));Re=await re(i,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Re)){let{processComponents:re}=await o("stx/component-renderer",()=>import("./chunk-dzp2a775.js")),ce={...a,__processedComponents:M,...ue};Re=await re(Re,ce,l,c,v);let we=ce.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...we])]}let Ae=[];if(Gc(Re)){let{processExpressions:re}=await o("stx/expressions",()=>import("./chunk-xsck49x5.js")),ce=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ue}:E.length>0?{...a,...ue}:a;Re=re(Re,ce,l);for(let we of Re.matchAll(/\{\{([\s\S]*?)\}\}/g))Ae.push(we[1].trim())}let Ue=G(Re),Ke=[],Ye=Ue.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ce)=>{let we=Ue.scripts[Number(ce)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",He=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!He||["module","text/javascript","application/javascript"].includes(He),ft=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!ft)return Ke.push(we),"";return we}),{extractSlotContent:Xe}=await o("stx/slots",()=>import("./chunk-0wrmcexg.js")),et=Xe(Ye),Je={};if(et.defaultSlot?.trim())Je.default=et.defaultSlot;for(let[re,ce]of et.namedSlots)Je[re]=ce.content;let gt=a.__stx_scope_seq??={n:0,key:Vs(String(a.__filename??l))},Tt=Ao(e,process.cwd()),lt=`stx_${(Tt.endsWith(".stx")?Tt.slice(0,-4):Tt).replace(/[^a-zA-Z0-9]/g,"_")}_${++gt.n}_${gt.key}`,We={...he,$uid:lt,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Ye,$slots:Je,__processedComponents:I,__sections:{},__stx_signals_gate:Se(te)||Gc(i),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ae]};if(/import\s/.test(te)){We.__importedComponents=new Map(We.__importedComponents);let{processESImports:re}=await o("stx/component-renderer",()=>import("./chunk-dzp2a775.js"));te=await re(te,We,D,c,v)}Xl(te,We);let Dt=te,sn=de(Dt);if(sn)Dt=sn.content.trim();let Jn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Lt=[...te.matchAll(Jn)];for(let[,re,ce]of Lt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Oe(ce,D,c.strict);let Ge=[],zt=null,Gn=Lt.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),bt=null,st=null,Bt=null,rn=0,Wt=null;if(Fl(c),Gn&&tr>0){let re=Vl({props:t,slot:Re,slotContext:i.trim()?Ul(he):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((ce)=>ce.configFile),uid:lt});if(re!==null){bt=`${D}\x00${S(te)}\x00${re}`;let ce=Zn.get(bt);if(ce){for(let we of ce.dependencies)v.add(we);if(Qr(a,ce.clientFactories),gt.n+=ce.uidsConsumed,ce.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of ce.preservedClientExpressions)we.add(be);a.__stx_preserved_client_expressions=[...we]}return ce.output}st=new Set(v),Bt=Gr(a),rn=gt.n,Wt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ft=new Set;for(let re of Lt){let ce=re[1]||"",we=re[2]||"",be=ce.includes("server");if(je(ce)&&we.trim())we=Be(we);if(be&&we){for(let Te of Me(we))Ft.add(Te);try{await X(we,We,D,{onFailure:(Te)=>{if(Te.kind!=="unknown")zt=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ft=Te.includes("{{")&&Te.includes("}}"),pt=Te.includes("{!!")&&Te.includes("!!}");if(ft||pt)Te=wi(Te,We,D);let yt=ce.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ge.push(`<script${yt}>${Te}</script>`)}}let Qe=G(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Vt=Qe?Qe[1]:"",Yn=Qe?Qe[2]:"",it="",se=Vt&&/\bscoped\b/i.test(Vt);if(Qe)it=`<style${Vt}>${Gl(Yn,We,D)}</style>`;let ie=Dt;if(ie=ie.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Qe)ie=ie.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ce=[];if(ie=ie.replace(re,(we,be)=>{let He=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)ce.push(`<style${He[1]}>${He[2]}</style>`);return""}),ie=ie.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ce.length>0)it=`${it}${ce.join(`
|
|
574
|
+
`)}`}if(i&&ie.includes("{{ text || slot }}"))ie=ie.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-0wrmcexg.js")),{defaultSlot:$e,namedSlots:Ce}=et,qe=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ye),ot=Ge.length>0&&Es(ie)||c._nativeHostAttrs===!0&&Ge.length>0||qe&&Ge.length>0||Ge.some((re)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(re)),Qn=(re)=>ot?Ui(re,lt):re,es=new Map([...Ce].map(([re,ce])=>[re,{...ce,content:Qn(ce.content)}]));ie=await me(ie,Qn($e),es,We,ot?lt:"");let on=yi(Ge),Ut=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((re)=>!Ft.has(re));if(on.length>0||Ut.length>0)We.__stx_client_signal_names=[...new Set([...Ut,...on])];else delete We.__stx_client_signal_names;let Ht=E.filter((re)=>!Ft.has(re)&&!(re in t));if(Ht.length>0)We[Bn]=Ht;let an={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ae.dirname(D),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||ot||Ge.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:cn}=await o("stx/process",()=>import("./chunk-2k3ga51z.js")),tt=await cn(ie,We,D,an,v),ut=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let re of tt.matchAll(/\{\{([\s\S]*?)\}\}/g))ut.add(re[1].trim());if(ut.size>0)a.__stx_preserved_client_expressions=[...ut];let ct=lt,Ze=tt;if(ot){let re="";if(Object.keys(t).length>0)try{re=` data-stx-props="${Ks(JSON.stringify(t))}"`}catch{}let ce=L?` stx-hydrate="${Ks(L)}"`:"",we=Object.fromEntries(Object.entries(Je).map(([mt,_t])=>[mt,Boolean(_t)])),be=Object.keys(we).length>0?` data-stx-slots="${Ks(JSON.stringify(we))}"`:"",He=` data-stx-scope="${ct}"${re}${be}${ce}`,Te=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(tt),ft=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(tt),pt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(tt),yt=Te?"span":"div",ts=ft&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':pt&&c._nativeHostAttrs?' style="width:100%;height:100%"':Te||ft?' style="display:contents"':"";Ze=fg(tt,He)??`<${yt}${He} data-stx-component-wrapper${ts}>${tt}</${yt}>`;let ns=await Promise.all(Ge.map(async(mt)=>{let _t=mt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return mt;let[,qt,ss]=_t,ln=bo(mt,We,D);if(ln!==null)return ln;let wt=await eu(ss,D,c.buildMode==="compile"),un=yn(wt.clientCode,De(We)),{vendorStyleTags:_n}=wt,Sn=un?`function(__scopeId) {
|
|
575
|
+
${un}
|
|
576
|
+
return (${wt.factoryBody})(__scopeId);
|
|
577
|
+
}`:wt.factoryBody,$n=L?null:bs(a,Sn),En=$n?`window.__stxComponentFactories[${JSON.stringify($n)}](${JSON.stringify(ct)});`:`(${Sn})(${JSON.stringify(ct)});`;if(L)return`${_n}<script type="stx/island" data-stx-island="${ct}" data-stx-scoped data-stx-owner="${ct}"${qt}>${En}</script>`;return`${_n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${ct}"${qt}>${En}</script>`}));if(Ze=Ze+`
|
|
578
|
+
`+ns.join(`
|
|
579
|
+
`),it)Ze+=`
|
|
580
|
+
`+it}else{if(it)Ze+=`
|
|
581
|
+
`+it;if(Ge.length>0){let re=We.__stx_event_bindings||[],ce=De(We),we=await Promise.all(Ge.map(async(be)=>{let He=bo(be,We,D);if(He!==null)return He;let Te=be.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Te)return be;return await Le(Te[1],{eventBindings:re,templateContent:Ze,filePath:D,projectRoot:process.cwd(),serverData:ce,instanceId:lt})}));Ze+=`
|
|
582
|
+
`+we.join(`
|
|
583
|
+
`),We.__stx_event_bindings=[]}}if(se){let re=Bs(Ze,D);if(re.hasScoped)Ze=re.html}if(bt&&st){let re=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];Zn.set(bt,{output:Ze,dependencies:[...v].filter((ce)=>!st.has(ce)),clientFactories:Bt?Yr(a,Bt):[],uidsConsumed:gt.n-rn,preservedClientExpressions:Wt?re.filter((ce)=>!Wt.has(ce)):[]})}if(zt)Ze=`<!--stx-render-failed:${zt}-->${Ze}`;return Ke.length>0?`${Ze}
|
|
584
|
+
${Ke.join(`
|
|
585
|
+
`)}`:Ze}catch(B){if(B instanceof q)throw B;return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{M.delete(e)}}async function s(e){return Bun.file(e).exists()}function nr(e,t){let i=ae.resolve(t),n=ae.resolve(e),a=i.endsWith(ae.sep)?i:i+ae.sep;if(n===i||n.startsWith(a))return n;return null}async function Ro(e,t,i,n){let a=t.startsWith("layouts/")?t.slice(8):t,l=ae.join(e,a);for(let c of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await s(c)){if(n)console.log(`Found layout in ${e}: ${c}`);return i?.add(c),c}return null}async function bn(e,t,i,n){let a=await Ql(e,t,i,n);if(a===null)return null;let l=nr(a,process.cwd());if(l)return l;let c=[i.root,i.layoutsDir,i.fallbackLayoutsDir,i.componentsDir,i.partialsDir,i.pagesDir,...i._layerLayoutDirs??[]].filter((y)=>typeof y==="string"&&y.length>0);for(let y of c){let v=ae.isAbsolute(y)?y:ae.resolve(process.cwd(),y);if(nr(a,v))return ae.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${t})`),null}async function Ql(e,t,i,n){if(i.debug)console.log(`Resolving template path: ${e} from ${t}`);let a=ae.dirname(t),l=process.cwd();if(e.startsWith("/")){let M=ae.join(l,e),I=nr(M,l);if(!I)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(i.debug)console.log(`Checking absolute path: ${I}`);if(await s(I)&&n)n.add(I);return I}let c=async(M)=>{if(!i.layoutsDir||!i.fallbackLayoutsDir)return M;let I=ae.relative(ae.resolve(l,i.fallbackLayoutsDir),M);if(I.startsWith("..")||ae.isAbsolute(I))return M;return await Ro(ae.resolve(l,i.layoutsDir),e,n,i.debug)??M},y=ae.join(a,e);if(await s(y)){if(i.debug)console.log(`Found direct path: ${y}`);let M=await c(y);if(n)n.add(M);return M}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let M of[".stx",".tsx",".jsx"]){let I=`${y}${M}`;if(await s(I)){if(i.debug)console.log(`Found direct path with extension: ${I}`);let z=await c(I);if(n)n.add(z);return z}}let v=[];if(v.push(...i._layerLayoutDirs??[]),i.layoutsDir)v.push(ae.isAbsolute(i.layoutsDir)?i.layoutsDir:ae.resolve(process.cwd(),i.layoutsDir));let E=ae.resolve(a),A=process.cwd();for(let M=0;M<10;M++){let I=ae.join(E,"layouts"),z=!1;try{z=Kn.statSync(I,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(z){v.push(I);break}let L=ae.dirname(E);if(L===E||L.length<A.length)break;E=L}for(let M of v){let I=await Ro(M,e,n,i.debug);if(I)return I}if(i.fallbackLayoutsDir){let M=ae.isAbsolute(i.fallbackLayoutsDir)?i.fallbackLayoutsDir:ae.resolve(process.cwd(),i.fallbackLayoutsDir),I=e.startsWith("layouts/")?e.slice(8):e,z=[ae.join(M,I)];if(!e.endsWith(".stx"))z.push(`${z[0]}.stx`);for(let L of z)if(await s(L)){if(i.debug)console.log(`Found in options.fallbackLayoutsDir: ${L}`);if(n)n.add(L);return L}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let M=e.split("layouts/"),I=ae.join(i.partialsDir||a,"layouts",M[1]);if(await s(I)){if(i.debug)console.log(`Found in layouts path: ${I}`);if(n)n.add(I);return I}if(!I.endsWith(".stx")){let z=`${I}.stx`;if(await s(z)){if(i.debug)console.log(`Found in layouts path with extension: ${z}`);if(n)n.add(z);return z}}}if(i.partialsDir){let M=ae.join(i.partialsDir,"layouts");if(await s(M)){let I=ae.join(M,e);if(await s(I)){if(i.debug)console.log(`Found in partials layouts dir: ${I}`);if(n)n.add(I);return I}if(!e.endsWith(".stx")){let z=`${I}.stx`;if(await s(z)){if(i.debug)console.log(`Found in partials layouts dir with extension: ${z}`);if(n)n.add(z);return z}}}}let j=i.partialsDir||ae.join(process.cwd(),"views"),X=ae.join(j,e);if(await s(X)){if(i.debug)console.log(`Found in views path: ${X}`);if(n)n.add(X);return X}if(!e.endsWith(".stx")){let M=`${X}.stx`;if(await s(M)){if(i.debug)console.log(`Found in views path with extension: ${M}`);if(n)n.add(M);return M}}if(a.includes("temp")){let M=ae.join(ae.dirname(a),"layouts",e);if(await s(M)){if(i.debug)console.log(`Found in temp layouts dir: ${M}`);if(n)n.add(M);return M}if(!e.endsWith(".stx")){let I=`${M}.stx`;if(await s(I)){if(i.debug)console.log(`Found in temp layouts dir with extension: ${I}`);if(n)n.add(I);return I}}}if(i.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function Yc(e,t,i){let n=0,a="",l="";try{if(typeof t==="number"&&t>=0){let c=e.split(`
|
|
586
|
+
`),y=0;for(let v=0;v<c.length;v++)if(y+=c[v].length+1,y>=t){n=v+1,a=c[v].trim();let E=Math.max(0,v-2),A=Math.min(c.length,v+3);l=c.slice(E,A).map((j,X)=>{let M=E+X+1;return`${M===n?"> ":" "}${M}: ${j}`}).join(`
|
|
587
|
+
`);break}}else if(i){let c=e.indexOf(i);if(c>=0)return Yc(e,c)}}catch{}return{lineNumber:n,lineContent:a,context:l}}var ke={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,t,i,n,a,l){let{lineNumber:c,context:y}=Yc(n,a,l),v=i.split("/").pop(),E=0;if(typeof a==="number"&&a>=0&&n){let j=n.lastIndexOf(`
|
|
588
|
+
`,Math.max(0,a-1));E=a-(j+1)+1}let A="";if(c>0)A+=`
|
|
589
|
+
${i}:${c}${E>0?`:${E}`:""}: ${e.toLowerCase()} error: ${t}
|
|
590
|
+
`;if(A+=`
|
|
591
|
+
${ke.bold}${ke.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${ke.reset}
|
|
592
|
+
`,A+=`${ke.bold}${ke.red}\u2502${ke.reset} ${ke.bold}${ke.bgRed} ERROR ${ke.reset} ${ke.red}${e} Error${ke.reset}${" ".repeat(Math.max(0,43-e.length))}${ke.bold}${ke.red}\u2502${ke.reset}
|
|
593
|
+
`,A+=`${ke.bold}${ke.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${ke.reset}
|
|
594
|
+
`,A+=`
|
|
595
|
+
${ke.cyan}${ke.bold}File:${ke.reset} ${ke.dim}${v}${ke.reset}`,c>0)A+=` ${ke.gray}(line ${c}${E>0?`, col ${E}`:""})${ke.reset}`;if(A+=`
|
|
596
|
+
${ke.yellow}${ke.bold}Message:${ke.reset} ${t}
|
|
597
|
+
`,y)A+=`
|
|
598
|
+
${ke.blue}${ke.bold}Context:${ke.reset}
|
|
599
|
+
${ke.dim}${y}${ke.reset}
|
|
600
|
+
`;return A}function fe(){tn.clear(),Gs.clear(),qn.clear(),Qs.clear(),er.clear(),Zn.clear()}function Gh(){return{size:tn.size,maxSize:500}}var Xs=b(128);async function eu(e,t,i){let n=S(e,t,i),a=Xs.get(n);if(a){if(Ds(a.deps))return a;Xs.delete(n)}let l=mi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,y=hi(l.styles);c=Nt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-0633xsmx.js")),A=[],j=!1;if(v(c)){let Q=c;c=await E(Q,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),j=c===Q}let{stripStxRuntimeImports:X}=await o("stx/signal-processing",()=>import("./chunk-9bhvh2dc.js"));c=X(c);let M=P(c),I=ql(M),z=new Set(H(M,!0).split(",").map((Q)=>Q.trim())),L=`function(__scopeId) {
|
|
601
|
+
${at("const",[...ul,...I],M)}
|
|
602
|
+
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
603
|
+
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
604
|
+
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
605
|
+
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
606
|
+
const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
|
|
607
|
+
// A clone the runtime is setting up may not be in the document yet (rows
|
|
608
|
+
// a loop builds inside a closed :if), where a lookup cannot see it, so the
|
|
609
|
+
// runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
|
|
610
|
+
const __setupRoot = window.__STX_SETUP_ROOT__;
|
|
611
|
+
const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
612
|
+
__scopeVars.$slots = Object.create(null);
|
|
613
|
+
if (__componentElement) {
|
|
614
|
+
try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
|
|
615
|
+
catch {}
|
|
616
|
+
}
|
|
617
|
+
window.__STX_CURRENT_ELEMENT__ = __componentElement;
|
|
618
|
+
let __componentProps = __componentElement && __componentElement.__stx_props;
|
|
619
|
+
if (!__componentProps && __componentElement) {
|
|
620
|
+
try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
|
|
621
|
+
catch { __componentProps = {}; }
|
|
622
|
+
}
|
|
623
|
+
window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
|
|
624
|
+
const __scopeProps = window.__STX_CURRENT_PROPS__;
|
|
625
|
+
Object.defineProperty(__scopeVars, '$props', { configurable: true, enumerable: true, get: function() {
|
|
626
|
+
return (__componentElement && __componentElement.__stx_props) || __scopeProps;
|
|
627
|
+
} });
|
|
628
|
+
|
|
629
|
+
// Scope-specific lifecycle callbacks. The queues drain as they run; the
|
|
630
|
+
// hook lists keep what setup registered, because a component behind an :if
|
|
631
|
+
// unmounts at each hide and mounts again at each show (signals.ts,
|
|
632
|
+
// suspendSubtreeScopes).
|
|
633
|
+
if (__scopeVars.__suspended && !__scopeVars.__mounted) {
|
|
634
|
+
// Set up again after an :if hid it -- a <template :if> clones the
|
|
635
|
+
// component afresh on every show, and the clone's script runs. This run's
|
|
636
|
+
// hooks close over this run's state, so they replace the ones the hide
|
|
637
|
+
// kept for a re-show rather than queueing beside them.
|
|
638
|
+
__scopeVars.__mountCallbacks = [];
|
|
639
|
+
__scopeVars.__destroyCallbacks = [];
|
|
640
|
+
__scopeVars.__mountHooks = [];
|
|
641
|
+
__scopeVars.__destroyHooks = [];
|
|
642
|
+
// So do its effects: the last run's watched a clone that is gone.
|
|
643
|
+
if (typeof __scopeVars.__disposeEffects === 'function') __scopeVars.__disposeEffects();
|
|
644
|
+
__scopeVars.__disposeEffects = null;
|
|
645
|
+
}
|
|
646
|
+
__scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
|
|
647
|
+
__scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
|
|
648
|
+
__scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
|
|
649
|
+
__scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
|
|
650
|
+
let __registeringSetupHooks = true;
|
|
651
|
+
const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
|
|
652
|
+
const onDestroy = (fn) => {
|
|
653
|
+
__scopeVars.__destroyCallbacks.push(fn);
|
|
654
|
+
// A teardown registered inside onMount belongs to this mount alone.
|
|
655
|
+
// Replaying it AND registering the next mount's teardown doubles cleanup.
|
|
656
|
+
if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
|
|
657
|
+
};
|
|
658
|
+
// The effects this setup makes (effect, watch) belong to the scope and are
|
|
659
|
+
// disposed with it (disposeSubtreeScopes in the runtime), as its bindings
|
|
660
|
+
// are. Untracked, one reading a store kept running for a component the
|
|
661
|
+
// router had long swapped out.
|
|
662
|
+
const __endEffects = window.stx._beginEffects ? window.stx._beginEffects() : null;
|
|
663
|
+
|
|
664
|
+
try {
|
|
665
|
+
${M}
|
|
666
|
+
|
|
667
|
+
// Register all defined signals and functions in this scope
|
|
668
|
+
const __localVars = {};
|
|
669
|
+
try {
|
|
670
|
+
${I.map((Q)=>z.has(Q)?`Object.defineProperty(__localVars, '${Q}', ${Ps(Q)});`:`if (typeof ${Q} !== 'undefined') __localVars['${Q}'] = ${Q};`).join(`
|
|
671
|
+
`)}
|
|
672
|
+
}
|
|
673
|
+
catch (e) {}
|
|
674
|
+
Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__localVars));
|
|
675
|
+
if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__stxLiveBindings));
|
|
676
|
+
}
|
|
677
|
+
finally {
|
|
678
|
+
__registeringSetupHooks = false;
|
|
679
|
+
if (__endEffects) {
|
|
680
|
+
const __previousDispose = __scopeVars.__disposeEffects;
|
|
681
|
+
const __disposeSetup = __endEffects();
|
|
682
|
+
__scopeVars.__disposeEffects = typeof __previousDispose === 'function'
|
|
683
|
+
? function() { __previousDispose(); __disposeSetup(); }
|
|
684
|
+
: __disposeSetup;
|
|
685
|
+
}
|
|
686
|
+
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
687
|
+
window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
|
|
688
|
+
}
|
|
689
|
+
}`,B={vendorStyleTags:y,factoryBody:L,clientCode:M,deps:br([...A,...l.styles.map((Q)=>Q.resolvedPath)])};if(!j&&l.unresolved.length===0)Xs.set(n,B);return B}var hn=["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 tu=100,nu=599,rr="__stxResponseStatus",nn="__stxResponseHeaders";function Xn(e){return typeof e==="number"&&Number.isInteger(e)&&e>=tu&&e<=nu}function gn(e){for(let t of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let i=t[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!i)continue;let n=Number(i[1]);if(Xn(n))return n}return}function sr(e,t){if(!e||typeof e!=="object")return!1;let i=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!Xn(i))return!1;return e[rr]=i,!0}function su(e,t,i){if(!e||typeof e!=="object")return;let n=String(t??"").trim();if(!n)return;e[nn]={...e[nn],[n]:String(i)}}function It(e){let t=e?.[rr];return Xn(t)?t:void 0}function Ot(e){let t=e?.[nn];if(!t||typeof t!=="object")return;let i=Object.entries(t).map(([n,a])=>[n,String(a)]);return i.length>0?Object.fromEntries(i):void 0}function Lc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let i=It(e);if(i!==void 0)t[rr]=i;let n=Ot(e);if(n)t[nn]={...t[nn],...n}}function Fs(e){return{setResponseStatus:(t)=>{sr(e,t)},notFound:(t=404)=>{let i=Xn(t)&&t>=400?t:404;sr(e,i)},setResponseHeader:(t,i)=>{su(e,t,i)}}}function jc(e,t,i={}){if(!e.includes("@status"))return e;let{filePath:n,buildMode:a}=i,l=a==="compile",c="",y=0,v=/@status\s*\(/g,E;while((E=v.exec(e))!==null){let A=ru(e,E.index+E[0].length-1);if(A<0)break;let j=e.slice(E.index+E[0].length,A).trim(),X=/^\d+$/.test(j)?Number(j):u(j,t),M=n?` in ${n}`:"";if(l)console.warn(`[stx] @status(${j})${M} 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(${j}) from <script server> instead \u2014 that runs per request.`);else if(!sr(t,X))console.warn(`[stx] @status(${j})${M} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(y,E.index),y=A+1+(e.slice(A+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=y}return y===0?e:c+e.slice(y)}function ru(e,t){let i=1,n=null,a=!1;for(let l=t+1;l<e.length;l++){let c=e[l];if(a){a=!1;continue}if(n){if(c==="\\")a=!0;else if(c===n)n=null;continue}if(c==='"'||c==="'"||c==="`"){n=c;continue}if(c==="(")i++;else if(c===")"&&--i===0)return l}return-1}var Po=new Set(hn),iu=new Set(["props","$props","defineProps"]),ou=new Set(["stx","@stacksjs/stx"]),Oo=b(128),Mo=b(64);function au(e){let t=[],i=0,n=e.split(`
|
|
690
|
+
`);for(let a of n){let l=i,c=null,y=!1;for(let v=0;v<a.length;v++){let E=a[v];if(y){y=!1;continue}if(E==="\\"){y=!0;continue}if(c){if(E===c)c=null;continue}if(E==="'"||E==='"'||E==="`"){c=E;continue}if(E==="/"&&v+1<a.length&&a[v+1]==="/")break;if(E==="{")i++;else if(E==="}")i--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)t.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let E=a.match(/(?:const|let|var)\s+(\w+)/);if(E)t.push(E[1])}else{let E=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(E){let j=E[1].slice(1,-1).split(",").map((X)=>{let M=X.split(":");return(M.length>1?M[1]:M[0]).trim()}).filter((X)=>/^\w+$/.test(X));t.push(...j)}}}}return[...new Set(t)]}function Zf(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function i(n){if(!n.includes(":"))return n;let a=[],l="",c=0,y=0,v=null;for(let E=0;E<n.length;E++){let A=n[E];if(v){if(l+=A,A===v)v=null;continue}if(A==='"'||A==="'"||A==="`"){v=A,l+=A;continue}if(A==="<")c++;else if(A===">"&&c>0)c--;else if(A==="(")y++;else if(A===")")y--;if(A===","&&c===0&&y===0){a.push(l),l="";continue}l+=A}if(l)a.push(l);return a.map((E)=>{let A=E.trim(),j=A.startsWith("..."),X=j?A.slice(3):A,M=-1,I=0;for(let ne=0;ne<X.length;ne++)if(X[ne]==="<")I++;else if(X[ne]===">")I--;else if(X[ne]===":"&&I===0){M=ne;break}if(M===-1)return E;let L=X.substring(0,M).trim().replace(/\?$/,""),B=X.substring(M+1),Q=-1,D=0;for(let ne=0;ne<B.length;ne++)if(B[ne]==="<")D++;else if(B[ne]===">")D--;else if(B[ne]==="="&&D===0){Q=ne;break}let ee=j?"...":"";if(Q!==-1)return`${ee}${L} = ${B.substring(Q+1).trim()}`;return`${ee}${L}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(n,a,l)=>{if(!l.includes(":"))return n;return`${a}(${i(l)})`});{let n=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=n.exec(t))!==null){let c=a.index+a[0].length-1,y=1,v=c+1,E=0,A=null;while(v<t.length&&y>0){let M=t[v];if(A){if(M===A)A=null;v++;continue}if(M==='"'||M==="'"||M==="`"){A=M,v++;continue}if(M==="<")E++;else if(M===">"&&E>0)E--;else if(E===0){if(M==="(")y++;else if(M===")")y--}if(y>0)v++}if(y!==0)continue;let j=t.substring(c+1,v);if(!j.includes(":"))continue;let X=i(j);l.push({start:c+1,end:v,replacement:X})}for(let c=l.length-1;c>=0;c--){let{start:y,end:v,replacement:E}=l[c];t=t.substring(0,y)+E+t.substring(v)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(n,a)=>{if(!a.includes(":"))return n;if(a.includes("{")||a.includes("}"))return n;return`(${a.split(",").map((c)=>{let[y,...v]=c.split("="),E=y.split(":")[0].trim();if(v.length>0)return`${E} = ${v.join("=").trim()}`;return E}).join(", ")}) =>`}),t=t.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"),t=t.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),t=t.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),t=t.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),t=t.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),t=t.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),t=t.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),t=t.replace(/\n\s*\n\s*\n/g,`
|
|
691
|
+
|
|
692
|
+
`),t}function Qf(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...i)=>{let[,n,a]=i,l=n??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":t})}function eg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function tg(e){if(e instanceof SyntaxError)return!0;let t=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(t)}function ng(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 jo=new Set;async function m(e,t,i,n={}){if(!e.trim())return;let a=C(),l=S(e,JSON.stringify(a)),c=Oo.get(l);if(c===void 0){try{let se=Y({loader:"ts",target:"browser",define:a}),ie=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ie=ie.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=se.transformSync(ie)}catch{c=Zf(e)}Oo.set(l,c)}let y={exports:{}},v=y.exports,E=Ct.cwd(),A={},j=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((se)=>se[1]).filter((se)=>!se.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(se)),X=new Map;for(let se of j)try{if(se.startsWith(".")){A[se]=await import(nt.resolve(nt.dirname(i),se));continue}let ie=nt.resolve(E,"node_modules",se),me=nt.join(ie,"package.json"),$e=JSON.parse(g("fs").readFileSync(me,"utf8")),Ce=$e.main||"index.js";if($e.exports){let qe=typeof $e.exports==="string"?$e.exports:$e.exports["."];if(typeof qe==="string")Ce=qe;else if(qe?.bun)Ce=qe.bun;else if(qe?.import)Ce=qe.import;else if(qe?.default)Ce=qe.default}A[se]=await import(nt.resolve(ie,Ce))}catch(ie){if(se.startsWith("."))X.set(se,ie instanceof Error?ie.message:String(ie))}let M=(se)=>{if(A[se])return A[se];let ie=X.get(se);if(ie!==void 0)throw Error(`Cannot require '${se}' from ${i}: ${ie}`);return g(se)},I=t.props||{},z=(se)=>{if(!se)return I;let ie={};for(let[me,$e]of Object.entries(se)){let Ce=I[me];if(Ce!==void 0)ie[me]=Ce;else if(typeof $e==="function")ie[me]=$e();else ie[me]=$e}return ie};for(let[se,ie]of Object.entries(I))Object.defineProperty(z,se,{value:ie,enumerable:!0,configurable:!0,writable:!0});let L=(se,ie=!1)=>{if(se===void 0||se===null)return ie;if(typeof se==="string"){let me=se.trim().toLowerCase();if(me===""||me==="true"||me==="1"||me==="on"||me==="yes")return!0;if(me==="false"||me==="0"||me==="off"||me==="no")return!1;return!0}return Boolean(se)},B=(se,ie=0)=>{if(se===void 0||se===null)return ie;if(typeof se==="string"){let $e=se.trim();if($e==="")return ie;let Ce=Number($e);return Number.isFinite(Ce)?Ce:ie}let me=Number(se);return Number.isFinite(me)?me:ie};for(let se of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(I,se))continue;try{Object.defineProperty(z,se,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let Q=(se)=>{if(!se)return I;let ie={...I};for(let[me,$e]of Object.entries(se)){let Ce=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(ie[me]===void 0&&Ce.default!==void 0)ie[me]=typeof Ce.default==="function"?Ce.default():Ce.default}return ie},D=()=>t.slots||{},ee=(se,ie)=>{let me={...se};for(let[$e,Ce]of Object.entries(ie))if(me[$e]===void 0)if(typeof Ce==="function")me[$e]=Ce();else me[$e]=Ce;return me},ne=(se)=>{let ie=()=>se;return ie.set=(me)=>{},ie.update=(me)=>{},ie},te=(se)=>{let ie,me=!1;return()=>{if(!me)try{ie=se(),me=!0}catch{ie=void 0}return ie}},le=(se)=>{},he=(se)=>se(),ue=(se)=>{},Re=(se)=>{},Ae=Fs(t);function Ue(se){let ie=se||{};if(ie.title!==void 0||ie.description!==void 0)Je({title:ie.title,description:ie.description})}function Ke(se){if(!se||typeof se!=="object")return;let ie=t.__stxClientPayload??{};Object.assign(ie,se),t.__stxClientPayload=ie}let Ye=()=>{let se=t.__stxServeContext,ie=t.__stxServeSearch??se?.search??"",me=se?.path??"",$e=Object.fromEntries(new URLSearchParams(ie)),Ce=t.query,qe=Object.keys($e).length>0?$e:Ce??{},ot=ie||(Object.keys(qe).length>0?`?${new URLSearchParams(qe).toString()}`:"");return{params:t.params??{},query:qe,path:me,name:"",fullPath:me+ot,hash:"",matched:[]}},Xe=()=>({push:(se)=>{},replace:(se)=>{},back:()=>{},forward:()=>{},go:(se)=>{}}),et=(se)=>{let ie=t.__stx_runtime_head||{};t.__stx_runtime_head=Ve(ie,_e(se||{},{known:Js,source:"useHead()"}))},Je=(se)=>{et(Ys(se||{}))},gt=(se)=>({value:se}),Tt=(se)=>se,or=(se)=>({value:typeof se==="function"?se():se}),lt=(se,ie)=>{},We=(se)=>{},Dt=(se)=>{},sn=(se)=>se?se():Promise.resolve(),Jn=(se)=>(ie,...me)=>{},Lt=(se)=>{},Ge=(se,ie)=>{},zt=(se,ie)=>ie,Gn=()=>({value:"light"}),bt=()=>ne(!1),st=(se)=>ne(!1),Bt=()=>ne(!1),rn=()=>st("(prefers-color-scheme: dark)"),Wt=()=>st("(prefers-color-scheme: light)"),Ft=()=>st("(prefers-reduced-motion: reduce)"),ar=()=>st("(prefers-contrast: more)"),Qe={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:{}},Vt=new Proxy(Qe,{get(se,ie){if(ie in se)return se[ie];return},set(se,ie,me){return se[ie]=me,!0}}),Yn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},it=console;try{let se=gi(c,i),ie=new Set(Object.keys(I)),me=Object.keys(t).filter((re)=>!ie.has(re)&&!iu.has(re)&&jt(re)),$e=me.map((re)=>t[re]);if(!me.includes("__stxServeContext"))me.push("__stxServeContext"),$e.push(void 0);if(!ie.has("cookies")){let re=t.cookies??t.__stxServeContext?.cookies??{},ce=me.indexOf("cookies");if(ce<0)me.push("cookies"),$e.push(re);else $e[ce]=re}let Ce=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),qe=[],ot=[];for(let[re,ce]of Object.entries(I)){if(!jt(re))continue;if(Ce.has(re))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${re}\\b`).test(se))continue;qe.push(re),ot.push(ce)}let es=au(se).map((re)=>`module.exports.${re} = typeof ${re} !== 'undefined' ? ${re} : module.exports.${re};`).join(`
|
|
693
|
+
`),on=t.params??{},Ut=[],Ht=[];for(let re=0;re<me.length;re++){if(me[re]==="params")continue;Ut.push(me[re]),Ht.push($e[re])}let an=[...hn,...qe,...Ut],cn=`return (async () => {
|
|
694
|
+
${se}
|
|
695
|
+
${es}
|
|
696
|
+
return module.exports
|
|
697
|
+
})()`,tt=S(cn,an.join("\x00")),ut=Mo.get(tt);if(!ut)ut=Function(...an,cn),Mo.set(tt,ut);let ct=t.__stx_options?.runtimeConfig;if(ct||/\buse(?:Server)?RuntimeConfig\b/.test(c))await vn(t,i,ct);let Ze=await ze(t.__stx_runtime_config??xn()??N(),()=>gr(t,()=>ut(y,v,M,I,z,L,B,Q,ee,Ke,mr,xi,Ws,ne,te,le,he,ue,Re,Ue,Ye,Xe,et,Je,Ae.setResponseStatus,Ae.setResponseHeader,Ae.notFound,gt,Tt,or,lt,We,Dt,sn,Jn,Lt,D,Ge,zt,Gn,bt,st,Bt,rn,Wt,Ft,ar,Vt,Yn,it,Qe.confirm,Qe.alert,Qe.fetch,on,...ot,...Ht)));if(n.preserveExisting){for(let[re,ce]of Object.entries(Ze))if(!(re in t)||t[re]===void 0)t[re]=ce}else Object.assign(t,Ze);for(let[re,ce]of Object.entries(I))if(!(re in t))t[re]=ce}catch(se){if(t.__stx_strict_hydration)throw se;let ie=Qf(se instanceof Error?se.message:String(se));if(eg(ie))console.warn(`[stx] server <script> in ${i??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ie}`),n.onFailure?.({kind:"module-resolution",message:ie,error:se});else if(tg(se))console.warn(`[stx] server <script> in ${i??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ie}`),n.onFailure?.({kind:"syntax",message:ie,error:se});else if(ng(ie))console.warn(`[stx] server <script> in ${i??"<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: ${ie}`),n.onFailure?.({kind:"missing-binding",message:ie,error:se});else{let me=`${i??"<unknown>"}\x00${ie}`;if(Ct.env.STX_DEBUG||!jo.has(me))jo.add(me),console.warn(`[stx] server <script> in ${i??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ie}`);n.onFailure?.({kind:"unknown",message:ie,error:se})}try{await du(c,t,i)}catch(me){if(Ct.env.STX_DEBUG){let $e=me instanceof Error?me.message:String(me);console.warn(`[stx] fallback extraction also failed in ${i??"<unknown>"}: ${$e}`)}}}}function rg(e){let t=0,i=null,n=!1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(i){if(c===i){if(i=null,n||t===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){i=c;continue}if(c==="{")t++;else if(c==="}")t--;else if(e.startsWith("from",l)&&t===0)n=!0}return i===null&&t===0&&a}var cu=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function gi(e,t){let i=t?nt.dirname(t):Ct.cwd(),n=Ct.cwd(),a=e.split(`
|
|
698
|
+
`),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 E of a[c])if(E==="{")v++;else if(E==="}")v--;if(v<=0)break}}c++;continue}if(y.startsWith("definePageMeta(")){let v=0,E=!1,A=c;for(let M=c;M<a.length&&!E;M++){let I=null,z=!1,L=a[M];for(let B=0;B<L.length;B++){let Q=L[B];if(z){z=!1;continue}if(Q==="\\"){z=!0;continue}if(I){if(Q===I)I=null;continue}if(Q==='"'||Q==="'"||Q==="`"){I=Q;continue}if(Q==="(")v++;else if(Q===")"){if(v--,v===0){c=M+1,E=!0;break}}}}if(!E)c=a.length;let j=a.slice(A,c).join(`
|
|
699
|
+
`),X=[];for(let M of["title","description"]){let I=new RegExp(`\\b${M}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(j);if(I)X.push(`${M}: ${JSON.stringify(I[2])}`)}if(X.length>0)l.push(`useSeoMeta({ ${X.join(", ")} });`);continue}if(y.startsWith("import ")||y==="import"||y.startsWith("import{")||/^import['"]/.test(y)){let v=y,E=0;while(!rg(v)&&c+E+1<a.length)E++,v=`${v} ${a[c+E].trim()}`;c+=E;let A=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),j=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),X=v.match(/^import\s*['"](.+?)['"]/),M=v,I=(z)=>{if(z.startsWith("."))return nt.resolve(i,z);if(z.startsWith("~/")||z.startsWith("@/"))return nt.resolve(n,z.slice(2));try{return Bun.resolveSync(z,i)}catch{return z}};if(A){let[,z,L]=A,B=I(L);l.push(`const ${z} = (await import('${B}')).default`),l.push(`module.exports.${z} = ${z};`)}else if(j){let[,z,L]=j,B=I(L),Q=[],D=[],ee=ou.has(L);for(let ne of z.split(",")){let te=ne.trim();if(!te)continue;let le=te.split(/\s+as\s+/);if(le.length===2){let[he,ue]=[le[0].trim(),le[1].trim()];if(ee&&Po.has(he)){l.push(`const ${ue} = ${he};`);continue}Q.push(`${he}: ${ue}`),D.push(ue)}else{if(ee&&Po.has(te))continue;Q.push(te),D.push(te)}}if(Q.length>0)l.push(`const { ${Q.join(", ")} } = await import('${B}')`);for(let ne of D)l.push(`module.exports.${ne} = ${ne};`)}else if(X){let z=I(X[1]);l.push(`await import('${z}')`)}else l.push(M);c++;continue}if(cu.test(y))l.push(a[c]),c++;else if(y.startsWith("export const ")||y.startsWith("export let ")||y.startsWith("export var ")){let v=No(a,c),{type:E,name:A,value:j}=v;l.push(`${E} ${A} = ${j};`),l.push(`module.exports.${A} = ${A};`),c=v.nextIndex}else if(y.startsWith("export function ")||y.startsWith("export async function ")){let v=ir(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=No(a,c),{type:E,name:A,value:j}=v;l.push(`${E} ${A} = ${j};`),l.push(`module.exports.${A} = ${A};`),c=v.nextIndex}else if(y.startsWith("function ")||y.startsWith("async function ")){let v=ir(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"),E=[...a];E[c]=v;let A=ir(E,c);if(l.push(A.functionCode),A.name)l.push(`module.exports.default = ${A.name};`);c=A.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 E=v[1],A=a[c].replace(/^export\s+/,""),j=0,X=c;for(;X<a.length;X++){let M=a[X];for(let I of M)if(I==="{")j++;else if(I==="}")j--;if(X>c)A+=`
|
|
700
|
+
`+M;if(j<=0&&X>=c)break}l.push(A),l.push(`module.exports.${E} = ${E};`),c=X+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 lu(l.join(`
|
|
701
|
+
`),i,n)}function lu(e,t,i){let n=e.length,a="",l=0,c=null,y=!1,v=!1,E=0;while(l<n){let A=e[l],j=e[l+1];if(y){if(a+=A,A===`
|
|
702
|
+
`)y=!1;l++;continue}if(v){if(a+=A,A==="*"&&j==="/"){a+=j,l+=2,v=!1;continue}l++;continue}if(!c&&A==="/"&&j==="/"){y=!0,a+=A,l++;continue}if(!c&&A==="/"&&j==="*"){v=!0,a+=A,l++;continue}if(c){if(a+=A,A==="\\"){a+=j,l+=2;continue}if(A===c&&c!=="`"){c=null,l++;continue}if(c==="`"){if(A==="$"&&j==="{"){E++,a+=j,l+=2;continue}if(A==="`"){c=null,l++;continue}}l++;continue}if(E>0){if(A==="{")E++;else if(A==="}")E--}if(A==='"'||A==="'"||A==="`"){c=A,a+=A,l++;continue}if(A==="a"&&e.startsWith("await",l)){let X=uu(e,l);if(X){let{quote:M,path:I,end:z}=X;if(I.startsWith(".")||I.startsWith("~/")||I.startsWith("@/")){let L=I.startsWith(".")?nt.resolve(t,I):nt.resolve(i,I.slice(2));a+=`await import(${M}${L}${M})`,l=z;continue}}}a+=A,l++}return a}function uu(e,t){let i=t+5;if(i>=e.length)return null;if(!/\s/.test(e[i]))return null;while(i<e.length&&/\s/.test(e[i]))i++;if(!e.startsWith("import",i))return null;i+=6;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="(")return null;i++;while(i<e.length&&/\s/.test(e[i]))i++;let n=e[i];if(n!=="'"&&n!=='"')return null;i++;let a=i;while(i<e.length&&e[i]!==n)if(e[i]==="\\")i+=2;else i++;if(i>=e.length)return null;let l=e.slice(a,i);i++;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!==")")return null;return{quote:n,path:l,end:i+1}}function Wo(e,t){let i=e[t];if(i!=="{"&&i!=="[")return null;let a=x(e,i,i==="{"?"}":"]",t);if(a===-1)return null;return{pattern:e.slice(t,a+1),endPos:a+1}}function Fo(e){let t=[],i=e.slice(1,-1).trim();if(!i)return t;let n=0,a=0,l="";while(n<i.length){let c=i[n];if(c==="{"||c==="["){let y=a===0?Wo(i,n):null;if(y){t.push(...Fo(y.pattern)),n=y.endPos,l="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){n++;continue}if(c===","){if(l.trim())t.push(l.trim());l="",n++;continue}if(c===":"){l="",n++;continue}if(c==="="){if(l.trim())t.push(l.trim());l="",n++;while(n<i.length&&i[n]!==","&&a===0){if(i[n]==="{"||i[n]==="[")a++;else if(i[n]==="}"||i[n]==="]")a--;n++}continue}if(/[\w$]/.test(c))l+=c;n++}if(l.trim())t.push(l.trim());return t}function sg(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let i=t[0].length,n=(a)=>a===" "||a==="\t";while(i<e.length&&n(e[i]))i++;if(e[i]===":"){let a=0,l=null;i++;for(;i<e.length;i++){let c=e[i];if(l){if(c==="\\"){i++;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[i+1],v=e[i-1];if(y!=="="&&y!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")break}}if(e[i]!=="=")return null}while(i<e.length&&n(e[i]))i++;if(e[i]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(i+1).trim()}}function Do(e,t,i,n){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===t)n++;else if(c===i)n--}return n}function No(e,t){let i=e[t].trim(),n=sg(i),a=n?[i,n.type,n.name,n.value]:null;if(!a){let A=i.match(/^(?:export\s+)?(const|let|var)\s+/);if(A){let j=i.slice(A[0].length),X=t;if(j.startsWith("{")||j.startsWith("[")){let I=j[0],z=I==="{"?"}":"]",L=Do(j,I,z,0),B=j;for(let Q=t+1;Q<e.length&&L>0;Q++)B+=` ${e[Q].trim()}`,X=Q,L=Do(e[Q],I,z,L);if(L>0)B=j,X=t;j=B}let M=Wo(j,0);if(M){let I=A[1],z=M.pattern,L=j.slice(M.endPos).trim();if(L.startsWith("=")){let B=L.slice(1).trim(),Q=B,D=Math.max(X,t);if(Lo(B)){let le=zo(e,D,B);Q=le.value,D=le.nextIndex}else D=D+1;Q=Q.trim().replace(/;$/,"");let ee=Fo(z),ne=`__stx_src_${t}`,te=ee.map((le)=>`module.exports.${le} = ${le};`).join(`
|
|
703
|
+
`);return{type:I,name:ne,value:`${Q}; ${I} ${z} = ${ne};
|
|
704
|
+
${te}`,nextIndex:D}}}}throw Error(`Failed to parse variable declaration: ${i}`)}let[,l,c,y]=a,v=y,E=t;if(Lo(y)){let A=zo(e,t,y);v=A.value,E=A.nextIndex}else E=t+1;while(E<e.length){let A=e[E].trim();if(A.startsWith(".")||A.startsWith("?."))v+=`
|
|
705
|
+
${e[E]}`,E++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:c,value:v,nextIndex:E}}function ir(e,t){let i=e[t].trim(),n=i.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!n)throw Error(`Failed to parse function declaration: ${i}`);let[,a]=n,l=i.replace(/^export\s+/,""),c=t;if(fu(i)){let y=pu(e,t,l);l=y.functionCode,c=y.nextIndex}else c=t+1;return{name:a,functionCode:l,nextIndex:c}}function Lo(e){let t=e.trim();if(t.startsWith("{"))return x(t,"{","}",0)===-1;if(t.startsWith("["))return x(t,"[","]",0)===-1;return!Vo(t)}function Vo(e){let t={paren:0,bracket:0,brace:0},i=null,n=0;for(let a=0;a<e.length;a++){let l=e[a];if((a>0?e[a-1]:"")==="\\"&&i)continue;if((l==='"'||l==="'")&&!i){i=l;continue}if(l===i&&i!=="`"){i=null;continue}if(l==="`"&&!i){i="`";continue}if(l==="`"&&i==="`"&&n===0){i=null;continue}if(i==="`"&&l==="$"&&e[a+1]==="{"){n++,a++;continue}if(n>0&&l==="{"){n++;continue}if(n>0&&l==="}"){n--;continue}if(i)continue;if(l==="(")t.paren++;else if(l===")")t.paren--;else if(l==="[")t.bracket++;else if(l==="]")t.bracket--;else if(l==="{")t.brace++;else if(l==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&i===null}function Uo(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let i=x(e,"(",")",t);if(i===-1)return-1;return e.indexOf("{",i)}function fu(e){let t=Uo(e);if(t===-1)return!0;return x(e,"{","}",t)===-1}function zo(e,t,i){let n=i,a=t+1;while(a<e.length&&!Vo(n)){let l=e[a];n+=`
|
|
706
|
+
${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))n+=`
|
|
707
|
+
${e[a]}`,a++;else break}return{value:n,nextIndex:a}}function pu(e,t,i){let n=i,a=t+1;while(a<e.length){let l=Uo(n);if(l!==-1){if(x(n,"{","}",l)!==-1)break}let c=e[a];n+=`
|
|
708
|
+
${c}`,a++}return{functionCode:n,nextIndex:a}}function Bo(e,t){let i=u(e,t)??u(`(${e})`,t);if(i!==void 0)return i;if(!/\bprocess\b/.test(e))return;let n={...t,process:Object.freeze({env:{...Ct.env}})},a=Object.keys(n).filter(jt),l=a.map((c)=>n[c]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function du(e,t,i){let n=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of n){let[,,c,y]=l;try{let v=y.trim().replace(/;$/,""),E=Bo(v,t);if(E!==void 0)t[c]=E}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 t))try{let v=y.trim().replace(/;$/,""),E=Bo(v,t);if(E!==void 0)t[c]=E}catch{}}}function Wc(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),i=t?t[1]:"",n=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:i,templateWithoutScript:n}}function qc(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
|
|
709
|
+
export{Pe,ve,H,Ps,Is,V,yr,Os,Ns,oi,ii,Ms,ai,$c,Rt,Ie,o,dn,b,Rc,S,br,Ds,xe,C,Oe,de,wr,W,pn,Ne,w,Ac,pe,G,vr,xr,oe,At,J,O,rt,Sr,kr,Pt,ci,Ls,Yf,Me,Pc,Ic,Oc,li,Nc,js,ui,Mc,Dc,di,pi,fn,Bs,gn,It,Ot,Lc,Fs,jc,Bc,mn,_r,zs,Hs,Fc,fi,zc,Hc,Vc,Uc,hn,Zf,Qf,eg,tg,ng,m,rg,gi,sg,Wc,qc,mi,hi,og,Nt,Kc,ig,Xc,Xh,De,yn,Le,ag,cg,lg,ug,dg,Vs,pg,je,Y,Be,fg,Cr,gg,Gc,Jc,yi,Fe,s,bn,Yc,h,fe,Gh,Zc,Qc,el,bi,Us,mg,Jh,hg,Yh,Mt,p,U,Z,wn,Se,yg,wi,bg,Zh,_,wg,Qh,R,ey};
|