@stacksjs/stx 0.2.861 → 0.2.862
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/analytics.js +3 -2
- package/dist/animation.js +3 -3
- package/dist/app-shell.js +4 -3
- package/dist/{chunk-14cvwsy1.js → chunk-01c16zw4.js} +2 -2
- package/dist/chunk-0bfgsv31.js +2 -0
- package/dist/chunk-0c9c9v03.js +14 -0
- package/dist/{chunk-naj146zq.js → chunk-0fh47gp0.js} +2 -2
- package/dist/chunk-0fpx3ctt.js +2 -0
- package/dist/chunk-0twkeh31.js +2 -0
- package/dist/chunk-0xtda6aw.js +2 -0
- package/dist/chunk-12sv6b9c.js +2 -0
- package/dist/chunk-194t5qat.js +2 -0
- package/dist/chunk-1crn4fv0.js +2 -0
- package/dist/chunk-1d3swbqw.js +2 -0
- package/dist/{chunk-9syvkm5z.js → chunk-1mqcttg3.js} +6 -6
- package/dist/chunk-1qf07v41.js +2 -0
- package/dist/chunk-24hq8mka.js +3 -0
- package/dist/chunk-2asyyky3.js +2 -0
- package/dist/chunk-2dpessnc.js +54 -0
- package/dist/{chunk-h4aqpf2r.js → chunk-2jgtfjyr.js} +5 -5
- package/dist/chunk-2kfayg4t.js +712 -0
- package/dist/chunk-2rff5mbj.js +4 -0
- package/dist/chunk-2s7rmn9r.js +3 -0
- package/dist/{chunk-avp271q4.js → chunk-2srjavsn.js} +2 -2
- package/dist/chunk-2zqh7xct.js +2 -0
- package/dist/chunk-321fbxnm.js +1327 -0
- package/dist/chunk-3gk1e2b1.js +2 -0
- package/dist/chunk-3ryp43f3.js +2 -0
- package/dist/{chunk-12r22pf0.js → chunk-3z1mmar2.js} +2 -2
- package/dist/{chunk-zhxdpzga.js → chunk-46ddesnf.js} +3 -3
- package/dist/chunk-46pxmpeb.js +3 -0
- package/dist/chunk-4pr29yrx.js +2 -0
- package/dist/{chunk-6nb49h13.js → chunk-4xanjv22.js} +125 -126
- package/dist/chunk-4ykgjewy.js +16 -0
- package/dist/{chunk-tjz3r7rj.js → chunk-55zq2ha8.js} +5 -5
- package/dist/{chunk-gggadrs4.js → chunk-5a0d3048.js} +3 -3
- package/dist/chunk-5ertqfs3.js +2 -0
- package/dist/chunk-627hzzs3.js +2 -0
- package/dist/chunk-64ebysb4.js +2 -0
- package/dist/{chunk-4rrxrxp6.js → chunk-669b2bya.js} +4 -4
- package/dist/{chunk-38qp2pg2.js → chunk-67dgp45w.js} +2 -2
- package/dist/chunk-6fstz73t.js +2 -0
- package/dist/{chunk-5xdkmn39.js → chunk-6ftee542.js} +2 -2
- package/dist/{chunk-5wr1qqz3.js → chunk-6k4ac74t.js} +2 -2
- package/dist/{chunk-121cgm3s.js → chunk-6m63rc7m.js} +8 -8
- package/dist/{chunk-c2w4wc9f.js → chunk-6m6y9bbx.js} +1 -1
- package/dist/chunk-6pczzq5f.js +2 -0
- package/dist/{chunk-6tp0w6hf.js → chunk-7ayvybdy.js} +3 -3
- package/dist/chunk-7mjf144y.js +2 -0
- package/dist/{chunk-5neezkj1.js → chunk-7mpqfg98.js} +21 -21
- package/dist/chunk-7q5h2cve.js +2 -0
- package/dist/chunk-7wqevtks.js +2 -0
- package/dist/chunk-84ztb43k.js +2 -0
- package/dist/{chunk-bag9q4m0.js → chunk-8502xb4n.js} +39 -39
- package/dist/{chunk-5ka3h8dy.js → chunk-85j9qh7v.js} +45 -46
- package/dist/{chunk-cxpq2zna.js → chunk-8arfg8kp.js} +3 -3
- package/dist/{chunk-xmy6g81m.js → chunk-8hhhmscy.js} +2 -2
- package/dist/{chunk-fyfvqd2s.js → chunk-8me8hamk.js} +2 -2
- package/dist/{chunk-pb09xy77.js → chunk-8s6s6nd0.js} +2 -2
- package/dist/chunk-8v1zpdef.js +2 -0
- package/dist/chunk-94mpe1ny.js +3 -0
- package/dist/chunk-94wnfxnd.js +2 -0
- package/dist/chunk-9jxs8sw2.js +2 -0
- package/dist/{chunk-eye156nv.js → chunk-9y9jecky.js} +1 -1
- package/dist/{chunk-mzes9ds7.js → chunk-9zrvh3pz.js} +2 -2
- package/dist/{chunk-68w65mhs.js → chunk-adb045wf.js} +3 -3
- package/dist/{chunk-fpkp0bqf.js → chunk-adqh1gp1.js} +1 -1
- package/dist/chunk-az5xw3w8.js +2 -0
- package/dist/chunk-ba91r7q9.js +2 -0
- package/dist/{chunk-qkcn0exq.js → chunk-brzjass3.js} +6 -6
- package/dist/chunk-bv7g3b3b.js +2 -0
- package/dist/chunk-bwdbj60y.js +3 -0
- package/dist/chunk-bwz2ehq9.js +33 -0
- package/dist/{chunk-3wg9kr5z.js → chunk-bx5d87xx.js} +6 -7
- package/dist/chunk-bz6dg4k8.js +3 -0
- package/dist/chunk-c34qn4k8.js +16 -0
- package/dist/{chunk-37tefp7s.js → chunk-cqhwzd9y.js} +5 -5
- package/dist/chunk-cvgbtmxp.js +2 -0
- package/dist/chunk-czpn3n1p.js +2 -0
- package/dist/chunk-dhnw2qwq.js +25 -0
- package/dist/{chunk-65cbfx5x.js → chunk-dpmayc2w.js} +2 -2
- package/dist/{chunk-d6216bcw.js → chunk-dtarm8x9.js} +9 -9
- package/dist/chunk-dydy9zrq.js +3 -0
- package/dist/chunk-eafqxbr0.js +2 -0
- package/dist/{chunk-hyea17hp.js → chunk-eeq8k81z.js} +155 -157
- package/dist/{chunk-qjm23ma2.js → chunk-ew5cey88.js} +1 -1
- package/dist/chunk-fa97kz5j.js +2 -0
- package/dist/{chunk-xppm4cs4.js → chunk-farh4p7f.js} +3 -3
- package/dist/{chunk-b1tctqn5.js → chunk-fnxg6134.js} +10 -10
- package/dist/chunk-g075cc67.js +2 -0
- package/dist/{chunk-zpkgs5d3.js → chunk-g5xth2yx.js} +6 -6
- package/dist/{chunk-q6w7a1vc.js → chunk-gbtbfg7e.js} +3 -3
- package/dist/{chunk-15jymk6t.js → chunk-gd56arnm.js} +2 -2
- package/dist/chunk-gmm3kffd.js +2 -0
- package/dist/{chunk-8hck9qqm.js → chunk-gp8hgpt9.js} +4 -4
- package/dist/chunk-h2qgqjkn.js +2 -0
- package/dist/chunk-h65shwe9.js +2 -0
- package/dist/chunk-hdjn7nw9.js +20 -0
- package/dist/{chunk-cq2hedwn.js → chunk-hev4t4d5.js} +6 -6
- package/dist/chunk-hf5fj7pr.js +2 -0
- package/dist/{chunk-7yhhwv07.js → chunk-hmdkf6c6.js} +2 -2
- package/dist/chunk-hsp9h3jn.js +2 -0
- package/dist/{chunk-vggtxttf.js → chunk-j1efsjsb.js} +5 -5
- package/dist/chunk-j4zrq17p.js +2 -0
- package/dist/chunk-jx5mss16.js +2 -0
- package/dist/chunk-jz84z19v.js +2 -0
- package/dist/{chunk-5rxks14t.js → chunk-k32q90b2.js} +2 -2
- package/dist/{chunk-x69457q9.js → chunk-kbdz4762.js} +8 -8
- package/dist/chunk-kw11yydy.js +2 -0
- package/dist/{chunk-wrbhq1y2.js → chunk-kwk3kxrx.js} +3 -3
- package/dist/chunk-kyer53x3.js +2 -0
- package/dist/chunk-m9cperj4.js +2 -0
- package/dist/{chunk-zs4s9fcq.js → chunk-mcnwvh06.js} +6 -6
- package/dist/chunk-meqsd5bt.js +2 -0
- package/dist/{chunk-dba4bwkd.js → chunk-mfa07erx.js} +16 -16
- package/dist/chunk-mj4wbrw7.js +2 -0
- package/dist/{chunk-76360zky.js → chunk-mjy98ppb.js} +9 -9
- package/dist/{chunk-jh2v1vvb.js → chunk-mrh08821.js} +3 -3
- package/dist/{chunk-15rkvc0t.js → chunk-n058hznh.js} +5 -5
- package/dist/{chunk-9n8t7v78.js → chunk-n3jw3xpj.js} +2 -2
- package/dist/chunk-nz9z3ct9.js +2 -0
- package/dist/chunk-p0tkhd12.js +2 -0
- package/dist/chunk-p2etn78y.js +2 -0
- package/dist/{chunk-1nankvf6.js → chunk-pbakxcv8.js} +2 -2
- package/dist/{chunk-t5q31st4.js → chunk-q1wxgw5s.js} +2 -2
- package/dist/chunk-qa5y30sy.js +72 -0
- package/dist/{chunk-m3p4hksq.js → chunk-qbghf76y.js} +4 -4
- package/dist/{chunk-a6d92kv6.js → chunk-qcxrcypb.js} +2 -2
- package/dist/{chunk-1jwcp2k0.js → chunk-qjey0jk6.js} +2 -2
- package/dist/chunk-rqa92xm4.js +2 -0
- package/dist/chunk-rvhrtnv3.js +12 -0
- package/dist/{chunk-bg0ywp5w.js → chunk-s0sad753.js} +2 -2
- package/dist/chunk-s92j8k4z.js +2 -0
- package/dist/chunk-s9df8srx.js +6 -0
- package/dist/{chunk-dt73ww6m.js → chunk-sb8n32rn.js} +1 -1
- package/dist/chunk-snz2cxqv.js +2 -0
- package/dist/{chunk-36vksrry.js → chunk-srgnevws.js} +2 -2
- package/dist/chunk-srgpz94e.js +42 -0
- package/dist/{chunk-9pyvc0dc.js → chunk-tnp2ta5q.js} +2 -2
- package/dist/{chunk-gx96hctv.js → chunk-v37zmez0.js} +2 -2
- package/dist/chunk-v408qsze.js +2 -0
- package/dist/{chunk-thdnk1kd.js → chunk-v4xes880.js} +3 -3
- package/dist/chunk-vfx1p83g.js +33 -0
- package/dist/chunk-vk98r75z.js +2 -0
- package/dist/{chunk-yj9nyt93.js → chunk-vvzys1x7.js} +3 -3
- package/dist/{chunk-f1vvhbmw.js → chunk-w6pzkcjp.js} +2 -2
- package/dist/chunk-x0s68p47.js +2 -0
- package/dist/{chunk-3gfd9t8a.js → chunk-x512h2gv.js} +4 -4
- package/dist/{chunk-nwxjh1gv.js → chunk-x7redxyd.js} +4 -4
- package/dist/chunk-xjxcwrqs.js +2 -0
- package/dist/chunk-xsq2jf96.js +2 -0
- package/dist/chunk-xymr4ys9.js +3 -0
- package/dist/{chunk-7bajrfb1.js → chunk-y3qg95wa.js} +8 -8
- package/dist/chunk-y7f2x57s.js +2 -0
- package/dist/chunk-ymdw4fhd.js +3 -0
- package/dist/chunk-ymjjn9pw.js +20 -0
- package/dist/chunk-ynkbv9jq.js +4 -0
- package/dist/{chunk-e8nzbz66.js → chunk-ysfeg3cn.js} +2 -2
- package/dist/chunk-ytzzth34.js +2 -0
- package/dist/chunk-yxpjj003.js +2 -0
- package/dist/chunk-z1rs6b4x.js +2 -0
- package/dist/{chunk-tm201m9x.js → chunk-z512gt4v.js} +3 -3
- package/dist/chunk-z6ntmv5x.js +2 -0
- package/dist/{chunk-5n7m8vqx.js → chunk-zbvfjm4a.js} +2 -2
- package/dist/chunk-zsnmk5me.js +2 -0
- package/dist/cli.js +35 -35
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/serve-app.js +3 -2
- package/dist/dev-server/serve-multi.js +3 -4
- package/dist/dev-server/ts-css.js +4 -5
- package/dist/document-shell.js +4 -3
- package/dist/document-tags.d.ts +8 -0
- package/dist/document-tags.js +37 -0
- package/dist/events.js +2 -1
- package/dist/head-injection.js +2 -1
- package/dist/heatmap.js +2 -1
- package/dist/hot-reload.js +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/native-build.js +3 -3
- package/dist/process.js +5 -6
- package/dist/production-build.js +3 -3
- package/dist/pwa/inject.js +3 -3
- package/dist/pwa.js +3 -3
- package/dist/reactive-bindings.js +2 -1
- package/dist/reactive.js +2 -1
- package/dist/render.js +1 -1
- package/dist/runtime-injection.js +6 -6
- package/dist/serve.js +1 -1
- package/dist/site-builder/build.js +1 -1
- package/dist/site-builder/i18n.js +2 -2
- package/dist/site-builder/router.js +1 -1
- package/dist/site-builder/theme.js +1 -1
- package/dist/ssg.js +30 -31
- package/dist/template-hydrator.js +2 -1
- package/dist/web-components/css-scoping.js +3 -3
- package/dist/x-element.js +2 -1
- package/package.json +5 -5
- package/dist/body-close.d.ts +0 -13
- package/dist/body-close.js +0 -8
- package/dist/chunk-02css3vk.js +0 -14
- package/dist/chunk-0hqr6bff.js +0 -2
- package/dist/chunk-15sgdvyd.js +0 -2
- package/dist/chunk-261t62q4.js +0 -712
- package/dist/chunk-2b4a8tbd.js +0 -3
- package/dist/chunk-2fw36w1x.js +0 -2
- package/dist/chunk-2jcxsw75.js +0 -2
- package/dist/chunk-2pbhdaka.js +0 -2
- package/dist/chunk-2wba5ypm.js +0 -2
- package/dist/chunk-353gnvfe.js +0 -2
- package/dist/chunk-3cr5y8v1.js +0 -2
- package/dist/chunk-3y7yp0ka.js +0 -2
- package/dist/chunk-41wwqw0q.js +0 -2
- package/dist/chunk-4a1y51fs.js +0 -2
- package/dist/chunk-4a751brg.js +0 -2
- package/dist/chunk-4jgcd4d9.js +0 -33
- package/dist/chunk-5awhm4na.js +0 -2
- package/dist/chunk-5fhp9hxd.js +0 -2
- package/dist/chunk-5mg443dw.js +0 -2
- package/dist/chunk-5q4tncfw.js +0 -18
- package/dist/chunk-5x9ajbq0.js +0 -2
- package/dist/chunk-6g7tkmty.js +0 -2
- package/dist/chunk-72bj7ea4.js +0 -2
- package/dist/chunk-74g64pzt.js +0 -20
- package/dist/chunk-7de5y29a.js +0 -54
- package/dist/chunk-7ycmnsh5.js +0 -2
- package/dist/chunk-811hh6vp.js +0 -2
- package/dist/chunk-830ej8d2.js +0 -72
- package/dist/chunk-8fkmxrat.js +0 -2
- package/dist/chunk-8p9npc8y.js +0 -2
- package/dist/chunk-9fz3h6sx.js +0 -2
- package/dist/chunk-9jr30fns.js +0 -2
- package/dist/chunk-9xr628ew.js +0 -3
- package/dist/chunk-a9m6ajd7.js +0 -2
- package/dist/chunk-aj6vqdf7.js +0 -25
- package/dist/chunk-asr5v51s.js +0 -2
- package/dist/chunk-b7nmgkwa.js +0 -42
- package/dist/chunk-bv14vry8.js +0 -3
- package/dist/chunk-byx82s10.js +0 -2
- package/dist/chunk-c9y1g61m.js +0 -2
- package/dist/chunk-ck5nzbbv.js +0 -2
- package/dist/chunk-cvdm0hgq.js +0 -2
- package/dist/chunk-e0fxgbcc.js +0 -2
- package/dist/chunk-ed2m6pjf.js +0 -2
- package/dist/chunk-ednwdhv0.js +0 -2
- package/dist/chunk-egtphftq.js +0 -2
- package/dist/chunk-f18rxz70.js +0 -2
- package/dist/chunk-fahqq7c4.js +0 -2
- package/dist/chunk-fcbpzdyz.js +0 -2
- package/dist/chunk-gc79s0wh.js +0 -20
- package/dist/chunk-gjnrmz2q.js +0 -4
- package/dist/chunk-gp1dt8b8.js +0 -33
- package/dist/chunk-h0dsxxz4.js +0 -2
- package/dist/chunk-h2cvfp9y.js +0 -2
- package/dist/chunk-jhm1228j.js +0 -4
- package/dist/chunk-k3yym9zg.js +0 -2
- package/dist/chunk-k9fsd6t3.js +0 -2
- package/dist/chunk-kepxsjfx.js +0 -2
- package/dist/chunk-kgrvvtcy.js +0 -3
- package/dist/chunk-kh01rvag.js +0 -2
- package/dist/chunk-kv40xq53.js +0 -1329
- package/dist/chunk-mad172af.js +0 -2
- package/dist/chunk-mjkdskeg.js +0 -12
- package/dist/chunk-npt0mdzb.js +0 -2
- package/dist/chunk-p95fsnbk.js +0 -2
- package/dist/chunk-ptc3yqn3.js +0 -2
- package/dist/chunk-pybm7c9p.js +0 -2
- package/dist/chunk-q87hkwfg.js +0 -3
- package/dist/chunk-qe6631me.js +0 -2
- package/dist/chunk-qnx71b17.js +0 -2
- package/dist/chunk-qx8cav4w.js +0 -2
- package/dist/chunk-rb7cwck6.js +0 -2
- package/dist/chunk-s1e0t3hv.js +0 -2
- package/dist/chunk-s7vfmasx.js +0 -2
- package/dist/chunk-scwbttvt.js +0 -3
- package/dist/chunk-shy2hkvj.js +0 -2
- package/dist/chunk-sxtvy0sm.js +0 -3
- package/dist/chunk-t7z67vf6.js +0 -2
- package/dist/chunk-tarvase5.js +0 -2
- package/dist/chunk-tqs9pcga.js +0 -2
- package/dist/chunk-twjfrywv.js +0 -2
- package/dist/chunk-v0wdgxga.js +0 -3
- package/dist/chunk-vyna2rsq.js +0 -2
- package/dist/chunk-w4gjx2zs.js +0 -18
- package/dist/chunk-xhe7pw6e.js +0 -2
- package/dist/chunk-y86mpnrg.js +0 -2
- package/dist/chunk-z99bf0q0.js +0 -3
- package/dist/chunk-zm0g7ntw.js +0 -2
- package/dist/chunk-zrm2x65c.js +0 -2
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qe,$n,Zs,Ii,j}from"./chunk-k32q90b2.js";import{Tn}from"./chunk-0fh47gp0.js";import{Fr,C,_l,ft,Fi,Cl}from"./chunk-qjey0jk6.js";import{N}from"./chunk-farh4p7f.js";import{P,E,Qs,d,m,Ut,p,J,U,k,ro,Re,Ge,so}from"./chunk-qa5y30sy.js";import{r,we}from"./chunk-x7redxyd.js";import{b}from"./chunk-94mpe1ny.js";import{Y}from"./chunk-bwdbj60y.js";import{c}from"./chunk-s9df8srx.js";import ut from"path";import Vt from"process";import{AsyncLocalStorage as ma}from"async_hooks";var Dr=new ma;function xn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Mr(e,t){return Dr.run(xn(e),t)}async function jr(e,t){let n=Dr.getStore();if(!n)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=n.pending.get(e);if(i)return i;let a=Promise.resolve().then(t).then((u)=>{let l=JSON.stringify(u,(x,v)=>{if(v===void 0||typeof v==="function"||typeof v==="symbol"||typeof v==="bigint"||typeof v==="number"&&!Number.isFinite(v))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(v&&typeof v==="object"&&!Array.isArray(v)&&Object.getPrototypeOf(v)!==Object.prototype&&Object.getPrototypeOf(v)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return v}),f=JSON.parse(l);return n.values.set(e,f),f}).catch((u)=>{throw n.pending.delete(e),u});return n.pending.set(e,a),a}function Pr(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function q(e,t=!1){let n=r(e),i=[],a=new Set,u=0,l=0,f=n.length,x=()=>{if(u!==0)return;let v=n.slice(l).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(v){if(t&&v[1]==="const")return;let z=v[2];if(!a.has(z))i.push(z),a.add(z);return}let A=n.slice(l).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&n.slice(l).startsWith("const"))return;A[1].split(",").forEach((z)=>{let W=z.trim();if(!W)return;let B=W.indexOf(":"),V=(B>=0?W.slice(B+1).trim():W).split(/[\s=]/)[0];if(V&&!a.has(V))i.push(V),a.add(V)});return}let D=n.slice(l).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(t&&n.slice(l).startsWith("const"))return;D[1].split(",").forEach((z)=>{let W=z.trim().replace(/^\.\.\./,"");if(!W)return;let B=W.split(/[\s=]/)[0];if(B&&!a.has(B))i.push(B),a.add(B)});return}if(t)return;let F=n.slice(l).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let z=F[1];if(!a.has(z))i.push(z),a.add(z);return}let O=n.slice(l).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let z=O[1];if(!a.has(z))i.push(z),a.add(z)}};while(l<f){if(n[l]==="{"){u++,l++;continue}if(n[l]==="}"){u--,l++;continue}if(u===0&&/[a-z]/i.test(n[l])&&(l===0||/\s|[;{}()]/.test(n[l-1])))x();l++}return i.join(", ")}function js(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ha(e,t=q(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(q(e,!0).split(",").map((i)=>i.trim()));return t.map((i)=>n.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Bs(e,t){let n=`{ ${ha(e,t)} }`;return q(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import Ot from"fs";import ve from"path";function K(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Nr=new Map;function _r(e,t=!0){let n=Nr.get(e);if(t&&n)return n;let i=new Map,a=[ve.join(e,"src"),ve.join(e,"dist"),e];function u(l,f){if(f>6)return;let x;try{x=Ot.readdirSync(l,{withFileTypes:!0})}catch{return}for(let v of x){let A=ve.join(l,v.name);if(v.isDirectory()){if(v.name==="node_modules"||v.name.startsWith("."))continue;u(A,f+1)}else if(v.isFile()&&v.name.endsWith(".stx")){let D=v.name.slice(0,-4);if(!i.has(D))i.set(D,A);let F=D.toLowerCase();if(!i.has(F))i.set(F,A);let O=K(D);if(!i.has(O))i.set(O,A)}}}for(let l of a)if(u(l,0),i.size>0)break;if(t)Nr.set(e,i);return i}function Fs(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=ve.join(n,"node_modules",e);try{if(Ot.statSync(i).isDirectory())return i}catch{}let a=ve.dirname(n);if(a===n)return null;n=a}}function zs(e,t,n={}){return[ve.resolve(ve.dirname(t),`${e}.stx`),ve.resolve(ve.dirname(t),e),ve.resolve(n.componentsDir||"components",`${e}.stx`),ve.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Lr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,n=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=K(t);return[t,n,i]}function fi(e,t){let[n,i,a]=Lr(e);for(let u of[n,n.toLowerCase(),i,a]){let l=t?.__importedComponents?.get(u);if(l!==void 0)return l}}function gi(e,t){let n=t?ve.resolve(t):void 0,i=ve.dirname(ve.resolve(e));for(;;){if(Ot.existsSync(ve.join(i,"package.json")))return n&&i===n?void 0:i;let a=ve.dirname(i);if(a===i)return;i=a}}var xa=["src/ui","src/components","components","dist"];function zn(e,t){let n=ve.resolve(e);if(!t&&!n.split(ve.sep).includes("node_modules"))return[];let i=gi(n,t);if(!i)return[];let a=[];try{let f=JSON.parse(Ot.readFileSync(ve.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(f))a=f.filter((x)=>typeof x==="string")}catch{}let u=a.length?a:xa;return[ve.dirname(ve.resolve(e)),...u.map((l)=>ve.resolve(i,l))]}function*mi(e,t,n={},i){let a=Lr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield ve.resolve(ve.dirname(t),`${a[0]}.stx`);return}let u=[...new Set(a.map((x)=>`${x}.stx`))],l=n.projectRoot||process.cwd(),f=[...zn(t,n.projectRoot),...i?.__originalFilePath?[ve.join(ve.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],ve.join(ve.dirname(t),"components"),ve.resolve(l,"src/components"),ve.resolve(l,"components"),...import.meta.dir?[ve.resolve(import.meta.dir,"components")]:[]];for(let x of new Set(f)){for(let v of u)yield ve.join(x,v);try{for(let v of Ot.readdirSync(x,{withFileTypes:!0}))if(v.isDirectory())for(let A of u)yield ve.join(x,v.name,A)}catch{}}}function zr(e,t,n={},i){let a=fi(e,i);if(a!==void 0)return a;for(let u of mi(e,t,n,i))try{if(Ot.statSync(u,{throwIfNoEntry:!1})?.isFile())return u}catch{}return null}function Hs(e,t=[],n={}){let i=new Set([...e].map((v)=>v.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")&&!i.has("source")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(n).map(([v,A])=>[v.replace(/[-_]/g,"").toLowerCase(),A])),u=a.get("alt"),l=a.get("decorative"),f=typeof u==="string"&&!!u.trim(),x=typeof l==="string"?!["false","0","off","no"].includes(l.trim().toLowerCase()):Boolean(l);if(!f&&!x)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((v)=>i.has(v)))return!1;if([...t].some((v)=>!["load","error"].includes(v.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(i.has("resizemode")&&(i.has("fit")||i.has("objectfit")))return!1;if(i.has("src")&&i.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((v)=>i.has(v))}import is from"fs";import ce from"path";import Et from"path";import sn from"fs";var ba=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ys(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return ba.has(e.toLowerCase())}var Br=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"]),Wr={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"},ya=new Set(["ctrl","alt","shift","meta"]),Hr={left:0,middle:1,right:2};function Vr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let n of e){let i=n.toLowerCase();if(i==="prevent")t.prevent=!0;else if(i==="stop")t.stop=!0;else if(i==="once")t.once=!0;else if(i==="capture")t.capture=!0;else if(i==="self")t.self=!0;else if(i==="passive")t.passive=!0;else if(i==="nonpassive")t.nonpassive=!0;else if(ya.has(i))t.systemKeys.push(i);else if(i in Hr)t.mouse=i;else if(i in Wr||/^[a-z]$/.test(i))t.keys.push(Wr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function qr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,u;while((u=a.exec(e))!==null){let[l,f,x]=u,v=u.index,A=v+l.length,D=`__stx_evt_${t}${i++}`,F=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=O.exec(x))!==null){let[,B,H]=z,V=B.split("."),M=V[0];if(!Br.has(M))continue;F.push({attribute:`@${B}`,event:M,handler:H,modifiers:Vr(V.slice(1)),elementId:D})}let W=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=W.exec(x))!==null){let[,B,H]=z,V=B.split("."),M=V[0];if(!Br.has(M))continue;F.push({attribute:`@${B}`,event:M,handler:H,modifiers:Vr(V.slice(1)),elementId:D})}if(F.length>0)n.push({originalTag:l,elementId:D,events:F,startIndex:v,endIndex:A})}return n}function _a(e){let t=[],{modifiers:n}=e;if(n.self)t.push("if ($event.target !== $el) return");for(let i of n.systemKeys)t.push(`if (!$event.${i}Key) return`);if(n.keys.length>0){let i=n.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${i})) return`)}if(n.mouse!==null){let i=Hr[n.mouse];t.push(`if ($event.button !== ${i}) return`)}if(n.prevent)t.push("$event.preventDefault()");if(n.stop)t.push("$event.stopPropagation()");return t.join("; ")}function wa(e,t){let n=e;if(t.debounce!==null)n=`__stx_debounce(() => { ${n} }, ${t.debounce})`;else if(t.throttle!==null)n=`__stx_throttle(() => { ${n} }, ${t.throttle})`;return n}function _s(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function Sa(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=_a(e),a=wa(_s(e.handler),t),u=[];if(t.once)u.push("once: true");if(t.capture)u.push("capture: true");if(ys(e.event,t))u.push("passive: true");let l=u.length>0?`, { ${u.join(", ")} }`:"",f=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
|
+
(function() {
|
|
4
|
+
var $el = document.getElementById('${n}');
|
|
5
|
+
if (!$el) return;
|
|
6
|
+
// Run mounted handler immediately (DOM is ready)
|
|
7
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
8
|
+
if (scope && scope.__stx_execute) {
|
|
9
|
+
scope.__stx_execute('${f}', null, $el);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
__stx_runHandler('${f}', null, $el);
|
|
13
|
+
}
|
|
14
|
+
})();`;if(e.event==="unmounted")return`
|
|
15
|
+
(function() {
|
|
16
|
+
var $el = document.getElementById('${n}');
|
|
17
|
+
if (!$el) return;
|
|
18
|
+
// Set up MutationObserver to detect removal
|
|
19
|
+
var observer = new MutationObserver(function(mutations) {
|
|
20
|
+
for (var m of mutations) {
|
|
21
|
+
for (var node of m.removedNodes) {
|
|
22
|
+
if (node === $el || (node.contains && node.contains($el))) {
|
|
23
|
+
observer.disconnect();
|
|
24
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
25
|
+
if (scope && scope.__stx_execute) {
|
|
26
|
+
scope.__stx_execute('${f}', null, $el);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
__stx_runHandler('${f}', null, $el);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
37
|
+
// Store observer for cleanup
|
|
38
|
+
$el.__stx_unmount_observer = observer;
|
|
39
|
+
})();`;return`
|
|
40
|
+
(function() {
|
|
41
|
+
var $el = document.getElementById('${n}');
|
|
42
|
+
if (!$el) return;
|
|
43
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
44
|
+
$el.addEventListener('${e.event}', function($event) {
|
|
45
|
+
${i?i+";":""}
|
|
46
|
+
// Find the closest reactive scope and execute within its context
|
|
47
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
48
|
+
if (scope && scope.__stx_execute) {
|
|
49
|
+
scope.__stx_execute('${f}', $event, $el);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Fallback for non-reactive context (entity-safe; decoded + run in memory)
|
|
53
|
+
__stx_runHandler('${f}', $event, $el);
|
|
54
|
+
}
|
|
55
|
+
}${l});
|
|
56
|
+
})();`}function hi(e){if(e.length===0)return"";return`
|
|
57
|
+
<script data-stx-events>
|
|
58
|
+
(function() {
|
|
59
|
+
'use strict';
|
|
60
|
+
|
|
61
|
+
// Utility functions
|
|
62
|
+
function __stx_debounce(fn, delay) {
|
|
63
|
+
var timeout;
|
|
64
|
+
return function() {
|
|
65
|
+
var args = arguments;
|
|
66
|
+
var ctx = this;
|
|
67
|
+
clearTimeout(timeout);
|
|
68
|
+
timeout = setTimeout(function() { fn.apply(ctx, args); }, delay);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function __stx_throttle(fn, delay) {
|
|
73
|
+
var last = 0;
|
|
74
|
+
return function() {
|
|
75
|
+
var now = Date.now();
|
|
76
|
+
if (now - last >= delay) {
|
|
77
|
+
last = now;
|
|
78
|
+
fn.apply(this, arguments);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Non-reactive fallback runner. The handler is embedded HTML-entity-encoded
|
|
84
|
+
// so the surrounding script element can never contain raw markup, including
|
|
85
|
+
// its own closing tag; we decode it to JS only in memory here, then run it
|
|
86
|
+
// with $event/$el in scope.
|
|
87
|
+
//
|
|
88
|
+
// This comment must not spell that closing tag out. It used to, as an
|
|
89
|
+
// example, and a browser ends the script element at the FIRST one it sees \u2014
|
|
90
|
+
// so everything below this line, __stx_runHandler included, was emitted as
|
|
91
|
+
// page text and no listener was ever bound. The comment about escaping was
|
|
92
|
+
// the thing that needed escaping.
|
|
93
|
+
function __stx_runHandler(h, $event, $el) {
|
|
94
|
+
var code = h
|
|
95
|
+
.replace(/</g, '<')
|
|
96
|
+
.replace(/>/g, '>')
|
|
97
|
+
.replace(/"/g, '"')
|
|
98
|
+
.replace(/'/g, "'")
|
|
99
|
+
.replace(/'/g, "'")
|
|
100
|
+
.replace(/&/g, '&');
|
|
101
|
+
try {
|
|
102
|
+
// eslint-disable-next-line no-new-func
|
|
103
|
+
(new Function('$event', '$el', code)).call($el, $event, $el);
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
if (typeof console !== 'undefined') console.error('[stx] event handler error:', e);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Event listeners
|
|
111
|
+
${e.map(Sa).join(`
|
|
112
|
+
`)}
|
|
113
|
+
})();
|
|
114
|
+
</script>`}function $a(e,t=""){let n=qr(e,t);if(n.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let u=n.length-1;u>=0;u--){let l=n[u],f=l.originalTag;if(!f.includes(" id="))f=f.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${l.elementId}"`);else{let x=f.match(/id=["']([^"']+)["']/);if(x)for(let v of l.events)v.elementId=x[1]}for(let x of l.events){let v=x.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${v}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${v}\\s*=\\s*'[^']*'`,"g");f=f.replace(A,""),f=f.replace(D,"")}i=i.slice(0,l.startIndex)+f+i.slice(l.endIndex),a.push(...l.events)}return{template:i,bindings:a}}function Ur(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Hc(e,t,n){if(Cl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:f,bindings:x}=$a(e,Ur(t)),v=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...v,...x],f}let i=qr(e,Ur(t));if(i.length===0)return e;let a=e;for(let f=i.length-1;f>=0;f--){let x=i[f],v=x.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${x.elementId}"`);else{let A=v.match(/id=["']([^"']+)["']/);if(A)for(let D of x.events)D.elementId=A[1]}for(let A of x.events){let D=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),F=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");v=v.replace(F,""),v=v.replace(O,"")}a=a.slice(0,x.startIndex)+v+a.slice(x.endIndex)}let u=hi(i.flatMap((f)=>f.events)),l=c(a);if(l!==-1)a=a.slice(0,l)+u+`
|
|
115
|
+
`+a.slice(l);else a+=u;return a}function Zr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let u=a.lastIndexOf(":");if(u!==-1)a=a.slice(u+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function Mt(e,t){let n=r(e),{depths:i,balanced:a}=we(n),u=(f)=>!a||i[f]===0,l=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let f of n.matchAll(l)){let x=(f.index??0)+f[0].length-f[1].length;if(u(x))return!0}for(let f of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(u(f.index??0)&&Zr(f[1],!0).has(t))return!0;for(let f of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(u(f.index??0)&&Zr(f[1],!1).has(t))return!0;return!1}var Kr=new P(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),wt=/^[A-Za-z_$][\w$]*$/,va=new Set(["if","for","while","switch","with"]),Xr=["(","[","{"],Jr=[")","]","}"],Ea=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function ka(e){let t=r(e),n=[];for(let i of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;n.push({text:i[0],start:a,end:a+i[0].length})}return{code:t,tokens:n}}function ws(e){let t=Kr.get(e);if(t)return t;let{code:n,tokens:i}=ka(e),a=new Map,u=[];for(let B=0;B<i.length;B++){let H=i[B].text;if(["(","[","{"].includes(H))u.push(B);else if([")","]","}"].includes(H)){let V=u.at(-1);if(V!==void 0&&["()","[]","{}"].includes(i[V].text+H))u.pop(),a.set(V,B),a.set(B,V)}}function l(B,H){let V=[],M=B;for(let Z=B;Z<H;Z++){if(["(","[","{"].includes(i[Z].text)&&(a.get(Z)??H)<H){Z=a.get(Z);continue}if(i[Z].text===",")V.push([M,Z]),M=Z+1}return V.push([M,H]),V}let f=[];function x(B,H,V,M=!1){if(i[B]?.text==="...")B++;if(B>=H)return;let Z=i[B].text;if(wt.test(Z)){if(V.add(Z),V===D)f.push({name:Z,token:B,functionScoped:M});return}if(Z!=="{"&&Z!=="[")return;let re=a.get(B);if(re===void 0||re>=H)return;for(let[se,fe]of l(B+1,re)){let xe=se;if(Z==="{")for(let pe=se;pe<fe;pe++){if(i[pe].text===":"){xe=pe+1;break}if(i[pe].text==="=")break;if(["(","[","{"].includes(i[pe].text)&&a.has(pe))pe=a.get(pe)}x(xe,fe,V,M)}}function v(B,H){let V=new Set;for(let[M,Z]of l(B,H))x(M,Z,V);return V}function A(B){let H=B;for(;H<i.length;H++){let V=i[H].text;if(["(","[","{"].includes(V)&&a.has(H)){H=a.get(H);continue}if([",",";",")","]","}"].includes(V))break}return i[Math.max(B,H-1)]?.end??n.length}let D=new Set,F=[];for(let B=0;B<i.length;B++)if(i[B].text==="=>"){let H=B-1,V=H,M;if(i[H]?.text===")"&&a.has(H))V=a.get(H),M=v(V+1,H);else if(i[H]&&wt.test(i[H].text))M=new Set([i[H].text]);else continue;let Z=B+1,re=i[Z]?.text==="{"&&a.has(Z)?i[a.get(Z)].end:A(Z);F.push({start:i[V].start,end:re,bodyStart:i[Z]?.start??re,functionBody:!0,names:M})}else if(i[B].text==="("&&a.has(B)){let H=i[B-1]?.text;if(!H||va.has(H)||!wt.test(H)&&H!=="*"&&H!=="]")continue;let V=a.get(B),M=V+1;if(i[M]?.text===":"){M++;while(M<i.length&&!["{","=>",";","="].includes(i[M].text))M++}if(i[M]?.text!=="{"||!a.has(M))continue;F.push({start:i[B].start,end:i[a.get(M)].end,bodyStart:i[M].start,functionBody:H!=="catch",names:v(B+1,V)})}function O(B){let H=B;for(;H<i.length;H++){let V=i[H].text;if(Xr.includes(V)&&a.has(H)){H=a.get(H);continue}if(V===";"||Jr.includes(V))break;let M=i[H-1];if(H>B&&Ea.has(V)&&M.text!==".")break;if(H>B&&/[\n\r]/.test(n.slice(M.end,i[H].start))&&(/^[\w$]+$/.test(M.text)||Jr.includes(M.text)||['"',"'","`"].includes(M.text))&&wt.test(V)&&!["in","of","instanceof"].includes(V))break}return H}let z=[];for(let B=0;B<i.length;B++){if(i[B].text!=="for")continue;let H=i[B+1]?.text==="await"?B+2:B+1;if(i[H]?.text!=="("||!a.has(H))continue;let V=a.get(H),M=V+1,Z=i[M]?.text==="{"&&a.has(M)?a.get(M):O(M),re=i[Z]?.text===";"||i[Z]?.text==="}"?i[Z].end:i[Math.max(M,Z-1)]?.end??n.length;z.push({headStart:H,headEnd:V,start:i[H].start,end:re})}for(let B=0;B<i.length;B++){let H=i[B].text,V=i[B-1]?.text;if(V==="."||i[B+1]?.text===":")continue;if(V==="as"||V==="<")continue;if(H==="const"||H==="let"||H==="var"){let M=O(B+1),Z=B+1,re=!1,se=!1,fe=0;for(let xe=B+1;xe<=M;xe++){let pe=i[xe]?.text;if(xe<M&&Xr.includes(pe)&&a.has(xe)&&a.get(xe)<M){xe=a.get(xe);continue}if(xe<M&&pe===":"&&!se)re=!0;else if(xe<M&&pe==="="&&fe===0)re=!1,se=!0;else if(xe<M&&re&&pe==="<")fe++;else if(xe<M&&re&&pe===">"&&fe>0)fe--;else if(xe===M||pe===","&&fe===0)x(Z,xe,D,H==="var"),Z=xe+1,re=!1,se=!1}}else if(H==="function"||H==="class"){let M=B+1;if(i[M]?.text==="*")M++;if(i[M]&&wt.test(i[M].text)&&i[M].text!=="extends")D.add(i[M].text),f.push({name:i[M].text,token:M})}else if(H==="import"){let M=B+1;if(i[M]?.text==="*"&&i[M+1]?.text==="as")M+=2;let Z=i[M]?.text;if(Z&&wt.test(Z)&&Z!=="type"&&i[M+1]?.text!=="("&&i[M+1]?.text!==".")D.add(Z),f.push({name:Z,token:M,file:!0});let re=i[M]?.text==="{"?M:i[M+1]?.text===","&&i[M+2]?.text==="{"?M+2:-1;if(re!==-1&&a.has(re)){let se=a.get(re);for(let[fe,xe]of l(re+1,se)){let pe=xe-1;while(pe>=fe&&!wt.test(i[pe].text))pe--;if(pe>=fe&&i[pe].text!=="type")f.push({name:i[pe].text,token:pe,file:!0})}}}}let W={code:n,scopes:F,loops:z,declarations:D,sites:f,tokens:i,pairs:a};return Kr.set(e,W),W}function nn(e){let t=ws(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function Bn(e){return new Set(ws(e).declarations)}function Le(e,t){let{scopes:n,loops:i,sites:a,tokens:u,pairs:l}=ws(e),f=Array.from({length:u.length},()=>-1),x=[];for(let O=0;O<u.length;O++){f[O]=x.length?x[x.length-1]:-1;let z=u[O].text;if(z==="{"&&l.has(O))x.push(O);else if(z==="}"&&x.length&&l.get(O)===x[x.length-1])x.pop()}let v=new Set,A=new Map;for(let O of a){if(!t.has(O.name))continue;v.add(O.token);let z=O.file?-1:f[O.token],W=z===-1?[0,Number.POSITIVE_INFINITY]:[u[z].start,u[l.get(z)].end];if(O.functionScoped){let H=u[O.token].start,V=n.filter((M)=>M.functionBody&&H>=M.bodyStart&&H<M.end).sort((M,Z)=>M.end-M.bodyStart-(Z.end-Z.bodyStart))[0];W=V?[V.bodyStart,V.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let H=i.filter((V)=>O.token>V.headStart&&O.token<V.headEnd).sort((V,M)=>V.headEnd-V.headStart-(M.headEnd-M.headStart))[0];if(H)W=[H.start,H.end]}let B=A.get(O.name);if(B)B.push(W);else A.set(O.name,[W])}let D=new Set;for(let O=0;O<u.length;O++){if(u[O].text!=="import"||u[O-1]?.text===".")continue;let z=O+1;if(u[z]?.text==="type")z++;if(u[z]&&wt.test(u[z].text)&&u[z+1]?.text===",")z+=2;if(u[z]?.text==="{"&&l.has(z))for(let W=z+1;W<l.get(z);W++)D.add(W)}let F=new Set;for(let O=0;O<u.length;O++){let z=u[O].text;if(!t.has(z)||F.has(z)||v.has(O)||D.has(O))continue;let W=u[O-1]?.text;if(W==="#"||W==="."&&u[O-2]?.text!=="..")continue;if(u[O+1]?.text===":"&&(W==="{"||W===","))continue;let B=u[O].start;if(A.get(z)?.some(([H,V])=>B>=H&&B<V))continue;if(n.some((H)=>B>=H.start&&B<H.end&&H.names.has(z)))continue;F.add(z)}return F}var De="0.2.862";var Gr=Symbol.for(`stx.lazy-module-promises.${De}`);function Ra(){let e=globalThis;return e[Gr]??=new Map,e[Gr]}function o(e,t){let n=Ra(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let u=t();return n.set(i,u),u.catch(()=>{if(n.get(i)===u)n.delete(i)}),u}var Ta=/<\/(script)/gi;function ue(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Ta,"<\\/$1")}import Yr from"fs";var Qr=[];function S(e){let t=new P(e);return Qr.push(t),t}function Vc(){for(let e of Qr)e.clear()}function _(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Cr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Yr.statSync(n).mtimeMs})}catch{}return t}function Vs(e){for(let t of e)try{if(Yr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Ee=["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 Aa=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Ia(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let n=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!n)return null;return{pkg:n[1],subpath:n[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function Pa(e,t){let n=t;while(!0){let i=Et.join(n,"node_modules",e,"package.json");if(sn.existsSync(i))return Et.dirname(i);let a=Et.dirname(n);if(a===n)return null;n=a}}function Oa(e,t){if(!e||typeof e!=="object")return null;let n=(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 n(a.import);if(typeof a.default==="object")return n(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return n(e[t]);let i=null;for(let a of Object.keys(e)){let u=a.indexOf("*");if(u===-1)continue;let l=a.slice(0,u),f=a.slice(u+1);if(!t.startsWith(l)||!t.endsWith(f))continue;if(t.length<l.length+f.length)continue;if(!i||l.length>i.prefix.length)i={pattern:a,prefix:l,suffix:f}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),u=n(e[i.pattern]);if(u)return u.replace("*",a)}return null}function Da(e,t){let n=Ia(e);if(!n||!n.subpath)return null;let i=Pa(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(sn.readFileSync(Et.join(i,"package.json"),"utf8"))}catch{return null}let u=`.${n.subpath}`,l=Oa(a.exports,u);if(!l)return null;let f=Et.resolve(i,l);return sn.existsSync(f)?f:null}function Ci(e,t){let n=t.filePath?Et.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,u=[],l=[];return{code:e.replace(Aa,(x,v)=>{let A;try{if(v.startsWith("./")||v.startsWith("../")||v.startsWith("/")){if(A=v.startsWith("/")?v:Et.resolve(n,v),!sn.existsSync(A))throw Error(`file not found: ${A}`)}else{let D=null;try{D=Bun.resolveSync(v,i)}catch{D=Da(v,i)}if(!D)throw Error(`could not resolve ${v} (Bun.resolveSync + exports fallback both failed)`);A=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(v)} (from ${t.filePath||"<unknown>"}): ${D?.message||D}`),l.push(v),""}if(a.has(A))return"";a.add(A);try{let D=sn.readFileSync(A,"utf8");u.push({source:v,resolvedPath:A,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${A}: ${D?.message||D}`),l.push(v)}return""}),styles:u,unresolved:l}}function Ma(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ei(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Ma(t.source)}" data-stx-layer="vendor">
|
|
116
|
+
@layer vendor {
|
|
117
|
+
${t.contents}
|
|
118
|
+
}
|
|
119
|
+
</style>`).join(`
|
|
120
|
+
`)}
|
|
121
|
+
`}var Sg=C,ei=S(256);function zt(e){let t=_(e),n=ei.get(t);if(!n)n=ja(e),ei.set(t,n);return{code:n.code,imports:[...n.imports],models:[...n.models]}}function ja(e){let t=r(e),n=new Set;for(let f of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let x of f[1].split(",")){let v=x.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(v)n.add(v)}let i=Bn(t),a=Ee.filter((f)=>{if(n.has(f)||i.has(f))return!1;return kg(t,f,!0)}),u=ri(t).filter((f)=>!n.has(f)&&!i.has(f));if(a.length===0&&u.length===0)return{code:e,imports:a,models:u};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",u.length>0?"import '@stacksjs/browser'":"",u.length>0?`const { ${u.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
122
|
+
`)}
|
|
123
|
+
${e}`,imports:a,models:u}}var Na=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 ri(e,t=nn(e)){let n=new Set,i=Bn(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 u of t.code.matchAll(a)){let l=u[1];if(Na.has(l)||i.has(l)||l.length<3)continue;if(t.shadows(l,u.index??0))continue;n.add(l)}return Array.from(n)}function La(e){return Bn(e)}var ti=S(128);function al(e){let t=_(e),n=ti.get(t);if(!n)n=za(e),ti.set(t,n);return{code:n.code,stxImports:[...n.stxImports],browserImports:[...n.browserImports]}}function za(e){let t=new Set,n=new Set,i=e;i=i.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,u=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,l;while((l=u.exec(e))!==null){let O=l[1],z=l[2];if(l[0].includes("import type"))continue;let W=[];for(let H of O.split(",")){let V=H.trim();if(!V||V.startsWith("type "))continue;let M=V.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!M)continue;let Z=M[1],re=M[2]||Z;if(a.add(Z),a.add(re),z==="stx"||z==="@stacksjs/stx")t.add(Z);else n.add(Z);if(re!==Z)W.push(`${re} = ${Z}`)}let B=W.length>0?`var ${W.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(l[0],B)}let f=La(i),x=nn(i);for(let O of Sg){if(a.has(O)||f.has(O))continue;if(Ss(x,O,!0))t.add(O)}let v=r(i),A=nn(v),D=new Set;for(let O of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let z of O[1].split(",")){let W=z.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let B of W){let H=B.trim();if(H)D.add(H)}}for(let O of Ee){if(a.has(O)||f.has(O)||D.has(O))continue;if(Ss(A,O))n.add(O)}let F=ri(v,A);for(let O of F)if(!a.has(O)&&!f.has(O))n.add(O);return{code:i,stxImports:Array.from(t),browserImports:Array.from(n)}}function kg(e,t,n=!1){return Ss(nn(e),t,n)}function Ss(e,t,n=!1){let i=e.code,a=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let u of i.matchAll(a)){let l=u.index??0;if(e.shadows(t,l))continue;let f=l+t.length,x=l-1;while(x>=0&&/\s/.test(i[x]))x--;if(i[x]==="."&&i.slice(Math.max(0,x-2),x+1)!=="...")continue;let v=f;while(v<i.length&&/\s/.test(i[v]))v++;if(i[v]===":"&&i[v+1]!==":"&&(i[x]==="{"||i[x]===","))continue;if(n&&!/^\s*(?:<[^>]*>)?\s*\(/.test(i.slice(f)))continue;if(Ba(i,f))continue;return!0}return!1}function Ba(e,t){let n=t;while(n<e.length&&(e[n]===" "||e[n]==="\t"))n++;if(e[n]!=="(")return!1;let i=0;for(;n<e.length;n++){let a=e[n];if(a==="(")i++;else if(a===")"){if(i--,i===0)break}}if(i!==0)return!1;n++;while(n<e.length&&(e[n]===" "||e[n]==="\t"))n++;return e[n]==="{"}function cl(e,t){let n=[];if(e.length>0)n.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)n.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(n.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
124
|
+
${n.join(`
|
|
125
|
+
`)}
|
|
126
|
+
${Wa(e,t)}`;return""}function fy(e,t=[]){let{browserImports:n}=al(e),i=new Set(t);return cl([],n.filter((a)=>!i.has(a)))}function Wa(e,t){let n=[...e.map((i)=>`['${i}', typeof ${i}, 'stx']`),...t.map((i)=>`['${i}', typeof ${i}, '@stacksjs/browser']`)];if(n.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
127
|
+
[${n.join(", ")}].forEach(function (e) {
|
|
128
|
+
if (e[1] !== 'undefined') return;
|
|
129
|
+
console.error(
|
|
130
|
+
'[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
|
|
131
|
+
+ 'but the client runtime does not provide it. Either it is not exported to the browser, '
|
|
132
|
+
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
`}function ze(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let i={};for(let a in t){let u=t[a];if(typeof u==="function")continue;i[a]=u}return i.__stxDeclaredPayload=!0,i}let n={};for(let i in e){if(i.startsWith("__")||i.startsWith("$"))continue;let a=e[i];if(typeof a==="function")continue;n[i]=a}return n}var Fa=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,ni=new Set;function Va(e,t){let n=Fa.test(e),i=t.length>32768;if(!n&&!i)return;if(ni.has(e))return;if(ni.add(e),n)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(i)console.warn(`[stx] server\u2192client bridge is publishing ${(t.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function kn(e,t){if(!t)return"";let n=Le(e,new Set(Object.keys(t))),i=t.__stxDeclaredPayload===!0,a=[],u=Object.entries(t).sort(([l],[f])=>l<f?-1:l>f?1:0);for(let[l,f]of u){if(!/^[A-Za-z_$][\w$]*$/.test(l))continue;if(l.startsWith("__")||l.startsWith("$"))continue;if(!i&&!n.has(l))continue;if(Mt(e,l)){if(i)console.warn(`[stx] defineClientPayload declares "${l}", but this client block also declares "${l}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${l}" from defineClientPayload.`);continue}let x;try{x=JSON.stringify(f)}catch{continue}if(x===void 0)continue;Va(l,x),a.push(` var ${l} = ${x.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
136
|
+
${a.join(`
|
|
137
|
+
`)}
|
|
138
|
+
`}var Ua={left:0,middle:1,right:2};function Ha(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let n of e.systemKeys)t.push(`if (!$event.${n}Key) return`);if(e.keys.length>0){let n=e.keys.map((i)=>`$event.key === '${i}'`).join(" || ");t.push(`if (!(${n})) return`)}if(e.mouse!==null){let n=Ua[e.mouse];t.push(`if ($event.button !== ${n}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function qa(e,t){let{elementId:n,event:i,modifiers:a}=e,u=_s(e.handler),l=Ha(a),f=[];if(a.once)f.push("once: true");if(a.capture)f.push("capture: true");if(ys(i,a))f.push("passive: true");let x=f.length>0?`, { ${f.join(", ")} }`:"",v="";if(l)v+=`${l}; `;let A=u.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),D=`var $emit = function(name, detail) {
|
|
139
|
+
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
140
|
+
};`;function F(O){if(/\$emit\s*\(/.test(O))return`${D}
|
|
141
|
+
${O}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
142
|
+
if (scope && scope.__stx_execute) {
|
|
143
|
+
scope.__stx_execute('${A}', $event, $el);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
${O}
|
|
147
|
+
}`}if(a.debounce!==null)return` ;(function() {
|
|
148
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
149
|
+
var $el = document.getElementById('${n}')
|
|
150
|
+
if (!$el) return
|
|
151
|
+
var __timer
|
|
152
|
+
$el.addEventListener('${i}', function($event) {
|
|
153
|
+
${l?l+"; ":""}clearTimeout(__timer)
|
|
154
|
+
__timer = setTimeout(function() { ${F(u)} }, ${a.debounce})
|
|
155
|
+
}${x})
|
|
156
|
+
})()`;if(a.throttle!==null)return` ;(function() {
|
|
157
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
158
|
+
var $el = document.getElementById('${n}')
|
|
159
|
+
if (!$el) return
|
|
160
|
+
var __last = 0
|
|
161
|
+
$el.addEventListener('${i}', function($event) {
|
|
162
|
+
${l?l+"; ":""}var __now = Date.now()
|
|
163
|
+
if (__now - __last >= ${a.throttle}) {
|
|
164
|
+
__last = __now
|
|
165
|
+
${F(u)}
|
|
166
|
+
}
|
|
167
|
+
}${x})
|
|
168
|
+
})()`;if(/\$emit\s*\(/.test(u))return` var $el = document.getElementById('${n}')
|
|
169
|
+
if ($el) $el.addEventListener('${i}', function($event) {
|
|
170
|
+
${v}${D}
|
|
171
|
+
${u}
|
|
172
|
+
}${x})`;return` var $el = document.getElementById('${n}')
|
|
173
|
+
if ($el) $el.addEventListener('${i}', function($event) {
|
|
174
|
+
${v}var scope = $el.closest('[data-stx-scope]');
|
|
175
|
+
if (scope && scope.__stx_execute) {
|
|
176
|
+
scope.__stx_execute('${A}', $event, $el);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
${u}
|
|
180
|
+
}
|
|
181
|
+
}${x})`}function Za(e){if(e.length===0)return"";return`
|
|
182
|
+
// STX: auto-generated event bindings
|
|
183
|
+
${e.map((n,i)=>qa(n,i)).join(`
|
|
184
|
+
`)}`}function si(e){let t=[],n=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,u=i.length,l=0;while(l<u){let f=i[l];if(f==="'"||f==='"'||f==="`"){let x=f;if(l++,x==="`"){let v=0;while(l<u){if(i[l]==="\\"){l+=2;continue}if(i[l]==="`"&&v===0){l++;break}if(i[l]==="$"&&i[l+1]==="{"){v++,l+=2;continue}if(i[l]==="}"&&v>0){v--,l++;continue}l++}}else while(l<u){if(i[l]==="\\"){l+=2;continue}if(i[l]===x){l++;break}l++}continue}if(f==="/"&&i[l+1]==="/"){while(l<u&&i[l]!==`
|
|
185
|
+
`)l++;continue}if(f==="/"&&i[l+1]==="*"){l+=2;while(l<u-1&&!(i[l]==="*"&&i[l+1]==="/"))l++;l+=2;continue}if(f==="{"){a++,l++;continue}if(f==="}"){a--,l++;continue}if(a===0){let x=i.slice(l),v=x.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(v){let F=v[1];if(!F.startsWith("_")&&!n.has(F))t.push(F),n.add(F);l+=v[0].length;continue}let A=x.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((F)=>{let O=F.trim(),z=O.indexOf(":"),W=z>=0?O.slice(z+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(W&&!W.startsWith("_")&&!n.has(W))t.push(W),n.add(W)}),l+=A[0].length;continue}let D=x.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let F=D[1];if(!F.startsWith("_")&&!n.has(F))t.push(F),n.add(F);l+=D[0].length;continue}}l++}return t}var Ka=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 Xa(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(F){let O;while((O=n.exec(F))!==null){let z=O[0];if(!Ka.has(z))t.add(z)}}let a=/\{\{([\s\S]*?)\}\}/g,u;while((u=a.exec(e))!==null)i(u[1]);let l=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((u=l.exec(e))!==null)i(u[1]);let f=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((u=f.exec(e))!==null)i(u[1]);let x=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((u=x.exec(e))!==null)i(u[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((u=v.exec(e))!==null)i(u[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((u=A.exec(e))!==null)i(u[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((u=D.exec(e))!==null)i(u[1]);return t}async function He(e,t={}){let n=e,i="",a=!1,u=[],l=Ci(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=l.code;let f=Ei(l.styles),x=zt(n);n=x.code,u=[...x.imports,...x.models];let{hasUserImports:v,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-12sv6b9c.js"));if(v(n))n=await A(n,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let M=al(n);n=M.code,i=cl(M.stxImports,M.browserImports.filter((Z)=>!u.includes(Z)))}if(i=`${kn(n,t.serverData)}${i}`,n=N(n),!a&&Ve(t.attrs||""))n=Ue(n);let D=Za(t.eventBindings||[]),F=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(F),z=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let M=F.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Z=`type="module" data-stx-scoped${z}${M?` ${M}`:""}`;return`${f}<script ${Z}>
|
|
186
|
+
${ue(`${i}${n}
|
|
187
|
+
${D}`)}
|
|
188
|
+
</script>`}let W=Fi(e),B=/function __stx_setup_/.test(n),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function V(M){let Z=M.length>0?`
|
|
189
|
+
return ${Bs(n,M)};`:"",re=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${f}<script data-stx-scoped data-stx-run="always"${z}>
|
|
190
|
+
window.stx.mount(function() {
|
|
191
|
+
'use strict';
|
|
192
|
+
try {
|
|
193
|
+
${ue(`${i}${n}
|
|
194
|
+
${D}${Z}`)}
|
|
195
|
+
} catch (error) {
|
|
196
|
+
console.error(${re}, error);
|
|
197
|
+
return {};
|
|
198
|
+
}
|
|
199
|
+
})</script>`}if(!H&&!B){if(W)return V(si(e));if(t.templateContent){let M=si(e);if(M.length>0){let Z=Xa(t.templateContent);if(M.some((se)=>Z.has(se)))return V(M)}}}return`${f}<script data-stx-scoped data-stx-run="always"${z}>
|
|
200
|
+
;(function() {
|
|
201
|
+
'use strict';
|
|
202
|
+
try {
|
|
203
|
+
${ue(`${i}${n}
|
|
204
|
+
${D}`)}
|
|
205
|
+
} catch (error) {
|
|
206
|
+
console.error(${JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`)}, error);
|
|
207
|
+
}
|
|
208
|
+
})()</script>`}import{createHash as sc}from"crypto";var $s=/\s*/y,vs=/\x00STX_HTML_COMMENT_\d+\x00/y;function Dt(e){let t=0;while(t<e.length){if($s.lastIndex=t,$s.exec(e),t=$s.lastIndex,e.startsWith("<!--",t)){let n=e.indexOf("-->",t+4);if(n===-1)return t;t=n+3;continue}if(vs.lastIndex=t,vs.test(e)){t=vs.lastIndex;continue}return t}return t}var Es=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,Ja=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function Lt(e){let t=[],n=0;while(n<e.length){let i=e.indexOf("<",n);if(i===-1)break;if(e.startsWith("<!--",i)){let F=e.indexOf("-->",i+4);if(F===-1)break;n=F+3;continue}Es.lastIndex=i;let a=Es.exec(e);if(!a){n=i+1;continue}let u=Es.lastIndex,l=u,f=null;for(;l<e.length;l++){let F=e[l];if(f){if(F===f)f=null}else if(F==='"'||F==="'")f=F;else if(F===">")break}if(l===e.length)break;let x=a[1]==="/",v=e[l-1]==="/";t.push({start:i,end:l+1,name:a[2],attributes:e.slice(u,v?l-1:l),closing:x,selfClosing:v}),n=l+1;let A=a[2].toLowerCase();if(!x&&A==="plaintext")break;let D=Ja.get(A);if(!x&&(A==="script"||A==="style"||D)){let F=D??(A==="script"?Vn:Un);F.lastIndex=n;let O=F.exec(e);if(!O)break;n=O.index}}return t}var Wn=/<script\b[^>]*>/iy,Vn=/<\/script\s*>/ig,Fn=/<style\b[^>]*>/iy,Un=/<\/style\s*>/ig;function ii(e,t,n,i){n.lastIndex=t;let a=n.exec(e);if(!a||a.index!==t)return-1;i.lastIndex=n.lastIndex;let u=i.exec(e);if(!u)return-1;return u.index+u[0].length}function X(e,t){return ii(e,t,Wn,Vn)}function bn(e,t){return ii(e,t,Fn,Un)}function Be(e,t){if(!e.startsWith("<!--",t))return-1;let n=e.indexOf("-->",t+4);if(n===-1)return-1;return n+3}function oi(e,t){if(e.startsWith("<!--",t)){let a=Be(e,t);return a===-1?e.length:a}if(Wn.lastIndex=t,Wn.exec(e)?.index===t){Vn.lastIndex=Wn.lastIndex;let a=Vn.exec(e);return a?a.index+a[0].length:e.length}if(Fn.lastIndex=t,Fn.exec(e)?.index===t){Un.lastIndex=Fn.lastIndex;let a=Un.exec(e);return a?a.index+a[0].length:e.length}return-1}function w(e,t){let n=[],i=0,a=e.length,u=!1,l=null;while(i<a){let f=e[i];if(u){if(l){if(f===l)l=null}else if(f==='"'||f==="'")l=f;else if(f===">")u=!1;i++;continue}if(f!=="<"){let D=e.indexOf("<",i+1);if(D===-1)break;i=D;continue}let x=t(e,i);if(x>i){n.push({start:i,end:x,token:e.slice(i,x)}),i=x;continue}let v=oi(e,i);if(v>i){i=v;continue}let A=e.charCodeAt(i+1);if(A>=65&&A<=90||A>=97&&A<=122)u=!0;i++}return n}function ai(e){let t=0,n=0,i=0,a=!1,u=null;while(i<e.length){if(a){let D=e[i];if(u){if(D===u)u=null}else if(D==='"'||D==="'")u=D;else if(D===">")a=!1;i++;continue}let l=e.indexOf("<",i),f=l===-1?e.length:l;while(i<f){let D=e[i++];if(D==="{")t++;else if(D==="}")n++;if(t>=2&&n>=2)return!0}if(l===-1)break;let x=oi(e,l);if(x>l){i=x;continue}let v=e.charCodeAt(l+1),A=v===47?e.charCodeAt(l+2):v;if(A>=65&&A<=90||A>=97&&A<=122)a=!0;i=l+1}return!1}function Uc(e,t){while(e.size>=t){let n=e.keys().next();if(n.done)return;e.delete(n.value)}}var Ga=1024,Ya=16777216,Nt=new Map,ks=0;function Qa(e,t){Nt.set(e,t),ks+=e.length+t.output.length;for(let[n,i]of Nt){if(ks<=Ya)break;Nt.delete(n),ks-=n.length+i.output.length}}function ye(e,t,n,i){let a=i!==void 0&&e.length>=Ga,u=a?`${i}\x00${e}`:"";if(a){let A=Nt.get(u);if(A)return Nt.delete(u),Nt.set(u,A),{output:A.output,tokens:A.tokens.slice()}}let l=w(e,t);if(l.length===0)return{output:e,tokens:[]};let f=l.map((A)=>A.token),x="",v=0;for(let A=0;A<l.length;A++){let D=l[A];x+=e.slice(v,D.start),x+=n(D.token,A),v=D.end}if(x+=e.slice(v),a)return Qa(u,{output:x,tokens:f}),{output:x,tokens:f.slice()};return{output:x,tokens:f}}var ec=1024,tc=16777216,Wt=new Map,Cs=0;function nc(e,t){Wt.set(e,t),Cs+=e.length+t.output.length;for(let[n,i]of Wt){if(Cs<=tc)break;Wt.delete(n),Cs-=n.length+i.output.length}}function Rs(e,t,n){return{output:t,scripts:n,restore:(i)=>i===t?e:Er(i,n)}}function Q(e){let t=e.length>=ec;if(t){let a=Wt.get(e);if(a)return Wt.delete(e),Wt.set(e,a),Rs(e,a.output,a.scripts.slice())}let{output:n,tokens:i}=ye(e,X,(a,u)=>`\x00STX_SCRIPT_${u}\x00`);if(t)return nc(e,{output:n,scripts:i}),Rs(e,n,i.slice());return Rs(e,n,i)}function Er(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(n,i)=>t[+i]??"")}var Hn="__stx_component_client_factories";function qn(e){let t=e[Hn];return t instanceof Map?t:null}function rl(e){e[Hn]=new Map}function Ts(e,t){let n=qn(e);if(!n)return null;let i=sc("sha256").update(t).digest("hex").slice(0,16),a=n.get(i);if(a)a.instances++;else n.set(i,{body:t,instances:1});return i}function sl(e,t){let n=qn(t);if(!n?.size)return e;let i=new Map;for(let[A,D]of n)if(D.instances===1)i.set(A,D.body);let a=[];if(i.size>0){let A=[...i.keys()].map((O)=>JSON.stringify(O).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),D=new RegExp(`window\\.__stxComponentFactories\\[(${A})\\]\\(("[^"]+")\\);`,"g"),F=D.exec(e);while(F!==null){let O=i.get(JSON.parse(F[1]));if(O!==void 0)a.push({start:F.index,end:F.index+F[0].length,replacement:ue(`(${O})(${F[2]});`)});F=D.exec(e)}}let u=[...n].filter(([,A])=>A.instances>1);if(u.length===0)return ci(e,a);let l=u.map(([A,D])=>` try { factories[${JSON.stringify(A)}] = factories[${JSON.stringify(A)}] || ${D.body}; }
|
|
209
|
+
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(A)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
210
|
+
`),f=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
211
|
+
(function() {
|
|
212
|
+
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
213
|
+
${ue(l)}
|
|
214
|
+
})();
|
|
215
|
+
</script>`,x,v=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return w(e,(A,D)=>{if(x===void 0){if(v.lastIndex=D,v.test(A))x=D}return-1}),a.push({start:x??0,end:x??0,replacement:`${f}
|
|
216
|
+
`}),ci(e,a)}function ci(e,t){if(t.length===0)return e;t.sort((u,l)=>u.start-l.start||u.end-l.end);let n=Array(t.length*2+1),i=0,a=0;for(let u of t)n[a++]=e.slice(i,u.start),n[a++]=u.replacement,i=u.end;return n[a]=e.slice(i),n.join("")}function li(e){let t=qn(e),n=new Map;if(t)for(let[i,a]of t)n.set(i,a.instances);return n}function ui(e,t){let n=qn(e);if(!n)return[];let i=[];for(let[a,u]of n){let l=u.instances-(t.get(a)??0);if(l>0)i.push({body:u.body,count:l})}return i}function pi(e,t){for(let{body:n,count:i}of t)for(let a=0;a<i;a++)Ts(e,n)}function Ce(e,t,n=2){let i=0,a=null;for(let u=t+n;u<e.length;u++){let l=e[u];if(a){if(l==="\\"){u++;continue}if(l===a)a=null;continue}if(l==='"'||l==="'"||l==="`"){a=l;continue}if(l==="{"){i++;continue}if(l==="}"){if(i>0){i--;continue}let f=0;while(e[u+f]==="}")f++;if(f>=n)return u}}return-1}import Li from"fs";var di=0,As=new Map;function pl(){di=0,As.clear()}function Zn(e,t){let n=di++,i=`<!--__STX_${e.toUpperCase()}_${n}__-->`;return As.set(i,{type:e,expression:t}),i}function fl(){let e={};for(let[t,n]of As)e[t]={type:n.type,expression:n.expression};return e}function gl(e,t){let n=e;for(let[i,a]of t)n=n.split(i).join(a);return n}function $i(e){return e.includes("<!--__STX_")}var rc=/@(?=[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 ic(e){return Array.from({length:e},()=>"{").join("⁠")}function Pi(e){return e.replace(/\{{2,}/g,(t)=>ic(t.length)).replace(/\{(?=!)/g,"{⁠").replace(rc,"@")}function $r(e,t,n=!1){let{openTag:i,tail:a}=n?oc(e,t):ac(e).at(t);return lc(a,i,n)}function oc(e,t){let n="",i=0;for(let l=0;l<t;l++){if(!e.startsWith("{{",l))continue;let f=Ce(e,l);if(f<0||f+2>t)break;n+=e.slice(i,l)+"x",l=f+1,i=f+2}n+=e.slice(i,t);let a=-1,u=null;for(let l=0;l<n.length;l++){let f=n[l];if(u){if(f===u)u=null;continue}if(f==='"'||f==="'"){u=f;continue}if(f===">"){a=-1;continue}if(f==="<")a=l}return{openTag:a,tail:a>=0?n.slice(a+1):n}}var Kn=null;function ac(e){if(Kn&&Kn.source===e)return Kn.scanner;let t=cc(e);return Kn={source:e,scanner:t},t}function cc(e){let t=0,n=-1,i=null,a=-1,u=(f,x)=>{let v=e[f];if(x.quote){if(v===x.quote)x.quote=null;return}if(x.openTag>=0){if(v==='"'||v==="'"){x.quote=v;return}if(v===">"){x.openTag=-1;return}}if(v==="<")x.openTag=f},l=(f,x)=>{if(x.openTag>=0||!e.startsWith("<!--",f))return-1;let v=e.indexOf("-->",f+4);return v<0?e.length:v+3};return{at(f){if(f<t)t=0,n=-1,i=null,a=-1;let x={openTag:n,quote:i},v=!1;while(t<f){if(a<0&&e.startsWith("{{",t)){let W=Ce(e,t);if(W<0)a=t;else if(W+2<=f){t=W+2;continue}else break}let z=l(t,x);if(z>=0){if(z>f){v=!0;break}t=z;continue}u(t,x),t++}if(n=x.openTag,i=x.quote,v)return{openTag:-1,tail:""};let A=a>=0?a:t,D={openTag:n,quote:i};for(let z=t;z<f;z++){let W=l(z,D);if(W>=0){if(W>f)return{openTag:-1,tail:""};z=W-1;continue}u(z,D)}if(D.openTag<0)return{openTag:-1,tail:""};let F="",O=D.openTag+1;for(let z=O;z<Math.min(f,A);z++){if(!e.startsWith("{{",z))continue;let W=Ce(e,z);F+=e.slice(O,z)+"x",z=W+1,O=W+2}return F+=e.slice(O,f),{openTag:D.openTag,tail:F}}}}function lc(e,t,n){if(t<0&&!n)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(t>=0)while(i<e.length&&!/\s/.test(e[i]))i++;while(i<e.length){while(/\s/.test(e[i]??"")&&i<e.length)i++;let a=i;while(i<e.length&&!/[\s=/>]/.test(e[i]))i++;let u=e.slice(a,i);if(!u)break;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="=")continue;i++;while(i<e.length&&/\s/.test(e[i]))i++;let l=e[i];if(l==='"'||l==="'"){let f=++i,x=e.indexOf(l,i);if(x===-1)return{kind:"attribute",name:u,quote:l,valuePrefix:e.slice(f)};i=x+1}else{let f=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:u,quote:null,valuePrefix:e.slice(f)}}}return{kind:"tag"}}class de extends Error{attribute;near;constructor(e,t){super(`Unsafe interpolation in ${e}: ${t}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,t){if(this.near===void 0)this.near=e.slice(Math.max(0,t-160),t).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Oi="unsafe:";var uc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,fc=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,pc=/^data:(?:text\/html|application\/xhtml\+xml)/,dc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function gc(e){return e.replace(dc,"").toLowerCase()}function Is(e){let t=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(t))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(t))return"fetched";return null}function Xn(e,t="navigable"){let n=gc(e);if(uc.test(n))return!0;return t==="navigable"?fc.test(n):pc.test(n)}function Tr(e,t="navigable"){return Xn(e,t)?"unsafe:"+e:e}function mc(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return Is(t[1])}function Di(e,t,n=256){if(t<=n)return e.slice(0,t);let i=e.slice(t-n,t),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function Mi(e,t,n=t){let i=mc(e);return i&&Xn(t,i)?"unsafe:"+n:n}function jt(e){let t=e.indexOf(" as ");if(t!==-1){let u=e.slice(0,t).trim(),l=e.slice(t+4).trim();return u&&l?{arrayExpr:u,itemVar:l}:null}let n=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!n)return null;let i=n[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=n[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function Jn(e){let t=[],n=0,i="",a=0;for(let u=0;u<e.length;u++){let l=e[u];if(i){if(l==="\\")u++;else if(l===i)i="";continue}if(l==="'"||l==='"'||l==="`")i=l;else if(l==="("||l==="["||l==="{")n++;else if(l===")"||l==="]"||l==="}")n--;else if(l===","&&n===0)t.push(e.slice(a,u)),a=u+1}return t.push(e.slice(a)),t}function ji(e,t){let n=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a===t&&n===0)return i}return-1}function Ni(e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];if(i==="("||i==="["||i==="{")t++;else if((i===")"||i==="]"||i==="}")&&--t===0)return n}return-1}function kt(e,t){let n=e.trim().replace(/^\.\.\./,"").trim(),i=ji(n,"=");if(i!==-1&&n[i+1]!==">")n=n.slice(0,i).trim();if(!n)return;if(n.startsWith("{")&&n.endsWith("}")){for(let a of Jn(n.slice(1,-1))){let u=a.trim();if(!u)continue;if(u.startsWith("...")){kt(u,t);continue}let l=ji(u,":");kt(l===-1?u:u.slice(l+1),t)}return}if(n.startsWith("[")&&n.endsWith("]")){for(let a of Jn(n.slice(1,-1)))kt(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(n))t.push(n)}function ee(e){let t=e.trim(),n=[],i=0;for(let u=0;u<t.length;u++){let l=t[u];if(l==="("||l==="["||l==="{")i++;else if(l===")"||l==="]"||l==="}")i--;else if(i===0&&/\s/.test(l)){if(!/^\s+(?:in|of)\s/.exec(t.slice(u)))continue;let x=t.slice(0,u).trim();if(x.startsWith("(")&&Ni(x)===x.length-1)x=x.slice(1,-1);for(let v of Jn(x))kt(v,n);if(n.length>0)return n;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let u=a[1].trim();if(u.startsWith("(")&&Ni(u)===u.length-1)u=u.slice(1,-1);let l=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(u);if(l)kt(l[2],n),kt(l[1],n);else for(let f of Jn(u))kt(f,n)}return n}function L(e,t){let n=t instanceof Set?t:new Set(t);if(n.size===0)return!1;let l=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let f of l.match(/[a-zA-Z_$][\w$]*/g)||[])if(n.has(f))return!0;return!1}var Gn="__stx_client_loop_names";function ct(e){let t=e?.[Gn];return Array.isArray(t)?t:[]}function Yn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],n=[],i=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(i)){let u=a[0];if(/^<\/template\s*>$/i.test(u)){let l=n.pop();if(l)l.end=a.index}else if(/^<template\b/i.test(u)&&!/\/\s*>$/.test(u)){let f=[...u.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((A)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(A[1])),x=(f?.[2]??f?.[3])?.trim();if(x&&f?.[1]==="data-stx-slot-binding")try{x=decodeURIComponent(x)}catch{x=void 0}let v=x?{start:a.index+u.length,end:e.length,binding:x}:void 0;if(n.push(v),v)t.push(v)}}return t}var on={},zi=new Map;function hc(e){let t=zi.get(e);if(!t){let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${n}(?!\\w)`,"g"),zi.set(e,t)}return t.lastIndex=0,t}var Ys={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let n=String(e);return n.charAt(0).toUpperCase()+n.slice(1)},number:(e,t,n=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(n),10))}catch{return""}},fmt:(e,t,n="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(n)}catch{return String(e)}},join:(e,t,n=",")=>{if(!Array.isArray(e))return"";return e.join(String(n))},escape:(e,t)=>{if(e===void 0||e===null)return"";return G(String(e))},translate:(e,t,n={})=>{if(!t||!t.__translations)return e;let i=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,u=String(e).split("."),l=i;for(let x of u){if(l===void 0||l===null)break;l=l[x]}if(l===void 0||l===null)return a?e:"";let f=String(l);return Object.entries(n).forEach(([x,v])=>{f=f.replace(hc(x),()=>String(v))}),f},t:(e,t,n={})=>Ys.translate(e,t,n),truncate:(e,t,n=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=n)return a;if(n<=i.length)return i.substring(0,n);return a.substring(0,n-i.length)+i},date:(e,t,n="short",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let u={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(n==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,u[n]||u.short).format(a)}catch{return String(e)}},currency:(e,t,n="USD",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(i,{style:"currency",currency:n}).format(a)}catch{return String(e)}},pluralize:(e,t,n,i)=>{let a=Number(e);if(Number.isNaN(a))return n;let u=i||`${n}s`;return a===1?n:u},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let n=String(e);return n.charAt(n.length-1)},length:(e,t)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,t,n=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return n?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,n="")=>e===void 0||e===null||e===""?n:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,n=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(n,i);return e},replace:(e,t,n,i="")=>{if(e===void 0||e===null)return"";let a=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let n=Number(e);return Number.isNaN(n)?0:Math.abs(n)},round:(e,t,n=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**n;return Math.round(i*a)/a}};function Ig(e,t){if(e in Ys)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);on[e]=t}function my(e){for(let[t,n]of Object.entries(e))Ig(t,n)}function Og(){return{...Ys,...on}}function hy(){for(let e of Object.keys(on))delete on[e]}function qi(e){let t=e.next();while(!t.done)t=e.next();return t.value}function*Zi(e,t,n,i){let a="{".repeat(n);if(!e.includes(a))return e;let u="",l=0,f=0,x=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let v=e.indexOf(a,l);if(v===-1)break;let A=Ce(e,v,n);if(A===-1)break;if(u+=e.slice(l,v)+t(e.slice(v,A+n),e.slice(v+n,A),v),l=A+n,++f>=64){f=0;let D=performance.now();if(D-x>=i)x=D,yield}}return l===0?e:u+e.slice(l)}function Cn(e,t,n=2){return qi(Zi(e,t,n,Number.POSITIVE_INFINITY))}function xc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=$r(e,t);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let u=0;for(let l=0;l<a.valuePrefix.length;l++)if(a.valuePrefix[l]==="\\")l++;else if(a.valuePrefix[l]===i)u++;return u%2===1}function g(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function G(e){return Pi(g(e))}function bc(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function yc(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,n)=>String.fromCodePoint(Number.parseInt(n,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function _c(e,t){let n=yc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(n))throw new de(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(n))!==null){let u=a[1].replace(/^["']|["']$/g,""),l=u.startsWith("/")&&!u.startsWith("//")||u.startsWith("./")||u.startsWith("../")||u.startsWith("#"),f=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(u);if(!l&&!f)throw new de(t,"CSS URLs must be local paths or base64 raster images")}}function ne(e,t,n,i=!1,a=0){try{return wc(e,t,n,i,a)}catch(u){if(u instanceof de)u.locate(e,t);throw u}}function wc(e,t,n,i,a){let u=$r(e,t,i),l=G(n);if(!u)return l;if(u.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(n))throw new de("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return n}if(u.kind==="tag"){let v=e.slice(t+a).trimStart(),A=n.trim();if(!v.startsWith("=")&&(A===""||A.split(/\s+/).every((D)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(D))))return A;throw new de("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let f=u.name.toLowerCase();if(/^on[a-z]/.test(f))throw new de(u.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(f==="srcdoc")l=G(l);if(f==="style")_c(n,u.name);if(u.quote===null)l=bc(l);let x=Is(f);if(x&&u.valuePrefix.trim()===""&&Xn(n,x))return Oi+l;return Mi(Di(e,t),n,l)}function En(e,t){let n=` ${e}="`;return ne(n,n.length,t,!0)}function Ki(e){return e.flatMap((t)=>{let n=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!n||/\bserver\b|\bsrc\s*=/.test(n[1])?[]:[n[2]]})}function Te(e,t){let{scripts:n}=Q(e);for(let i of Ki(n)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||ul.test(i))return!0;if(Fr(i,t))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function Ng(e){let t=[],n=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=n.exec(e);i;i=n.exec(e)){let a=i[1].toLowerCase(),u=new Set(ee(i[3]));if(u.size===0)continue;let l=i.index+i[0].length;if(i[0].endsWith("/>")){t.push({start:i.index,end:l,names:u});continue}let f=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");f.lastIndex=l;let x=1,v=e.length;for(let A=f.exec(e);A;A=f.exec(e)){if(A[2]==="/")continue;if(x+=A[1]==="/"?-1:1,x===0){v=A.index+A[0].length;break}}t.push({start:i.index,end:v,names:u})}return t}function Bi(e,t,n){let i=r(n);for(let a of e){if(t<a.start||t>=a.end)continue;for(let u of a.names)if(new RegExp(`(?<![.#\\w$])${u.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function Wi(e,t){let n=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",u=!1,l=0;for(let v=0;v<i.length;v++){let A=i[v];if(!u&&A==="`"){u=!0,l=0;continue}if(u){if(A==="`"&&l===0){u=!1;continue}if(A==="$"&&i[v+1]==="{"){l++,v++,a+=" ";continue}if(A==="}"&&l>0){l--;continue}if(l>0){a+=A;continue}continue}a+=A}i=a;let f=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,x;while((x=f.exec(i))!==null){let v=x[1];if(!i.substring(0,x.index).trimEnd().endsWith(".")){if(!n.includes(v)&&!(v in t))return!1}}return!0}function Sc(e,t){let n=r(e);for(let i of n.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[i[1]]==="function")return!0;return!1}function $c(e,t){let n=t.__stx_serverDeclared;if(!n||n.size===0)return!1;let i=r(e);for(let a of n)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var Vi=new Set;function Ui(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function vc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let u=e.lastIndexOf(`
|
|
217
|
+
`,t-1)+1;u<t;u++)if(e[u]==="\\")u++;else if(e[u]===i)a++;return a%2===1}function Hi(e,t){let n=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Vi.has(n))Vi.add(n),console.warn(`[stx] {{ ${e} }} in a <script> in ${t??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function Ri(e,t,n){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,u)=>{try{let l=I(u,t);if(l===void 0)return Ui(u)?Hi(u.trim(),n):a;return l===null?"":String(l)}catch{return a}}),i=Cn(i,(a,u,l)=>{let f=u.trim();if(vc(i,l,u))return a;if(/^__[A-Z_]+__$/.test(f))return a;try{let x=I(u,t);if(x===void 0)return Ui(f)?Hi(f,n):a;return JSON.stringify(x).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(v)=>"\\u007b".repeat(v.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function Mg(e,t){if(!e.includes("{"))return e;let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let u=I(a,t);if(u===void 0)return i;return u===null?"":String(u)}catch{return i}}),n=Cn(n,(i,a,u)=>{let l=a.trim();if(/^__[A-Z_]+__$/.test(l))return i;try{let f=I(a,t);if(f===void 0)return i;if(f===null)return"";let x=String(f);return ne(n,u,x,!0,i.length)}catch(f){if(f instanceof de)throw f;return i}}),n}function yy(e,t,n={}){let{output:i,scripts:a}=Q(e),u=a.map((l)=>{let f=l.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),x=l.search(/<\/script\s*>$/i);if(!f||x===-1)return l;let v=f[1],A=l.slice(f[0].length,x);if(/\bdata-raw\b/.test(v))return l;if(n.skipServer&&/\bserver\b/.test(v))return l;let F=`<script${Mg(v,t)}>`;if(/\bsrc\s*=/.test(v)||/\btype\s*=\s*["']application\/json["']/.test(v))return F+A+l.slice(x);return F+Ri(A,t)+l.slice(x)});return Er(i,u)}function*Xi(e,t,n,i){let a=e,u=(W,B)=>{let H=bn(W,B);if(H===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(B,H))?-1:H},l=(W,B,H,V)=>{let M=H.length,{output:Z,tokens:re}=ye(W,B,(se,fe)=>V(M+fe));return H.push(...re),Z},f=[];a=l(a,u,f,(W)=>`<!--__STX_STYLE_${W}__-->`);let x=[];a=l(a,X,x,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);let v=t?.__stx_signals_gate===!0||Te(e),A=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...Ti(Ki(x))]),D=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);a=Cn(a,(W,B,H)=>{if(L(B,A))return W;try{let V=I(B,t,!1,(M)=>Ps(M,W,n,e));return V!==void 0&&V!==null?String(V):""}catch(V){let M=V instanceof Error?V.message:String(V);return y("Expression",`Error evaluating: {{{ ${B.trim()}}}}: ${M}`,n,e,H,W)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(W,B,H)=>{if(L(B,A))return W;try{let V=I(B,t,!1,(M)=>Ps(M,W,n,e));if(V===void 0&&t.__stx_buildMode==="compile")return Zn("raw",B.trim());return V!==void 0&&V!==null?String(V):""}catch(V){if(t.__stx_buildMode==="compile")return Zn("raw",B.trim());let M=V instanceof Error?V.message:String(V);return y("Expression",`Error evaluating: {!! ${B.trim()} !!}: ${M}`,n,e,H,W)}}),a=l(a,X,x,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),a=l(a,u,f,(W)=>`<!--__STX_STYLE_${W}__-->`);let F=v?Ng(a):[],O=Yn(a).map((W)=>({...W,names:new Set(ee(`${W.binding} in __slot`))})),z=new Set(ct(t));if(a=yield*Zi(a,(W,B,H)=>{let V=B.trim();if(xc(a,H,B))return W;if(Bi(O,H,V))return W;if(L(V,z))return W;if(F.length>0&&Bi(F,H,V))return W;if(D.has(V))return W;let M=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],Z=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,se=V.match(Z)?.[1],fe=se&&((se in t)||M.includes(se)),xe=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,pe=V.match(xe),Pe=pe&&!M.includes(pe[1])&&!(pe[1]in t);if(/^__[A-Z_]+__$/.test(V))return"";if(L(V,A))return W;if(t.__stx_native_screen===!0&&Sc(V,t))return W;let Ke;try{let Ae=I(B,t,!1,(et)=>{Ke=et});if(v&&!Wi(V,t))return W;if(Ke)Ps(Ke,W,n,e);if(t.__stx_buildMode==="compile"&&!v&&(Ae===void 0||$c(V,t)))return Zn("expr",V);if(Ae===void 0||Ae===null)return"";let Xe=String(Ae);return ne(a,H,Xe,!1,W.length)}catch(Ae){if(Ae instanceof de)throw Ae;if(v&&!Wi(V,t))return W;if(Pe)return W;let Xe=Ae instanceof Error?Ae.message:String(Ae);return y("Expression",`Error evaluating: {{ ${V} }}: ${Xe}`,n,e,H,W)}},2,i),x.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(W,B)=>x[Number(B)]??W);if(f.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(W,B)=>f[Number(B)]??W);return a}function R(e,t,n){return qi(Xi(e,t,n,Number.POSITIVE_INFINITY))}var Ec=100;async function Ai(e,t,n,i=Ec){let a=Xi(e,t,n,i),u=a.next();while(!u.done)await E(),u=a.next();return u.value}function Dg(e,t,n){if(!t.trim())return e;let i=e,a=t.trim();while(a.length>0){let u=a.match(/^(\w+)/);if(!u)break;let l=u[1];a=a.substring(l.length).trim();let f=on[l]||Ys[l];if(!f)throw Error(`Filter not found: ${l}. Available filters: ${Object.keys(Og()).join(", ")}`);let x=[];if(a.startsWith(":")){let v=a.match(/^:([^|\s]+)/);if(v){let A=v[1].trim();try{let D=Number(A);x=[Number.isNaN(D)?A:D]}catch{x=[A]}a=a.substring(v[0].length).trim()}}else if(a.startsWith("(")){let v=1,A=1;while(v>0&&A<a.length){if(a[A]==="(")v++;if(a[A]===")")v--;A++}if(v===0){let D=a.substring(1,A-1).trim();if(D)try{if(D.startsWith("{")&&D.endsWith("}"))x=[I(`(${D})`,n,!0)];else{let F=[],O="",z=null,W=0,B=0,H=0,V=!1;for(let M=0;M<D.length;M++){let Z=D[M];if(V){O+=Z,V=!1;continue}if(Z==="\\"){O+=Z,V=!0;continue}if(z){if(O+=Z,Z===z)z=null;continue}if(Z==='"'||Z==="'"||Z==="`"){z=Z,O+=Z;continue}if(Z==="(")W++;else if(Z===")")W--;else if(Z==="[")B++;else if(Z==="]")B--;else if(Z==="{")H++;else if(Z==="}")H--;if(Z===","&&W===0&&B===0&&H===0){F.push(O),O="";continue}O+=Z}if(O)F.push(O);x=F.map((M)=>{let Z=M.trim();return I(Z,n,!0)})}}catch{x=[D]}a=a.substring(A).trim()}}try{i=f(i,n,...x)}catch(v){let A=v instanceof Error?v.message:String(v);throw Error(`Error applying filter '${l}': ${A}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function kc(e){let t=!1,n="",i=0,a=0,u=0,l=!1;for(let f=0;f<e.length;f++){let x=e[f],v=e[f+1];if(t&&l){l=!1;continue}if(t&&x==="\\"){l=!0;continue}if(l=!1,(x==='"'||x==="'"||x==="`")&&!l){if(!t)t=!0,n=x;else if(x===n)t=!1,n="";continue}if(t&&n==="`"&&x==="$"&&v==="{"){let A=1;f+=2;while(f<e.length&&A>0){if(e[f]==="{")A++;else if(e[f]==="}")A--;if(A>0)f++}continue}if(t)continue;if(x==="(")i++;else if(x===")")i--;else if(x==="[")a++;else if(x==="]")a--;else if(x==="{")u++;else if(x==="}")u--;if(x==="|"&&i===0&&a===0&&u===0){if(v==="|"){f++;continue}if(v==="="){f++;continue}return f}}return-1}var rn=new Set,Cc=1000;function by(){rn.clear()}function Ps(e,t,n,i){if(!Y())return;let a=`${n}\x00${e.expression}`;if(rn.has(a))return;if(rn.size>=Cc)rn.clear();rn.add(a);let u=n,l=i;try{if(n&&Li.existsSync(n))l=Li.readFileSync(n,"utf8")}catch{}let f=l.indexOf(t);if(f>=0)u=`${n}:${l.slice(0,f).split(`
|
|
218
|
+
`).length}`;console.warn(`${u}: stx warning: ${t} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function I(e,t,n=!1,i){try{let a=e.trim(),u=kc(a);if(u>0){let f=a.substring(0,u).trim(),x=a.substring(u+1).trim(),v=I(f,t,!0,i);return Dg(v,x,t)}let l=Qs(a);if(l!==null){i?.({expression:a,rule:l});return}try{let f=Object.keys(t),x=Object.values(t);return p(a,f)(...x)}catch{return d(a,t)}}catch(a){if(a instanceof ReferenceError){let u=/(\b\w+)\s+is not defined/.exec(a.message);if(u){let l=u[1],f=Rc(l,Object.keys(t));if(f&&f!==l)a.message=`${a.message} \u2014 did you mean '${f}'?`}}if(!n)console.error(`Error evaluating expression: ${e}`,a);throw a}}function Rc(e,t){let n=null;for(let a of t){if(a===e)continue;let u=Tc(e,a);if(n===null||u<n.dist)n={key:a,dist:u}}if(!n)return null;let i=Math.max(e.length,n.key.length);if(n.dist<=2||n.dist/i<=0.35)return n.key;return null}function Tc(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[n,i]=e.length<t.length?[e,t]:[t,e],a=Array(n.length+1),u=Array(n.length+1);for(let l=0;l<=n.length;l++)a[l]=l;for(let l=1;l<=i.length;l++){u[0]=l;for(let f=1;f<=n.length;f++){let x=n[f-1]===i[l-1]?0:1;u[f]=Math.min(u[f-1]+1,a[f]+1,a[f-1]+x)}for(let f=0;f<=n.length;f++)a[f]=u[f]}return a[n.length]}function wy(e){if(!e)return"";return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import Ac from"process";function T(e="STX_PUBLIC_"){let t={},n={};for(let[i,a]of Object.entries(Ac.env)){if(!i.startsWith(e)||a===void 0)continue;t[`import.meta.env.${i}`]=JSON.stringify(a),n[i]=a}return t["import.meta.env"]=JSON.stringify(n),t}function Ji(e,t=""){let n=`${e}${t}`,i=0;for(let a=0;a<n.length;a++){let u=n.charCodeAt(a);i=(i<<5)-i+u,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function Gi(e,t,n={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:u=!0,scopeCustomProperties:l=!1}=n;if(!e.trim())return"";let f=Os(e),x=[],v=new Map;if(u)for(let A of f){let D=A.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(D){let F=D[1],O=`${t}_${F}`;v.set(F,O)}}for(let A of f){let D=Yi(A,t,i,a,v,l);x.push(D)}return x.join(`
|
|
219
|
+
|
|
220
|
+
`)}function Os(e){let t=[],n=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",u=!1,l="";for(let f=0;f<n.length;f++){let x=n[f];if(x==="@"&&i===0)u=!0;if(x==="{")i++;else if(x==="}"){if(i--,i===0){if(u){l+=x;let v=l.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(v){let[,A,D,F]=v;if(A==="keyframes")t.push({selector:`@keyframes ${D.trim()}`,declarations:F.trim()});else if(A==="media"||A==="supports"||A==="container"){let O=Os(F);t.push({selector:`@${A} ${D.trim()}`,declarations:O.map((z)=>`${z.selector} { ${z.declarations} }`).join(`
|
|
221
|
+
`)})}else t.push({selector:`@${A} ${D.trim()}`,declarations:F.trim()})}l="",u=!1}else if(a.trim()){a+=x;let v=a.match(/([^{]+)\{([^}]*)\}/);if(v)t.push({selector:v[1].trim(),declarations:v[2].trim()});a=""}continue}}if(u)l+=x;else a+=x}return t}function Yi(e,t,n,i,a,u){let{selector:l,declarations:f}=e;if(l.startsWith("@")){if(l.startsWith("@keyframes")){let A=l.replace("@keyframes ","").trim();return`@keyframes ${a.get(A)||A} { ${f} }`}if(l.startsWith("@media")||l.startsWith("@supports")||l.startsWith("@container")){let D=Os(`x { ${f} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((F)=>Yi(F,t,n,i,a,u)).join(`
|
|
222
|
+
`);return`${l} {
|
|
223
|
+
${D}
|
|
224
|
+
}`}return`${l} { ${f} }`}let x=Ic(l,t,n,i),v=f;for(let[A,D]of a)v=v.replace(new RegExp(`\\b${A}\\b`,"g"),D);if(u)v=v.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${x} { ${v} }`}function Ic(e,t,n,i){let a=e.split(",").map((l)=>l.trim()),u=[];for(let l of a){if(l.startsWith(":host")){if(i)u.push(l);else{let v=l.replace(/:host(\([^)]*\))?/,`.${t}$1`);u.push(v)}continue}if(l.includes("::slotted")){u.push(l);continue}if(l===":root"){u.push(`:root .${t}`);continue}let f=n?`${n} .${t}`:`.${t}`;u.push(`${f} ${l}`);let x=Pc(l,t);if(x)u.push(n?`${n} ${x}`:x)}return u.join(", ")}function Pc(e,t){let n=0,i=e.length;for(let x=0;x<e.length;x++){let v=e[x];if(v==="["||v==="(")n++;else if(v==="]"||v===")")n--;else if(n===0&&(v===" "||v===">"||v==="+"||v==="~")){i=x;break}}let a=e.slice(0,i),u=e.slice(i);if(!a)return"";let l=a.length,f=0;for(let x=0;x<a.length;x++){let v=a[x];if(v==="["||v==="(")f++;else if(v==="]"||v===")")f--;else if(n===0&&f===0&&v===":"){l=x;break}}return`${a.slice(0,l)}.${t}${a.slice(l)}${u}`}var to=String.raw`(?<![\w-])scoped(?![\w-])`,Ds=/<style\s+([^>]*)>/gi,Qi=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,no=new RegExp(to,"i"),Oc=new RegExp(to,"gi"),Ms=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Dc(e){Ds.lastIndex=0;let t=Ds.exec(e);while(t!==null){if(no.test(t[1]))return!0;t=Ds.exec(e)}return!1}function Si(e){let t=new Set,n=[];Ms.lastIndex=0;let i=Ms.exec(e);while(i!==null){let a=i[0].trim();if(t.has(a))n.push({start:i.index,end:i.index+i[0].length});else t.add(a);i=Ms.exec(e)}return n}function wn(e){let t=Si(e);if(t.length===0)return e;let n=Array(t.length+1),i=0;for(let a=0;a<t.length;a++){let u=t[a];n[a]=e.slice(i,u.start),i=u.end}return n[t.length]=e.slice(i),n.join("")}function qs(e,t){if(!Dc(e))return{html:e,hasScoped:!1};let n=Ji(t),i=`data-v-${n}`,a=e,u=!1;if(Qi.lastIndex=0,a=a.replace(Qi,(l,f,x)=>{if(!no.test(f))return l;u=!0;let v=Mc(x,i),A=f.replace(Oc,"").trim(),D=A?` ${A}`:"";return`<style data-stx-scoped="${n}"${D}>${v}</style>`}),!u)return{html:e,hasScoped:!1};return a=Nc(a,i),{html:a,hasScoped:!0}}function Mc(e,t){return Gi(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var jc=(e)=>`\x00stx-scope-mask-${e}\x00`,eo=/\u0000stx-scope-mask-(\d+)\u0000/g;function Nc(e,t){let n=ye(e,(a,u)=>{let l=X(a,u);return l>u?l:bn(a,u)},(a,u)=>jc(u)),i=Lc(n.output,t);return eo.lastIndex=0,i.replace(eo,(a,u)=>n.tokens[Number(u)])}function Lc(e,t){let n=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(i,a,u)=>{if(n.has(a.toLowerCase()))return i;if(i.includes(t))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(u)return i.replace(`<${a}${u}`,`<${a} ${t}${u}`);if(i.endsWith("/>"))return`<${a} ${t} />`;return`<${a} ${t}>`})}var an=/<\/?template\b[^>]*>/gi,zc=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Bc(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return zc.test(t)}function he(e){an.lastIndex=0;let t;while((t=an.exec(e))!==null){if(t[0].startsWith("</")||Bc(t[0]))continue;let n=t.index,i=an.lastIndex,a=1,u;while((u=an.exec(e))!==null)if(u[0].startsWith("</")){if(a--,a===0){let l=u.index;return{start:n,openEnd:i,closeStart:l,end:an.lastIndex,content:e.slice(i,l)}}}else a++;return null}return null}var Fc=0,ml=0;function Qn(e,t){let n=/(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;for(let i of e.matchAll(n))if(i[1].toLowerCase()===t.toLowerCase())return i[2]??i[3]??i[4]??null;return null}function oo(e){let t=[],n=/<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;return w(e,(i,a)=>{n.lastIndex=a;let u=n.exec(i);if(!u||!Qn(u[2],"x-data"))return-1;return t.push({fullMatch:u[0],tagName:u[1],attributes:u[2],startIndex:a,endIndex:n.lastIndex}),n.lastIndex}),t}function hl(e){let t=[];for(let{fullMatch:n,tagName:i,attributes:a,startIndex:u}of oo(e)){let l=Qn(a,"x-data");if(!l)continue;let f=`__stx_scope_${Fc++}`,x=Qn(a,"x-init"),v=xl(e,i,u+n.length),A=e.slice(u,v.endIndex),D=bl(A);t.push({id:f,selector:`[data-stx-scope="${f}"]`,stateExpr:l,initExpr:x,bindings:[],refs:D})}return t}function xl(e,t,n){let i=1,a=n,u=new RegExp(`<${t}(?:\\s|>)`,"gi"),l=new RegExp(`</${t}>`,"gi"),f=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(i>0&&a<e.length){u.lastIndex=a,l.lastIndex=a,f.lastIndex=a;let x=u.exec(e),v=l.exec(e),A=f.exec(e);if(A&&A.index<(x?.index??1/0)){a=A.index+A[0].length;continue}if(!v)return{endIndex:e.length};if(x&&x.index<v.index)i++,a=x.index+x[0].length;else{if(i--,i===0)return{endIndex:v.index+v[0].length};a=v.index+v[0].length}}return{endIndex:e.length}}function bl(e){let t=new Map,n=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),i=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,a;while((a=i.exec(n))!==null){let[,u,l]=a,f=yl(u);t.set(l,f)}return t}function yl(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${ml++}`}function wl(){return`
|
|
225
|
+
// STX Reactive Runtime - x-cloak and transition CSS
|
|
226
|
+
(function() {
|
|
227
|
+
var style = document.createElement('style');
|
|
228
|
+
style.textContent = [
|
|
229
|
+
'[x-cloak] { display: none !important; }',
|
|
230
|
+
// Default transition classes
|
|
231
|
+
'.stx-enter { opacity: 0; transform: scale(0.95); }',
|
|
232
|
+
'.stx-enter-start { opacity: 0; transform: scale(0.95); }',
|
|
233
|
+
'.stx-enter-active { transition: opacity 150ms ease-out, transform 150ms ease-out; }',
|
|
234
|
+
'.stx-enter-to { opacity: 1; transform: scale(1); }',
|
|
235
|
+
'.stx-leave { opacity: 1; transform: scale(1); }',
|
|
236
|
+
'.stx-leave-start { opacity: 1; transform: scale(1); }',
|
|
237
|
+
'.stx-leave-active { transition: opacity 100ms ease-in, transform 100ms ease-in; }',
|
|
238
|
+
'.stx-leave-to { opacity: 0; transform: scale(0.95); }'
|
|
239
|
+
].join('\\n');
|
|
240
|
+
document.head.appendChild(style);
|
|
241
|
+
})();
|
|
242
|
+
|
|
243
|
+
// STX Reactive Runtime
|
|
244
|
+
/* eslint-disable pickier/no-unused-vars, no-console, prefer-const */
|
|
245
|
+
window.__stx_reactive = (function() {
|
|
246
|
+
'use strict';
|
|
247
|
+
|
|
248
|
+
// Deep reactive proxy that triggers onChange for any mutation
|
|
249
|
+
function reactive(obj, onChange) {
|
|
250
|
+
if (!obj || typeof obj !== 'object') return obj;
|
|
251
|
+
return new Proxy(obj, {
|
|
252
|
+
get(target, prop) {
|
|
253
|
+
const value = target[prop];
|
|
254
|
+
if (value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Promise)) {
|
|
255
|
+
return reactive(value, onChange);
|
|
256
|
+
}
|
|
257
|
+
return value;
|
|
258
|
+
},
|
|
259
|
+
set(target, prop, value) {
|
|
260
|
+
target[prop] = value;
|
|
261
|
+
onChange(prop, value);
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
|
|
268
|
+
// then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
|
|
269
|
+
function initScope(scopeEl, initialState, bindings, refs, initExpr, deferInit) {
|
|
270
|
+
// Parse initial state (may contain methods including async init())
|
|
271
|
+
var state;
|
|
272
|
+
try {
|
|
273
|
+
state = new Function('return (' + initialState + ')')();
|
|
274
|
+
} catch (e) {
|
|
275
|
+
console.error('[stx-reactive] Invalid x-data:', initialState, e);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Build $refs object
|
|
280
|
+
var $refs = {};
|
|
281
|
+
for (var name in refs) {
|
|
282
|
+
if (Object.prototype.hasOwnProperty.call(refs, name)) {
|
|
283
|
+
(function(refName, refId) {
|
|
284
|
+
Object.defineProperty($refs, refName, {
|
|
285
|
+
get: function() { return document.getElementById(refId); }
|
|
286
|
+
});
|
|
287
|
+
})(name, refs[name]);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Extract init method from state if present (Alpine.js convention)
|
|
292
|
+
var initMethod = state.init;
|
|
293
|
+
if (typeof initMethod === 'function') {
|
|
294
|
+
delete state.init;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Make state reactive \u2014 mutations trigger re-render via signals
|
|
298
|
+
var scopeId = scopeEl.getAttribute('data-stx-scope');
|
|
299
|
+
var stx = window.stx;
|
|
300
|
+
|
|
301
|
+
// Create signals for each state property so the signals runtime can track dependencies
|
|
302
|
+
var signalState = {};
|
|
303
|
+
var rawState = {};
|
|
304
|
+
var derivedState = {};
|
|
305
|
+
var accessors = {};
|
|
306
|
+
// A getter must NOT be read here. Reading one calls it, and the old loop did
|
|
307
|
+
// exactly that: the returned value is not a function, so it was wrapped as a
|
|
308
|
+
// plain state() -- a snapshot of the answer at construction time, frozen
|
|
309
|
+
// forever while plain properties beside it updated (#2053). A getter is a
|
|
310
|
+
// derived value, so it is registered as one below, once ctxProxy exists for
|
|
311
|
+
// it to read through.
|
|
312
|
+
var ownDescriptors = Object.getOwnPropertyDescriptors ? Object.getOwnPropertyDescriptors(state) : {};
|
|
313
|
+
for (var key in state) {
|
|
314
|
+
if (Object.prototype.hasOwnProperty.call(state, key)) {
|
|
315
|
+
var descriptor = ownDescriptors[key];
|
|
316
|
+
if (descriptor && typeof descriptor.get === 'function') {
|
|
317
|
+
accessors[key] = descriptor;
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
if (typeof state[key] === 'function') {
|
|
321
|
+
// Methods \u2014 bind to a proxy so 'this.prop = val' triggers signal updates
|
|
322
|
+
signalState[key] = state[key];
|
|
323
|
+
} else {
|
|
324
|
+
// Data properties \u2014 wrap in signals for reactivity
|
|
325
|
+
signalState[key] = stx.state(state[key]);
|
|
326
|
+
rawState[key] = true;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Create a proxy context that auto-unwraps signals and writes back through them.
|
|
332
|
+
// Methods get 'this' bound to this proxy so this.foo = bar triggers reactivity.
|
|
333
|
+
var ctx = {};
|
|
334
|
+
var ctxProxy = new Proxy(ctx, {
|
|
335
|
+
get: function(target, prop) {
|
|
336
|
+
if (prop === '$refs') return $refs;
|
|
337
|
+
if (prop === '$el') return scopeEl;
|
|
338
|
+
if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
|
|
339
|
+
if (prop === Symbol.unscopables) return undefined;
|
|
340
|
+
if (!(prop in signalState)) {
|
|
341
|
+
var owner = stx._scopeForBinding(scopeEl, prop);
|
|
342
|
+
return owner ? owner[prop] : undefined;
|
|
343
|
+
}
|
|
344
|
+
var s = signalState[prop];
|
|
345
|
+
if (!s) return undefined;
|
|
346
|
+
if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
|
|
347
|
+
return s.value; // unwrap signal
|
|
348
|
+
}
|
|
349
|
+
if (typeof s === 'function' && !rawState[prop]) {
|
|
350
|
+
return s.bind(ctxProxy); // bind methods to proxy
|
|
351
|
+
}
|
|
352
|
+
return s;
|
|
353
|
+
},
|
|
354
|
+
set: function(target, prop, value) {
|
|
355
|
+
var accessor = derivedState[prop];
|
|
356
|
+
if (accessor) {
|
|
357
|
+
// A getter/setter pair writes through its setter. A getter alone has
|
|
358
|
+
// nowhere to put the value: a derived has no .value setter, so the
|
|
359
|
+
// assignment would be a silent no-op, which is the same class of
|
|
360
|
+
// failure as the stale read this replaces.
|
|
361
|
+
if (typeof accessor.set === 'function') {
|
|
362
|
+
accessor.set.call(ctxProxy, value);
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
console.warn('[stx-reactive] cannot assign to ' + String(prop) + ': it is a getter in x-data, so its value comes from what it reads. Give it a setter, or make it a plain property.');
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
var s = signalState[prop];
|
|
369
|
+
if (rawState[prop] && s && typeof s === 'function') {
|
|
370
|
+
s.value = value; // write through signal \u2014 triggers effects
|
|
371
|
+
} else {
|
|
372
|
+
signalState[prop] = value;
|
|
373
|
+
}
|
|
374
|
+
return true;
|
|
375
|
+
},
|
|
376
|
+
has: function(target, prop) {
|
|
377
|
+
return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick' || !!stx._scopeForBinding(scopeEl, prop);
|
|
378
|
+
},
|
|
379
|
+
ownKeys: function() {
|
|
380
|
+
return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
|
|
381
|
+
},
|
|
382
|
+
getOwnPropertyDescriptor: function(target, prop) {
|
|
383
|
+
if (prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick') {
|
|
384
|
+
return { configurable: true, enumerable: true, writable: true, value: ctxProxy[prop] };
|
|
385
|
+
}
|
|
386
|
+
return undefined;
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
// Now that ctxProxy exists, a getter becomes a derived that reads through it,
|
|
391
|
+
// so it tracks whatever it touches and recomputes when that changes. derived()
|
|
392
|
+
// is lazy, so nothing is evaluated until a binding actually reads it.
|
|
393
|
+
//
|
|
394
|
+
// Marked rawState as well: that is what makes the proxy unwrap it and what
|
|
395
|
+
// exposes the signal itself to the runtime below, which is where dependency
|
|
396
|
+
// tracking comes from. A getter needs both, exactly like a data property.
|
|
397
|
+
for (var accessorKey in accessors) {
|
|
398
|
+
if (Object.prototype.hasOwnProperty.call(accessors, accessorKey)) {
|
|
399
|
+
(function(name, descriptor) {
|
|
400
|
+
signalState[name] = stx.derived(function() {
|
|
401
|
+
return descriptor.get.call(ctxProxy);
|
|
402
|
+
});
|
|
403
|
+
rawState[name] = true;
|
|
404
|
+
derivedState[name] = descriptor;
|
|
405
|
+
})(accessorKey, accessors[accessorKey]);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// Build scope vars for the signals runtime \u2014 it reads these for expression evaluation.
|
|
410
|
+
// We need to provide getter/setter descriptors so signals track properly.
|
|
411
|
+
var scopeVars = {};
|
|
412
|
+
for (var k in signalState) {
|
|
413
|
+
if (Object.prototype.hasOwnProperty.call(signalState, k)) {
|
|
414
|
+
if (rawState[k]) {
|
|
415
|
+
// Data: expose the signal directly so expressions trigger dependency tracking
|
|
416
|
+
scopeVars[k] = signalState[k];
|
|
417
|
+
} else {
|
|
418
|
+
// Method: bind to ctxProxy so 'this' works
|
|
419
|
+
scopeVars[k] = (typeof signalState[k] === 'function') ? signalState[k].bind(ctxProxy) : signalState[k];
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
scopeVars.$refs = $refs;
|
|
424
|
+
scopeVars.$el = scopeEl;
|
|
425
|
+
scopeVars.$nextTick = function(fn) { requestAnimationFrame(fn); };
|
|
426
|
+
|
|
427
|
+
// Register scope \u2014 merge with any existing vars from partial signal scripts
|
|
428
|
+
if (!stx._scopes) stx._scopes = {};
|
|
429
|
+
var registered = stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
|
|
430
|
+
registered.__el = scopeEl;
|
|
431
|
+
|
|
432
|
+
// Store on element for findElementScope
|
|
433
|
+
scopeEl.__stx_scope = scopeVars;
|
|
434
|
+
|
|
435
|
+
// Run init() if present (supports async)
|
|
436
|
+
function runInit() {
|
|
437
|
+
var maybePromise;
|
|
438
|
+
if (initMethod) {
|
|
439
|
+
maybePromise = initMethod.call(ctxProxy);
|
|
440
|
+
}
|
|
441
|
+
if (initExpr) {
|
|
442
|
+
try {
|
|
443
|
+
var fn = new Function('with(this){' + initExpr + ';}');
|
|
444
|
+
var result = fn.call(ctxProxy);
|
|
445
|
+
if (result && typeof result.then === 'function') maybePromise = result;
|
|
446
|
+
} catch (e) {
|
|
447
|
+
console.warn('[stx-reactive] init expression error:', e);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
// If init is async, signal updates will trigger effects automatically
|
|
451
|
+
// when init() resolves and sets this.prop = value (writes through signal)
|
|
452
|
+
if (maybePromise && typeof maybePromise.then === 'function') {
|
|
453
|
+
maybePromise.catch(function(e) {
|
|
454
|
+
console.error('[stx-reactive] async init() error:', e);
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// A component's helper setup follows its markup. Its own mount queue
|
|
460
|
+
// starts the initializer after all component factories have registered.
|
|
461
|
+
// Standalone x-data retains synchronous initialization.
|
|
462
|
+
if (deferInit) {
|
|
463
|
+
registered.__mountCallbacks = registered.__mountCallbacks || [];
|
|
464
|
+
registered.__mountCallbacks.push(runInit);
|
|
465
|
+
} else {
|
|
466
|
+
runInit();
|
|
467
|
+
}
|
|
468
|
+
var destroyExpr = scopeEl.getAttribute('data-stx-xdestroy') || scopeEl.getAttribute('x-destroy');
|
|
469
|
+
if (destroyExpr) {
|
|
470
|
+
registered.__destroyCallbacks = registered.__destroyCallbacks || [];
|
|
471
|
+
var teardown = function() { scopeEl.__stx_execute(destroyExpr); };
|
|
472
|
+
registered.__destroyCallbacks.push(teardown);
|
|
473
|
+
registered.__destroyHooks = registered.__destroyHooks || [];
|
|
474
|
+
registered.__destroyHooks.push(teardown);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Expose for debugging
|
|
478
|
+
scopeEl.__stx_state = ctxProxy;
|
|
479
|
+
scopeEl.__stx_execute = function(stmt, $event, $el) {
|
|
480
|
+
try {
|
|
481
|
+
// Run the statement with the reactive proxy as the lexical scope.
|
|
482
|
+
// Wrapping in a with-block on the proxy makes bare reads/writes go
|
|
483
|
+
// through it (so foo = bar triggers signal.set()) instead of treating
|
|
484
|
+
// each state key as a local function parameter \u2014 bare assignments
|
|
485
|
+
// would otherwise just rebind the local and never reach the signal.
|
|
486
|
+
var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
|
|
487
|
+
fn.call(ctxProxy, $event, $el);
|
|
488
|
+
} catch (e) {
|
|
489
|
+
console.warn('[stx-reactive] execute error:', e);
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
return { initScope: initScope, reactive: reactive };
|
|
495
|
+
})();
|
|
496
|
+
`}function io(e,t){let n=e.replace(/\{!!([\s\S]*?)!!\}/g,(f,x)=>{try{let v=I(x,t,!0);if(v===void 0)return f;return String(v)}catch{return f}}),i="",a=0,u=null;while(a<n.length){let f=n[a];if(u&&f==="\\"){i+=f+(n[a+1]??""),a+=2;continue}if(f==="{"&&n[a+1]==="{"){let x=n.indexOf("}}",a+2);if(x!==-1){let v=n.slice(a,x+2);i+=l(n.slice(a+2,x),v,u),a=x+2;continue}}if(u){if(f===u)u=null}else if(f==="'"||f==='"'||f==="`")u=f;i+=f,a++}return i;function l(f,x,v){let A;try{A=I(f,t,!0)}catch{return x}if(A===void 0)return x;if(v){let D=String(A).replace(/\\/g,"\\\\").replace(new RegExp(v==="`"?"`":v,"g"),`\\${v}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return v==="`"?D.replace(/\$\{/g,"\\${"):D}if(typeof A==="string"){let D=A.trim();if(D.startsWith("{")&&D.endsWith("}")||D.startsWith("[")&&D.endsWith("]"))try{return JSON.parse(D),D}catch{}}return JSON.stringify(A)}}function Sl(e,t,n){if(e.length===0)return"";let i=e.map((a)=>{let u=JSON.stringify(Object.fromEntries(a.refs)),l=io(a.stateExpr,t),f=a.initExpr?io(a.initExpr,t):null,x=JSON.stringify(l),v=f?JSON.stringify(f):"null";return`
|
|
497
|
+
(function() {
|
|
498
|
+
var scopeEl = document.querySelector('${a.selector}');
|
|
499
|
+
if (!scopeEl) return;
|
|
500
|
+
var refs = ${u};
|
|
501
|
+
window.__stx_reactive.initScope(scopeEl, ${x}, [], refs, ${v}${n?", true":""});
|
|
502
|
+
})();`}).join(`
|
|
503
|
+
`);return`
|
|
504
|
+
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
505
|
+
${wl()}
|
|
506
|
+
${i}
|
|
507
|
+
</script>`}function Qc(e,t,n,i=!1){if(!Ns(e))return e;let a=hl(e);if(a.length===0)return e;let u=$l(e,a),l=Sl(a,t,i),f=c(u);if(f!==-1)u=u.slice(0,f)+l+`
|
|
508
|
+
`+u.slice(f);else u+=l;return u}function $l(e,t){let n=[],i=0;for(let[u,l]of oo(e).entries()){let f=t[u];if(!f)break;n.push(e.slice(i,l.startIndex));let x=Qn(l.attributes,"data-stx-scope");if(x)f.id=x,f.selector=`[data-stx-scope="${f.id}"]`,n.push(l.fullMatch);else n.push(`<${l.tagName} data-stx-scope="${f.id}"${l.attributes}>`);i=l.endIndex}n.push(e.slice(i));let a=n.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function Ns(e){return/x-data\s*=\s*["']/.test(e)}function Gs(e,t){let n=e,i=/@json\s*\(/g,a;while((a=i.exec(n))!==null){let u=a.index,l=u+a[0].length-1,f=1,x=l+1,v=null,A=!1;while(x<n.length&&f>0){let M=n[x];if(A){A=!1,x++;continue}if(M==="\\"&&v){A=!0,x++;continue}if(v){if(M===v)v=null;x++;continue}if(M==='"'||M==="'"||M==="`"){v=M,x++;continue}if(M==="(")f++;else if(M===")"){if(f--,f===0)break}x++}if(f!==0)break;let D=n.substring(l+1,x).trim(),F=n.substring(u,x+1),O=-1,z=0,W=null,B=!1;for(let M=0;M<D.length;M++){let Z=D[M];if(B){B=!1;continue}if(Z==="\\"&&W){B=!0;continue}if(W){if(Z===W)W=null;continue}if(Z==='"'||Z==="'"||Z==="`"){W=Z;continue}if(Z==="("||Z==="["||Z==="{")z++;else if(Z===")"||Z==="]"||Z==="}")z--;if(Z===","&&z===0){O=M;break}}let H=O>=0?D.substring(0,O).trim():D,V=O>=0?D.substring(O+1).trim():void 0;try{let M=H.trim(),Z;if(m(M))Z=p(M,Object.keys(t))(...Object.values(t));else Z=void 0;let re;if(V==="true")re=JSON.stringify(Z,null,2);else re=JSON.stringify(Z);let se=re.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");n=n.substring(0,u)+se+n.substring(x+1),i.lastIndex=u+se.length}catch(M){U.log(M instanceof Error?M:Error(String(M)),{directive:"@json"},"error"),i.lastIndex=u+F.length}}return n}function Xs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function el(e){let t=e,n=/@memo\s*\(/g,i,a=[];while((i=n.exec(t))!==null){let u=i.index,l=u+i[0].length,f=1,x=l;while(x<t.length&&f>0){if(t[x]==="(")f++;else if(t[x]===")")f--;x++}if(f!==0)continue;let v=t.slice(l,x-1).trim(),A=x,D=t.slice(A),F=D.indexOf("@endmemo");if(F===-1)continue;let O=D.slice(0,F),z=A+F+8,W=Dt(O),B=O.slice(W),H=O.match(/(\s*)$/),V=H?H[0].length:0,M=B.slice(0,B.length-V),Z=M.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),re;if(Z){let[se,fe,xe="",pe]=Z,Pe=`<${fe}${xe} data-stx-memo="${v}"${pe}>`;re=O.slice(0,W)+Pe+M.slice(se.length)+O.slice(W+M.length)}else re=`${O.slice(0,W)}<div data-stx-memo="${v}">${M}</div>${O.slice(W+M.length)}`;a.push({start:u,end:z,replacement:re}),n.lastIndex=z}for(let u=a.length-1;u>=0;u--){let l=a[u];t=t.slice(0,l.start)+l.replacement+t.slice(l.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function ki(e){let t=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return t=t.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),t}function uo(e,t){let n=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(f,x)=>{n.lastIndex=x;let v=n.exec(f);if(!v||/^(?:script|style)$/i.test(v[1]))return-1;return n.lastIndex}),a=[],u=0,l=[];for(let{start:f,end:x,token:v}of i){let A=/^<\/?([\w-]+)/.exec(v)[1].toLowerCase();if(v.startsWith("</")){while(a.length&&a.pop()!==A);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(v))l.push(e.slice(u,f),v.replace(/\s*\/?>$/,(D)=>` data-stx-slot-owner="${t}"${D}`)),u=x;if(!Ls.has(A)&&!/\/>$/.test(v))a.push(A)}return l.push(e.slice(u)),l.join("")}function fo(e,t){if(!/\bref\s*=/.test(e))return e;let n=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=w(e,(x,v)=>{n.lastIndex=v;let A=n.exec(x);if(!A||/^(?:script|style)$/i.test(A[1]))return-1;return n.lastIndex}),a=[],u=0,l=0,f=[];for(let{start:x,end:v,token:A}of i){let D=/^<\/?([\w-]+)/.exec(A)[1].toLowerCase();if(A.startsWith("</")){let W;while(W=a.pop()){if(W.scoped)u--;if(W.name===D)break}continue}let F=/\sdata-stx-scope\s*=/.test(A),O=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(A),z=a.find((W)=>W.scoped)?.scopeId;if(O&&z&&O[2]===z)f.push(e.slice(l,x),A.replace(O[0],` data-stx-ref-caller="${t}"`)),l=v;else if(!u&&!F&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(A)&&!/\sdata-stx-ref-caller\s*=/.test(A))f.push(e.slice(l,x),A.replace(/\s*\/?>$/,(W)=>` data-stx-ref-caller="${t}"${W}`)),l=v;if(!Ls.has(D)&&!/\/>$/.test(A)){let W=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(A);if(a.push({name:D,scoped:F,scopeId:W?.[1]??W?.[2]}),F)u++}}return f.push(e.slice(l)),f.join("")}var Ls=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),po=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,ao=/<\/?\s*([a-z][\w-]*)/iy,vl=/\s/;function El(e,t){let n=t-1;while(n>=0&&vl.test(e[n]))n--;return n>=0&&e[n]==="/"}function kl(e,t){let n=!1,i=!1;for(let a=t;a<e.length;a++){let u=e[a];if(n){if(u==="'")n=!1}else if(i){if(u==='"')i=!1}else if(u==="'")n=!0;else if(u==='"')i=!0;else if(u===">")return a}return-1}function Rl(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let n=0,i=t,a=!1,u=!1,l=!1;while(i<e.length){let f=e.indexOf("<",i),x=f===-1?e.length:f;if(x>i){if(n===0)while(i<x){let D=e.indexOf(u?"}":"{",i);if(D===-1||D>=x){if(u)l=!1;else a=!1;break}if(D>i)if(u)l=!1;else a=!1;if(u){if(l)return!0;l=!0}else if(a)u=!0,l=!1;else a=!0;i=D+1}i=x;continue}if(e.startsWith("<!--",i)){let D=e.indexOf("-->",i);i=D===-1?e.length:D+3;continue}let v=kl(e,i);if(v===-1)break;ao.lastIndex=i;let A=ao.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(n===0)break;n--}else if(!El(e,v)&&!Ls.has(A))n++;i=v+1}return!1}var co=S(256);function tl(e){if(e.length<1024)return lo(e);let t=_(e),n=co.get(t);if(n!==void 0)return n;let i=lo(e);return co.set(t,i),i}function lo(e){if(e.length>=32768&&!ai(e))return e;let n=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),i="",a=0,u;while((u=n.exec(e))!==null){let l=u.index,f=l+u[0].length,x=!1,v=!1,A=-1;while(f<e.length){let F=e[f];if(x){if(F==="'")x=!1}else if(v){if(F==='"')v=!1}else if(F==="'")x=!0;else if(F==='"')v=!0;else if(F===">"){A=f;break}f++}if(A===-1)continue;let D=e.slice(l,A+1);if(po.test(D))continue;if(D.includes("x-cloak"))continue;if(Rl(e,A+1))i+=e.slice(a,A)+" x-cloak>",a=A+1}return i+=e.slice(a),i}var Tl=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Al=/<\/script>/gi,Il=/<\/style>/gi;function nl(e){let t=/<[a-z][\w-]*/gi,n="",i=0,a;while((a=t.exec(e))!==null){let u=a.index,l=a[0].slice(1).toLowerCase();if(l==="script"||l==="style"){let z=l==="script"?Al:Il;z.lastIndex=u;let W=z.exec(e);if(W!==null)t.lastIndex=W.index+W[0].length;continue}let f=u+a[0].length,x=!1,v=!1,A=-1;while(f<e.length){let z=e[f];if(x){if(z==="'")x=!1}else if(v){if(z==='"')v=!1}else if(z==="'")x=!0;else if(z==='"')v=!0;else if(z===">"){A=f;break}f++}if(A===-1)continue;let D=e.slice(u+a[0].length,A);if(po.test(D))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(D))continue;if(!Tl.test(D))continue;let F=e[A-1]==="/",O=F?A-1:A;n+=`${e.slice(i,O)} x-cloak${F?" ":""}`,i=O}return n+=e.slice(i),n}import To from"path";import tr from"fs";import cn from"path";function go(e,t,n,i){let a=0;for(let u=t;u<e.length;u++)if(e[u]===n)a++;else if(e[u]===i&&!(i===">"&&e[u-1]==="=")){if(--a===0)return u}return-1}function Pl(e){let t=r(e),n=0,i=0,a=[];for(let u=0;u<t.length;u++)if("([{".includes(t[u]))n++;else if(")]}".includes(t[u]))n--;else if(t[u]===","&&n===0)a.push(e.slice(i,u).trim()),i=u+1;return a.push(e.slice(i).trim()),a}function er(e,t){let n=r(e),i=new RegExp(`\\b(?:${t.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of n.matchAll(i)){let u=a.index+a[0].length,l="";if(n[u]==="<"){let x=go(n,u,"<",">");if(x<0)continue;l=e.slice(u+1,x),u=x+1;while(/\s/.test(n[u]||"")&&u<n.length)u++}if(n[u]!=="(")continue;let f=go(n,u,"(",")");if(f>=0)return{type:l,args:Pl(e.slice(u+1,f))}}return null}var mo=`
|
|
509
|
+
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
510
|
+
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
511
|
+
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
512
|
+
type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
|
|
513
|
+
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
514
|
+
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
515
|
+
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
516
|
+
`;function ho(e,t){let n=[],i={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=r(e),u=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(F,O,z,W,B)=>{if(a.slice(B,B+6)!=="import")return F;if(W.endsWith(".stx"))return"";let H=`${t}Import${n.length}`;if(n.push(`import * as ${H} from ${JSON.stringify(W)};`),O.startsWith("*"))return`import ${O.replace(/^\*\s+as\s+/,"")} = ${H};`;if(!O.startsWith("{"))return`import ${O} = ${H}.default;`;return O.slice(1,-1).split(",").map((V)=>{let[M,Z=M]=V.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!M)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(W)&&M in i)i[M].push(Z);return`import ${Z} = ${H}.${M};`}).join(`
|
|
517
|
+
`)}),l=er(e,i.defineProps),f=er(e,i.defineEmits),x=er(e,i.withDefaults);if(!l&&!f)return{declarations:"",props:null,events:null};let v=[],A=null,D=null;if(l){v.push(`const __options = (${l.args[0]||"{}"}) as const;`),v.push(`const __defaults = (${x?.args[1]||"{}"});`);let F=l.type||"__StxOptions<typeof __options>";v.push(`export type __StxProps = __StxDefaults<${F}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),A=`${t}.__StxProps`}if(f)v.push(`const __events = (${f.args[0]||"[]"}) as const;`),v.push(`export type __StxEvents = ${f.type||"Record<(typeof __events)[number], any[]>"};`),D=`${t}.__StxEvents`;return{declarations:`${n.join(`
|
|
518
|
+
`)}
|
|
519
|
+
namespace ${t} {
|
|
520
|
+
${u}
|
|
521
|
+
${v.join(`
|
|
522
|
+
`)}
|
|
523
|
+
}`,props:A,events:D}}var Rr=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 Ar(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Rr].some((t)=>t.toLowerCase()===e.toLowerCase());return Rr.has(e)||/[A-Z]/.test(e)}function*Ol(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,n;while(n=t.exec(e)){let i=t.lastIndex,a=[];while(i<e.length){while(/\s/.test(e[i]||""))i++;if(e[i]===">"||e.slice(i,i+2)==="/>"){i+=e[i]===">"?1:2;break}let u=/^[^\s=/>]+/.exec(e.slice(i))?.[0];if(!u){i++;continue}let l=i;i+=u.length;while(/\s/.test(e[i]||""))i++;if(e[i]!=="="){a.push({name:u,value:!0,offset:l,braced:!1});continue}i++;while(/\s/.test(e[i]||""))i++;let f=e[i],x=f==="{",v=f==='"'||f==="'";if(v||x)i++;let A=i;if(x){let D=r(e.slice(i)),F=1,O=0;for(;O<D.length;O++){if(D[O]==="{")F++;if(D[O]==="}"&&--F===0)break}i+=O}else if(v)while(i<e.length&&e[i]!==f)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:u,value:e.slice(A,i),offset:A,braced:x}),v||x)i++}t.lastIndex=i,yield{name:n[1],offset:n.index,attributes:a}}}function xo(e,t,n){let i=[],a=[mo,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],u=new Map,l=new Map,f=new Map,x=n.scriptCode(e,n.filePath),v=r(x);for(let z of x.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(v.slice(z.index,z.index+6)!=="import")continue;let W=z[2],B=cn.isAbsolute(W)||W.startsWith(".")?cn.resolve(cn.dirname(n.filePath),W):Fs(W,cn.dirname(n.filePath));if(!B)continue;let H=B.endsWith(".stx")?B:tr.existsSync(`${B}.stx`)?`${B}.stx`:void 0,V=H?null:_r(B,!1),M=z[1].startsWith("{")?z[1].slice(1,-1).split(","):[z[1]];for(let Z of M){let[re,se=re]=Z.trim().split(/\s+as\s+/),fe=H||V?.get(re)||V?.get(re.toLowerCase());if(fe)f.set(se,fe),f.set(se.toLowerCase(),fe),f.set(se.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fe)}}for(let z of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let W of z[1].matchAll(/['"]([^'"]+)['"]/g)){let B=zs(W[1],n.filePath,n).find((H)=>tr.statSync(H,{throwIfNoEntry:!1})?.isFile());if(B)f.set(cn.basename(W[1]).replace(/\.stx$/,""),B)}let A={__importedComponents:f},D=new Map,F=(z,W,B)=>{let H=e.slice(0,z);return{code:W,offset:z,attribute:B,anchor:!0,kind:"directive",line:H.split(`
|
|
524
|
+
`).length,column:z-H.lastIndexOf(`
|
|
525
|
+
`)}},O=(z,W,B)=>i.push({expression:z,statement:{text:W+z.code+B,prefixLength:W.length}});for(let z of Ol(t)){if(Ar(z.name)||z.name==="component")continue;let W=zr(z.name,n.filePath,n,A);if(!W)continue;let B=D.get(W);if(!B){let V;try{V=n.readComponent?n.readComponent(W):tr.readFileSync(W,"utf8")}catch{continue}if(V===void 0)continue;l.set(W,V),B=ho(n.scriptCode(V,W),`__StxComponent${D.size}`),D.set(W,B),a.push(B.declarations)}let H=[];for(let V of z.attributes){let{name:M,offset:Z}=V,re=V.value===!0?"true":V.value;if(M.startsWith("@")||M.startsWith("v-on:")){if(B.events&&V.value!==!0)u.set(Z,`__StxEvent<${B.events}, ${JSON.stringify(M.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let se=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(M);if(M.startsWith("v-")&&!M.startsWith("v-bind:")&&!se)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(M))continue;let fe=(se?se[1]||"modelValue":M.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ke,Ae)=>Ae.toUpperCase());if(H.push(fe),!B.props)continue;let xe=M.startsWith(":")||M.startsWith("v-bind:")||!!se||V.braced,pe=xe?re:V.value!==!0?JSON.stringify(re):"true",Pe=!xe&&V.value!==!0&&(re==="true"||re==="false");O(F(Z,pe,M),";void ((",`) satisfies ${Pe?"__StxStaticProp":"__StxProp"}<${B.props}, ${JSON.stringify(fe)}>);`)}if(B.props){let V=[...new Set(H)].map((Z)=>`${JSON.stringify(Z)}: undefined as any`).join(", "),M=F(z.offset,`<${z.name}>`);i.push({expression:M,statement:{text:`;void ({ ${V} } satisfies ${B.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:D.size?a.join(`
|
|
526
|
+
`):"",checks:i,events:u,dependencies:l}}var bo=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Dl(e){let t=(n)=>n.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function lt(e){let t=[],n=Dl(e);bo.lastIndex=0;let i;while((i=bo.exec(n))!==null){let a=(i[1]||"").trim(),u=(i[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,l=(i[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,f=i.index+u,x=i.index+i[0].length-l,v=e.slice(f,x);if(/\bsrc\s*=/.test(a))continue;let A=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(A&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(A[1]))continue;let D=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",F=ln(e,f);t.push({kind:D,code:v,startLine:F,startColumn:un(e,f),offset:f,attrs:a})}return t}function ln(e,t){let n=1;for(let i=0;i<t&&i<e.length;i++)if(e.charCodeAt(i)===10)n++;return n}function un(e,t){let n=e.lastIndexOf(`
|
|
527
|
+
`,t-1)+1;return t-n+1}function es(e){let t=e.split(""),n=(a,u)=>{for(let l=a;l<u&&l<t.length;l++)if(t[l]!==`
|
|
528
|
+
`)t[l]=" "},i=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let a of i){a.lastIndex=0;let u;while((u=a.exec(e))!==null)n(u.index,u.index+u[0].length)}return t.join("")}function Ao(e){let t=0,n="";for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n="";continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{"){t++;continue}if(a===")"||a==="]"||a==="}"){t--;continue}if(a==="|"&&t===0){if(e[i+1]==="|"){i++;continue}if(e[i-1]==="|")continue;return e.slice(0,i)}}return e}var Io=new Set([":for","x-for","v-for"]),ts=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,nr="__stx_interpolated",yo="__StxElement",Po="__StxTemplateValue",Ml=`type ${Po}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function _o(e){return e.replace(/\{\{[\s\S]*?\}\}/g,nr).replace(/\{!![\s\S]*?!!\}/g,nr)}function jl(e,t,n){let i=0;for(let a=t;a<e.length;a++){let u=e[a];if(u==="{"){i++;continue}if(u!=="}"&&u!=="!")continue;if(e.startsWith(n,a)&&i===0)return a;if(u==="}"&&i>0)i--}return-1}function yi(e,t,n="0"){let i=`__stxScript${n}`;while((e+t).includes(i))i+="_";let a=new Map,u=[],l=[],f=r(e),x=zo(e),v=[],A=0;for(let B=0;B<f.length;B++){let H=f.startsWith("{{",B);if(!H&&!f.startsWith("{!!",B))continue;let V=H?2:3,M=H?"}}":"!!}",Z=jl(f,B+V,M);if(Z<0)continue;let re=B,se=e.slice(re,Z+M.length),fe=se.slice(V,-M.length);B=Z+M.length-1;let xe=l.length,pe=rr(x,re),Pe=rr(x,re+(H?2:3));l.push({code:Ao(fe),...Pe});let Ke=`${i}_${xe}`,Ae=se.split(`
|
|
529
|
+
`),Xe=Ae[0].length;Ae[0]=Ke+" ".repeat(Math.max(0,Xe-Ke.length));for(let nt=1;nt<Ae.length;nt++)Ae[nt]=Ae[nt].replace(/[^\r]/g," ");let et=a.get(pe.line)??[],Ye=et.at(-1),it=pe.column+(Ye?Ye.generatedEnd-Ye.sourceEnd:0);et.push({sourceStart:pe.column,sourceEnd:pe.column+Xe,generatedStart:it,generatedEnd:it+Ae[0].length}),a.set(pe.line,et),v.push(e.slice(A,re),Ae.join(`
|
|
530
|
+
`)),A=re+se.length}v.push(e.slice(A));let D=v.join("");if(!l.length)return{code:D,columns:a,declarations:u};let{imports:F,body:O}=Do(t),z=[],W=0;for(let B of F.split(/\n(?=import\b)/)){if(!B.trim())continue;let H=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(B);if(!H){u.push({text:B});continue}let V=`${i}Module${W++}`;u.push({text:`import * as ${V} from ${H[2]}`});let M=H[1],Z=/\{([\s\S]*?)\}/.exec(M);for(let xe of Z?.[1].split(",")??[]){let[pe,Pe=pe]=xe.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(pe==="default")z.push(`const ${Pe} = ${V}.default; type ${Pe} = import(${H[2]}).default`);else if(pe)z.push(`import ${Pe} = ${V}.${pe}`)}let re=M.replace(/\{[\s\S]*?\}/,""),se=/\*\s+as\s+(\w+)/.exec(re);if(se)z.push(`import ${se[1]} = ${V}`);let fe=/^\s*([\w$]+)/.exec(re)?.[1];if(fe)z.push(`const ${fe} = ${V}.default; type ${fe} = import(${H[2]}).default`)}u.push({text:`namespace ${i}Scope {
|
|
531
|
+
${z.join(`
|
|
532
|
+
`)}
|
|
533
|
+
export async function read() {
|
|
534
|
+
${Us(O).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
|
|
535
|
+
return {`});for(let[B,H]of l.entries())u.push({text:`value${B}: (`}),u.push({text:H.code,origin:{line:H.line,column:H.column}}),u.push({text:"),"});u.push({text:`}
|
|
536
|
+
}
|
|
537
|
+
}`});for(let B=0;B<l.length;B++)u.push({text:`declare var ${i}_${B}: Awaited<ReturnType<typeof ${i}Scope.read>>['value${B}']`});return{code:D,columns:a,declarations:u}}function wo(e,t){let n=0;for(let i of e){if(t<i.generatedStart)break;if(t<i.generatedEnd)return i.sourceStart+Math.min(t-i.generatedStart,i.sourceEnd-i.sourceStart);n=i.sourceEnd-i.generatedEnd}return t+n}var Nl=["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"],Ll=new RegExp(String.raw`^[ \t]*@(?:${Nl.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Us(e){return e.replace(Ll,(t)=>t.replace(/[^\n]/g," "))}var So=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function gg(e){let t=es(e),n=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(t))!==null){if(a[1]||a[3])continue;let f=a[2]??a[4]??"",x=a[2]!==void 0?2:3,v=Ao(f);if(!v.trim())continue;let A=a.index+x+(v.length-v.trimStart().length);n.push({code:v.trim(),line:ln(t,A),column:un(t,A),offset:A,kind:"interpolation"})}let u=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=u.exec(t))!==null){let l=a.index+a[0].length-1,f=0,x=l;for(;x<t.length;x++){let F=t[x];if(F==="(")f++;else if(F===")"){if(f--,f===0)break}}if(f!==0)continue;let v=t.slice(l+1,x),A=v.trim();if(u.lastIndex=x+1,!A)continue;let D=l+1+(v.length-v.trimStart().length);n.push({code:A,line:ln(t,D),column:un(t,D),offset:a.index,kind:"condition"})}ts.lastIndex=0;while((a=ts.exec(t))!==null){let l=a[1],f=a[3]??"",x=l.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(So.has(x)||So.has(l))continue;if(!f.trim())continue;let v=a.index+a[0].indexOf(a[2],a[0].indexOf(l)+l.length)+1;if(Io.has(x)){let D=f.match(/\s+(?:in|of)\s+/);if(!D||D.index===void 0)continue;let F=f.slice(D.index+D[0].length),O=D.index+D[0].length+(F.length-F.trimStart().length);n.push({code:_o(F.trim()),line:ln(t,v+O),column:un(t,v+O),offset:v+O,kind:"directive",attribute:x});continue}let A=f.length-f.trimStart().length;n.push({code:_o(f.trim()),line:ln(t,v+A),column:un(t,v+A),offset:v+A,kind:"directive",attribute:x})}return n.sort((l,f)=>l.line-f.line||l.column-f.column),n}var zl=2000;function Bl(e,t){let n=0,i=Math.min(e.length,t+zl);for(let a=t;a<i;a++){let u=e[a];if(u==="(")n++;else if(u===")"){if(n--,n===0)return e.slice(t+1,a)}}return null}function Wl(e){let t=new Map,n=(f,x)=>{let v=f.split(/[,[\]{}()\s]+/).filter(Boolean);for(let A of v){let D=A.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(D))continue;let F=v.length===1?x:void 0,O=t.get(D);if(!O)t.set(D,{name:D,iterable:F});else if(O.iterable!==F)O.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(f)=>{let x=f.trim();return i.test(x)?x:void 0};for(let f of e.matchAll(/@for(?:each|else)\s*\(/g)){let x=Bl(e,f.index+f[0].length-1);if(x===null)continue;let v=jt(x);if(!v)continue;n(v.itemVar.replace(/=>/g," "),a(v.arrayExpr))}for(let f of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))n(f[1],f[2]==="of"?a(f[3]):void 0);for(let f of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))n(f[1]);let u=es(e);ts.lastIndex=0;let l;while((l=ts.exec(u))!==null){let f=l[1].replace(/\..*$/,"");if(!Io.has(f))continue;let x=l[3].match(/\s+(?:in|of)\s+/);if(!x||x.index===void 0)continue;n(l[3].slice(0,x.index),a(l[3].slice(x.index+x[0].length)))}for(let f of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let x of f[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))n(x[1]);return[...t.values()].sort((f,x)=>f.name.localeCompare(x.name))}function Fe(e){let t=new Set;for(let n of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))t.add(n[1]);for(let n of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let i of n[1].split(",")){let a=i.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))t.add(a)}return[...t].sort()}var sr=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Fl={$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 Wc(e=new Set){return[...sr.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(Fl).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
|
|
538
|
+
`)}function qc(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function Oo(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,n,i=!1,a=new Set,u=r(e);while((n=t.exec(u))!==null){i=!0;for(let l of Vl(n[1])){let f=l.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(f))a.add(f)}}return i?[...a]:null}function Vl(e){let t=[],n=0,i="";for(let a of e){if(a===","&&n===0){t.push(i),i="";continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;i+=a}return t.push(i),t.filter((a)=>a.trim().length>0)}function Do(e){let t=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,n=[],i=e.replace(t,(a)=>(n.push(a.trim()),a.split(`
|
|
539
|
+
`).map(()=>"").join(`
|
|
540
|
+
`)));return{imports:n.join(`
|
|
541
|
+
`),body:i}}function ir(e){let t=r(e),n=Array(t.length),i=0;for(let f=0;f<t.length;f++){let x=t[f];if(x==="}"||x===")"||x==="]")i=Math.max(0,i-1);if(n[f]=i,x==="{"||x==="("||x==="[")i++}let a=[],u=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,l;while((l=u.exec(t))!==null){if(n[l.index]!==0)continue;let f=l[1],x=l[2],v;if(f==="interface"){let A=t.indexOf("{",l.index);if(A===-1)continue;let D=0;v=-1;for(let F=A;F<t.length;F++)if(t[F]==="{")D++;else if(t[F]==="}"&&--D===0){v=F+1;break}if(v===-1)continue}else{let A=0;v=t.length;for(let D=t.indexOf("=",l.index)+1;D<t.length;D++){let F=t[D];if(F==="{"||F==="["||F==="("||F==="<")A++;else if(F==="}"||F==="]"||F===")"||F===">")A--;else if(A<=0&&(F===";"||F===`
|
|
542
|
+
`&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,D-40),D)))){v=F===";"?D+1:D;break}}}a.push({name:x,text:e.slice(l.index,v).replace(/^[ \t]*export[ \t]+/,"")}),u.lastIndex=v}return a}function Ul(e){let t=r(e),n=[],i=/^[ \t]*(?:export[ \t]+)?(?:const|let|var)[ \t]+/gm,a,u=0,l=0;while((a=i.exec(t))!==null){for(;l<a.index;l++){let v=t[l];if(v==="{"||v==="("||v==="[")u++;else if(v==="}"||v===")"||v==="]")u=Math.max(0,u-1)}if(u!==0)continue;let f=0,x=t.length;for(let v=a.index+a[0].length;v<t.length;v++){let A=t[v];if(A==="{"||A==="("||A==="[")f++;else if(A==="}"||A===")"||A==="]")f--;else if(f<=0&&(A===";"||A===`
|
|
543
|
+
`)){x=A===";"?v+1:v;break}}if(/\bdefineProps\s*(?:<|\()/.test(t.slice(a.index,x)))n.push(e.slice(a.index,x).replace(/^[ \t]*export[ \t]+/,"").trim())}return n}function bi(e){let t=e.filter((a)=>a.kind==="server").map((a)=>a.code).join(`
|
|
544
|
+
`);if(/\bdefineProps\s*(?:<|\()/.test(r(t)))return t;let n=Mo(t),i=e.filter((a)=>a.kind!=="server").flatMap((a)=>{let u=Ul(a.code);if(!u.length)return[];return[...ir(a.code).filter((l)=>!n.has(l.name)).map((l)=>l.text),...u]});return[t,...i].filter(Boolean).join(`
|
|
545
|
+
`)}function Mo(e){return new Set(ir(e).map((t)=>t.name))}function Kc(e,t=""){let n=Oo(e),i=Mo(t),a=ir(e).filter((v)=>!i.has(v.name)).map((v)=>v.text);if(!n){let v=Fe(e).filter((A)=>!Mt(t,A));if(v.length===0&&a.length===0)return"";return["",`// ${Zl}`,...a,...v.map((A)=>`declare var ${A}: any`)].join(`
|
|
546
|
+
`)}if(n.length===0)return a.length>0?["",`// ${vo}`,...a].join(`
|
|
547
|
+
`):"";let{imports:u,body:l}=Do(e),f=l.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),x=["",`// ${vo}`];if(u)x.push(u);return x.push(...a),x.push(`async function ${Eo}() {`,f,` return { ${n.join(", ")} }`,"}",`type ${ko} = Awaited<ReturnType<typeof ${Eo}>>`,...n.map((v)=>`declare var ${v}: ${ko}[${JSON.stringify(v)}]`)),x.join(`
|
|
548
|
+
`)}function wi(e){let t=r(e),n=t.split(""),i=[],a=0,u=0;for(let f=0;f<n.length;f++){let x=n[f];if(x===`
|
|
549
|
+
`)u=f+1;if(x==="{"||x==="("||x==="["){if(a===0&&x!=="("&&Hl.test(t.slice(u,f))){let v=jo(t,f);if(v!==-1)i.push(...No(t.slice(f,v+1)))}a++;continue}if(x==="}"||x===")"||x==="]"){a=Math.max(0,a-1);continue}if(a>0&&x!==`
|
|
550
|
+
`)n[f]=" "}let l=Fe(n.join(""));return i.length===0?l:[...new Set([...l,...i])].sort()}var Hl=/^\s*(?:export\s+)?(?:const|let|var)\s*$/;function jo(e,t){let n=0;for(let i=t;i<e.length;i++){let a=e[i];if(a==="{"||a==="("||a==="[")n++;else if(a==="}"||a===")"||a==="]")n--;if(n===0)return i}return-1}function ql(e){let t=[],n=0,i=0;for(let a=0;a<e.length;a++){let u=e[a];if(u==="{"||u==="("||u==="[")n++;else if(u==="}"||u===")"||u==="]")n--;else if(u===","&&n===0)t.push(e.slice(i,a)),i=a+1}return t.push(e.slice(i)),t}function $o(e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];if(i==="{"||i==="("||i==="[")t++;else if(i==="}"||i===")"||i==="]")t--;else if(t===0&&(i===":"||i==="="))return{index:n,char:i}}return null}function No(e){let t=[],n=(a)=>{let u=a.trim().replace(/^\.\.\./,"").trim();if(u.startsWith("{")||u.startsWith("[")){let f=jo(u,0);if(f!==-1)t.push(...No(u.slice(0,f+1)));return}let l=$o(u);if(l)u=u.slice(0,l.index).trim();if(/^[A-Z_$][\w$]*$/i.test(u))t.push(u)},i=e.slice(1,-1);for(let a of ql(i)){if(!a.trim())continue;if(e[0]==="["){n(a);continue}let u=$o(a);n(u?.char===":"?a.slice(u.index+1):a)}return t}function Gc(e,t){if(Oo(e)!==null)return[];let n=wi(e),i=Le(t,new Set(n)),a=new Set(C);return n.filter((u)=>{if(a.has(u))return!1;if(Mt(t,u))return!1;return i.has(u)})}var vo="stx: types for the declared client payload (#1868)",Zl="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Eo="__stxServerScope",ko="__StxClientPayload";var Co=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Kl=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Xl(e){let t=new Map,n=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=r(i),{depths:u,balanced:l}=we(a);if(!l)continue;let f=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let x of a.matchAll(f)){let v=x.index??0;if(u[v+x[1].length]!==0)continue;let A=x[2],D=v+x[0].length-x[3].length,F=i.slice(D,v+x[0].length).trim().replace(/;$/,"").trim(),O=x[3],z=n.test(O)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(O)&&!/[,+\-*/%&|?:=]$/.test(F)&&we(O).balanced;t.set(A,t.has(A)||!z?null:F)}}return new Map([...t].filter((i)=>i[1]!==null))}function Lo(e,t,n=0,i=new Set){if(t.size===0||n>=5)return e;let a=r(e),u="",l=0;for(let f of a.matchAll(/[A-Za-z_$][\w$]*/g)){let x=f.index??0,v=f[0],A=t.get(v);if(!A||i.has(v))continue;let D=a.slice(0,x).trimEnd(),F=a.slice(x+v.length).trimStart();if(D.endsWith(".")||/^:(?!:)/.test(F)&&/[{,]$/.test(D))continue;if(x>0&&/[\w$]/.test(a[x-1]))continue;u+=`${e.slice(l,x)}(${Lo(A,t,n+1,new Set([...i,v]))})`,l=x+v.length}return u+e.slice(l)}function Jl(e,t){let n=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=n.exec(e))!==null){if(a.index>t)break;let u=a[1];if(a.index===t){if(u==="elseif"){let f=i[i.length-1];if(f?.current)f.seen.push(f.current);if(f)f.current=null}break}if(u==="endif"||u==="endunless"){i.pop();continue}let l="";if(a[2]==="("){let f=0,x=a.index+a[0].length-1,v=x+1;for(;x<e.length;x++){let A=e[x];if(A==="(")f++;else if(A===")"){if(f--,f===0)break}}l=e.slice(v,x).trim(),n.lastIndex=x+1}if(u==="if")i.push({seen:[],current:l});else if(u==="unless")i.push({seen:[],current:`!(${l})`});else if(u==="elseif"||u==="else"){let f=i[i.length-1];if(!f)continue;if(f.current)f.seen.push(f.current);f.current=u==="elseif"?l:null}}return i.flatMap((u)=>[...u.seen.map((l)=>`!(${l})`),...u.current?[u.current]:[]]).filter(Boolean)}function Gl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(Kl.test(t))return null;let i=";(($event: any): void => { ";return{text:`${i}${t} });`,prefixLength:i.length}}let n=";void ((";return{text:`${n}${t}));`,prefixLength:n.length}}var Yl=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Ro(e,t){return Ws(e,t).code}function Ws(e,t){let n=new Map;if(!t)return{code:e,columns:n};let i=zo(e),a=[],u=0;for(let l of e.matchAll(Yl)){let f=l.index,[x,v,A,D]=l,F=To.resolve(t,D).replace(/\\/g,"/"),O=`${v}${A}${F}${A}`;if(a.push(e.slice(u,f),O),u=f+x.length,x.includes(`
|
|
551
|
+
`))continue;let z=rr(i,f),W=n.get(z.line)??[],B=W.at(-1),H=z.column+(B?B.generatedEnd-B.sourceEnd:0);W.push({sourceStart:z.column,sourceEnd:z.column+x.length,generatedStart:H,generatedEnd:H+O.length}),n.set(z.line,W)}return a.push(e.slice(u)),{code:a.join(""),columns:n}}function Ql(e,t,n){let i=wo(e.importColumns?.get(t)??[],n);return wo(e.scriptColumns?.get(t)??[],i)}function vi(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function eu(e){let t=new Set,n=r(e);for(let i of n.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],u=/\{([^}]*)\}/.exec(a);for(let v of u?.[1].split(",")??[]){let A=v.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(A&&/^[A-Z_$][\w$]*$/i.test(A))t.add(A)}let l=a.replace(/\{[^}]*\}/,""),f=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(l);if(f)t.add(f[1]);let x=/^\s*([A-Z_$][\w$]*)/i.exec(l);if(x&&x[1]!=="type")t.add(x[1])}return[...t].sort()}function Xc(e,t={}){let n=lt(e),i=e.split(`
|
|
552
|
+
`),a=Array.from({length:i.length},()=>""),u=new Map,l=new Map,f=new Map,x=[],v=bi(n),A=t.filePath&&t.templateExpressions!==!1?xo(e,es(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(W,B)=>lt(W).map((H)=>Ro(H.code,To.dirname(B))).join(`
|
|
553
|
+
`)}):void 0,D=new Set,F=[];for(let[W,B]of n.entries()){let H=yi(vi(B)+B.code,v,String(W));for(let[re,se]of H.columns)l.set(B.startLine+re-1,se);for(let re of H.declarations)x.push({text:Ro(re.text,t.originDir??""),origin:re.origin?{...re.origin,line:re.origin.line+B.startLine-1}:void 0});let V=Us(H.code),M=Ws(V,t.originDir??"");for(let[re,se]of M.columns)f.set(B.startLine+re-1,se);let Z=M.code.split(`
|
|
554
|
+
`);Z.forEach((re,se)=>{let fe=B.startLine-1+se;if(fe<a.length)a[fe]=re,D.add(fe)}),F.push(B.startLine-1+Z.length-1)}for(let W of F){let B=a[W]?.trim()===""?W:W+1;if(B<a.length&&a[B].trim()===""&&(B===W||!D.has(B)))a[B]=";"}let O=(W,B)=>{for(let[H,V]of W.split(`
|
|
555
|
+
`).entries())if(a.push(V),B)u.set(a.length,H===0?B:{...B,line:B.line+H,column:1,prefixLength:0})};for(let W of x)O(W.text,W.origin);if(t.globals!==!1){O("");let W=new Set([...n.flatMap((M)=>Fe(M.code)),...n.flatMap((M)=>eu(M.code))]),B=(M)=>{if(!W.has(M))O(`declare var ${M}: any`)};if(t.runtimeGlobals!==!1){if(!W.has("window"))O("declare var window: any");for(let M of C)B(M)}let H=[...new Set([...sr,...Ee,...Co])].filter((M)=>t.runtimeGlobals!==!1||!C.includes(M));if(t.contextScope==="global"){O("declare global {");for(let M of H)O(` var ${M}: any`);O("}")}else{for(let M of sr)B(M);for(let M of Ee)B(M);for(let M of Co)B(M)}O(`declare var ${nr}: any`);let V=new Set(n.flatMap((M)=>Fe(M.code)));O(`type ${yo}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let M of Wl(e)){if(V.has(M.name))continue;let Z=M.iterable&&V.has(M.iterable)?`${yo}<typeof ${M.iterable}>`:"any";O(`declare var ${M.name}: ${Z}`)}}if(t.templateExpressions!==!1){if(A?.declarations)for(let B of A.declarations.split(`
|
|
556
|
+
`))O(B);let W=gg(e).map((B)=>{let H=A?.events.get(B.offset??-1);if(H){B.anchor=!0;let V=B.code.trim(),M=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(V),Z=M?`void ((${M[2]}) satisfies __StxAssignedValue<typeof ${M[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(V)?`${V} satisfies (($event: ${H}) => unknown)`:V,re=`;(($event: ${H}): void => { `;return{expression:B,statement:{text:`${re}${Z} });`,prefixLength:re.length}}}return{expression:B,statement:Gl(B)}}).filter((B)=>B.statement!==null);if(W.push(...A?.checks||[]),W.length>0){let B=es(e),H=Yn(B),V=Xl(n.map((se)=>se.code)),Z=[...new Set(n.flatMap((se)=>Fe(se.code)))].filter((se)=>/^[A-Z_$][\w$]*$/i.test(se)),re=0;if(Z.length>0){O(Ml);for(let se of Z)O(`function __StxRead_${se}() { return ${se} }`),O(`type __StxT_${se} = ${Po}<ReturnType<typeof __StxRead_${se}>>`);O(`;((${Z.map((se)=>`${se}: __StxT_${se}`).join(", ")}) => {`),re=1}for(let{expression:se,statement:fe}of W){let xe=" ".repeat(re),pe=se.offset===void 0?[]:H.filter((Ye)=>se.offset>=Ye.start&&se.offset<Ye.end),Pe=pe.map((Ye)=>`;((${Ye.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ke=" });".repeat(pe.length),Ae=se.offset===void 0?[]:Jl(B,se.offset),Xe=Ae.length>0?`${Ae.map((Ye)=>`if (${Lo(Ye,V)}) `).join("")}{ `:"",et=Ae.length>0?" }":"";O(xe+Pe+Xe+fe.text+et+Ke,{line:se.line,column:se.column,expression:se,prefixLength:fe.prefixLength+xe.length+Pe.length+Xe.length,guardPrefixLength:xe.length+Pe.length+Xe.length})}if(re>0)O("});")}}let z=!1;if(t.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,z=!0;return O("export {}"),{text:a.join(`
|
|
557
|
+
`),lineMap:u,sourceLineCount:i.length,componentDependencies:A?.dependencies,referenced:z,scriptColumns:l,importColumns:f}}function zo(e){let t=[0];for(let n=0;n<e.length;n++)if(e.charCodeAt(n)===10)t.push(n+1);return t}function rr(e,t){let n=0,i=e.length-1;while(n<i){let a=Math.ceil((n+i)/2);if(e[a]<=t)n=a;else i=a-1}return{line:n+1,column:t-e[n]+1}}function Jc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function xi(e,t,n){let i=e.lineMap.get(t);if(!i)return t<=e.sourceLineCount?{line:t,column:Ql(e,t,n)}:null;let a=i.expression?.anchor?0:Math.max(0,n-1-(i.prefixLength??0));return{line:i.line,column:i.column+a,expression:i.expression,inGuard:n<=(i.guardPrefixLength??0)}}var or=S(256),tu=[{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"}],Bo=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function nu(e){let t=Array.from(e,(a)=>a===`
|
|
558
|
+
`?`
|
|
559
|
+
`:" "),n=0,i="";while(n<e.length){let a=e[n],u=e[n+1];if(i){if(a==="\\"){n+=2;continue}if(a===i)i="";n++;continue}if(a==='"'||a==="'"||a==="`"){i=a,n++;continue}if(a==="/"&&u==="/"){while(n<e.length&&e[n]!==`
|
|
560
|
+
`)t[n]=e[n],n++;continue}if(a==="/"&&u==="*"){let l=e.indexOf("*/",n+2),f=l===-1?e.length:l+2;for(;n<f;n++)t[n]=e[n];continue}if(a==="{"&&u==="{"&&e.slice(n,n+4)==="{{--"){let l=e.indexOf("--}}",n+4),f=l===-1?e.length:l+4;for(;n<f;n++)t[n]=e[n];continue}n++}return t.join("")}function su(e){let t=new Map,n=nu(e).split(`
|
|
561
|
+
`),i=e.split(`
|
|
562
|
+
`);return n.forEach((a,u)=>{Bo.lastIndex=0;for(let l of a.matchAll(Bo)){let f=l[1]==="-next-line",x=(i[u]??"").slice(0,l.index).trim(),v=f||x===""?u+2:u+1,D=(l[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),F=D.filter((z)=>/\w/.test(z));if(D.length>0&&F.length===0)continue;let O=t.get(v);if(O&&O.size===0)continue;if(F.length===0){t.set(v,new Set);continue}if(O)F.forEach((z)=>O.add(z));else t.set(v,new Set(F))}}),t}function ru(e,t,n){let i=e.get(t);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>n.includes(a))}function je(e,t,n,i){let a=typeof n==="boolean"?{enabled:n,failOnViolation:n}:n??{enabled:!1};if(!a.enabled)return;let u=_(e,t,i,JSON.stringify(a)),l=or.get(u);if(l!==void 0){if(l&&a.failOnViolation)throw new J(l,i??t);return}let f=a.allowPatterns??[],x=su(e),v=[],A=r(e.replace(/\{\{--[\s\S]*?--\}\}/g,(z)=>z.replace(/[^\n]/g," ")));for(let{pattern:z,message:W,suggestion:B}of tu){if(f.some((V)=>/\w/.test(V)&&W.includes(V)))continue;z.lastIndex=0;let H=A.match(z);if(H&&H.length>0){let V=A.split(`
|
|
563
|
+
`),M=e.split(`
|
|
564
|
+
`),Z=[];if(V.forEach((xe,pe)=>{if(z.lastIndex=0,z.test(xe)&&!ru(x,pe+1,W))Z.push(pe+1)}),Z.length===0&&V.some((xe)=>(z.lastIndex=0,z.test(xe))))continue;let re=Z.length>0?` (script line${Z.length>1?"s":""} ${Z.join(", ")})`:"",se=Z.slice(0,3).map((xe)=>` ${xe} | ${(M[xe-1]??"").trim().slice(0,100)}`).join(`
|
|
565
|
+
`),fe=se?`
|
|
566
|
+
${se}`:"";v.push(` \u2717 ${W}${re}
|
|
567
|
+
\u2192 ${B}${fe}`)}}if(v.length===0){or.set(u,"");return}let D=(z)=>{let W=`${process.cwd()}/`;return z.startsWith(W)?z.slice(W.length):z},O=`[STX] DOM API violation in ${i&&i!==t?`${D(i)} (composed into ${D(t)})`:D(t)}:
|
|
568
|
+
${v.join(`
|
|
569
|
+
`)}
|
|
570
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(or.set(u,O),console.warn(O),a.failOnViolation)throw new J(O,i??t)}var iu=[{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"}],ou=[{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')"}],au=[{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 _g(e){let t=[],n=[];return cu(e,t),lu(e,t,n),uu(e,n),fu(e,t),{valid:t.length===0,errors:t,warnings:n}}function cu(e,t){let n=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(n!==i)t.push({type:"expression",message:`Unclosed expression brackets: found ${n} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function lu(e,t,n){for(let i of iu){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),u=new RegExp(i.close,"g"),l=(e.match(a)||[]).length,f=(e.match(u)||[]).length;if(i.altClose){let x=new RegExp(i.altClose,"g");f+=(e.match(x)||[]).length}if(l>f)t.push({type:"directive",message:`Unclosed @${i.name} directive: found ${l} opening and ${f} closing`,suggestion:`Add ${l-f} missing ${i.close} tag(s)`});else if(f>l)n.push({type:"directive",message:`Extra ${i.close} found: ${f-l} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function uu(e,t){for(let n of ou)if(n.pattern.test(e))t.push({type:"syntax",message:n.message,suggestion:n.suggestion})}function fu(e,t){for(let n of au)if(n.pattern.test(e))t.push({type:"expression",message:`Security warning: ${n.message}`,suggestion:"Remove dangerous code from template expressions"})}function Cg(e,t){let n=e.slice(0,t).split(`
|
|
571
|
+
`);return{line:n.length,column:n[n.length-1].length+1}}function Eg(e,t,n){let i=[];switch(e){case"if":case"elseif":case"unless":if(n.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(n.length===0||!n[0].includes(" as "))i.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(n.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(n.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(n.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(n.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function Tg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function $g(e){let t=e.matchAll(/@([a-z]+)/gi),n=new Set;for(let i of t){let a=i[1].toLowerCase();if(!a.startsWith("end"))n.add(a)}return Array.from(n)}function Wo(e,t,n){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return R(i[0],t,n)+e.slice(i[0].length)}var fn=new P(500),lr=new Map;function Fo(e){try{let t=is.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var ss=new P(1000),ur=new Map,fr=new P(2000),pr=new P(500),Go=33554432,dr=Go;function pu(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===dr)return;dr=t,rs.setMaxBytes(t)}var rs=new P(2000,{maxBytes:Go,sizeOf:(e)=>e.output.length});function du(e){let t=new WeakSet;try{let n=(i)=>{if(i===void 0)return{__stxType:"undefined"};if(typeof i==="bigint")return{__stxType:"bigint",value:i.toString()};if(typeof i==="function"||typeof i==="symbol")throw TypeError("Non-serializable component input");if(i===null||typeof i!=="object")return i;if(t.has(i))throw TypeError("Circular component input");t.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(n);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let u={};for(let l of Object.keys(i).sort())u[l]=n(i[l]);return u}finally{t.delete(i)}};return JSON.stringify(n(e))}catch{return null}}function gu(e){let t={};for(let[n,i]of Object.entries(e))if(!n.startsWith("__")||n==="__stxServeContext")t[n]=i;return t}function ar(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Js(e){let t=process.cwd(),n=`${t}\x00${e}`,i=Vo.get(n);if(i===void 0)i=Bun.hash(Yo(e,t).split(ce.sep).join("/")).toString(36).slice(0,6),Vo.set(n,i);return i}var Vo=new Map;function Yo(e,t){if(!ce.isAbsolute(e))return e;let n=(i)=>{try{return is.realpathSync(i)}catch{return i}};return ce.relative(n(t),n(e))}function Rg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Ve(e){return!Rg(e)}var ns=new Map;function te(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let n=ns.get(t);if(n)return n;if(ns.size>=16)ns.clear();let i=new Bun.Transpiler(e);return ns.set(t,i),i}var Uo=new WeakMap,mu=256;function Ue(e){try{let t=te({loader:"ts",target:"browser",define:T()}),n=Uo.get(t);if(!n)n=new Map,Uo.set(t,n);let i=n.get(e);if(i!==void 0)return i;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let u=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(f)=>{let x=u.length;return u.push(f),`"__STX_EXPR_${x}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(f)=>{let x=u.length;return u.push(f),`"__STX_EXPR_${x}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(f)=>{let x=u.length;return u.push(f),`"__STX_EXPR_${x}__"`});let l=t.transformSync(a);for(let f=0;f<u.length;f++)l=l.replace(`"__STX_EXPR_${f}__"`,u[f]),l=l.replace(`'__STX_EXPR_${f}__'`,u[f]);if(n.size>=mu){let f=n.keys().next();if(!f.done)n.delete(f.value)}return n.set(e,l),l}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function hu(e){let t=[],n=new Set,i=0,a=0,u=e.length,l=(O)=>{a++;while(a<u){if(e[a]==="\\"){a+=2;continue}if(e[a]===O){a++;return}a++}},f=()=>{a++;while(a<u){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let O=1;while(a<u&&O>0)if(e[a]==="{")O++,a++;else if(e[a]==="}")O--,a++;else if(e[a]==="'"||e[a]==='"')l(e[a]);else if(e[a]==="`")f();else a++;continue}a++}},x=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<u&&e[a]!==`
|
|
572
|
+
`)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<u-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},v=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),A=()=>{let O=a-1;while(O>=0&&/\s/.test(e[O]))O--;if(O<0)return!0;let z=e[O];if("(,=:[!&|?{};+-*%<>~^".includes(z))return!0;if(!/[\w$]/.test(z))return!1;let W=O;while(W>0&&/[\w$]/.test(e[W-1]))W--;return v.has(e.slice(W,O+1))},D=()=>{a++;let O=!1;while(a<u&&e[a]!==`
|
|
573
|
+
`){let z=e[a];if(z==="\\"){a+=2;continue}if(z==="[")O=!0;else if(z==="]")O=!1;else if(z==="/"&&!O){a++;while(a<u&&/[a-z]/i.test(e[a]))a++;return}a++}},F=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let H=O[2].split(",").map((V)=>{let M=V.trim().split(":");return M[M.length-1].trim()});for(let V of H)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!n.has(V))t.push(V),n.add(V);return}let z=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let H=z[2];if(!n.has(H))t.push(H),n.add(H);return}let W=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let H=W[1];if(!n.has(H))t.push(H),n.add(H);return}let B=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let H=B[1];if(!n.has(H))t.push(H),n.add(H)}};while(a<u){if(x())continue;if(e[a]==="'"||e[a]==='"'){l(e[a]);continue}if(e[a]==="`"){f();continue}if(e[a]==="/"&&A()){D();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))F();a++}return t}function xu(e){let t=[],n=0,i=0,a=null;for(let u=0;u<e.length;u++){let l=e[u];if(a){if(l==="\\"){u++;continue}if(l===a)a=null;continue}if(l==='"'||l==="'"||l==="`"){a=l;continue}if(l==="("||l==="["||l==="{")n++;else if(l===")"||l==="]"||l==="}")n--;else if(l===","&&n===0)t.push(e.slice(i,u)),i=u+1}if(i<e.length)t.push(e.slice(i));return t}function bu(e){let t=0,n=null;for(let i=0;i<e.length;i++){let a=e[i];if(n){if(a==="\\"){i++;continue}if(a===n)n=null;continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let u=e[i-1],l=e[i+1];if(u==="!"||u==="<"||u===">"||u==="=")continue;if(l==="="||l===">")continue;return i}}return-1}function yu(e,t){try{let n=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!n)return;let i=n.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,u=0,l=-1;for(;i>=0;i--){let x=e[i];if(x==="}")u++;else if(x==="{"){if(u--,u===0){l=i;break}}}if(l===-1)return;let f=e.slice(l+1,a);for(let x of xu(f)){let v=x.trim();if(!v||v.startsWith("..."))continue;let A=bu(v);if(A===-1)continue;let D=v.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(t[D]!==void 0)continue;let F=v.slice(A+1).trim();if(!F)continue;try{let O=Object.keys(t).filter(Ut),z=Function(...O,`"use strict"; return (${F});`);t[D]=z(...O.map((W)=>t[W]))}catch{}}}catch{}}var _u=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Ag(e,t){let n=Dt(e),i=e.slice(n).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!_u.has(a))return null;let u=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=w(e,(A,D)=>(u.lastIndex=D,u.exec(A)?.index===D?u.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let f=0,x=!1;for(let A of l){if(f+=A.token.startsWith("</")?-1:1,f<0)return null;if(f===0){if(e.slice(A.end).trim())return null;x=!0;break}}if(!x)return null;let v=n+i[0].length;return e.slice(0,v)+t+e.slice(v)}function Qo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((i)=>{let a=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.isAbsolute(a)})}async function Ir(e,t,n,i,a){let u=e.endsWith(".stx")?e.slice(0,-4):e,l=(se)=>se.split("-").map((fe)=>fe.charAt(0).toUpperCase()+fe.slice(1)).join(""),f=n.__importedComponents;if(f){for(let se of[u,u.toLowerCase(),l(u),K(u)])if(f.has(se))return!0}let x=[...new Set([`${u}.stx`,`${l(u)}.stx`,`${K(u)}.stx`])],v=typeof a.root==="string"?ce.resolve(a.root):void 0,A=v??ce.dirname(i),D=[],F=(se)=>{if(se&&!D.includes(se))D.push(se)};for(let se of zn(i,v))F(se);let O=n.__originalFilePath;if(O)F(ce.join(ce.dirname(O),"components"));if(Qo(t,a))F(a._rootComponentsDir);F(t),F(a._rootComponentsDir),F(ce.join(ce.dirname(i),"components")),F(a.componentsDir);for(let se of a.additionalComponentsDirs??[])F(se);let z=a._targetComponentFallbackNames?.some((se)=>se.toLowerCase()===u.toLowerCase());if(!z)for(let se of a._targetComponentDirs??[])F(se);if(v)F(ce.resolve(v,"resources/views/components")),F(ce.resolve(v,"resources/components")),F(ce.resolve(v,"src/components")),F(ce.resolve(v,"components"));for(let se of a._layerComponentDirs??[])F(se);let W=a._pluginComponentDirs;if(Array.isArray(W))for(let se of W)F(typeof se==="string"?se:null);if(F(a.fallbackComponentsDir),z)for(let se of a._targetComponentDirs??[])F(se);let B=a._nativePrimitivesFallback;if(B&&!B.except.some((se)=>se.toLowerCase()===u.toLowerCase()))F(B.dir);if(u.startsWith("./")||u.startsWith("../"))return s(ce.resolve(ce.dirname(i),`${u}.stx`));let H=Ho(ce.resolve(import.meta.dir,"components")),V=D.map((se)=>ce.isAbsolute(se)?se:ce.resolve(A,se)),M=`${x.join("\x00")}\x00\x00${V.join("\x00")}`,Z=fr.get(M);if(Z!==void 0)return Z;let re=!1;e:for(let se of V){if(Ho(se)===H)continue;for(let fe of x)if(await s(ce.join(se,fe))){re=!0;break e}}return fr.set(M,re),re}function Ho(e){let t=pr.get(e);if(t!==void 0)return t;let n=e;try{n=is.realpathSync(e)}catch{}return pr.set(e,n),n}function Pg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function ll(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function wu(e,t,n){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,u)=>{let l;try{l=I(a,t)}catch{return u}if(l===void 0||l===null)return"";let f=String(l);if(/<\/style/i.test(f))return console.warn(`[stx] a <style> expression in ${n??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return f};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,u)=>i(u,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,u)=>i(u,a))}var qo=new Set;function Zo(e,t,n,i){let a=`${e}\x00${t}\x00${i??""}`;if(!process.env.STX_DEBUG&&qo.has(a))return;qo.add(a);let u=t?` used in ${t}`:"",l=i?` Cause: ${i}.`:"",f=n.length>0?`
|
|
574
|
+
searched:
|
|
575
|
+
${n.map((x)=>` - ${x}`).join(`
|
|
576
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${u}, so it rendered as nothing.${l}${f}`)}function Ko(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Su=new Set(["for","if","show","key","ref","class","className","style"]),Xo=new Set,ea="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",ul=new RegExp(`\\b(?:${ea})\\s*(?:<[^>]*>)?\\s*\\(`);function Ti(e){let t=new Set,n=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${ea})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let i of e){let a;while((a=n.exec(i))!==null)t.add(a[1]);n.lastIndex=0}return[...t]}async function We(e,t,n,i,a,u,l,f=new Set,x,v=ct(a),A,D=e){let{extractVariables:F}=await o("stx/variable-extractor",()=>import("./chunk-627hzzs3.js")),O=f??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let z=new Set(O);z.add(e);let W=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let B=W&&W!=="load"&&Pg(W)?W:"";try{let H=(oe)=>oe.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),V=D.endsWith(".stx")?D.slice(0,-4):D,M=null,Z=a.__importedComponents;if(Z){let oe=[V,V.toLowerCase(),H(V),K(V)];for(let le of oe)if(Z.has(le)){M=Z.get(le);break}}let re=[];if(!M){let oe=[`${V}.stx`,`${H(V)}.stx`,`${K(V)}.stx`],le=[...new Set(oe)],Se=a.__originalFilePath,me=[];for(let _e of zn(u))if(!me.includes(_e))me.push(_e);let Je=me.length;for(let _e of l._layerComponentDirs??[])if(!me.includes(_e))me.push(_e);if(Se){let _e=ce.join(ce.dirname(Se),"components");me.push(_e)}let Ie=l._rootComponentsDir;if(typeof Ie==="string"&&Qo(i,l)&&!me.includes(Ie))me.push(Ie);if(i&&!me.includes(i))me.push(i);if(typeof Ie==="string"&&!me.includes(Ie))me.push(Ie);let xt=ce.join(ce.dirname(u),"components");if(!me.includes(xt))me.push(xt);if(l.componentsDir&&l.componentsDir!==i&&!me.includes(l.componentsDir))me.push(l.componentsDir);for(let _e of l.additionalComponentsDirs??[])if(_e&&!me.includes(_e))me.push(_e);let Rt=l._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(V),_t=(A?.events??[]).map((_e)=>_e.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ps=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),ds=!_t.includes("valuechange")&&(Rn||_t.includes("change")&&!ps),$t=l._nativeHostAttrs&&/^textinput$/i.test(V),Tt=_t.includes("update:value")&&!_t.includes("input"),tn=l._nativeHostAttrs&&/^video$/i.test(V),gs=l._nativeHostAttrs&&/^image$/i.test(V),An=Hs([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),At=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),In=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),Pn=tn&&(At||In)&&(A?.events??[]).every((_e)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(_e.replace(/^@/,"").split(".")[0])),On=new Set(["","primary","secondary","outline","ghost","danger"]),Dn=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Mn=l._nativeHostAttrs&&/^button$/i.test(V)&&!On.has(Dn),wr=l._targetComponentFallbackNames?.some((_e)=>_e.toLowerCase()===V.toLowerCase())??!1,ms=wr&&(!Rt||ds)&&(!$t||Tt)&&(!tn||Pn)&&(!gs||An)&&!Mn;for(let _e of ms?[]:l._targetComponentDirs??[])if(_e&&!me.includes(_e))me.push(_e);let It=typeof l.root==="string"?ce.resolve(l.root):void 0,Sr=It??ce.dirname(u),Pt=[];if(It)Pt.push(ce.resolve(It,"resources/views/components")),Pt.push(ce.resolve(It,"resources/components")),Pt.push(ce.resolve(It,"src/components")),Pt.push(ce.resolve(It,"components"));Pt.push(ce.resolve(import.meta.dir,"components"));for(let _e of Pt)if(!me.includes(_e))me.push(_e);if(wr){let _e=(l._componentPackageDirs??[]).filter((tt)=>typeof tt==="string"&&tt.length>0),bt=(ms?_e.length?_e:l._pluginComponentDirs??[]:l._targetComponentDirs??[]).filter((tt)=>typeof tt==="string"&&tt.length>0);if(bt.length){let tt=me.slice(Je).map((Qe)=>ce.isAbsolute(Qe)?Qe:ce.resolve(Sr,Qe)).filter((Qe)=>!bt.includes(Qe)),Nn=`${V}\x00${tt.join("\x00")}`,at=ur.get(Nn);if(at===void 0){at=!1;for(let Qe of tt){for(let vt of le)if(await s(ce.join(Qe,vt))){at=!0;break}if(at)break}ur.set(Nn,at)}if(!at){for(let Qe of bt){let vt=me.indexOf(Qe);if(vt>=0)me.splice(vt,1)}me.splice(Je,0,...bt)}}}let vr=l._pluginComponentDirs;if(Array.isArray(vr)){for(let _e of vr)if(typeof _e==="string"&&!me.includes(_e))me.push(_e)}if(l.fallbackComponentsDir&&!me.includes(l.fallbackComponentsDir))me.push(l.fallbackComponentsDir);if(ms){for(let _e of l._targetComponentDirs??[])if(_e&&!me.includes(_e))me.push(_e)}let jn=l._nativePrimitivesFallback;if(jn&&!jn.except.some((_e)=>_e.toLowerCase()===V.toLowerCase())&&!me.includes(jn.dir))me.push(jn.dir);let kr=[...new Set(me.map((_e)=>{if(!_e)return _e;return ce.isAbsolute(_e)?_e:ce.resolve(Sr,_e)}))];me.length=0,me.push(...kr);let hs=`${V}\x00${u}\x00${kr.join("\x00")}`,xs=ss.get(hs);if(xs)if(await s(xs))M=xs;else ss.delete(hs);if(!M&&(V.startsWith("./")||V.startsWith("../")))M=ce.resolve(ce.dirname(u),`${V}.stx`),re.push(M);else if(!M)for(let _e of me){if(!_e)continue;for(let bt of le){let tt=ce.join(_e,bt);if(re.push(tt),await s(tt)){M=tt;break}}if(M)break;if(!M)try{let bt=await import("fs");if(!bt.statSync(_e,{throwIfNoEntry:!1})?.isDirectory())continue;let Nn=8,at=[{path:_e,depth:0}];while(at.length>0&&!M){let Qe=at.pop();if(Qe.depth>=Nn)continue;let vt;try{vt=bt.readdirSync(Qe.path,{withFileTypes:!0})}catch{continue}for(let Ln of vt){if(!Ln.isDirectory())continue;if(Ln.name==="node_modules"||Ln.name.startsWith("."))continue;let Or=ce.join(Qe.path,Ln.name);for(let ga of le){let bs=ce.join(Or,ga);if(re.push(bs),await s(bs)){M=bs;break}}if(M)break;at.push({path:Or,depth:Qe.depth+1})}}}catch{}if(M)break}if(M)ss.set(hs,M)}if(!M||!await s(M))return Zo(e,u,re),Ko(e);x.add(M);let se;if(fn.has(M)&&lr.get(M)===Fo(M))se=fn.get(M);else try{let oe=Fo(M);se=await Bun.file(M).text(),fn.set(M,se),lr.set(M,oe)}catch(oe){let le=oe instanceof Error?oe.message:String(oe);return Zo(e,u,[M],le),Ko(e)}if(A)for(let oe of new Set([...Object.keys(t),...A.reactiveProps??[]])){let le=oe.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let Se=oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Se}\\b`).test(se))A.declaredProps.add(oe);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Se}\\b|\\[\\s*['"]${Se}['"]\\s*\\])`).test(se)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Se}['"]`).test(se))A.consumedProps?.add(oe)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(se))for(let oe of A.reactiveProps){if(Su.has(oe)||A.consumedProps?.has(oe))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(se))continue;let le=`${M}\x00${oe}`;if(Xo.has(le))continue;Xo.add(le),console.warn(`[stx] ${ce.basename(M)} reads \`${oe}\` with defineProps(), which is not live, but ${ce.basename(u)} binds it (:${oe}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${oe}').`)}let fe=new Set(["__originalFilePath","__importedComponents",Hn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),xe={};for(let[oe,le]of Object.entries(a))if(!oe.startsWith("__")||fe.has(oe))xe[oe]=le;let pe=v.length>0?{[Gn]:[...v]}:{},Pe=n;if(n.includes("@include")){let{processIncludes:oe}=await o("stx/includes",()=>import("./chunk-kyer53x3.js"));Pe=await oe(n,a,u,l,x)}if(/<[A-Z][\w.-]*[\s/>]/.test(Pe)){let{processComponents:oe}=await o("stx/component-renderer",()=>import("./chunk-jx5mss16.js")),le={...a,__processedComponents:O,...pe};Pe=await oe(Pe,le,u,l,x);let Se=le.__stx_preserved_client_expressions;if(Array.isArray(Se)&&Se.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Se])]}let Ke=[];if(ll(Pe)){let{processExpressions:oe}=await o("stx/expressions",()=>import("./chunk-z6ntmv5x.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...pe}:v.length>0?{...a,...pe}:a;Pe=oe(Pe,le,u);for(let Se of Pe.matchAll(/\{\{([\s\S]*?)\}\}/g))Ke.push(Se[1].trim())}let Ae=Q(Pe),Xe=[],et=Ae.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(oe,le)=>{let Se=Ae.scripts[Number(le)]||"",me=Se.match(/^<script\b([^>]*)>/i)?.[1]||"",Je=me.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ie=!Je||["module","text/javascript","application/javascript"].includes(Je),xt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${me}`);if(!/\bserver\b/i.test(me)&&Ie&&!xt)return Xe.push(Se),"";return Se}),{extractSlotContent:Ye}=await o("stx/slots",()=>import("./chunk-x0s68p47.js")),it=Ye(et),nt={};if(it.defaultSlot?.trim())nt.default=it.defaultSlot;for(let[oe,le]of it.namedSlots)nt[oe]=le.content;let St=a.__stx_scope_seq??={n:0,key:Js(String(a.__filename??u))},Ht=Yo(e,process.cwd()),pt=`stx_${(Ht.endsWith(".stx")?Ht.slice(0,-4):Ht).replace(/[^a-zA-Z0-9]/g,"_")}_${++St.n}_${St.key}`,Me={...xe,$uid:pt,$native:l._nativeHostAttrs===!0,...t,props:t,slot:et,$slots:nt,__processedComponents:z,__sections:{},__stx_signals_gate:Te(se)||ll(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ke]};if(/import\s/.test(se)){Me.__importedComponents=new Map(Me.__importedComponents);let{processESImports:oe}=await o("stx/component-renderer",()=>import("./chunk-jx5mss16.js"));se=await oe(se,Me,M,l,x)}yu(se,Me);let qt=se,dn=he(qt);if(dn)qt=dn.content.trim();let as=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Zt=[...se.matchAll(as)];for(let[,oe,le]of Zt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(oe))je(le,M,l.strict);let st=[],Kt=null,cs=Zt.some((oe)=>/\bserver\b/.test(oe[1]||"")&&/\bcache\b/.test(oe[1]||"")),Ct=null,dt=null,Xt=null,gn=0,Jt=null;if(pu(l),cs&&dr>0){let oe=du({props:t,slot:Pe,slotContext:n.trim()?gu(xe):void 0,buildMode:l.buildMode??"",skipEventDirectives:l.skipEventDirectives===!0,native:l._nativeHostAttrs===!0,clientLoopNames:[...v].sort(),layers:l._layerGraph?.layers.map((le)=>le.configFile),uid:pt});if(oe!==null){Ct=`${M}\x00${_(se)}\x00${oe}`;let le=rs.get(Ct);if(le){for(let Se of le.dependencies)x.add(Se);if(pi(a,le.clientFactories),St.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let Se=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let me of le.preservedClientExpressions)Se.add(me);a.__stx_preserved_client_expressions=[...Se]}return le.output}dt=new Set(x),Xt=li(a),gn=St.n,Jt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Gt=new Set;for(let oe of Zt){let le=oe[1]||"",Se=oe[2]||"",me=le.includes("server");if(Ve(le)&&Se.trim())Se=Ue(Se);if(me&&Se){for(let Ie of Fe(Se))Gt.add(Ie);try{await F(Se,Me,M,{onFailure:(Ie)=>{if(Ie.kind!=="unknown")Kt=Ie.kind}})}catch(Ie){}}if(!me){let Ie=Se.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),xt=Ie.includes("{{")&&Ie.includes("}}"),Rt=Ie.includes("{!!")&&Ie.includes("!!}");if(xt||Rt)Ie=Ri(Ie,Me,M);let _t=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");st.push(`<script${_t}>${Ie}</script>`)}}let rt=Q(se).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Yt=rt?rt[1]:"",ls=rt?rt[2]:"",gt="",ie=Yt&&/\bscoped\b/i.test(Yt);if(rt)gt=`<style${Yt}>${wu(ls,Me,M)}</style>`;let ae=qt;if(ae=ae.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),rt)ae=ae.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let oe=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(ae=ae.replace(oe,(Se,me)=>{let Je=me.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Je)le.push(`<style${Je[1]}>${Je[2]}</style>`);return""}),ae=ae.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)gt=`${gt}${le.join(`
|
|
577
|
+
`)}`}if(n&&ae.includes("{{ text || slot }}"))ae=ae.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:ge}=await o("stx/slots",()=>import("./chunk-x0s68p47.js")),{defaultSlot:$e,namedSlots:Oe}=it,Ne=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(et),ot=st.length>0&&Ns(ae)||l._nativeHostAttrs===!0&&st.length>0||Ne&&st.length>0||st.some((oe)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(oe)),us=(oe)=>ot?fo(oe,pt):oe,fs=new Map([...Oe].map(([oe,le])=>[oe,{...le,content:us(le.content)}]));ae=await ge(ae,ot?uo(us($e),pt):$e,fs,Me,ot?pt:"");let mn=Ti(st),Qt=(Array.isArray(Me.__stx_client_signal_names)?Me.__stx_client_signal_names:[]).filter((oe)=>!Gt.has(oe));if(mn.length>0||Qt.length>0)Me.__stx_client_signal_names=[...new Set([...Qt,...mn])];else delete Me.__stx_client_signal_names;let en=v.filter((oe)=>!Gt.has(oe)&&!(oe in t));if(en.length>0)Me[Gn]=en;let hn={...l,_rootComponentsDir:l._rootComponentsDir||l.componentsDir,componentsDir:ce.dirname(M),skipSignalsRuntime:!0,skipEventDirectives:l._nativeHostAttrs===!0||ot||st.length===0,defaultLayout:void 0};Me.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:yn}=await o("stx/process",()=>import("./chunk-6fstz73t.js")),mt=await yn(ae,Me,M,hn,x),yt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let oe of mt.matchAll(/\{\{([\s\S]*?)\}\}/g))yt.add(oe[1].trim());if(yt.size>0)a.__stx_preserved_client_expressions=[...yt];let ht=pt,Ze=mt;if(ot){let oe="";if(Object.keys(t).length>0)try{oe=` data-stx-props="${ar(JSON.stringify(t))}"`}catch{}let le=B?` stx-hydrate="${ar(B)}"`:"",Se=Object.fromEntries(Object.entries(nt).map(([$t,Tt])=>[$t,Boolean(Tt)])),me=Object.keys(Se).length>0?` data-stx-slots="${ar(JSON.stringify(Se))}"`:"",Je=` data-stx-scope="${ht}"${oe}${me}${le}`,Ie=mt.slice(Dt(mt)),xt=/^<span(?=[\s/>])/i.test(Ie),Rt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Ie),_t=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Ie),Rn=xt?"span":"div",ps=Rt&&l._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':_t&&l._nativeHostAttrs?' style="width:100%;height:100%"':xt||Rt?' style="display:contents"':"";Ze=Ag(mt,Je)??`<${Rn}${Je} data-stx-component-wrapper${ps}>${mt}</${Rn}>`;let ds=await Promise.all(st.map(async($t)=>{let Tt=$t.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Tt)return $t;let[,tn,gs]=Tt,An=Wo($t,Me,M);if(An!==null)return An;let At=await vu(gs,M,l.buildMode==="compile"),In=kn(At.clientCode,ze(Me)),{vendorStyleTags:Pn}=At,On=In?`function(__scopeId) {
|
|
578
|
+
${In}
|
|
579
|
+
return (${At.factoryBody})(__scopeId);
|
|
580
|
+
}`:At.factoryBody,Dn=B?null:Ts(a,On),Mn=Dn?`window.__stxComponentFactories[${JSON.stringify(Dn)}](${JSON.stringify(ht)});`:`(${On})(${JSON.stringify(ht)});`;if(B)return`${Pn}<script type="stx/island" data-stx-island="${ht}" data-stx-scoped data-stx-owner="${ht}"${tn}>${ue(Mn)}</script>`;return`${Pn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${ht}"${tn}>${ue(Mn)}</script>`}));if(Ze=Ze+`
|
|
581
|
+
`+ds.join(`
|
|
582
|
+
`),gt)Ze+=`
|
|
583
|
+
`+gt}else{if(gt)Ze+=`
|
|
584
|
+
`+gt;if(st.length>0){let oe=Me.__stx_event_bindings||[],le=ze(Me),Se=await Promise.all(st.map(async(me)=>{let Je=Wo(me,Me,M);if(Je!==null)return Je;let Ie=me.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Ie)return me;return await He(Ie[1],{eventBindings:oe,templateContent:Ze,filePath:M,projectRoot:process.cwd(),serverData:le,instanceId:pt})}));Ze+=`
|
|
585
|
+
`+Se.join(`
|
|
586
|
+
`),Me.__stx_event_bindings=[]}}if(ie){let oe=qs(Ze,M);if(oe.hasScoped)Ze=oe.html}if(Ct&&dt){let oe=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];rs.set(Ct,{output:Ze,dependencies:[...x].filter((le)=>!dt.has(le)),clientFactories:Xt?ui(a,Xt):[],uidsConsumed:St.n-gn,preservedClientExpressions:Jt?oe.filter((le)=>!Jt.has(le)):[]})}if(Kt)Ze=`<!--stx-render-failed:${Kt}-->${Ze}`;return Xe.length>0?`${Ze}
|
|
587
|
+
${Xe.join(`
|
|
588
|
+
`)}`:Ze}catch(H){if(H instanceof J)throw H;return`[Error processing component: ${H instanceof Error?H.message:String(H)}]`}finally{O.delete(e)}}async function s(e){return Bun.file(e).exists()}function gr(e,t){let n=ce.resolve(t),i=ce.resolve(e),a=n.endsWith(ce.sep)?n:n+ce.sep;if(i===n||i.startsWith(a))return i;return null}async function Jo(e,t,n,i){let a=t.startsWith("layouts/")?t.slice(8):t,u=ce.join(e,a);for(let l of u.endsWith(".stx")?[u]:[u,`${u}.stx`])if(await s(l)){if(i)console.log(`Found layout in ${e}: ${l}`);return n?.add(l),l}return null}async function _n(e,t,n,i){let a=await $u(e,t,n,i);if(a===null)return null;let u=gr(a,process.cwd());if(u)return u;let l=[n.root,n.layoutsDir,n.fallbackLayoutsDir,n.componentsDir,n.partialsDir,n.pagesDir,...n._layerLayoutDirs??[]].filter((f)=>typeof f==="string"&&f.length>0);for(let f of l){let x=ce.isAbsolute(f)?f:ce.resolve(process.cwd(),f);if(gr(a,x))return ce.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${t})`),null}async function $u(e,t,n,i){if(n.debug)console.log(`Resolving template path: ${e} from ${t}`);let a=ce.dirname(t),u=process.cwd();if(e.startsWith("/")){let O=ce.join(u,e),z=gr(O,u);if(!z)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(n.debug)console.log(`Checking absolute path: ${z}`);if(await s(z)&&i)i.add(z);return z}let l=async(O)=>{if(!n.layoutsDir||!n.fallbackLayoutsDir)return O;let z=ce.relative(ce.resolve(u,n.fallbackLayoutsDir),O);if(z.startsWith("..")||ce.isAbsolute(z))return O;return await Jo(ce.resolve(u,n.layoutsDir),e,i,n.debug)??O},f=ce.join(a,e);if(await s(f)){if(n.debug)console.log(`Found direct path: ${f}`);let O=await l(f);if(i)i.add(O);return O}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let O of[".stx",".tsx",".jsx"]){let z=`${f}${O}`;if(await s(z)){if(n.debug)console.log(`Found direct path with extension: ${z}`);let W=await l(z);if(i)i.add(W);return W}}let x=[];if(x.push(...n._layerLayoutDirs??[]),n.layoutsDir)x.push(ce.isAbsolute(n.layoutsDir)?n.layoutsDir:ce.resolve(process.cwd(),n.layoutsDir));let v=ce.resolve(a),A=process.cwd();for(let O=0;O<10;O++){let z=ce.join(v,"layouts"),W=!1;try{W=is.statSync(z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(W){x.push(z);break}let B=ce.dirname(v);if(B===v||B.length<A.length)break;v=B}for(let O of x){let z=await Jo(O,e,i,n.debug);if(z)return z}if(n.fallbackLayoutsDir){let O=ce.isAbsolute(n.fallbackLayoutsDir)?n.fallbackLayoutsDir:ce.resolve(process.cwd(),n.fallbackLayoutsDir),z=e.startsWith("layouts/")?e.slice(8):e,W=[ce.join(O,z)];if(!e.endsWith(".stx"))W.push(`${W[0]}.stx`);for(let B of W)if(await s(B)){if(n.debug)console.log(`Found in options.fallbackLayoutsDir: ${B}`);if(i)i.add(B);return B}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let O=e.split("layouts/"),z=ce.join(n.partialsDir||a,"layouts",O[1]);if(await s(z)){if(n.debug)console.log(`Found in layouts path: ${z}`);if(i)i.add(z);return z}if(!z.endsWith(".stx")){let W=`${z}.stx`;if(await s(W)){if(n.debug)console.log(`Found in layouts path with extension: ${W}`);if(i)i.add(W);return W}}}if(n.partialsDir){let O=ce.join(n.partialsDir,"layouts");if(await s(O)){let z=ce.join(O,e);if(await s(z)){if(n.debug)console.log(`Found in partials layouts dir: ${z}`);if(i)i.add(z);return z}if(!e.endsWith(".stx")){let W=`${z}.stx`;if(await s(W)){if(n.debug)console.log(`Found in partials layouts dir with extension: ${W}`);if(i)i.add(W);return W}}}}let D=n.partialsDir||ce.join(process.cwd(),"views"),F=ce.join(D,e);if(await s(F)){if(n.debug)console.log(`Found in views path: ${F}`);if(i)i.add(F);return F}if(!e.endsWith(".stx")){let O=`${F}.stx`;if(await s(O)){if(n.debug)console.log(`Found in views path with extension: ${O}`);if(i)i.add(O);return O}}if(a.includes("temp")){let O=ce.join(ce.dirname(a),"layouts",e);if(await s(O)){if(n.debug)console.log(`Found in temp layouts dir: ${O}`);if(i)i.add(O);return O}if(!e.endsWith(".stx")){let z=`${O}.stx`;if(await s(z)){if(n.debug)console.log(`Found in temp layouts dir with extension: ${z}`);if(i)i.add(z);return z}}}if(n.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function dl(e,t,n){let i=0,a="",u="";try{if(typeof t==="number"&&t>=0){let l=e.split(`
|
|
589
|
+
`),f=0;for(let x=0;x<l.length;x++)if(f+=l[x].length+1,f>=t){i=x+1,a=l[x].trim();let v=Math.max(0,x-2),A=Math.min(l.length,x+3);u=l.slice(v,A).map((D,F)=>{let O=v+F+1;return`${O===i?"> ":" "}${O}: ${D}`}).join(`
|
|
590
|
+
`);break}}else if(n){let l=e.indexOf(n);if(l>=0)return dl(e,l)}}catch{}return{lineNumber:i,lineContent:a,context:u}}var ke={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function y(e,t,n,i,a,u){let{lineNumber:l,context:f}=dl(i,a,u),x=n.split("/").pop(),v=0;if(typeof a==="number"&&a>=0&&i){let D=i.lastIndexOf(`
|
|
591
|
+
`,Math.max(0,a-1));v=a-(D+1)+1}let A="";if(l>0)A+=`
|
|
592
|
+
${n}:${l}${v>0?`:${v}`:""}: ${e.toLowerCase()} error: ${t}
|
|
593
|
+
`;if(A+=`
|
|
594
|
+
${ke.bold}${ke.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${ke.reset}
|
|
595
|
+
`,A+=`${ke.bold}${ke.red}\u2502${ke.reset} ${ke.bold}${ke.bgRed} ERROR ${ke.reset} ${ke.red}${e} Error${ke.reset}${" ".repeat(Math.max(0,43-e.length))}${ke.bold}${ke.red}\u2502${ke.reset}
|
|
596
|
+
`,A+=`${ke.bold}${ke.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${ke.reset}
|
|
597
|
+
`,A+=`
|
|
598
|
+
${ke.cyan}${ke.bold}File:${ke.reset} ${ke.dim}${x}${ke.reset}`,l>0)A+=` ${ke.gray}(line ${l}${v>0?`, col ${v}`:""})${ke.reset}`;if(A+=`
|
|
599
|
+
${ke.yellow}${ke.bold}Message:${ke.reset} ${t}
|
|
600
|
+
`,f)A+=`
|
|
601
|
+
${ke.blue}${ke.bold}Context:${ke.reset}
|
|
602
|
+
${ke.dim}${f}${ke.reset}
|
|
603
|
+
`;return A}function be(){fn.clear(),lr.clear(),ss.clear(),ur.clear(),fr.clear(),pr.clear(),rs.clear()}function gy(){return{size:fn.size,maxSize:500}}var cr=S(128);async function vu(e,t,n){let i=_(e,t,n),a=cr.get(i);if(a){if(Vs(a.deps))return a;cr.delete(i)}let u=Ci(e,{filePath:t,projectRoot:process.cwd()}),l=u.code,f=Ei(u.styles);l=zt(l).code;let{hasUserImports:x,bundleClientScript:v}=await o("stx/client-script-bundler",()=>import("./chunk-12sv6b9c.js")),A=[],D=!1;if(x(l)){let V=l;l=await v(V,t,{projectRoot:process.cwd(),minify:n,collectInputs:A}),D=l===V}let{stripStxRuntimeImports:F}=await o("stx/signal-processing",()=>import("./chunk-7q5h2cve.js"));l=F(l);let O=N(l),z=hu(O),W=new Set(q(O,!0).split(",").map((V)=>V.trim())),B=`function(__scopeId) {
|
|
604
|
+
${ft("const",[..._l,...z],O)}
|
|
605
|
+
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
606
|
+
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
607
|
+
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
608
|
+
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
609
|
+
const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
|
|
610
|
+
// A clone the runtime is setting up may not be in the document yet (rows
|
|
611
|
+
// a loop builds inside a closed :if), where a lookup cannot see it, so the
|
|
612
|
+
// runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
|
|
613
|
+
const __setupRoot = window.__STX_SETUP_ROOT__;
|
|
614
|
+
const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
615
|
+
__scopeVars.$slots = Object.create(null);
|
|
616
|
+
if (__componentElement) {
|
|
617
|
+
try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
|
|
618
|
+
catch {}
|
|
619
|
+
}
|
|
620
|
+
window.__STX_CURRENT_ELEMENT__ = __componentElement;
|
|
621
|
+
let __componentProps = __componentElement && __componentElement.__stx_props;
|
|
622
|
+
if (!__componentProps && __componentElement) {
|
|
623
|
+
try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
|
|
624
|
+
catch { __componentProps = {}; }
|
|
625
|
+
}
|
|
626
|
+
window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
|
|
627
|
+
const __scopeProps = window.__STX_CURRENT_PROPS__;
|
|
628
|
+
Object.defineProperty(__scopeVars, '$props', { configurable: true, enumerable: true, get: function() {
|
|
629
|
+
return (__componentElement && __componentElement.__stx_props) || __scopeProps;
|
|
630
|
+
} });
|
|
631
|
+
|
|
632
|
+
// Scope-specific lifecycle callbacks. The queues drain as they run; the
|
|
633
|
+
// hook lists keep what setup registered, because a component behind an :if
|
|
634
|
+
// unmounts at each hide and mounts again at each show (signals.ts,
|
|
635
|
+
// suspendSubtreeScopes).
|
|
636
|
+
if (__scopeVars.__suspended && !__scopeVars.__mounted) {
|
|
637
|
+
// Set up again after an :if hid it -- a <template :if> clones the
|
|
638
|
+
// component afresh on every show, and the clone's script runs. This run's
|
|
639
|
+
// hooks close over this run's state, so they replace the ones the hide
|
|
640
|
+
// kept for a re-show rather than queueing beside them.
|
|
641
|
+
__scopeVars.__mountCallbacks = [];
|
|
642
|
+
__scopeVars.__destroyCallbacks = [];
|
|
643
|
+
__scopeVars.__mountHooks = [];
|
|
644
|
+
__scopeVars.__destroyHooks = [];
|
|
645
|
+
// So do its effects: the last run's watched a clone that is gone.
|
|
646
|
+
if (typeof __scopeVars.__disposeEffects === 'function') __scopeVars.__disposeEffects();
|
|
647
|
+
__scopeVars.__disposeEffects = null;
|
|
648
|
+
}
|
|
649
|
+
__scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
|
|
650
|
+
__scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
|
|
651
|
+
__scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
|
|
652
|
+
__scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
|
|
653
|
+
let __registeringSetupHooks = true;
|
|
654
|
+
const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
|
|
655
|
+
const onDestroy = (fn) => {
|
|
656
|
+
__scopeVars.__destroyCallbacks.push(fn);
|
|
657
|
+
// A teardown registered inside onMount belongs to this mount alone.
|
|
658
|
+
// Replaying it AND registering the next mount's teardown doubles cleanup.
|
|
659
|
+
if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
|
|
660
|
+
};
|
|
661
|
+
// The effects this setup makes (effect, watch) belong to the scope and are
|
|
662
|
+
// disposed with it (disposeSubtreeScopes in the runtime), as its bindings
|
|
663
|
+
// are. Untracked, one reading a store kept running for a component the
|
|
664
|
+
// router had long swapped out.
|
|
665
|
+
const __endEffects = window.stx._beginEffects ? window.stx._beginEffects() : null;
|
|
666
|
+
|
|
667
|
+
try {
|
|
668
|
+
${O}
|
|
669
|
+
|
|
670
|
+
// Register all defined signals and functions in this scope
|
|
671
|
+
const __localVars = {};
|
|
672
|
+
try {
|
|
673
|
+
${z.map((V)=>W.has(V)?`Object.defineProperty(__localVars, '${V}', ${js(V)});`:`if (typeof ${V} !== 'undefined') __localVars['${V}'] = ${V};`).join(`
|
|
674
|
+
`)}
|
|
675
|
+
}
|
|
676
|
+
catch (e) {}
|
|
677
|
+
Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__localVars));
|
|
678
|
+
if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__stxLiveBindings));
|
|
679
|
+
}
|
|
680
|
+
finally {
|
|
681
|
+
__registeringSetupHooks = false;
|
|
682
|
+
if (__endEffects) {
|
|
683
|
+
const __previousDispose = __scopeVars.__disposeEffects;
|
|
684
|
+
const __disposeSetup = __endEffects();
|
|
685
|
+
__scopeVars.__disposeEffects = typeof __previousDispose === 'function'
|
|
686
|
+
? function() { __previousDispose(); __disposeSetup(); }
|
|
687
|
+
: __disposeSetup;
|
|
688
|
+
}
|
|
689
|
+
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
690
|
+
window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
|
|
691
|
+
}
|
|
692
|
+
}`,H={vendorStyleTags:f,factoryBody:B,clientCode:O,deps:Cr([...A,...u.styles.map((V)=>V.resolvedPath)])};if(!D&&u.unresolved.length===0)cr.set(i,H);return H}var Sn=["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 Eu=100,ku=599,hr="__stxResponseStatus",pn="__stxResponseHeaders";function os(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Eu&&e<=ku}function vn(e){for(let t of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let n=t[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!n)continue;let i=Number(n[1]);if(os(i))return i}return}function mr(e,t){if(!e||typeof e!=="object")return!1;let n=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!os(n))return!1;return e[hr]=n,!0}function Cu(e,t,n){if(!e||typeof e!=="object")return;let i=String(t??"").trim();if(!i)return;e[pn]={...e[pn],[i]:String(n)}}function Bt(e){let t=e?.[hr];return os(t)?t:void 0}function Ft(e){let t=e?.[pn];if(!t||typeof t!=="object")return;let n=Object.entries(t).map(([i,a])=>[i,String(a)]);return n.length>0?Object.fromEntries(n):void 0}function Yc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let n=Bt(e);if(n!==void 0)t[hr]=n;let i=Ft(e);if(i)t[pn]={...t[pn],...i}}function Ks(e){return{setResponseStatus:(t)=>{mr(e,t)},notFound:(t=404)=>{let n=os(t)&&t>=400?t:404;mr(e,n)},setResponseHeader:(t,n)=>{Cu(e,t,n)}}}function Zc(e,t,n={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=n,u=a==="compile",l="",f=0,x=/@status\s*\(/g,v;while((v=x.exec(e))!==null){let A=Ru(e,v.index+v[0].length-1);if(A<0)break;let D=e.slice(v.index+v[0].length,A).trim(),F=/^\d+$/.test(D)?Number(D):d(D,t),O=i?` in ${i}`:"";if(u)console.warn(`[stx] @status(${D})${O} 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(${D}) from <script server> instead \u2014 that runs per request.`);else if(!mr(t,F))console.warn(`[stx] @status(${D})${O} is not an HTTP status (100-599) \u2014 ignoring it.`);l+=e.slice(f,v.index),f=A+1+(e.slice(A+1).match(/^[^\S\n]*\n?/)?.[0].length??0),x.lastIndex=f}return f===0?e:l+e.slice(f)}function Ru(e,t){let n=1,i=null,a=!1;for(let u=t+1;u<e.length;u++){let l=e[u];if(a){a=!1;continue}if(i){if(l==="\\")a=!0;else if(l===i)i=null;continue}if(l==='"'||l==="'"||l==="`"){i=l;continue}if(l==="(")n++;else if(l===")"&&--n===0)return u}return-1}var ta=new Set(Sn),Tu=new Set(["props","$props","defineProps"]),Au=new Set(["stx","@stacksjs/stx"]),na=S(128),sa=S(64);function Iu(e){let t=[],n=0,i=e.split(`
|
|
693
|
+
`);for(let a of i){let u=n,l=null,f=!1;for(let x=0;x<a.length;x++){let v=a[x];if(f){f=!1;continue}if(v==="\\"){f=!0;continue}if(l){if(v===l)l=null;continue}if(v==="'"||v==='"'||v==="`"){l=v;continue}if(v==="/"&&x+1<a.length&&a[x+1]==="/")break;if(v==="{")n++;else if(v==="}")n--}if(u===0){let x=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(x)t.push(x[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let v=a.match(/(?:const|let|var)\s+(\w+)/);if(v)t.push(v[1])}else{let v=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(v){let D=v[1].slice(1,-1).split(",").map((F)=>{let O=F.split(":");return(O.length>1?O[1]:O[0]).trim()}).filter((F)=>/^\w+$/.test(F));t.push(...D)}}}}return[...new Set(t)]}function mg(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function n(i){if(!i.includes(":"))return i;let a=[],u="",l=0,f=0,x=null;for(let v=0;v<i.length;v++){let A=i[v];if(x){if(u+=A,A===x)x=null;continue}if(A==='"'||A==="'"||A==="`"){x=A,u+=A;continue}if(A==="<")l++;else if(A===">"&&l>0)l--;else if(A==="(")f++;else if(A===")")f--;if(A===","&&l===0&&f===0){a.push(u),u="";continue}u+=A}if(u)a.push(u);return a.map((v)=>{let A=v.trim(),D=A.startsWith("..."),F=D?A.slice(3):A,O=-1,z=0;for(let re=0;re<F.length;re++)if(F[re]==="<")z++;else if(F[re]===">")z--;else if(F[re]===":"&&z===0){O=re;break}if(O===-1)return v;let B=F.substring(0,O).trim().replace(/\?$/,""),H=F.substring(O+1),V=-1,M=0;for(let re=0;re<H.length;re++)if(H[re]==="<")M++;else if(H[re]===">")M--;else if(H[re]==="="&&M===0){V=re;break}let Z=D?"...":"";if(V!==-1)return`${Z}${B} = ${H.substring(V+1).trim()}`;return`${Z}${B}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,u)=>{if(!u.includes(":"))return i;return`${a}(${n(u)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,u=[];while((a=i.exec(t))!==null){let l=a.index+a[0].length-1,f=1,x=l+1,v=0,A=null;while(x<t.length&&f>0){let O=t[x];if(A){if(O===A)A=null;x++;continue}if(O==='"'||O==="'"||O==="`"){A=O,x++;continue}if(O==="<")v++;else if(O===">"&&v>0)v--;else if(v===0){if(O==="(")f++;else if(O===")")f--}if(f>0)x++}if(f!==0)continue;let D=t.substring(l+1,x);if(!D.includes(":"))continue;let F=n(D);u.push({start:l+1,end:x,replacement:F})}for(let l=u.length-1;l>=0;l--){let{start:f,end:x,replacement:v}=u[l];t=t.substring(0,f)+v+t.substring(x)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(i,a)=>{if(!a.includes(":"))return i;if(a.includes("{")||a.includes("}"))return i;return`(${a.split(",").map((l)=>{let[f,...x]=l.split("="),v=f.split(":")[0].trim();if(x.length>0)return`${v} = ${x.join("=").trim()}`;return v}).join(", ")}) =>`}),t=t.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),t=t.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),t=t.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),t=t.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),t=t.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),t=t.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),t=t.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),t=t.replace(/\n\s*\n\s*\n/g,`
|
|
694
|
+
|
|
695
|
+
`),t}function hg(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...n)=>{let[,i,a]=n,u=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(u)?"":t})}function yg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function bg(e){if(e instanceof SyntaxError)return!0;let t=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(t)}function wg(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 ra=new Set;async function h(e,t,n,i={}){if(!e.trim())return;let a=T(),u=_(e,JSON.stringify(a)),l=na.get(u);if(l===void 0){try{let ie=te({loader:"ts",target:"browser",define:a}),ae=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ae=ae.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),l=ie.transformSync(ae)}catch{l=mg(e)}na.set(u,l)}let f={exports:{}},x=f.exports,v=Vt.cwd(),A={},D=[...l.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((ie)=>ie[1]).filter((ie)=>!ie.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ie)),F=new Map;for(let ie of D)try{if(ie.startsWith(".")){A[ie]=await import(ut.resolve(ut.dirname(n),ie));continue}let ae=ut.resolve(v,"node_modules",ie),ge=ut.join(ae,"package.json"),$e=JSON.parse(b("fs").readFileSync(ge,"utf8")),Oe=$e.main||"index.js";if($e.exports){let Ne=typeof $e.exports==="string"?$e.exports:$e.exports["."];if(typeof Ne==="string")Oe=Ne;else if(Ne?.bun)Oe=Ne.bun;else if(Ne?.import)Oe=Ne.import;else if(Ne?.default)Oe=Ne.default}A[ie]=await import(ut.resolve(ae,Oe))}catch(ae){if(ie.startsWith("."))F.set(ie,ae instanceof Error?ae.message:String(ae))}let O=(ie)=>{if(A[ie])return A[ie];let ae=F.get(ie);if(ae!==void 0)throw Error(`Cannot require '${ie}' from ${n}: ${ae}`);return b(ie)},z=t.props||{},W=(ie)=>{if(!ie)return z;let ae={};for(let[ge,$e]of Object.entries(ie)){let Oe=z[ge];if(Oe!==void 0)ae[ge]=Oe;else if(typeof $e==="function")ae[ge]=$e();else ae[ge]=$e}return ae};for(let[ie,ae]of Object.entries(z))Object.defineProperty(W,ie,{value:ae,enumerable:!0,configurable:!0,writable:!0});let B=(ie,ae=!1)=>{if(ie===void 0||ie===null)return ae;if(typeof ie==="string"){let ge=ie.trim().toLowerCase();if(ge===""||ge==="true"||ge==="1"||ge==="on"||ge==="yes")return!0;if(ge==="false"||ge==="0"||ge==="off"||ge==="no")return!1;return!0}return Boolean(ie)},H=(ie,ae=0)=>{if(ie===void 0||ie===null)return ae;if(typeof ie==="string"){let $e=ie.trim();if($e==="")return ae;let Oe=Number($e);return Number.isFinite(Oe)?Oe:ae}let ge=Number(ie);return Number.isFinite(ge)?ge:ae};for(let ie of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,ie))continue;try{Object.defineProperty(W,ie,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let V=(ie)=>{if(!ie)return z;let ae={...z};for(let[ge,$e]of Object.entries(ie)){let Oe=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(ae[ge]===void 0&&Oe.default!==void 0)ae[ge]=typeof Oe.default==="function"?Oe.default():Oe.default}return ae},M=()=>t.slots||{},Z=(ie,ae)=>{let ge={...ie};for(let[$e,Oe]of Object.entries(ae))if(ge[$e]===void 0)if(typeof Oe==="function")ge[$e]=Oe();else ge[$e]=Oe;return ge},re=(ie)=>{let ae=()=>ie;return ae.set=(ge)=>{},ae.update=(ge)=>{},ae},se=(ie)=>{let ae,ge=!1;return()=>{if(!ge)try{ae=ie(),ge=!0}catch{ae=void 0}return ae}},fe=(ie)=>{},xe=(ie)=>ie(),pe=(ie)=>{},Pe=(ie)=>{},Ke=Ks(t);function Ae(ie){let ae=ie||{};if(ae.title!==void 0||ae.description!==void 0)nt({title:ae.title,description:ae.description})}function Xe(ie){if(!ie||typeof ie!=="object")return;let ae=t.__stxClientPayload??{};Object.assign(ae,ie),t.__stxClientPayload=ae}let et=()=>{let ie=t.__stxServeContext,ae=t.__stxServeSearch??ie?.search??"",ge=ie?.path??"",$e=Object.fromEntries(new URLSearchParams(ae)),Oe=t.query,Ne=Object.keys($e).length>0?$e:Oe??{},ot=ae||(Object.keys(Ne).length>0?`?${new URLSearchParams(Ne).toString()}`:"");return{params:t.params??{},query:Ne,path:ge,name:"",fullPath:ge+ot,hash:"",matched:[]}},Ye=()=>({push:(ie)=>{},replace:(ie)=>{},back:()=>{},forward:()=>{},go:(ie)=>{}}),it=(ie)=>{let ae=t.__stx_runtime_head||{};t.__stx_runtime_head=Ge(ae,Re(ie||{},{known:ro,source:"useHead()"}))},nt=(ie)=>{it(so(ie||{}))},St=(ie)=>({value:ie}),Ht=(ie)=>ie,br=(ie)=>({value:typeof ie==="function"?ie():ie}),pt=(ie,ae)=>{},Me=(ie)=>{},qt=(ie)=>{},dn=(ie)=>ie?ie():Promise.resolve(),as=(ie)=>(ae,...ge)=>{},Zt=(ie)=>{},st=(ie,ae)=>{},Kt=(ie,ae)=>ae,cs=()=>({value:"light"}),Ct=()=>re(!1),dt=(ie)=>re(!1),Xt=()=>re(!1),gn=()=>dt("(prefers-color-scheme: dark)"),Jt=()=>dt("(prefers-color-scheme: light)"),Gt=()=>dt("(prefers-reduced-motion: reduce)"),yr=()=>dt("(prefers-contrast: more)"),rt={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:{}},Yt=new Proxy(rt,{get(ie,ae){if(ae in ie)return ie[ae];return},set(ie,ae,ge){return ie[ae]=ge,!0}}),ls={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},gt=console;try{let ie=_i(l,n),ae=new Set(Object.keys(z)),ge=Object.keys(t).filter((oe)=>!ae.has(oe)&&!Tu.has(oe)&&Ut(oe)),$e=ge.map((oe)=>t[oe]);if(!ge.includes("__stxServeContext"))ge.push("__stxServeContext"),$e.push(void 0);if(!ae.has("cookies")){let oe=t.cookies??t.__stxServeContext?.cookies??{},le=ge.indexOf("cookies");if(le<0)ge.push("cookies"),$e.push(oe);else $e[le]=oe}let Oe=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ne=[],ot=[];for(let[oe,le]of Object.entries(z)){if(!Ut(oe))continue;if(Oe.has(oe))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${oe}\\b`).test(ie))continue;Ne.push(oe),ot.push(le)}let fs=Iu(ie).map((oe)=>`module.exports.${oe} = typeof ${oe} !== 'undefined' ? ${oe} : module.exports.${oe};`).join(`
|
|
696
|
+
`),mn=t.params??{},Qt=[],en=[];for(let oe=0;oe<ge.length;oe++){if(ge[oe]==="params")continue;Qt.push(ge[oe]),en.push($e[oe])}let hn=[...Sn,...Ne,...Qt],yn=`return (async () => {
|
|
697
|
+
${ie}
|
|
698
|
+
${fs}
|
|
699
|
+
return module.exports
|
|
700
|
+
})()`,mt=_(yn,hn.join("\x00")),yt=sa.get(mt);if(!yt)yt=Function(...hn,yn),sa.set(mt,yt);let ht=t.__stx_options?.runtimeConfig;if(ht||/\buse(?:Server)?RuntimeConfig\b/.test(l))await Tn(t,n,ht);let Ze=await qe(t.__stx_runtime_config??$n()??j(),()=>Mr(t,()=>yt(f,x,O,z,W,B,H,V,Z,Xe,jr,Ii,Zs,re,se,fe,xe,pe,Pe,Ae,et,Ye,it,nt,Ke.setResponseStatus,Ke.setResponseHeader,Ke.notFound,St,Ht,br,pt,Me,qt,dn,as,Zt,M,st,Kt,cs,Ct,dt,Xt,gn,Jt,Gt,yr,Yt,ls,gt,rt.confirm,rt.alert,rt.fetch,mn,...ot,...en)));if(i.preserveExisting){for(let[oe,le]of Object.entries(Ze))if(!(oe in t)||t[oe]===void 0)t[oe]=le}else Object.assign(t,Ze);for(let[oe,le]of Object.entries(z))if(!(oe in t))t[oe]=le}catch(ie){if(t.__stx_strict_hydration)throw ie;let ae=hg(ie instanceof Error?ie.message:String(ie));if(yg(ae))console.warn(`[stx] server <script> in ${n??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ae}`),i.onFailure?.({kind:"module-resolution",message:ae,error:ie});else if(bg(ie))console.warn(`[stx] server <script> in ${n??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ae}`),i.onFailure?.({kind:"syntax",message:ae,error:ie});else if(wg(ae))console.warn(`[stx] server <script> in ${n??"<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: ${ae}`),i.onFailure?.({kind:"missing-binding",message:ae,error:ie});else{let ge=`${n??"<unknown>"}\x00${ae}`;if(Vt.env.STX_DEBUG||!ra.has(ge))ra.add(ge),console.warn(`[stx] server <script> in ${n??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ae}`);i.onFailure?.({kind:"unknown",message:ae,error:ie})}try{await Nu(l,t,n)}catch(ge){if(Vt.env.STX_DEBUG){let $e=ge instanceof Error?ge.message:String(ge);console.warn(`[stx] fallback extraction also failed in ${n??"<unknown>"}: ${$e}`)}}}}function vg(e){let t=0,n=null,i=!1,a=!1;for(let u=0;u<e.length;u++){let l=e[u];if(n){if(l===n){if(n=null,i||t===0)a=!0}continue}if(l==="'"||l==='"'||l==="`"){n=l;continue}if(l==="{")t++;else if(l==="}")t--;else if(e.startsWith("from",u)&&t===0)i=!0}return n===null&&t===0&&a}var Pu=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function _i(e,t){let n=t?ut.dirname(t):Vt.cwd(),i=Vt.cwd(),a=e.split(`
|
|
701
|
+
`),u=[],l=0;while(l<a.length){let f=a[l].trim();if(f.startsWith("interface ")||f.startsWith("export interface ")||f.startsWith("type ")||f.startsWith("export type ")){if(f.includes("{")&&!f.includes("}")){let x=0;for(;l<a.length;l++){for(let v of a[l])if(v==="{")x++;else if(v==="}")x--;if(x<=0)break}}l++;continue}if(f.startsWith("definePageMeta(")){let x=0,v=!1,A=l;for(let O=l;O<a.length&&!v;O++){let z=null,W=!1,B=a[O];for(let H=0;H<B.length;H++){let V=B[H];if(W){W=!1;continue}if(V==="\\"){W=!0;continue}if(z){if(V===z)z=null;continue}if(V==='"'||V==="'"||V==="`"){z=V;continue}if(V==="(")x++;else if(V===")"){if(x--,x===0){l=O+1,v=!0;break}}}}if(!v)l=a.length;let D=a.slice(A,l).join(`
|
|
702
|
+
`),F=[];for(let O of["title","description"]){let z=new RegExp(`\\b${O}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(D);if(z)F.push(`${O}: ${JSON.stringify(z[2])}`)}if(F.length>0)u.push(`useSeoMeta({ ${F.join(", ")} });`);continue}if(f.startsWith("import ")||f==="import"||f.startsWith("import{")||/^import['"]/.test(f)){let x=f,v=0;while(!vg(x)&&l+v+1<a.length)v++,x=`${x} ${a[l+v].trim()}`;l+=v;let A=x.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),D=x.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),F=x.match(/^import\s*['"](.+?)['"]/),O=x,z=(W)=>{if(W.startsWith("."))return ut.resolve(n,W);if(W.startsWith("~/")||W.startsWith("@/"))return ut.resolve(i,W.slice(2));try{return Bun.resolveSync(W,n)}catch{return W}};if(A){let[,W,B]=A,H=z(B);u.push(`const ${W} = (await import('${H}')).default`),u.push(`module.exports.${W} = ${W};`)}else if(D){let[,W,B]=D,H=z(B),V=[],M=[],Z=Au.has(B);for(let re of W.split(",")){let se=re.trim();if(!se)continue;let fe=se.split(/\s+as\s+/);if(fe.length===2){let[xe,pe]=[fe[0].trim(),fe[1].trim()];if(Z&&ta.has(xe)){u.push(`const ${pe} = ${xe};`);continue}V.push(`${xe}: ${pe}`),M.push(pe)}else{if(Z&&ta.has(se))continue;V.push(se),M.push(se)}}if(V.length>0)u.push(`const { ${V.join(", ")} } = await import('${H}')`);for(let re of M)u.push(`module.exports.${re} = ${re};`)}else if(F){let W=z(F[1]);u.push(`await import('${W}')`)}else u.push(O);l++;continue}if(Pu.test(f))u.push(a[l]),l++;else if(f.startsWith("export const ")||f.startsWith("export let ")||f.startsWith("export var ")){let x=oa(a,l),{type:v,name:A,value:D}=x;u.push(`${v} ${A} = ${D};`),u.push(`module.exports.${A} = ${A};`),l=x.nextIndex}else if(f.startsWith("export function ")||f.startsWith("export async function ")){let x=xr(a,l);u.push(x.functionCode),u.push(`module.exports.${x.name} = ${x.name};`),l=x.nextIndex}else if(f.startsWith("const ")||f.startsWith("let ")||f.startsWith("var ")){let x=oa(a,l),{type:v,name:A,value:D}=x;u.push(`${v} ${A} = ${D};`),u.push(`module.exports.${A} = ${A};`),l=x.nextIndex}else if(f.startsWith("function ")||f.startsWith("async function ")){let x=xr(a,l);u.push(x.functionCode),u.push(`module.exports.${x.name} = ${x.name};`),l=x.nextIndex}else if(f.startsWith("export default function ")||f.startsWith("export default async function ")){let x=a[l].replace(/^(\s*)export\s+default\s+/,"$1"),v=[...a];v[l]=x;let A=xr(v,l);if(u.push(A.functionCode),A.name)u.push(`module.exports.default = ${A.name};`);l=A.nextIndex}else if(f.startsWith("export default ")){let x=f.replace(/^export\s+default\s+/,"").replace(/;$/,"");u.push(`module.exports.default = ${x};`),l++}else if(f.startsWith("class ")||f.startsWith("export class ")){let x=f.match(/(?:export\s+)?class\s+(\w+)/);if(x){let v=x[1],A=a[l].replace(/^export\s+/,""),D=0,F=l;for(;F<a.length;F++){let O=a[F];for(let z of O)if(z==="{")D++;else if(z==="}")D--;if(F>l)A+=`
|
|
703
|
+
`+O;if(D<=0&&F>=l)break}u.push(A),u.push(`module.exports.${v} = ${v};`),l=F+1}else u.push(f),l++}else if(f.includes("module.exports"))u.push(f),l++;else if(f.trim()&&!f.startsWith("//"))u.push(f),l++;else l++}return Ou(u.join(`
|
|
704
|
+
`),n,i)}function Ou(e,t,n){let i=e.length,a="",u=0,l=null,f=!1,x=!1,v=0;while(u<i){let A=e[u],D=e[u+1];if(f){if(a+=A,A===`
|
|
705
|
+
`)f=!1;u++;continue}if(x){if(a+=A,A==="*"&&D==="/"){a+=D,u+=2,x=!1;continue}u++;continue}if(!l&&A==="/"&&D==="/"){f=!0,a+=A,u++;continue}if(!l&&A==="/"&&D==="*"){x=!0,a+=A,u++;continue}if(l){if(a+=A,A==="\\"){a+=D,u+=2;continue}if(A===l&&l!=="`"){l=null,u++;continue}if(l==="`"){if(A==="$"&&D==="{"){v++,a+=D,u+=2;continue}if(A==="`"){l=null,u++;continue}}u++;continue}if(v>0){if(A==="{")v++;else if(A==="}")v--}if(A==='"'||A==="'"||A==="`"){l=A,a+=A,u++;continue}if(A==="a"&&e.startsWith("await",u)){let F=Du(e,u);if(F){let{quote:O,path:z,end:W}=F;if(z.startsWith(".")||z.startsWith("~/")||z.startsWith("@/")){let B=z.startsWith(".")?ut.resolve(t,z):ut.resolve(n,z.slice(2));a+=`await import(${O}${B}${O})`,u=W;continue}}}a+=A,u++}return a}function Du(e,t){let n=t+5;if(n>=e.length)return null;if(!/\s/.test(e[n]))return null;while(n<e.length&&/\s/.test(e[n]))n++;if(!e.startsWith("import",n))return null;n+=6;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return null;n++;while(n<e.length&&/\s/.test(e[n]))n++;let i=e[n];if(i!=="'"&&i!=='"')return null;n++;let a=n;while(n<e.length&&e[n]!==i)if(e[n]==="\\")n+=2;else n++;if(n>=e.length)return null;let u=e.slice(a,n);n++;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!==")")return null;return{quote:i,path:u,end:n+1}}function ua(e,t){let n=e[t];if(n!=="{"&&n!=="[")return null;let a=k(e,n,n==="{"?"}":"]",t);if(a===-1)return null;return{pattern:e.slice(t,a+1),endPos:a+1}}function fa(e){let t=[],n=e.slice(1,-1).trim();if(!n)return t;let i=0,a=0,u="";while(i<n.length){let l=n[i];if(l==="{"||l==="["){let f=a===0?ua(n,i):null;if(f){t.push(...fa(f.pattern)),i=f.endPos,u="";continue}a++}else if(l==="}"||l==="]")a--;if(a>0){i++;continue}if(l===","){if(u.trim())t.push(u.trim());u="",i++;continue}if(l===":"){u="",i++;continue}if(l==="="){if(u.trim())t.push(u.trim());u="",i++;while(i<n.length&&n[i]!==","&&a===0){if(n[i]==="{"||n[i]==="[")a++;else if(n[i]==="}"||n[i]==="]")a--;i++}continue}if(/[\w$]/.test(l))u+=l;i++}if(u.trim())t.push(u.trim());return t}function xg(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let n=t[0].length,i=(a)=>a===" "||a==="\t";while(n<e.length&&i(e[n]))n++;if(e[n]===":"){let a=0,u=null;n++;for(;n<e.length;n++){let l=e[n];if(u){if(l==="\\"){n++;continue}if(l===u)u=null;continue}if(l==="'"||l==='"'||l==="`"){u=l;continue}if(l==="("||l==="["||l==="{"||l==="<"){a++;continue}if(l===")"||l==="]"||l==="}"||l===">"){a--;continue}if(l==="="&&a<=0){let f=e[n+1],x=e[n-1];if(f!=="="&&f!==">"&&x!=="="&&x!=="!"&&x!=="<"&&x!==">")break}}if(e[n]!=="=")return null}while(n<e.length&&i(e[n]))n++;if(e[n]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(n+1).trim()}}function ia(e,t,n,i){let a=null,u=!1;for(let l of e){if(u){u=!1;continue}if(l==="\\"){u=!0;continue}if(a){if(l===a)a=null;continue}if(l==="'"||l==='"'||l==="`"){a=l;continue}if(l===t)i++;else if(l===n)i--}return i}function oa(e,t){let n=e[t].trim(),i=xg(n),a=i?[n,i.type,i.name,i.value]:null;if(!a){let A=n.match(/^(?:export\s+)?(const|let|var)\s+/);if(A){let D=n.slice(A[0].length),F=t;if(D.startsWith("{")||D.startsWith("[")){let z=D[0],W=z==="{"?"}":"]",B=ia(D,z,W,0),H=D;for(let V=t+1;V<e.length&&B>0;V++)H+=` ${e[V].trim()}`,F=V,B=ia(e[V],z,W,B);if(B>0)H=D,F=t;D=H}let O=ua(D,0);if(O){let z=A[1],W=O.pattern,B=D.slice(O.endPos).trim();if(B.startsWith("=")){let H=B.slice(1).trim(),V=H,M=Math.max(F,t);if(aa(H)){let fe=ca(e,M,H);V=fe.value,M=fe.nextIndex}else M=M+1;V=V.trim().replace(/;$/,"");let Z=fa(W),re=`__stx_src_${t}`,se=Z.map((fe)=>`module.exports.${fe} = ${fe};`).join(`
|
|
706
|
+
`);return{type:z,name:re,value:`${V}; ${z} ${W} = ${re};
|
|
707
|
+
${se}`,nextIndex:M}}}}throw Error(`Failed to parse variable declaration: ${n}`)}let[,u,l,f]=a,x=f,v=t;if(aa(f)){let A=ca(e,t,f);x=A.value,v=A.nextIndex}else v=t+1;while(v<e.length){let A=e[v].trim();if(A.startsWith(".")||A.startsWith("?."))x+=`
|
|
708
|
+
${e[v]}`,v++;else break}return x=x.trim().replace(/;$/,""),{type:u,name:l,value:x,nextIndex:v}}function xr(e,t){let n=e[t].trim(),i=n.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!i)throw Error(`Failed to parse function declaration: ${n}`);let[,a]=i,u=n.replace(/^export\s+/,""),l=t;if(Mu(n)){let f=ju(e,t,u);u=f.functionCode,l=f.nextIndex}else l=t+1;return{name:a,functionCode:u,nextIndex:l}}function aa(e){let t=e.trim();if(t.startsWith("{"))return k(t,"{","}",0)===-1;if(t.startsWith("["))return k(t,"[","]",0)===-1;return!pa(t)}function pa(e){let t={paren:0,bracket:0,brace:0},n=null,i=0;for(let a=0;a<e.length;a++){let u=e[a];if((a>0?e[a-1]:"")==="\\"&&n)continue;if((u==='"'||u==="'")&&!n){n=u;continue}if(u===n&&n!=="`"){n=null;continue}if(u==="`"&&!n){n="`";continue}if(u==="`"&&n==="`"&&i===0){n=null;continue}if(n==="`"&&u==="$"&&e[a+1]==="{"){i++,a++;continue}if(i>0&&u==="{"){i++;continue}if(i>0&&u==="}"){i--;continue}if(n)continue;if(u==="(")t.paren++;else if(u===")")t.paren--;else if(u==="[")t.bracket++;else if(u==="]")t.bracket--;else if(u==="{")t.brace++;else if(u==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&n===null}function da(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let n=k(e,"(",")",t);if(n===-1)return-1;return e.indexOf("{",n)}function Mu(e){let t=da(e);if(t===-1)return!0;return k(e,"{","}",t)===-1}function ca(e,t,n){let i=n,a=t+1;while(a<e.length&&!pa(i)){let u=e[a];i+=`
|
|
709
|
+
${u}`,a++}while(a<e.length){let u=e[a].trim();if(u.startsWith(".")||u.startsWith("?."))i+=`
|
|
710
|
+
${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function ju(e,t,n){let i=n,a=t+1;while(a<e.length){let u=da(i);if(u!==-1){if(k(i,"{","}",u)!==-1)break}let l=e[a];i+=`
|
|
711
|
+
${l}`,a++}return{functionCode:i,nextIndex:a}}function la(e,t){let n=d(e,t)??d(`(${e})`,t);if(n!==void 0)return n;if(!/\bprocess\b/.test(e))return;let i={...t,process:Object.freeze({env:{...Vt.env}})},a=Object.keys(i).filter(Ut),u=a.map((l)=>i[l]);try{return Function(...a,`'use strict'; return (${e});`)(...u)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...u)}catch{return}}}async function Nu(e,t,n){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let u of i){let[,,l,f]=u;try{let x=f.trim().replace(/;$/,""),v=la(x,t);if(v!==void 0)t[l]=v}catch(x){console.warn(`Failed to parse export ${l} in fallback:`,x)}}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 u of a){let[,,l,f]=u;if(!(l in t))try{let x=f.trim().replace(/;$/,""),v=la(x,t);if(v!==void 0)t[l]=v}catch{}}}function ol(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),n=t?t[1]:"",i=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:n,templateWithoutScript:i}}function il(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
|
|
712
|
+
export{De,Ce,q,js,Bs,K,_r,Fs,zs,fi,gi,mi,Hs,hi,Hc,Mt,Le,o,ue,S,Vc,_,Cr,Vs,Ee,T,je,he,Dt,Lt,X,bn,Be,w,Uc,ye,Q,Er,Tr,$r,de,jt,ee,L,ct,Rr,Ar,lt,yi,Us,gg,Fe,Wc,qc,bi,Kc,wi,Gc,Ws,vi,Xc,Jc,xi,Si,wn,qs,vn,Bt,Ft,Yc,Ks,Zc,Qc,xn,Pr,Gs,Xs,el,ki,tl,nl,rl,sl,Sn,mg,hg,yg,bg,wg,h,vg,_i,xg,ol,il,Ci,Ei,Sg,zt,al,kg,cl,fy,ze,kn,He,_g,Cg,Eg,Tg,$g,Js,Rg,Ve,te,Ue,Ag,Ir,Pg,ll,ul,Ti,We,s,_n,dl,y,be,gy,pl,fl,gl,$i,Ys,Ig,my,Og,hy,Cn,g,G,ne,En,Te,Ng,Ri,Mg,yy,R,Ai,Dg,by,I,wy};
|