@stacksjs/stx 0.2.672 → 0.2.674
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-0jwdcqj8.js +2 -0
- package/dist/chunk-0mwdq478.js +2 -0
- package/dist/{chunk-npa7gze7.js → chunk-0nfqgv4n.js} +2 -2
- package/dist/chunk-1y6egkty.js +2 -0
- package/dist/{chunk-1sr6c0nk.js → chunk-25zmy8q6.js} +2 -2
- package/dist/chunk-2881tcqt.js +2 -0
- package/dist/chunk-2a775q7x.js +2 -0
- package/dist/chunk-2asdbd5e.js +2 -0
- package/dist/chunk-34yj93hh.js +2 -0
- package/dist/{chunk-30nes8ne.js → chunk-35ezh7de.js} +2 -2
- package/dist/{chunk-sjcqxfq1.js → chunk-40tswfe7.js} +8 -8
- package/dist/chunk-41de209e.js +2 -0
- package/dist/{chunk-6xe8rnfv.js → chunk-4b9s7wgy.js} +2 -2
- package/dist/{chunk-ttbn287w.js → chunk-4bgjrrvz.js} +1 -1
- package/dist/{chunk-365vg0eg.js → chunk-4s8zacxg.js} +4 -4
- package/dist/chunk-4w6baw62.js +3 -0
- package/dist/{chunk-fbtv2k1p.js → chunk-506mv7hb.js} +2 -2
- package/dist/{chunk-fzqj1mjz.js → chunk-5qtthtg3.js} +7 -7
- package/dist/chunk-5s1ay9mv.js +2 -0
- package/dist/{chunk-kenbxxbn.js → chunk-5vt48yce.js} +6 -6
- package/dist/{chunk-qv6axke4.js → chunk-5zhp87wv.js} +2 -2
- package/dist/{chunk-hvf2e7pr.js → chunk-6s7tvmqp.js} +1 -1
- package/dist/{chunk-ecqrkyg8.js → chunk-6sjtyd0k.js} +4 -4
- package/dist/{chunk-a3d0g4mr.js → chunk-7adznted.js} +2 -2
- package/dist/chunk-7j1zgrnf.js +42 -0
- package/dist/chunk-7kznee1g.js +2 -0
- package/dist/{chunk-qjtpxsyx.js → chunk-7mvz972c.js} +3 -3
- package/dist/chunk-80zgyaqe.js +2 -0
- package/dist/chunk-84tqb1rn.js +2 -0
- package/dist/chunk-8azm7nha.js +2 -0
- package/dist/chunk-902qnyg0.js +2 -0
- package/dist/{chunk-3y41efsf.js → chunk-9dtbvjpp.js} +8 -8
- package/dist/chunk-9n6jwcpb.js +2 -0
- package/dist/{chunk-yfvm7q6t.js → chunk-a4p18ybc.js} +3 -3
- package/dist/chunk-a6y8td0d.js +2 -0
- package/dist/chunk-a7kt1ts4.js +2 -0
- package/dist/chunk-a81y8g40.js +2 -0
- package/dist/{chunk-mjm3tyfj.js → chunk-aet1pgw7.js} +36 -36
- package/dist/chunk-aft1zc84.js +2 -0
- package/dist/{chunk-04kg16qs.js → chunk-am2w363p.js} +4 -4
- package/dist/{chunk-ym41ybz2.js → chunk-asezs2n3.js} +6 -6
- package/dist/{chunk-7kk2m44a.js → chunk-bawq4fqy.js} +4 -4
- package/dist/chunk-bdp2r0v4.js +2 -0
- package/dist/{chunk-1mj9crcg.js → chunk-bkkpq8dx.js} +9 -9
- package/dist/chunk-brtvm8mb.js +2 -0
- package/dist/{chunk-2dp7hyv7.js → chunk-bsajk82t.js} +14 -14
- package/dist/chunk-bvzr9zqt.js +2 -0
- package/dist/{chunk-t9yqq483.js → chunk-cbjabv1w.js} +4 -4
- package/dist/chunk-cbvgtf3m.js +2 -0
- package/dist/chunk-cfydbaeq.js +2 -0
- package/dist/{chunk-t2pzy3x1.js → chunk-ck2e3e47.js} +3 -3
- package/dist/{chunk-wpmrz872.js → chunk-d09q93yf.js} +2 -2
- package/dist/{chunk-a91atghh.js → chunk-d1a86qx8.js} +1 -1
- package/dist/{chunk-xqp4hstk.js → chunk-dgc1a3yt.js} +6 -6
- package/dist/chunk-dq8c3h4n.js +2 -0
- package/dist/chunk-e36pne7n.js +2 -0
- package/dist/chunk-e62qfexp.js +2 -0
- package/dist/chunk-eq5jzaj5.js +2 -0
- package/dist/{chunk-kwek8xdt.js → chunk-f9zyf9n6.js} +65 -65
- package/dist/{chunk-dgb4z4kw.js → chunk-faakv1p6.js} +2 -2
- package/dist/{chunk-yqz01qvy.js → chunk-fb7t1nn9.js} +3 -3
- package/dist/{chunk-06b8btkv.js → chunk-fbmth6xv.js} +10 -10
- package/dist/{chunk-7met6yva.js → chunk-fd49fahd.js} +5 -5
- package/dist/chunk-fr39emcz.js +2 -0
- package/dist/chunk-fsq13amm.js +2 -0
- package/dist/chunk-fw413k9q.js +3 -0
- package/dist/chunk-fxh12vqd.js +2 -0
- package/dist/chunk-gcc9fa33.js +2 -0
- package/dist/chunk-h6t2ney6.js +2 -0
- package/dist/{chunk-kgfgb971.js → chunk-ham5x7ts.js} +4 -4
- package/dist/{chunk-n38yb274.js → chunk-hb3edeq9.js} +6 -6
- package/dist/{chunk-fvtwec1r.js → chunk-hegfgw27.js} +1 -1
- package/dist/{chunk-p472crv1.js → chunk-hgry3mjd.js} +1 -1
- package/dist/{chunk-t961jbzc.js → chunk-hsmcbh0p.js} +7 -7
- package/dist/{chunk-wz2zb53w.js → chunk-hz4x7h0n.js} +5 -5
- package/dist/{chunk-jxda11cg.js → chunk-j6m8xqh3.js} +2 -2
- package/dist/chunk-j8g5cvvm.js +2 -0
- package/dist/chunk-jzjpyyw2.js +2 -0
- package/dist/chunk-k1b8x73j.js +2 -0
- package/dist/{chunk-8k3rwv8r.js → chunk-kdebh22m.js} +7 -7
- package/dist/{chunk-pvb48ehs.js → chunk-mwnhdsbp.js} +2 -2
- package/dist/{chunk-s20h5gmr.js → chunk-nj343mw2.js} +5 -5
- package/dist/chunk-nw9bdk2n.js +2 -0
- package/dist/chunk-p4jkswz8.js +2 -0
- package/dist/chunk-p4r90vqf.js +2 -0
- package/dist/{chunk-bnn7pd62.js → chunk-p6qd7ad0.js} +2 -2
- package/dist/chunk-p8bgy5tt.js +2 -0
- package/dist/{chunk-aprhqxky.js → chunk-pb6erpj3.js} +5 -5
- package/dist/{chunk-r3e6x87d.js → chunk-pg2v1pb5.js} +3 -3
- package/dist/{chunk-dw81nc5v.js → chunk-pqqe2b6m.js} +4 -4
- package/dist/chunk-q6nwcav4.js +2 -0
- package/dist/chunk-qmqavdz2.js +2 -0
- package/dist/chunk-qpw72bty.js +2 -0
- package/dist/chunk-qwnh1kj6.js +2 -0
- package/dist/chunk-qy9m6qdn.js +2 -0
- package/dist/chunk-qychcdsm.js +2 -0
- package/dist/{chunk-7d4z944r.js → chunk-qz5b8ed4.js} +7 -7
- package/dist/{chunk-6ajahb2x.js → chunk-r7fdw2v5.js} +3 -3
- package/dist/{chunk-mmwedr93.js → chunk-rdr09efy.js} +5 -5
- package/dist/chunk-rj3w1ama.js +2 -0
- package/dist/{chunk-prf164ct.js → chunk-rr527jt6.js} +2 -2
- package/dist/{chunk-x68etmdg.js → chunk-rv39s5az.js} +4 -4
- package/dist/{chunk-a5zqqgx2.js → chunk-rym0309c.js} +3 -3
- package/dist/{chunk-sqayfat9.js → chunk-s0vtjyyj.js} +1 -1
- package/dist/{chunk-vqc4h16r.js → chunk-s2wptfm1.js} +2 -2
- package/dist/chunk-sf0r963g.js +2 -0
- package/dist/{chunk-a3yte051.js → chunk-sqn3y9qt.js} +2 -2
- package/dist/{chunk-9gfffs28.js → chunk-srq9fqq8.js} +10 -10
- package/dist/chunk-ss820yys.js +2 -0
- package/dist/{chunk-pn1ehs6a.js → chunk-szevd7d5.js} +2 -2
- package/dist/{chunk-wbzmr6a4.js → chunk-t0k16vqv.js} +2 -2
- package/dist/chunk-t4j9g2vh.js +2 -0
- package/dist/chunk-t79jfpv6.js +3 -0
- package/dist/{chunk-rcadtv3x.js → chunk-t9kxhe46.js} +1 -1
- package/dist/{chunk-zqtbtqbq.js → chunk-tddnb5bv.js} +2 -2
- package/dist/{chunk-hvzzhkhr.js → chunk-thceyzj6.js} +2 -2
- package/dist/{chunk-n3m7fkv1.js → chunk-trh7s6k3.js} +5 -5
- package/dist/{chunk-3349573p.js → chunk-trz8z4j4.js} +18 -18
- package/dist/chunk-ttemwrbx.js +2 -0
- package/dist/{chunk-wankp78x.js → chunk-twqzn21x.js} +7 -7
- package/dist/chunk-v14rq8b4.js +3 -0
- package/dist/{chunk-b4pcw34n.js → chunk-v21bhhjb.js} +1 -1
- package/dist/{chunk-ka8befem.js → chunk-v6peecfp.js} +2 -2
- package/dist/{chunk-g8r0km7g.js → chunk-vayhx642.js} +2 -2
- package/dist/{chunk-5pgk3w2c.js → chunk-vdxg7e1y.js} +2 -2
- package/dist/chunk-vq513cxx.js +2 -0
- package/dist/chunk-vvq8xe3n.js +2 -0
- package/dist/{chunk-tre98h62.js → chunk-w3d98907.js} +2 -2
- package/dist/{chunk-p3x21vp7.js → chunk-w7t2cfgy.js} +42 -42
- package/dist/chunk-w8t31bn9.js +2 -0
- package/dist/chunk-x1kz4d7j.js +2 -0
- package/dist/chunk-xcsyqwxf.js +25 -0
- package/dist/{chunk-9p6efb17.js → chunk-xghcsg3f.js} +1 -1
- package/dist/chunk-xn9jrjzh.js +2 -0
- package/dist/{chunk-nrvwejdw.js → chunk-y1pcdeg9.js} +5 -5
- package/dist/{chunk-qffbkvfn.js → chunk-yx3dpdwc.js} +3 -3
- package/dist/{chunk-f9hrpwsw.js → chunk-z22zy22p.js} +2 -2
- package/dist/chunk-z97bwx8m.js +2 -0
- package/dist/{chunk-120ze5ms.js → chunk-zmg1peyg.js} +3 -3
- package/dist/{chunk-pxdww4rb.js → chunk-zp79zkkd.js} +2 -2
- package/dist/cli.js +20 -20
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/loops.js +19 -3
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.d.ts +12 -0
- package/dist/signal-processing.js +1 -1
- package/dist/ssg.js +6 -6
- package/package.json +5 -5
- package/dist/chunk-028ee6q5.js +0 -2
- package/dist/chunk-02ymqwmj.js +0 -2
- package/dist/chunk-0dcrd58z.js +0 -2
- package/dist/chunk-0f33ssaq.js +0 -2
- package/dist/chunk-17yfcd5s.js +0 -2
- package/dist/chunk-1pnp91wx.js +0 -2
- package/dist/chunk-23b0khvh.js +0 -3
- package/dist/chunk-2f17h17f.js +0 -2
- package/dist/chunk-4c183zem.js +0 -2
- package/dist/chunk-4ve8vsw5.js +0 -2
- package/dist/chunk-4yt8tg4j.js +0 -2
- package/dist/chunk-52gp2xxk.js +0 -2
- package/dist/chunk-5w1c7x22.js +0 -2
- package/dist/chunk-5zgrvj4b.js +0 -2
- package/dist/chunk-67kj14at.js +0 -2
- package/dist/chunk-6vzktvyw.js +0 -2
- package/dist/chunk-7a3g26kk.js +0 -2
- package/dist/chunk-7d2fab0z.js +0 -2
- package/dist/chunk-7dtpszqq.js +0 -2
- package/dist/chunk-7spxdz5k.js +0 -2
- package/dist/chunk-864qtx7y.js +0 -2
- package/dist/chunk-89jbdtgw.js +0 -3
- package/dist/chunk-96mm4q2g.js +0 -2
- package/dist/chunk-9szxxgv5.js +0 -2
- package/dist/chunk-9yxgdy4z.js +0 -42
- package/dist/chunk-a95r5nmq.js +0 -25
- package/dist/chunk-am246nf3.js +0 -2
- package/dist/chunk-avnhsjq0.js +0 -2
- package/dist/chunk-aw3meb8t.js +0 -2
- package/dist/chunk-b4fd2dtk.js +0 -2
- package/dist/chunk-b823zxq6.js +0 -3
- package/dist/chunk-bdg0fydw.js +0 -2
- package/dist/chunk-d6en3vz7.js +0 -2
- package/dist/chunk-dnw3knxq.js +0 -2
- package/dist/chunk-dpvxe52r.js +0 -2
- package/dist/chunk-e1fetwbr.js +0 -2
- package/dist/chunk-e44z03s5.js +0 -2
- package/dist/chunk-e4vpr36s.js +0 -2
- package/dist/chunk-f8dkq3ta.js +0 -2
- package/dist/chunk-fcn71bq1.js +0 -2
- package/dist/chunk-g2jmwh7p.js +0 -2
- package/dist/chunk-j0v970k3.js +0 -2
- package/dist/chunk-jk41jwsc.js +0 -2
- package/dist/chunk-k2pa44rf.js +0 -2
- package/dist/chunk-qq1k3364.js +0 -2
- package/dist/chunk-qxmyaajq.js +0 -2
- package/dist/chunk-sc7hszsx.js +0 -2
- package/dist/chunk-sf0wsq74.js +0 -2
- package/dist/chunk-shpc1ttk.js +0 -2
- package/dist/chunk-sj6mhjdq.js +0 -2
- package/dist/chunk-sqhmkvwd.js +0 -2
- package/dist/chunk-sw6p5176.js +0 -2
- package/dist/chunk-tb6vacgp.js +0 -2
- package/dist/chunk-we8ptx6w.js +0 -2
- package/dist/chunk-weqc0ssb.js +0 -2
- package/dist/chunk-wq712sw1.js +0 -2
- package/dist/chunk-wyq0c4wy.js +0 -2
- package/dist/chunk-wz6368p4.js +0 -2
- package/dist/chunk-yscr04dv.js +0 -2
- package/dist/chunk-z8j2sbnb.js +0 -2
- package/dist/chunk-z8p6tk5z.js +0 -2
- package/dist/chunk-zhf01af3.js +0 -3
- package/dist/chunk-zp9k5pha.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{je,mn,
|
|
2
|
+
import{je,mn,bs,Fo,A}from"./chunk-25zmy8q6.js";import{gn}from"./chunk-mwnhdsbp.js";import{vr,x,ac,st,Ko,cc}from"./chunk-zp79zkkd.js";import{T}from"./chunk-ce6zddpf.js";import{vs,l,p,Nt,u,H,D,w,ks,xe,Fe,_s}from"./chunk-bsajk82t.js";import{i,et}from"./chunk-7mvz972c.js";import{f}from"./chunk-b7e07ybq.js";import{V}from"./chunk-506mv7hb.js";import Je from"path";import Ct from"process";import{AsyncLocalStorage as io}from"async_hooks";var nr=new io;function ln(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function rr(e,s){return nr.run(ln(e),s)}async function fr(e,s){let t=nr.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let o=t.pending.get(e);if(o)return o;let a=Promise.resolve().then(s).then((h)=>{let c=JSON.stringify(h,(E,R)=>{if(R===void 0||typeof R==="function"||typeof R==="symbol"||typeof R==="bigint"||typeof R==="number"&&!Number.isFinite(R))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(R&&typeof R==="object"&&!Array.isArray(R)&&Object.getPrototypeOf(R)!==Object.prototype&&Object.getPrototypeOf(R)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return R}),v=JSON.parse(c);return t.values.set(e,v),v}).catch((h)=>{throw t.pending.delete(e),h});return t.pending.set(e,a),a}function lr(e){let s=e.__stx_server_data;if(!s?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(s.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function L(e,s=!1){let t=i(e),o=[],a=new Set,h=0,c=0,v=t.length,E=()=>{if(h!==0)return;let R=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(R){if(s&&R[1]==="const")return;let I=R[2];if(!a.has(I))o.push(I),a.add(I);return}let C=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){if(s&&t.slice(c).startsWith("const"))return;C[1].split(",").forEach((I)=>{let P=I.trim();if(!P)return;let Z=P.indexOf(":"),W=(Z>=0?P.slice(Z+1).trim():P).split(/[\s=]/)[0];if(W&&!a.has(W))o.push(W),a.add(W)});return}let O=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(s&&t.slice(c).startsWith("const"))return;O[1].split(",").forEach((I)=>{let P=I.trim().replace(/^\.\.\./,"");if(!P)return;let Z=P.split(/[\s=]/)[0];if(Z&&!a.has(Z))o.push(Z),a.add(Z)});return}if(s)return;let M=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!a.has(I))o.push(I),a.add(I);return}let N=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!a.has(I))o.push(I),a.add(I)}};while(c<v){if(t[c]==="{"){h++,c++;continue}if(t[c]==="}"){h--,c++;continue}if(h===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))E();c++}return o.join(", ")}function rs(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function oo(e,s=L(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(L(e,!0).split(",").map((o)=>o.trim()));return s.map((o)=>t.has(o)?`get ${o}() { return ${o} }, set ${o}(__stxValue_${o}) { ${o} = __stxValue_${o} }`:o).join(", ")}function ss(e,s){let t=`{ ${oo(e,s)} }`;return L(e).split(",").some((o)=>o.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import kn from"fs";import Ce from"path";function j(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var pr=new Map;function os(e,s=!0){let t=pr.get(e);if(s&&t)return t;let o=new Map,a=[Ce.join(e,"src"),Ce.join(e,"dist"),e];function h(c,v){if(v>6)return;let E;try{E=kn.readdirSync(c,{withFileTypes:!0})}catch{return}for(let R of E){let C=Ce.join(c,R.name);if(R.isDirectory()){if(R.name==="node_modules"||R.name.startsWith("."))continue;h(C,v+1)}else if(R.isFile()&&R.name.endsWith(".stx")){let O=R.name.slice(0,-4);if(!o.has(O))o.set(O,C);let M=O.toLowerCase();if(!o.has(M))o.set(M,C);let N=j(O);if(!o.has(N))o.set(N,C)}}}for(let c of a)if(h(c,0),o.size>0)break;if(s)pr.set(e,o);return o}function is(e,s){if(e.startsWith(".")||e.startsWith("/"))return null;let t=s;while(!0){let o=Ce.join(t,"node_modules",e);try{if(kn.statSync(o).isDirectory())return o}catch{}let a=Ce.dirname(t);if(a===t)return null;t=a}}function as(e,s,t={}){return[Ce.resolve(Ce.dirname(s),`${e}.stx`),Ce.resolve(Ce.dirname(s),e),Ce.resolve(t.componentsDir||"components",`${e}.stx`),Ce.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function dr(e){let s=e.endsWith(".stx")?e.slice(0,-4):e,t=s.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),o=j(s);return[s,t,o]}function ko(e,s){let[t,o,a]=dr(e);for(let h of[t,t.toLowerCase(),o,a]){let c=s?.__importedComponents?.get(h);if(c!==void 0)return c}}function*_o(e,s,t={},o){let a=dr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ce.resolve(Ce.dirname(s),`${a[0]}.stx`);return}let h=[...new Set(a.map((E)=>`${E}.stx`))],c=t.projectRoot||process.cwd(),v=[...o?.__originalFilePath?[Ce.join(Ce.dirname(o.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ce.join(Ce.dirname(s),"components"),Ce.resolve(c,"src/components"),Ce.resolve(c,"components"),...import.meta.dir?[Ce.resolve(import.meta.dir,"components")]:[]];for(let E of new Set(v)){for(let R of h)yield Ce.join(E,R);try{for(let R of kn.readdirSync(E,{withFileTypes:!0}))if(R.isDirectory())for(let C of h)yield Ce.join(E,R.name,C)}catch{}}}function gr(e,s,t={},o){let a=ko(e,o);if(a!==void 0)return a;for(let h of _o(e,s,t,o))try{if(kn.statSync(h,{throwIfNoEntry:!1})?.isFile())return h}catch{}return null}import Ks from"fs";import ce from"path";import mt from"path";import Kt from"fs";var ao=new Set(["touchstart","touchmove","wheel","mousewheel"]);function es(e,s){if(s.passive)return!0;if(s.prevent||s.nonpassive)return!1;return ao.has(e.toLowerCase())}var mr=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"]),hr={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"},co=new Set(["ctrl","alt","shift","meta"]),yr={left:0,middle:1,right:2};function xr(e){let s={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let o=t.toLowerCase();if(o==="prevent")s.prevent=!0;else if(o==="stop")s.stop=!0;else if(o==="once")s.once=!0;else if(o==="capture")s.capture=!0;else if(o==="self")s.self=!0;else if(o==="passive")s.passive=!0;else if(o==="nonpassive")s.nonpassive=!0;else if(co.has(o))s.systemKeys.push(o);else if(o in yr)s.mouse=o;else if(o in hr||/^[a-z]$/.test(o))s.keys.push(hr[o]||o.toUpperCase());else if(o.startsWith("debounce")){let a=o.match(/debounce(?:\.(\d+))?/);s.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(o.startsWith("throttle")){let a=o.match(/throttle(?:\.(\d+))?/);s.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return s}function _r(e,s=""){let t=[],o=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,h;while((h=a.exec(e))!==null){let[c,v,E]=h,R=h.index,C=R+c.length,O=`__stx_evt_${s}${o++}`,M=[],N=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=N.exec(E))!==null){let[,Z,U]=I,W=Z.split("."),Y=W[0];if(!mr.has(Y))continue;M.push({attribute:`@${Z}`,event:Y,handler:U,modifiers:xr(W.slice(1)),elementId:O})}let P=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=P.exec(E))!==null){let[,Z,U]=I,W=Z.split("."),Y=W[0];if(!mr.has(Y))continue;M.push({attribute:`@${Z}`,event:Y,handler:U,modifiers:xr(W.slice(1)),elementId:O})}if(M.length>0)t.push({originalTag:c,elementId:O,events:M,startIndex:R,endIndex:C})}return t}function lo(e){let s=[],{modifiers:t}=e;if(t.self)s.push("if ($event.target !== $el) return");for(let o of t.systemKeys)s.push(`if (!$event.${o}Key) return`);if(t.keys.length>0){let o=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");s.push(`if (!(${o})) return`)}if(t.mouse!==null){let o=yr[t.mouse];s.push(`if ($event.button !== ${o}) return`)}if(t.prevent)s.push("$event.preventDefault()");if(t.stop)s.push("$event.stopPropagation()");return s.join("; ")}function uo(e,s){let t=e;if(s.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${s.debounce})`;else if(s.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${s.throttle})`;return t}function ts(e){let s=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(s))return e;return`if (typeof ${s} === 'function' && !${s}._isSignal) ${s}($event);`}function fo(e){let{modifiers:s}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),o=lo(e),a=uo(ts(e.handler),s),h=[];if(s.once)h.push("once: true");if(s.capture)h.push("capture: true");if(es(e.event,s))h.push("passive: true");let c=h.length>0?`, { ${h.join(", ")} }`:"",v=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${t}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -53,7 +53,7 @@ else {
|
|
|
53
53
|
__stx_runHandler('${v}', $event, $el);
|
|
54
54
|
}
|
|
55
55
|
}${c});
|
|
56
|
-
})();`}function
|
|
56
|
+
})();`}function Co(e){if(e.length===0)return"";return`
|
|
57
57
|
<script data-stx-events>
|
|
58
58
|
(function() {
|
|
59
59
|
'use strict';
|
|
@@ -111,8 +111,8 @@ else {
|
|
|
111
111
|
${e.map(fo).join(`
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
|
-
</script>`}function po(e,s=""){let t=
|
|
115
|
-
`+a.slice(c);else a+=h;return a}function
|
|
114
|
+
</script>`}function po(e,s=""){let t=_r(e,s);if(t.length===0)return{template:e,bindings:[]};let o=e,a=[];for(let h=t.length-1;h>=0;h--){let c=t[h],v=c.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let E=v.match(/id=["']([^"']+)["']/);if(E)for(let R of c.events)R.elementId=E[1]}for(let E of c.events){let R=E.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),C=new RegExp(`\\s*${R}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${R}\\s*=\\s*'[^']*'`,"g");v=v.replace(C,""),v=v.replace(O,"")}o=o.slice(0,c.startIndex)+v+o.slice(c.endIndex),a.push(...c.events)}return{template:o,bindings:a}}function br(e){let s=e.$uid;return typeof s==="string"&&s?`${s}_`:""}function Ta(e,s,t){if(cc(e))return e;if(s.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:v,bindings:E}=po(e,br(s)),R=s.__stx_event_bindings||[];return s.__stx_event_bindings=[...R,...E],v}let o=_r(e,br(s));if(o.length===0)return e;let a=e;for(let v=o.length-1;v>=0;v--){let E=o[v],R=E.originalTag;if(!R.includes(" id="))R=R.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${E.elementId}"`);else{let C=R.match(/id=["']([^"']+)["']/);if(C)for(let O of E.events)O.elementId=C[1]}for(let C of E.events){let O=C.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),M=new RegExp(`\\s*${O}\\s*=\\s*"[^"]*"`,"g"),N=new RegExp(`\\s*${O}\\s*=\\s*'[^']*'`,"g");R=R.replace(M,""),R=R.replace(N,"")}a=a.slice(0,E.startIndex)+R+a.slice(E.endIndex)}let h=Co(o.flatMap((v)=>v.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+h+`
|
|
115
|
+
`+a.slice(c);else a+=h;return a}function wr(e,s){let t=new Set;for(let o of e.split(",")){let a=o.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(s){let h=a.lastIndexOf(":");if(h!==-1)a=a.slice(h+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Ht(e,s){let t=i(e),{depths:o,balanced:a}=et(t),h=(v)=>!a||o[v]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${s}\\b)`,"g");for(let v of t.matchAll(c)){let E=(v.index??0)+v[0].length-v[1].length;if(h(E))return!0}for(let v of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h(v.index??0)&&wr(v[1],!0).has(s))return!0;for(let v of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h(v.index??0)&&wr(v[1],!1).has(s))return!0;return!1}var Sr="",Rn,ut=/^[A-Za-z_$][\w$]*$/,go=new Set(["if","for","while","switch","with"]),$r=["(","[","{"],Er=[")","]","}"],mo=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function ho(e){let s=i(e),t=[];for(let o of s.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=o.index??0;t.push({text:o[0],start:a,end:a+o[0].length})}return{code:s,tokens:t}}function ns(e){if(Rn&&e===Sr)return Rn;let{code:s,tokens:t}=ho(e),o=new Map,a=[];for(let I=0;I<t.length;I++){let P=t[I].text;if(["(","[","{"].includes(P))a.push(I);else if([")","]","}"].includes(P)){let Z=a.at(-1);if(Z!==void 0&&["()","[]","{}"].includes(t[Z].text+P))a.pop(),o.set(Z,I),o.set(I,Z)}}function h(I,P){let Z=[],U=I;for(let W=I;W<P;W++){if(["(","[","{"].includes(t[W].text)&&(o.get(W)??P)<P){W=o.get(W);continue}if(t[W].text===",")Z.push([U,W]),U=W+1}return Z.push([U,P]),Z}let c=[];function v(I,P,Z,U=!1){if(t[I]?.text==="...")I++;if(I>=P)return;let W=t[I].text;if(ut.test(W)){if(Z.add(W),Z===C)c.push({name:W,token:I,functionScoped:U});return}if(W!=="{"&&W!=="[")return;let Y=o.get(I);if(Y===void 0||Y>=P)return;for(let[ee,te]of h(I+1,Y)){let oe=ee;if(W==="{")for(let ge=ee;ge<te;ge++){if(t[ge].text===":"){oe=ge+1;break}if(t[ge].text==="=")break;if(["(","[","{"].includes(t[ge].text)&&o.has(ge))ge=o.get(ge)}v(oe,te,Z,U)}}function E(I,P){let Z=new Set;for(let[U,W]of h(I,P))v(U,W,Z);return Z}function R(I){let P=I;for(;P<t.length;P++){let Z=t[P].text;if(["(","[","{"].includes(Z)&&o.has(P)){P=o.get(P);continue}if([",",";",")","]","}"].includes(Z))break}return t[Math.max(I,P-1)]?.end??s.length}let C=new Set,O=[];for(let I=0;I<t.length;I++)if(t[I].text==="=>"){let P=I-1,Z=P,U;if(t[P]?.text===")"&&o.has(P))Z=o.get(P),U=E(Z+1,P);else if(t[P]&&ut.test(t[P].text))U=new Set([t[P].text]);else continue;let W=I+1,Y=t[W]?.text==="{"&&o.has(W)?t[o.get(W)].end:R(W);O.push({start:t[Z].start,end:Y,bodyStart:t[W]?.start??Y,functionBody:!0,names:U})}else if(t[I].text==="("&&o.has(I)){let P=t[I-1]?.text;if(!P||go.has(P)||!ut.test(P)&&P!=="*"&&P!=="]")continue;let Z=o.get(I),U=Z+1;if(t[U]?.text===":"){U++;while(U<t.length&&!["{","=>",";","="].includes(t[U].text))U++}if(t[U]?.text!=="{"||!o.has(U))continue;O.push({start:t[I].start,end:t[o.get(U)].end,bodyStart:t[U].start,functionBody:P!=="catch",names:E(I+1,Z)})}function M(I){let P=I;for(;P<t.length;P++){let Z=t[P].text;if($r.includes(Z)&&o.has(P)){P=o.get(P);continue}if(Z===";"||Er.includes(Z))break;let U=t[P-1];if(P>I&&mo.has(Z)&&U.text!==".")break;if(P>I&&/[\n\r]/.test(s.slice(U.end,t[P].start))&&(/^[\w$]+$/.test(U.text)||Er.includes(U.text)||['"',"'","`"].includes(U.text))&&ut.test(Z)&&!["in","of","instanceof"].includes(Z))break}return P}let N=[];for(let I=0;I<t.length;I++){if(t[I].text!=="for")continue;let P=t[I+1]?.text==="await"?I+2:I+1;if(t[P]?.text!=="("||!o.has(P))continue;let Z=o.get(P),U=Z+1,W=t[U]?.text==="{"&&o.has(U)?o.get(U):M(U),Y=t[W]?.text===";"||t[W]?.text==="}"?t[W].end:t[Math.max(U,W-1)]?.end??s.length;N.push({headStart:P,headEnd:Z,start:t[P].start,end:Y})}for(let I=0;I<t.length;I++){let P=t[I].text,Z=t[I-1]?.text;if(Z==="."||t[I+1]?.text===":")continue;if(Z==="as"||Z==="<")continue;if(P==="const"||P==="let"||P==="var"){let U=M(I+1),W=I+1,Y=!1,ee=!1,te=0;for(let oe=I+1;oe<=U;oe++){let ge=t[oe]?.text;if(oe<U&&$r.includes(ge)&&o.has(oe)&&o.get(oe)<U){oe=o.get(oe);continue}if(oe<U&&ge===":"&&!ee)Y=!0;else if(oe<U&&ge==="="&&te===0)Y=!1,ee=!0;else if(oe<U&&Y&&ge==="<")te++;else if(oe<U&&Y&&ge===">"&&te>0)te--;else if(oe===U||ge===","&&te===0)v(W,oe,C,P==="var"),W=oe+1,Y=!1,ee=!1}}else if(P==="function"||P==="class"){let U=I+1;if(t[U]?.text==="*")U++;if(t[U]&&ut.test(t[U].text)&&t[U].text!=="extends")C.add(t[U].text),c.push({name:t[U].text,token:U})}else if(P==="import"){let U=I+1;if(t[U]?.text==="*"&&t[U+1]?.text==="as")U+=2;let W=t[U]?.text;if(W&&ut.test(W)&&W!=="type"&&t[U+1]?.text!=="("&&t[U+1]?.text!==".")C.add(W),c.push({name:W,token:U,file:!0});let Y=t[U]?.text==="{"?U:t[U+1]?.text===","&&t[U+2]?.text==="{"?U+2:-1;if(Y!==-1&&o.has(Y)){let ee=o.get(Y);for(let[te,oe]of h(Y+1,ee)){let ge=oe-1;while(ge>=te&&!ut.test(t[ge].text))ge--;if(ge>=te&&t[ge].text!=="type")c.push({name:t[ge].text,token:ge,file:!0})}}}}return Sr=e,Rn={code:s,scopes:O,loops:N,declarations:C,sites:c,tokens:t,pairs:o},Rn}function fs(e){let s=ns(e);return{code:s.code,shadows:(t,o)=>s.scopes.some((a)=>o>=a.start&&o<a.end&&a.names.has(t))}}function Cn(e){return new Set(ns(e).declarations)}function rn(e,s){let{scopes:t,loops:o,sites:a,tokens:h,pairs:c}=ns(e),v=Array.from({length:h.length},()=>-1),E=[];for(let N=0;N<h.length;N++){v[N]=E.length?E[E.length-1]:-1;let I=h[N].text;if(I==="{"&&c.has(N))E.push(N);else if(I==="}"&&E.length&&c.get(N)===E[E.length-1])E.pop()}let R=new Set,C=new Map;for(let N of a){if(!s.has(N.name))continue;R.add(N.token);let I=N.file?-1:v[N.token],P=I===-1?[0,Number.POSITIVE_INFINITY]:[h[I].start,h[c.get(I)].end];if(N.functionScoped){let U=h[N.token].start,W=t.filter((Y)=>Y.functionBody&&U>=Y.bodyStart&&U<Y.end).sort((Y,ee)=>Y.end-Y.bodyStart-(ee.end-ee.bodyStart))[0];P=W?[W.bodyStart,W.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let U=o.filter((W)=>N.token>W.headStart&&N.token<W.headEnd).sort((W,Y)=>W.headEnd-W.headStart-(Y.headEnd-Y.headStart))[0];if(U)P=[U.start,U.end]}let Z=C.get(N.name);if(Z)Z.push(P);else C.set(N.name,[P])}let O=new Set;for(let N=0;N<h.length;N++){if(h[N].text!=="import"||h[N-1]?.text===".")continue;let I=N+1;if(h[I]?.text==="type")I++;if(h[I]&&ut.test(h[I].text)&&h[I+1]?.text===",")I+=2;if(h[I]?.text==="{"&&c.has(I))for(let P=I+1;P<c.get(I);P++)O.add(P)}let M=new Set;for(let N=0;N<h.length;N++){let I=h[N].text;if(!s.has(I)||M.has(I)||R.has(N)||O.has(N))continue;let P=h[N-1]?.text;if(P==="#"||P==="."&&h[N-2]?.text!=="..")continue;if(h[N+1]?.text===":"&&(P==="{"||P===","))continue;let Z=h[N].start;if(C.get(I)?.some(([U,W])=>Z>=U&&Z<W))continue;if(t.some((U)=>Z>=U.start&&Z<U.end&&U.names.has(I)))continue;M.add(I)}return M}var Re="0.2.674";var kr=Symbol.for(`stx.lazy-module-promises.${Re}`);function bo(){let e=globalThis;return e[kr]??=new Map,e[kr]}function r(e,s){let t=bo(),o=`${import.meta.url}\x00${e}`,a=t.get(o);if(a)return a;let h=s();return t.set(o,h),h.catch(()=>{if(t.get(o)===h)t.delete(o)}),h}var yo=/<\/(script)/gi;function sn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(yo,"<\\/$1")}import Tr from"fs";class B{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,s){this.maxSize=e,this.options=s??null,this.sizes=s?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let s=this.cache.keys().next().value;if(s===void 0)break;this.delete(s)}}get(e){if(!this.cache.has(e))return;let s=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,s),s}set(e,s){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(s):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let o=this.cache.keys().next().value;if(o===void 0)break;this.delete(o)}if(this.cache.set(e,s),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let s=this.sizes.get(e);if(s!==void 0)this.bytes-=s,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,wo=500;function Et(e,s){if(s?.includes("g"))return new RegExp(e,s);let t=`${e}:${s||""}`;if(!St.has(t)){if(St.size>=wo){let o=St.keys().next().value;if(o)St.delete(o)}St.set(t,new RegExp(e,s))}return St.get(t)}class Rr{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let s=Array.from(new Set(e)),t=s.sort().join(","),o=this.pool.find((v)=>v.context.join(",")===t);if(o)return o.func;let a=this.fnCache,h=this.fnCacheMaxSize,c=(...v)=>(E)=>{try{let R=`${t}:${E}`,C=a.get(R);if(!C){if(a.size>=h){let O=a.keys().next().value;if(O)a.delete(O)}C=Function(...s,`
|
|
116
116
|
'use strict';
|
|
117
117
|
try {
|
|
118
118
|
return ${E};
|
|
@@ -123,18 +123,18 @@ catch (e) {
|
|
|
123
123
|
}
|
|
124
124
|
throw e;
|
|
125
125
|
}
|
|
126
|
-
`),a.set(R,C)}return C(...v)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:c,context:s.slice()});return c}clear(){this.pool.length=0,this.fnCache.clear()}}var xu=new Rr;class Cr{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,s){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...s})}setBudgets(e){for(let[s,t]of Object.entries(e))this.setBudget(s,t)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[s,t]of this.budgets.entries())e[s]=t;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let s=this.violationHandlers.indexOf(e);if(s!==-1)this.violationHandlers.splice(s,1)}time(e,s){if(!this.enabled)return s();let t=performance.now(),o=s(),a=performance.now()-t;return this.recordTime(e,a),this.checkBudget(e,a),o}async timeAsync(e,s){if(!this.enabled)return s();let t=performance.now(),o=await s(),a=performance.now()-t;return this.recordTime(e,a),this.checkBudget(e,a),o}checkBudget(e,s){let t=this.budgets.get(e);if(!t)return;let o=s/t.maxTime*100,a=t.warnThreshold!==void 0?s>=t.maxTime*t.warnThreshold&&s<t.maxTime:!1,h=s>=t.maxTime;if(!a&&!h)return;let c={label:e,actualTime:s,budgetTime:t.maxTime,exceedancePercent:o,timestamp:new Date,isWarning:a};this.violations.push(c);while(this.violations.length>this.maxViolations)this.violations.shift();for(let E of this.violationHandlers)try{E(c)}catch{}let v=a?`[Performance Warning] "${e}" took ${s.toFixed(2)}ms (${o.toFixed(1)}% of ${t.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${s.toFixed(2)}ms (exceeded ${t.maxTime}ms budget by ${(o-100).toFixed(1)}%)`;switch(t.action){case"log":console.log(v);break;case"warn":console.warn(v);break;case"error":console.error(v);break;case"throw":if(h)throw Error(v);else console.warn(v);break}}recordTime(e,s){let t=this.metrics.get(e);if(t)t.count++,t.totalTime+=s,t.maxTime=Math.max(t.maxTime,s),t.minTime=Math.min(t.minTime,s);else this.metrics.set(e,{count:1,totalTime:s,maxTime:s,minTime:s})}getStats(e){if(e){let t=this.metrics.get(e);if(!t)return{};let o=this.budgets.get(e);return{count:t.count,avgTime:t.totalTime/t.count,totalTime:t.totalTime,maxTime:t.maxTime,minTime:t.minTime,budget:o?.maxTime,budgetUtilization:o?t.totalTime/t.count/o.maxTime*100:void 0}}let s={};for(let[t,o]of this.metrics.entries()){let a=this.budgets.get(t);s[t]={count:o.count,avgTime:o.totalTime/o.count,totalTime:o.totalTime,maxTime:o.maxTime,minTime:o.minTime,budget:a?.maxTime,budgetUtilization:a?o.totalTime/o.count/a.maxTime*100:void 0}}return s}getViolations(e){if(e)return this.violations.filter((s)=>s.label===e);return[...this.violations]}getViolationStats(){let e={},s=0,t=0;for(let o of this.violations)if(e[o.label]=(e[o.label]||0)+1,o.isWarning)s++;else t++;return{total:this.violations.length,byLabel:e,warnings:s,errors:t}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var
|
|
126
|
+
`),a.set(R,C)}return C(...v)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:c,context:s.slice()});return c}clear(){this.pool.length=0,this.fnCache.clear()}}var xu=new Rr;class Cr{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,s){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...s})}setBudgets(e){for(let[s,t]of Object.entries(e))this.setBudget(s,t)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[s,t]of this.budgets.entries())e[s]=t;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let s=this.violationHandlers.indexOf(e);if(s!==-1)this.violationHandlers.splice(s,1)}time(e,s){if(!this.enabled)return s();let t=performance.now(),o=s(),a=performance.now()-t;return this.recordTime(e,a),this.checkBudget(e,a),o}async timeAsync(e,s){if(!this.enabled)return s();let t=performance.now(),o=await s(),a=performance.now()-t;return this.recordTime(e,a),this.checkBudget(e,a),o}checkBudget(e,s){let t=this.budgets.get(e);if(!t)return;let o=s/t.maxTime*100,a=t.warnThreshold!==void 0?s>=t.maxTime*t.warnThreshold&&s<t.maxTime:!1,h=s>=t.maxTime;if(!a&&!h)return;let c={label:e,actualTime:s,budgetTime:t.maxTime,exceedancePercent:o,timestamp:new Date,isWarning:a};this.violations.push(c);while(this.violations.length>this.maxViolations)this.violations.shift();for(let E of this.violationHandlers)try{E(c)}catch{}let v=a?`[Performance Warning] "${e}" took ${s.toFixed(2)}ms (${o.toFixed(1)}% of ${t.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${s.toFixed(2)}ms (exceeded ${t.maxTime}ms budget by ${(o-100).toFixed(1)}%)`;switch(t.action){case"log":console.log(v);break;case"warn":console.warn(v);break;case"error":console.error(v);break;case"throw":if(h)throw Error(v);else console.warn(v);break}}recordTime(e,s){let t=this.metrics.get(e);if(t)t.count++,t.totalTime+=s,t.maxTime=Math.max(t.maxTime,s),t.minTime=Math.min(t.minTime,s);else this.metrics.set(e,{count:1,totalTime:s,maxTime:s,minTime:s})}getStats(e){if(e){let t=this.metrics.get(e);if(!t)return{};let o=this.budgets.get(e);return{count:t.count,avgTime:t.totalTime/t.count,totalTime:t.totalTime,maxTime:t.maxTime,minTime:t.minTime,budget:o?.maxTime,budgetUtilization:o?t.totalTime/t.count/o.maxTime*100:void 0}}let s={};for(let[t,o]of this.metrics.entries()){let a=this.budgets.get(t);s[t]={count:o.count,avgTime:o.totalTime/o.count,totalTime:o.totalTime,maxTime:o.maxTime,minTime:o.minTime,budget:a?.maxTime,budgetUtilization:a?o.totalTime/o.count/a.maxTime*100:void 0}}return s}getViolations(e){if(e)return this.violations.filter((s)=>s.label===e);return[...this.violations]}getViolationStats(){let e={},s=0,t=0;for(let o of this.violations)if(e[o.label]=(e[o.label]||0)+1,o.isWarning)s++;else t++;return{total:this.violations.length,byLabel:e,warnings:s,errors:t}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var xs=null;function So(){if(!xs)xs=new Cr;return xs}var re=new Proxy({},{get(e,s){return So()[s]}});var Ar=[];function y(e){let s=new B(e);return Ar.push(s),s}function $a(){for(let e of Ar)e.clear()}function b(e,...s){return`${s.map((t)=>String(t??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function sr(e){let s=[];for(let t of new Set(e))try{s.push({path:t,mtimeMs:Tr.statSync(t).mtimeMs})}catch{}return s}function cs(e){for(let s of e)try{if(Tr.statSync(s.path).mtimeMs!==s.mtimeMs)return!1}catch{return!1}return!0}var be=["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 vo=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Bo(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let t=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}let s=e.match(/^([^/]+)(\/.*)?$/);if(!s)return null;return{pkg:s[1],subpath:s[2]||""}}function zo(e,s){let t=s;while(!0){let o=mt.join(t,"node_modules",e,"package.json");if(Kt.existsSync(o))return mt.dirname(o);let a=mt.dirname(t);if(a===t)return null;t=a}}function Wo(e,s){if(!e||typeof e!=="object")return null;let t=(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 t(a.import);if(typeof a.default==="object")return t(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,s))return t(e[s]);let o=null;for(let a of Object.keys(e)){let h=a.indexOf("*");if(h===-1)continue;let c=a.slice(0,h),v=a.slice(h+1);if(!s.startsWith(c)||!s.endsWith(v))continue;if(s.length<c.length+v.length)continue;if(!o||c.length>o.prefix.length)o={pattern:a,prefix:c,suffix:v}}if(o){let a=s.slice(o.prefix.length,s.length-o.suffix.length),h=t(e[o.pattern]);if(h)return h.replace("*",a)}return null}function Vo(e,s){let t=Bo(e);if(!t||!t.subpath)return null;let o=zo(t.pkg,s);if(!o)return null;let a;try{a=JSON.parse(Kt.readFileSync(mt.join(o,"package.json"),"utf8"))}catch{return null}let h=`.${t.subpath}`,c=Wo(a.exports,h);if(!c)return null;let v=mt.resolve(o,c);return Kt.existsSync(v)?v:null}function Oo(e,s){let t=s.filePath?mt.dirname(s.filePath):s.projectRoot||process.cwd(),o=s.projectRoot||process.cwd(),a=new Set,h=[],c=[];return{code:e.replace(vo,(E,R)=>{let C;try{if(R.startsWith("./")||R.startsWith("../")||R.startsWith("/")){if(C=R.startsWith("/")?R:mt.resolve(t,R),!Kt.existsSync(C))throw Error(`file not found: ${C}`)}else{let O=null;try{O=Bun.resolveSync(R,o)}catch{O=Vo(R,o)}if(!O)throw Error(`could not resolve ${R} (Bun.resolveSync + exports fallback both failed)`);C=O}}catch(O){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(R)} (from ${s.filePath||"<unknown>"}): ${O?.message||O}`),c.push(R),""}if(a.has(C))return"";a.add(C);try{let O=Kt.readFileSync(C,"utf8");h.push({source:R,resolvedPath:C,contents:O})}catch(O){console.warn(`[stx:vendor-css] could not read ${C}: ${O?.message||O}`),c.push(R)}return""}),styles:h,unresolved:c}}function Uo(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function No(e){if(e.length===0)return"";return`${e.map((s)=>`<style data-stx-vendor="${Uo(s.source)}" data-stx-layer="vendor">
|
|
127
127
|
@layer vendor {
|
|
128
128
|
${s.contents}
|
|
129
129
|
}
|
|
130
130
|
</style>`).join(`
|
|
131
131
|
`)}
|
|
132
|
-
`}var
|
|
132
|
+
`}var Xl=x,Ir=y(256);function Pt(e){let s=b(e),t=Ir.get(s);if(!t)t=Ho(e),Ir.set(s,t);return{code:t.code,imports:[...t.imports],models:[...t.models]}}function Ho(e){let s=i(e),t=new Set;for(let v of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let E of v[1].split(",")){let R=E.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(R)t.add(R)}let o=Cn(s),a=be.filter((v)=>{if(t.has(v)||o.has(v))return!1;return Do(s,v,!0)}),h=Dr(s).filter((v)=>!t.has(v)&&!o.has(v));if(a.length===0&&h.length===0)return{code:e,imports:a,models:h};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",h.length>0?"import '@stacksjs/browser'":"",h.length>0?`const { ${h.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
133
133
|
`)}
|
|
134
|
-
${e}`,imports:a,models:h}}var
|
|
134
|
+
${e}`,imports:a,models:h}}var Zo=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 Dr(e){let s=new Set,t=fs(e),o=Cn(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 h of t.code.matchAll(a)){let c=h[1];if(Zo.has(c)||o.has(c)||c.length<3)continue;if(t.shadows(c,h.index??0))continue;s.add(c)}return Array.from(s)}function qo(e){return Cn(e)}var Or=y(128);function qa(e){let s=b(e),t=Or.get(s);if(!t)t=Xo(e),Or.set(s,t);return{code:t.code,stxImports:[...t.stxImports],browserImports:[...t.browserImports]}}function Xo(e){let s=new Set,t=new Set,o=e;o=o.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,h=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,c;while((c=h.exec(e))!==null){let O=c[1],M=c[2];if(c[0].includes("import type"))continue;let N=[];for(let P of O.split(",")){let Z=P.trim();if(!Z||Z.startsWith("type "))continue;let U=Z.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!U)continue;let W=U[1],Y=U[2]||W;if(a.add(W),a.add(Y),M==="stx"||M==="@stacksjs/stx")s.add(W);else t.add(W);if(Y!==W)N.push(`${Y} = ${W}`)}let I=N.length>0?`var ${N.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";o=o.replace(c[0],I)}let v=qo(o);for(let O of Xl){if(a.has(O)||v.has(O))continue;if(Do(o,O,!0))s.add(O)}let E=i(o),R=new Set;for(let O of o.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let M of O[1].split(",")){let N=M.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let I of N){let P=I.trim();if(P)R.add(P)}}for(let O of be){if(a.has(O)||v.has(O)||R.has(O))continue;if(Do(E,O))t.add(O)}let C=Dr(E);for(let O of C)if(!a.has(O)&&!v.has(O))t.add(O);return{code:o,stxImports:Array.from(s),browserImports:Array.from(t)}}function Do(e,s,t=!1){let o=fs(e);e=o.code;let a=new RegExp(`\\b${s.replace(/[$]/g,"\\$")}\\b`,"g");for(let h of e.matchAll(a)){let c=h.index??0;if(o.shadows(s,c))continue;let v=c+s.length,E=c-1;while(E>=0&&/\s/.test(e[E]))E--;if(e[E]==="."&&e.slice(Math.max(0,E-2),E+1)!=="...")continue;let R=v;while(R<e.length&&/\s/.test(e[R]))R++;if(e[R]===":"&&e[R+1]!==":"&&(e[E]==="{"||e[E]===","))continue;if(t&&!/^\s*(?:<[^>]*>)?\s*\(/.test(e.slice(v)))continue;if(Jo(e,v))continue;return!0}return!1}function Jo(e,s){let t=s;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;if(e[t]!=="(")return!1;let o=0;for(;t<e.length;t++){let a=e[t];if(a==="(")o++;else if(a===")"){if(o--,o===0)break}}if(o!==0)return!1;t++;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;return e[t]==="{"}function Ga(e,s){let t=[];if(e.length>0)t.push(` var { ${e.join(", ")} } = window.stx || window;`);if(s.length>0)t.push(` var { ${s.join(", ")} } = window.StacksBrowser || {};`);if(t.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
135
135
|
${t.join(`
|
|
136
136
|
`)}
|
|
137
|
-
${
|
|
137
|
+
${Go(e,s)}`;return""}function Rp(e,s=[]){let{browserImports:t}=qa(e),o=new Set(s);return Ga([],t.filter((a)=>!o.has(a)))}function Go(e,s){let t=[...e.map((o)=>`['${o}', typeof ${o}, 'stx']`),...s.map((o)=>`['${o}', typeof ${o}, '@stacksjs/browser']`)];if(t.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
138
138
|
[${t.join(", ")}].forEach(function (e) {
|
|
139
139
|
if (e[1] !== 'undefined') return;
|
|
140
140
|
console.error(
|
|
@@ -193,21 +193,21 @@ else {
|
|
|
193
193
|
// STX: auto-generated event bindings
|
|
194
194
|
${e.map((t,o)=>na(t,o)).join(`
|
|
195
195
|
`)}`}function Mr(e){let s=[],t=new Set,o=e.replace(/^\s*import\s+.*$/gm,""),a=0,h=o.length,c=0;while(c<h){let v=o[c];if(v==="'"||v==='"'||v==="`"){let E=v;if(c++,E==="`"){let R=0;while(c<h){if(o[c]==="\\"){c+=2;continue}if(o[c]==="`"&&R===0){c++;break}if(o[c]==="$"&&o[c+1]==="{"){R++,c+=2;continue}if(o[c]==="}"&&R>0){R--,c++;continue}c++}}else while(c<h){if(o[c]==="\\"){c+=2;continue}if(o[c]===E){c++;break}c++}continue}if(v==="/"&&o[c+1]==="/"){while(c<h&&o[c]!==`
|
|
196
|
-
`)c++;continue}if(v==="/"&&o[c+1]==="*"){c+=2;while(c<h-1&&!(o[c]==="*"&&o[c+1]==="/"))c++;c+=2;continue}if(v==="{"){a++,c++;continue}if(v==="}"){a--,c++;continue}if(a===0){let E=o.slice(c),R=E.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let M=R[1];if(!M.startsWith("_")&&!t.has(M))s.push(M),t.add(M);c+=R[0].length;continue}let C=E.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){C[1].split(",").forEach((M)=>{let N=M.trim(),I=N.indexOf(":"),P=I>=0?N.slice(I+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(P&&!P.startsWith("_")&&!t.has(P))s.push(P),t.add(P)}),c+=C[0].length;continue}let O=E.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let M=O[1];if(!M.startsWith("_")&&!t.has(M))s.push(M),t.add(M);c+=O[0].length;continue}}c++}return s}var ra=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 ia(e){let s=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function o(M){let N;while((N=t.exec(M))!==null){let I=N[0];if(!ra.has(I))s.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,h;while((h=a.exec(e))!==null)o(h[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((h=c.exec(e))!==null)o(h[1]);let v=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((h=v.exec(e))!==null)o(h[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((h=E.exec(e))!==null)o(h[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((h=R.exec(e))!==null)o(h[1]);let C=/@model\s*=\s*["']([^"']*)["']/gi;while((h=C.exec(e))!==null)o(h[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((h=O.exec(e))!==null)o(h[1]);return s}async function Ne(e,s={}){let t=e,o="",a=!1,h=[],c=
|
|
196
|
+
`)c++;continue}if(v==="/"&&o[c+1]==="*"){c+=2;while(c<h-1&&!(o[c]==="*"&&o[c+1]==="/"))c++;c+=2;continue}if(v==="{"){a++,c++;continue}if(v==="}"){a--,c++;continue}if(a===0){let E=o.slice(c),R=E.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let M=R[1];if(!M.startsWith("_")&&!t.has(M))s.push(M),t.add(M);c+=R[0].length;continue}let C=E.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){C[1].split(",").forEach((M)=>{let N=M.trim(),I=N.indexOf(":"),P=I>=0?N.slice(I+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(P&&!P.startsWith("_")&&!t.has(P))s.push(P),t.add(P)}),c+=C[0].length;continue}let O=E.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let M=O[1];if(!M.startsWith("_")&&!t.has(M))s.push(M),t.add(M);c+=O[0].length;continue}}c++}return s}var ra=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 ia(e){let s=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function o(M){let N;while((N=t.exec(M))!==null){let I=N[0];if(!ra.has(I))s.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,h;while((h=a.exec(e))!==null)o(h[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((h=c.exec(e))!==null)o(h[1]);let v=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((h=v.exec(e))!==null)o(h[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((h=E.exec(e))!==null)o(h[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((h=R.exec(e))!==null)o(h[1]);let C=/@model\s*=\s*["']([^"']*)["']/gi;while((h=C.exec(e))!==null)o(h[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((h=O.exec(e))!==null)o(h[1]);return s}async function Ne(e,s={}){let t=e,o="",a=!1,h=[],c=Oo(t,{filePath:s.filePath,projectRoot:s.projectRoot});t=c.code;let v=No(c.styles),E=Pt(t);t=E.code,h=[...E.imports,...E.models];let{hasUserImports:R,bundleClientScript:C}=await r("stx/client-script-bundler",()=>import("./chunk-2a775q7x.js"));if(R(t))t=await C(t,s.filePath||"",{projectRoot:s.projectRoot,minify:s.production}),a=!0;if(s.autoImports!==!1){let Y=qa(t);t=Y.code,o=Ga(Y.stxImports,Y.browserImports.filter((ee)=>!h.includes(ee)))}if(o=`${dn(t,s.serverData)}${o}`,t=T(t),!a&&De(s.attrs||""))t=Me(t);let O=sa(s.eventBindings||[]),M=(s.attrs||"").trim(),N=/\btype\s*=\s*["']module["']/i.test(M),I=s.instanceId?` data-stx-instance="${s.instanceId}"`:"";if(N){let Y=M.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${I}${Y?` ${Y}`:""}`;return`${v}<script ${ee}>
|
|
197
197
|
${sn(`${o}${t}
|
|
198
198
|
${O}`)}
|
|
199
|
-
</script>`}let P=
|
|
200
|
-
return ${
|
|
199
|
+
</script>`}let P=Ko(e),Z=/function __stx_setup_/.test(t),U=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function W(Y){let ee=Y.length>0?`
|
|
200
|
+
return ${ss(t,Y)};`:"",te=JSON.stringify(`[stx] client block failed${s.filePath?` (${s.filePath})`:""}; this block will not hydrate`);return`${v}<script data-stx-scoped data-stx-run="always"${I}>
|
|
201
201
|
window.stx.mount(function() {
|
|
202
202
|
'use strict';
|
|
203
203
|
try {
|
|
204
204
|
${sn(`${o}${t}
|
|
205
|
-
${O}${
|
|
205
|
+
${O}${ee}`)}
|
|
206
206
|
} catch (error) {
|
|
207
|
-
console.error(${
|
|
207
|
+
console.error(${te}, error);
|
|
208
208
|
return {};
|
|
209
209
|
}
|
|
210
|
-
})</script>`}if(!U&&!Z){if(P)return
|
|
210
|
+
})</script>`}if(!U&&!Z){if(P)return W(Mr(e));if(s.templateContent){let Y=Mr(e);if(Y.length>0){let ee=ia(s.templateContent);if(Y.some((oe)=>ee.has(oe)))return W(Y)}}}return`${v}<script data-stx-scoped data-stx-run="always"${I}>
|
|
211
211
|
;(function() {
|
|
212
212
|
'use strict';
|
|
213
213
|
try {
|
|
@@ -216,7 +216,7 @@ ${O}`)}
|
|
|
216
216
|
} catch (error) {
|
|
217
217
|
console.error(${JSON.stringify(`[stx] client block failed${s.filePath?` (${s.filePath})`:""}; this block will not hydrate`)}, error);
|
|
218
218
|
}
|
|
219
|
-
})()</script>`}import{createHash as oa}from"crypto";var Tn="__stx_component_client_factories";function An(e){let s=e[Tn];return s instanceof Map?s:null}function
|
|
219
|
+
})()</script>`}import{createHash as oa}from"crypto";var Tn="__stx_component_client_factories";function An(e){let s=e[Tn];return s instanceof Map?s:null}function Ha(e){e[Tn]=new Map}function ws(e,s){let t=An(e);if(!t)return null;let o=oa("sha256").update(s).digest("hex").slice(0,16),a=t.get(o);if(a)a.instances++;else t.set(o,{body:s,instances:1});return o}function Va(e,s){let t=An(s);if(!t?.size)return e;let o=new Map;for(let[C,O]of t)if(O.instances===1)o.set(C,O.body);let a=[];if(o.size>0){let C=[...o.keys()].map((N)=>JSON.stringify(N).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),O=new RegExp(`window\\.__stxComponentFactories\\[(${C})\\]\\(("[^"]+")\\);`,"g"),M=O.exec(e);while(M!==null){let N=o.get(JSON.parse(M[1]));if(N!==void 0)a.push({start:M.index,end:M.index+M[0].length,replacement:`(${N})(${M[2]});`});M=O.exec(e)}}let h=[...t].filter(([,C])=>C.instances>1);if(h.length===0)return jr(e,a);let v=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
220
220
|
(function() {
|
|
221
221
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
222
222
|
${h.map(([C,O])=>` try { factories[${JSON.stringify(C)}] = factories[${JSON.stringify(C)}] || ${O.body}; }
|
|
@@ -224,14 +224,14 @@ ${h.map(([C,O])=>` try { factories[${JSON.stringify(C)}] = factories[${JSON.str
|
|
|
224
224
|
`)}
|
|
225
225
|
})();
|
|
226
226
|
</script>`,E=e.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),R=E<0?0:E;return a.push({start:R,end:R,replacement:`${v}
|
|
227
|
-
`}),jr(e,a)}function jr(e,s){if(s.length===0)return e;s.sort((h,c)=>h.start-c.start||h.end-c.end);let t=Array(s.length*2+1),o=0,a=0;for(let h of s)t[a++]=e.slice(o,h.start),t[a++]=h.replacement,o=h.end;return t[a]=e.slice(o),t.join("")}function Nr(e){let s=An(e),t=new Map;if(s)for(let[o,a]of s)t.set(o,a.instances);return t}function Lr(e,s){let t=An(e);if(!t)return[];let o=[];for(let[a,h]of t){let c=h.instances-(s.get(a)??0);if(c>0)o.push({body:h.body,count:c})}return o}function Br(e,s){for(let{body:t,count:o}of s)for(let a=0;a<o;a++)ws(e,t)}function he(e,s,t=2){let o=0,a=null;for(let h=s+t;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){o++;continue}if(c==="}"){if(o>0){o--;continue}let v=0;while(e[h+v]==="}")v++;if(v>=t)return h}}return-1}import Jr from"fs";var zr=0,$s=new Map;function Xa(){zr=0,$s.clear()}function In(e,s){let t=zr++,o=`<!--__STX_${e.toUpperCase()}_${t}__-->`;return $s.set(o,{type:e,expression:s}),o}function Ja(){let e={};for(let[s,t]of $s)e[s]={type:t.type,expression:t.expression};return e}function Ya(e,s){let t=e;for(let[o,a]of s)t=t.split(o).join(a);return t}function Mo(e){return e.includes("<!--__STX_")}var aa=/@(?=[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 ca(e){return Array.from({length:e},()=>"{").join("⁠")}function Wr(e){return e.replace(/\{{2,}/g,(s)=>ca(s.length)).replace(/\{(?=!)/g,"{⁠").replace(aa,"@")}function cs(e,s,t=!1){let{openTag:o,tail:a}=t?la(e,s):ua(e).at(s);return pa(a,o,t)}function la(e,s){let t="",o=0;for(let c=0;c<s;c++){if(!e.startsWith("{{",c))continue;let v=he(e,c);if(v<0||v+2>s)break;t+=e.slice(o,c)+"x",c=v+1,o=v+2}t+=e.slice(o,s);let a=-1,h=null;for(let c=0;c<t.length;c++){let v=t[c];if(h){if(v===h)h=null;continue}if(v==='"'||v==="'"){h=v;continue}if(v===">"){a=-1;continue}if(v==="<")a=c}return{openTag:a,tail:a>=0?t.slice(a+1):t}}var On=null;function ua(e){if(On&&On.source===e)return On.scanner;let s=fa(e);return On={source:e,scanner:s},s}function fa(e){let s=0,t=-1,o=null,a=-1,h=(v,E)=>{let R=e[v];if(E.quote){if(R===E.quote)E.quote=null;return}if(E.openTag>=0){if(R==='"'||R==="'"){E.quote=R;return}if(R===">"){E.openTag=-1;return}}if(R==="<")E.openTag=v},c=(v,E)=>{if(E.openTag>=0||!e.startsWith("<!--",v))return-1;let R=e.indexOf("-->",v+4);return R<0?e.length:R+3};return{at(v){if(v<s)s=0,t=-1,o=null,a=-1;let E={openTag:t,quote:o},R=!1;while(s<v){if(a<0&&e.startsWith("{{",s)){let P=he(e,s);if(P<0)a=s;else if(P+2<=v){s=P+2;continue}else break}let I=c(s,E);if(I>=0){if(I>v){R=!0;break}s=I;continue}h(s,E),s++}if(t=E.openTag,o=E.quote,R)return{openTag:-1,tail:""};let C=a>=0?a:s,O={openTag:t,quote:o};for(let I=s;I<v;I++){let P=c(I,O);if(P>=0){if(P>v)return{openTag:-1,tail:""};I=P-1;continue}h(I,O)}if(O.openTag<0)return{openTag:-1,tail:""};let M="",N=O.openTag+1;for(let I=N;I<Math.min(v,C);I++){if(!e.startsWith("{{",I))continue;let P=he(e,I);M+=e.slice(N,I)+"x",I=P+1,N=P+2}return M+=e.slice(N,v),{openTag:O.openTag,tail:M}}}}function pa(e,s,t){if(s<0&&!t)return null;if(s>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(s>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let o=0;if(s>=0)while(o<e.length&&!/\s/.test(e[o]))o++;while(o<e.length){while(/\s/.test(e[o]??"")&&o<e.length)o++;let a=o;while(o<e.length&&!/[\s=/>]/.test(e[o]))o++;let h=e.slice(a,o);if(!h)break;while(o<e.length&&/\s/.test(e[o]))o++;if(e[o]!=="=")continue;o++;while(o<e.length&&/\s/.test(e[o]))o++;let c=e[o];if(c==='"'||c==="'"){let v=++o,E=e.indexOf(c,o);if(E===-1)return{kind:"attribute",name:h,quote:c,valuePrefix:e.slice(v)};o=E+1}else{let v=o;while(o<e.length&&!/\s/.test(e[o]))o++;if(o===e.length)return{kind:"attribute",name:h,quote:null,valuePrefix:e.slice(v)}}}return{kind:"tag"}}class ne extends Error{attribute;near;constructor(e,s){super(`Unsafe interpolation in ${e}: ${s}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,s){if(this.near===void 0)this.near=e.slice(Math.max(0,s-160),s).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Fr="unsafe:";var da=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ga=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,ma=/^data:(?:text\/html|application\/xhtml\+xml)/,ha=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function xa(e){return e.replace(ha,"").toLowerCase()}function vs(e){let s=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(s))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(s))return"fetched";return null}function Pn(e,s="navigable"){let t=xa(e);if(da.test(t))return!0;return s==="navigable"?ga.test(t):ma.test(t)}function sr(e,s="navigable"){return Pn(e,s)?"unsafe:"+e:e}function ba(e){let s=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!s)return null;if(s[3].trim()!=="")return null;return vs(s[1])}function Vr(e,s,t=256){if(s<=t)return e.slice(0,s);let o=e.slice(s-t,s),a=o.search(/[\s"'`/]/);return a===-1?"":o.slice(a)}function Ur(e,s,t=s){let o=ba(e);return o&&Pn(s,o)?"unsafe:"+t:t}var Mn=/<script\b[^>]*>/iy,Ts=/<\/script\s*>/ig,Dn=/<style\b[^>]*>/iy,As=/<\/style\s*>/ig;function Hr(e,s,t,o){t.lastIndex=s;let a=t.exec(e);if(!a||a.index!==s)return-1;o.lastIndex=t.lastIndex;let h=o.exec(e);if(!h)return-1;return h.index+h[0].length}function W(e,s){return Hr(e,s,Mn,Ts)}function on(e,s){return Hr(e,s,Dn,As)}function Pe(e,s){if(!e.startsWith("<!--",s))return-1;let t=e.indexOf("-->",s+4);if(t===-1)return-1;return t+3}function Kr(e,s){if(e.startsWith("<!--",s)){let a=Pe(e,s);return a===-1?e.length:a}if(Mn.lastIndex=s,Mn.exec(e)?.index===s){Ts.lastIndex=Mn.lastIndex;let a=Ts.exec(e);return a?a.index+a[0].length:e.length}if(Dn.lastIndex=s,Dn.exec(e)?.index===s){As.lastIndex=Dn.lastIndex;let a=As.exec(e);return a?a.index+a[0].length:e.length}return-1}function ce(e,s){let t=[],o=0,a=e.length,h=!1,c=null;while(o<a){let v=e[o];if(h){if(c){if(v===c)c=null}else if(v==='"'||v==="'")c=v;else if(v===">")h=!1;o++;continue}if(v!=="<"){let O=e.indexOf("<",o+1);if(O===-1)break;o=O;continue}let E=s(e,o);if(E>o){t.push({start:o,end:E,token:e.slice(o,E)}),o=E;continue}let R=Kr(e,o);if(R>o){o=R;continue}let C=e.charCodeAt(o+1);if(C>=65&&C<=90||C>=97&&C<=122)h=!0;o++}return t}function Zr(e){let s=0,t=0,o=0,a=!1,h=null;while(o<e.length){if(a){let O=e[o];if(h){if(O===h)h=null}else if(O==='"'||O==="'")h=O;else if(O===">")a=!1;o++;continue}let c=e.indexOf("<",o),v=c===-1?e.length:c;while(o<v){let O=e[o++];if(O==="{")s++;else if(O==="}")t++;if(s>=2&&t>=2)return!0}if(c===-1)break;let E=Kr(e,c);if(E>c){o=E;continue}let R=e.charCodeAt(c+1),C=R===47?e.charCodeAt(c+2):R;if(C>=65&&C<=90||C>=97&&C<=122)a=!0;o=c+1}return!1}function $a(e,s){while(e.size>=s){let t=e.keys().next();if(t.done)return;e.delete(t.value)}}var ya=1024,_a=16777216,vt=new Map,Es=0;function wa(e,s){vt.set(e,s),Es+=e.length+s.output.length;for(let[t,o]of vt){if(Es<=_a)break;vt.delete(t),Es-=t.length+o.output.length}}function le(e,s,t,o){let a=o!==void 0&&e.length>=ya,h=a?`${o}\x00${e}`:"";if(a){let C=vt.get(h);if(C)return vt.delete(h),vt.set(h,C),{output:C.output,tokens:C.tokens.slice()}}let c=ce(e,s);if(c.length===0)return{output:e,tokens:[]};let v=c.map((C)=>C.token),E="",R=0;for(let C=0;C<c.length;C++){let O=c[C];E+=e.slice(R,O.start),E+=t(O.token,C),R=O.end}if(E+=e.slice(R),a)return wa(h,{output:E,tokens:v}),{output:E,tokens:v.slice()};return{output:E,tokens:v}}var Sa=1024,va=16777216,kt=new Map,Rs=0;function ka(e,s){kt.set(e,s),Rs+=e.length+s.output.length;for(let[t,o]of kt){if(Rs<=va)break;kt.delete(t),Rs-=t.length+o.output.length}}function Cs(e,s,t){return{output:s,scripts:t,restore:(o)=>o===s?e:or(o,t)}}function q(e){let s=e.length>=Sa;if(s){let a=kt.get(e);if(a)return kt.delete(e),kt.set(e,a),Cs(e,a.output,a.scripts.slice())}let{output:t,tokens:o}=le(e,W,(a,h)=>`\x00STX_SCRIPT_${h}\x00`);if(s)return ka(e,{output:t,scripts:o}),Cs(e,t,o.slice());return Cs(e,t,o)}function or(e,s){if(s.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(t,o)=>s[+o]??"")}function Tt(e){let s=e.indexOf(" as ");if(s!==-1){let h=e.slice(0,s).trim(),c=e.slice(s+4).trim();return h&&c?{arrayExpr:h,itemVar:c}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let o=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=t[2].trim();return o&&a?{arrayExpr:a,itemVar:o}:null}function jn(e){let s=[],t=0,o="",a=0;for(let h=0;h<e.length;h++){let c=e[h];if(o){if(c==="\\")h++;else if(c===o)o="";continue}if(c==="'"||c==='"'||c==="`")o=c;else if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)s.push(e.slice(a,h)),a=h+1}return s.push(e.slice(a)),s}function qr(e,s){let t=0;for(let o=0;o<e.length;o++){let a=e[o];if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a===s&&t===0)return o}return-1}function Xr(e){let s=0;for(let t=0;t<e.length;t++){let o=e[t];if(o==="("||o==="["||o==="{")s++;else if((o===")"||o==="]"||o==="}")&&--s===0)return t}return-1}function ht(e,s){let t=e.trim().replace(/^\.\.\./,"").trim(),o=qr(t,"=");if(o!==-1&&t[o+1]!==">")t=t.slice(0,o).trim();if(!t)return;if(t.startsWith("{")&&t.endsWith("}")){for(let a of jn(t.slice(1,-1))){let h=a.trim();if(!h)continue;if(h.startsWith("...")){ht(h,s);continue}let c=qr(h,":");ht(c===-1?h:h.slice(c+1),s)}return}if(t.startsWith("[")&&t.endsWith("]")){for(let a of jn(t.slice(1,-1)))ht(a,s);return}if(/^[A-Z_$][\w$]*$/i.test(t))s.push(t)}function be(e){let s=e.trim(),t=[],o=0;for(let h=0;h<s.length;h++){let c=s[h];if(c==="("||c==="["||c==="{")o++;else if(c===")"||c==="]"||c==="}")o--;else if(o===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(s.slice(h)))continue;let E=s.slice(0,h).trim();if(E.startsWith("(")&&Xr(E)===E.length-1)E=E.slice(1,-1);for(let R of jn(E))ht(R,t);if(t.length>0)return t;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(s);if(a){let h=a[1].trim();if(h.startsWith("(")&&Xr(h)===h.length-1)h=h.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(h);if(c)ht(c[2],t),ht(c[1],t);else for(let v of jn(h))ht(v,t)}return t}function ue(e,s){let t=s instanceof Set?s:new Set(s);if(t.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let v of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(t.has(v))return!0;return!1}var Nn="__stx_client_loop_names";function Qe(e){let s=e?.[Nn];return Array.isArray(s)?s:[]}function Ln(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let s=[],t=[],o=/<!--[\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(o)){let h=a[0];if(/^<\/template\s*>$/i.test(h)){let c=t.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(h)&&!/\/\s*>$/.test(h)){let v=[...h.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((C)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(C[1])),E=(v?.[2]??v?.[3])?.trim();if(E&&v?.[1]==="data-stx-slot-binding")try{E=decodeURIComponent(E)}catch{E=void 0}let R=E?{start:a.index+h.length,end:e.length,binding:E}:void 0;if(t.push(R),R)s.push(R)}}return s}var qt={},Gr=new Map;function Ca(e){let s=Gr.get(e);if(!s){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");s=new RegExp(`:${t}(?!\\w)`,"g"),Gr.set(e,s)}return s.lastIndex=0,s}var hs={uppercase:(e,s)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,s)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,s)=>{if(e===void 0||e===null)return"";let t=String(e);return t.charAt(0).toUpperCase()+t.slice(1)},number:(e,s,t=0)=>{if(e===void 0||e===null)return"";try{let o=Number(e);return Number.isNaN(o)?"":o.toFixed(Number.parseInt(String(t),10))}catch{return""}},fmt:(e,s,t="en-US")=>{if(e===void 0||e===null)return"";try{let o=Number(e);if(Number.isNaN(o))return String(e);return o.toLocaleString(t)}catch{return String(e)}},join:(e,s,t=",")=>{if(!Array.isArray(e))return"";return e.join(String(t))},escape:(e,s)=>{if(e===void 0||e===null)return"";return F(String(e))},translate:(e,s,t={})=>{if(!s||!s.__translations)return e;let o=s.__translations,a=s.__i18nConfig?.fallbackToKey??!0,h=String(e).split("."),c=o;for(let E of h){if(c===void 0||c===null)break;c=c[E]}if(c===void 0||c===null)return a?e:"";let v=String(c);return Object.entries(t).forEach(([E,R])=>{v=v.replace(Ca(E),()=>String(R))}),v},t:(e,s,t={})=>hs.translate(e,s,t),truncate:(e,s,t=50,o="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=t)return a;if(t<=o.length)return o.substring(0,t);return a.substring(0,t-o.length)+o},date:(e,s,t="short",o="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 h={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(t==="iso")return a.toISOString();return new Intl.DateTimeFormat(o,h[t]||h.short).format(a)}catch{return String(e)}},currency:(e,s,t="USD",o="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(o,{style:"currency",currency:t}).format(a)}catch{return String(e)}},pluralize:(e,s,t,o)=>{let a=Number(e);if(Number.isNaN(a))return t;let h=o||`${t}s`;return a===1?t:h},first:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let t=String(e);return t.charAt(t.length-1)},length:(e,s)=>{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,s,t=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return t?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,s,t="")=>e===void 0||e===null||e===""?t:e,reverse:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,s,t=0,o)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(t,o);return e},replace:(e,s,t,o="")=>{if(e===void 0||e===null)return"";let a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>o)},stripTags:(e,s)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,s)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,s)=>{let t=Number(e);return Number.isNaN(t)?0:Math.abs(t)},round:(e,s,t=0)=>{let o=Number(e);if(Number.isNaN(o))return 0;let a=10**t;return Math.round(o*a)/a}};function ru(e,s){if(e in hs)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);qt[e]=s}function Ap(e){for(let[s,t]of Object.entries(e))ru(s,t)}function su(){return{...hs,...qt}}function Pp(){for(let e of Object.keys(qt))delete qt[e]}function It(e,s,t=2){let o="{".repeat(t);if(!e.includes(o))return e;let a="",h=0;for(;;){let c=e.indexOf(o,h);if(c===-1)break;let v=he(e,c,t);if(v===-1)break;a+=e.slice(h,c)+s(e.slice(c,v+t),e.slice(c+t,v),c),h=v+t}return h===0?e:a+e.slice(h)}function d(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function F(e){return Wr(d(e))}function Za(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function Qa(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(s,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function ec(e,s){let t=Qa(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(t))throw new ne(s,"network-capable or executable CSS is not allowed in an escaped interpolation");let o=/url\(([^)]*)\)/g,a;while((a=o.exec(t))!==null){let h=a[1].replace(/^["']|["']$/g,""),c=h.startsWith("/")&&!h.startsWith("//")||h.startsWith("./")||h.startsWith("../")||h.startsWith("#"),v=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(h);if(!c&&!v)throw new ne(s,"CSS URLs must be local paths or base64 raster images")}}function K(e,s,t,o=!1,a=0){try{return tc(e,s,t,o,a)}catch(h){if(h instanceof ne)h.locate(e,s);throw h}}function tc(e,s,t,o,a){let h=cs(e,s,o),c=F(t);if(!h)return c;if(h.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(t))throw new ne("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return t}if(h.kind==="tag"){let R=e.slice(s+a).trimStart(),C=t.trim();if(!R.startsWith("=")&&(C===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(C)))return C;throw new ne("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let v=h.name.toLowerCase();if(/^on[a-z]/.test(v))throw new ne(h.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(v==="srcdoc")c=F(c);if(v==="style")ec(t,h.name);if(h.quote===null)c=Za(c);let E=vs(v);if(E&&h.valuePrefix.trim()===""&&Pn(t,E))return Fr+c;return Ur(Vr(e,s),t,c)}function fn(e,s){let t=` ${e}="`;return K(t,t.length,s,!0)}function si(e){return e.flatMap((s)=>{let t=s.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!t||/\bserver\b|\bsrc\s*=/.test(t[1])?[]:[t[2]]})}function ve(e,s){let{scripts:t}=q(e);for(let o of si(t)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(o))return!0;if(br(o,s))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 ou(e){let s=[],t=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let o=t.exec(e);o;o=t.exec(e)){let a=o[1].toLowerCase(),h=new Set(be(o[3]));if(h.size===0)continue;let c=o.index+o[0].length;if(o[0].endsWith("/>")){s.push({start:o.index,end:c,names:h});continue}let v=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");v.lastIndex=c;let E=1,R=e.length;for(let C=v.exec(e);C;C=v.exec(e)){if(C[2]==="/")continue;if(E+=C[1]==="/"?-1:1,E===0){R=C.index+C[0].length;break}}s.push({start:o.index,end:R,names:h})}return s}function Yr(e,s,t){let o=i(t);for(let a of e){if(s<a.start||s>=a.end)continue;for(let h of a.names)if(new RegExp(`(?<![.#\\w$])${h.replace(/\$/g,"\\$")}(?![\\w$])`).test(o))return!0}return!1}function Qr(e,s){let t=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],o=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",h=!1,c=0;for(let R=0;R<o.length;R++){let C=o[R];if(!h&&C==="`"){h=!0,c=0;continue}if(h){if(C==="`"&&c===0){h=!1;continue}if(C==="$"&&o[R+1]==="{"){c++,R++,a+=" ";continue}if(C==="}"&&c>0){c--;continue}if(c>0){a+=C;continue}continue}a+=C}o=a;let v=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,E;while((E=v.exec(o))!==null){let R=E[1];if(!o.substring(0,E.index).trimEnd().endsWith(".")){if(!t.includes(R)&&!(R in s))return!1}}return!0}function nc(e,s){let t=i(e);for(let o of t.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof s[o[1]]==="function")return!0;return!1}function sc(e,s){let t=s.__stx_serverDeclared;if(!t||t.size===0)return!1;let o=i(e);for(let a of t)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(o))return!0;return!1}var ei=new Set;function ti(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function ni(e,s){let t=`${s??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!ei.has(t))ei.add(t),console.warn(`[stx] {{ ${e} }} in a <script> in ${s??"<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 Lo(e,s,t){let o=e;return o=o.replace(/\{!!([\s\S]*?)!!\}/g,(a,h)=>{try{let c=_(h,s);if(c===void 0)return ti(h)?ni(h.trim(),t):a;return c===null?"":String(c)}catch{return a}}),o=It(o,(a,h,c)=>{let v=h.trim();if(/^__[A-Z_]+__$/.test(v))return a;try{let E=_(h,s);if(E===void 0)return ti(v)?ni(v,t):a;return JSON.stringify(E).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(R)=>"\\u007b".repeat(R.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),o}function iu(e,s){if(!e.includes("{"))return e;let t=e;return t=t.replace(/\{!!([\s\S]*?)!!\}/g,(o,a)=>{try{let h=_(a,s);if(h===void 0)return o;return h===null?"":String(h)}catch{return o}}),t=It(t,(o,a,h)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return o;try{let v=_(a,s);if(v===void 0)return o;if(v===null)return"";let E=String(v);return K(t,h,E,!0,o.length)}catch(v){if(v instanceof ne)throw v;return o}}),t}function Ip(e,s,t={}){let{output:o,scripts:a}=q(e),h=a.map((c)=>{let v=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),E=c.search(/<\/script\s*>$/i);if(!v||E===-1)return c;let R=v[1],C=c.slice(v[0].length,E);if(/\bdata-raw\b/.test(R))return c;if(t.skipServer&&/\bserver\b/.test(R))return c;let M=`<script${iu(R,s)}>`;if(/\bsrc\s*=/.test(R)||/\btype\s*=\s*["']application\/json["']/.test(R))return M+C+c.slice(E);return M+Lo(C,s)+c.slice(E)});return or(o,h)}function k(e,s,t){let o=e,a=(I,P)=>{let Z=on(I,P);if(Z===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(I.slice(P,Z))?-1:Z},h=(I,P,Z,U)=>{let V=Z.length,{output:X,tokens:Y}=le(I,P,(Q,re)=>U(V+re));return Z.push(...Y),X},c=[];o=h(o,a,c,(I)=>`<!--__STX_STYLE_${I}__-->`);let v=[];o=h(o,W,v,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`);let E=s?.__stx_signals_gate===!0||ve(e),R=new Set([...Array.isArray(s?.__stx_client_signal_names)?s.__stx_client_signal_names:[],...Do(si(v))]),C=new Set(Array.isArray(s?.__stx_preserved_client_expressions)?s.__stx_preserved_client_expressions:[]);o=It(o,(I,P,Z)=>{try{let U=_(P,s,!1,(V)=>Is(V,I,t,e));return U!==void 0&&U!==null?String(U):""}catch(U){let V=U instanceof Error?U.message:String(U);return m("Expression",`Error evaluating: {{{ ${P.trim()}}}}: ${V}`,t,e,Z,I)}},3),o=o.replace(/\{!!([\s\S]*?)!!\}/g,(I,P,Z)=>{try{let U=_(P,s,!1,(V)=>Is(V,I,t,e));if(U===void 0&&s.__stx_buildMode==="compile")return In("raw",P.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(s.__stx_buildMode==="compile")return In("raw",P.trim());let V=U instanceof Error?U.message:String(U);return m("Expression",`Error evaluating: {!! ${P.trim()} !!}: ${V}`,t,e,Z,I)}}),o=h(o,W,v,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`),o=h(o,a,c,(I)=>`<!--__STX_STYLE_${I}__-->`);let O=E?ou(o):[],M=Ln(o).map((I)=>({...I,names:new Set(be(`${I.binding} in __slot`))})),N=new Set(Qe(s));if(o=It(o,(I,P,Z)=>{let U=P.trim();if(Yr(M,Z,U))return I;if(ue(U,N))return I;if(O.length>0&&Yr(O,Z,U))return I;if(C.has(U))return I;let V=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],X=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,Q=U.match(X)?.[1],re=Q&&((Q in s)||V.includes(Q)),pe=Boolean(Q&&R.has(Q)),Ee=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,ke=U.match(Ee),We=ke&&!V.includes(ke[1])&&!(ke[1]in s);if(/^__[A-Z_]+__$/.test(U))return"";if(pe)return I;if(s.__stx_native_screen===!0&&nc(U,s))return I;let Te;try{let Ke=_(P,s,!1,(xt)=>{Te=xt});if(E&&!Qr(U,s))return I;if(Te)Is(Te,I,t,e);if(s.__stx_buildMode==="compile"&&!E&&(Ke===void 0||sc(U,s)))return In("expr",U);if(Ke===void 0||Ke===null)return"";let Ge=String(Ke);return K(o,Z,Ge,!1,I.length)}catch(Ke){if(Ke instanceof ne)throw Ke;if(E&&!Qr(U,s))return I;if(We)return I;let Ge=Ke instanceof Error?Ke.message:String(Ke);return m("Expression",`Error evaluating: {{ ${U} }}: ${Ge}`,t,e,Z,I)}}),v.length>0)o=o.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(I,P)=>v[Number(P)]??I);if(c.length>0)o=o.replace(/<!--__STX_STYLE_(\d+)__-->/g,(I,P)=>c[Number(P)]??I);return o}function au(e,s,t){if(!s.trim())return e;let o=e,a=s.trim();while(a.length>0){let h=a.match(/^(\w+)/);if(!h)break;let c=h[1];a=a.substring(c.length).trim();let v=qt[c]||hs[c];if(!v)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(su()).join(", ")}`);let E=[];if(a.startsWith(":")){let R=a.match(/^:([^|\s]+)/);if(R){let C=R[1].trim();try{let O=Number(C);E=[Number.isNaN(O)?C:O]}catch{E=[C]}a=a.substring(R[0].length).trim()}}else if(a.startsWith("(")){let R=1,C=1;while(R>0&&C<a.length){if(a[C]==="(")R++;if(a[C]===")")R--;C++}if(R===0){let O=a.substring(1,C-1).trim();if(O)try{if(O.startsWith("{")&&O.endsWith("}"))E=[_(`(${O})`,t,!0)];else{let M=[],N="",I=null,P=0,Z=0,U=0,V=!1;for(let X=0;X<O.length;X++){let Y=O[X];if(V){N+=Y,V=!1;continue}if(Y==="\\"){N+=Y,V=!0;continue}if(I){if(N+=Y,Y===I)I=null;continue}if(Y==='"'||Y==="'"||Y==="`"){I=Y,N+=Y;continue}if(Y==="(")P++;else if(Y===")")P--;else if(Y==="[")Z++;else if(Y==="]")Z--;else if(Y==="{")U++;else if(Y==="}")U--;if(Y===","&&P===0&&Z===0&&U===0){M.push(N),N="";continue}N+=Y}if(N)M.push(N);E=M.map((X)=>{let Y=X.trim();return _(Y,t,!0)})}}catch{E=[O]}a=a.substring(C).trim()}}try{o=v(o,t,...E)}catch(R){let C=R instanceof Error?R.message:String(R);throw Error(`Error applying filter '${c}': ${C}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return o}function rc(e){let s=!1,t="",o=0,a=0,h=0,c=!1;for(let v=0;v<e.length;v++){let E=e[v],R=e[v+1];if(s&&c){c=!1;continue}if(s&&E==="\\"){c=!0;continue}if(c=!1,(E==='"'||E==="'"||E==="`")&&!c){if(!s)s=!0,t=E;else if(E===t)s=!1,t="";continue}if(s&&t==="`"&&E==="$"&&R==="{"){let C=1;v+=2;while(v<e.length&&C>0){if(e[v]==="{")C++;else if(e[v]==="}")C--;if(C>0)v++}continue}if(s)continue;if(E==="(")o++;else if(E===")")o--;else if(E==="[")a++;else if(E==="]")a--;else if(E==="{")h++;else if(E==="}")h--;if(E==="|"&&o===0&&a===0&&h===0){if(R==="|"){v++;continue}if(R==="="){v++;continue}return v}}return-1}var Zt=new Set,oc=1000;function Op(){Zt.clear()}function Is(e,s,t,o){if(!H())return;let a=`${t}\x00${e.expression}`;if(Zt.has(a))return;if(Zt.size>=oc)Zt.clear();Zt.add(a);let h=t,c=o;try{if(t&&Jr.existsSync(t))c=Jr.readFileSync(t,"utf8")}catch{}let v=c.indexOf(s);if(v>=0)h=`${t}:${c.slice(0,v).split(`
|
|
228
|
-
`).length}`;console.warn(`${h}: stx warning: ${s} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function _(e,s,t=!1,o){try{let a=e.trim(),h=rc(a);if(h>0){let v=a.substring(0,h).trim(),E=a.substring(h+1).trim(),R=_(v,s,!0,o);return
|
|
227
|
+
`}),jr(e,a)}function jr(e,s){if(s.length===0)return e;s.sort((h,c)=>h.start-c.start||h.end-c.end);let t=Array(s.length*2+1),o=0,a=0;for(let h of s)t[a++]=e.slice(o,h.start),t[a++]=h.replacement,o=h.end;return t[a]=e.slice(o),t.join("")}function Nr(e){let s=An(e),t=new Map;if(s)for(let[o,a]of s)t.set(o,a.instances);return t}function Lr(e,s){let t=An(e);if(!t)return[];let o=[];for(let[a,h]of t){let c=h.instances-(s.get(a)??0);if(c>0)o.push({body:h.body,count:c})}return o}function Br(e,s){for(let{body:t,count:o}of s)for(let a=0;a<o;a++)ws(e,t)}function ye(e,s,t=2){let o=0,a=null;for(let h=s+t;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){o++;continue}if(c==="}"){if(o>0){o--;continue}let v=0;while(e[h+v]==="}")v++;if(v>=t)return h}}return-1}import Jr from"fs";var zr=0,Ss=new Map;function Ja(){zr=0,Ss.clear()}function In(e,s){let t=zr++,o=`<!--__STX_${e.toUpperCase()}_${t}__-->`;return Ss.set(o,{type:e,expression:s}),o}function Ya(){let e={};for(let[s,t]of Ss)e[s]={type:t.type,expression:t.expression};return e}function Za(e,s){let t=e;for(let[o,a]of s)t=t.split(o).join(a);return t}function Lo(e){return e.includes("<!--__STX_")}var aa=/@(?=[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 ca(e){return Array.from({length:e},()=>"{").join("⁠")}function Wr(e){return e.replace(/\{{2,}/g,(s)=>ca(s.length)).replace(/\{(?=!)/g,"{⁠").replace(aa,"@")}function ls(e,s,t=!1){let{openTag:o,tail:a}=t?la(e,s):ua(e).at(s);return pa(a,o,t)}function la(e,s){let t="",o=0;for(let c=0;c<s;c++){if(!e.startsWith("{{",c))continue;let v=ye(e,c);if(v<0||v+2>s)break;t+=e.slice(o,c)+"x",c=v+1,o=v+2}t+=e.slice(o,s);let a=-1,h=null;for(let c=0;c<t.length;c++){let v=t[c];if(h){if(v===h)h=null;continue}if(v==='"'||v==="'"){h=v;continue}if(v===">"){a=-1;continue}if(v==="<")a=c}return{openTag:a,tail:a>=0?t.slice(a+1):t}}var On=null;function ua(e){if(On&&On.source===e)return On.scanner;let s=fa(e);return On={source:e,scanner:s},s}function fa(e){let s=0,t=-1,o=null,a=-1,h=(v,E)=>{let R=e[v];if(E.quote){if(R===E.quote)E.quote=null;return}if(E.openTag>=0){if(R==='"'||R==="'"){E.quote=R;return}if(R===">"){E.openTag=-1;return}}if(R==="<")E.openTag=v},c=(v,E)=>{if(E.openTag>=0||!e.startsWith("<!--",v))return-1;let R=e.indexOf("-->",v+4);return R<0?e.length:R+3};return{at(v){if(v<s)s=0,t=-1,o=null,a=-1;let E={openTag:t,quote:o},R=!1;while(s<v){if(a<0&&e.startsWith("{{",s)){let P=ye(e,s);if(P<0)a=s;else if(P+2<=v){s=P+2;continue}else break}let I=c(s,E);if(I>=0){if(I>v){R=!0;break}s=I;continue}h(s,E),s++}if(t=E.openTag,o=E.quote,R)return{openTag:-1,tail:""};let C=a>=0?a:s,O={openTag:t,quote:o};for(let I=s;I<v;I++){let P=c(I,O);if(P>=0){if(P>v)return{openTag:-1,tail:""};I=P-1;continue}h(I,O)}if(O.openTag<0)return{openTag:-1,tail:""};let M="",N=O.openTag+1;for(let I=N;I<Math.min(v,C);I++){if(!e.startsWith("{{",I))continue;let P=ye(e,I);M+=e.slice(N,I)+"x",I=P+1,N=P+2}return M+=e.slice(N,v),{openTag:O.openTag,tail:M}}}}function pa(e,s,t){if(s<0&&!t)return null;if(s>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(s>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let o=0;if(s>=0)while(o<e.length&&!/\s/.test(e[o]))o++;while(o<e.length){while(/\s/.test(e[o]??"")&&o<e.length)o++;let a=o;while(o<e.length&&!/[\s=/>]/.test(e[o]))o++;let h=e.slice(a,o);if(!h)break;while(o<e.length&&/\s/.test(e[o]))o++;if(e[o]!=="=")continue;o++;while(o<e.length&&/\s/.test(e[o]))o++;let c=e[o];if(c==='"'||c==="'"){let v=++o,E=e.indexOf(c,o);if(E===-1)return{kind:"attribute",name:h,quote:c,valuePrefix:e.slice(v)};o=E+1}else{let v=o;while(o<e.length&&!/\s/.test(e[o]))o++;if(o===e.length)return{kind:"attribute",name:h,quote:null,valuePrefix:e.slice(v)}}}return{kind:"tag"}}class se extends Error{attribute;near;constructor(e,s){super(`Unsafe interpolation in ${e}: ${s}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,s){if(this.near===void 0)this.near=e.slice(Math.max(0,s-160),s).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Fr="unsafe:";var da=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ga=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,ma=/^data:(?:text\/html|application\/xhtml\+xml)/,ha=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function xa(e){return e.replace(ha,"").toLowerCase()}function $s(e){let s=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(s))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(s))return"fetched";return null}function Pn(e,s="navigable"){let t=xa(e);if(da.test(t))return!0;return s==="navigable"?ga.test(t):ma.test(t)}function or(e,s="navigable"){return Pn(e,s)?"unsafe:"+e:e}function ba(e){let s=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!s)return null;if(s[3].trim()!=="")return null;return $s(s[1])}function Vr(e,s,t=256){if(s<=t)return e.slice(0,s);let o=e.slice(s-t,s),a=o.search(/[\s"'`/]/);return a===-1?"":o.slice(a)}function Ur(e,s,t=s){let o=ba(e);return o&&Pn(s,o)?"unsafe:"+t:t}var Mn=/<script\b[^>]*>/iy,Ts=/<\/script\s*>/ig,Dn=/<style\b[^>]*>/iy,As=/<\/style\s*>/ig;function Hr(e,s,t,o){t.lastIndex=s;let a=t.exec(e);if(!a||a.index!==s)return-1;o.lastIndex=t.lastIndex;let h=o.exec(e);if(!h)return-1;return h.index+h[0].length}function q(e,s){return Hr(e,s,Mn,Ts)}function on(e,s){return Hr(e,s,Dn,As)}function Pe(e,s){if(!e.startsWith("<!--",s))return-1;let t=e.indexOf("-->",s+4);if(t===-1)return-1;return t+3}function Kr(e,s){if(e.startsWith("<!--",s)){let a=Pe(e,s);return a===-1?e.length:a}if(Mn.lastIndex=s,Mn.exec(e)?.index===s){Ts.lastIndex=Mn.lastIndex;let a=Ts.exec(e);return a?a.index+a[0].length:e.length}if(Dn.lastIndex=s,Dn.exec(e)?.index===s){As.lastIndex=Dn.lastIndex;let a=As.exec(e);return a?a.index+a[0].length:e.length}return-1}function ue(e,s){let t=[],o=0,a=e.length,h=!1,c=null;while(o<a){let v=e[o];if(h){if(c){if(v===c)c=null}else if(v==='"'||v==="'")c=v;else if(v===">")h=!1;o++;continue}if(v!=="<"){let O=e.indexOf("<",o+1);if(O===-1)break;o=O;continue}let E=s(e,o);if(E>o){t.push({start:o,end:E,token:e.slice(o,E)}),o=E;continue}let R=Kr(e,o);if(R>o){o=R;continue}let C=e.charCodeAt(o+1);if(C>=65&&C<=90||C>=97&&C<=122)h=!0;o++}return t}function Zr(e){let s=0,t=0,o=0,a=!1,h=null;while(o<e.length){if(a){let O=e[o];if(h){if(O===h)h=null}else if(O==='"'||O==="'")h=O;else if(O===">")a=!1;o++;continue}let c=e.indexOf("<",o),v=c===-1?e.length:c;while(o<v){let O=e[o++];if(O==="{")s++;else if(O==="}")t++;if(s>=2&&t>=2)return!0}if(c===-1)break;let E=Kr(e,c);if(E>c){o=E;continue}let R=e.charCodeAt(c+1),C=R===47?e.charCodeAt(c+2):R;if(C>=65&&C<=90||C>=97&&C<=122)a=!0;o=c+1}return!1}function Ra(e,s){while(e.size>=s){let t=e.keys().next();if(t.done)return;e.delete(t.value)}}var ya=1024,_a=16777216,vt=new Map,Es=0;function wa(e,s){vt.set(e,s),Es+=e.length+s.output.length;for(let[t,o]of vt){if(Es<=_a)break;vt.delete(t),Es-=t.length+o.output.length}}function de(e,s,t,o){let a=o!==void 0&&e.length>=ya,h=a?`${o}\x00${e}`:"";if(a){let C=vt.get(h);if(C)return vt.delete(h),vt.set(h,C),{output:C.output,tokens:C.tokens.slice()}}let c=ue(e,s);if(c.length===0)return{output:e,tokens:[]};let v=c.map((C)=>C.token),E="",R=0;for(let C=0;C<c.length;C++){let O=c[C];E+=e.slice(R,O.start),E+=t(O.token,C),R=O.end}if(E+=e.slice(R),a)return wa(h,{output:E,tokens:v}),{output:E,tokens:v.slice()};return{output:E,tokens:v}}var Sa=1024,va=16777216,kt=new Map,Rs=0;function Ea(e,s){kt.set(e,s),Rs+=e.length+s.output.length;for(let[t,o]of kt){if(Rs<=va)break;kt.delete(t),Rs-=t.length+o.output.length}}function Cs(e,s,t){return{output:s,scripts:t,restore:(o)=>o===s?e:ir(o,t)}}function G(e){let s=e.length>=Sa;if(s){let a=kt.get(e);if(a)return kt.delete(e),kt.set(e,a),Cs(e,a.output,a.scripts.slice())}let{output:t,tokens:o}=de(e,q,(a,h)=>`\x00STX_SCRIPT_${h}\x00`);if(s)return Ea(e,{output:t,scripts:o}),Cs(e,t,o.slice());return Cs(e,t,o)}function ir(e,s){if(s.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(t,o)=>s[+o]??"")}function Tt(e){let s=e.indexOf(" as ");if(s!==-1){let h=e.slice(0,s).trim(),c=e.slice(s+4).trim();return h&&c?{arrayExpr:h,itemVar:c}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let o=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=t[2].trim();return o&&a?{arrayExpr:a,itemVar:o}:null}function jn(e){let s=[],t=0,o="",a=0;for(let h=0;h<e.length;h++){let c=e[h];if(o){if(c==="\\")h++;else if(c===o)o="";continue}if(c==="'"||c==='"'||c==="`")o=c;else if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)s.push(e.slice(a,h)),a=h+1}return s.push(e.slice(a)),s}function qr(e,s){let t=0;for(let o=0;o<e.length;o++){let a=e[o];if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a===s&&t===0)return o}return-1}function Xr(e){let s=0;for(let t=0;t<e.length;t++){let o=e[t];if(o==="("||o==="["||o==="{")s++;else if((o===")"||o==="]"||o==="}")&&--s===0)return t}return-1}function ht(e,s){let t=e.trim().replace(/^\.\.\./,"").trim(),o=qr(t,"=");if(o!==-1&&t[o+1]!==">")t=t.slice(0,o).trim();if(!t)return;if(t.startsWith("{")&&t.endsWith("}")){for(let a of jn(t.slice(1,-1))){let h=a.trim();if(!h)continue;if(h.startsWith("...")){ht(h,s);continue}let c=qr(h,":");ht(c===-1?h:h.slice(c+1),s)}return}if(t.startsWith("[")&&t.endsWith("]")){for(let a of jn(t.slice(1,-1)))ht(a,s);return}if(/^[A-Z_$][\w$]*$/i.test(t))s.push(t)}function K(e){let s=e.trim(),t=[],o=0;for(let h=0;h<s.length;h++){let c=s[h];if(c==="("||c==="["||c==="{")o++;else if(c===")"||c==="]"||c==="}")o--;else if(o===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(s.slice(h)))continue;let E=s.slice(0,h).trim();if(E.startsWith("(")&&Xr(E)===E.length-1)E=E.slice(1,-1);for(let R of jn(E))ht(R,t);if(t.length>0)return t;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(s);if(a){let h=a[1].trim();if(h.startsWith("(")&&Xr(h)===h.length-1)h=h.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(h);if(c)ht(c[2],t),ht(c[1],t);else for(let v of jn(h))ht(v,t)}return t}function F(e,s){let t=s instanceof Set?s:new Set(s);if(t.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let v of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(t.has(v))return!0;return!1}var Nn="__stx_client_loop_names";function Qe(e){let s=e?.[Nn];return Array.isArray(s)?s:[]}function Ln(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let s=[],t=[],o=/<!--[\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(o)){let h=a[0];if(/^<\/template\s*>$/i.test(h)){let c=t.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(h)&&!/\/\s*>$/.test(h)){let v=[...h.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((C)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(C[1])),E=(v?.[2]??v?.[3])?.trim();if(E&&v?.[1]==="data-stx-slot-binding")try{E=decodeURIComponent(E)}catch{E=void 0}let R=E?{start:a.index+h.length,end:e.length,binding:E}:void 0;if(t.push(R),R)s.push(R)}}return s}var qt={},Gr=new Map;function ka(e){let s=Gr.get(e);if(!s){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");s=new RegExp(`:${t}(?!\\w)`,"g"),Gr.set(e,s)}return s.lastIndex=0,s}var ys={uppercase:(e,s)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,s)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,s)=>{if(e===void 0||e===null)return"";let t=String(e);return t.charAt(0).toUpperCase()+t.slice(1)},number:(e,s,t=0)=>{if(e===void 0||e===null)return"";try{let o=Number(e);return Number.isNaN(o)?"":o.toFixed(Number.parseInt(String(t),10))}catch{return""}},fmt:(e,s,t="en-US")=>{if(e===void 0||e===null)return"";try{let o=Number(e);if(Number.isNaN(o))return String(e);return o.toLocaleString(t)}catch{return String(e)}},join:(e,s,t=",")=>{if(!Array.isArray(e))return"";return e.join(String(t))},escape:(e,s)=>{if(e===void 0||e===null)return"";return z(String(e))},translate:(e,s,t={})=>{if(!s||!s.__translations)return e;let o=s.__translations,a=s.__i18nConfig?.fallbackToKey??!0,h=String(e).split("."),c=o;for(let E of h){if(c===void 0||c===null)break;c=c[E]}if(c===void 0||c===null)return a?e:"";let v=String(c);return Object.entries(t).forEach(([E,R])=>{v=v.replace(ka(E),()=>String(R))}),v},t:(e,s,t={})=>ys.translate(e,s,t),truncate:(e,s,t=50,o="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=t)return a;if(t<=o.length)return o.substring(0,t);return a.substring(0,t-o.length)+o},date:(e,s,t="short",o="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 h={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(t==="iso")return a.toISOString();return new Intl.DateTimeFormat(o,h[t]||h.short).format(a)}catch{return String(e)}},currency:(e,s,t="USD",o="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(o,{style:"currency",currency:t}).format(a)}catch{return String(e)}},pluralize:(e,s,t,o)=>{let a=Number(e);if(Number.isNaN(a))return t;let h=o||`${t}s`;return a===1?t:h},first:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let t=String(e);return t.charAt(t.length-1)},length:(e,s)=>{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,s,t=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return t?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,s,t="")=>e===void 0||e===null||e===""?t:e,reverse:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,s,t=0,o)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(t,o);return e},replace:(e,s,t,o="")=>{if(e===void 0||e===null)return"";let a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>o)},stripTags:(e,s)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,s)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,s)=>{let t=Number(e);return Number.isNaN(t)?0:Math.abs(t)},round:(e,s,t=0)=>{let o=Number(e);if(Number.isNaN(o))return 0;let a=10**t;return Math.round(o*a)/a}};function su(e,s){if(e in ys)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);qt[e]=s}function Pp(e){for(let[s,t]of Object.entries(e))su(s,t)}function ou(){return{...ys,...qt}}function Ip(){for(let e of Object.keys(qt))delete qt[e]}function It(e,s,t=2){let o="{".repeat(t);if(!e.includes(o))return e;let a="",h=0;for(;;){let c=e.indexOf(o,h);if(c===-1)break;let v=ye(e,c,t);if(v===-1)break;a+=e.slice(h,c)+s(e.slice(c,v+t),e.slice(c+t,v),c),h=v+t}return h===0?e:a+e.slice(h)}function d(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function z(e){return Wr(d(e))}function Ca(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function Qa(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(s,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function ec(e,s){let t=Qa(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(t))throw new se(s,"network-capable or executable CSS is not allowed in an escaped interpolation");let o=/url\(([^)]*)\)/g,a;while((a=o.exec(t))!==null){let h=a[1].replace(/^["']|["']$/g,""),c=h.startsWith("/")&&!h.startsWith("//")||h.startsWith("./")||h.startsWith("../")||h.startsWith("#"),v=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(h);if(!c&&!v)throw new se(s,"CSS URLs must be local paths or base64 raster images")}}function J(e,s,t,o=!1,a=0){try{return tc(e,s,t,o,a)}catch(h){if(h instanceof se)h.locate(e,s);throw h}}function tc(e,s,t,o,a){let h=ls(e,s,o),c=z(t);if(!h)return c;if(h.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(t))throw new se("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return t}if(h.kind==="tag"){let R=e.slice(s+a).trimStart(),C=t.trim();if(!R.startsWith("=")&&(C===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(C)))return C;throw new se("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let v=h.name.toLowerCase();if(/^on[a-z]/.test(v))throw new se(h.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(v==="srcdoc")c=z(c);if(v==="style")ec(t,h.name);if(h.quote===null)c=Ca(c);let E=$s(v);if(E&&h.valuePrefix.trim()===""&&Pn(t,E))return Fr+c;return Ur(Vr(e,s),t,c)}function fn(e,s){let t=` ${e}="`;return J(t,t.length,s,!0)}function si(e){return e.flatMap((s)=>{let t=s.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!t||/\bserver\b|\bsrc\s*=/.test(t[1])?[]:[t[2]]})}function ve(e,s){let{scripts:t}=G(e);for(let o of si(t)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(o))return!0;if(vr(o,s))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 iu(e){let s=[],t=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let o=t.exec(e);o;o=t.exec(e)){let a=o[1].toLowerCase(),h=new Set(K(o[3]));if(h.size===0)continue;let c=o.index+o[0].length;if(o[0].endsWith("/>")){s.push({start:o.index,end:c,names:h});continue}let v=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");v.lastIndex=c;let E=1,R=e.length;for(let C=v.exec(e);C;C=v.exec(e)){if(C[2]==="/")continue;if(E+=C[1]==="/"?-1:1,E===0){R=C.index+C[0].length;break}}s.push({start:o.index,end:R,names:h})}return s}function Yr(e,s,t){let o=i(t);for(let a of e){if(s<a.start||s>=a.end)continue;for(let h of a.names)if(new RegExp(`(?<![.#\\w$])${h.replace(/\$/g,"\\$")}(?![\\w$])`).test(o))return!0}return!1}function Qr(e,s){let t=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],o=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",h=!1,c=0;for(let R=0;R<o.length;R++){let C=o[R];if(!h&&C==="`"){h=!0,c=0;continue}if(h){if(C==="`"&&c===0){h=!1;continue}if(C==="$"&&o[R+1]==="{"){c++,R++,a+=" ";continue}if(C==="}"&&c>0){c--;continue}if(c>0){a+=C;continue}continue}a+=C}o=a;let v=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,E;while((E=v.exec(o))!==null){let R=E[1];if(!o.substring(0,E.index).trimEnd().endsWith(".")){if(!t.includes(R)&&!(R in s))return!1}}return!0}function nc(e,s){let t=i(e);for(let o of t.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof s[o[1]]==="function")return!0;return!1}function sc(e,s){let t=s.__stx_serverDeclared;if(!t||t.size===0)return!1;let o=i(e);for(let a of t)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(o))return!0;return!1}var ei=new Set;function ti(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function ni(e,s){let t=`${s??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!ei.has(t))ei.add(t),console.warn(`[stx] {{ ${e} }} in a <script> in ${s??"<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 jo(e,s,t){let o=e;return o=o.replace(/\{!!([\s\S]*?)!!\}/g,(a,h)=>{try{let c=_(h,s);if(c===void 0)return ti(h)?ni(h.trim(),t):a;return c===null?"":String(c)}catch{return a}}),o=It(o,(a,h,c)=>{let v=h.trim();if(/^__[A-Z_]+__$/.test(v))return a;try{let E=_(h,s);if(E===void 0)return ti(v)?ni(v,t):a;return JSON.stringify(E).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(R)=>"\\u007b".repeat(R.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),o}function au(e,s){if(!e.includes("{"))return e;let t=e;return t=t.replace(/\{!!([\s\S]*?)!!\}/g,(o,a)=>{try{let h=_(a,s);if(h===void 0)return o;return h===null?"":String(h)}catch{return o}}),t=It(t,(o,a,h)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return o;try{let v=_(a,s);if(v===void 0)return o;if(v===null)return"";let E=String(v);return J(t,h,E,!0,o.length)}catch(v){if(v instanceof se)throw v;return o}}),t}function Op(e,s,t={}){let{output:o,scripts:a}=G(e),h=a.map((c)=>{let v=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),E=c.search(/<\/script\s*>$/i);if(!v||E===-1)return c;let R=v[1],C=c.slice(v[0].length,E);if(/\bdata-raw\b/.test(R))return c;if(t.skipServer&&/\bserver\b/.test(R))return c;let M=`<script${au(R,s)}>`;if(/\bsrc\s*=/.test(R)||/\btype\s*=\s*["']application\/json["']/.test(R))return M+C+c.slice(E);return M+jo(C,s)+c.slice(E)});return ir(o,h)}function k(e,s,t){let o=e,a=(I,P)=>{let Z=on(I,P);if(Z===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(I.slice(P,Z))?-1:Z},h=(I,P,Z,U)=>{let W=Z.length,{output:Y,tokens:ee}=de(I,P,(te,oe)=>U(W+oe));return Z.push(...ee),Y},c=[];o=h(o,a,c,(I)=>`<!--__STX_STYLE_${I}__-->`);let v=[];o=h(o,q,v,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`);let E=s?.__stx_signals_gate===!0||ve(e),R=new Set([...Array.isArray(s?.__stx_client_signal_names)?s.__stx_client_signal_names:[],...Mo(si(v))]),C=new Set(Array.isArray(s?.__stx_preserved_client_expressions)?s.__stx_preserved_client_expressions:[]);o=It(o,(I,P,Z)=>{try{let U=_(P,s,!1,(W)=>Is(W,I,t,e));return U!==void 0&&U!==null?String(U):""}catch(U){let W=U instanceof Error?U.message:String(U);return m("Expression",`Error evaluating: {{{ ${P.trim()}}}}: ${W}`,t,e,Z,I)}},3),o=o.replace(/\{!!([\s\S]*?)!!\}/g,(I,P,Z)=>{try{let U=_(P,s,!1,(W)=>Is(W,I,t,e));if(U===void 0&&s.__stx_buildMode==="compile")return In("raw",P.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(s.__stx_buildMode==="compile")return In("raw",P.trim());let W=U instanceof Error?U.message:String(U);return m("Expression",`Error evaluating: {!! ${P.trim()} !!}: ${W}`,t,e,Z,I)}}),o=h(o,q,v,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`),o=h(o,a,c,(I)=>`<!--__STX_STYLE_${I}__-->`);let O=E?iu(o):[],M=Ln(o).map((I)=>({...I,names:new Set(K(`${I.binding} in __slot`))})),N=new Set(Qe(s));if(o=It(o,(I,P,Z)=>{let U=P.trim();if(Yr(M,Z,U))return I;if(F(U,N))return I;if(O.length>0&&Yr(O,Z,U))return I;if(C.has(U))return I;let W=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],Y=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,te=U.match(Y)?.[1],oe=te&&((te in s)||W.includes(te)),ge=Boolean(te&&R.has(te)),Ee=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,ke=U.match(Ee),We=ke&&!W.includes(ke[1])&&!(ke[1]in s);if(/^__[A-Z_]+__$/.test(U))return"";if(ge)return I;if(s.__stx_native_screen===!0&&nc(U,s))return I;let Te;try{let Ke=_(P,s,!1,(xt)=>{Te=xt});if(E&&!Qr(U,s))return I;if(Te)Is(Te,I,t,e);if(s.__stx_buildMode==="compile"&&!E&&(Ke===void 0||sc(U,s)))return In("expr",U);if(Ke===void 0||Ke===null)return"";let Ge=String(Ke);return J(o,Z,Ge,!1,I.length)}catch(Ke){if(Ke instanceof se)throw Ke;if(E&&!Qr(U,s))return I;if(We)return I;let Ge=Ke instanceof Error?Ke.message:String(Ke);return m("Expression",`Error evaluating: {{ ${U} }}: ${Ge}`,t,e,Z,I)}}),v.length>0)o=o.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(I,P)=>v[Number(P)]??I);if(c.length>0)o=o.replace(/<!--__STX_STYLE_(\d+)__-->/g,(I,P)=>c[Number(P)]??I);return o}function cu(e,s,t){if(!s.trim())return e;let o=e,a=s.trim();while(a.length>0){let h=a.match(/^(\w+)/);if(!h)break;let c=h[1];a=a.substring(c.length).trim();let v=qt[c]||ys[c];if(!v)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(ou()).join(", ")}`);let E=[];if(a.startsWith(":")){let R=a.match(/^:([^|\s]+)/);if(R){let C=R[1].trim();try{let O=Number(C);E=[Number.isNaN(O)?C:O]}catch{E=[C]}a=a.substring(R[0].length).trim()}}else if(a.startsWith("(")){let R=1,C=1;while(R>0&&C<a.length){if(a[C]==="(")R++;if(a[C]===")")R--;C++}if(R===0){let O=a.substring(1,C-1).trim();if(O)try{if(O.startsWith("{")&&O.endsWith("}"))E=[_(`(${O})`,t,!0)];else{let M=[],N="",I=null,P=0,Z=0,U=0,W=!1;for(let Y=0;Y<O.length;Y++){let ee=O[Y];if(W){N+=ee,W=!1;continue}if(ee==="\\"){N+=ee,W=!0;continue}if(I){if(N+=ee,ee===I)I=null;continue}if(ee==='"'||ee==="'"||ee==="`"){I=ee,N+=ee;continue}if(ee==="(")P++;else if(ee===")")P--;else if(ee==="[")Z++;else if(ee==="]")Z--;else if(ee==="{")U++;else if(ee==="}")U--;if(ee===","&&P===0&&Z===0&&U===0){M.push(N),N="";continue}N+=ee}if(N)M.push(N);E=M.map((Y)=>{let ee=Y.trim();return _(ee,t,!0)})}}catch{E=[O]}a=a.substring(C).trim()}}try{o=v(o,t,...E)}catch(R){let C=R instanceof Error?R.message:String(R);throw Error(`Error applying filter '${c}': ${C}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return o}function rc(e){let s=!1,t="",o=0,a=0,h=0,c=!1;for(let v=0;v<e.length;v++){let E=e[v],R=e[v+1];if(s&&c){c=!1;continue}if(s&&E==="\\"){c=!0;continue}if(c=!1,(E==='"'||E==="'"||E==="`")&&!c){if(!s)s=!0,t=E;else if(E===t)s=!1,t="";continue}if(s&&t==="`"&&E==="$"&&R==="{"){let C=1;v+=2;while(v<e.length&&C>0){if(e[v]==="{")C++;else if(e[v]==="}")C--;if(C>0)v++}continue}if(s)continue;if(E==="(")o++;else if(E===")")o--;else if(E==="[")a++;else if(E==="]")a--;else if(E==="{")h++;else if(E==="}")h--;if(E==="|"&&o===0&&a===0&&h===0){if(R==="|"){v++;continue}if(R==="="){v++;continue}return v}}return-1}var Zt=new Set,ic=1000;function Np(){Zt.clear()}function Is(e,s,t,o){if(!V())return;let a=`${t}\x00${e.expression}`;if(Zt.has(a))return;if(Zt.size>=ic)Zt.clear();Zt.add(a);let h=t,c=o;try{if(t&&Jr.existsSync(t))c=Jr.readFileSync(t,"utf8")}catch{}let v=c.indexOf(s);if(v>=0)h=`${t}:${c.slice(0,v).split(`
|
|
228
|
+
`).length}`;console.warn(`${h}: stx warning: ${s} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function _(e,s,t=!1,o){try{let a=e.trim(),h=rc(a);if(h>0){let v=a.substring(0,h).trim(),E=a.substring(h+1).trim(),R=_(v,s,!0,o);return cu(R,E,s)}let c=vs(a);if(c!==null){o?.({expression:a,rule:c});return}try{let v=Object.keys(s),E=Object.values(s);return u(a,v)(...E)}catch{return l(a,s)}}catch(a){if(a instanceof ReferenceError){let h=/(\b\w+)\s+is not defined/.exec(a.message);if(h){let c=h[1],v=oc(c,Object.keys(s));if(v&&v!==c)a.message=`${a.message} \u2014 did you mean '${v}'?`}}if(!t)console.error(`Error evaluating expression: ${e}`,a);throw a}}function oc(e,s){let t=null;for(let a of s){if(a===e)continue;let h=lc(e,a);if(t===null||h<t.dist)t={key:a,dist:h}}if(!t)return null;let o=Math.max(e.length,t.key.length);if(t.dist<=2||t.dist/o<=0.35)return t.key;return null}function lc(e,s){if(e===s)return 0;if(e.length===0)return s.length;if(s.length===0)return e.length;let[t,o]=e.length<s.length?[e,s]:[s,e],a=Array(t.length+1),h=Array(t.length+1);for(let c=0;c<=t.length;c++)a[c]=c;for(let c=1;c<=o.length;c++){h[0]=c;for(let v=1;v<=t.length;v++){let E=t[v-1]===o[c-1]?0:1;h[v]=Math.min(h[v-1]+1,a[v]+1,a[v-1]+E)}for(let v=0;v<=t.length;v++)a[v]=h[v]}return a[t.length]}function Dp(e){if(!e)return"";return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import uc from"process";function S(e="STX_PUBLIC_"){let s={},t={};for(let[o,a]of Object.entries(uc.env)){if(!o.startsWith(e)||a===void 0)continue;s[`import.meta.env.${o}`]=JSON.stringify(a),t[o]=a}return s["import.meta.env"]=JSON.stringify(t),s}function ri(e,s=""){let t=`${e}${s}`,o=0;for(let a=0;a<t.length;a++){let h=t.charCodeAt(a);o=(o<<5)-o+h,o=o&o}return`stx-${Math.abs(o).toString(36)}`}function ii(e,s,t={}){let{prefix:o="",preserveHost:a=!0,scopeKeyframes:h=!0,scopeCustomProperties:c=!1}=t;if(!e.trim())return"";let v=Os(e),E=[],R=new Map;if(h)for(let C of v){let O=C.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(O){let M=O[1],N=`${s}_${M}`;R.set(M,N)}}for(let C of v){let O=oi(C,s,o,a,R,c);E.push(O)}return E.join(`
|
|
229
229
|
|
|
230
230
|
`)}function Os(e){let s=[],t=e.replace(/\/\*[\s\S]*?\*\//g,""),o=0,a="",h=!1,c="";for(let v=0;v<t.length;v++){let E=t[v];if(E==="@"&&o===0)h=!0;if(E==="{")o++;else if(E==="}"){if(o--,o===0){if(h){c+=E;let R=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(R){let[,C,O,M]=R;if(C==="keyframes")s.push({selector:`@keyframes ${O.trim()}`,declarations:M.trim()});else if(C==="media"||C==="supports"||C==="container"){let N=Os(M);s.push({selector:`@${C} ${O.trim()}`,declarations:N.map((I)=>`${I.selector} { ${I.declarations} }`).join(`
|
|
231
231
|
`)})}else s.push({selector:`@${C} ${O.trim()}`,declarations:M.trim()})}c="",h=!1}else if(a.trim()){a+=E;let R=a.match(/([^{]+)\{([^}]*)\}/);if(R)s.push({selector:R[1].trim(),declarations:R[2].trim()});a=""}continue}}if(h)c+=E;else a+=E}return s}function oi(e,s,t,o,a,h){let{selector:c,declarations:v}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let C=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(C)||C} { ${v} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let O=Os(`x { ${v} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((M)=>oi(M,s,t,o,a,h)).join(`
|
|
232
232
|
`);return`${c} {
|
|
233
233
|
${O}
|
|
234
|
-
}`}return`${c} { ${v} }`}let E=fc(c,s,t,o),R=v;for(let[C,O]of a)R=R.replace(new RegExp(`\\b${C}\\b`,"g"),O);if(h)R=R.replace(/--([a-z-]+)/gi,`--${s}-$1`);return`${E} { ${R} }`}function fc(e,s,t,o){let a=e.split(",").map((c)=>c.trim()),h=[];for(let c of a){if(c.startsWith(":host")){if(o)h.push(c);else{let R=c.replace(/:host(\([^)]*\))?/,`.${s}$1`);h.push(R)}continue}if(c.includes("::slotted")){h.push(c);continue}if(c===":root"){h.push(`:root .${s}`);continue}let v=t?`${t} .${s}`:`.${s}`;h.push(`${v} ${c}`);let E=pc(c,s);if(E)h.push(t?`${t} ${E}`:E)}return h.join(", ")}function pc(e,s){let t=0,o=e.length;for(let E=0;E<e.length;E++){let R=e[E];if(R==="["||R==="(")t++;else if(R==="]"||R===")")t--;else if(t===0&&(R===" "||R===">"||R==="+"||R==="~")){o=E;break}}let a=e.slice(0,o),h=e.slice(o);if(!a)return"";let c=a.length,v=0;for(let E=0;E<a.length;E++){let R=a[E];if(R==="["||R==="(")v++;else if(R==="]"||R===")")v--;else if(t===0&&v===0&&R===":"){c=E;break}}return`${a.slice(0,c)}.${s}${a.slice(c)}${h}`}var li=String.raw`(?<![\w-])scoped(?![\w-])`,Ps=/<style\s+([^>]*)>/gi,ai=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,ui=new RegExp(li,"i"),dc=new RegExp(li,"gi"),Ms=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function gc(e){Ps.lastIndex=0;let s=Ps.exec(e);while(s!==null){if(ui.test(s[1]))return!0;s=Ps.exec(e)}return!1}function Ro(e){let s=new Set,t=[];Ms.lastIndex=0;let o=Ms.exec(e);while(o!==null){let a=o[0].trim();if(s.has(a))t.push({start:o.index,end:o.index+o[0].length});else s.add(a);o=Ms.exec(e)}return t}function an(e){let s=Ro(e);if(s.length===0)return e;let t=Array(s.length+1),o=0;for(let a=0;a<s.length;a++){let h=s[a];t[a]=e.slice(o,h.start),o=h.end}return t[s.length]=e.slice(o),t.join("")}function us(e,s){if(!gc(e))return{html:e,hasScoped:!1};let t=ri(s),o=`data-v-${t}`,a=e,h=!1;if(ai.lastIndex=0,a=a.replace(ai,(c,v,E)=>{if(!ui.test(v))return c;h=!0;let R=mc(E,o),C=v.replace(dc,"").trim(),O=C?` ${C}`:"";return`<style data-stx-scoped="${t}"${O}>${R}</style>`}),!h)return{html:e,hasScoped:!1};return a=xc(a,o),{html:a,hasScoped:!0}}function mc(e,s){return ii(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${s}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${s}]`)}var hc=(e)=>`\x00stx-scope-mask-${e}\x00`,ci=/\u0000stx-scope-mask-(\d+)\u0000/g;function xc(e,s){let t=le(e,(a,h)=>{let c=W(a,h);return c>h?c:on(a,h)},(a,h)=>hc(h)),o=bc(t.output,s);return ci.lastIndex=0,o.replace(ci,(a,h)=>t.tokens[Number(h)])}function bc(e,s){let t=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(o,a,h)=>{if(t.has(a.toLowerCase()))return o;if(o.includes(s))return o;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return o;if(h)return o.replace(`<${a}${h}`,`<${a} ${s}${h}`);if(o.endsWith("/>"))return`<${a} ${s} />`;return`<${a} ${s}>`})}var Xt=/<\/?template\b[^>]*>/gi,yc=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function _c(e){let s=e.replace(/^<template\b/i,"").replace(/>$/,"");return yc.test(s)}function ae(e){Xt.lastIndex=0;let s;while((s=Xt.exec(e))!==null){if(s[0].startsWith("</")||_c(s[0]))continue;let t=s.index,o=Xt.lastIndex,a=1,h;while((h=Xt.exec(e))!==null)if(h[0].startsWith("</")){if(a--,a===0){let c=h.index;return{start:t,openEnd:o,closeStart:c,end:Xt.lastIndex,content:e.slice(o,c)}}}else a++;return null}return null}function ps(e,s){let t=e,o=/@json\s*\(/g,a;while((a=o.exec(t))!==null){let h=a.index,c=h+a[0].length-1,v=1,E=c+1,R=null,C=!1;while(E<t.length&&v>0){let X=t[E];if(C){C=!1,E++;continue}if(X==="\\"&&R){C=!0,E++;continue}if(R){if(X===R)R=null;E++;continue}if(X==='"'||X==="'"||X==="`"){R=X,E++;continue}if(X==="(")v++;else if(X===")"){if(v--,v===0)break}E++}if(v!==0)break;let O=t.substring(c+1,E).trim(),M=t.substring(h,E+1),N=-1,I=0,P=null,Z=!1;for(let X=0;X<O.length;X++){let Y=O[X];if(Z){Z=!1;continue}if(Y==="\\"&&P){Z=!0;continue}if(P){if(Y===P)P=null;continue}if(Y==='"'||Y==="'"||Y==="`"){P=Y;continue}if(Y==="("||Y==="["||Y==="{")I++;else if(Y===")"||Y==="]"||Y==="}")I--;if(Y===","&&I===0){N=X;break}}let U=N>=0?O.substring(0,N).trim():O,V=N>=0?O.substring(N+1).trim():void 0;try{let X=U.trim(),Y;if(p(X))Y=u(X,Object.keys(s))(...Object.values(s));else Y=void 0;let Q;if(V==="true")Q=JSON.stringify(Y,null,2);else Q=JSON.stringify(Y);let re=Q.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");t=t.substring(0,h)+re+t.substring(E+1),o.lastIndex=h+re.length}catch(X){D.log(X instanceof Error?X:Error(String(X)),{directive:"@json"},"error"),o.lastIndex=h+M.length}}return t}function gs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function ja(e){let s=e,t=/@memo\s*\(/g,o,a=[];while((o=t.exec(s))!==null){let h=o.index,c=h+o[0].length,v=1,E=c;while(E<s.length&&v>0){if(s[E]==="(")v++;else if(s[E]===")")v--;E++}if(v!==0)continue;let R=s.slice(c,E-1).trim(),C=E,O=s.slice(C),M=O.indexOf("@endmemo");if(M===-1)continue;let N=O.slice(0,M),I=C+M+8,P=N.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),Z=P?P[0].length:0,U=N.slice(Z),V=N.match(/(\s*)$/),X=V?V[0].length:0,Y=U.slice(0,U.length-X),Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),re;if(Q){let[pe,Ee,ke="",We]=Q,Te=`<${Ee}${ke} data-stx-memo="${R}"${We}>`;re=N.slice(0,Z)+Te+Y.slice(pe.length)+N.slice(Z+Y.length)}else re=`${N.slice(0,Z)}<div data-stx-memo="${R}">${Y}</div>${N.slice(Z+Y.length)}`;a.push({start:h,end:I,replacement:re}),t.lastIndex=I}for(let h=a.length-1;h>=0;h--){let c=a[h];s=s.slice(0,c.start)+c.replacement+s.slice(c.end)}return s.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Ao(e){let s=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return s=s.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),s}function gi(e,s){if(!/\bref\s*=/.test(e))return e;let t=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,o=ce(e,(E,R)=>{t.lastIndex=R;let C=t.exec(E);if(!C||/^(?:script|style)$/i.test(C[1]))return-1;return t.lastIndex}),a=[],h=0,c=0,v=[];for(let{start:E,end:R,token:C}of o){let O=/^<\/?([\w-]+)/.exec(C)[1].toLowerCase();if(C.startsWith("</")){let N;while(N=a.pop()){if(N.scoped)h--;if(N.name===O)break}continue}let M=/\sdata-stx-scope\s*=/.test(C);if(!h&&!M&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(C)&&!/\sdata-stx-ref-caller\s*=/.test(C))v.push(e.slice(c,E),C.replace(/\s*\/?>$/,(N)=>` data-stx-ref-caller="${s}"${N}`)),c=R;if(!mi.has(O)&&!/\/>$/.test(C)){if(a.push({name:O,scoped:M}),M)h++}}return v.push(e.slice(c)),v.join("")}var mi=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),hi=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,fi=/<\/?\s*([a-z][\w-]*)/iy,wc=/\s/;function Sc(e,s){let t=s-1;while(t>=0&&wc.test(e[t]))t--;return t>=0&&e[t]==="/"}function $c(e,s){let t=!1,o=!1;for(let a=s;a<e.length;a++){let h=e[a];if(t){if(h==="'")t=!1}else if(o){if(h==='"')o=!1}else if(h==="'")t=!0;else if(h==='"')o=!0;else if(h===">")return a}return-1}function vc(e,s){if(e.indexOf("{",s)===-1||e.indexOf("}",s)===-1)return!1;let t=0,o=s,a=!1,h=!1,c=!1;while(o<e.length){let v=e.indexOf("<",o),E=v===-1?e.length:v;if(E>o){if(t===0)while(o<E){let O=e.indexOf(h?"}":"{",o);if(O===-1||O>=E){if(h)c=!1;else a=!1;break}if(O>o)if(h)c=!1;else a=!1;if(h){if(c)return!0;c=!0}else if(a)h=!0,c=!1;else a=!0;o=O+1}o=E;continue}if(e.startsWith("<!--",o)){let O=e.indexOf("-->",o);o=O===-1?e.length:O+3;continue}let R=$c(e,o);if(R===-1)break;fi.lastIndex=o;let C=fi.exec(e)?.[1]?.toLowerCase()??"";if(e[o+1]==="/"){if(t===0)break;t--}else if(!Sc(e,R)&&!mi.has(C))t++;o=R+1}return!1}var pi=y(256);function Ba(e){if(e.length<1024)return di(e);let s=b(e),t=pi.get(s);if(t!==void 0)return t;let o=di(e);return pi.set(s,o),o}function di(e){if(e.length>=32768&&!Zr(e))return e;let t=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),o="",a=0,h;while((h=t.exec(e))!==null){let c=h.index,v=c+h[0].length,E=!1,R=!1,C=-1;while(v<e.length){let M=e[v];if(E){if(M==="'")E=!1}else if(R){if(M==='"')R=!1}else if(M==="'")E=!0;else if(M==='"')R=!0;else if(M===">"){C=v;break}v++}if(C===-1)continue;let O=e.slice(c,C+1);if(hi.test(O))continue;if(O.includes("x-cloak"))continue;if(vc(e,C+1))o+=e.slice(a,C)+" x-cloak>",a=C+1}return o+=e.slice(a),o}var Ec=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,kc=/<\/script>/gi,Rc=/<\/style>/gi;function Fa(e){let s=/<[a-z][\w-]*/gi,t="",o=0,a;while((a=s.exec(e))!==null){let h=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let I=c==="script"?kc:Rc;I.lastIndex=h;let P=I.exec(e);if(P!==null)s.lastIndex=P.index+P[0].length;continue}let v=h+a[0].length,E=!1,R=!1,C=-1;while(v<e.length){let I=e[v];if(E){if(I==="'")E=!1}else if(R){if(I==='"')R=!1}else if(I==="'")E=!0;else if(I==='"')R=!0;else if(I===">"){C=v;break}v++}if(C===-1)continue;let O=e.slice(h+a[0].length,C);if(hi.test(O))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(O))continue;if(!Ec.test(O))continue;let M=e[C-1]==="/",N=M?C-1:C;t+=`${e.slice(o,N)} x-cloak${M?" ":""}`,o=N}return t+=e.slice(o),t}import Ti from"path";import js from"fs";import Jt from"path";function xi(e,s,t,o){let a=0;for(let h=s;h<e.length;h++)if(e[h]===t)a++;else if(e[h]===o&&!(o===">"&&e[h-1]==="=")){if(--a===0)return h}return-1}function Cc(e){let s=i(e),t=0,o=0,a=[];for(let h=0;h<s.length;h++)if("([{".includes(s[h]))t++;else if(")]}".includes(s[h]))t--;else if(s[h]===","&&t===0)a.push(e.slice(o,h).trim()),o=h+1;return a.push(e.slice(o).trim()),a}function Ds(e,s){let t=i(e),o=new RegExp(`\\b(?:${s.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of t.matchAll(o)){let h=a.index+a[0].length,c="";if(t[h]==="<"){let E=xi(t,h,"<",">");if(E<0)continue;c=e.slice(h+1,E),h=E+1;while(/\s/.test(t[h]||"")&&h<t.length)h++}if(t[h]!=="(")continue;let v=xi(t,h,"(",")");if(v>=0)return{type:c,args:Cc(e.slice(h+1,v))}}return null}var bi=`
|
|
234
|
+
}`}return`${c} { ${v} }`}let E=fc(c,s,t,o),R=v;for(let[C,O]of a)R=R.replace(new RegExp(`\\b${C}\\b`,"g"),O);if(h)R=R.replace(/--([a-z-]+)/gi,`--${s}-$1`);return`${E} { ${R} }`}function fc(e,s,t,o){let a=e.split(",").map((c)=>c.trim()),h=[];for(let c of a){if(c.startsWith(":host")){if(o)h.push(c);else{let R=c.replace(/:host(\([^)]*\))?/,`.${s}$1`);h.push(R)}continue}if(c.includes("::slotted")){h.push(c);continue}if(c===":root"){h.push(`:root .${s}`);continue}let v=t?`${t} .${s}`:`.${s}`;h.push(`${v} ${c}`);let E=pc(c,s);if(E)h.push(t?`${t} ${E}`:E)}return h.join(", ")}function pc(e,s){let t=0,o=e.length;for(let E=0;E<e.length;E++){let R=e[E];if(R==="["||R==="(")t++;else if(R==="]"||R===")")t--;else if(t===0&&(R===" "||R===">"||R==="+"||R==="~")){o=E;break}}let a=e.slice(0,o),h=e.slice(o);if(!a)return"";let c=a.length,v=0;for(let E=0;E<a.length;E++){let R=a[E];if(R==="["||R==="(")v++;else if(R==="]"||R===")")v--;else if(t===0&&v===0&&R===":"){c=E;break}}return`${a.slice(0,c)}.${s}${a.slice(c)}${h}`}var li=String.raw`(?<![\w-])scoped(?![\w-])`,Ps=/<style\s+([^>]*)>/gi,ai=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,ui=new RegExp(li,"i"),dc=new RegExp(li,"gi"),Ms=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function gc(e){Ps.lastIndex=0;let s=Ps.exec(e);while(s!==null){if(ui.test(s[1]))return!0;s=Ps.exec(e)}return!1}function Ao(e){let s=new Set,t=[];Ms.lastIndex=0;let o=Ms.exec(e);while(o!==null){let a=o[0].trim();if(s.has(a))t.push({start:o.index,end:o.index+o[0].length});else s.add(a);o=Ms.exec(e)}return t}function an(e){let s=Ao(e);if(s.length===0)return e;let t=Array(s.length+1),o=0;for(let a=0;a<s.length;a++){let h=s[a];t[a]=e.slice(o,h.start),o=h.end}return t[s.length]=e.slice(o),t.join("")}function ds(e,s){if(!gc(e))return{html:e,hasScoped:!1};let t=ri(s),o=`data-v-${t}`,a=e,h=!1;if(ai.lastIndex=0,a=a.replace(ai,(c,v,E)=>{if(!ui.test(v))return c;h=!0;let R=mc(E,o),C=v.replace(dc,"").trim(),O=C?` ${C}`:"";return`<style data-stx-scoped="${t}"${O}>${R}</style>`}),!h)return{html:e,hasScoped:!1};return a=xc(a,o),{html:a,hasScoped:!0}}function mc(e,s){return ii(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${s}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${s}]`)}var hc=(e)=>`\x00stx-scope-mask-${e}\x00`,ci=/\u0000stx-scope-mask-(\d+)\u0000/g;function xc(e,s){let t=de(e,(a,h)=>{let c=q(a,h);return c>h?c:on(a,h)},(a,h)=>hc(h)),o=bc(t.output,s);return ci.lastIndex=0,o.replace(ci,(a,h)=>t.tokens[Number(h)])}function bc(e,s){let t=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(o,a,h)=>{if(t.has(a.toLowerCase()))return o;if(o.includes(s))return o;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return o;if(h)return o.replace(`<${a}${h}`,`<${a} ${s}${h}`);if(o.endsWith("/>"))return`<${a} ${s} />`;return`<${a} ${s}>`})}var Xt=/<\/?template\b[^>]*>/gi,yc=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function _c(e){let s=e.replace(/^<template\b/i,"").replace(/>$/,"");return yc.test(s)}function le(e){Xt.lastIndex=0;let s;while((s=Xt.exec(e))!==null){if(s[0].startsWith("</")||_c(s[0]))continue;let t=s.index,o=Xt.lastIndex,a=1,h;while((h=Xt.exec(e))!==null)if(h[0].startsWith("</")){if(a--,a===0){let c=h.index;return{start:t,openEnd:o,closeStart:c,end:Xt.lastIndex,content:e.slice(o,c)}}}else a++;return null}return null}function gs(e,s){let t=e,o=/@json\s*\(/g,a;while((a=o.exec(t))!==null){let h=a.index,c=h+a[0].length-1,v=1,E=c+1,R=null,C=!1;while(E<t.length&&v>0){let Y=t[E];if(C){C=!1,E++;continue}if(Y==="\\"&&R){C=!0,E++;continue}if(R){if(Y===R)R=null;E++;continue}if(Y==='"'||Y==="'"||Y==="`"){R=Y,E++;continue}if(Y==="(")v++;else if(Y===")"){if(v--,v===0)break}E++}if(v!==0)break;let O=t.substring(c+1,E).trim(),M=t.substring(h,E+1),N=-1,I=0,P=null,Z=!1;for(let Y=0;Y<O.length;Y++){let ee=O[Y];if(Z){Z=!1;continue}if(ee==="\\"&&P){Z=!0;continue}if(P){if(ee===P)P=null;continue}if(ee==='"'||ee==="'"||ee==="`"){P=ee;continue}if(ee==="("||ee==="["||ee==="{")I++;else if(ee===")"||ee==="]"||ee==="}")I--;if(ee===","&&I===0){N=Y;break}}let U=N>=0?O.substring(0,N).trim():O,W=N>=0?O.substring(N+1).trim():void 0;try{let Y=U.trim(),ee;if(p(Y))ee=u(Y,Object.keys(s))(...Object.values(s));else ee=void 0;let te;if(W==="true")te=JSON.stringify(ee,null,2);else te=JSON.stringify(ee);let oe=te.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");t=t.substring(0,h)+oe+t.substring(E+1),o.lastIndex=h+oe.length}catch(Y){D.log(Y instanceof Error?Y:Error(String(Y)),{directive:"@json"},"error"),o.lastIndex=h+M.length}}return t}function ms(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Ba(e){let s=e,t=/@memo\s*\(/g,o,a=[];while((o=t.exec(s))!==null){let h=o.index,c=h+o[0].length,v=1,E=c;while(E<s.length&&v>0){if(s[E]==="(")v++;else if(s[E]===")")v--;E++}if(v!==0)continue;let R=s.slice(c,E-1).trim(),C=E,O=s.slice(C),M=O.indexOf("@endmemo");if(M===-1)continue;let N=O.slice(0,M),I=C+M+8,P=N.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),Z=P?P[0].length:0,U=N.slice(Z),W=N.match(/(\s*)$/),Y=W?W[0].length:0,ee=U.slice(0,U.length-Y),te=ee.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),oe;if(te){let[ge,Ee,ke="",We]=te,Te=`<${Ee}${ke} data-stx-memo="${R}"${We}>`;oe=N.slice(0,Z)+Te+ee.slice(ge.length)+N.slice(Z+ee.length)}else oe=`${N.slice(0,Z)}<div data-stx-memo="${R}">${ee}</div>${N.slice(Z+ee.length)}`;a.push({start:h,end:I,replacement:oe}),t.lastIndex=I}for(let h=a.length-1;h>=0;h--){let c=a[h];s=s.slice(0,c.start)+c.replacement+s.slice(c.end)}return s.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Po(e){let s=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return s=s.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),s}function gi(e,s){if(!/\bref\s*=/.test(e))return e;let t=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,o=ue(e,(E,R)=>{t.lastIndex=R;let C=t.exec(E);if(!C||/^(?:script|style)$/i.test(C[1]))return-1;return t.lastIndex}),a=[],h=0,c=0,v=[];for(let{start:E,end:R,token:C}of o){let O=/^<\/?([\w-]+)/.exec(C)[1].toLowerCase();if(C.startsWith("</")){let N;while(N=a.pop()){if(N.scoped)h--;if(N.name===O)break}continue}let M=/\sdata-stx-scope\s*=/.test(C);if(!h&&!M&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(C)&&!/\sdata-stx-ref-caller\s*=/.test(C))v.push(e.slice(c,E),C.replace(/\s*\/?>$/,(N)=>` data-stx-ref-caller="${s}"${N}`)),c=R;if(!mi.has(O)&&!/\/>$/.test(C)){if(a.push({name:O,scoped:M}),M)h++}}return v.push(e.slice(c)),v.join("")}var mi=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),hi=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,fi=/<\/?\s*([a-z][\w-]*)/iy,wc=/\s/;function Sc(e,s){let t=s-1;while(t>=0&&wc.test(e[t]))t--;return t>=0&&e[t]==="/"}function $c(e,s){let t=!1,o=!1;for(let a=s;a<e.length;a++){let h=e[a];if(t){if(h==="'")t=!1}else if(o){if(h==='"')o=!1}else if(h==="'")t=!0;else if(h==='"')o=!0;else if(h===">")return a}return-1}function vc(e,s){if(e.indexOf("{",s)===-1||e.indexOf("}",s)===-1)return!1;let t=0,o=s,a=!1,h=!1,c=!1;while(o<e.length){let v=e.indexOf("<",o),E=v===-1?e.length:v;if(E>o){if(t===0)while(o<E){let O=e.indexOf(h?"}":"{",o);if(O===-1||O>=E){if(h)c=!1;else a=!1;break}if(O>o)if(h)c=!1;else a=!1;if(h){if(c)return!0;c=!0}else if(a)h=!0,c=!1;else a=!0;o=O+1}o=E;continue}if(e.startsWith("<!--",o)){let O=e.indexOf("-->",o);o=O===-1?e.length:O+3;continue}let R=$c(e,o);if(R===-1)break;fi.lastIndex=o;let C=fi.exec(e)?.[1]?.toLowerCase()??"";if(e[o+1]==="/"){if(t===0)break;t--}else if(!Sc(e,R)&&!mi.has(C))t++;o=R+1}return!1}var pi=y(256);function Fa(e){if(e.length<1024)return di(e);let s=b(e),t=pi.get(s);if(t!==void 0)return t;let o=di(e);return pi.set(s,o),o}function di(e){if(e.length>=32768&&!Zr(e))return e;let t=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),o="",a=0,h;while((h=t.exec(e))!==null){let c=h.index,v=c+h[0].length,E=!1,R=!1,C=-1;while(v<e.length){let M=e[v];if(E){if(M==="'")E=!1}else if(R){if(M==='"')R=!1}else if(M==="'")E=!0;else if(M==='"')R=!0;else if(M===">"){C=v;break}v++}if(C===-1)continue;let O=e.slice(c,C+1);if(hi.test(O))continue;if(O.includes("x-cloak"))continue;if(vc(e,C+1))o+=e.slice(a,C)+" x-cloak>",a=C+1}return o+=e.slice(a),o}var Ec=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,kc=/<\/script>/gi,Rc=/<\/style>/gi;function za(e){let s=/<[a-z][\w-]*/gi,t="",o=0,a;while((a=s.exec(e))!==null){let h=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let I=c==="script"?kc:Rc;I.lastIndex=h;let P=I.exec(e);if(P!==null)s.lastIndex=P.index+P[0].length;continue}let v=h+a[0].length,E=!1,R=!1,C=-1;while(v<e.length){let I=e[v];if(E){if(I==="'")E=!1}else if(R){if(I==='"')R=!1}else if(I==="'")E=!0;else if(I==='"')R=!0;else if(I===">"){C=v;break}v++}if(C===-1)continue;let O=e.slice(h+a[0].length,C);if(hi.test(O))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(O))continue;if(!Ec.test(O))continue;let M=e[C-1]==="/",N=M?C-1:C;t+=`${e.slice(o,N)} x-cloak${M?" ":""}`,o=N}return t+=e.slice(o),t}import Ti from"path";import js from"fs";import Jt from"path";function xi(e,s,t,o){let a=0;for(let h=s;h<e.length;h++)if(e[h]===t)a++;else if(e[h]===o&&!(o===">"&&e[h-1]==="=")){if(--a===0)return h}return-1}function Cc(e){let s=i(e),t=0,o=0,a=[];for(let h=0;h<s.length;h++)if("([{".includes(s[h]))t++;else if(")]}".includes(s[h]))t--;else if(s[h]===","&&t===0)a.push(e.slice(o,h).trim()),o=h+1;return a.push(e.slice(o).trim()),a}function Ds(e,s){let t=i(e),o=new RegExp(`\\b(?:${s.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of t.matchAll(o)){let h=a.index+a[0].length,c="";if(t[h]==="<"){let E=xi(t,h,"<",">");if(E<0)continue;c=e.slice(h+1,E),h=E+1;while(/\s/.test(t[h]||"")&&h<t.length)h++}if(t[h]!=="(")continue;let v=xi(t,h,"(",")");if(v>=0)return{type:c,args:Cc(e.slice(h+1,v))}}return null}var bi=`
|
|
235
235
|
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
236
236
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
237
237
|
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
@@ -239,68 +239,68 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
|
|
|
239
239
|
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
240
240
|
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
241
241
|
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
242
|
-
`;function yi(e,s){let t=[],o={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=i(e),h=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(M,N,I,P,Z)=>{if(a.slice(Z,Z+6)!=="import")return M;if(P.endsWith(".stx"))return"";let U=`${s}Import${t.length}`;if(t.push(`import * as ${U} from ${JSON.stringify(P)};`),N.startsWith("*"))return`import ${N.replace(/^\*\s+as\s+/,"")} = ${U};`;if(!N.startsWith("{"))return`import ${N} = ${U}.default;`;return N.slice(1,-1).split(",").map((
|
|
242
|
+
`;function yi(e,s){let t=[],o={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=i(e),h=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(M,N,I,P,Z)=>{if(a.slice(Z,Z+6)!=="import")return M;if(P.endsWith(".stx"))return"";let U=`${s}Import${t.length}`;if(t.push(`import * as ${U} from ${JSON.stringify(P)};`),N.startsWith("*"))return`import ${N.replace(/^\*\s+as\s+/,"")} = ${U};`;if(!N.startsWith("{"))return`import ${N} = ${U}.default;`;return N.slice(1,-1).split(",").map((W)=>{let[Y,ee=Y]=W.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!Y)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(P)&&Y in o)o[Y].push(ee);return`import ${ee} = ${U}.${Y};`}).join(`
|
|
243
243
|
`)}),c=Ds(e,o.defineProps),v=Ds(e,o.defineEmits),E=Ds(e,o.withDefaults);if(!c&&!v)return{declarations:"",props:null,events:null};let R=[],C=null,O=null;if(c){R.push(`const __options = (${c.args[0]||"{}"}) as const;`),R.push(`const __defaults = (${E?.args[1]||"{}"});`);let M=c.type||"__StxOptions<typeof __options>";R.push(`export type __StxProps = __StxDefaults<${M}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),C=`${s}.__StxProps`}if(v)R.push(`const __events = (${v.args[0]||"[]"}) as const;`),R.push(`export type __StxEvents = ${v.type||"Record<(typeof __events)[number], any[]>"};`),O=`${s}.__StxEvents`;return{declarations:`${t.join(`
|
|
244
244
|
`)}
|
|
245
245
|
namespace ${s} {
|
|
246
246
|
${h}
|
|
247
247
|
${R.join(`
|
|
248
248
|
`)}
|
|
249
|
-
}`,props:C,events:O}}var
|
|
249
|
+
}`,props:C,events:O}}var ar=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 cr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...ar].some((s)=>s.toLowerCase()===e.toLowerCase());return ar.has(e)||/[A-Z]/.test(e)}function*Tc(e){let s=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,t;while(t=s.exec(e)){let o=s.lastIndex,a=[];while(o<e.length){while(/\s/.test(e[o]||""))o++;if(e[o]===">"||e.slice(o,o+2)==="/>"){o+=e[o]===">"?1:2;break}let h=/^[^\s=/>]+/.exec(e.slice(o))?.[0];if(!h){o++;continue}let c=o;o+=h.length;while(/\s/.test(e[o]||""))o++;if(e[o]!=="="){a.push({name:h,value:!0,offset:c,braced:!1});continue}o++;while(/\s/.test(e[o]||""))o++;let v=e[o],E=v==="{",R=v==='"'||v==="'";if(R||E)o++;let C=o;if(E){let O=i(e.slice(o)),M=1,N=0;for(;N<O.length;N++){if(O[N]==="{")M++;if(O[N]==="}"&&--M===0)break}o+=N}else if(R)while(o<e.length&&e[o]!==v)o++;else while(o<e.length&&!/[\s/>]/.test(e[o]))o++;if(a.push({name:h,value:e.slice(C,o),offset:C,braced:E}),R||E)o++}s.lastIndex=o,yield{name:t[1],offset:t.index,attributes:a}}}function _i(e,s,t){let o=[],a=[bi,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],h=new Map,c=new Map,v=new Map,E=t.scriptCode(e,t.filePath),R=i(E);for(let I of E.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(R.slice(I.index,I.index+6)!=="import")continue;let P=I[2],Z=Jt.isAbsolute(P)||P.startsWith(".")?Jt.resolve(Jt.dirname(t.filePath),P):is(P,Jt.dirname(t.filePath));if(!Z)continue;let U=Z.endsWith(".stx")?Z:js.existsSync(`${Z}.stx`)?`${Z}.stx`:void 0,W=U?null:os(Z,!1),Y=I[1].startsWith("{")?I[1].slice(1,-1).split(","):[I[1]];for(let ee of Y){let[te,oe=te]=ee.trim().split(/\s+as\s+/),ge=U||W?.get(te)||W?.get(te.toLowerCase());if(ge)v.set(oe,ge),v.set(oe.toLowerCase(),ge),v.set(oe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ge)}}for(let I of s.matchAll(/@import\s*\(([^)]+)\)/g))for(let P of I[1].matchAll(/['"]([^'"]+)['"]/g)){let Z=as(P[1],t.filePath,t).find((U)=>js.statSync(U,{throwIfNoEntry:!1})?.isFile());if(Z)v.set(Jt.basename(P[1]).replace(/\.stx$/,""),Z)}let C={__importedComponents:v},O=new Map,M=(I,P,Z)=>{let U=e.slice(0,I);return{code:P,offset:I,attribute:Z,anchor:!0,kind:"directive",line:U.split(`
|
|
250
250
|
`).length,column:I-U.lastIndexOf(`
|
|
251
|
-
`)}},N=(I,P,Z)=>o.push({expression:I,statement:{text:P+I.code+Z,prefixLength:P.length}});for(let I of Tc(s)){if(
|
|
251
|
+
`)}},N=(I,P,Z)=>o.push({expression:I,statement:{text:P+I.code+Z,prefixLength:P.length}});for(let I of Tc(s)){if(cr(I.name)||I.name==="component")continue;let P=gr(I.name,t.filePath,t,C);if(!P)continue;let Z=O.get(P);if(!Z){let W;try{W=t.readComponent?t.readComponent(P):js.readFileSync(P,"utf8")}catch{continue}if(W===void 0)continue;c.set(P,W),Z=yi(t.scriptCode(W,P),`__StxComponent${O.size}`),O.set(P,Z),a.push(Z.declarations)}let U=[];for(let W of I.attributes){let{name:Y,offset:ee}=W,te=W.value===!0?"true":W.value;if(Y.startsWith("@")||Y.startsWith("v-on:")){if(Z.events&&W.value!==!0)h.set(ee,`__StxEvent<${Z.events}, ${JSON.stringify(Y.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let oe=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(Y);if(Y.startsWith("v-")&&!Y.startsWith("v-bind:")&&!oe)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(Y))continue;let ge=(oe?oe[1]||"modelValue":Y.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(We,Te)=>Te.toUpperCase());if(U.push(ge),!Z.props)continue;let ke=Y.startsWith(":")||Y.startsWith("v-bind:")||!!oe||W.braced?te:W.value!==!0?JSON.stringify(te):"true";N(M(ee,ke,Y),";void ((",`) satisfies __StxProp<${Z.props}, ${JSON.stringify(ge)}>);`)}if(Z.props){let W=[...new Set(U)].map((ee)=>`${JSON.stringify(ee)}: undefined as any`).join(", "),Y=M(I.offset,`<${I.name}>`);o.push({expression:Y,statement:{text:`;void ({ ${W} } satisfies ${Z.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:O.size?a.join(`
|
|
252
252
|
`):"",checks:o,events:h,dependencies:c}}var wi=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Ac(e){let s=(t)=>t.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,s).replace(/\{\{--[\s\S]*?--\}\}/g,s)}function $t(e){let s=[],t=Ac(e);wi.lastIndex=0;let o;while((o=wi.exec(t))!==null){let a=(o[1]||"").trim(),h=(o[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(o[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,v=o.index+h,E=o.index+o[0].length-c,R=e.slice(v,E);if(/\bsrc\s*=/.test(a))continue;let C=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(C&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(C[1]))continue;let O=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",M=Gt(e,v);s.push({kind:O,code:R,startLine:M,startColumn:Yt(e,v),offset:v,attrs:a})}return s}function Gt(e,s){let t=1;for(let o=0;o<s&&o<e.length;o++)if(e.charCodeAt(o)===10)t++;return t}function Yt(e,s){let t=e.lastIndexOf(`
|
|
253
253
|
`,s-1)+1;return s-t+1}function Bn(e){let s=e.split(""),t=(a,h)=>{for(let c=a;c<h&&c<s.length;c++)if(s[c]!==`
|
|
254
|
-
`)s[c]=" "},o=[/<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 o){a.lastIndex=0;let h;while((h=a.exec(e))!==null)t(h.index,h.index+h[0].length)}return s.join("")}function Ic(e){let s=0,t="";for(let o=0;o<e.length;o++){let a=e[o];if(t){if(a==="\\"){o++;continue}if(a===t)t="";continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{"){s++;continue}if(a===")"||a==="]"||a==="}"){s--;continue}if(a==="|"&&s===0){if(e[o+1]==="|"){o++;continue}if(e[o-1]==="|")continue;return e.slice(0,o)}}return e}var Ai=new Set([":for","x-for","v-for"]),zn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Ns="__stx_interpolated",Si="__StxElement",Ii="__StxTemplateValue",Oc=`type ${Ii}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function $i(e){return e.replace(/\{\{[\s\S]*?\}\}/g,Ns).replace(/\{!![\s\S]*?!!\}/g,Ns)}function
|
|
254
|
+
`)s[c]=" "},o=[/<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 o){a.lastIndex=0;let h;while((h=a.exec(e))!==null)t(h.index,h.index+h[0].length)}return s.join("")}function Ic(e){let s=0,t="";for(let o=0;o<e.length;o++){let a=e[o];if(t){if(a==="\\"){o++;continue}if(a===t)t="";continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{"){s++;continue}if(a===")"||a==="]"||a==="}"){s--;continue}if(a==="|"&&s===0){if(e[o+1]==="|"){o++;continue}if(e[o-1]==="|")continue;return e.slice(0,o)}}return e}var Ai=new Set([":for","x-for","v-for"]),zn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Ns="__stx_interpolated",Si="__StxElement",Ii="__StxTemplateValue",Oc=`type ${Ii}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function $i(e){return e.replace(/\{\{[\s\S]*?\}\}/g,Ns).replace(/\{!![\s\S]*?!!\}/g,Ns)}function Eo(e){return e.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(s)=>{let t=s.split(`
|
|
255
255
|
`).length-1,o=s.length-t;return`0${" ".repeat(Math.max(0,o-1))}${`
|
|
256
|
-
`.repeat(t)}`})}var Pc=["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"],Mc=new RegExp(String.raw`^[ \t]*@(?:${Pc.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function
|
|
257
|
-
`)}function
|
|
256
|
+
`.repeat(t)}`})}var Pc=["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"],Mc=new RegExp(String.raw`^[ \t]*@(?:${Pc.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function To(e){return e.replace(Mc,(s)=>s.replace(/[^\n]/g," "))}var vi=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function zl(e){let s=Bn(e),t=[],o=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=o.exec(s))!==null){if(a[1]||a[3])continue;let v=a[2]??a[4]??"",E=a[2]!==void 0?2:3,R=Ic(v);if(!R.trim())continue;let C=a.index+E+(R.length-R.trimStart().length);t.push({code:R.trim(),line:Gt(s,C),column:Yt(s,C),offset:C,kind:"interpolation"})}let h=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=h.exec(s))!==null){let c=a.index+a[0].length-1,v=0,E=c;for(;E<s.length;E++){let M=s[E];if(M==="(")v++;else if(M===")"){if(v--,v===0)break}}if(v!==0)continue;let R=s.slice(c+1,E),C=R.trim();if(h.lastIndex=E+1,!C)continue;let O=c+1+(R.length-R.trimStart().length);t.push({code:C,line:Gt(s,O),column:Yt(s,O),offset:a.index,kind:"condition"})}zn.lastIndex=0;while((a=zn.exec(s))!==null){let c=a[1],v=a[3]??"",E=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(vi.has(E)||vi.has(c))continue;if(!v.trim())continue;let R=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(Ai.has(E)){let O=v.match(/\s+(?:in|of)\s+/);if(!O||O.index===void 0)continue;let M=v.slice(O.index+O[0].length),N=O.index+O[0].length+(M.length-M.trimStart().length);t.push({code:$i(M.trim()),line:Gt(s,R+N),column:Yt(s,R+N),offset:R+N,kind:"directive",attribute:E});continue}let C=v.length-v.trimStart().length;t.push({code:$i(v.trim()),line:Gt(s,R+C),column:Yt(s,R+C),offset:R+C,kind:"directive",attribute:E})}return t.sort((c,v)=>c.line-v.line||c.column-v.column),t}var Dc=2000;function jc(e,s){let t=0,o=Math.min(e.length,s+Dc);for(let a=s;a<o;a++){let h=e[a];if(h==="(")t++;else if(h===")"){if(t--,t===0)return e.slice(s+1,a)}}return null}function Nc(e){let s=new Map,t=(v,E)=>{let R=v.split(/[,[\]{}()\s]+/).filter(Boolean);for(let C of R){let O=C.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(O))continue;let M=R.length===1?E:void 0,N=s.get(O);if(!N)s.set(O,{name:O,iterable:M});else if(N.iterable!==M)N.iterable=void 0}},o=/^\$?[A-Z_$][\w$]*$/i,a=(v)=>{let E=v.trim();return o.test(E)?E:void 0};for(let v of e.matchAll(/@for(?:each|else)\s*\(/g)){let E=jc(e,v.index+v[0].length-1);if(E===null)continue;let R=Tt(E);if(!R)continue;t(R.itemVar.replace(/=>/g," "),a(R.arrayExpr))}for(let v of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))t(v[1],v[2]==="of"?a(v[3]):void 0);for(let v of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))t(v[1]);let h=Bn(e);zn.lastIndex=0;let c;while((c=zn.exec(h))!==null){let v=c[1].replace(/\..*$/,"");if(!Ai.has(v))continue;let E=c[3].match(/\s+(?:in|of)\s+/);if(!E||E.index===void 0)continue;t(c[3].slice(0,E.index),a(c[3].slice(E.index+E[0].length)))}for(let v of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let E of v[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))t(E[1]);return[...s.values()].sort((v,E)=>v.name.localeCompare(E.name))}function Ie(e){let s=new Set;for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))s.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))s.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))s.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let o of t[1].split(",")){let a=o.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))s.add(a)}return[...s].sort()}var Ls=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Lc={$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 Aa(e=new Set){return[...Ls.filter((s)=>!e.has(s)).map((s)=>`declare var ${s}: any`),...Object.entries(Lc).filter(([s])=>!e.has(s)).map(([,s])=>s)].join(`
|
|
257
|
+
`)}function Pa(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((s)=>s[1]))}function Oi(e){let s=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,t,o=!1,a=new Set,h=i(e);while((t=s.exec(h))!==null){o=!0;for(let c of Bc(t[1])){let v=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(v))a.add(v)}}return o?[...a]:null}function Bc(e){let s=[],t=0,o="";for(let a of e){if(a===","&&t===0){s.push(o),o="";continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;o+=a}return s.push(o),s.filter((a)=>a.trim().length>0)}function zc(e){let s=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,t=[],o=e.replace(s,(a)=>(t.push(a.trim()),a.split(`
|
|
258
258
|
`).map(()=>"").join(`
|
|
259
259
|
`)));return{imports:t.join(`
|
|
260
260
|
`),body:o}}function Pi(e){let s=i(e),t=Array(s.length),o=0;for(let v=0;v<s.length;v++){let E=s[v];if(E==="}"||E===")"||E==="]")o=Math.max(0,o-1);if(t[v]=o,E==="{"||E==="("||E==="[")o++}let a=[],h=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=h.exec(s))!==null){if(t[c.index]!==0)continue;let v=c[1],E=c[2],R;if(v==="interface"){let C=s.indexOf("{",c.index);if(C===-1)continue;let O=0;R=-1;for(let M=C;M<s.length;M++)if(s[M]==="{")O++;else if(s[M]==="}"&&--O===0){R=M+1;break}if(R===-1)continue}else{let C=0;R=s.length;for(let O=s.indexOf("=",c.index)+1;O<s.length;O++){let M=s[O];if(M==="{"||M==="["||M==="("||M==="<")C++;else if(M==="}"||M==="]"||M===")"||M===">")C--;else if(C<=0&&(M===";"||M===`
|
|
261
|
-
`&&!/[=|&,<([{]\s*$/.test(s.slice(Math.max(0,O-40),O)))){R=M===";"?O+1:O;break}}}a.push({name:E,text:e.slice(c.index,R).replace(/^[ \t]*export[ \t]+/,"")}),h.lastIndex=R}return a}function Wc(e){return new Set(Pi(e).map((s)=>s.name))}function
|
|
261
|
+
`&&!/[=|&,<([{]\s*$/.test(s.slice(Math.max(0,O-40),O)))){R=M===";"?O+1:O;break}}}a.push({name:E,text:e.slice(c.index,R).replace(/^[ \t]*export[ \t]+/,"")}),h.lastIndex=R}return a}function Wc(e){return new Set(Pi(e).map((s)=>s.name))}function Ia(e,s=""){let t=Oi(e),o=Wc(s),a=Pi(e).filter((R)=>!o.has(R.name)).map((R)=>R.text);if(!t){let R=Ie(e).filter((C)=>!Ht(s,C));if(R.length===0&&a.length===0)return"";return["",`// ${Fc}`,...a,...R.map((C)=>`declare var ${C}: any`)].join(`
|
|
262
262
|
`)}if(t.length===0)return a.length>0?["",`// ${Ei}`,...a].join(`
|
|
263
263
|
`):"";let{imports:h,body:c}=zc(e),v=c.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),E=["",`// ${Ei}`];if(h)E.push(h);return E.push(...a),E.push(`async function ${ki}() {`,v,` return { ${t.join(", ")} }`,"}",`type ${Ri} = Awaited<ReturnType<typeof ${ki}>>`,...t.map((R)=>`declare var ${R}: ${Ri}[${JSON.stringify(R)}]`)),E.join(`
|
|
264
|
-
`)}function
|
|
265
|
-
`)t[a]=" "}return Ie(t.join(""))}function
|
|
266
|
-
`),a=Array.from({length:o.length},()=>""),h=new Map,c=s.filePath&&s.templateExpressions!==!1?_i(e,Bn(e),{filePath:s.filePath,componentsDir:s.componentsDir,projectRoot:s.projectRoot,readComponent:s.readComponent,scriptCode:(O,M)=>$t(O).map((N)=>
|
|
267
|
-
`)}):void 0,v=new Set,E=[];for(let O of t){let M=Eo(
|
|
268
|
-
`);N.forEach((I,P)=>{let Z=O.startLine-1+P;if(Z<a.length)a[Z]=P===0
|
|
269
|
-
`).entries())if(a.push(I),M)h.set(a.length,N===0?M:{...M,line:M.line+N,column:1,prefixLength:0})};if(s.globals!==!1){R("");let O=new Set([...t.flatMap((P)=>Ie(P.code)),...t.flatMap((P)=>qc(P.code))]),M=(P)=>{if(!O.has(P))R(`declare var ${P}: any`)};if(s.runtimeGlobals!==!1){if(!O.has("window"))R("declare var window: any");for(let P of x)M(P)}let N=[...new Set([...Ls,...
|
|
270
|
-
`))R(M);let O=
|
|
271
|
-
`),lineMap:h,sourceLineCount:o.length,componentDependencies:c?.dependencies,referenced:C}}function
|
|
264
|
+
`)}function $o(e){let t=i(e).split(""),o=0;for(let a=0;a<t.length;a++){let h=t[a];if(h==="{"||h==="("||h==="["){o++;continue}if(h==="}"||h===")"||h==="]"){o=Math.max(0,o-1);continue}if(o>0&&h!==`
|
|
265
|
+
`)t[a]=" "}return Ie(t.join(""))}function Oa(e,s){if(Oi(e)!==null)return[];let t=$o(e),o=rn(s,new Set(t)),a=new Set(x);return t.filter((h)=>{if(a.has(h))return!1;if(Ht(s,h))return!1;return o.has(h)})}var Ei="stx: types for the declared client payload (#1868)",Fc="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",ki="__stxServerScope",Ri="__StxClientPayload";var Ci=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Vc=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Uc(e){let s=new Map,t=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let o of e){let a=i(o),{depths:h,balanced:c}=et(a);if(!c)continue;let v=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let E of a.matchAll(v)){let R=E.index??0;if(h[R+E[1].length]!==0)continue;let C=E[2],O=R+E[0].length-E[3].length,M=o.slice(O,R+E[0].length).trim().replace(/;$/,"").trim(),N=E[3],I=t.test(N)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(N)&&!/[,+\-*/%&|?:=]$/.test(M)&&et(N).balanced;s.set(C,s.has(C)||!I?null:M)}}return new Map([...s].filter((o)=>o[1]!==null))}function Mi(e,s,t=0,o=new Set){if(s.size===0||t>=5)return e;let a=i(e),h="",c=0;for(let v of a.matchAll(/[A-Za-z_$][\w$]*/g)){let E=v.index??0,R=v[0],C=s.get(R);if(!C||o.has(R))continue;let O=a.slice(0,E).trimEnd(),M=a.slice(E+R.length).trimStart();if(O.endsWith(".")||/^:(?!:)/.test(M)&&/[{,]$/.test(O))continue;if(E>0&&/[\w$]/.test(a[E-1]))continue;h+=`${e.slice(c,E)}(${Mi(C,s,t+1,new Set([...o,R]))})`,c=E+R.length}return h+e.slice(c)}function Hc(e,s){let t=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,o=[],a;while((a=t.exec(e))!==null){if(a.index>s)break;let h=a[1];if(a.index===s){if(h==="elseif"){let v=o[o.length-1];if(v?.current)v.seen.push(v.current);if(v)v.current=null}break}if(h==="endif"||h==="endunless"){o.pop();continue}let c="";if(a[2]==="("){let v=0,E=a.index+a[0].length-1,R=E+1;for(;E<e.length;E++){let C=e[E];if(C==="(")v++;else if(C===")"){if(v--,v===0)break}}c=e.slice(R,E).trim(),t.lastIndex=E+1}if(h==="if")o.push({seen:[],current:c});else if(h==="unless")o.push({seen:[],current:`!(${c})`});else if(h==="elseif"||h==="else"){let v=o[o.length-1];if(!v)continue;if(v.current)v.seen.push(v.current);v.current=h==="elseif"?c:null}}return o.flatMap((h)=>[...h.seen.map((c)=>`!(${c})`),...h.current?[h.current]:[]]).filter(Boolean)}function Kc(e){let s=e.code.trim();if(!s)return null;if(e.attribute?.startsWith("@")){if(Vc.test(s))return null;let o=";(($event: any): void => { ";return{text:`${o}${s} });`,prefixLength:o.length}}let t=";void ((";return{text:`${t}${s}));`,prefixLength:t.length}}var Zc=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function us(e,s){if(!s)return e;return e.replace(Zc,(t,o,a,h)=>{let c=Ti.resolve(s,h).replace(/\\/g,"/");return`${o}${a}${c}${a}`})}function Ro(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function qc(e){let s=new Set,t=i(e);for(let o of t.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=o[1],h=/\{([^}]*)\}/.exec(a);for(let R of h?.[1].split(",")??[]){let C=R.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(C&&/^[A-Z_$][\w$]*$/i.test(C))s.add(C)}let c=a.replace(/\{[^}]*\}/,""),v=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(v)s.add(v[1]);let E=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(E&&E[1]!=="type")s.add(E[1])}return[...s].sort()}function Na(e,s={}){let t=$t(e),o=e.split(`
|
|
266
|
+
`),a=Array.from({length:o.length},()=>""),h=new Map,c=s.filePath&&s.templateExpressions!==!1?_i(e,Bn(e),{filePath:s.filePath,componentsDir:s.componentsDir,projectRoot:s.projectRoot,readComponent:s.readComponent,scriptCode:(O,M)=>$t(O).map((N)=>us(N.code,Ti.dirname(M))).join(`
|
|
267
|
+
`)}):void 0,v=new Set,E=[];for(let O of t){let M=To(Eo(O.code)),N=us(M,s.originDir??"").split(`
|
|
268
|
+
`);N.forEach((I,P)=>{let Z=O.startLine-1+P;if(Z<a.length)a[Z]=P===0?Ro(O)+I:I,v.add(Z)}),E.push(O.startLine-1+N.length-1)}for(let O of E){let M=a[O]?.trim()===""?O:O+1;if(M<a.length&&a[M].trim()===""&&(M===O||!v.has(M)))a[M]=";"}let R=(O,M)=>{for(let[N,I]of O.split(`
|
|
269
|
+
`).entries())if(a.push(I),M)h.set(a.length,N===0?M:{...M,line:M.line+N,column:1,prefixLength:0})};if(s.globals!==!1){R("");let O=new Set([...t.flatMap((P)=>Ie(P.code)),...t.flatMap((P)=>qc(P.code))]),M=(P)=>{if(!O.has(P))R(`declare var ${P}: any`)};if(s.runtimeGlobals!==!1){if(!O.has("window"))R("declare var window: any");for(let P of x)M(P)}let N=[...new Set([...Ls,...be,...Ci])].filter((P)=>s.runtimeGlobals!==!1||!x.includes(P));if(s.contextScope==="global"){R("declare global {");for(let P of N)R(` var ${P}: any`);R("}")}else{for(let P of Ls)M(P);for(let P of be)M(P);for(let P of Ci)M(P)}R(`declare var ${Ns}: any`);let I=new Set(t.flatMap((P)=>Ie(P.code)));R(`type ${Si}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let P of Nc(e)){if(I.has(P.name))continue;let Z=P.iterable&&I.has(P.iterable)?`${Si}<typeof ${P.iterable}>`:"any";R(`declare var ${P.name}: ${Z}`)}}if(s.templateExpressions!==!1){if(c?.declarations)for(let M of c.declarations.split(`
|
|
270
|
+
`))R(M);let O=zl(e).map((M)=>{let N=c?.events.get(M.offset??-1);if(N){M.anchor=!0;let I=M.code.trim(),P=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(I),Z=P?`void ((${P[2]}) satisfies __StxAssignedValue<typeof ${P[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(I)?`${I} satisfies (($event: ${N}) => unknown)`:I,U=`;(($event: ${N}): void => { `;return{expression:M,statement:{text:`${U}${Z} });`,prefixLength:U.length}}}return{expression:M,statement:Kc(M)}}).filter((M)=>M.statement!==null);if(O.push(...c?.checks||[]),O.length>0){let M=Bn(e),N=Ln(M),I=Uc(t.map((W)=>W.code)),Z=[...new Set(t.flatMap((W)=>Ie(W.code)))].filter((W)=>/^[A-Z_$][\w$]*$/i.test(W)),U=0;if(Z.length>0){R(Oc);for(let W of Z)R(`function __StxRead_${W}() { return ${W} }`),R(`type __StxT_${W} = ${Ii}<ReturnType<typeof __StxRead_${W}>>`);R(`;((${Z.map((W)=>`${W}: __StxT_${W}`).join(", ")}) => {`),U=1}for(let{expression:W,statement:Y}of O){let ee=" ".repeat(U),te=W.offset===void 0?[]:N.filter((Te)=>W.offset>=Te.start&&W.offset<Te.end),oe=te.map((Te)=>`;((${Te.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),ge=" });".repeat(te.length),Ee=W.offset===void 0?[]:Hc(M,W.offset),ke=Ee.length>0?`${Ee.map((Te)=>`if (${Mi(Te,I)}) `).join("")}{ `:"",We=Ee.length>0?" }":"";R(ee+oe+ke+Y.text+We+ge,{line:W.line,column:W.column,expression:W,prefixLength:Y.prefixLength+ee.length+oe.length+ke.length,guardPrefixLength:ee.length+oe.length+ke.length})}if(U>0)R("});")}}let C=!1;if(s.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(s.reference.replace(/\\/g,"/"))} />`,C=!0;return R("export {}"),{text:a.join(`
|
|
271
|
+
`),lineMap:h,sourceLineCount:o.length,componentDependencies:c?.dependencies,referenced:C}}function Da(e,s){if(!e.expression)return!1;return e.inGuard===!0||s===2774}function Ma(e,s,t){let o=e.lineMap.get(s);if(!o)return s<=e.sourceLineCount?{line:s,column:t}:null;let a=o.expression?.anchor?0:Math.max(0,t-1-(o.prefixLength??0));return{line:o.line,column:o.column+a,expression:o.expression,inGuard:t<=(o.guardPrefixLength??0)}}var Bs=y(256),Xc=[{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"}],Di=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Jc(e){let s=Array.from(e,(a)=>a===`
|
|
272
272
|
`?`
|
|
273
273
|
`:" "),t=0,o="";while(t<e.length){let a=e[t],h=e[t+1];if(o){if(a==="\\"){t+=2;continue}if(a===o)o="";t++;continue}if(a==='"'||a==="'"||a==="`"){o=a,t++;continue}if(a==="/"&&h==="/"){while(t<e.length&&e[t]!==`
|
|
274
274
|
`)s[t]=e[t],t++;continue}if(a==="/"&&h==="*"){let c=e.indexOf("*/",t+2),v=c===-1?e.length:c+2;for(;t<v;t++)s[t]=e[t];continue}if(a==="{"&&h==="{"&&e.slice(t,t+4)==="{{--"){let c=e.indexOf("--}}",t+4),v=c===-1?e.length:c+4;for(;t<v;t++)s[t]=e[t];continue}t++}return s.join("")}function Gc(e){let s=new Map,t=Jc(e).split(`
|
|
275
275
|
`),o=e.split(`
|
|
276
|
-
`);return t.forEach((a,h)=>{Di.lastIndex=0;for(let c of a.matchAll(Di)){let v=c[1]==="-next-line",E=(o[h]??"").slice(0,c.index).trim(),R=v||E===""?h+2:h+1,O=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),M=O.filter((I)=>/\w/.test(I));if(O.length>0&&M.length===0)continue;let N=s.get(R);if(N&&N.size===0)continue;if(M.length===0){s.set(R,new Set);continue}if(N)M.forEach((I)=>N.add(I));else s.set(R,new Set(M))}}),s}function Yc(e,s,t){let o=e.get(s);if(!o)return!1;if(o.size===0)return!0;return[...o].some((a)=>t.includes(a))}function Ae(e,s,t,o){let a=typeof t==="boolean"?{enabled:t,failOnViolation:t}:t??{enabled:!1};if(!a.enabled)return;let h=b(e,s,o,JSON.stringify(a)),c=Bs.get(h);if(c!==void 0){if(c&&a.failOnViolation)throw new
|
|
277
|
-
`),
|
|
278
|
-
`),
|
|
279
|
-
`),
|
|
280
|
-
${
|
|
281
|
-
\u2192 ${Z}${
|
|
276
|
+
`);return t.forEach((a,h)=>{Di.lastIndex=0;for(let c of a.matchAll(Di)){let v=c[1]==="-next-line",E=(o[h]??"").slice(0,c.index).trim(),R=v||E===""?h+2:h+1,O=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),M=O.filter((I)=>/\w/.test(I));if(O.length>0&&M.length===0)continue;let N=s.get(R);if(N&&N.size===0)continue;if(M.length===0){s.set(R,new Set);continue}if(N)M.forEach((I)=>N.add(I));else s.set(R,new Set(M))}}),s}function Yc(e,s,t){let o=e.get(s);if(!o)return!1;if(o.size===0)return!0;return[...o].some((a)=>t.includes(a))}function Ae(e,s,t,o){let a=typeof t==="boolean"?{enabled:t,failOnViolation:t}:t??{enabled:!1};if(!a.enabled)return;let h=b(e,s,o,JSON.stringify(a)),c=Bs.get(h);if(c!==void 0){if(c&&a.failOnViolation)throw new H(c,o??s);return}let v=a.allowPatterns??[],E=Gc(e),R=[],C=i(e.replace(/\{\{--[\s\S]*?--\}\}/g,(I)=>I.replace(/[^\n]/g," ")));for(let{pattern:I,message:P,suggestion:Z}of Xc){if(v.some((W)=>/\w/.test(W)&&P.includes(W)))continue;I.lastIndex=0;let U=C.match(I);if(U&&U.length>0){let W=C.split(`
|
|
277
|
+
`),Y=e.split(`
|
|
278
|
+
`),ee=[];if(W.forEach((Ee,ke)=>{if(I.lastIndex=0,I.test(Ee)&&!Yc(E,ke+1,P))ee.push(ke+1)}),ee.length===0&&W.some((Ee)=>(I.lastIndex=0,I.test(Ee))))continue;let te=ee.length>0?` (script line${ee.length>1?"s":""} ${ee.join(", ")})`:"",oe=ee.slice(0,3).map((Ee)=>` ${Ee} | ${(Y[Ee-1]??"").trim().slice(0,100)}`).join(`
|
|
279
|
+
`),ge=oe?`
|
|
280
|
+
${oe}`:"";R.push(` \u2717 ${P}${te}
|
|
281
|
+
\u2192 ${Z}${ge}`)}}if(R.length===0){Bs.set(h,"");return}let O=(I)=>{let P=`${process.cwd()}/`;return I.startsWith(P)?I.slice(P.length):I},N=`[STX] DOM API violation in ${o&&o!==s?`${O(o)} (composed into ${O(s)})`:O(s)}:
|
|
282
282
|
${R.join(`
|
|
283
283
|
`)}
|
|
284
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(Bs.set(h,N),console.warn(N),a.failOnViolation)throw new
|
|
285
|
-
`);return{line:t.length,column:t[t.length-1].length+1}}function
|
|
286
|
-
`)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<h-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},R=()=>{if(o!==0)return;let C=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(C){let I=C[2].split(",").map((P)=>{let Z=P.trim().split(":");return Z[Z.length-1].trim()});for(let P of I)if(P&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(P)&&!t.has(P))s.push(P),t.add(P);return}let O=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(O){let I=O[2];if(!t.has(I))s.push(I),t.add(I);return}let M=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!t.has(I))s.push(I),t.add(I);return}let N=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!t.has(I))s.push(I),t.add(I)}};while(a<h){if(E())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){v();continue}if(e[a]==="{"){o++,a++;continue}if(e[a]==="}"){o--,a++;continue}if(o===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))R();a++}return s}function fl(e){let s=[],t=0,o=0,a=null;for(let h=0;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)s.push(e.slice(o,h)),o=h+1}if(o<e.length)s.push(e.slice(o));return s}function pl(e){let s=0,t=null;for(let o=0;o<e.length;o++){let a=e[o];if(t){if(a==="\\"){o++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")s++;else if(a===")"||a==="]"||a==="}")s--;else if(a==="="&&s===0){let h=e[o-1],c=e[o+1];if(h==="!"||h==="<"||h===">"||h==="=")continue;if(c==="="||c===">")continue;return o}}return-1}function dl(e,s){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let o=t.index-1;while(o>=0&&/\s/.test(e[o]))o--;if(e[o]!=="}")return;let a=o,h=0,c=-1;for(;o>=0;o--){let E=e[o];if(E==="}")h++;else if(E==="{"){if(h--,h===0){c=o;break}}}if(c===-1)return;let v=e.slice(c+1,a);for(let E of fl(v)){let R=E.trim();if(!R||R.startsWith("..."))continue;let C=pl(R);if(C===-1)continue;let O=R.slice(0,C).trim();if(!/^[A-Z_$][\w$]*$/i.test(O))continue;if(s[O]!==void 0)continue;let M=R.slice(C+1).trim();if(!M)continue;try{let N=Object.keys(s).filter(Nt),I=Function(...N,`"use strict"; return (${M});`);s[O]=I(...N.map((P)=>s[P]))}catch{}}}catch{}}var gl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function
|
|
284
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(Bs.set(h,N),console.warn(N),a.failOnViolation)throw new H(N,o??s)}var Qc=[{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"}],el=[{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')"}],tl=[{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 Jl(e){let s=[],t=[];return nl(e,s),sl(e,s,t),rl(e,t),il(e,s),{valid:s.length===0,errors:s,warnings:t}}function nl(e,s){let t=(e.match(/\{\{/g)||[]).length,o=(e.match(/\}\}/g)||[]).length;if(t!==o)s.push({type:"expression",message:`Unclosed expression brackets: found ${t} opening '{{' and ${o} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function sl(e,s,t){for(let o of Qc){let a=new RegExp(`${o.open}(?:\\s|\\()`,"g"),h=new RegExp(o.close,"g"),c=(e.match(a)||[]).length,v=(e.match(h)||[]).length;if(o.altClose){let E=new RegExp(o.altClose,"g");v+=(e.match(E)||[]).length}if(c>v)s.push({type:"directive",message:`Unclosed @${o.name} directive: found ${c} opening and ${v} closing`,suggestion:`Add ${c-v} missing ${o.close} tag(s)`});else if(v>c)t.push({type:"directive",message:`Extra ${o.close} found: ${v-c} more closing than opening`,suggestion:`Check for orphaned ${o.close} tags`})}}function rl(e,s){for(let t of el)if(t.pattern.test(e))s.push({type:"syntax",message:t.message,suggestion:t.suggestion})}function il(e,s){for(let t of tl)if(t.pattern.test(e))s.push({type:"expression",message:`Security warning: ${t.message}`,suggestion:"Remove dangerous code from template expressions"})}function Yl(e,s){let t=e.slice(0,s).split(`
|
|
285
|
+
`);return{line:t.length,column:t[t.length-1].length+1}}function Zl(e,s,t){let o=[];switch(e){case"if":case"elseif":case"unless":if(t.length===0)o.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(t.length===0||!t[0].includes(" as "))o.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(t.length===0)o.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(t.length===0)o.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(t.length===0)o.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(t.length===0)o.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return o}function Ql(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function eu(e){let s=e.matchAll(/@([a-z]+)/gi),t=new Set;for(let o of s){let a=o[1].toLowerCase();if(!a.startsWith("end"))t.add(a)}return Array.from(t)}var Qt=new B(500),Fn=new B(1000),Fs=new B(2000),Vs=new B(500),Fi=33554432,Us=Fi;function ol(e){let s=e.componentRenderCacheBytes;if(typeof s!=="number"||s<0||s===Us)return;Us=s,Vn.setMaxBytes(s)}var Vn=new B(2000,{maxBytes:Fi,sizeOf:(e)=>e.output.length});function al(e){let s=new WeakSet;try{let t=(o)=>{if(o===void 0)return{__stxType:"undefined"};if(typeof o==="bigint")return{__stxType:"bigint",value:o.toString()};if(typeof o==="function"||typeof o==="symbol")throw TypeError("Non-serializable component input");if(o===null||typeof o!=="object")return o;if(s.has(o))throw TypeError("Circular component input");s.add(o);try{if(o instanceof Date)return{__stxType:"date",value:o.toISOString()};if(Array.isArray(o))return o.map(t);let a=Object.getPrototypeOf(o);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let h={};for(let c of Object.keys(o).sort())h[c]=t(o[c]);return h}finally{s.delete(o)}};return JSON.stringify(t(e))}catch{return null}}function cl(e){let s={};for(let[t,o]of Object.entries(e))if(!t.startsWith("__")||t==="__stxServeContext")s[t]=o;return s}function zs(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function hs(e){let s=process.cwd(),t=`${s}\x00${e}`,o=ji.get(t);if(o===void 0)o=Bun.hash(Vi(e,s).split(ce.sep).join("/")).toString(36).slice(0,6),ji.set(t,o);return o}var ji=new Map;function Vi(e,s){if(!ce.isAbsolute(e))return e;let t=(o)=>{try{return Ks.realpathSync(o)}catch{return o}};return ce.relative(t(s),t(e))}function tu(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function De(e){return!tu(e)}var Wn=new Map;function X(e){let s;try{s=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let t=Wn.get(s);if(t)return t;if(Wn.size>=16)Wn.clear();let o=new Bun.Transpiler(e);return Wn.set(s,o),o}var Ni=new WeakMap,ll=256;function Me(e){try{let s=X({loader:"ts",target:"browser",define:S()}),t=Ni.get(s);if(!t)t=new Map,Ni.set(s,t);let o=t.get(e);if(o!==void 0)return o;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 h=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(v)=>{let E=h.length;return h.push(v),`"__STX_EXPR_${E}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(v)=>{let E=h.length;return h.push(v),`"__STX_EXPR_${E}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(v)=>{let E=h.length;return h.push(v),`"__STX_EXPR_${E}__"`});let c=s.transformSync(a);for(let v=0;v<h.length;v++)c=c.replace(`"__STX_EXPR_${v}__"`,h[v]),c=c.replace(`'__STX_EXPR_${v}__'`,h[v]);if(t.size>=ll){let v=t.keys().next();if(!v.done)t.delete(v.value)}return t.set(e,c),c}catch(s){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",s);return e}}function ul(e){let s=[],t=new Set,o=0,a=0,h=e.length,c=(C)=>{a++;while(a<h){if(e[a]==="\\"){a+=2;continue}if(e[a]===C){a++;return}a++}},v=()=>{a++;while(a<h){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let C=1;while(a<h&&C>0)if(e[a]==="{")C++,a++;else if(e[a]==="}")C--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")v();else a++;continue}a++}},E=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<h&&e[a]!==`
|
|
286
|
+
`)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<h-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},R=()=>{if(o!==0)return;let C=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(C){let I=C[2].split(",").map((P)=>{let Z=P.trim().split(":");return Z[Z.length-1].trim()});for(let P of I)if(P&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(P)&&!t.has(P))s.push(P),t.add(P);return}let O=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(O){let I=O[2];if(!t.has(I))s.push(I),t.add(I);return}let M=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!t.has(I))s.push(I),t.add(I);return}let N=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!t.has(I))s.push(I),t.add(I)}};while(a<h){if(E())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){v();continue}if(e[a]==="{"){o++,a++;continue}if(e[a]==="}"){o--,a++;continue}if(o===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))R();a++}return s}function fl(e){let s=[],t=0,o=0,a=null;for(let h=0;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)s.push(e.slice(o,h)),o=h+1}if(o<e.length)s.push(e.slice(o));return s}function pl(e){let s=0,t=null;for(let o=0;o<e.length;o++){let a=e[o];if(t){if(a==="\\"){o++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")s++;else if(a===")"||a==="]"||a==="}")s--;else if(a==="="&&s===0){let h=e[o-1],c=e[o+1];if(h==="!"||h==="<"||h===">"||h==="=")continue;if(c==="="||c===">")continue;return o}}return-1}function dl(e,s){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let o=t.index-1;while(o>=0&&/\s/.test(e[o]))o--;if(e[o]!=="}")return;let a=o,h=0,c=-1;for(;o>=0;o--){let E=e[o];if(E==="}")h++;else if(E==="{"){if(h--,h===0){c=o;break}}}if(c===-1)return;let v=e.slice(c+1,a);for(let E of fl(v)){let R=E.trim();if(!R||R.startsWith("..."))continue;let C=pl(R);if(C===-1)continue;let O=R.slice(0,C).trim();if(!/^[A-Z_$][\w$]*$/i.test(O))continue;if(s[O]!==void 0)continue;let M=R.slice(C+1).trim();if(!M)continue;try{let N=Object.keys(s).filter(Nt),I=Function(...N,`"use strict"; return (${M});`);s[O]=I(...N.map((P)=>s[P]))}catch{}}}catch{}}var gl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function nu(e,s){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let o=t[2].toLowerCase();if(!gl.has(o))return null;let a=new RegExp(`<\\/?${o}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),h=ue(e,(R,C)=>(a.lastIndex=C,a.exec(R)?.index===C?a.lastIndex:-1));if(o==="span"&&/\sdata-stx-scope\s*=/.test(h[0]?.token||""))return null;let c=0,v=!1;for(let R of h){if(c+=R.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(R.end).trim())return null;v=!0;break}}if(!v)return null;let E=t[0].length;return e.slice(0,E)+s+e.slice(E)}async function ur(e,s,t,o,a){let h=e.endsWith(".stx")?e.slice(0,-4):e,c=(te)=>te.split("-").map((oe)=>oe.charAt(0).toUpperCase()+oe.slice(1)).join(""),v=t.__importedComponents;if(v){for(let te of[h,h.toLowerCase(),c(h),j(h)])if(v.has(te))return!0}let E=[...new Set([`${h}.stx`,`${c(h)}.stx`,`${j(h)}.stx`])],R=typeof a.root==="string"?ce.resolve(a.root):void 0,C=R??ce.dirname(o),O=[],M=(te)=>{if(te&&!O.includes(te))O.push(te)},N=t.__originalFilePath;if(N)M(ce.join(ce.dirname(N),"components"));M(s),M(a._rootComponentsDir),M(ce.join(ce.dirname(o),"components")),M(a.componentsDir);let I=a._targetComponentFallbackNames?.some((te)=>te.toLowerCase()===h.toLowerCase());if(!I)for(let te of a._targetComponentDirs??[])M(te);if(R)M(ce.resolve(R,"resources/views/components")),M(ce.resolve(R,"resources/components")),M(ce.resolve(R,"src/components")),M(ce.resolve(R,"components"));for(let te of a._layerComponentDirs??[])M(te);let P=a._pluginComponentDirs;if(Array.isArray(P))for(let te of P)M(typeof te==="string"?te:null);if(M(a.fallbackComponentsDir),I)for(let te of a._targetComponentDirs??[])M(te);if(h.startsWith("./")||h.startsWith("../"))return n(ce.resolve(ce.dirname(o),`${h}.stx`));let Z=Li(ce.resolve(import.meta.dir,"components")),U=O.map((te)=>ce.isAbsolute(te)?te:ce.resolve(C,te)),W=`${E.join("\x00")}\x00\x00${U.join("\x00")}`,Y=Fs.get(W);if(Y!==void 0)return Y;let ee=!1;e:for(let te of U){if(Li(te)===Z)continue;for(let oe of E)if(await n(ce.join(te,oe))){ee=!0;break e}}return Fs.set(W,ee),ee}function Li(e){let s=Vs.get(e);if(s!==void 0)return s;let t=e;try{t=Ks.realpathSync(e)}catch{}return Vs.set(e,t),t}function ru(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Ka(e){if(!e)return!1;let s=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(s)}function ml(e,s,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let o=(a,h)=>{let c;try{c=_(a,s)}catch{return h}if(c===void 0||c===null)return"";let v=String(c);if(/<\/style/i.test(v))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return v};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,h)=>o(h,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,h)=>o(h,a))}var Bi=new Set;function zi(e,s,t,o){let a=`${e}\x00${s}\x00${o??""}`;if(!process.env.STX_DEBUG&&Bi.has(a))return;Bi.add(a);let h=s?` used in ${s}`:"",c=o?` Cause: ${o}.`:"",v=t.length>0?`
|
|
287
287
|
searched:
|
|
288
288
|
${t.map((E)=>` - ${E}`).join(`
|
|
289
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${v}`)}function Wi(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function
|
|
290
|
-
`)}`}if(t&&
|
|
289
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${v}`)}function Wi(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Mo(e){let s=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let o of e){let a;while((a=t.exec(o))!==null)s.add(a[1]);t.lastIndex=0}return[...s]}async function Le(e,s,t,o,a,h,c,v=new Set,E,R=Qe(a),C,O=e){let{extractVariables:M}=await r("stx/variable-extractor",()=>import("./chunk-902qnyg0.js")),N=v??new Set;if(N.has(e))return`[Circular component reference: ${e}]`;let I=new Set(N);I.add(e);let P=typeof s.client==="string"?s.client.trim():"";if("client"in s)delete s.client;let Z=P&&P!=="load"&&ru(P)?P:"";try{let U=(ae)=>ae.split("-").map((ie)=>ie.charAt(0).toUpperCase()+ie.slice(1)).join(""),W=O.endsWith(".stx")?O.slice(0,-4):O,Y=null,ee=a.__importedComponents;if(ee){let ae=[W,W.toLowerCase(),U(W),j(W)];for(let ie of ae)if(ee.has(ie)){Y=ee.get(ie);break}}let te=[];if(!Y){let ae=[`${W}.stx`,`${U(W)}.stx`,`${j(W)}.stx`],ie=[...new Set(ae)],me=a.__originalFilePath,he=[];if(he.push(...c._layerComponentDirs??[]),me){let Se=ce.join(ce.dirname(me),"components");he.push(Se)}if(o)he.push(o);let He=c._rootComponentsDir;if(typeof He==="string"&&!he.includes(He))he.push(He);let Be=ce.join(ce.dirname(h),"components");if(!he.includes(Be))he.push(Be);if(c.componentsDir&&c.componentsDir!==o&&!he.includes(c.componentsDir))he.push(c.componentsDir);let at=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(W),ct=(C?.events??[]).map((Se)=>Se.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),lt=Object.hasOwn(s,"checked")||Boolean(C?.reactiveProps?.includes("checked")),_t=Object.hasOwn(s,"value")||Boolean(C?.reactiveProps?.includes("value")),_n=!ct.includes("valuechange")&&(lt||ct.includes("change")&&!_t),Xn=c._nativeHostAttrs&&/^textinput$/i.test(W),wt=ct.includes("update:value")&&!ct.includes("input"),Vt=c._targetComponentFallbackNames?.some((Se)=>Se.toLowerCase()===W.toLowerCase())&&(!at||_n)&&(!Xn||wt);for(let Se of Vt?[]:c._targetComponentDirs??[])if(Se&&!he.includes(Se))he.push(Se);let nt=typeof c.root==="string"?ce.resolve(c.root):void 0,wn=nt??ce.dirname(h),rt=[];if(nt)rt.push(ce.resolve(nt,"resources/views/components")),rt.push(ce.resolve(nt,"resources/components")),rt.push(ce.resolve(nt,"src/components")),rt.push(ce.resolve(nt,"components"));rt.push(ce.resolve(import.meta.dir,"components"));for(let Se of rt)if(!he.includes(Se))he.push(Se);let Ut=c._pluginComponentDirs;if(Array.isArray(Ut)){for(let Se of Ut)if(typeof Se==="string"&&!he.includes(Se))he.push(Se)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(Vt){for(let Se of c._targetComponentDirs??[])if(Se&&!he.includes(Se))he.push(Se)}let Qs=[...new Set(he.map((Se)=>{if(!Se)return Se;return ce.isAbsolute(Se)?Se:ce.resolve(wn,Se)}))];he.length=0,he.push(...Qs);let Jn=`${W}\x00${h}\x00${Qs.join("\x00")}`,Gn=Fn.get(Jn);if(Gn)if(await n(Gn))Y=Gn;else Fn.delete(Jn);if(!Y&&(W.startsWith("./")||W.startsWith("../")))Y=ce.resolve(ce.dirname(h),`${W}.stx`),te.push(Y);else if(!Y)for(let Se of he){if(!Se)continue;for(let Sn of ie){let $n=ce.join(Se,Sn);if(te.push($n),await n($n)){Y=$n;break}}if(Y)break;if(!Y)try{let Sn=await import("fs");if(!Sn.statSync(Se,{throwIfNoEntry:!1})?.isDirectory())continue;let so=8,Yn=[{path:Se,depth:0}];while(Yn.length>0&&!Y){let vn=Yn.pop();if(vn.depth>=so)continue;let er;try{er=Sn.readdirSync(vn.path,{withFileTypes:!0})}catch{continue}for(let En of er){if(!En.isDirectory())continue;if(En.name==="node_modules"||En.name.startsWith("."))continue;let tr=ce.join(vn.path,En.name);for(let ro of ie){let Qn=ce.join(tr,ro);if(te.push(Qn),await n(Qn)){Y=Qn;break}}if(Y)break;Yn.push({path:tr,depth:vn.depth+1})}}}catch{}if(Y)break}if(Y)Fn.set(Jn,Y)}if(!Y||!await n(Y))return zi(e,h,te),Wi(e);E.add(Y);let oe;if(Qt.has(Y))oe=Qt.get(Y);else try{oe=await Bun.file(Y).text(),Qt.set(Y,oe)}catch(ae){let ie=ae instanceof Error?ae.message:String(ae);return zi(e,h,[Y],ie),Wi(e)}if(C)for(let ae of new Set([...Object.keys(s),...C.reactiveProps??[]])){let ie=ae.toLowerCase();if(ie.startsWith("aria-")||ie.startsWith("data-"))continue;let me=ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${me}\\b`).test(oe))C.declaredProps.add(ae);if(new RegExp(`\\$props\\s*(?:\\.\\s*${me}\\b|\\[\\s*['"]${me}['"]\\s*\\])`).test(oe)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${me}['"]`).test(oe))C.consumedProps?.add(ae)}let ge=new Set(["__originalFilePath","__importedComponents",Tn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[ae,ie]of Object.entries(a))if(!ae.startsWith("__")||ge.has(ae))Ee[ae]=ie;let ke=R.length>0?{[Nn]:[...R]}:{},We=t;if(t.includes("@include")){let{processIncludes:ae}=await r("stx/includes",()=>import("./chunk-0mwdq478.js"));We=await ae(t,a,h,c,E)}if(/<[A-Z][\w.-]*[\s/>]/.test(We)){let{processComponents:ae}=await r("stx/component-renderer",()=>import("./chunk-eq5jzaj5.js"));We=await ae(We,{...a,__processedComponents:N,...ke},h,c,E)}let Te=[];if(Ka(We)){let{processExpressions:ae}=await r("stx/expressions",()=>import("./chunk-z97bwx8m.js")),ie=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ke}:R.length>0?{...a,...ke}:a;We=ae(We,ie,h);for(let me of We.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(me[1].trim())}let Ke=G(We),Ge=[],xt=Ke.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ae,ie)=>{let me=Ke.scripts[Number(ie)]||"",he=me.match(/^<script\b([^>]*)>/i)?.[1]||"",He=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Be=!He||["module","text/javascript","application/javascript"].includes(He),at=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Be&&!at)return Ge.push(me),"";return me}),{extractSlotContent:Hn}=await r("stx/slots",()=>import("./chunk-cbvgtf3m.js")),ft=Hn(xt),pt={};if(ft.defaultSlot?.trim())pt.default=ft.defaultSlot;for(let[ae,ie]of ft.namedSlots)pt[ae]=ie.content;let dt=a.__stx_scope_seq??={n:0,key:hs(String(a.__filename??h))},Ot=Vi(e,process.cwd()),it=`stx_${(Ot.endsWith(".stx")?Ot.slice(0,-4):Ot).replace(/[^a-zA-Z0-9]/g,"_")}_${++dt.n}_${dt.key}`,Ve={...Ee,$uid:it,$native:c._nativeHostAttrs===!0,...s,props:s,slot:xt,$slots:pt,__processedComponents:I,__sections:{},__stx_signals_gate:ve(oe)||Ka(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};dl(oe,Ve);let Mt=oe,tn=le(Mt);if(tn)Mt=tn.content.trim();let Kn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Dt=[...oe.matchAll(Kn)];for(let[,ae,ie]of Dt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ae))Ae(ie,Y,c.strict);let Xe=[],jt=null,Zn=Dt.some((ae)=>/\bserver\b/.test(ae[1]||"")&&/\bcache\b/.test(ae[1]||"")),bt=null,Ye=null,Lt=null,nn=0,Bt=null;if(ol(c),Zn&&Us>0){let ae=al({props:s,slot:We,slotContext:t.trim()?cl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...R].sort(),layers:c._layerGraph?.layers.map((ie)=>ie.configFile),uid:it});if(ae!==null){bt=`${Y}\x00${b(oe)}\x00${ae}`;let ie=Vn.get(bt);if(ie){for(let me of ie.dependencies)E.add(me);if(Br(a,ie.clientFactories),dt.n+=ie.uidsConsumed,ie.preservedClientExpressions.length>0){let me=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of ie.preservedClientExpressions)me.add(he);a.__stx_preserved_client_expressions=[...me]}return ie.output}Ye=new Set(E),Lt=Nr(a),nn=dt.n,Bt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let zt=new Set;for(let ae of Dt){let ie=ae[1]||"",me=ae[2]||"",he=ie.includes("server");if(De(ie)&&me.trim())me=Me(me);if(he&&me){for(let Be of Ie(me))zt.add(Be);try{await M(me,Ve,Y,{onFailure:(Be)=>{if(Be.kind!=="unknown")jt=Be.kind}})}catch(Be){}}if(!he){let Be=me.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),at=Be.includes("{{")&&Be.includes("}}"),ct=Be.includes("{!!")&&Be.includes("!!}");if(at||ct)Be=jo(Be,Ve,Y);let lt=ie.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Xe.push(`<script${lt}>${Be}</script>`)}}let Ze=G(oe).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Wt=Ze?Ze[1]:"",qn=Ze?Ze[2]:"",tt="",Q=Wt&&/\bscoped\b/i.test(Wt);if(Ze)tt=`<style${Wt}>${ml(qn,Ve,Y)}</style>`;let ne=Mt;if(ne=ne.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ze)ne=ne.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ae=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ie=[];if(ne=ne.replace(ae,(me,he)=>{let He=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)ie.push(`<style${He[1]}>${He[2]}</style>`);return""}),ne=ne.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ie.length>0)tt=`${tt}${ie.join(`
|
|
290
|
+
`)}`}if(t&&ne.includes("{{ text || slot }}"))ne=ne.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:fe}=await r("stx/slots",()=>import("./chunk-cbvgtf3m.js")),{defaultSlot:_e,namedSlots:$e}=ft,ze=c._nativeHostAttrs===!0&&Xe.length>0||Xe.some((ae)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ae)),gt=(ae)=>ze?gi(ae,it):ae,Ys=new Map([...$e].map(([ae,ie])=>[ae,{...ie,content:gt(ie.content)}]));ne=await fe(ne,gt(_e),Ys,Ve,ze?it:"");let hn=Mo(Xe),xn=(Array.isArray(Ve.__stx_client_signal_names)?Ve.__stx_client_signal_names:[]).filter((ae)=>!zt.has(ae));if(hn.length>0||xn.length>0)Ve.__stx_client_signal_names=[...new Set([...xn,...hn])];else delete Ve.__stx_client_signal_names;let Ft=R.filter((ae)=>!zt.has(ae)&&!(ae in s));if(Ft.length>0)Ve[Nn]=Ft;let bn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(Y),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||ze||Xe.length===0,defaultLayout:void 0};Ve.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:yn}=await r("stx/process",()=>import("./chunk-jzjpyyw2.js")),ot=await yn(ne,Ve,Y,bn,E),yt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ae of ot.matchAll(/\{\{([\s\S]*?)\}\}/g))yt.add(ae[1].trim());if(yt.size>0)a.__stx_preserved_client_expressions=[...yt];let qe=it,Ue=ot;if(ze){let ae="";if(Object.keys(s).length>0)try{ae=` data-stx-props="${zs(JSON.stringify(s))}"`}catch{}let ie=Z?` stx-hydrate="${zs(Z)}"`:"",me=Object.fromEntries(Object.entries(pt).map(([lt,_t])=>[lt,Boolean(_t)])),he=Object.keys(me).length>0?` data-stx-slots="${zs(JSON.stringify(me))}"`:"",He=` data-stx-scope="${qe}"${ae}${he}${ie}`,Be=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(ot),at=Be?"span":"div";Ue=nu(ot,He)??`<${at}${He} data-stx-component-wrapper${Be?' style="display:contents"':""}>${ot}</${at}>`;let ct=await Promise.all(Xe.map(async(lt)=>{let _t=lt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return lt;let[,_n,Xn]=_t,wt=await bl(Xn,Y,c.buildMode==="compile"),Vt=dn(wt.clientCode,Oe(Ve)),{vendorStyleTags:nt}=wt,wn=Vt?`function(__scopeId) {
|
|
291
291
|
${Vt}
|
|
292
292
|
return (${wt.factoryBody})(__scopeId);
|
|
293
293
|
}`:wt.factoryBody,rt=Z?null:ws(a,wn),Ut=rt?`window.__stxComponentFactories[${JSON.stringify(rt)}](${JSON.stringify(qe)});`:`(${wn})(${JSON.stringify(qe)});`;if(Z)return`${nt}<script type="stx/island" data-stx-island="${qe}" data-stx-scoped data-stx-owner="${qe}"${_n}>${Ut}</script>`;return`${nt}<script data-stx-scoped data-stx-run="always" data-stx-owner="${qe}"${_n}>${Ut}</script>`}));if(Ue=Ue+`
|
|
294
294
|
`+ct.join(`
|
|
295
295
|
`),tt)Ue+=`
|
|
296
296
|
`+tt}else{if(tt)Ue+=`
|
|
297
|
-
`+tt;if(Xe.length>0){let
|
|
298
|
-
`+
|
|
299
|
-
`),Ve.__stx_event_bindings=[]}}if(
|
|
297
|
+
`+tt;if(Xe.length>0){let ae=Ve.__stx_event_bindings||[],ie=Oe(Ve),me=await Promise.all(Xe.map(async(he)=>{let He=he.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!He)return he;return await Ne(He[1],{eventBindings:ae,templateContent:Ue,filePath:Y,projectRoot:process.cwd(),serverData:ie,instanceId:it})}));Ue+=`
|
|
298
|
+
`+me.join(`
|
|
299
|
+
`),Ve.__stx_event_bindings=[]}}if(Q){let ae=ds(Ue,Y);if(ae.hasScoped)Ue=ae.html}if(bt&&Ye){let ae=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];Vn.set(bt,{output:Ue,dependencies:[...E].filter((ie)=>!Ye.has(ie)),clientFactories:Lt?Lr(a,Lt):[],uidsConsumed:dt.n-nn,preservedClientExpressions:Bt?ae.filter((ie)=>!Bt.has(ie)):[]})}if(jt)Ue=`<!--stx-render-failed:${jt}-->${Ue}`;return Ge.length>0?`${Ue}
|
|
300
300
|
${Ge.join(`
|
|
301
|
-
`)}`:Ue}catch(U){if(U instanceof
|
|
301
|
+
`)}`:Ue}catch(U){if(U instanceof H)throw U;return`[Error processing component: ${U instanceof Error?U.message:String(U)}]`}finally{N.delete(e)}}async function n(e){return Bun.file(e).exists()}function Hs(e,s){let t=ce.resolve(s),o=ce.resolve(e),a=t.endsWith(ce.sep)?t:t+ce.sep;if(o===t||o.startsWith(a))return o;return null}async function hl(e,s,t,o){let a=s.startsWith("layouts/")?s.slice(8):s,h=ce.join(e,a);for(let c of h.endsWith(".stx")?[h]:[h,`${h}.stx`])if(await n(c)){if(o)console.log(`Found layout in ${e}: ${c}`);return t?.add(c),c}return null}async function pn(e,s,t,o){let a=await xl(e,s,t,o);if(a===null)return null;let h=Hs(a,process.cwd());if(h)return h;let c=[t.root,t.layoutsDir,t.fallbackLayoutsDir,t.componentsDir,t.partialsDir,t.pagesDir,...t._layerLayoutDirs??[]].filter((v)=>typeof v==="string"&&v.length>0);for(let v of c){let E=ce.isAbsolute(v)?v:ce.resolve(process.cwd(),v);if(Hs(a,E))return ce.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${s})`),null}async function xl(e,s,t,o){if(t.debug)console.log(`Resolving template path: ${e} from ${s}`);let a=ce.dirname(s),h=process.cwd();if(e.startsWith("/")){let M=ce.join(h,e),N=Hs(M,h);if(!N)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${s})`),null;if(t.debug)console.log(`Checking absolute path: ${N}`);if(await n(N)&&o)o.add(N);return N}let c=ce.join(a,e);if(await n(c)){if(t.debug)console.log(`Found direct path: ${c}`);if(o)o.add(c);return c}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let M of[".stx",".tsx",".jsx"]){let N=`${c}${M}`;if(await n(N)){if(t.debug)console.log(`Found direct path with extension: ${N}`);if(o)o.add(N);return N}}let v=[];if(v.push(...t._layerLayoutDirs??[]),t.layoutsDir)v.push(ce.isAbsolute(t.layoutsDir)?t.layoutsDir:ce.resolve(process.cwd(),t.layoutsDir));let E=ce.resolve(a),R=process.cwd();for(let M=0;M<10;M++){let N=ce.join(E,"layouts"),I=!1;try{I=Ks.statSync(N,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(I){v.push(N);break}let P=ce.dirname(E);if(P===E||P.length<R.length)break;E=P}for(let M of v){let N=await hl(M,e,o,t.debug);if(N)return N}if(t.fallbackLayoutsDir){let M=ce.isAbsolute(t.fallbackLayoutsDir)?t.fallbackLayoutsDir:ce.resolve(process.cwd(),t.fallbackLayoutsDir),N=e.startsWith("layouts/")?e.slice(8):e,I=[ce.join(M,N)];if(!e.endsWith(".stx"))I.push(`${I[0]}.stx`);for(let P of I)if(await n(P)){if(t.debug)console.log(`Found in options.fallbackLayoutsDir: ${P}`);if(o)o.add(P);return P}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let M=e.split("layouts/"),N=ce.join(t.partialsDir||a,"layouts",M[1]);if(await n(N)){if(t.debug)console.log(`Found in layouts path: ${N}`);if(o)o.add(N);return N}if(!N.endsWith(".stx")){let I=`${N}.stx`;if(await n(I)){if(t.debug)console.log(`Found in layouts path with extension: ${I}`);if(o)o.add(I);return I}}}if(t.partialsDir){let M=ce.join(t.partialsDir,"layouts");if(await n(M)){let N=ce.join(M,e);if(await n(N)){if(t.debug)console.log(`Found in partials layouts dir: ${N}`);if(o)o.add(N);return N}if(!e.endsWith(".stx")){let I=`${N}.stx`;if(await n(I)){if(t.debug)console.log(`Found in partials layouts dir with extension: ${I}`);if(o)o.add(I);return I}}}}let C=t.partialsDir||ce.join(process.cwd(),"views"),O=ce.join(C,e);if(await n(O)){if(t.debug)console.log(`Found in views path: ${O}`);if(o)o.add(O);return O}if(!e.endsWith(".stx")){let M=`${O}.stx`;if(await n(M)){if(t.debug)console.log(`Found in views path with extension: ${M}`);if(o)o.add(M);return M}}if(a.includes("temp")){let M=ce.join(ce.dirname(a),"layouts",e);if(await n(M)){if(t.debug)console.log(`Found in temp layouts dir: ${M}`);if(o)o.add(M);return M}if(!e.endsWith(".stx")){let N=`${M}.stx`;if(await n(N)){if(t.debug)console.log(`Found in temp layouts dir with extension: ${N}`);if(o)o.add(N);return N}}}if(t.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${s})`);else console.warn(`Template not found: ${e} (referenced from ${s})`);return null}function Xa(e,s,t){let o=0,a="",h="";try{if(typeof s==="number"&&s>=0){let c=e.split(`
|
|
302
302
|
`),v=0;for(let E=0;E<c.length;E++)if(v+=c[E].length+1,v>=s){o=E+1,a=c[E].trim();let R=Math.max(0,E-2),C=Math.min(c.length,E+3);h=c.slice(R,C).map((O,M)=>{let N=R+M+1;return`${N===o?"> ":" "}${N}: ${O}`}).join(`
|
|
303
|
-
`);break}}else if(t){let c=e.indexOf(t);if(c>=0)return
|
|
303
|
+
`);break}}else if(t){let c=e.indexOf(t);if(c>=0)return Xa(e,c)}}catch{}return{lineNumber:o,lineContent:a,context:h}}var we={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 m(e,s,t,o,a,h){let{lineNumber:c,context:v}=Xa(o,a,h),E=t.split("/").pop(),R=0;if(typeof a==="number"&&a>=0&&o){let O=o.lastIndexOf(`
|
|
304
304
|
`,Math.max(0,a-1));R=a-(O+1)+1}let C="";if(c>0)C+=`
|
|
305
305
|
${t}:${c}${R>0?`:${R}`:""}: ${e.toLowerCase()} error: ${s}
|
|
306
306
|
`;if(C+=`
|
|
@@ -313,8 +313,8 @@ ${we.yellow}${we.bold}Message:${we.reset} ${s}
|
|
|
313
313
|
`,v)C+=`
|
|
314
314
|
${we.blue}${we.bold}Context:${we.reset}
|
|
315
315
|
${we.dim}${v}${we.reset}
|
|
316
|
-
`;return C}function
|
|
317
|
-
${st("const",[...
|
|
316
|
+
`;return C}function pe(){Qt.clear(),Fn.clear(),Fs.clear(),Vs.clear(),Vn.clear()}function Ap(){return{size:Qt.size,maxSize:500}}var Ws=y(128);async function bl(e,s,t){let o=b(e,s,t),a=Ws.get(o);if(a){if(cs(a.deps))return a;Ws.delete(o)}let h=Oo(e,{filePath:s,projectRoot:process.cwd()}),c=h.code,v=No(h.styles);c=Pt(c).code;let{hasUserImports:E,bundleClientScript:R}=await r("stx/client-script-bundler",()=>import("./chunk-2a775q7x.js")),C=[],O=!1;if(E(c)){let W=c;c=await R(W,s,{projectRoot:process.cwd(),minify:t,collectInputs:C}),O=c===W}let{stripStxRuntimeImports:M}=await r("stx/signal-processing",()=>import("./chunk-fr39emcz.js"));c=M(c);let N=T(c),I=ul(N),P=new Set(L(N,!0).split(",").map((W)=>W.trim())),Z=`function(__scopeId) {
|
|
317
|
+
${st("const",[...ac,...I],N)}
|
|
318
318
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
319
319
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
320
320
|
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
@@ -379,7 +379,7 @@ ${N}
|
|
|
379
379
|
// Register all defined signals and functions in this scope
|
|
380
380
|
const __localVars = {};
|
|
381
381
|
try {
|
|
382
|
-
${I.map((
|
|
382
|
+
${I.map((W)=>P.has(W)?`Object.defineProperty(__localVars, '${W}', ${rs(W)});`:`if (typeof ${W} !== 'undefined') __localVars['${W}'] = ${W};`).join(`
|
|
383
383
|
`)}
|
|
384
384
|
}
|
|
385
385
|
catch (e) {}
|
|
@@ -398,24 +398,24 @@ finally {
|
|
|
398
398
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
399
399
|
window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
|
|
400
400
|
}
|
|
401
|
-
}`,U={vendorStyleTags:v,factoryBody:Z,clientCode:N,deps:
|
|
402
|
-
`);for(let a of o){let h=t,c=null,v=!1;for(let E=0;E<a.length;E++){let R=a[E];if(v){v=!1;continue}if(R==="\\"){v=!0;continue}if(c){if(R===c)c=null;continue}if(R==="'"||R==='"'||R==="`"){c=R;continue}if(R==="/"&&E+1<a.length&&a[E+1]==="/")break;if(R==="{")t++;else if(R==="}")t--}if(h===0){let E=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(E)s.push(E[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let R=a.match(/(?:const|let|var)\s+(\w+)/);if(R)s.push(R[1])}else{let R=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(R){let O=R[1].slice(1,-1).split(",").map((M)=>{let N=M.split(":");return(N.length>1?N[1]:N[0]).trim()}).filter((M)=>/^\w+$/.test(M));s.push(...O)}}}}return[...new Set(s)]}function
|
|
401
|
+
}`,U={vendorStyleTags:v,factoryBody:Z,clientCode:N,deps:sr([...C,...h.styles.map((W)=>W.resolvedPath)])};if(!O&&h.unresolved.length===0)Ws.set(o,U);return U}var un=["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 yl=100,_l=599,qs="__stxResponseStatus",en="__stxResponseHeaders";function Un(e){return typeof e==="number"&&Number.isInteger(e)&&e>=yl&&e<=_l}function cn(e){for(let s of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let t=s[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!t)continue;let o=Number(t[1]);if(Un(o))return o}return}function Zs(e,s){if(!e||typeof e!=="object")return!1;let t=typeof s==="string"&&/^\d+$/.test(s.trim())?Number(s.trim()):s;if(!Un(t))return!1;return e[qs]=t,!0}function wl(e,s,t){if(!e||typeof e!=="object")return;let o=String(s??"").trim();if(!o)return;e[en]={...e[en],[o]:String(t)}}function Rt(e){let s=e?.[qs];return Un(s)?s:void 0}function At(e){let s=e?.[en];if(!s||typeof s!=="object")return;let t=Object.entries(s).map(([o,a])=>[o,String(a)]);return t.length>0?Object.fromEntries(t):void 0}function La(e,s){if(!e||!s||e===s||typeof s!=="object")return;let t=Rt(e);if(t!==void 0)s[qs]=t;let o=At(e);if(o)s[en]={...s[en],...o}}function ps(e){return{setResponseStatus:(s)=>{Zs(e,s)},notFound:(s=404)=>{let t=Un(s)&&s>=400?s:404;Zs(e,t)},setResponseHeader:(s,t)=>{wl(e,s,t)}}}function ja(e,s,t={}){if(!e.includes("@status"))return e;let{filePath:o,buildMode:a}=t,h=a==="compile",c="",v=0,E=/@status\s*\(/g,R;while((R=E.exec(e))!==null){let C=Sl(e,R.index+R[0].length-1);if(C<0)break;let O=e.slice(R.index+R[0].length,C).trim(),M=/^\d+$/.test(O)?Number(O):l(O,s),N=o?` in ${o}`:"";if(h)console.warn(`[stx] @status(${O})${N} 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(${O}) from <script server> instead \u2014 that runs per request.`);else if(!Zs(s,M))console.warn(`[stx] @status(${O})${N} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(v,R.index),v=C+1+(e.slice(C+1).match(/^[^\S\n]*\n?/)?.[0].length??0),E.lastIndex=v}return v===0?e:c+e.slice(v)}function Sl(e,s){let t=1,o=null,a=!1;for(let h=s+1;h<e.length;h++){let c=e[h];if(a){a=!1;continue}if(o){if(c==="\\")a=!0;else if(c===o)o=null;continue}if(c==='"'||c==="'"||c==="`"){o=c;continue}if(c==="(")t++;else if(c===")"&&--t===0)return h}return-1}var Ui=new Set(un),$l=new Set(["props","$props","defineProps"]),vl=new Set(["stx","@stacksjs/stx"]),Hi=y(128),Ki=y(64);function El(e){let s=[],t=0,o=e.split(`
|
|
402
|
+
`);for(let a of o){let h=t,c=null,v=!1;for(let E=0;E<a.length;E++){let R=a[E];if(v){v=!1;continue}if(R==="\\"){v=!0;continue}if(c){if(R===c)c=null;continue}if(R==="'"||R==='"'||R==="`"){c=R;continue}if(R==="/"&&E+1<a.length&&a[E+1]==="/")break;if(R==="{")t++;else if(R==="}")t--}if(h===0){let E=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(E)s.push(E[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let R=a.match(/(?:const|let|var)\s+(\w+)/);if(R)s.push(R[1])}else{let R=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(R){let O=R[1].slice(1,-1).split(",").map((M)=>{let N=M.split(":");return(N.length>1?N[1]:N[0]).trim()}).filter((M)=>/^\w+$/.test(M));s.push(...O)}}}}return[...new Set(s)]}function Hl(e){let s=e;s=s.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),s=s.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),s=s.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),s=s.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),s=s.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function t(o){if(!o.includes(":"))return o;let a=[],h="",c=0,v=0,E=null;for(let R=0;R<o.length;R++){let C=o[R];if(E){if(h+=C,C===E)E=null;continue}if(C==='"'||C==="'"||C==="`"){E=C,h+=C;continue}if(C==="<")c++;else if(C===">"&&c>0)c--;else if(C==="(")v++;else if(C===")")v--;if(C===","&&c===0&&v===0){a.push(h),h="";continue}h+=C}if(h)a.push(h);return a.map((R)=>{let C=R.trim(),O=C.startsWith("..."),M=O?C.slice(3):C,N=-1,I=0;for(let te=0;te<M.length;te++)if(M[te]==="<")I++;else if(M[te]===">")I--;else if(M[te]===":"&&I===0){N=te;break}if(N===-1)return R;let Z=M.substring(0,N).trim().replace(/\?$/,""),U=M.substring(N+1),W=-1,Y=0;for(let te=0;te<U.length;te++)if(U[te]==="<")Y++;else if(U[te]===">")Y--;else if(U[te]==="="&&Y===0){W=te;break}let ee=O?"...":"";if(W!==-1)return`${ee}${Z} = ${U.substring(W+1).trim()}`;return`${ee}${Z}`}).join(", ")}s=s.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(o,a,h)=>{if(!h.includes(":"))return o;return`${a}(${t(h)})`});{let o=/\b(function\s+\w*\s*)\(/g,a,h=[];while((a=o.exec(s))!==null){let c=a.index+a[0].length-1,v=1,E=c+1,R=0,C=null;while(E<s.length&&v>0){let N=s[E];if(C){if(N===C)C=null;E++;continue}if(N==='"'||N==="'"||N==="`"){C=N,E++;continue}if(N==="<")R++;else if(N===">"&&R>0)R--;else if(R===0){if(N==="(")v++;else if(N===")")v--}if(v>0)E++}if(v!==0)continue;let O=s.substring(c+1,E);if(!O.includes(":"))continue;let M=t(O);h.push({start:c+1,end:E,replacement:M})}for(let c=h.length-1;c>=0;c--){let{start:v,end:E,replacement:R}=h[c];s=s.substring(0,v)+R+s.substring(E)}}return s=s.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(o,a)=>{if(!a.includes(":"))return o;if(a.includes("{")||a.includes("}"))return o;return`(${a.split(",").map((c)=>{let[v,...E]=c.split("="),R=v.split(":")[0].trim();if(E.length>0)return`${R} = ${E.join("=").trim()}`;return R}).join(", ")}) =>`}),s=s.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"),s=s.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),s=s.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),s=s.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),s=s.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),s=s.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),s=s.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),s=s.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),s=s.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),s=s.replace(/\n\s*\n\s*\n/g,`
|
|
403
403
|
|
|
404
|
-
`),s}function
|
|
405
|
-
`),xn=s.params??{},Ft=[],bn=[];for(let
|
|
406
|
-
${
|
|
404
|
+
`),s}function Vl(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(s,...t)=>{let[,o,a]=t,h=o??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(h)?"":s})}function Ul(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function Wl(e){if(e instanceof SyntaxError)return!0;let s=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(s)}function ql(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 Zi=new Set;async function g(e,s,t,o={}){if(!e.trim())return;let a=S(),h=b(e,JSON.stringify(a)),c=Hi.get(h);if(c===void 0){try{let Q=X({loader:"ts",target:"browser",define:a}),ne=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ne=ne.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=Q.transformSync(ne)}catch{c=Hl(e)}Hi.set(h,c)}let v={exports:{}},E=v.exports,R=Ct.cwd(),C={},O=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Q)=>Q[1]).filter((Q)=>!Q.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Q)),M=new Map;for(let Q of O)try{if(Q.startsWith(".")){C[Q]=await import(Je.resolve(Je.dirname(t),Q));continue}let ne=Je.resolve(R,"node_modules",Q),fe=Je.join(ne,"package.json"),_e=JSON.parse(f("fs").readFileSync(fe,"utf8")),$e=_e.main||"index.js";if(_e.exports){let ze=typeof _e.exports==="string"?_e.exports:_e.exports["."];if(typeof ze==="string")$e=ze;else if(ze?.bun)$e=ze.bun;else if(ze?.import)$e=ze.import;else if(ze?.default)$e=ze.default}C[Q]=await import(Je.resolve(ne,$e))}catch(ne){if(Q.startsWith("."))M.set(Q,ne instanceof Error?ne.message:String(ne))}let N=(Q)=>{if(C[Q])return C[Q];let ne=M.get(Q);if(ne!==void 0)throw Error(`Cannot require '${Q}' from ${t}: ${ne}`);return f(Q)},I=s.props||{},P=(Q)=>{if(!Q)return I;let ne={};for(let[fe,_e]of Object.entries(Q)){let $e=I[fe];if($e!==void 0)ne[fe]=$e;else if(typeof _e==="function")ne[fe]=_e();else ne[fe]=_e}return ne};for(let[Q,ne]of Object.entries(I))Object.defineProperty(P,Q,{value:ne,enumerable:!0,configurable:!0,writable:!0});let Z=(Q,ne=!1)=>{if(Q===void 0||Q===null)return ne;if(typeof Q==="string"){let fe=Q.trim().toLowerCase();if(fe===""||fe==="true"||fe==="1"||fe==="on"||fe==="yes")return!0;if(fe==="false"||fe==="0"||fe==="off"||fe==="no")return!1;return!0}return Boolean(Q)},U=(Q,ne=0)=>{if(Q===void 0||Q===null)return ne;if(typeof Q==="string"){let _e=Q.trim();if(_e==="")return ne;let $e=Number(_e);return Number.isFinite($e)?$e:ne}let fe=Number(Q);return Number.isFinite(fe)?fe:ne};for(let Q of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(I,Q))continue;try{Object.defineProperty(P,Q,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let W=(Q)=>{if(!Q)return I;let ne={...I};for(let[fe,_e]of Object.entries(Q)){let $e=_e&&typeof _e==="object"&&!Array.isArray(_e)?_e:{type:_e};if(ne[fe]===void 0&&$e.default!==void 0)ne[fe]=typeof $e.default==="function"?$e.default():$e.default}return ne},Y=()=>s.slots||{},ee=(Q,ne)=>{let fe={...Q};for(let[_e,$e]of Object.entries(ne))if(fe[_e]===void 0)if(typeof $e==="function")fe[_e]=$e();else fe[_e]=$e;return fe},te=(Q)=>{let ne=()=>Q;return ne.set=(fe)=>{},ne.update=(fe)=>{},ne},oe=(Q)=>{let ne,fe=!1;return()=>{if(!fe)try{ne=Q(),fe=!0}catch{ne=void 0}return ne}},ge=(Q)=>{},Ee=(Q)=>Q(),ke=(Q)=>{},We=(Q)=>{},Te=ps(s);function Ke(Q){let ne=Q||{};if(ne.title!==void 0||ne.description!==void 0)pt({title:ne.title,description:ne.description})}function Ge(Q){if(!Q||typeof Q!=="object")return;let ne=s.__stxClientPayload??{};Object.assign(ne,Q),s.__stxClientPayload=ne}let xt=()=>{let Q=s.__stxServeContext,ne=s.__stxServeSearch??Q?.search??"",fe=Q?.path??"",_e=Object.fromEntries(new URLSearchParams(ne)),$e=s.query,ze=Object.keys(_e).length>0?_e:$e??{},gt=ne||(Object.keys(ze).length>0?`?${new URLSearchParams(ze).toString()}`:"");return{params:s.params??{},query:ze,path:fe,name:"",fullPath:fe+gt,hash:"",matched:[]}},Hn=()=>({push:(Q)=>{},replace:(Q)=>{},back:()=>{},forward:()=>{},go:(Q)=>{}}),ft=(Q)=>{let ne=s.__stx_runtime_head||{};s.__stx_runtime_head=Fe(ne,xe(Q||{},{known:ks,source:"useHead()"}))},pt=(Q)=>{ft(_s(Q||{}))},dt=(Q)=>({value:Q}),Ot=(Q)=>Q,Js=(Q)=>({value:typeof Q==="function"?Q():Q}),it=(Q,ne)=>{},Ve=(Q)=>{},Mt=(Q)=>{},tn=(Q)=>Q?Q():Promise.resolve(),Kn=(Q)=>(ne,...fe)=>{},Dt=(Q)=>{},Xe=(Q,ne)=>{},jt=(Q,ne)=>ne,Zn=()=>({value:"light"}),bt=()=>te(!1),Ye=(Q)=>te(!1),Lt=()=>te(!1),nn=()=>Ye("(prefers-color-scheme: dark)"),Bt=()=>Ye("(prefers-color-scheme: light)"),zt=()=>Ye("(prefers-reduced-motion: reduce)"),Gs=()=>Ye("(prefers-contrast: more)"),Ze={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},Wt=new Proxy(Ze,{get(Q,ne){if(ne in Q)return Q[ne];return},set(Q,ne,fe){return Q[ne]=fe,!0}}),qn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},tt=console;try{let Q=Io(c,t),ne=new Set(Object.keys(I)),fe=Object.keys(s).filter((ie)=>!ne.has(ie)&&!$l.has(ie)&&Nt(ie)),_e=fe.map((ie)=>s[ie]);if(!fe.includes("__stxServeContext"))fe.push("__stxServeContext"),_e.push(void 0);if(!ne.has("cookies")){let ie=s.cookies??s.__stxServeContext?.cookies??{},me=fe.indexOf("cookies");if(me<0)fe.push("cookies"),_e.push(ie);else _e[me]=ie}let $e=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),ze=[],gt=[];for(let[ie,me]of Object.entries(I)){if(!Nt(ie))continue;if($e.has(ie))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ie}\\b`).test(Q))continue;ze.push(ie),gt.push(me)}let hn=El(Q).map((ie)=>`module.exports.${ie} = typeof ${ie} !== 'undefined' ? ${ie} : module.exports.${ie};`).join(`
|
|
405
|
+
`),xn=s.params??{},Ft=[],bn=[];for(let ie=0;ie<fe.length;ie++){if(fe[ie]==="params")continue;Ft.push(fe[ie]),bn.push(_e[ie])}let yn=[...un,...ze,...Ft],ot=`return (async () => {
|
|
406
|
+
${Q}
|
|
407
407
|
${hn}
|
|
408
408
|
return module.exports
|
|
409
|
-
})()`,yt=b(ot,yn.join("\x00")),qe=Ki.get(yt);if(!qe)qe=Function(...yn,ot),Ki.set(yt,qe);let Ue=s.__stx_options?.runtimeConfig;if(Ue||/\buse(?:Server)?RuntimeConfig\b/.test(c))await gn(s,t,Ue);let
|
|
410
|
-
`),h=[],c=0;while(c<a.length){let v=a[c].trim();if(v.startsWith("interface ")||v.startsWith("export interface ")||v.startsWith("type ")||v.startsWith("export type ")){if(v.includes("{")&&!v.includes("}")){let E=0;for(;c<a.length;c++){for(let R of a[c])if(R==="{")E++;else if(R==="}")E--;if(E<=0)break}}c++;continue}if(v.startsWith("definePageMeta(")){let E=0,R=!1,C=c;for(let N=c;N<a.length&&!R;N++){let I=null,P=!1,Z=a[N];for(let U=0;U<Z.length;U++){let
|
|
411
|
-
`),M=[];for(let N of["title","description"]){let I=new RegExp(`\\b${N}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(O);if(I)M.push(`${N}: ${JSON.stringify(I[2])}`)}if(M.length>0)h.push(`useSeoMeta({ ${M.join(", ")} });`);continue}if(v.startsWith("import ")||v==="import"||v.startsWith("import{")||/^import['"]/.test(v)){let E=v,R=0;while(!
|
|
409
|
+
})()`,yt=b(ot,yn.join("\x00")),qe=Ki.get(yt);if(!qe)qe=Function(...yn,ot),Ki.set(yt,qe);let Ue=s.__stx_options?.runtimeConfig;if(Ue||/\buse(?:Server)?RuntimeConfig\b/.test(c))await gn(s,t,Ue);let ae=await je(s.__stx_runtime_config??mn()??A(),()=>rr(s,()=>qe(v,E,N,I,P,Z,U,W,ee,Ge,fr,Fo,bs,te,oe,ge,Ee,ke,We,Ke,xt,Hn,ft,pt,Te.setResponseStatus,Te.setResponseHeader,Te.notFound,dt,Ot,Js,it,Ve,Mt,tn,Kn,Dt,Y,Xe,jt,Zn,bt,Ye,Lt,nn,Bt,zt,Gs,Wt,qn,tt,Ze.confirm,Ze.alert,Ze.fetch,xn,...gt,...bn)));if(o.preserveExisting){for(let[ie,me]of Object.entries(ae))if(!(ie in s)||s[ie]===void 0)s[ie]=me}else Object.assign(s,ae);for(let[ie,me]of Object.entries(I))if(!(ie in s))s[ie]=me}catch(Q){if(s.__stx_strict_hydration)throw Q;let ne=Vl(Q instanceof Error?Q.message:String(Q));if(Ul(ne))console.warn(`[stx] server <script> in ${t??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ne}`),o.onFailure?.({kind:"module-resolution",message:ne,error:Q});else if(Wl(Q))console.warn(`[stx] server <script> in ${t??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ne}`),o.onFailure?.({kind:"syntax",message:ne,error:Q});else if(ql(ne))console.warn(`[stx] server <script> in ${t??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${ne}`),o.onFailure?.({kind:"missing-binding",message:ne,error:Q});else{let fe=`${t??"<unknown>"}\x00${ne}`;if(Ct.env.STX_DEBUG||!Zi.has(fe))Zi.add(fe),console.warn(`[stx] server <script> in ${t??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ne}`);o.onFailure?.({kind:"unknown",message:ne,error:Q})}try{await Il(c,s,t)}catch(fe){if(Ct.env.STX_DEBUG){let _e=fe instanceof Error?fe.message:String(fe);console.warn(`[stx] fallback extraction also failed in ${t??"<unknown>"}: ${_e}`)}}}}function Gl(e){let s=0,t=null,o=!1,a=!1;for(let h=0;h<e.length;h++){let c=e[h];if(t){if(c===t){if(t=null,o||s===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){t=c;continue}if(c==="{")s++;else if(c==="}")s--;else if(e.startsWith("from",h)&&s===0)o=!0}return t===null&&s===0&&a}var kl=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Io(e,s){let t=s?Je.dirname(s):Ct.cwd(),o=Ct.cwd(),a=e.split(`
|
|
410
|
+
`),h=[],c=0;while(c<a.length){let v=a[c].trim();if(v.startsWith("interface ")||v.startsWith("export interface ")||v.startsWith("type ")||v.startsWith("export type ")){if(v.includes("{")&&!v.includes("}")){let E=0;for(;c<a.length;c++){for(let R of a[c])if(R==="{")E++;else if(R==="}")E--;if(E<=0)break}}c++;continue}if(v.startsWith("definePageMeta(")){let E=0,R=!1,C=c;for(let N=c;N<a.length&&!R;N++){let I=null,P=!1,Z=a[N];for(let U=0;U<Z.length;U++){let W=Z[U];if(P){P=!1;continue}if(W==="\\"){P=!0;continue}if(I){if(W===I)I=null;continue}if(W==='"'||W==="'"||W==="`"){I=W;continue}if(W==="(")E++;else if(W===")"){if(E--,E===0){c=N+1,R=!0;break}}}}if(!R)c=a.length;let O=a.slice(C,c).join(`
|
|
411
|
+
`),M=[];for(let N of["title","description"]){let I=new RegExp(`\\b${N}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(O);if(I)M.push(`${N}: ${JSON.stringify(I[2])}`)}if(M.length>0)h.push(`useSeoMeta({ ${M.join(", ")} });`);continue}if(v.startsWith("import ")||v==="import"||v.startsWith("import{")||/^import['"]/.test(v)){let E=v,R=0;while(!Gl(E)&&c+R+1<a.length)R++,E=`${E} ${a[c+R].trim()}`;c+=R;let C=E.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),O=E.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),M=E.match(/^import\s*['"](.+?)['"]/),N=E,I=(P)=>{if(P.startsWith("."))return Je.resolve(t,P);if(P.startsWith("~/")||P.startsWith("@/"))return Je.resolve(o,P.slice(2));try{return Bun.resolveSync(P,t)}catch{return P}};if(C){let[,P,Z]=C,U=I(Z);h.push(`const ${P} = (await import('${U}')).default`),h.push(`module.exports.${P} = ${P};`)}else if(O){let[,P,Z]=O,U=I(Z),W=[],Y=[],ee=vl.has(Z);for(let te of P.split(",")){let oe=te.trim();if(!oe)continue;let ge=oe.split(/\s+as\s+/);if(ge.length===2){let[Ee,ke]=[ge[0].trim(),ge[1].trim()];if(ee&&Ui.has(Ee)){h.push(`const ${ke} = ${Ee};`);continue}W.push(`${Ee}: ${ke}`),Y.push(ke)}else{if(ee&&Ui.has(oe))continue;W.push(oe),Y.push(oe)}}if(W.length>0)h.push(`const { ${W.join(", ")} } = await import('${U}')`);for(let te of Y)h.push(`module.exports.${te} = ${te};`)}else if(M){let P=I(M[1]);h.push(`await import('${P}')`)}else h.push(N);c++;continue}if(kl.test(v))h.push(a[c]),c++;else if(v.startsWith("export const ")||v.startsWith("export let ")||v.startsWith("export var ")){let E=Xi(a,c),{type:R,name:C,value:O}=E;h.push(`${R} ${C} = ${O};`),h.push(`module.exports.${C} = ${C};`),c=E.nextIndex}else if(v.startsWith("export function ")||v.startsWith("export async function ")){let E=Xs(a,c);h.push(E.functionCode),h.push(`module.exports.${E.name} = ${E.name};`),c=E.nextIndex}else if(v.startsWith("const ")||v.startsWith("let ")||v.startsWith("var ")){let E=Xi(a,c),{type:R,name:C,value:O}=E;h.push(`${R} ${C} = ${O};`),h.push(`module.exports.${C} = ${C};`),c=E.nextIndex}else if(v.startsWith("function ")||v.startsWith("async function ")){let E=Xs(a,c);h.push(E.functionCode),h.push(`module.exports.${E.name} = ${E.name};`),c=E.nextIndex}else if(v.startsWith("export default function ")||v.startsWith("export default async function ")){let E=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),R=[...a];R[c]=E;let C=Xs(R,c);if(h.push(C.functionCode),C.name)h.push(`module.exports.default = ${C.name};`);c=C.nextIndex}else if(v.startsWith("export default ")){let E=v.replace(/^export\s+default\s+/,"").replace(/;$/,"");h.push(`module.exports.default = ${E};`),c++}else if(v.startsWith("class ")||v.startsWith("export class ")){let E=v.match(/(?:export\s+)?class\s+(\w+)/);if(E){let R=E[1],C=a[c].replace(/^export\s+/,""),O=0,M=c;for(;M<a.length;M++){let N=a[M];for(let I of N)if(I==="{")O++;else if(I==="}")O--;if(M>c)C+=`
|
|
412
412
|
`+N;if(O<=0&&M>=c)break}h.push(C),h.push(`module.exports.${R} = ${R};`),c=M+1}else h.push(v),c++}else if(v.includes("module.exports"))h.push(v),c++;else if(v.trim()&&!v.startsWith("//"))h.push(v),c++;else c++}return Rl(h.join(`
|
|
413
413
|
`),t,o)}function Rl(e,s,t){let o=e.length,a="",h=0,c=null,v=!1,E=!1,R=0;while(h<o){let C=e[h],O=e[h+1];if(v){if(a+=C,C===`
|
|
414
|
-
`)v=!1;h++;continue}if(E){if(a+=C,C==="*"&&O==="/"){a+=O,h+=2,E=!1;continue}h++;continue}if(!c&&C==="/"&&O==="/"){v=!0,a+=C,h++;continue}if(!c&&C==="/"&&O==="*"){E=!0,a+=C,h++;continue}if(c){if(a+=C,C==="\\"){a+=O,h+=2;continue}if(C===c&&c!=="`"){c=null,h++;continue}if(c==="`"){if(C==="$"&&O==="{"){R++,a+=O,h+=2;continue}if(C==="`"){c=null,h++;continue}}h++;continue}if(R>0){if(C==="{")R++;else if(C==="}")R--}if(C==='"'||C==="'"||C==="`"){c=C,a+=C,h++;continue}if(C==="a"&&e.startsWith("await",h)){let M=Cl(e,h);if(M){let{quote:N,path:I,end:P}=M;if(I.startsWith(".")||I.startsWith("~/")||I.startsWith("@/")){let Z=I.startsWith(".")?Je.resolve(s,I):Je.resolve(t,I.slice(2));a+=`await import(${N}${Z}${N})`,h=P;continue}}}a+=C,h++}return a}function Cl(e,s){let t=s+5;if(t>=e.length)return null;if(!/\s/.test(e[t]))return null;while(t<e.length&&/\s/.test(e[t]))t++;if(!e.startsWith("import",t))return null;t+=6;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!=="(")return null;t++;while(t<e.length&&/\s/.test(e[t]))t++;let o=e[t];if(o!=="'"&&o!=='"')return null;t++;let a=t;while(t<e.length&&e[t]!==o)if(e[t]==="\\")t+=2;else t++;if(t>=e.length)return null;let h=e.slice(a,t);t++;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!==")")return null;return{quote:o,path:h,end:t+1}}function Qi(e,s){let t=e[s];if(t!=="{"&&t!=="[")return null;let a=w(e,t,t==="{"?"}":"]",s);if(a===-1)return null;return{pattern:e.slice(s,a+1),endPos:a+1}}function eo(e){let s=[],t=e.slice(1,-1).trim();if(!t)return s;let o=0,a=0,h="";while(o<t.length){let c=t[o];if(c==="{"||c==="["){let v=a===0?Qi(t,o):null;if(v){s.push(...eo(v.pattern)),o=v.endPos,h="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){o++;continue}if(c===","){if(h.trim())s.push(h.trim());h="",o++;continue}if(c===":"){h="",o++;continue}if(c==="="){if(h.trim())s.push(h.trim());h="",o++;while(o<t.length&&t[o]!==","&&a===0){if(t[o]==="{"||t[o]==="[")a++;else if(t[o]==="}"||t[o]==="]")a--;o++}continue}if(/[\w$]/.test(c))h+=c;o++}if(h.trim())s.push(h.trim());return s}function
|
|
415
|
-
`);return{type:I,name:
|
|
416
|
-
${
|
|
414
|
+
`)v=!1;h++;continue}if(E){if(a+=C,C==="*"&&O==="/"){a+=O,h+=2,E=!1;continue}h++;continue}if(!c&&C==="/"&&O==="/"){v=!0,a+=C,h++;continue}if(!c&&C==="/"&&O==="*"){E=!0,a+=C,h++;continue}if(c){if(a+=C,C==="\\"){a+=O,h+=2;continue}if(C===c&&c!=="`"){c=null,h++;continue}if(c==="`"){if(C==="$"&&O==="{"){R++,a+=O,h+=2;continue}if(C==="`"){c=null,h++;continue}}h++;continue}if(R>0){if(C==="{")R++;else if(C==="}")R--}if(C==='"'||C==="'"||C==="`"){c=C,a+=C,h++;continue}if(C==="a"&&e.startsWith("await",h)){let M=Cl(e,h);if(M){let{quote:N,path:I,end:P}=M;if(I.startsWith(".")||I.startsWith("~/")||I.startsWith("@/")){let Z=I.startsWith(".")?Je.resolve(s,I):Je.resolve(t,I.slice(2));a+=`await import(${N}${Z}${N})`,h=P;continue}}}a+=C,h++}return a}function Cl(e,s){let t=s+5;if(t>=e.length)return null;if(!/\s/.test(e[t]))return null;while(t<e.length&&/\s/.test(e[t]))t++;if(!e.startsWith("import",t))return null;t+=6;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!=="(")return null;t++;while(t<e.length&&/\s/.test(e[t]))t++;let o=e[t];if(o!=="'"&&o!=='"')return null;t++;let a=t;while(t<e.length&&e[t]!==o)if(e[t]==="\\")t+=2;else t++;if(t>=e.length)return null;let h=e.slice(a,t);t++;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!==")")return null;return{quote:o,path:h,end:t+1}}function Qi(e,s){let t=e[s];if(t!=="{"&&t!=="[")return null;let a=w(e,t,t==="{"?"}":"]",s);if(a===-1)return null;return{pattern:e.slice(s,a+1),endPos:a+1}}function eo(e){let s=[],t=e.slice(1,-1).trim();if(!t)return s;let o=0,a=0,h="";while(o<t.length){let c=t[o];if(c==="{"||c==="["){let v=a===0?Qi(t,o):null;if(v){s.push(...eo(v.pattern)),o=v.endPos,h="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){o++;continue}if(c===","){if(h.trim())s.push(h.trim());h="",o++;continue}if(c===":"){h="",o++;continue}if(c==="="){if(h.trim())s.push(h.trim());h="",o++;while(o<t.length&&t[o]!==","&&a===0){if(t[o]==="{"||t[o]==="[")a++;else if(t[o]==="}"||t[o]==="]")a--;o++}continue}if(/[\w$]/.test(c))h+=c;o++}if(h.trim())s.push(h.trim());return s}function Kl(e){let s=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!s)return null;let t=s[0].length,o=(a)=>a===" "||a==="\t";while(t<e.length&&o(e[t]))t++;if(e[t]===":"){let a=0,h=null;t++;for(;t<e.length;t++){let c=e[t];if(h){if(c==="\\"){t++;continue}if(c===h)h=null;continue}if(c==="'"||c==='"'||c==="`"){h=c;continue}if(c==="("||c==="["||c==="{"||c==="<"){a++;continue}if(c===")"||c==="]"||c==="}"||c===">"){a--;continue}if(c==="="&&a<=0){let v=e[t+1],E=e[t-1];if(v!=="="&&v!==">"&&E!=="="&&E!=="!"&&E!=="<"&&E!==">")break}}if(e[t]!=="=")return null}while(t<e.length&&o(e[t]))t++;if(e[t]!=="=")return null;return{type:s[1],name:s[2],value:e.slice(t+1).trim()}}function qi(e,s,t,o){let a=null,h=!1;for(let c of e){if(h){h=!1;continue}if(c==="\\"){h=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c===s)o++;else if(c===t)o--}return o}function Xi(e,s){let t=e[s].trim(),o=Kl(t),a=o?[t,o.type,o.name,o.value]:null;if(!a){let C=t.match(/^(?:export\s+)?(const|let|var)\s+/);if(C){let O=t.slice(C[0].length),M=s;if(O.startsWith("{")||O.startsWith("[")){let I=O[0],P=I==="{"?"}":"]",Z=qi(O,I,P,0),U=O;for(let W=s+1;W<e.length&&Z>0;W++)U+=` ${e[W].trim()}`,M=W,Z=qi(e[W],I,P,Z);if(Z>0)U=O,M=s;O=U}let N=Qi(O,0);if(N){let I=C[1],P=N.pattern,Z=O.slice(N.endPos).trim();if(Z.startsWith("=")){let U=Z.slice(1).trim(),W=U,Y=Math.max(M,s);if(Ji(U)){let ge=Gi(e,Y,U);W=ge.value,Y=ge.nextIndex}else Y=Y+1;W=W.trim().replace(/;$/,"");let ee=eo(P),te=`__stx_src_${s}`,oe=ee.map((ge)=>`module.exports.${ge} = ${ge};`).join(`
|
|
415
|
+
`);return{type:I,name:te,value:`${W}; ${I} ${P} = ${te};
|
|
416
|
+
${oe}`,nextIndex:Y}}}}throw Error(`Failed to parse variable declaration: ${t}`)}let[,h,c,v]=a,E=v,R=s;if(Ji(v)){let C=Gi(e,s,v);E=C.value,R=C.nextIndex}else R=s+1;while(R<e.length){let C=e[R].trim();if(C.startsWith(".")||C.startsWith("?."))E+=`
|
|
417
417
|
${e[R]}`,R++;else break}return E=E.trim().replace(/;$/,""),{type:h,name:c,value:E,nextIndex:R}}function Xs(e,s){let t=e[s].trim(),o=t.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!o)throw Error(`Failed to parse function declaration: ${t}`);let[,a]=o,h=t.replace(/^export\s+/,""),c=s;if(Tl(t)){let v=Al(e,s,h);h=v.functionCode,c=v.nextIndex}else c=s+1;return{name:a,functionCode:h,nextIndex:c}}function Ji(e){let s=e.trim();if(s.startsWith("{"))return w(s,"{","}",0)===-1;if(s.startsWith("["))return w(s,"[","]",0)===-1;return!to(s)}function to(e){let s={paren:0,bracket:0,brace:0},t=null,o=0;for(let a=0;a<e.length;a++){let h=e[a];if((a>0?e[a-1]:"")==="\\"&&t)continue;if((h==='"'||h==="'")&&!t){t=h;continue}if(h===t&&t!=="`"){t=null;continue}if(h==="`"&&!t){t="`";continue}if(h==="`"&&t==="`"&&o===0){t=null;continue}if(t==="`"&&h==="$"&&e[a+1]==="{"){o++,a++;continue}if(o>0&&h==="{"){o++;continue}if(o>0&&h==="}"){o--;continue}if(t)continue;if(h==="(")s.paren++;else if(h===")")s.paren--;else if(h==="[")s.bracket++;else if(h==="]")s.bracket--;else if(h==="{")s.brace++;else if(h==="}")s.brace--}return s.paren===0&&s.bracket===0&&s.brace===0&&t===null}function no(e){let s=e.indexOf("(");if(s===-1)return e.indexOf("{");let t=w(e,"(",")",s);if(t===-1)return-1;return e.indexOf("{",t)}function Tl(e){let s=no(e);if(s===-1)return!0;return w(e,"{","}",s)===-1}function Gi(e,s,t){let o=t,a=s+1;while(a<e.length&&!to(o)){let h=e[a];o+=`
|
|
418
418
|
${h}`,a++}while(a<e.length){let h=e[a].trim();if(h.startsWith(".")||h.startsWith("?."))o+=`
|
|
419
419
|
${e[a]}`,a++;else break}return{value:o,nextIndex:a}}function Al(e,s,t){let o=t,a=s+1;while(a<e.length){let h=no(o);if(h!==-1){if(w(o,"{","}",h)!==-1)break}let c=e[a];o+=`
|
|
420
|
-
${c}`,a++}return{functionCode:o,nextIndex:a}}function Yi(e,s){let t=l(e,s)??l(`(${e})`,s);if(t!==void 0)return t;if(!/\bprocess\b/.test(e))return;let o={...s,process:Object.freeze({env:{...Ct.env}})},a=Object.keys(o).filter(Nt),h=a.map((c)=>o[c]);try{return Function(...a,`'use strict'; return (${e});`)(...h)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...h)}catch{return}}}async function Il(e,s,t){let o=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let h of o){let[,,c,v]=h;try{let E=v.trim().replace(/;$/,""),R=Yi(E,s);if(R!==void 0)s[c]=R}catch(E){console.warn(`Failed to parse export ${c} in fallback:`,E)}}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 h of a){let[,,c,v]=h;if(!(c in s))try{let E=v.trim().replace(/;$/,""),R=Yi(E,s);if(R!==void 0)s[c]=R}catch{}}}function
|
|
421
|
-
export{Re,
|
|
420
|
+
${c}`,a++}return{functionCode:o,nextIndex:a}}function Yi(e,s){let t=l(e,s)??l(`(${e})`,s);if(t!==void 0)return t;if(!/\bprocess\b/.test(e))return;let o={...s,process:Object.freeze({env:{...Ct.env}})},a=Object.keys(o).filter(Nt),h=a.map((c)=>o[c]);try{return Function(...a,`'use strict'; return (${e});`)(...h)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...h)}catch{return}}}async function Il(e,s,t){let o=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let h of o){let[,,c,v]=h;try{let E=v.trim().replace(/;$/,""),R=Yi(E,s);if(R!==void 0)s[c]=R}catch(E){console.warn(`Failed to parse export ${c} in fallback:`,E)}}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 h of a){let[,,c,v]=h;if(!(c in s))try{let E=v.trim().replace(/;$/,""),R=Yi(E,s);if(R!==void 0)s[c]=R}catch{}}}function Ua(e){let s=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),t=s?s[1]:"",o=s?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:t,templateWithoutScript:o}}function Wa(e){let s=e.trim();if(!s)return!1;return/(?:const|let|var|function)\s+\w+/.test(s)}
|
|
421
|
+
export{Re,ye,L,rs,ss,j,os,is,as,ko,_o,Co,Ta,rn,r,sn,B,Et,re,y,$a,b,sr,cs,be,S,Ae,le,or,q,on,Pe,ue,Ra,de,G,ir,ls,se,Tt,K,F,Qe,ar,cr,$t,Eo,To,zl,Ie,Aa,Pa,Ia,$o,Oa,us,Ro,Na,Da,Ma,Ao,an,ds,cn,Rt,At,La,ps,ja,ln,lr,gs,ms,Ba,Po,Fa,za,Ha,Va,un,Hl,Vl,Ul,Wl,ql,g,Gl,Io,Kl,Ua,Wa,Oo,No,Xl,Pt,qa,Do,Ga,Rp,Oe,dn,Ne,Jl,Yl,Zl,Ql,eu,hs,tu,De,X,Me,nu,ur,ru,Ka,Mo,Le,n,pn,Xa,m,pe,Ap,Ja,Ya,Za,Lo,ys,su,Pp,ou,Ip,It,d,z,J,fn,ve,iu,jo,au,Op,k,cu,Np,_,Dp};
|