@stacksjs/stx 0.2.859 → 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-wjamjgx6.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-4yfbd8ny.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-ews9yzr7.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-v9h7s8ce.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-wfd9e224.js → chunk-4xanjv22.js} +125 -126
- package/dist/chunk-4ykgjewy.js +16 -0
- package/dist/{chunk-ftwdjgzd.js → chunk-55zq2ha8.js} +5 -5
- package/dist/{chunk-9a3rv0rj.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-k8pzk8v9.js → chunk-669b2bya.js} +4 -4
- package/dist/{chunk-ktnb1j54.js → chunk-67dgp45w.js} +2 -2
- package/dist/chunk-6fstz73t.js +2 -0
- package/dist/{chunk-gndxakrh.js → chunk-6ftee542.js} +2 -2
- package/dist/{chunk-5wr1qqz3.js → chunk-6k4ac74t.js} +2 -2
- package/dist/{chunk-astcp7bc.js → chunk-6m63rc7m.js} +8 -8
- package/dist/{chunk-q3cyycnh.js → chunk-6m6y9bbx.js} +1 -1
- package/dist/chunk-6pczzq5f.js +2 -0
- package/dist/{chunk-6t0xy3wk.js → chunk-7ayvybdy.js} +3 -3
- package/dist/chunk-7mjf144y.js +2 -0
- package/dist/{chunk-9qe4qsc7.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-6e44f8w8.js → chunk-8502xb4n.js} +39 -39
- package/dist/{chunk-ywk6t76q.js → chunk-85j9qh7v.js} +45 -46
- package/dist/{chunk-cxpq2zna.js → chunk-8arfg8kp.js} +3 -3
- package/dist/{chunk-33x46g87.js → chunk-8hhhmscy.js} +2 -2
- package/dist/{chunk-x9c4njvx.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-2w7csg0c.js → chunk-9y9jecky.js} +1 -1
- package/dist/{chunk-mzes9ds7.js → chunk-9zrvh3pz.js} +2 -2
- package/dist/{chunk-hf9pvmq2.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-ts4t2n6b.js → chunk-bx5d87xx.js} +6 -7
- package/dist/chunk-bz6dg4k8.js +3 -0
- package/dist/chunk-c34qn4k8.js +16 -0
- package/dist/{chunk-0es47pwe.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-3w3fxcyx.js → chunk-dpmayc2w.js} +2 -2
- package/dist/{chunk-6mza6zr3.js → chunk-dtarm8x9.js} +9 -9
- package/dist/chunk-dydy9zrq.js +3 -0
- package/dist/chunk-eafqxbr0.js +2 -0
- package/dist/{chunk-52b6czss.js → chunk-eeq8k81z.js} +155 -157
- package/dist/{chunk-26jt4jvh.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-3248qphb.js → chunk-fnxg6134.js} +10 -10
- package/dist/chunk-g075cc67.js +2 -0
- package/dist/{chunk-618t6hxp.js → chunk-g5xth2yx.js} +6 -6
- package/dist/{chunk-xpg52hsz.js → chunk-gbtbfg7e.js} +3 -3
- package/dist/{chunk-xytq7q8j.js → chunk-gd56arnm.js} +2 -2
- package/dist/chunk-gmm3kffd.js +2 -0
- package/dist/{chunk-dbm963p9.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-yd6ej23e.js → chunk-hev4t4d5.js} +6 -6
- package/dist/chunk-hf5fj7pr.js +2 -0
- package/dist/{chunk-cj9rev2p.js → chunk-hmdkf6c6.js} +2 -2
- package/dist/chunk-hsp9h3jn.js +2 -0
- package/dist/{chunk-p9jfn4yh.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-4a0x737h.js → chunk-kbdz4762.js} +8 -8
- package/dist/chunk-kw11yydy.js +2 -0
- package/dist/{chunk-v4rrgphj.js → chunk-kwk3kxrx.js} +3 -3
- package/dist/chunk-kyer53x3.js +2 -0
- package/dist/chunk-m9cperj4.js +2 -0
- package/dist/{chunk-fxxh149b.js → chunk-mcnwvh06.js} +6 -6
- package/dist/chunk-meqsd5bt.js +2 -0
- package/dist/{chunk-s4592dy0.js → chunk-mfa07erx.js} +16 -16
- package/dist/chunk-mj4wbrw7.js +2 -0
- package/dist/{chunk-0yw86e75.js → chunk-mjy98ppb.js} +9 -9
- package/dist/{chunk-jh2v1vvb.js → chunk-mrh08821.js} +3 -3
- package/dist/{chunk-gq9h36jf.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-m1qqqc2j.js → chunk-qbghf76y.js} +4 -4
- package/dist/{chunk-a9c3gndq.js → chunk-qcxrcypb.js} +2 -2
- package/dist/{chunk-fkh4xece.js → chunk-qjey0jk6.js} +2 -2
- package/dist/chunk-rqa92xm4.js +2 -0
- package/dist/chunk-rvhrtnv3.js +12 -0
- package/dist/{chunk-7m17m22p.js → chunk-s0sad753.js} +2 -2
- package/dist/chunk-s92j8k4z.js +2 -0
- package/dist/chunk-s9df8srx.js +6 -0
- package/dist/{chunk-rgjjt1mb.js → chunk-sb8n32rn.js} +1 -1
- package/dist/chunk-snz2cxqv.js +2 -0
- package/dist/{chunk-14h4n1sj.js → chunk-srgnevws.js} +2 -2
- package/dist/chunk-srgpz94e.js +42 -0
- package/dist/{chunk-2sq9pdg3.js → chunk-tnp2ta5q.js} +2 -2
- package/dist/{chunk-5t1k0dxm.js → chunk-v37zmez0.js} +2 -2
- package/dist/chunk-v408qsze.js +2 -0
- package/dist/{chunk-qgxwf9xr.js → chunk-v4xes880.js} +3 -3
- package/dist/chunk-vfx1p83g.js +33 -0
- package/dist/chunk-vk98r75z.js +2 -0
- package/dist/{chunk-ypgegzh2.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-g17q4y5k.js → chunk-x512h2gv.js} +4 -4
- package/dist/{chunk-shke1fcm.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-wdcz6d20.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-49j3cn9h.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-yehdcjn1.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 -0
- package/dist/index.js +1 -0
- 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 +2 -6
- package/dist/runtime-injection.js +6 -6
- package/dist/serve.js +2 -6
- package/dist/site-builder/build.js +2 -2
- package/dist/site-builder/i18n.js +2 -2
- package/dist/site-builder/router.js +2 -5
- package/dist/site-builder/theme.js +2 -2
- 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/chunk-13fe3avf.js +0 -2
- package/dist/chunk-1hebvmaj.js +0 -2
- package/dist/chunk-1p47cg0g.js +0 -2
- package/dist/chunk-1v95w26e.js +0 -20
- package/dist/chunk-1z46g29d.js +0 -2
- package/dist/chunk-228cbw2p.js +0 -2
- package/dist/chunk-2bggrzv0.js +0 -2
- package/dist/chunk-2dnd2s2a.js +0 -3
- package/dist/chunk-2kc0vsnb.js +0 -54
- package/dist/chunk-34rh88vd.js +0 -2
- package/dist/chunk-3cqp0m62.js +0 -2
- package/dist/chunk-3dtzcc9j.js +0 -2
- package/dist/chunk-3rgqrs3c.js +0 -2
- package/dist/chunk-403a4pqm.js +0 -25
- package/dist/chunk-51kb36f7.js +0 -2
- package/dist/chunk-53ezn1tw.js +0 -2
- package/dist/chunk-5va6c7jf.js +0 -14
- package/dist/chunk-636j1nmd.js +0 -2
- package/dist/chunk-6w5a5ns4.js +0 -18
- package/dist/chunk-756rpwn0.js +0 -2
- package/dist/chunk-7pq02v7n.js +0 -2
- package/dist/chunk-7sht1rkv.js +0 -2
- package/dist/chunk-7trdtz0c.js +0 -3
- package/dist/chunk-7ycmnsh5.js +0 -2
- package/dist/chunk-8mdhencj.js +0 -42
- package/dist/chunk-9nh48zvm.js +0 -72
- package/dist/chunk-9rgp005c.js +0 -2
- package/dist/chunk-9xr628ew.js +0 -3
- package/dist/chunk-aq8r4rbs.js +0 -3
- package/dist/chunk-azvx5gaa.js +0 -2
- package/dist/chunk-b1kc0ka1.js +0 -712
- package/dist/chunk-ebk1723c.js +0 -2
- package/dist/chunk-emc7zqry.js +0 -2
- package/dist/chunk-eppv6knk.js +0 -2
- package/dist/chunk-f18rxz70.js +0 -2
- package/dist/chunk-f935fec7.js +0 -2
- package/dist/chunk-g0v1shhr.js +0 -2
- package/dist/chunk-g5pg0pg1.js +0 -2
- package/dist/chunk-g8x32bq2.js +0 -2
- package/dist/chunk-g978f9qg.js +0 -18
- package/dist/chunk-hk7vjyqa.js +0 -2
- package/dist/chunk-jd4dr23j.js +0 -3
- package/dist/chunk-jhm1228j.js +0 -4
- package/dist/chunk-jmaw2cdt.js +0 -2
- package/dist/chunk-jw75rmpw.js +0 -2
- package/dist/chunk-kgrvvtcy.js +0 -3
- package/dist/chunk-kpsxhm4x.js +0 -33
- package/dist/chunk-kvc9cwvx.js +0 -12
- package/dist/chunk-m3fq72f8.js +0 -2
- package/dist/chunk-n54twtm7.js +0 -2
- package/dist/chunk-np6y9evb.js +0 -2
- package/dist/chunk-p95fsnbk.js +0 -2
- package/dist/chunk-pk0mxjxw.js +0 -2
- package/dist/chunk-q87hkwfg.js +0 -3
- package/dist/chunk-q9r13taa.js +0 -2
- package/dist/chunk-qd87dk1d.js +0 -1329
- package/dist/chunk-qe6631me.js +0 -2
- package/dist/chunk-qqjhq0hb.js +0 -2
- package/dist/chunk-qsjkewah.js +0 -2
- package/dist/chunk-qttq8cje.js +0 -2
- package/dist/chunk-qw80eta1.js +0 -2
- package/dist/chunk-r51bfc2y.js +0 -2
- package/dist/chunk-rbrvepr3.js +0 -2
- package/dist/chunk-rwxg4m3h.js +0 -3
- package/dist/chunk-se4ny3q0.js +0 -2
- package/dist/chunk-shy2hkvj.js +0 -2
- package/dist/chunk-sxvv9w8t.js +0 -2
- package/dist/chunk-sy703233.js +0 -2
- package/dist/chunk-syzn6mq5.js +0 -2
- package/dist/chunk-t2nhr2tc.js +0 -2
- package/dist/chunk-tc31my2p.js +0 -20
- package/dist/chunk-v3r1wwec.js +0 -2
- package/dist/chunk-vd5d1yb9.js +0 -2
- package/dist/chunk-vj1bwnvs.js +0 -4
- package/dist/chunk-vmdsj8r5.js +0 -2
- package/dist/chunk-vmg3f76h.js +0 -2
- package/dist/chunk-w1d8t47c.js +0 -33
- package/dist/chunk-w1stsxm3.js +0 -3
- package/dist/chunk-w63c96ce.js +0 -2
- package/dist/chunk-wcgca1q6.js +0 -2
- package/dist/chunk-wv8qmwqp.js +0 -2
- package/dist/chunk-x90f7h2g.js +0 -2
- package/dist/chunk-xhnpgey5.js +0 -2
- package/dist/chunk-y54pj23g.js +0 -2
- package/dist/chunk-yhrkqcqd.js +0 -2
- package/dist/chunk-ykxpzjgy.js +0 -2
- package/dist/chunk-zhyrhxdp.js +0 -2
- package/dist/chunk-zn5tewws.js +0 -2
- package/dist/chunk-zvra3bmk.js +0 -2
package/dist/chunk-b1kc0ka1.js
DELETED
|
@@ -1,712 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ve,Cn,Xs,Ri,M}from"./chunk-5rxks14t.js";import{_n}from"./chunk-wjamjgx6.js";import{Lr,k,vl,ut,Li,xl}from"./chunk-fkh4xece.js";import{I}from"./chunk-xppm4cs4.js";import{R,_,Js,u,f,zt,d,K,z,x,eo,Ee,We,to}from"./chunk-9nh48zvm.js";import{r,he}from"./chunk-shke1fcm.js";import{h}from"./chunk-kgrvvtcy.js";import{G}from"./chunk-9xr628ew.js";import lt from"path";import Vt from"process";import{AsyncLocalStorage as ga}from"async_hooks";var Or=new ga;function bn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Dr(e,t){return Or.run(bn(e),t)}async function Mr(e,t){let n=Or.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((l)=>{let c=JSON.stringify(l,(v,T)=>{if(T===void 0||typeof T==="function"||typeof T==="symbol"||typeof T==="bigint"||typeof T==="number"&&!Number.isFinite(T))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(T&&typeof T==="object"&&!Array.isArray(T)&&Object.getPrototypeOf(T)!==Object.prototype&&Object.getPrototypeOf(T)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return T}),b=JSON.parse(c);return n.values.set(e,b),b}).catch((l)=>{throw n.pending.delete(e),l});return n.pending.set(e,a),a}function $r(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let n=r(e),i=[],a=new Set,l=0,c=0,b=n.length,v=()=>{if(l!==0)return;let T=n.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(T){if(t&&T[1]==="const")return;let L=T[2];if(!a.has(L))i.push(L),a.add(L);return}let P=n.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){if(t&&n.slice(c).startsWith("const"))return;P[1].split(",").forEach((L)=>{let F=L.trim();if(!F)return;let B=F.indexOf(":"),X=(B>=0?F.slice(B+1).trim():F).split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}let D=n.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(t&&n.slice(c).startsWith("const"))return;D[1].split(",").forEach((L)=>{let F=L.trim().replace(/^\.\.\./,"");if(!F)return;let B=F.split(/[\s=]/)[0];if(B&&!a.has(B))i.push(B),a.add(B)});return}if(t)return;let H=n.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let L=H[1];if(!a.has(L))i.push(L),a.add(L);return}let O=n.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!a.has(L))i.push(L),a.add(L)}};while(c<b){if(n[c]==="{"){l++,c++;continue}if(n[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(n[c])&&(c===0||/\s|[;{}()]/.test(n[c-1])))v();c++}return i.join(", ")}function Ms(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ma(e,t=V(e).split(",").map((n)=>n.trim()).filter(Boolean)){let n=new Set(V(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 Ds(e,t){let n=`{ ${ma(e,t)} }`;return V(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${n}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:n}import Bt from"fs";import Ce from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var jr=new Map;function xr(e,t=!0){let n=jr.get(e);if(t&&n)return n;let i=new Map,a=[Ce.join(e,"src"),Ce.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=Bt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let T of v){let P=Ce.join(c,T.name);if(T.isDirectory()){if(T.name==="node_modules"||T.name.startsWith("."))continue;l(P,b+1)}else if(T.isFile()&&T.name.endsWith(".stx")){let D=T.name.slice(0,-4);if(!i.has(D))i.set(D,P);let H=D.toLowerCase();if(!i.has(H))i.set(H,P);let O=U(D);if(!i.has(O))i.set(O,P)}}}for(let c of a)if(l(c,0),i.size>0)break;if(t)jr.set(e,i);return i}function Ls(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let n=t;while(!0){let i=Ce.join(n,"node_modules",e);try{if(Bt.statSync(i).isDirectory())return i}catch{}let a=Ce.dirname(n);if(a===n)return null;n=a}}function js(e,t,n={}){return[Ce.resolve(Ce.dirname(t),`${e}.stx`),Ce.resolve(Ce.dirname(t),e),Ce.resolve(n.componentsDir||"components",`${e}.stx`),Ce.resolve(n.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Nr(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=U(t);return[t,n,i]}function ui(e,t){let[n,i,a]=Nr(e);for(let l of[n,n.toLowerCase(),i,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function di(e,t){let n=t?Ce.resolve(t):void 0,i=Ce.dirname(Ce.resolve(e));for(;;){if(Bt.existsSync(Ce.join(i,"package.json")))return n&&i===n?void 0:i;let a=Ce.dirname(i);if(a===i)return;i=a}}var ha=["src/ui","src/components","components","dist"];function Ln(e,t){let n=Ce.resolve(e);if(!t&&!n.split(Ce.sep).includes("node_modules"))return[];let i=di(n,t);if(!i)return[];let a=[];try{let b=JSON.parse(Bt.readFileSync(Ce.join(i,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:ha;return[Ce.dirname(Ce.resolve(e)),...l.map((c)=>Ce.resolve(i,c))]}function*pi(e,t,n={},i){let a=Nr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ce.resolve(Ce.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=n.projectRoot||process.cwd(),b=[...Ln(t,n.projectRoot),...i?.__originalFilePath?[Ce.join(Ce.dirname(i.__originalFilePath),"components")]:[],...n.componentsDir?[n.componentsDir]:[],Ce.join(Ce.dirname(t),"components"),Ce.resolve(c,"src/components"),Ce.resolve(c,"components"),...import.meta.dir?[Ce.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let T of l)yield Ce.join(v,T);try{for(let T of Bt.readdirSync(v,{withFileTypes:!0}))if(T.isDirectory())for(let P of l)yield Ce.join(v,T.name,P)}catch{}}}function zr(e,t,n={},i){let a=ui(e,i);if(a!==void 0)return a;for(let l of pi(e,t,n,i))try{if(Bt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Bs(e,t=[],n={}){let i=new Set([...e].map((T)=>T.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(([T,P])=>[T.replace(/[-_]/g,"").toLowerCase(),P])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((T)=>i.has(T)))return!1;if([...t].some((T)=>!["load","error"].includes(T.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((T)=>i.has(T))}import rs from"fs";import le from"path";import vt from"path";import nn from"fs";var xa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function bs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return xa.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"},ba=new Set(["ctrl","alt","shift","meta"]),Ur={left:0,middle:1,right:2};function Fr(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(ba.has(i))t.systemKeys.push(i);else if(i in Ur)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 Hr(e,t=""){let n=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,T=l.index,P=T+c.length,D=`__stx_evt_${t}${i++}`,H=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,L;while((L=O.exec(v))!==null){let[,B,ee]=L,X=B.split("."),j=X[0];if(!Br.has(j))continue;H.push({attribute:`@${B}`,event:j,handler:ee,modifiers:Fr(X.slice(1)),elementId:D})}let F=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((L=F.exec(v))!==null){let[,B,ee]=L,X=B.split("."),j=X[0];if(!Br.has(j))continue;H.push({attribute:`@${B}`,event:j,handler:ee,modifiers:Fr(X.slice(1)),elementId:D})}if(H.length>0)n.push({originalTag:c,elementId:D,events:H,startIndex:T,endIndex:P})}return n}function ya(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=Ur[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 _a(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 ys(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 wa(e){let{modifiers:t}=e,n=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=ya(e),a=_a(ys(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(bs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=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('${b}', null, $el);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
__stx_runHandler('${b}', 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('${b}', null, $el);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
__stx_runHandler('${b}', 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('${b}', $event, $el);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
// Fallback for non-reactive context (entity-safe; decoded + run in memory)
|
|
53
|
-
__stx_runHandler('${b}', $event, $el);
|
|
54
|
-
}
|
|
55
|
-
}${c});
|
|
56
|
-
})();`}function fi(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(wa).join(`
|
|
112
|
-
`)}
|
|
113
|
-
})();
|
|
114
|
-
</script>`}function Sa(e,t=""){let n=Hr(e,t);if(n.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=n.length-1;l>=0;l--){let c=n[l],b=c.originalTag;if(!b.includes(" id="))b=b.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=b.match(/id=["']([^"']+)["']/);if(v)for(let T of c.events)T.elementId=v[1]}for(let v of c.events){let T=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),P=new RegExp(`\\s*${T}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${T}\\s*=\\s*'[^']*'`,"g");b=b.replace(P,""),b=b.replace(D,"")}i=i.slice(0,c.startIndex)+b+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Vr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function jc(e,t,n){if(xl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:b,bindings:v}=Sa(e,Vr(t)),T=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...T,...v],b}let i=Hr(e,Vr(t));if(i.length===0)return e;let a=e;for(let b=i.length-1;b>=0;b--){let v=i[b],T=v.originalTag;if(!T.includes(" id="))T=T.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let P=T.match(/id=["']([^"']+)["']/);if(P)for(let D of v.events)D.elementId=P[1]}for(let P of v.events){let D=P.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");T=T.replace(H,""),T=T.replace(O,"")}a=a.slice(0,v.startIndex)+T+a.slice(v.endIndex)}let l=fi(i.flatMap((b)=>b.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
|
|
115
|
-
`+a.slice(c);else a+=l;return a}function qr(e,t){let n=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))n.add(a)}return n}function It(e,t){let n=r(e),{depths:i,balanced:a}=he(n),l=(b)=>!a||i[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of n.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of n.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&qr(b[1],!0).has(t))return!0;for(let b of n.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&qr(b[1],!1).has(t))return!0;return!1}var Zr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),_t=/^[A-Za-z_$][\w$]*$/,$a=new Set(["if","for","while","switch","with"]),Kr=["(","[","{"],Xr=[")","]","}"],va=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Ea(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 _s(e){let t=Zr.get(e);if(t)return t;let{code:n,tokens:i}=Ea(e),a=new Map,l=[];for(let B=0;B<i.length;B++){let ee=i[B].text;if(["(","[","{"].includes(ee))l.push(B);else if([")","]","}"].includes(ee)){let X=l.at(-1);if(X!==void 0&&["()","[]","{}"].includes(i[X].text+ee))l.pop(),a.set(X,B),a.set(B,X)}}function c(B,ee){let X=[],j=B;for(let te=B;te<ee;te++){if(["(","[","{"].includes(i[te].text)&&(a.get(te)??ee)<ee){te=a.get(te);continue}if(i[te].text===",")X.push([j,te]),j=te+1}return X.push([j,ee]),X}let b=[];function v(B,ee,X,j=!1){if(i[B]?.text==="...")B++;if(B>=ee)return;let te=i[B].text;if(_t.test(te)){if(X.add(te),X===D)b.push({name:te,token:B,functionScoped:j});return}if(te!=="{"&&te!=="[")return;let se=a.get(B);if(se===void 0||se>=ee)return;for(let[ne,pe]of c(B+1,se)){let ye=ne;if(te==="{")for(let de=ne;de<pe;de++){if(i[de].text===":"){ye=de+1;break}if(i[de].text==="=")break;if(["(","[","{"].includes(i[de].text)&&a.has(de))de=a.get(de)}v(ye,pe,X,j)}}function T(B,ee){let X=new Set;for(let[j,te]of c(B,ee))v(j,te,X);return X}function P(B){let ee=B;for(;ee<i.length;ee++){let X=i[ee].text;if(["(","[","{"].includes(X)&&a.has(ee)){ee=a.get(ee);continue}if([",",";",")","]","}"].includes(X))break}return i[Math.max(B,ee-1)]?.end??n.length}let D=new Set,H=[];for(let B=0;B<i.length;B++)if(i[B].text==="=>"){let ee=B-1,X=ee,j;if(i[ee]?.text===")"&&a.has(ee))X=a.get(ee),j=T(X+1,ee);else if(i[ee]&&_t.test(i[ee].text))j=new Set([i[ee].text]);else continue;let te=B+1,se=i[te]?.text==="{"&&a.has(te)?i[a.get(te)].end:P(te);H.push({start:i[X].start,end:se,bodyStart:i[te]?.start??se,functionBody:!0,names:j})}else if(i[B].text==="("&&a.has(B)){let ee=i[B-1]?.text;if(!ee||$a.has(ee)||!_t.test(ee)&&ee!=="*"&&ee!=="]")continue;let X=a.get(B),j=X+1;if(i[j]?.text===":"){j++;while(j<i.length&&!["{","=>",";","="].includes(i[j].text))j++}if(i[j]?.text!=="{"||!a.has(j))continue;H.push({start:i[B].start,end:i[a.get(j)].end,bodyStart:i[j].start,functionBody:ee!=="catch",names:T(B+1,X)})}function O(B){let ee=B;for(;ee<i.length;ee++){let X=i[ee].text;if(Kr.includes(X)&&a.has(ee)){ee=a.get(ee);continue}if(X===";"||Xr.includes(X))break;let j=i[ee-1];if(ee>B&&va.has(X)&&j.text!==".")break;if(ee>B&&/[\n\r]/.test(n.slice(j.end,i[ee].start))&&(/^[\w$]+$/.test(j.text)||Xr.includes(j.text)||['"',"'","`"].includes(j.text))&&_t.test(X)&&!["in","of","instanceof"].includes(X))break}return ee}let L=[];for(let B=0;B<i.length;B++){if(i[B].text!=="for")continue;let ee=i[B+1]?.text==="await"?B+2:B+1;if(i[ee]?.text!=="("||!a.has(ee))continue;let X=a.get(ee),j=X+1,te=i[j]?.text==="{"&&a.has(j)?a.get(j):O(j),se=i[te]?.text===";"||i[te]?.text==="}"?i[te].end:i[Math.max(j,te-1)]?.end??n.length;L.push({headStart:ee,headEnd:X,start:i[ee].start,end:se})}for(let B=0;B<i.length;B++){let ee=i[B].text,X=i[B-1]?.text;if(X==="."||i[B+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(ee==="const"||ee==="let"||ee==="var"){let j=O(B+1),te=B+1,se=!1,ne=!1,pe=0;for(let ye=B+1;ye<=j;ye++){let de=i[ye]?.text;if(ye<j&&Kr.includes(de)&&a.has(ye)&&a.get(ye)<j){ye=a.get(ye);continue}if(ye<j&&de===":"&&!ne)se=!0;else if(ye<j&&de==="="&&pe===0)se=!1,ne=!0;else if(ye<j&&se&&de==="<")pe++;else if(ye<j&&se&&de===">"&&pe>0)pe--;else if(ye===j||de===","&&pe===0)v(te,ye,D,ee==="var"),te=ye+1,se=!1,ne=!1}}else if(ee==="function"||ee==="class"){let j=B+1;if(i[j]?.text==="*")j++;if(i[j]&&_t.test(i[j].text)&&i[j].text!=="extends")D.add(i[j].text),b.push({name:i[j].text,token:j})}else if(ee==="import"){let j=B+1;if(i[j]?.text==="*"&&i[j+1]?.text==="as")j+=2;let te=i[j]?.text;if(te&&_t.test(te)&&te!=="type"&&i[j+1]?.text!=="("&&i[j+1]?.text!==".")D.add(te),b.push({name:te,token:j,file:!0});let se=i[j]?.text==="{"?j:i[j+1]?.text===","&&i[j+2]?.text==="{"?j+2:-1;if(se!==-1&&a.has(se)){let ne=a.get(se);for(let[pe,ye]of c(se+1,ne)){let de=ye-1;while(de>=pe&&!_t.test(i[de].text))de--;if(de>=pe&&i[de].text!=="type")b.push({name:i[de].text,token:de,file:!0})}}}}let F={code:n,scopes:H,loops:L,declarations:D,sites:b,tokens:i,pairs:a};return Zr.set(e,F),F}function tn(e){let t=_s(e);return{code:t.code,shadows:(n,i)=>t.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(n))}}function zn(e){return new Set(_s(e).declarations)}function Ne(e,t){let{scopes:n,loops:i,sites:a,tokens:l,pairs:c}=_s(e),b=Array.from({length:l.length},()=>-1),v=[];for(let O=0;O<l.length;O++){b[O]=v.length?v[v.length-1]:-1;let L=l[O].text;if(L==="{"&&c.has(O))v.push(O);else if(L==="}"&&v.length&&c.get(O)===v[v.length-1])v.pop()}let T=new Set,P=new Map;for(let O of a){if(!t.has(O.name))continue;T.add(O.token);let L=O.file?-1:b[O.token],F=L===-1?[0,Number.POSITIVE_INFINITY]:[l[L].start,l[c.get(L)].end];if(O.functionScoped){let ee=l[O.token].start,X=n.filter((j)=>j.functionBody&&ee>=j.bodyStart&&ee<j.end).sort((j,te)=>j.end-j.bodyStart-(te.end-te.bodyStart))[0];F=X?[X.bodyStart,X.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let ee=i.filter((X)=>O.token>X.headStart&&O.token<X.headEnd).sort((X,j)=>X.headEnd-X.headStart-(j.headEnd-j.headStart))[0];if(ee)F=[ee.start,ee.end]}let B=P.get(O.name);if(B)B.push(F);else P.set(O.name,[F])}let D=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let L=O+1;if(l[L]?.text==="type")L++;if(l[L]&&_t.test(l[L].text)&&l[L+1]?.text===",")L+=2;if(l[L]?.text==="{"&&c.has(L))for(let F=L+1;F<c.get(L);F++)D.add(F)}let H=new Set;for(let O=0;O<l.length;O++){let L=l[O].text;if(!t.has(L)||H.has(L)||T.has(O)||D.has(O))continue;let F=l[O-1]?.text;if(F==="#"||F==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(F==="{"||F===","))continue;let B=l[O].start;if(P.get(L)?.some(([ee,X])=>B>=ee&&B<X))continue;if(n.some((ee)=>B>=ee.start&&B<ee.end&&ee.names.has(L)))continue;H.add(L)}return H}var Oe="0.2.859";var Jr=Symbol.for(`stx.lazy-module-promises.${Oe}`);function Ca(){let e=globalThis;return e[Jr]??=new Map,e[Jr]}function o(e,t){let n=Ca(),i=`${import.meta.url}\x00${e}`,a=n.get(i);if(a)return a;let l=t();return n.set(i,l),l.catch(()=>{if(n.get(i)===l)n.delete(i)}),l}var Ra=/<\/(script)/gi;function ae(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Ra,"<\\/$1")}import Gr from"fs";var Yr=[];function w(e){let t=new R(e);return Yr.push(t),t}function Bc(){for(let e of Yr)e.clear()}function S(e,...t){return`${t.map((n)=>String(n??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function Sr(e){let t=[];for(let n of new Set(e))try{t.push({path:n,mtimeMs:Gr.statSync(n).mtimeMs})}catch{}return t}function Fs(e){for(let t of e)try{if(Gr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var ke=["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 Ta=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Aa(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 Ia(e,t){let n=t;while(!0){let i=vt.join(n,"node_modules",e,"package.json");if(nn.existsSync(i))return vt.dirname(i);let a=vt.dirname(n);if(a===n)return null;n=a}}function Pa(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 l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!i||c.length>i.prefix.length)i={pattern:a,prefix:c,suffix:b}}if(i){let a=t.slice(i.prefix.length,t.length-i.suffix.length),l=n(e[i.pattern]);if(l)return l.replace("*",a)}return null}function Oa(e,t){let n=Aa(e);if(!n||!n.subpath)return null;let i=Ia(n.pkg,t);if(!i)return null;let a;try{a=JSON.parse(nn.readFileSync(vt.join(i,"package.json"),"utf8"))}catch{return null}let l=`.${n.subpath}`,c=Pa(a.exports,l);if(!c)return null;let b=vt.resolve(i,c);return nn.existsSync(b)?b:null}function Si(e,t){let n=t.filePath?vt.dirname(t.filePath):t.projectRoot||process.cwd(),i=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(Ta,(v,T)=>{let P;try{if(T.startsWith("./")||T.startsWith("../")||T.startsWith("/")){if(P=T.startsWith("/")?T:vt.resolve(n,T),!nn.existsSync(P))throw Error(`file not found: ${P}`)}else{let D=null;try{D=Bun.resolveSync(T,i)}catch{D=Oa(T,i)}if(!D)throw Error(`could not resolve ${T} (Bun.resolveSync + exports fallback both failed)`);P=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(T)} (from ${t.filePath||"<unknown>"}): ${D?.message||D}`),c.push(T),""}if(a.has(P))return"";a.add(P);try{let D=nn.readFileSync(P,"utf8");l.push({source:T,resolvedPath:P,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${P}: ${D?.message||D}`),c.push(T)}return""}),styles:l,unresolved:c}}function Da(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ki(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Da(t.source)}" data-stx-layer="vendor">
|
|
116
|
-
@layer vendor {
|
|
117
|
-
${t.contents}
|
|
118
|
-
}
|
|
119
|
-
</style>`).join(`
|
|
120
|
-
`)}
|
|
121
|
-
`}var bg=k,Qr=w(256);function jt(e){let t=S(e),n=Qr.get(t);if(!n)n=Ma(e),Qr.set(t,n);return{code:n.code,imports:[...n.imports],models:[...n.models]}}function Ma(e){let t=r(e),n=new Set;for(let b of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let v of b[1].split(",")){let T=v.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(T)n.add(T)}let i=zn(t),a=ke.filter((b)=>{if(n.has(b)||i.has(b))return!1;return wg(t,b,!0)}),l=si(t).filter((b)=>!n.has(b)&&!i.has(b));if(a.length===0&&l.length===0)return{code:e,imports:a,models:l};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
122
|
-
`)}
|
|
123
|
-
${e}`,imports:a,models:l}}var ja=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 si(e,t=tn(e)){let n=new Set,i=zn(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let l of t.code.matchAll(a)){let c=l[1];if(ja.has(c)||i.has(c)||c.length<3)continue;if(t.shadows(c,l.index??0))continue;n.add(c)}return Array.from(n)}function Na(e){return zn(e)}var ei=w(128);function rl(e){let t=S(e),n=ei.get(t);if(!n)n=La(e),ei.set(t,n);return{code:n.code,stxImports:[...n.stxImports],browserImports:[...n.browserImports]}}function La(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,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,c;while((c=l.exec(e))!==null){let O=c[1],L=c[2];if(c[0].includes("import type"))continue;let F=[];for(let ee of O.split(",")){let X=ee.trim();if(!X||X.startsWith("type "))continue;let j=X.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!j)continue;let te=j[1],se=j[2]||te;if(a.add(te),a.add(se),L==="stx"||L==="@stacksjs/stx")t.add(te);else n.add(te);if(se!==te)F.push(`${se} = ${te}`)}let B=F.length>0?`var ${F.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(c[0],B)}let b=Na(i),v=tn(i);for(let O of bg){if(a.has(O)||b.has(O))continue;if(ws(v,O,!0))t.add(O)}let T=r(i),P=tn(T),D=new Set;for(let O of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let L of O[1].split(",")){let F=L.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let B of F){let ee=B.trim();if(ee)D.add(ee)}}for(let O of ke){if(a.has(O)||b.has(O)||D.has(O))continue;if(ws(P,O))n.add(O)}let H=si(T,P);for(let O of H)if(!a.has(O)&&!b.has(O))n.add(O);return{code:i,stxImports:Array.from(t),browserImports:Array.from(n)}}function wg(e,t,n=!1){return ws(tn(e),t,n)}function ws(e,t,n=!1){let i=e.code,a=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of i.matchAll(a)){let c=l.index??0;if(e.shadows(t,c))continue;let b=c+t.length,v=c-1;while(v>=0&&/\s/.test(i[v]))v--;if(i[v]==="."&&i.slice(Math.max(0,v-2),v+1)!=="...")continue;let T=b;while(T<i.length&&/\s/.test(i[T]))T++;if(i[T]===":"&&i[T+1]!==":"&&(i[v]==="{"||i[v]===","))continue;if(n&&!/^\s*(?:<[^>]*>)?\s*\(/.test(i.slice(b)))continue;if(za(i,b))continue;return!0}return!1}function za(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 sl(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
|
-
${Ba(e,t)}`;return""}function ly(e,t=[]){let{browserImports:n}=rl(e),i=new Set(t);return sl([],n.filter((a)=>!i.has(a)))}function Ba(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 je(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let i={};for(let a in t){let l=t[a];if(typeof l==="function")continue;i[a]=l}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 Wa=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,ti=new Set;function Fa(e,t){let n=Wa.test(e),i=t.length>32768;if(!n&&!i)return;if(ti.has(e))return;if(ti.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 vn(e,t){if(!t)return"";let n=Ne(e,new Set(Object.keys(t))),i=t.__stxDeclaredPayload===!0,a=[],l=Object.entries(t).sort(([c],[b])=>c<b?-1:c>b?1:0);for(let[c,b]of l){if(!/^[A-Za-z_$][\w$]*$/.test(c))continue;if(c.startsWith("__")||c.startsWith("$"))continue;if(!i&&!n.has(c))continue;if(It(e,c)){if(i)console.warn(`[stx] defineClientPayload declares "${c}", but this client block also declares "${c}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${c}" from defineClientPayload.`);continue}let v;try{v=JSON.stringify(b)}catch{continue}if(v===void 0)continue;Fa(c,v),a.push(` var ${c} = ${v.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
136
|
-
${a.join(`
|
|
137
|
-
`)}
|
|
138
|
-
`}var Va={left:0,middle:1,right:2};function Ua(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=Va[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 Ha(e,t){let{elementId:n,event:i,modifiers:a}=e,l=ys(e.handler),c=Ua(a),b=[];if(a.once)b.push("once: true");if(a.capture)b.push("capture: true");if(bs(i,a))b.push("passive: true");let v=b.length>0?`, { ${b.join(", ")} }`:"",T="";if(c)T+=`${c}; `;let P=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),D=`var $emit = function(name, detail) {
|
|
139
|
-
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
140
|
-
};`;function H(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('${P}', $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
|
-
${c?c+"; ":""}clearTimeout(__timer)
|
|
154
|
-
__timer = setTimeout(function() { ${H(l)} }, ${a.debounce})
|
|
155
|
-
}${v})
|
|
156
|
-
})()`;if(a.throttle!==null)return` ;(function() {
|
|
157
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
158
|
-
var $el = document.getElementById('${n}')
|
|
159
|
-
if (!$el) return
|
|
160
|
-
var __last = 0
|
|
161
|
-
$el.addEventListener('${i}', function($event) {
|
|
162
|
-
${c?c+"; ":""}var __now = Date.now()
|
|
163
|
-
if (__now - __last >= ${a.throttle}) {
|
|
164
|
-
__last = __now
|
|
165
|
-
${H(l)}
|
|
166
|
-
}
|
|
167
|
-
}${v})
|
|
168
|
-
})()`;if(/\$emit\s*\(/.test(l))return` var $el = document.getElementById('${n}')
|
|
169
|
-
if ($el) $el.addEventListener('${i}', function($event) {
|
|
170
|
-
${T}${D}
|
|
171
|
-
${l}
|
|
172
|
-
}${v})`;return` var $el = document.getElementById('${n}')
|
|
173
|
-
if ($el) $el.addEventListener('${i}', function($event) {
|
|
174
|
-
${T}var scope = $el.closest('[data-stx-scope]');
|
|
175
|
-
if (scope && scope.__stx_execute) {
|
|
176
|
-
scope.__stx_execute('${P}', $event, $el);
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
${l}
|
|
180
|
-
}
|
|
181
|
-
}${v})`}function qa(e){if(e.length===0)return"";return`
|
|
182
|
-
// STX: auto-generated event bindings
|
|
183
|
-
${e.map((n,i)=>Ha(n,i)).join(`
|
|
184
|
-
`)}`}function ni(e){let t=[],n=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let b=i[c];if(b==="'"||b==='"'||b==="`"){let v=b;if(c++,v==="`"){let T=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&T===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){T++,c+=2;continue}if(i[c]==="}"&&T>0){T--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(b==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
|
|
185
|
-
`)c++;continue}if(b==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),T=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(T){let H=T[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=T[0].length;continue}let P=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(P){P[1].split(",").forEach((H)=>{let O=H.trim(),L=O.indexOf(":"),F=L>=0?O.slice(L+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(F&&!F.startsWith("_")&&!n.has(F))t.push(F),n.add(F)}),c+=P[0].length;continue}let D=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let H=D[1];if(!H.startsWith("_")&&!n.has(H))t.push(H),n.add(H);c+=D[0].length;continue}}c++}return t}var Za=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 Ka(e){let t=new Set,n=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(H){let O;while((O=n.exec(H))!==null){let L=O[0];if(!Za.has(L))t.add(L)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let T=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=T.exec(e))!==null)i(l[1]);let P=/@model\s*=\s*["']([^"']*)["']/gi;while((l=P.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return t}async function Be(e,t={}){let n=e,i="",a=!1,l=[],c=Si(n,{filePath:t.filePath,projectRoot:t.projectRoot});n=c.code;let b=ki(c.styles),v=jt(n);n=v.code,l=[...v.imports,...v.models];let{hasUserImports:T,bundleClientScript:P}=await o("stx/client-script-bundler",()=>import("./chunk-xhnpgey5.js"));if(T(n))n=await P(n,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let j=rl(n);n=j.code,i=sl(j.stxImports,j.browserImports.filter((te)=>!l.includes(te)))}if(i=`${vn(n,t.serverData)}${i}`,n=I(n),!a&&Fe(t.attrs||""))n=ze(n);let D=qa(t.eventBindings||[]),H=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(H),L=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let j=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${L}${j?` ${j}`:""}`;return`${b}<script ${te}>
|
|
186
|
-
${ae(`${i}${n}
|
|
187
|
-
${D}`)}
|
|
188
|
-
</script>`}let F=Li(e),B=/function __stx_setup_/.test(n),ee=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function X(j){let te=j.length>0?`
|
|
189
|
-
return ${Ds(n,j)};`:"",se=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${b}<script data-stx-scoped data-stx-run="always"${L}>
|
|
190
|
-
window.stx.mount(function() {
|
|
191
|
-
'use strict';
|
|
192
|
-
try {
|
|
193
|
-
${ae(`${i}${n}
|
|
194
|
-
${D}${te}`)}
|
|
195
|
-
} catch (error) {
|
|
196
|
-
console.error(${se}, error);
|
|
197
|
-
return {};
|
|
198
|
-
}
|
|
199
|
-
})</script>`}if(!ee&&!B){if(F)return X(ni(e));if(t.templateContent){let j=ni(e);if(j.length>0){let te=Ka(t.templateContent);if(j.some((ne)=>te.has(ne)))return X(j)}}}return`${b}<script data-stx-scoped data-stx-run="always"${L}>
|
|
200
|
-
;(function() {
|
|
201
|
-
'use strict';
|
|
202
|
-
try {
|
|
203
|
-
${ae(`${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 nc}from"crypto";var Ss=/\s*/y,$s=/\x00STX_HTML_COMMENT_\d+\x00/y;function Ot(e){let t=0;while(t<e.length){if(Ss.lastIndex=t,Ss.exec(e),t=Ss.lastIndex,e.startsWith("<!--",t)){let n=e.indexOf("-->",t+4);if(n===-1)return t;t=n+3;continue}if($s.lastIndex=t,$s.test(e)){t=$s.lastIndex;continue}return t}return t}var vs=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,Xa=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function Nt(e){let t=[],n=0;while(n<e.length){let i=e.indexOf("<",n);if(i===-1)break;if(e.startsWith("<!--",i)){let H=e.indexOf("-->",i+4);if(H===-1)break;n=H+3;continue}vs.lastIndex=i;let a=vs.exec(e);if(!a){n=i+1;continue}let l=vs.lastIndex,c=l,b=null;for(;c<e.length;c++){let H=e[c];if(b){if(H===b)b=null}else if(H==='"'||H==="'")b=H;else if(H===">")break}if(c===e.length)break;let v=a[1]==="/",T=e[c-1]==="/";t.push({start:i,end:c+1,name:a[2],attributes:e.slice(l,T?c-1:c),closing:v,selfClosing:T}),n=c+1;let P=a[2].toLowerCase();if(!v&&P==="plaintext")break;let D=Xa.get(P);if(!v&&(P==="script"||P==="style"||D)){let H=D??(P==="script"?Fn:Vn);H.lastIndex=n;let O=H.exec(e);if(!O)break;n=O.index}}return t}var Bn=/<script\b[^>]*>/iy,Fn=/<\/script\s*>/ig,Wn=/<style\b[^>]*>/iy,Vn=/<\/style\s*>/ig;function ri(e,t,n,i){n.lastIndex=t;let a=n.exec(e);if(!a||a.index!==t)return-1;i.lastIndex=n.lastIndex;let l=i.exec(e);if(!l)return-1;return l.index+l[0].length}function q(e,t){return ri(e,t,Bn,Fn)}function mn(e,t){return ri(e,t,Wn,Vn)}function De(e,t){if(!e.startsWith("<!--",t))return-1;let n=e.indexOf("-->",t+4);if(n===-1)return-1;return n+3}function ii(e,t){if(e.startsWith("<!--",t)){let a=De(e,t);return a===-1?e.length:a}if(Bn.lastIndex=t,Bn.exec(e)?.index===t){Fn.lastIndex=Bn.lastIndex;let a=Fn.exec(e);return a?a.index+a[0].length:e.length}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}return-1}function y(e,t){let n=[],i=0,a=e.length,l=!1,c=null;while(i<a){let b=e[i];if(l){if(c){if(b===c)c=null}else if(b==='"'||b==="'")c=b;else if(b===">")l=!1;i++;continue}if(b!=="<"){let D=e.indexOf("<",i+1);if(D===-1)break;i=D;continue}let v=t(e,i);if(v>i){n.push({start:i,end:v,token:e.slice(i,v)}),i=v;continue}let T=ii(e,i);if(T>i){i=T;continue}let P=e.charCodeAt(i+1);if(P>=65&&P<=90||P>=97&&P<=122)l=!0;i++}return n}function oi(e){let t=0,n=0,i=0,a=!1,l=null;while(i<e.length){if(a){let D=e[i];if(l){if(D===l)l=null}else if(D==='"'||D==="'")l=D;else if(D===">")a=!1;i++;continue}let c=e.indexOf("<",i),b=c===-1?e.length:c;while(i<b){let D=e[i++];if(D==="{")t++;else if(D==="}")n++;if(t>=2&&n>=2)return!0}if(c===-1)break;let v=ii(e,c);if(v>c){i=v;continue}let T=e.charCodeAt(c+1),P=T===47?e.charCodeAt(c+2):T;if(P>=65&&P<=90||P>=97&&P<=122)a=!0;i=c+1}return!1}function Fc(e,t){while(e.size>=t){let n=e.keys().next();if(n.done)return;e.delete(n.value)}}var Ja=1024,Ga=16777216,Wt=new Map,Es=0;function Ya(e,t){Wt.set(e,t),Es+=e.length+t.output.length;for(let[n,i]of Wt){if(Es<=Ga)break;Wt.delete(n),Es-=n.length+i.output.length}}function ge(e,t,n,i){let a=i!==void 0&&e.length>=Ja,l=a?`${i}\x00${e}`:"";if(a){let P=Wt.get(l);if(P)return Wt.delete(l),Wt.set(l,P),{output:P.output,tokens:P.tokens.slice()}}let c=y(e,t);if(c.length===0)return{output:e,tokens:[]};let b=c.map((P)=>P.token),v="",T=0;for(let P=0;P<c.length;P++){let D=c[P];v+=e.slice(T,D.start),v+=n(D.token,P),T=D.end}if(v+=e.slice(T),a)return Ya(l,{output:v,tokens:b}),{output:v,tokens:b.slice()};return{output:v,tokens:b}}var Qa=1024,ec=16777216,Ft=new Map,ks=0;function tc(e,t){Ft.set(e,t),ks+=e.length+t.output.length;for(let[n,i]of Ft){if(ks<=ec)break;Ft.delete(n),ks-=n.length+i.output.length}}function Cs(e,t,n){return{output:t,scripts:n,restore:(i)=>i===t?e:kr(i,n)}}function J(e){let t=e.length>=Qa;if(t){let a=Ft.get(e);if(a)return Ft.delete(e),Ft.set(e,a),Cs(e,a.output,a.scripts.slice())}let{output:n,tokens:i}=ge(e,q,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(t)return tc(e,{output:n,scripts:i}),Cs(e,n,i.slice());return Cs(e,n,i)}function kr(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(n,i)=>t[+i]??"")}var Un="__stx_component_client_factories";function Hn(e){let t=e[Un];return t instanceof Map?t:null}function Qc(e){e[Un]=new Map}function Rs(e,t){let n=Hn(e);if(!n)return null;let i=nc("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 el(e,t){let n=Hn(t);if(!n?.size)return e;let i=new Map;for(let[P,D]of n)if(D.instances===1)i.set(P,D.body);let a=[];if(i.size>0){let P=[...i.keys()].map((O)=>JSON.stringify(O).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),D=new RegExp(`window\\.__stxComponentFactories\\[(${P})\\]\\(("[^"]+")\\);`,"g"),H=D.exec(e);while(H!==null){let O=i.get(JSON.parse(H[1]));if(O!==void 0)a.push({start:H.index,end:H.index+H[0].length,replacement:ae(`(${O})(${H[2]});`)});H=D.exec(e)}}let l=[...n].filter(([,P])=>P.instances>1);if(l.length===0)return ai(e,a);let c=l.map(([P,D])=>` try { factories[${JSON.stringify(P)}] = factories[${JSON.stringify(P)}] || ${D.body}; }
|
|
209
|
-
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(P)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
210
|
-
`),b=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
211
|
-
(function() {
|
|
212
|
-
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
213
|
-
${ae(c)}
|
|
214
|
-
})();
|
|
215
|
-
</script>`,v,T=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return y(e,(P,D)=>{if(v===void 0){if(T.lastIndex=D,T.test(P))v=D}return-1}),a.push({start:v??0,end:v??0,replacement:`${b}
|
|
216
|
-
`}),ai(e,a)}function ai(e,t){if(t.length===0)return e;t.sort((l,c)=>l.start-c.start||l.end-c.end);let n=Array(t.length*2+1),i=0,a=0;for(let l of t)n[a++]=e.slice(i,l.start),n[a++]=l.replacement,i=l.end;return n[a]=e.slice(i),n.join("")}function ci(e){let t=Hn(e),n=new Map;if(t)for(let[i,a]of t)n.set(i,a.instances);return n}function li(e,t){let n=Hn(e);if(!n)return[];let i=[];for(let[a,l]of n){let c=l.instances-(t.get(a)??0);if(c>0)i.push({body:l.body,count:c})}return i}function $i(e,t){for(let{body:n,count:i}of t)for(let a=0;a<i;a++)Rs(e,n)}function Se(e,t,n=2){let i=0,a=null;for(let l=t+n;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){i++;continue}if(c==="}"){if(i>0){i--;continue}let b=0;while(e[l+b]==="}")b++;if(b>=n)return l}}return-1}import Ni from"fs";var Ai=0,Ts=new Map;function cl(){Ai=0,Ts.clear()}function qn(e,t){let n=Ai++,i=`<!--__STX_${e.toUpperCase()}_${n}__-->`;return Ts.set(i,{type:e,expression:t}),i}function ll(){let e={};for(let[t,n]of Ts)e[t]={type:n.type,expression:n.expression};return e}function ul(e,t){let n=e;for(let[i,a]of t)n=n.split(i).join(a);return n}function Ci(e){return e.includes("<!--__STX_")}var sc=/@(?=[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 rc(e){return Array.from({length:e},()=>"{").join("⁠")}function Ii(e){return e.replace(/\{{2,}/g,(t)=>rc(t.length)).replace(/\{(?=!)/g,"{⁠").replace(sc,"@")}function Cr(e,t,n=!1){let{openTag:i,tail:a}=n?ic(e,t):oc(e).at(t);return cc(a,i,n)}function ic(e,t){let n="",i=0;for(let c=0;c<t;c++){if(!e.startsWith("{{",c))continue;let b=Se(e,c);if(b<0||b+2>t)break;n+=e.slice(i,c)+"x",c=b+1,i=b+2}n+=e.slice(i,t);let a=-1,l=null;for(let c=0;c<n.length;c++){let b=n[c];if(l){if(b===l)l=null;continue}if(b==='"'||b==="'"){l=b;continue}if(b===">"){a=-1;continue}if(b==="<")a=c}return{openTag:a,tail:a>=0?n.slice(a+1):n}}var Zn=null;function oc(e){if(Zn&&Zn.source===e)return Zn.scanner;let t=ac(e);return Zn={source:e,scanner:t},t}function ac(e){let t=0,n=-1,i=null,a=-1,l=(b,v)=>{let T=e[b];if(v.quote){if(T===v.quote)v.quote=null;return}if(v.openTag>=0){if(T==='"'||T==="'"){v.quote=T;return}if(T===">"){v.openTag=-1;return}}if(T==="<")v.openTag=b},c=(b,v)=>{if(v.openTag>=0||!e.startsWith("<!--",b))return-1;let T=e.indexOf("-->",b+4);return T<0?e.length:T+3};return{at(b){if(b<t)t=0,n=-1,i=null,a=-1;let v={openTag:n,quote:i},T=!1;while(t<b){if(a<0&&e.startsWith("{{",t)){let F=Se(e,t);if(F<0)a=t;else if(F+2<=b){t=F+2;continue}else break}let L=c(t,v);if(L>=0){if(L>b){T=!0;break}t=L;continue}l(t,v),t++}if(n=v.openTag,i=v.quote,T)return{openTag:-1,tail:""};let P=a>=0?a:t,D={openTag:n,quote:i};for(let L=t;L<b;L++){let F=c(L,D);if(F>=0){if(F>b)return{openTag:-1,tail:""};L=F-1;continue}l(L,D)}if(D.openTag<0)return{openTag:-1,tail:""};let H="",O=D.openTag+1;for(let L=O;L<Math.min(b,P);L++){if(!e.startsWith("{{",L))continue;let F=Se(e,L);H+=e.slice(O,L)+"x",L=F+1,O=F+2}return H+=e.slice(O,b),{openTag:D.openTag,tail:H}}}}function cc(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 l=e.slice(a,i);if(!l)break;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="=")continue;i++;while(i<e.length&&/\s/.test(e[i]))i++;let c=e[i];if(c==='"'||c==="'"){let b=++i,v=e.indexOf(c,i);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(b)};i=v+1}else{let b=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(b)}}}return{kind:"tag"}}class ce 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 Pi="unsafe:";var lc=/^(?:javascript|vbscript|livescript|mocha|view-source):/,uc=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,fc=/^data:(?:text\/html|application\/xhtml\+xml)/,pc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function dc(e){return e.replace(pc,"").toLowerCase()}function As(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 Kn(e,t="navigable"){let n=dc(e);if(lc.test(n))return!0;return t==="navigable"?uc.test(n):fc.test(n)}function _r(e,t="navigable"){return Kn(e,t)?"unsafe:"+e:e}function gc(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return As(t[1])}function Oi(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 Di(e,t,n=t){let i=gc(e);return i&&Kn(t,i)?"unsafe:"+n:n}function Mt(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),c=e.slice(t+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let 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 Xn(e){let t=[],n=0,i="",a=0;for(let l=0;l<e.length;l++){let c=e[l];if(i){if(c==="\\")l++;else if(c===i)i="";continue}if(c==="'"||c==='"'||c==="`")i=c;else if(c==="("||c==="["||c==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(c===","&&n===0)t.push(e.slice(a,l)),a=l+1}return t.push(e.slice(a)),t}function Mi(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 ji(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 Et(e,t){let n=e.trim().replace(/^\.\.\./,"").trim(),i=Mi(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 Xn(n.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){Et(l,t);continue}let c=Mi(l,":");Et(c===-1?l:l.slice(c+1),t)}return}if(n.startsWith("[")&&n.endsWith("]")){for(let a of Xn(n.slice(1,-1)))Et(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(n))t.push(n)}function Y(e){let t=e.trim(),n=[],i=0;for(let l=0;l<t.length;l++){let c=t[l];if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(i===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(t.slice(l)))continue;let v=t.slice(0,l).trim();if(v.startsWith("(")&&ji(v)===v.length-1)v=v.slice(1,-1);for(let T of Xn(v))Et(T,n);if(n.length>0)return n;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let l=a[1].trim();if(l.startsWith("(")&&ji(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)Et(c[2],n),Et(c[1],n);else for(let b of Xn(l))Et(b,n)}return n}function N(e,t){let n=t instanceof Set?t:new Set(t);if(n.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let b of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(n.has(b))return!0;return!1}var Jn="__stx_client_loop_names";function ot(e){let t=e?.[Jn];return Array.isArray(t)?t:[]}function Gn(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 l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=n.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let b=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((P)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(P[1])),v=(b?.[2]??b?.[3])?.trim();if(v&&b?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let T=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(n.push(T),T)t.push(T)}}return t}var rn={},zi=new Map;function mc(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 Gs={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 W(String(e))},translate:(e,t,n={})=>{if(!t||!t.__translations)return e;let i=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),c=i;for(let v of l){if(c===void 0||c===null)break;c=c[v]}if(c===void 0||c===null)return a?e:"";let b=String(c);return Object.entries(n).forEach(([v,T])=>{b=b.replace(mc(v),()=>String(T))}),b},t:(e,t,n={})=>Gs.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 l={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,l[n]||l.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 l=i||`${n}s`;return a===1?n:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let 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 $g(e,t){if(e in Gs)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);rn[e]=t}function dy(e){for(let[t,n]of Object.entries(e))$g(t,n)}function Rg(){return{...Gs,...rn}}function py(){for(let e of Object.keys(rn))delete rn[e]}function Hi(e){let t=e.next();while(!t.done)t=e.next();return t.value}function*qi(e,t,n,i){let a="{".repeat(n);if(!e.includes(a))return e;let l="",c=0,b=0,v=i===Number.POSITIVE_INFINITY?0:performance.now();for(;;){let T=e.indexOf(a,c);if(T===-1)break;let P=Se(e,T,n);if(P===-1)break;if(l+=e.slice(c,T)+t(e.slice(T,P+n),e.slice(T+n,P),T),c=P+n,++b>=64){b=0;let D=performance.now();if(D-v>=i)v=D,yield}}return c===0?e:l+e.slice(c)}function Sn(e,t,n=2){return Hi(qi(e,t,n,Number.POSITIVE_INFINITY))}function hc(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=Cr(e,t);if(!a||a.kind!=="attribute"||a.quote===i)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let c=0;c<a.valuePrefix.length;c++)if(a.valuePrefix[c]==="\\")c++;else if(a.valuePrefix[c]===i)l++;return l%2===1}function p(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function W(e){return Ii(p(e))}function xc(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function bc(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 yc(e,t){let n=bc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(n))throw new ce(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 l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),b=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!b)throw new ce(t,"CSS URLs must be local paths or base64 raster images")}}function Q(e,t,n,i=!1,a=0){try{return _c(e,t,n,i,a)}catch(l){if(l instanceof ce)l.locate(e,t);throw l}}function _c(e,t,n,i,a){let l=Cr(e,t,i),c=W(n);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(n))throw new ce("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return n}if(l.kind==="tag"){let T=e.slice(t+a).trimStart(),P=n.trim();if(!T.startsWith("=")&&(P===""||P.split(/\s+/).every((D)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(D))))return P;throw new ce("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let b=l.name.toLowerCase();if(/^on[a-z]/.test(b))throw new ce(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(b==="srcdoc")c=W(c);if(b==="style")yc(n,l.name);if(l.quote===null)c=xc(c);let v=As(b);if(v&&l.valuePrefix.trim()===""&&Kn(n,v))return Pi+c;return Di(Oi(e,t),n,c)}function kn(e,t){let n=` ${e}="`;return Q(n,n.length,t,!0)}function Zi(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 _e(e,t){let{scripts:n}=J(e);for(let i of Zi(n)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i)||il.test(i))return!0;if(Lr(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 Ag(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(),l=new Set(Y(i[3]));if(l.size===0)continue;let c=i.index+i[0].length;if(i[0].endsWith("/>")){t.push({start:i.index,end:c,names:l});continue}let b=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");b.lastIndex=c;let v=1,T=e.length;for(let P=b.exec(e);P;P=b.exec(e)){if(P[2]==="/")continue;if(v+=P[1]==="/"?-1:1,v===0){T=P.index+P[0].length;break}}t.push({start:i.index,end:T,names:l})}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 l of a.names)if(new RegExp(`(?<![.#\\w$])${l.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="",l=!1,c=0;for(let T=0;T<i.length;T++){let P=i[T];if(!l&&P==="`"){l=!0,c=0;continue}if(l){if(P==="`"&&c===0){l=!1;continue}if(P==="$"&&i[T+1]==="{"){c++,T++,a+=" ";continue}if(P==="}"&&c>0){c--;continue}if(c>0){a+=P;continue}continue}a+=P}i=a;let b=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=b.exec(i))!==null){let T=v[1];if(!i.substring(0,v.index).trimEnd().endsWith(".")){if(!n.includes(T)&&!(T in t))return!1}}return!0}function wc(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 Sc(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 Fi=new Set;function Vi(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function $c(e,t,n){let i=n[0];if(i!=="'"&&i!=='"'&&i!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
|
|
217
|
-
`,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===i)a++;return a%2===1}function Ui(e,t){let n=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Fi.has(n))Fi.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 Ei(e,t,n){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=A(l,t);if(c===void 0)return Vi(l)?Ui(l.trim(),n):a;return c===null?"":String(c)}catch{return a}}),i=Sn(i,(a,l,c)=>{let b=l.trim();if($c(i,c,l))return a;if(/^__[A-Z_]+__$/.test(b))return a;try{let v=A(l,t);if(v===void 0)return Vi(b)?Ui(b,n):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(T)=>"\\u007b".repeat(T.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function Pg(e,t){if(!e.includes("{"))return e;let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let l=A(a,t);if(l===void 0)return i;return l===null?"":String(l)}catch{return i}}),n=Sn(n,(i,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return i;try{let b=A(a,t);if(b===void 0)return i;if(b===null)return"";let v=String(b);return Q(n,l,v,!0,i.length)}catch(b){if(b instanceof ce)throw b;return i}}),n}function fy(e,t,n={}){let{output:i,scripts:a}=J(e),l=a.map((c)=>{let b=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=c.search(/<\/script\s*>$/i);if(!b||v===-1)return c;let T=b[1],P=c.slice(b[0].length,v);if(/\bdata-raw\b/.test(T))return c;if(n.skipServer&&/\bserver\b/.test(T))return c;let H=`<script${Pg(T,t)}>`;if(/\bsrc\s*=/.test(T)||/\btype\s*=\s*["']application\/json["']/.test(T))return H+P+c.slice(v);return H+Ei(P,t)+c.slice(v)});return kr(i,l)}function*Ki(e,t,n,i){let a=e,l=(F,B)=>{let ee=mn(F,B);if(ee===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(F.slice(B,ee))?-1:ee},c=(F,B,ee,X)=>{let j=ee.length,{output:te,tokens:se}=ge(F,B,(ne,pe)=>X(j+pe));return ee.push(...se),te},b=[];a=c(a,l,b,(F)=>`<!--__STX_STYLE_${F}__-->`);let v=[];a=c(a,q,v,(F)=>`<!--__STX_SCRIPT_EXPR_${F}__-->`);let T=t?.__stx_signals_gate===!0||_e(e),P=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],..._i(Zi(v))]),D=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);a=Sn(a,(F,B,ee)=>{if(N(B,P))return F;try{let X=A(B,t,!1,(j)=>Is(j,F,n,e));return X!==void 0&&X!==null?String(X):""}catch(X){let j=X instanceof Error?X.message:String(X);return m("Expression",`Error evaluating: {{{ ${B.trim()}}}}: ${j}`,n,e,ee,F)}},3),a=a.replace(/\{!!([\s\S]*?)!!\}/g,(F,B,ee)=>{if(N(B,P))return F;try{let X=A(B,t,!1,(j)=>Is(j,F,n,e));if(X===void 0&&t.__stx_buildMode==="compile")return qn("raw",B.trim());return X!==void 0&&X!==null?String(X):""}catch(X){if(t.__stx_buildMode==="compile")return qn("raw",B.trim());let j=X instanceof Error?X.message:String(X);return m("Expression",`Error evaluating: {!! ${B.trim()} !!}: ${j}`,n,e,ee,F)}}),a=c(a,q,v,(F)=>`<!--__STX_SCRIPT_EXPR_${F}__-->`),a=c(a,l,b,(F)=>`<!--__STX_STYLE_${F}__-->`);let H=T?Ag(a):[],O=Gn(a).map((F)=>({...F,names:new Set(Y(`${F.binding} in __slot`))})),L=new Set(ot(t));if(a=yield*qi(a,(F,B,ee)=>{let X=B.trim();if(hc(a,ee,B))return F;if(Bi(O,ee,X))return F;if(N(X,L))return F;if(H.length>0&&Bi(H,ee,X))return F;if(D.has(X))return F;let j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],te=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ne=X.match(te)?.[1],pe=ne&&((ne in t)||j.includes(ne)),ye=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,de=X.match(ye),Ie=de&&!j.includes(de[1])&&!(de[1]in t);if(/^__[A-Z_]+__$/.test(X))return"";if(N(X,P))return F;if(t.__stx_native_screen===!0&&wc(X,t))return F;let Ke;try{let Te=A(B,t,!1,(Qe)=>{Ke=Qe});if(T&&!Wi(X,t))return F;if(Ke)Is(Ke,F,n,e);if(t.__stx_buildMode==="compile"&&!T&&(Te===void 0||Sc(X,t)))return qn("expr",X);if(Te===void 0||Te===null)return"";let Xe=String(Te);return Q(a,ee,Xe,!1,F.length)}catch(Te){if(Te instanceof ce)throw Te;if(T&&!Wi(X,t))return F;if(Ie)return F;let Xe=Te instanceof Error?Te.message:String(Te);return m("Expression",`Error evaluating: {{ ${X} }}: ${Xe}`,n,e,ee,F)}},2,i),v.length>0)a=a.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(F,B)=>v[Number(B)]??F);if(b.length>0)a=a.replace(/<!--__STX_STYLE_(\d+)__-->/g,(F,B)=>b[Number(B)]??F);return a}function E(e,t,n){return Hi(Ki(e,t,n,Number.POSITIVE_INFINITY))}var vc=100;async function Ti(e,t,n,i=vc){let a=Ki(e,t,n,i),l=a.next();while(!l.done)await _(),l=a.next();return l.value}function Ig(e,t,n){if(!t.trim())return e;let i=e,a=t.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let c=l[1];a=a.substring(c.length).trim();let b=rn[c]||Gs[c];if(!b)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(Rg()).join(", ")}`);let v=[];if(a.startsWith(":")){let T=a.match(/^:([^|\s]+)/);if(T){let P=T[1].trim();try{let D=Number(P);v=[Number.isNaN(D)?P:D]}catch{v=[P]}a=a.substring(T[0].length).trim()}}else if(a.startsWith("(")){let T=1,P=1;while(T>0&&P<a.length){if(a[P]==="(")T++;if(a[P]===")")T--;P++}if(T===0){let D=a.substring(1,P-1).trim();if(D)try{if(D.startsWith("{")&&D.endsWith("}"))v=[A(`(${D})`,n,!0)];else{let H=[],O="",L=null,F=0,B=0,ee=0,X=!1;for(let j=0;j<D.length;j++){let te=D[j];if(X){O+=te,X=!1;continue}if(te==="\\"){O+=te,X=!0;continue}if(L){if(O+=te,te===L)L=null;continue}if(te==='"'||te==="'"||te==="`"){L=te,O+=te;continue}if(te==="(")F++;else if(te===")")F--;else if(te==="[")B++;else if(te==="]")B--;else if(te==="{")ee++;else if(te==="}")ee--;if(te===","&&F===0&&B===0&&ee===0){H.push(O),O="";continue}O+=te}if(O)H.push(O);v=H.map((j)=>{let te=j.trim();return A(te,n,!0)})}}catch{v=[D]}a=a.substring(P).trim()}}try{i=b(i,n,...v)}catch(T){let P=T instanceof Error?T.message:String(T);throw Error(`Error applying filter '${c}': ${P}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function Ec(e){let t=!1,n="",i=0,a=0,l=0,c=!1;for(let b=0;b<e.length;b++){let v=e[b],T=e[b+1];if(t&&c){c=!1;continue}if(t&&v==="\\"){c=!0;continue}if(c=!1,(v==='"'||v==="'"||v==="`")&&!c){if(!t)t=!0,n=v;else if(v===n)t=!1,n="";continue}if(t&&n==="`"&&v==="$"&&T==="{"){let P=1;b+=2;while(b<e.length&&P>0){if(e[b]==="{")P++;else if(e[b]==="}")P--;if(P>0)b++}continue}if(t)continue;if(v==="(")i++;else if(v===")")i--;else if(v==="[")a++;else if(v==="]")a--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&i===0&&a===0&&l===0){if(T==="|"){b++;continue}if(T==="="){b++;continue}return b}}return-1}var sn=new Set,kc=1000;function gy(){sn.clear()}function Is(e,t,n,i){if(!G())return;let a=`${n}\x00${e.expression}`;if(sn.has(a))return;if(sn.size>=kc)sn.clear();sn.add(a);let l=n,c=i;try{if(n&&Ni.existsSync(n))c=Ni.readFileSync(n,"utf8")}catch{}let b=c.indexOf(t);if(b>=0)l=`${n}:${c.slice(0,b).split(`
|
|
218
|
-
`).length}`;console.warn(`${l}: stx warning: ${t} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function A(e,t,n=!1,i){try{let a=e.trim(),l=Ec(a);if(l>0){let b=a.substring(0,l).trim(),v=a.substring(l+1).trim(),T=A(b,t,!0,i);return Ig(T,v,t)}let c=Js(a);if(c!==null){i?.({expression:a,rule:c});return}try{let b=Object.keys(t),v=Object.values(t);return d(a,b)(...v)}catch{return u(a,t)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let c=l[1],b=Cc(c,Object.keys(t));if(b&&b!==c)a.message=`${a.message} \u2014 did you mean '${b}'?`}}if(!n)console.error(`Error evaluating expression: ${e}`,a);throw a}}function Cc(e,t){let n=null;for(let a of t){if(a===e)continue;let l=Rc(e,a);if(n===null||l<n.dist)n={key:a,dist:l}}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 Rc(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),l=Array(n.length+1);for(let c=0;c<=n.length;c++)a[c]=c;for(let c=1;c<=i.length;c++){l[0]=c;for(let b=1;b<=n.length;b++){let v=n[b-1]===i[c-1]?0:1;l[b]=Math.min(l[b-1]+1,a[b]+1,a[b-1]+v)}for(let b=0;b<=n.length;b++)a[b]=l[b]}return a[n.length]}function my(e){if(!e)return"";return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import Tc from"process";function C(e="STX_PUBLIC_"){let t={},n={};for(let[i,a]of Object.entries(Tc.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 Xi(e,t=""){let n=`${e}${t}`,i=0;for(let a=0;a<n.length;a++){let l=n.charCodeAt(a);i=(i<<5)-i+l,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function Ji(e,t,n={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:c=!1}=n;if(!e.trim())return"";let b=Ps(e),v=[],T=new Map;if(l)for(let P of b){let D=P.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(D){let H=D[1],O=`${t}_${H}`;T.set(H,O)}}for(let P of b){let D=Gi(P,t,i,a,T,c);v.push(D)}return v.join(`
|
|
219
|
-
|
|
220
|
-
`)}function Ps(e){let t=[],n=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",l=!1,c="";for(let b=0;b<n.length;b++){let v=n[b];if(v==="@"&&i===0)l=!0;if(v==="{")i++;else if(v==="}"){if(i--,i===0){if(l){c+=v;let T=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(T){let[,P,D,H]=T;if(P==="keyframes")t.push({selector:`@keyframes ${D.trim()}`,declarations:H.trim()});else if(P==="media"||P==="supports"||P==="container"){let O=Ps(H);t.push({selector:`@${P} ${D.trim()}`,declarations:O.map((L)=>`${L.selector} { ${L.declarations} }`).join(`
|
|
221
|
-
`)})}else t.push({selector:`@${P} ${D.trim()}`,declarations:H.trim()})}c="",l=!1}else if(a.trim()){a+=v;let T=a.match(/([^{]+)\{([^}]*)\}/);if(T)t.push({selector:T[1].trim(),declarations:T[2].trim()});a=""}continue}}if(l)c+=v;else a+=v}return t}function Gi(e,t,n,i,a,l){let{selector:c,declarations:b}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let P=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(P)||P} { ${b} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let D=Ps(`x { ${b} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>Gi(H,t,n,i,a,l)).join(`
|
|
222
|
-
`);return`${c} {
|
|
223
|
-
${D}
|
|
224
|
-
}`}return`${c} { ${b} }`}let v=Ac(c,t,n,i),T=b;for(let[P,D]of a)T=T.replace(new RegExp(`\\b${P}\\b`,"g"),D);if(l)T=T.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${v} { ${T} }`}function Ac(e,t,n,i){let a=e.split(",").map((c)=>c.trim()),l=[];for(let c of a){if(c.startsWith(":host")){if(i)l.push(c);else{let T=c.replace(/:host(\([^)]*\))?/,`.${t}$1`);l.push(T)}continue}if(c.includes("::slotted")){l.push(c);continue}if(c===":root"){l.push(`:root .${t}`);continue}let b=n?`${n} .${t}`:`.${t}`;l.push(`${b} ${c}`);let v=Ic(c,t);if(v)l.push(n?`${n} ${v}`:v)}return l.join(", ")}function Ic(e,t){let n=0,i=e.length;for(let v=0;v<e.length;v++){let T=e[v];if(T==="["||T==="(")n++;else if(T==="]"||T===")")n--;else if(n===0&&(T===" "||T===">"||T==="+"||T==="~")){i=v;break}}let a=e.slice(0,i),l=e.slice(i);if(!a)return"";let c=a.length,b=0;for(let v=0;v<a.length;v++){let T=a[v];if(T==="["||T==="(")b++;else if(T==="]"||T===")")b--;else if(n===0&&b===0&&T===":"){c=v;break}}return`${a.slice(0,c)}.${t}${a.slice(c)}${l}`}var no=String.raw`(?<![\w-])scoped(?![\w-])`,Os=/<style\s+([^>]*)>/gi,Yi=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,so=new RegExp(no,"i"),Pc=new RegExp(no,"gi"),Ns=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Oc(e){Os.lastIndex=0;let t=Os.exec(e);while(t!==null){if(so.test(t[1]))return!0;t=Os.exec(e)}return!1}function wi(e){let t=new Set,n=[];Ns.lastIndex=0;let i=Ns.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=Ns.exec(e)}return n}function hn(e){let t=wi(e);if(t.length===0)return e;let n=Array(t.length+1),i=0;for(let a=0;a<t.length;a++){let l=t[a];n[a]=e.slice(i,l.start),i=l.end}return n[t.length]=e.slice(i),n.join("")}function Vs(e,t){if(!Oc(e))return{html:e,hasScoped:!1};let n=Xi(t),i=`data-v-${n}`,a=e,l=!1;if(Yi.lastIndex=0,a=a.replace(Yi,(c,b,v)=>{if(!so.test(b))return c;l=!0;let T=Dc(v,i),P=b.replace(Pc,"").trim(),D=P?` ${P}`:"";return`<style data-stx-scoped="${n}"${D}>${T}</style>`}),!l)return{html:e,hasScoped:!1};return a=Nc(a,i),{html:a,hasScoped:!0}}function Dc(e,t){return Ji(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var Mc=(e)=>`\x00stx-scope-mask-${e}\x00`,Qi=/\u0000stx-scope-mask-(\d+)\u0000/g;function Nc(e,t){let n=ge(e,(a,l)=>{let c=q(a,l);return c>l?c:mn(a,l)},(a,l)=>Mc(l)),i=Lc(n.output,t);return Qi.lastIndex=0,i.replace(Qi,(a,l)=>n.tokens[Number(l)])}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,l)=>{if(n.has(a.toLowerCase()))return i;if(i.includes(t))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(l)return i.replace(`<${a}${l}`,`<${a} ${t}${l}`);if(i.endsWith("/>"))return`<${a} ${t} />`;return`<${a} ${t}>`})}var on=/<\/?template\b[^>]*>/gi,fl=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function pl(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return fl.test(t)}function fe(e){on.lastIndex=0;let t;while((t=on.exec(e))!==null){if(t[0].startsWith("</")||pl(t[0]))continue;let n=t.index,i=on.lastIndex,a=1,l;while((l=on.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let c=l.index;return{start:n,openEnd:i,closeStart:c,end:on.lastIndex,content:e.slice(i,c)}}}else a++;return null}return null}var dl=0,gl=0;function Yn(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 io(e){let t=[],n=/<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;return y(e,(i,a)=>{n.lastIndex=a;let l=n.exec(i);if(!l||!Yn(l[2],"x-data"))return-1;return t.push({fullMatch:l[0],tagName:l[1],attributes:l[2],startIndex:a,endIndex:n.lastIndex}),n.lastIndex}),t}function ml(e){let t=[];for(let{fullMatch:n,tagName:i,attributes:a,startIndex:l}of io(e)){let c=Yn(a,"x-data");if(!c)continue;let b=`__stx_scope_${dl++}`,v=Yn(a,"x-init"),T=hl(e,i,l+n.length),P=e.slice(l,T.endIndex),D=bl(P);t.push({id:b,selector:`[data-stx-scope="${b}"]`,stateExpr:c,initExpr:v,bindings:[],refs:D})}return t}function hl(e,t,n){let i=1,a=n,l=new RegExp(`<${t}(?:\\s|>)`,"gi"),c=new RegExp(`</${t}>`,"gi"),b=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(i>0&&a<e.length){l.lastIndex=a,c.lastIndex=a,b.lastIndex=a;let v=l.exec(e),T=c.exec(e),P=b.exec(e);if(P&&P.index<(v?.index??1/0)){a=P.index+P[0].length;continue}if(!T)return{endIndex:e.length};if(v&&v.index<T.index)i++,a=v.index+v[0].length;else{if(i--,i===0)return{endIndex:T.index+T[0].length};a=T.index+T[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[,l,c]=a,b=yl(l);t.set(c,b)}return t}function yl(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${gl++}`}function _l(){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 ro(e,t){let n=e.replace(/\{!!([\s\S]*?)!!\}/g,(b,v)=>{try{let T=A(v,t,!0);if(T===void 0)return b;return String(T)}catch{return b}}),i="",a=0,l=null;while(a<n.length){let b=n[a];if(l&&b==="\\"){i+=b+(n[a+1]??""),a+=2;continue}if(b==="{"&&n[a+1]==="{"){let v=n.indexOf("}}",a+2);if(v!==-1){let T=n.slice(a,v+2);i+=c(n.slice(a+2,v),T,l),a=v+2;continue}}if(l){if(b===l)l=null}else if(b==="'"||b==='"'||b==="`")l=b;i+=b,a++}return i;function c(b,v,T){let P;try{P=A(b,t,!0)}catch{return v}if(P===void 0)return v;if(T){let D=String(P).replace(/\\/g,"\\\\").replace(new RegExp(T==="`"?"`":T,"g"),`\\${T}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return T==="`"?D.replace(/\$\{/g,"\\${"):D}if(typeof P==="string"){let D=P.trim();if(D.startsWith("{")&&D.endsWith("}")||D.startsWith("[")&&D.endsWith("]"))try{return JSON.parse(D),D}catch{}}return JSON.stringify(P)}}function wl(e,t,n){if(e.length===0)return"";let i=e.map((a)=>{let l=JSON.stringify(Object.fromEntries(a.refs)),c=ro(a.stateExpr,t),b=a.initExpr?ro(a.initExpr,t):null,v=JSON.stringify(c),T=b?JSON.stringify(b):"null";return`
|
|
497
|
-
(function() {
|
|
498
|
-
var scopeEl = document.querySelector('${a.selector}');
|
|
499
|
-
if (!scopeEl) return;
|
|
500
|
-
var refs = ${l};
|
|
501
|
-
window.__stx_reactive.initScope(scopeEl, ${v}, [], refs, ${T}${n?", true":""});
|
|
502
|
-
})();`}).join(`
|
|
503
|
-
`);return`
|
|
504
|
-
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
505
|
-
${_l()}
|
|
506
|
-
${i}
|
|
507
|
-
</script>`}function Xc(e,t,n,i=!1){if(!Zs(e))return e;let a=ml(e);if(a.length===0)return e;let l=Sl(e,a),c=wl(a,t,i),b=l.lastIndexOf("</body>");if(b!==-1)l=l.slice(0,b)+c+`
|
|
508
|
-
`+l.slice(b);else l+=c;return l}function Sl(e,t){let n=[],i=0;for(let[l,c]of io(e).entries()){let b=t[l];if(!b)break;n.push(e.slice(i,c.startIndex));let v=Yn(c.attributes,"data-stx-scope");if(v)b.id=v,b.selector=`[data-stx-scope="${b.id}"]`,n.push(c.fullMatch);else n.push(`<${c.tagName} data-stx-scope="${b.id}"${c.attributes}>`);i=c.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 Zs(e){return/x-data\s*=\s*["']/.test(e)}function Ws(e,t){let n=e,i=/@json\s*\(/g,a;while((a=i.exec(n))!==null){let l=a.index,c=l+a[0].length-1,b=1,v=c+1,T=null,P=!1;while(v<n.length&&b>0){let j=n[v];if(P){P=!1,v++;continue}if(j==="\\"&&T){P=!0,v++;continue}if(T){if(j===T)T=null;v++;continue}if(j==='"'||j==="'"||j==="`"){T=j,v++;continue}if(j==="(")b++;else if(j===")"){if(b--,b===0)break}v++}if(b!==0)break;let D=n.substring(c+1,v).trim(),H=n.substring(l,v+1),O=-1,L=0,F=null,B=!1;for(let j=0;j<D.length;j++){let te=D[j];if(B){B=!1;continue}if(te==="\\"&&F){B=!0;continue}if(F){if(te===F)F=null;continue}if(te==='"'||te==="'"||te==="`"){F=te;continue}if(te==="("||te==="["||te==="{")L++;else if(te===")"||te==="]"||te==="}")L--;if(te===","&&L===0){O=j;break}}let ee=O>=0?D.substring(0,O).trim():D,X=O>=0?D.substring(O+1).trim():void 0;try{let j=ee.trim(),te;if(f(j))te=d(j,Object.keys(t))(...Object.values(t));else te=void 0;let se;if(X==="true")se=JSON.stringify(te,null,2);else se=JSON.stringify(te);let ne=se.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");n=n.substring(0,l)+ne+n.substring(v+1),i.lastIndex=l+ne.length}catch(j){z.log(j instanceof Error?j:Error(String(j)),{directive:"@json"},"error"),i.lastIndex=l+H.length}}return n}function qs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Jc(e){let t=e,n=/@memo\s*\(/g,i,a=[];while((i=n.exec(t))!==null){let l=i.index,c=l+i[0].length,b=1,v=c;while(v<t.length&&b>0){if(t[v]==="(")b++;else if(t[v]===")")b--;v++}if(b!==0)continue;let T=t.slice(c,v-1).trim(),P=v,D=t.slice(P),H=D.indexOf("@endmemo");if(H===-1)continue;let O=D.slice(0,H),L=P+H+8,F=Ot(O),B=O.slice(F),ee=O.match(/(\s*)$/),X=ee?ee[0].length:0,j=B.slice(0,B.length-X),te=j.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),se;if(te){let[ne,pe,ye="",de]=te,Ie=`<${pe}${ye} data-stx-memo="${T}"${de}>`;se=O.slice(0,F)+Ie+j.slice(ne.length)+O.slice(F+j.length)}else se=`${O.slice(0,F)}<div data-stx-memo="${T}">${j}</div>${O.slice(F+j.length)}`;a.push({start:l,end:L,replacement:se}),n.lastIndex=L}for(let l=a.length-1;l>=0;l--){let c=a[l];t=t.slice(0,c.start)+c.replacement+t.slice(c.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function vi(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 lo(e,t){let n=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=y(e,(b,v)=>{n.lastIndex=v;let T=n.exec(b);if(!T||/^(?:script|style)$/i.test(T[1]))return-1;return n.lastIndex}),a=[],l=0,c=[];for(let{start:b,end:v,token:T}of i){let P=/^<\/?([\w-]+)/.exec(T)[1].toLowerCase();if(T.startsWith("</")){while(a.length&&a.pop()!==P);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(T))c.push(e.slice(l,b),T.replace(/\s*\/?>$/,(D)=>` data-stx-slot-owner="${t}"${D}`)),l=v;if(!Ys.has(P)&&!/\/>$/.test(T))a.push(P)}return c.push(e.slice(l)),c.join("")}function uo(e,t){if(!/\bref\s*=/.test(e))return e;let n=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=y(e,(v,T)=>{n.lastIndex=T;let P=n.exec(v);if(!P||/^(?:script|style)$/i.test(P[1]))return-1;return n.lastIndex}),a=[],l=0,c=0,b=[];for(let{start:v,end:T,token:P}of i){let D=/^<\/?([\w-]+)/.exec(P)[1].toLowerCase();if(P.startsWith("</")){let F;while(F=a.pop()){if(F.scoped)l--;if(F.name===D)break}continue}let H=/\sdata-stx-scope\s*=/.test(P),O=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(P),L=a.find((F)=>F.scoped)?.scopeId;if(O&&L&&O[2]===L)b.push(e.slice(c,v),P.replace(O[0],` data-stx-ref-caller="${t}"`)),c=T;else if(!l&&!H&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(P)&&!/\sdata-stx-ref-caller\s*=/.test(P))b.push(e.slice(c,v),P.replace(/\s*\/?>$/,(F)=>` data-stx-ref-caller="${t}"${F}`)),c=T;if(!Ys.has(D)&&!/\/>$/.test(P)){let F=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(P);if(a.push({name:D,scoped:H,scopeId:F?.[1]??F?.[2]}),H)l++}}return b.push(e.slice(c)),b.join("")}var Ys=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),fo=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,oo=/<\/?\s*([a-z][\w-]*)/iy,$l=/\s/;function El(e,t){let n=t-1;while(n>=0&&$l.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 l=e[a];if(n){if(l==="'")n=!1}else if(i){if(l==='"')i=!1}else if(l==="'")n=!0;else if(l==='"')i=!0;else if(l===">")return a}return-1}function Cl(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let n=0,i=t,a=!1,l=!1,c=!1;while(i<e.length){let b=e.indexOf("<",i),v=b===-1?e.length:b;if(v>i){if(n===0)while(i<v){let D=e.indexOf(l?"}":"{",i);if(D===-1||D>=v){if(l)c=!1;else a=!1;break}if(D>i)if(l)c=!1;else a=!1;if(l){if(c)return!0;c=!0}else if(a)l=!0,c=!1;else a=!0;i=D+1}i=v;continue}if(e.startsWith("<!--",i)){let D=e.indexOf("-->",i);i=D===-1?e.length:D+3;continue}let T=kl(e,i);if(T===-1)break;oo.lastIndex=i;let P=oo.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(n===0)break;n--}else if(!El(e,T)&&!Ys.has(P))n++;i=T+1}return!1}var ao=w(256);function Yc(e){if(e.length<1024)return co(e);let t=S(e),n=ao.get(t);if(n!==void 0)return n;let i=co(e);return ao.set(t,i),i}function co(e){if(e.length>=32768&&!oi(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,l;while((l=n.exec(e))!==null){let c=l.index,b=c+l[0].length,v=!1,T=!1,P=-1;while(b<e.length){let H=e[b];if(v){if(H==="'")v=!1}else if(T){if(H==='"')T=!1}else if(H==="'")v=!0;else if(H==='"')T=!0;else if(H===">"){P=b;break}b++}if(P===-1)continue;let D=e.slice(c,P+1);if(fo.test(D))continue;if(D.includes("x-cloak"))continue;if(Cl(e,P+1))i+=e.slice(a,P)+" x-cloak>",a=P+1}return i+=e.slice(a),i}var Rl=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Tl=/<\/script>/gi,Al=/<\/style>/gi;function Zc(e){let t=/<[a-z][\w-]*/gi,n="",i=0,a;while((a=t.exec(e))!==null){let l=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let L=c==="script"?Tl:Al;L.lastIndex=l;let F=L.exec(e);if(F!==null)t.lastIndex=F.index+F[0].length;continue}let b=l+a[0].length,v=!1,T=!1,P=-1;while(b<e.length){let L=e[b];if(v){if(L==="'")v=!1}else if(T){if(L==='"')T=!1}else if(L==="'")v=!0;else if(L==='"')T=!0;else if(L===">"){P=b;break}b++}if(P===-1)continue;let D=e.slice(l+a[0].length,P);if(fo.test(D))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(D))continue;if(!Rl.test(D))continue;let H=e[P-1]==="/",O=H?P-1:P;n+=`${e.slice(i,O)} x-cloak${H?" ":""}`,i=O}return n+=e.slice(i),n}import Ro from"path";import er from"fs";import an from"path";function po(e,t,n,i){let a=0;for(let l=t;l<e.length;l++)if(e[l]===n)a++;else if(e[l]===i&&!(i===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function Il(e){let t=r(e),n=0,i=0,a=[];for(let l=0;l<t.length;l++)if("([{".includes(t[l]))n++;else if(")]}".includes(t[l]))n--;else if(t[l]===","&&n===0)a.push(e.slice(i,l).trim()),i=l+1;return a.push(e.slice(i).trim()),a}function Qs(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 l=a.index+a[0].length,c="";if(n[l]==="<"){let v=po(n,l,"<",">");if(v<0)continue;c=e.slice(l+1,v),l=v+1;while(/\s/.test(n[l]||"")&&l<n.length)l++}if(n[l]!=="(")continue;let b=po(n,l,"(",")");if(b>=0)return{type:c,args:Il(e.slice(l+1,b))}}return null}var go=`
|
|
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 mo(e,t){let n=[],i={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=r(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(H,O,L,F,B)=>{if(a.slice(B,B+6)!=="import")return H;if(F.endsWith(".stx"))return"";let ee=`${t}Import${n.length}`;if(n.push(`import * as ${ee} from ${JSON.stringify(F)};`),O.startsWith("*"))return`import ${O.replace(/^\*\s+as\s+/,"")} = ${ee};`;if(!O.startsWith("{"))return`import ${O} = ${ee}.default;`;return O.slice(1,-1).split(",").map((X)=>{let[j,te=j]=X.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!j)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(F)&&j in i)i[j].push(te);return`import ${te} = ${ee}.${j};`}).join(`
|
|
517
|
-
`)}),c=Qs(e,i.defineProps),b=Qs(e,i.defineEmits),v=Qs(e,i.withDefaults);if(!c&&!b)return{declarations:"",props:null,events:null};let T=[],P=null,D=null;if(c){T.push(`const __options = (${c.args[0]||"{}"}) as const;`),T.push(`const __defaults = (${v?.args[1]||"{}"});`);let H=c.type||"__StxOptions<typeof __options>";T.push(`export type __StxProps = __StxDefaults<${H}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),P=`${t}.__StxProps`}if(b)T.push(`const __events = (${b.args[0]||"[]"}) as const;`),T.push(`export type __StxEvents = ${b.type||"Record<(typeof __events)[number], any[]>"};`),D=`${t}.__StxEvents`;return{declarations:`${n.join(`
|
|
518
|
-
`)}
|
|
519
|
-
namespace ${t} {
|
|
520
|
-
${l}
|
|
521
|
-
${T.join(`
|
|
522
|
-
`)}
|
|
523
|
-
}`,props:P,events:D}}var Er=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 Tr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Er].some((t)=>t.toLowerCase()===e.toLowerCase());return Er.has(e)||/[A-Z]/.test(e)}function*Pl(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 l=/^[^\s=/>]+/.exec(e.slice(i))?.[0];if(!l){i++;continue}let c=i;i+=l.length;while(/\s/.test(e[i]||""))i++;if(e[i]!=="="){a.push({name:l,value:!0,offset:c,braced:!1});continue}i++;while(/\s/.test(e[i]||""))i++;let b=e[i],v=b==="{",T=b==='"'||b==="'";if(T||v)i++;let P=i;if(v){let D=r(e.slice(i)),H=1,O=0;for(;O<D.length;O++){if(D[O]==="{")H++;if(D[O]==="}"&&--H===0)break}i+=O}else if(T)while(i<e.length&&e[i]!==b)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:l,value:e.slice(P,i),offset:P,braced:v}),T||v)i++}t.lastIndex=i,yield{name:n[1],offset:n.index,attributes:a}}}function ho(e,t,n){let i=[],a=[go,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,c=new Map,b=new Map,v=n.scriptCode(e,n.filePath),T=r(v);for(let L of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(T.slice(L.index,L.index+6)!=="import")continue;let F=L[2],B=an.isAbsolute(F)||F.startsWith(".")?an.resolve(an.dirname(n.filePath),F):Ls(F,an.dirname(n.filePath));if(!B)continue;let ee=B.endsWith(".stx")?B:er.existsSync(`${B}.stx`)?`${B}.stx`:void 0,X=ee?null:xr(B,!1),j=L[1].startsWith("{")?L[1].slice(1,-1).split(","):[L[1]];for(let te of j){let[se,ne=se]=te.trim().split(/\s+as\s+/),pe=ee||X?.get(se)||X?.get(se.toLowerCase());if(pe)b.set(ne,pe),b.set(ne.toLowerCase(),pe),b.set(ne.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),pe)}}for(let L of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let F of L[1].matchAll(/['"]([^'"]+)['"]/g)){let B=js(F[1],n.filePath,n).find((ee)=>er.statSync(ee,{throwIfNoEntry:!1})?.isFile());if(B)b.set(an.basename(F[1]).replace(/\.stx$/,""),B)}let P={__importedComponents:b},D=new Map,H=(L,F,B)=>{let ee=e.slice(0,L);return{code:F,offset:L,attribute:B,anchor:!0,kind:"directive",line:ee.split(`
|
|
524
|
-
`).length,column:L-ee.lastIndexOf(`
|
|
525
|
-
`)}},O=(L,F,B)=>i.push({expression:L,statement:{text:F+L.code+B,prefixLength:F.length}});for(let L of Pl(t)){if(Tr(L.name)||L.name==="component")continue;let F=zr(L.name,n.filePath,n,P);if(!F)continue;let B=D.get(F);if(!B){let X;try{X=n.readComponent?n.readComponent(F):er.readFileSync(F,"utf8")}catch{continue}if(X===void 0)continue;c.set(F,X),B=mo(n.scriptCode(X,F),`__StxComponent${D.size}`),D.set(F,B),a.push(B.declarations)}let ee=[];for(let X of L.attributes){let{name:j,offset:te}=X,se=X.value===!0?"true":X.value;if(j.startsWith("@")||j.startsWith("v-on:")){if(B.events&&X.value!==!0)l.set(te,`__StxEvent<${B.events}, ${JSON.stringify(j.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let ne=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(j);if(j.startsWith("v-")&&!j.startsWith("v-bind:")&&!ne)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(j))continue;let pe=(ne?ne[1]||"modelValue":j.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ke,Te)=>Te.toUpperCase());if(ee.push(pe),!B.props)continue;let ye=j.startsWith(":")||j.startsWith("v-bind:")||!!ne||X.braced,de=ye?se:X.value!==!0?JSON.stringify(se):"true",Ie=!ye&&X.value!==!0&&(se==="true"||se==="false");O(H(te,de,j),";void ((",`) satisfies ${Ie?"__StxStaticProp":"__StxProp"}<${B.props}, ${JSON.stringify(pe)}>);`)}if(B.props){let X=[...new Set(ee)].map((te)=>`${JSON.stringify(te)}: undefined as any`).join(", "),j=H(L.offset,`<${L.name}>`);i.push({expression:j,statement:{text:`;void ({ ${X} } satisfies ${B.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:D.size?a.join(`
|
|
526
|
-
`):"",checks:i,events:l,dependencies:c}}var xo=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Ol(e){let t=(n)=>n.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function it(e){let t=[],n=Ol(e);xo.lastIndex=0;let i;while((i=xo.exec(n))!==null){let a=(i[1]||"").trim(),l=(i[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(i[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,b=i.index+l,v=i.index+i[0].length-c,T=e.slice(b,v);if(/\bsrc\s*=/.test(a))continue;let P=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(P&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(P[1]))continue;let D=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",H=cn(e,b);t.push({kind:D,code:T,startLine:H,startColumn:ln(e,b),offset:b,attrs:a})}return t}function cn(e,t){let n=1;for(let i=0;i<t&&i<e.length;i++)if(e.charCodeAt(i)===10)n++;return n}function ln(e,t){let n=e.lastIndexOf(`
|
|
527
|
-
`,t-1)+1;return t-n+1}function Qn(e){let t=e.split(""),n=(a,l)=>{for(let c=a;c<l&&c<t.length;c++)if(t[c]!==`
|
|
528
|
-
`)t[c]=" "},i=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let a of i){a.lastIndex=0;let l;while((l=a.exec(e))!==null)n(l.index,l.index+l[0].length)}return t.join("")}function To(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 Ao=new Set([":for","x-for","v-for"]),es=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,tr="__stx_interpolated",bo="__StxElement",Io="__StxTemplateValue",Dl=`type ${Io}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function yo(e){return e.replace(/\{\{[\s\S]*?\}\}/g,tr).replace(/\{!![\s\S]*?!!\}/g,tr)}function Ml(e,t,n){let i=0;for(let a=t;a<e.length;a++){let l=e[a];if(l==="{"){i++;continue}if(l!=="}"&&l!=="!")continue;if(e.startsWith(n,a)&&i===0)return a;if(l==="}"&&i>0)i--}return-1}function gi(e,t,n="0"){let i=`__stxScript${n}`;while((e+t).includes(i))i+="_";let a=new Map,l=[],c=[],b=r(e),v=Lo(e),T=[],P=0;for(let B=0;B<b.length;B++){let ee=b.startsWith("{{",B);if(!ee&&!b.startsWith("{!!",B))continue;let X=ee?2:3,j=ee?"}}":"!!}",te=Ml(b,B+X,j);if(te<0)continue;let se=B,ne=e.slice(se,te+j.length),pe=ne.slice(X,-j.length);B=te+j.length-1;let ye=c.length,de=sr(v,se),Ie=sr(v,se+(ee?2:3));c.push({code:To(pe),...Ie});let Ke=`${i}_${ye}`,Te=ne.split(`
|
|
529
|
-
`),Xe=Te[0].length;Te[0]=Ke+" ".repeat(Math.max(0,Xe-Ke.length));for(let tt=1;tt<Te.length;tt++)Te[tt]=Te[tt].replace(/[^\r]/g," ");let Qe=a.get(de.line)??[],Ge=Qe.at(-1),rt=de.column+(Ge?Ge.generatedEnd-Ge.sourceEnd:0);Qe.push({sourceStart:de.column,sourceEnd:de.column+Xe,generatedStart:rt,generatedEnd:rt+Te[0].length}),a.set(de.line,Qe),T.push(e.slice(P,se),Te.join(`
|
|
530
|
-
`)),P=se+ne.length}T.push(e.slice(P));let D=T.join("");if(!c.length)return{code:D,columns:a,declarations:l};let{imports:H,body:O}=Oo(t),L=[],F=0;for(let B of H.split(/\n(?=import\b)/)){if(!B.trim())continue;let ee=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(B);if(!ee){l.push({text:B});continue}let X=`${i}Module${F++}`;l.push({text:`import * as ${X} from ${ee[2]}`});let j=ee[1],te=/\{([\s\S]*?)\}/.exec(j);for(let ye of te?.[1].split(",")??[]){let[de,Ie=de]=ye.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(de==="default")L.push(`const ${Ie} = ${X}.default; type ${Ie} = import(${ee[2]}).default`);else if(de)L.push(`import ${Ie} = ${X}.${de}`)}let se=j.replace(/\{[\s\S]*?\}/,""),ne=/\*\s+as\s+(\w+)/.exec(se);if(ne)L.push(`import ${ne[1]} = ${X}`);let pe=/^\s*([\w$]+)/.exec(se)?.[1];if(pe)L.push(`const ${pe} = ${X}.default; type ${pe} = import(${ee[2]}).default`)}l.push({text:`namespace ${i}Scope {
|
|
531
|
-
${L.join(`
|
|
532
|
-
`)}
|
|
533
|
-
export async function read() {
|
|
534
|
-
${zs(O).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
|
|
535
|
-
return {`});for(let[B,ee]of c.entries())l.push({text:`value${B}: (`}),l.push({text:ee.code,origin:{line:ee.line,column:ee.column}}),l.push({text:"),"});l.push({text:`}
|
|
536
|
-
}
|
|
537
|
-
}`});for(let B=0;B<c.length;B++)l.push({text:`declare var ${i}_${B}: Awaited<ReturnType<typeof ${i}Scope.read>>['value${B}']`});return{code:D,columns:a,declarations:l}}function _o(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 jl=["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"],Nl=new RegExp(String.raw`^[ \t]*@(?:${jl.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function zs(e){return e.replace(Nl,(t)=>t.replace(/[^\n]/g," "))}var wo=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function ug(e){let t=Qn(e),n=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(t))!==null){if(a[1]||a[3])continue;let b=a[2]??a[4]??"",v=a[2]!==void 0?2:3,T=To(b);if(!T.trim())continue;let P=a.index+v+(T.length-T.trimStart().length);n.push({code:T.trim(),line:cn(t,P),column:ln(t,P),offset:P,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(t))!==null){let c=a.index+a[0].length-1,b=0,v=c;for(;v<t.length;v++){let H=t[v];if(H==="(")b++;else if(H===")"){if(b--,b===0)break}}if(b!==0)continue;let T=t.slice(c+1,v),P=T.trim();if(l.lastIndex=v+1,!P)continue;let D=c+1+(T.length-T.trimStart().length);n.push({code:P,line:cn(t,D),column:ln(t,D),offset:a.index,kind:"condition"})}es.lastIndex=0;while((a=es.exec(t))!==null){let c=a[1],b=a[3]??"",v=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(wo.has(v)||wo.has(c))continue;if(!b.trim())continue;let T=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(Ao.has(v)){let D=b.match(/\s+(?:in|of)\s+/);if(!D||D.index===void 0)continue;let H=b.slice(D.index+D[0].length),O=D.index+D[0].length+(H.length-H.trimStart().length);n.push({code:yo(H.trim()),line:cn(t,T+O),column:ln(t,T+O),offset:T+O,kind:"directive",attribute:v});continue}let P=b.length-b.trimStart().length;n.push({code:yo(b.trim()),line:cn(t,T+P),column:ln(t,T+P),offset:T+P,kind:"directive",attribute:v})}return n.sort((c,b)=>c.line-b.line||c.column-b.column),n}var Ll=2000;function zl(e,t){let n=0,i=Math.min(e.length,t+Ll);for(let a=t;a<i;a++){let l=e[a];if(l==="(")n++;else if(l===")"){if(n--,n===0)return e.slice(t+1,a)}}return null}function Bl(e){let t=new Map,n=(b,v)=>{let T=b.split(/[,[\]{}()\s]+/).filter(Boolean);for(let P of T){let D=P.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(D))continue;let H=T.length===1?v:void 0,O=t.get(D);if(!O)t.set(D,{name:D,iterable:H});else if(O.iterable!==H)O.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(b)=>{let v=b.trim();return i.test(v)?v:void 0};for(let b of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=zl(e,b.index+b[0].length-1);if(v===null)continue;let T=Mt(v);if(!T)continue;n(T.itemVar.replace(/=>/g," "),a(T.arrayExpr))}for(let b of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))n(b[1],b[2]==="of"?a(b[3]):void 0);for(let b of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))n(b[1]);let l=Qn(e);es.lastIndex=0;let c;while((c=es.exec(l))!==null){let b=c[1].replace(/\..*$/,"");if(!Ao.has(b))continue;let v=c[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;n(c[3].slice(0,v.index),a(c[3].slice(v.index+v[0].length)))}for(let b of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let v of b[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))n(v[1]);return[...t.values()].sort((b,v)=>b.name.localeCompare(v.name))}function Le(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 nr=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Wl={$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 zc(e=new Set){return[...nr.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(Wl).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
|
|
538
|
-
`)}function Hc(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function Po(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,n,i=!1,a=new Set,l=r(e);while((n=t.exec(l))!==null){i=!0;for(let c of Fl(n[1])){let b=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(b))a.add(b)}}return i?[...a]:null}function Fl(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 Oo(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 rr(e){let t=r(e),n=Array(t.length),i=0;for(let b=0;b<t.length;b++){let v=t[b];if(v==="}"||v===")"||v==="]")i=Math.max(0,i-1);if(n[b]=i,v==="{"||v==="("||v==="[")i++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=l.exec(t))!==null){if(n[c.index]!==0)continue;let b=c[1],v=c[2],T;if(b==="interface"){let P=t.indexOf("{",c.index);if(P===-1)continue;let D=0;T=-1;for(let H=P;H<t.length;H++)if(t[H]==="{")D++;else if(t[H]==="}"&&--D===0){T=H+1;break}if(T===-1)continue}else{let P=0;T=t.length;for(let D=t.indexOf("=",c.index)+1;D<t.length;D++){let H=t[D];if(H==="{"||H==="["||H==="("||H==="<")P++;else if(H==="}"||H==="]"||H===")"||H===">")P--;else if(P<=0&&(H===";"||H===`
|
|
542
|
-
`&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,D-40),D)))){T=H===";"?D+1:D;break}}}a.push({name:v,text:e.slice(c.index,T).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=T}return a}function Vl(e){let t=r(e),n=[],i=/^[ \t]*(?:export[ \t]+)?(?:const|let|var)[ \t]+/gm,a,l=0,c=0;while((a=i.exec(t))!==null){for(;c<a.index;c++){let T=t[c];if(T==="{"||T==="("||T==="[")l++;else if(T==="}"||T===")"||T==="]")l=Math.max(0,l-1)}if(l!==0)continue;let b=0,v=t.length;for(let T=a.index+a[0].length;T<t.length;T++){let P=t[T];if(P==="{"||P==="("||P==="[")b++;else if(P==="}"||P===")"||P==="]")b--;else if(b<=0&&(P===";"||P===`
|
|
543
|
-
`)){v=P===";"?T+1:T;break}}if(/\bdefineProps\s*(?:<|\()/.test(t.slice(a.index,v)))n.push(e.slice(a.index,v).replace(/^[ \t]*export[ \t]+/,"").trim())}return n}function mi(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=Do(t),i=e.filter((a)=>a.kind!=="server").flatMap((a)=>{let l=Vl(a.code);if(!l.length)return[];return[...rr(a.code).filter((c)=>!n.has(c.name)).map((c)=>c.text),...l]});return[t,...i].filter(Boolean).join(`
|
|
545
|
-
`)}function Do(e){return new Set(rr(e).map((t)=>t.name))}function Vc(e,t=""){let n=Po(e),i=Do(t),a=rr(e).filter((T)=>!i.has(T.name)).map((T)=>T.text);if(!n){let T=Le(e).filter((P)=>!It(t,P));if(T.length===0&&a.length===0)return"";return["",`// ${ql}`,...a,...T.map((P)=>`declare var ${P}: any`)].join(`
|
|
546
|
-
`)}if(n.length===0)return a.length>0?["",`// ${$o}`,...a].join(`
|
|
547
|
-
`):"";let{imports:l,body:c}=Oo(e),b=c.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${$o}`];if(l)v.push(l);return v.push(...a),v.push(`async function ${vo}() {`,b,` return { ${n.join(", ")} }`,"}",`type ${Eo} = Awaited<ReturnType<typeof ${vo}>>`,...n.map((T)=>`declare var ${T}: ${Eo}[${JSON.stringify(T)}]`)),v.join(`
|
|
548
|
-
`)}function hi(e){let t=r(e),n=t.split(""),i=[],a=0,l=0;for(let b=0;b<n.length;b++){let v=n[b];if(v===`
|
|
549
|
-
`)l=b+1;if(v==="{"||v==="("||v==="["){if(a===0&&v!=="("&&Ul.test(t.slice(l,b))){let T=Mo(t,b);if(T!==-1)i.push(...jo(t.slice(b,T+1)))}a++;continue}if(v==="}"||v===")"||v==="]"){a=Math.max(0,a-1);continue}if(a>0&&v!==`
|
|
550
|
-
`)n[b]=" "}let c=Le(n.join(""));return i.length===0?c:[...new Set([...c,...i])].sort()}var Ul=/^\s*(?:export\s+)?(?:const|let|var)\s*$/;function Mo(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 Hl(e){let t=[],n=0,i=0;for(let a=0;a<e.length;a++){let l=e[a];if(l==="{"||l==="("||l==="[")n++;else if(l==="}"||l===")"||l==="]")n--;else if(l===","&&n===0)t.push(e.slice(i,a)),i=a+1}return t.push(e.slice(i)),t}function So(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 jo(e){let t=[],n=(a)=>{let l=a.trim().replace(/^\.\.\./,"").trim();if(l.startsWith("{")||l.startsWith("[")){let b=Mo(l,0);if(b!==-1)t.push(...jo(l.slice(0,b+1)));return}let c=So(l);if(c)l=l.slice(0,c.index).trim();if(/^[A-Z_$][\w$]*$/i.test(l))t.push(l)},i=e.slice(1,-1);for(let a of Hl(i)){if(!a.trim())continue;if(e[0]==="["){n(a);continue}let l=So(a);n(l?.char===":"?a.slice(l.index+1):a)}return t}function Uc(e,t){if(Po(e)!==null)return[];let n=hi(e),i=Ne(t,new Set(n)),a=new Set(k);return n.filter((l)=>{if(a.has(l))return!1;if(It(t,l))return!1;return i.has(l)})}var $o="stx: types for the declared client payload (#1868)",ql="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",vo="__stxServerScope",Eo="__StxClientPayload";var ko=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Zl=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Kl(e){let t=new Map,n=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=r(i),{depths:l,balanced:c}=he(a);if(!c)continue;let b=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of a.matchAll(b)){let T=v.index??0;if(l[T+v[1].length]!==0)continue;let P=v[2],D=T+v[0].length-v[3].length,H=i.slice(D,T+v[0].length).trim().replace(/;$/,"").trim(),O=v[3],L=n.test(O)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(O)&&!/[,+\-*/%&|?:=]$/.test(H)&&he(O).balanced;t.set(P,t.has(P)||!L?null:H)}}return new Map([...t].filter((i)=>i[1]!==null))}function No(e,t,n=0,i=new Set){if(t.size===0||n>=5)return e;let a=r(e),l="",c=0;for(let b of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=b.index??0,T=b[0],P=t.get(T);if(!P||i.has(T))continue;let D=a.slice(0,v).trimEnd(),H=a.slice(v+T.length).trimStart();if(D.endsWith(".")||/^:(?!:)/.test(H)&&/[{,]$/.test(D))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(c,v)}(${No(P,t,n+1,new Set([...i,T]))})`,c=v+T.length}return l+e.slice(c)}function Xl(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 l=a[1];if(a.index===t){if(l==="elseif"){let b=i[i.length-1];if(b?.current)b.seen.push(b.current);if(b)b.current=null}break}if(l==="endif"||l==="endunless"){i.pop();continue}let c="";if(a[2]==="("){let b=0,v=a.index+a[0].length-1,T=v+1;for(;v<e.length;v++){let P=e[v];if(P==="(")b++;else if(P===")"){if(b--,b===0)break}}c=e.slice(T,v).trim(),n.lastIndex=v+1}if(l==="if")i.push({seen:[],current:c});else if(l==="unless")i.push({seen:[],current:`!(${c})`});else if(l==="elseif"||l==="else"){let b=i[i.length-1];if(!b)continue;if(b.current)b.seen.push(b.current);b.current=l==="elseif"?c:null}}return i.flatMap((l)=>[...l.seen.map((c)=>`!(${c})`),...l.current?[l.current]:[]]).filter(Boolean)}function Jl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(Zl.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 Gl=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Co(e,t){return Hs(e,t).code}function Hs(e,t){let n=new Map;if(!t)return{code:e,columns:n};let i=Lo(e),a=[],l=0;for(let c of e.matchAll(Gl)){let b=c.index,[v,T,P,D]=c,H=Ro.resolve(t,D).replace(/\\/g,"/"),O=`${T}${P}${H}${P}`;if(a.push(e.slice(l,b),O),l=b+v.length,v.includes(`
|
|
551
|
-
`))continue;let L=sr(i,b),F=n.get(L.line)??[],B=F.at(-1),ee=L.column+(B?B.generatedEnd-B.sourceEnd:0);F.push({sourceStart:L.column,sourceEnd:L.column+v.length,generatedStart:ee,generatedEnd:ee+O.length}),n.set(L.line,F)}return a.push(e.slice(l)),{code:a.join(""),columns:n}}function Yl(e,t,n){let i=_o(e.importColumns?.get(t)??[],n);return _o(e.scriptColumns?.get(t)??[],i)}function yi(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function Ql(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],l=/\{([^}]*)\}/.exec(a);for(let T of l?.[1].split(",")??[]){let P=T.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(P&&/^[A-Z_$][\w$]*$/i.test(P))t.add(P)}let c=a.replace(/\{[^}]*\}/,""),b=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(b)t.add(b[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(v&&v[1]!=="type")t.add(v[1])}return[...t].sort()}function Wc(e,t={}){let n=it(e),i=e.split(`
|
|
552
|
-
`),a=Array.from({length:i.length},()=>""),l=new Map,c=new Map,b=new Map,v=[],T=mi(n),P=t.filePath&&t.templateExpressions!==!1?ho(e,Qn(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(F,B)=>it(F).map((ee)=>Co(ee.code,Ro.dirname(B))).join(`
|
|
553
|
-
`)}):void 0,D=new Set,H=[];for(let[F,B]of n.entries()){let ee=gi(yi(B)+B.code,T,String(F));for(let[se,ne]of ee.columns)c.set(B.startLine+se-1,ne);for(let se of ee.declarations)v.push({text:Co(se.text,t.originDir??""),origin:se.origin?{...se.origin,line:se.origin.line+B.startLine-1}:void 0});let X=zs(ee.code),j=Hs(X,t.originDir??"");for(let[se,ne]of j.columns)b.set(B.startLine+se-1,ne);let te=j.code.split(`
|
|
554
|
-
`);te.forEach((se,ne)=>{let pe=B.startLine-1+ne;if(pe<a.length)a[pe]=se,D.add(pe)}),H.push(B.startLine-1+te.length-1)}for(let F of H){let B=a[F]?.trim()===""?F:F+1;if(B<a.length&&a[B].trim()===""&&(B===F||!D.has(B)))a[B]=";"}let O=(F,B)=>{for(let[ee,X]of F.split(`
|
|
555
|
-
`).entries())if(a.push(X),B)l.set(a.length,ee===0?B:{...B,line:B.line+ee,column:1,prefixLength:0})};for(let F of v)O(F.text,F.origin);if(t.globals!==!1){O("");let F=new Set([...n.flatMap((j)=>Le(j.code)),...n.flatMap((j)=>Ql(j.code))]),B=(j)=>{if(!F.has(j))O(`declare var ${j}: any`)};if(t.runtimeGlobals!==!1){if(!F.has("window"))O("declare var window: any");for(let j of k)B(j)}let ee=[...new Set([...nr,...ke,...ko])].filter((j)=>t.runtimeGlobals!==!1||!k.includes(j));if(t.contextScope==="global"){O("declare global {");for(let j of ee)O(` var ${j}: any`);O("}")}else{for(let j of nr)B(j);for(let j of ke)B(j);for(let j of ko)B(j)}O(`declare var ${tr}: any`);let X=new Set(n.flatMap((j)=>Le(j.code)));O(`type ${bo}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let j of Bl(e)){if(X.has(j.name))continue;let te=j.iterable&&X.has(j.iterable)?`${bo}<typeof ${j.iterable}>`:"any";O(`declare var ${j.name}: ${te}`)}}if(t.templateExpressions!==!1){if(P?.declarations)for(let B of P.declarations.split(`
|
|
556
|
-
`))O(B);let F=ug(e).map((B)=>{let ee=P?.events.get(B.offset??-1);if(ee){B.anchor=!0;let X=B.code.trim(),j=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(X),te=j?`void ((${j[2]}) satisfies __StxAssignedValue<typeof ${j[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(X)?`${X} satisfies (($event: ${ee}) => unknown)`:X,se=`;(($event: ${ee}): void => { `;return{expression:B,statement:{text:`${se}${te} });`,prefixLength:se.length}}}return{expression:B,statement:Jl(B)}}).filter((B)=>B.statement!==null);if(F.push(...P?.checks||[]),F.length>0){let B=Qn(e),ee=Gn(B),X=Kl(n.map((ne)=>ne.code)),te=[...new Set(n.flatMap((ne)=>Le(ne.code)))].filter((ne)=>/^[A-Z_$][\w$]*$/i.test(ne)),se=0;if(te.length>0){O(Dl);for(let ne of te)O(`function __StxRead_${ne}() { return ${ne} }`),O(`type __StxT_${ne} = ${Io}<ReturnType<typeof __StxRead_${ne}>>`);O(`;((${te.map((ne)=>`${ne}: __StxT_${ne}`).join(", ")}) => {`),se=1}for(let{expression:ne,statement:pe}of F){let ye=" ".repeat(se),de=ne.offset===void 0?[]:ee.filter((Ge)=>ne.offset>=Ge.start&&ne.offset<Ge.end),Ie=de.map((Ge)=>`;((${Ge.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ke=" });".repeat(de.length),Te=ne.offset===void 0?[]:Xl(B,ne.offset),Xe=Te.length>0?`${Te.map((Ge)=>`if (${No(Ge,X)}) `).join("")}{ `:"",Qe=Te.length>0?" }":"";O(ye+Ie+Xe+pe.text+Qe+Ke,{line:ne.line,column:ne.column,expression:ne,prefixLength:pe.prefixLength+ye.length+Ie.length+Xe.length,guardPrefixLength:ye.length+Ie.length+Xe.length})}if(se>0)O("});")}}let L=!1;if(t.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,L=!0;return O("export {}"),{text:a.join(`
|
|
557
|
-
`),lineMap:l,sourceLineCount:i.length,componentDependencies:P?.dependencies,referenced:L,scriptColumns:c,importColumns:b}}function Lo(e){let t=[0];for(let n=0;n<e.length;n++)if(e.charCodeAt(n)===10)t.push(n+1);return t}function sr(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 qc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function bi(e,t,n){let i=e.lineMap.get(t);if(!i)return t<=e.sourceLineCount?{line:t,column:Yl(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 ir=w(256),eu=[{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"}],zo=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function tu(e){let t=Array.from(e,(a)=>a===`
|
|
558
|
-
`?`
|
|
559
|
-
`:" "),n=0,i="";while(n<e.length){let a=e[n],l=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==="/"&&l==="/"){while(n<e.length&&e[n]!==`
|
|
560
|
-
`)t[n]=e[n],n++;continue}if(a==="/"&&l==="*"){let c=e.indexOf("*/",n+2),b=c===-1?e.length:c+2;for(;n<b;n++)t[n]=e[n];continue}if(a==="{"&&l==="{"&&e.slice(n,n+4)==="{{--"){let c=e.indexOf("--}}",n+4),b=c===-1?e.length:c+4;for(;n<b;n++)t[n]=e[n];continue}n++}return t.join("")}function nu(e){let t=new Map,n=tu(e).split(`
|
|
561
|
-
`),i=e.split(`
|
|
562
|
-
`);return n.forEach((a,l)=>{zo.lastIndex=0;for(let c of a.matchAll(zo)){let b=c[1]==="-next-line",v=(i[l]??"").slice(0,c.index).trim(),T=b||v===""?l+2:l+1,D=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),H=D.filter((L)=>/\w/.test(L));if(D.length>0&&H.length===0)continue;let O=t.get(T);if(O&&O.size===0)continue;if(H.length===0){t.set(T,new Set);continue}if(O)H.forEach((L)=>O.add(L));else t.set(T,new Set(H))}}),t}function su(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 Me(e,t,n,i){let a=typeof n==="boolean"?{enabled:n,failOnViolation:n}:n??{enabled:!1};if(!a.enabled)return;let l=S(e,t,i,JSON.stringify(a)),c=ir.get(l);if(c!==void 0){if(c&&a.failOnViolation)throw new K(c,i??t);return}let b=a.allowPatterns??[],v=nu(e),T=[],P=r(e.replace(/\{\{--[\s\S]*?--\}\}/g,(L)=>L.replace(/[^\n]/g," ")));for(let{pattern:L,message:F,suggestion:B}of eu){if(b.some((X)=>/\w/.test(X)&&F.includes(X)))continue;L.lastIndex=0;let ee=P.match(L);if(ee&&ee.length>0){let X=P.split(`
|
|
563
|
-
`),j=e.split(`
|
|
564
|
-
`),te=[];if(X.forEach((ye,de)=>{if(L.lastIndex=0,L.test(ye)&&!su(v,de+1,F))te.push(de+1)}),te.length===0&&X.some((ye)=>(L.lastIndex=0,L.test(ye))))continue;let se=te.length>0?` (script line${te.length>1?"s":""} ${te.join(", ")})`:"",ne=te.slice(0,3).map((ye)=>` ${ye} | ${(j[ye-1]??"").trim().slice(0,100)}`).join(`
|
|
565
|
-
`),pe=ne?`
|
|
566
|
-
${ne}`:"";T.push(` \u2717 ${F}${se}
|
|
567
|
-
\u2192 ${B}${pe}`)}}if(T.length===0){ir.set(l,"");return}let D=(L)=>{let F=`${process.cwd()}/`;return L.startsWith(F)?L.slice(F.length):L},O=`[STX] DOM API violation in ${i&&i!==t?`${D(i)} (composed into ${D(t)})`:D(t)}:
|
|
568
|
-
${T.join(`
|
|
569
|
-
`)}
|
|
570
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(ir.set(l,O),console.warn(O),a.failOnViolation)throw new K(O,i??t)}var ru=[{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"}],iu=[{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')"}],ou=[{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 vg(e){let t=[],n=[];return au(e,t),cu(e,t,n),lu(e,n),uu(e,t),{valid:t.length===0,errors:t,warnings:n}}function au(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 cu(e,t,n){for(let i of ru){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),l=new RegExp(i.close,"g"),c=(e.match(a)||[]).length,b=(e.match(l)||[]).length;if(i.altClose){let v=new RegExp(i.altClose,"g");b+=(e.match(v)||[]).length}if(c>b)t.push({type:"directive",message:`Unclosed @${i.name} directive: found ${c} opening and ${b} closing`,suggestion:`Add ${c-b} missing ${i.close} tag(s)`});else if(b>c)n.push({type:"directive",message:`Extra ${i.close} found: ${b-c} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function lu(e,t){for(let n of iu)if(n.pattern.test(e))t.push({type:"syntax",message:n.message,suggestion:n.suggestion})}function uu(e,t){for(let n of ou)if(n.pattern.test(e))t.push({type:"expression",message:`Security warning: ${n.message}`,suggestion:"Remove dangerous code from template expressions"})}function xg(e,t){let n=e.slice(0,t).split(`
|
|
571
|
-
`);return{line:n.length,column:n[n.length-1].length+1}}function Sg(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 kg(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 Bo(e,t,n){let i=/^<script\b([^>]*)>/i.exec(e);if(!i||!/(?:^|\s)src\s*=/i.test(i[1]??""))return null;return E(i[0],t,n)+e.slice(i[0].length)}var un=new R(500),cr=new Map;function Wo(e){try{let t=rs.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var ns=new R(1000),lr=new Map,ur=new R(2000),fr=new R(500),Jo=33554432,pr=Jo;function fu(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===pr)return;pr=t,ss.setMaxBytes(t)}var ss=new R(2000,{maxBytes:Jo,sizeOf:(e)=>e.output.length});function pu(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 l={};for(let c of Object.keys(i).sort())l[c]=n(i[c]);return l}finally{t.delete(i)}};return JSON.stringify(n(e))}catch{return null}}function du(e){let t={};for(let[n,i]of Object.entries(e))if(!n.startsWith("__")||n==="__stxServeContext")t[n]=i;return t}function or(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ks(e){let t=process.cwd(),n=`${t}\x00${e}`,i=Fo.get(n);if(i===void 0)i=Bun.hash(Go(e,t).split(le.sep).join("/")).toString(36).slice(0,6),Fo.set(n,i);return i}var Fo=new Map;function Go(e,t){if(!le.isAbsolute(e))return e;let n=(i)=>{try{return rs.realpathSync(i)}catch{return i}};return le.relative(n(t),n(e))}function Cg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Fe(e){return!Cg(e)}var ts=new Map;function Z(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let n=ts.get(t);if(n)return n;if(ts.size>=16)ts.clear();let i=new Bun.Transpiler(e);return ts.set(t,i),i}var Vo=new WeakMap,gu=256;function ze(e){try{let t=Z({loader:"ts",target:"browser",define:C()}),n=Vo.get(t);if(!n)n=new Map,Vo.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 l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`});let c=t.transformSync(a);for(let b=0;b<l.length;b++)c=c.replace(`"__STX_EXPR_${b}__"`,l[b]),c=c.replace(`'__STX_EXPR_${b}__'`,l[b]);if(n.size>=gu){let b=n.keys().next();if(!b.done)n.delete(b.value)}return n.set(e,c),c}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function mu(e){let t=[],n=new Set,i=0,a=0,l=e.length,c=(O)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===O){a++;return}a++}},b=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let O=1;while(a<l&&O>0)if(e[a]==="{")O++,a++;else if(e[a]==="}")O--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")b();else a++;continue}a++}},v=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
|
|
572
|
-
`)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<l-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},T=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),P=()=>{let O=a-1;while(O>=0&&/\s/.test(e[O]))O--;if(O<0)return!0;let L=e[O];if("(,=:[!&|?{};+-*%<>~^".includes(L))return!0;if(!/[\w$]/.test(L))return!1;let F=O;while(F>0&&/[\w$]/.test(e[F-1]))F--;return T.has(e.slice(F,O+1))},D=()=>{a++;let O=!1;while(a<l&&e[a]!==`
|
|
573
|
-
`){let L=e[a];if(L==="\\"){a+=2;continue}if(L==="[")O=!0;else if(L==="]")O=!1;else if(L==="/"&&!O){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},H=()=>{if(i!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let ee=O[2].split(",").map((X)=>{let j=X.trim().split(":");return j[j.length-1].trim()});for(let X of ee)if(X&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(X)&&!n.has(X))t.push(X),n.add(X);return}let L=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(L){let ee=L[2];if(!n.has(ee))t.push(ee),n.add(ee);return}let F=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let ee=F[1];if(!n.has(ee))t.push(ee),n.add(ee);return}let B=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let ee=B[1];if(!n.has(ee))t.push(ee),n.add(ee)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){b();continue}if(e[a]==="/"&&P()){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])))H();a++}return t}function hu(e){let t=[],n=0,i=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(c===","&&n===0)t.push(e.slice(i,l)),i=l+1}if(i<e.length)t.push(e.slice(i));return t}function xu(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 l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function bu(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,l=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=i;break}}}if(c===-1)return;let b=e.slice(c+1,a);for(let v of hu(b)){let T=v.trim();if(!T||T.startsWith("..."))continue;let P=xu(T);if(P===-1)continue;let D=T.slice(0,P).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(t[D]!==void 0)continue;let H=T.slice(P+1).trim();if(!H)continue;try{let O=Object.keys(t).filter(zt),L=Function(...O,`"use strict"; return (${H});`);t[D]=L(...O.map((F)=>t[F]))}catch{}}}catch{}}var yu=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Eg(e,t){let n=Ot(e),i=e.slice(n).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!i)return null;let a=i[1].toLowerCase();if(!yu.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),c=y(e,(P,D)=>(l.lastIndex=D,l.exec(P)?.index===D?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(c[0]?.token||""))return null;let b=0,v=!1;for(let P of c){if(b+=P.token.startsWith("</")?-1:1,b<0)return null;if(b===0){if(e.slice(P.end).trim())return null;v=!0;break}}if(!v)return null;let T=n+i[0].length;return e.slice(0,T)+t+e.slice(T)}function Yo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((i)=>{let a=le.relative(le.resolve(i),le.resolve(e));return!a.startsWith("..")&&!le.isAbsolute(a)})}async function Rr(e,t,n,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(ne)=>ne.split("-").map((pe)=>pe.charAt(0).toUpperCase()+pe.slice(1)).join(""),b=n.__importedComponents;if(b){for(let ne of[l,l.toLowerCase(),c(l),U(l)])if(b.has(ne))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${U(l)}.stx`])],T=typeof a.root==="string"?le.resolve(a.root):void 0,P=T??le.dirname(i),D=[],H=(ne)=>{if(ne&&!D.includes(ne))D.push(ne)};for(let ne of Ln(i,T))H(ne);let O=n.__originalFilePath;if(O)H(le.join(le.dirname(O),"components"));if(Yo(t,a))H(a._rootComponentsDir);H(t),H(a._rootComponentsDir),H(le.join(le.dirname(i),"components")),H(a.componentsDir);for(let ne of a.additionalComponentsDirs??[])H(ne);let L=a._targetComponentFallbackNames?.some((ne)=>ne.toLowerCase()===l.toLowerCase());if(!L)for(let ne of a._targetComponentDirs??[])H(ne);if(T)H(le.resolve(T,"resources/views/components")),H(le.resolve(T,"resources/components")),H(le.resolve(T,"src/components")),H(le.resolve(T,"components"));for(let ne of a._layerComponentDirs??[])H(ne);let F=a._pluginComponentDirs;if(Array.isArray(F))for(let ne of F)H(typeof ne==="string"?ne:null);if(H(a.fallbackComponentsDir),L)for(let ne of a._targetComponentDirs??[])H(ne);let B=a._nativePrimitivesFallback;if(B&&!B.except.some((ne)=>ne.toLowerCase()===l.toLowerCase()))H(B.dir);if(l.startsWith("./")||l.startsWith("../"))return s(le.resolve(le.dirname(i),`${l}.stx`));let ee=Uo(le.resolve(import.meta.dir,"components")),X=D.map((ne)=>le.isAbsolute(ne)?ne:le.resolve(P,ne)),j=`${v.join("\x00")}\x00\x00${X.join("\x00")}`,te=ur.get(j);if(te!==void 0)return te;let se=!1;e:for(let ne of X){if(Uo(ne)===ee)continue;for(let pe of v)if(await s(le.join(ne,pe))){se=!0;break e}}return ur.set(j,se),se}function Uo(e){let t=fr.get(e);if(t!==void 0)return t;let n=e;try{n=rs.realpathSync(e)}catch{}return fr.set(e,n),n}function Tg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function ol(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 _u(e,t,n){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=A(a,t)}catch{return l}if(c===void 0||c===null)return"";let b=String(c);if(/<\/style/i.test(b))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 b};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var Ho=new Set;function qo(e,t,n,i){let a=`${e}\x00${t}\x00${i??""}`;if(!process.env.STX_DEBUG&&Ho.has(a))return;Ho.add(a);let l=t?` used in ${t}`:"",c=i?` Cause: ${i}.`:"",b=n.length>0?`
|
|
574
|
-
searched:
|
|
575
|
-
${n.map((v)=>` - ${v}`).join(`
|
|
576
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Zo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var wu=new Set(["for","if","show","key","ref","class","className","style"]),Ko=new Set,Qo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",il=new RegExp(`\\b(?:${Qo})\\s*(?:<[^>]*>)?\\s*\\(`);function _i(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|${Qo})\\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 He(e,t,n,i,a,l,c,b=new Set,v,T=ot(a),P,D=e){let{extractVariables:H}=await o("stx/variable-extractor",()=>import("./chunk-sy703233.js")),O=b??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let L=new Set(O);L.add(e);let F=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let B=F&&F!=="load"&&Tg(F)?F:"";try{let ee=(ie)=>ie.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),X=D.endsWith(".stx")?D.slice(0,-4):D,j=null,te=a.__importedComponents;if(te){let ie=[X,X.toLowerCase(),ee(X),U(X)];for(let ue of ie)if(te.has(ue)){j=te.get(ue);break}}let se=[];if(!j){let ie=[`${X}.stx`,`${ee(X)}.stx`,`${U(X)}.stx`],ue=[...new Set(ie)],$e=a.__originalFilePath,be=[];for(let we of Ln(l))if(!be.includes(we))be.push(we);let Je=be.length;for(let we of c._layerComponentDirs??[])if(!be.includes(we))be.push(we);if($e){let we=le.join(le.dirname($e),"components");be.push(we)}let Ae=c._rootComponentsDir;if(typeof Ae==="string"&&Yo(i,c)&&!be.includes(Ae))be.push(Ae);if(i&&!be.includes(i))be.push(i);if(typeof Ae==="string"&&!be.includes(Ae))be.push(Ae);let ht=le.join(le.dirname(l),"components");if(!be.includes(ht))be.push(ht);if(c.componentsDir&&c.componentsDir!==i&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let we of c.additionalComponentsDirs??[])if(we&&!be.includes(we))be.push(we);let Ct=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(X),yt=(P?.events??[]).map((we)=>we.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(P?.reactiveProps?.includes("checked")),fs=Object.hasOwn(t,"value")||Boolean(P?.reactiveProps?.includes("value")),ps=!yt.includes("valuechange")&&(Rn||yt.includes("change")&&!fs),St=c._nativeHostAttrs&&/^textinput$/i.test(X),Rt=yt.includes("update:value")&&!yt.includes("input"),en=c._nativeHostAttrs&&/^video$/i.test(X),ds=c._nativeHostAttrs&&/^image$/i.test(X),Tn=Bs([...Object.keys(t),...P?.reactiveProps??[]],P?.events,t),Tt=Object.hasOwn(t,"src")||Boolean(P?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(P?.reactiveProps?.includes("source")),In=en&&(Tt||An)&&(P?.events??[]).every((we)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(we.replace(/^@/,"").split(".")[0])),Pn=new Set(["","primary","secondary","outline","ghost","danger"]),On=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Dn=c._nativeHostAttrs&&/^button$/i.test(X)&&!Pn.has(On),wr=c._targetComponentFallbackNames?.some((we)=>we.toLowerCase()===X.toLowerCase())??!1,gs=wr&&(!Ct||ps)&&(!St||Rt)&&(!en||In)&&(!ds||Tn)&&!Dn;for(let we of gs?[]:c._targetComponentDirs??[])if(we&&!be.includes(we))be.push(we);let At=typeof c.root==="string"?le.resolve(c.root):void 0,vr=At??le.dirname(l),Pt=[];if(At)Pt.push(le.resolve(At,"resources/views/components")),Pt.push(le.resolve(At,"resources/components")),Pt.push(le.resolve(At,"src/components")),Pt.push(le.resolve(At,"components"));Pt.push(le.resolve(import.meta.dir,"components"));for(let we of Pt)if(!be.includes(we))be.push(we);if(wr){let we=(c._componentPackageDirs??[]).filter((et)=>typeof et==="string"&&et.length>0),xt=(gs?we.length?we:c._pluginComponentDirs??[]:c._targetComponentDirs??[]).filter((et)=>typeof et==="string"&&et.length>0);if(xt.length){let et=be.slice(Je).map((Ye)=>le.isAbsolute(Ye)?Ye:le.resolve(vr,Ye)).filter((Ye)=>!xt.includes(Ye)),jn=`${X}\x00${et.join("\x00")}`,ct=lr.get(jn);if(ct===void 0){ct=!1;for(let Ye of et){for(let $t of ue)if(await s(le.join(Ye,$t))){ct=!0;break}if(ct)break}lr.set(jn,ct)}if(!ct){for(let Ye of xt){let $t=be.indexOf(Ye);if($t>=0)be.splice($t,1)}be.splice(Je,0,...xt)}}}let Ar=c._pluginComponentDirs;if(Array.isArray(Ar)){for(let we of Ar)if(typeof we==="string"&&!be.includes(we))be.push(we)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(gs){for(let we of c._targetComponentDirs??[])if(we&&!be.includes(we))be.push(we)}let Mn=c._nativePrimitivesFallback;if(Mn&&!Mn.except.some((we)=>we.toLowerCase()===X.toLowerCase())&&!be.includes(Mn.dir))be.push(Mn.dir);let Ir=[...new Set(be.map((we)=>{if(!we)return we;return le.isAbsolute(we)?we:le.resolve(vr,we)}))];be.length=0,be.push(...Ir);let ms=`${X}\x00${l}\x00${Ir.join("\x00")}`,hs=ns.get(ms);if(hs)if(await s(hs))j=hs;else ns.delete(ms);if(!j&&(X.startsWith("./")||X.startsWith("../")))j=le.resolve(le.dirname(l),`${X}.stx`),se.push(j);else if(!j)for(let we of be){if(!we)continue;for(let xt of ue){let et=le.join(we,xt);if(se.push(et),await s(et)){j=et;break}}if(j)break;if(!j)try{let xt=await import("fs");if(!xt.statSync(we,{throwIfNoEntry:!1})?.isDirectory())continue;let jn=8,ct=[{path:we,depth:0}];while(ct.length>0&&!j){let Ye=ct.pop();if(Ye.depth>=jn)continue;let $t;try{$t=xt.readdirSync(Ye.path,{withFileTypes:!0})}catch{continue}for(let Nn of $t){if(!Nn.isDirectory())continue;if(Nn.name==="node_modules"||Nn.name.startsWith("."))continue;let Pr=le.join(Ye.path,Nn.name);for(let da of ue){let xs=le.join(Pr,da);if(se.push(xs),await s(xs)){j=xs;break}}if(j)break;ct.push({path:Pr,depth:Ye.depth+1})}}}catch{}if(j)break}if(j)ns.set(ms,j)}if(!j||!await s(j))return qo(e,l,se),Zo(e);v.add(j);let ne;if(un.has(j)&&cr.get(j)===Wo(j))ne=un.get(j);else try{let ie=Wo(j);ne=await Bun.file(j).text(),un.set(j,ne),cr.set(j,ie)}catch(ie){let ue=ie instanceof Error?ie.message:String(ie);return qo(e,l,[j],ue),Zo(e)}if(P)for(let ie of new Set([...Object.keys(t),...P.reactiveProps??[]])){let ue=ie.toLowerCase();if(ue.startsWith("aria-")||ue.startsWith("data-"))continue;let $e=ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${$e}\\b`).test(ne))P.declaredProps.add(ie);if(new RegExp(`\\$props\\s*(?:\\.\\s*${$e}\\b|\\[\\s*['"]${$e}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${$e}['"]`).test(ne))P.consumedProps?.add(ie)}if(P?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(ne))for(let ie of P.reactiveProps){if(wu.has(ie)||P.consumedProps?.has(ie))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(ne))continue;let ue=`${j}\x00${ie}`;if(Ko.has(ue))continue;Ko.add(ue),console.warn(`[stx] ${le.basename(j)} reads \`${ie}\` with defineProps(), which is not live, but ${le.basename(l)} binds it (:${ie}): 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('${ie}').`)}let pe=new Set(["__originalFilePath","__importedComponents",Un,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),ye={};for(let[ie,ue]of Object.entries(a))if(!ie.startsWith("__")||pe.has(ie))ye[ie]=ue;let de=T.length>0?{[Jn]:[...T]}:{},Ie=n;if(n.includes("@include")){let{processIncludes:ie}=await o("stx/includes",()=>import("./chunk-1p47cg0g.js"));Ie=await ie(n,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ie)){let{processComponents:ie}=await o("stx/component-renderer",()=>import("./chunk-y54pj23g.js")),ue={...a,__processedComponents:O,...de};Ie=await ie(Ie,ue,l,c,v);let $e=ue.__stx_preserved_client_expressions;if(Array.isArray($e)&&$e.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...$e])]}let Ke=[];if(ol(Ie)){let{processExpressions:ie}=await o("stx/expressions",()=>import("./chunk-v3r1wwec.js")),ue=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...de}:T.length>0?{...a,...de}:a;Ie=ie(Ie,ue,l);for(let $e of Ie.matchAll(/\{\{([\s\S]*?)\}\}/g))Ke.push($e[1].trim())}let Te=J(Ie),Xe=[],Qe=Te.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ie,ue)=>{let $e=Te.scripts[Number(ue)]||"",be=$e.match(/^<script\b([^>]*)>/i)?.[1]||"",Je=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ae=!Je||["module","text/javascript","application/javascript"].includes(Je),ht=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Ae&&!ht)return Xe.push($e),"";return $e}),{extractSlotContent:Ge}=await o("stx/slots",()=>import("./chunk-sxvv9w8t.js")),rt=Ge(Qe),tt={};if(rt.defaultSlot?.trim())tt.default=rt.defaultSlot;for(let[ie,ue]of rt.namedSlots)tt[ie]=ue.content;let wt=a.__stx_scope_seq??={n:0,key:Ks(String(a.__filename??l))},Ut=Go(e,process.cwd()),ft=`stx_${(Ut.endsWith(".stx")?Ut.slice(0,-4):Ut).replace(/[^a-zA-Z0-9]/g,"_")}_${++wt.n}_${wt.key}`,Ue={...ye,$uid:ft,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Qe,$slots:tt,__processedComponents:L,__sections:{},__stx_signals_gate:_e(ne)||ol(n),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Ke]};if(/import\s/.test(ne)){Ue.__importedComponents=new Map(Ue.__importedComponents);let{processESImports:ie}=await o("stx/component-renderer",()=>import("./chunk-y54pj23g.js"));ne=await ie(ne,Ue,j,c,v)}bu(ne,Ue);let Ht=ne,pn=fe(Ht);if(pn)Ht=pn.content.trim();let os=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,qt=[...ne.matchAll(os)];for(let[,ie,ue]of qt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ie))Me(ue,j,c.strict);let nt=[],Zt=null,as=qt.some((ie)=>/\bserver\b/.test(ie[1]||"")&&/\bcache\b/.test(ie[1]||"")),kt=null,pt=null,Kt=null,dn=0,Xt=null;if(fu(c),as&&pr>0){let ie=pu({props:t,slot:Ie,slotContext:n.trim()?du(ye):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...T].sort(),layers:c._layerGraph?.layers.map((ue)=>ue.configFile),uid:ft});if(ie!==null){kt=`${j}\x00${S(ne)}\x00${ie}`;let ue=ss.get(kt);if(ue){for(let $e of ue.dependencies)v.add($e);if($i(a,ue.clientFactories),wt.n+=ue.uidsConsumed,ue.preservedClientExpressions.length>0){let $e=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of ue.preservedClientExpressions)$e.add(be);a.__stx_preserved_client_expressions=[...$e]}return ue.output}pt=new Set(v),Kt=ci(a),dn=wt.n,Xt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Jt=new Set;for(let ie of qt){let ue=ie[1]||"",$e=ie[2]||"",be=ue.includes("server");if(Fe(ue)&&$e.trim())$e=ze($e);if(be&&$e){for(let Ae of Le($e))Jt.add(Ae);try{await H($e,Ue,j,{onFailure:(Ae)=>{if(Ae.kind!=="unknown")Zt=Ae.kind}})}catch(Ae){}}if(!be){let Ae=$e.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ht=Ae.includes("{{")&&Ae.includes("}}"),Ct=Ae.includes("{!!")&&Ae.includes("!!}");if(ht||Ct)Ae=Ei(Ae,Ue,j);let yt=ue.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");nt.push(`<script${yt}>${Ae}</script>`)}}let st=J(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Gt=st?st[1]:"",cs=st?st[2]:"",dt="",re=Gt&&/\bscoped\b/i.test(Gt);if(st)dt=`<style${Gt}>${_u(cs,Ue,j)}</style>`;let oe=Ht;if(oe=oe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),st)oe=oe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ie=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ue=[];if(oe=oe.replace(ie,($e,be)=>{let Je=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Je)ue.push(`<style${Je[1]}>${Je[2]}</style>`);return""}),oe=oe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ue.length>0)dt=`${dt}${ue.join(`
|
|
577
|
-
`)}`}if(n&&oe.includes("{{ text || slot }}"))oe=oe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>n);let{applySlots:xe}=await o("stx/slots",()=>import("./chunk-sxvv9w8t.js")),{defaultSlot:ve,namedSlots:Pe}=rt,qe=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Qe),at=nt.length>0&&Zs(oe)||c._nativeHostAttrs===!0&&nt.length>0||qe&&nt.length>0||nt.some((ie)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ie)),ls=(ie)=>at?uo(ie,ft):ie,us=new Map([...Pe].map(([ie,ue])=>[ie,{...ue,content:ls(ue.content)}]));oe=await xe(oe,at?lo(ls(ve),ft):ve,us,Ue,at?ft:"");let gn=_i(nt),Yt=(Array.isArray(Ue.__stx_client_signal_names)?Ue.__stx_client_signal_names:[]).filter((ie)=>!Jt.has(ie));if(gn.length>0||Yt.length>0)Ue.__stx_client_signal_names=[...new Set([...Yt,...gn])];else delete Ue.__stx_client_signal_names;let Qt=T.filter((ie)=>!Jt.has(ie)&&!(ie in t));if(Qt.length>0)Ue[Jn]=Qt;let $n={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:le.dirname(j),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||at||nt.length===0,defaultLayout:void 0};Ue.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:En}=await o("stx/process",()=>import("./chunk-ykxpzjgy.js")),gt=await En(oe,Ue,j,$n,v),bt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let ie of gt.matchAll(/\{\{([\s\S]*?)\}\}/g))bt.add(ie[1].trim());if(bt.size>0)a.__stx_preserved_client_expressions=[...bt];let mt=ft,Ze=gt;if(at){let ie="";if(Object.keys(t).length>0)try{ie=` data-stx-props="${or(JSON.stringify(t))}"`}catch{}let ue=B?` stx-hydrate="${or(B)}"`:"",$e=Object.fromEntries(Object.entries(tt).map(([St,Rt])=>[St,Boolean(Rt)])),be=Object.keys($e).length>0?` data-stx-slots="${or(JSON.stringify($e))}"`:"",Je=` data-stx-scope="${mt}"${ie}${be}${ue}`,Ae=gt.slice(Ot(gt)),ht=/^<span(?=[\s/>])/i.test(Ae),Ct=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Ae),yt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Ae),Rn=ht?"span":"div",fs=Ct&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':yt&&c._nativeHostAttrs?' style="width:100%;height:100%"':ht||Ct?' style="display:contents"':"";Ze=Eg(gt,Je)??`<${Rn}${Je} data-stx-component-wrapper${fs}>${gt}</${Rn}>`;let ps=await Promise.all(nt.map(async(St)=>{let Rt=St.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Rt)return St;let[,en,ds]=Rt,Tn=Bo(St,Ue,j);if(Tn!==null)return Tn;let Tt=await $u(ds,j,c.buildMode==="compile"),An=vn(Tt.clientCode,je(Ue)),{vendorStyleTags:In}=Tt,Pn=An?`function(__scopeId) {
|
|
578
|
-
${An}
|
|
579
|
-
return (${Tt.factoryBody})(__scopeId);
|
|
580
|
-
}`:Tt.factoryBody,On=B?null:Rs(a,Pn),Dn=On?`window.__stxComponentFactories[${JSON.stringify(On)}](${JSON.stringify(mt)});`:`(${Pn})(${JSON.stringify(mt)});`;if(B)return`${In}<script type="stx/island" data-stx-island="${mt}" data-stx-scoped data-stx-owner="${mt}"${en}>${ae(Dn)}</script>`;return`${In}<script data-stx-scoped data-stx-run="always" data-stx-owner="${mt}"${en}>${ae(Dn)}</script>`}));if(Ze=Ze+`
|
|
581
|
-
`+ps.join(`
|
|
582
|
-
`),dt)Ze+=`
|
|
583
|
-
`+dt}else{if(dt)Ze+=`
|
|
584
|
-
`+dt;if(nt.length>0){let ie=Ue.__stx_event_bindings||[],ue=je(Ue),$e=await Promise.all(nt.map(async(be)=>{let Je=Bo(be,Ue,j);if(Je!==null)return Je;let Ae=be.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Ae)return be;return await Be(Ae[1],{eventBindings:ie,templateContent:Ze,filePath:j,projectRoot:process.cwd(),serverData:ue,instanceId:ft})}));Ze+=`
|
|
585
|
-
`+$e.join(`
|
|
586
|
-
`),Ue.__stx_event_bindings=[]}}if(re){let ie=Vs(Ze,j);if(ie.hasScoped)Ze=ie.html}if(kt&&pt){let ie=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];ss.set(kt,{output:Ze,dependencies:[...v].filter((ue)=>!pt.has(ue)),clientFactories:Kt?li(a,Kt):[],uidsConsumed:wt.n-dn,preservedClientExpressions:Xt?ie.filter((ue)=>!Xt.has(ue)):[]})}if(Zt)Ze=`<!--stx-render-failed:${Zt}-->${Ze}`;return Xe.length>0?`${Ze}
|
|
587
|
-
${Xe.join(`
|
|
588
|
-
`)}`:Ze}catch(ee){if(ee instanceof K)throw ee;return`[Error processing component: ${ee instanceof Error?ee.message:String(ee)}]`}finally{O.delete(e)}}async function s(e){return Bun.file(e).exists()}function dr(e,t){let n=le.resolve(t),i=le.resolve(e),a=n.endsWith(le.sep)?n:n+le.sep;if(i===n||i.startsWith(a))return i;return null}async function Xo(e,t,n,i){let a=t.startsWith("layouts/")?t.slice(8):t,l=le.join(e,a);for(let c of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await s(c)){if(i)console.log(`Found layout in ${e}: ${c}`);return n?.add(c),c}return null}async function xn(e,t,n,i){let a=await Su(e,t,n,i);if(a===null)return null;let l=dr(a,process.cwd());if(l)return l;let c=[n.root,n.layoutsDir,n.fallbackLayoutsDir,n.componentsDir,n.partialsDir,n.pagesDir,...n._layerLayoutDirs??[]].filter((b)=>typeof b==="string"&&b.length>0);for(let b of c){let v=le.isAbsolute(b)?b:le.resolve(process.cwd(),b);if(dr(a,v))return le.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${t})`),null}async function Su(e,t,n,i){if(n.debug)console.log(`Resolving template path: ${e} from ${t}`);let a=le.dirname(t),l=process.cwd();if(e.startsWith("/")){let O=le.join(l,e),L=dr(O,l);if(!L)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(n.debug)console.log(`Checking absolute path: ${L}`);if(await s(L)&&i)i.add(L);return L}let c=async(O)=>{if(!n.layoutsDir||!n.fallbackLayoutsDir)return O;let L=le.relative(le.resolve(l,n.fallbackLayoutsDir),O);if(L.startsWith("..")||le.isAbsolute(L))return O;return await Xo(le.resolve(l,n.layoutsDir),e,i,n.debug)??O},b=le.join(a,e);if(await s(b)){if(n.debug)console.log(`Found direct path: ${b}`);let O=await c(b);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 L=`${b}${O}`;if(await s(L)){if(n.debug)console.log(`Found direct path with extension: ${L}`);let F=await c(L);if(i)i.add(F);return F}}let v=[];if(v.push(...n._layerLayoutDirs??[]),n.layoutsDir)v.push(le.isAbsolute(n.layoutsDir)?n.layoutsDir:le.resolve(process.cwd(),n.layoutsDir));let T=le.resolve(a),P=process.cwd();for(let O=0;O<10;O++){let L=le.join(T,"layouts"),F=!1;try{F=rs.statSync(L,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(F){v.push(L);break}let B=le.dirname(T);if(B===T||B.length<P.length)break;T=B}for(let O of v){let L=await Xo(O,e,i,n.debug);if(L)return L}if(n.fallbackLayoutsDir){let O=le.isAbsolute(n.fallbackLayoutsDir)?n.fallbackLayoutsDir:le.resolve(process.cwd(),n.fallbackLayoutsDir),L=e.startsWith("layouts/")?e.slice(8):e,F=[le.join(O,L)];if(!e.endsWith(".stx"))F.push(`${F[0]}.stx`);for(let B of F)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/"),L=le.join(n.partialsDir||a,"layouts",O[1]);if(await s(L)){if(n.debug)console.log(`Found in layouts path: ${L}`);if(i)i.add(L);return L}if(!L.endsWith(".stx")){let F=`${L}.stx`;if(await s(F)){if(n.debug)console.log(`Found in layouts path with extension: ${F}`);if(i)i.add(F);return F}}}if(n.partialsDir){let O=le.join(n.partialsDir,"layouts");if(await s(O)){let L=le.join(O,e);if(await s(L)){if(n.debug)console.log(`Found in partials layouts dir: ${L}`);if(i)i.add(L);return L}if(!e.endsWith(".stx")){let F=`${L}.stx`;if(await s(F)){if(n.debug)console.log(`Found in partials layouts dir with extension: ${F}`);if(i)i.add(F);return F}}}}let D=n.partialsDir||le.join(process.cwd(),"views"),H=le.join(D,e);if(await s(H)){if(n.debug)console.log(`Found in views path: ${H}`);if(i)i.add(H);return H}if(!e.endsWith(".stx")){let O=`${H}.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=le.join(le.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 L=`${O}.stx`;if(await s(L)){if(n.debug)console.log(`Found in temp layouts dir with extension: ${L}`);if(i)i.add(L);return L}}}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 al(e,t,n){let i=0,a="",l="";try{if(typeof t==="number"&&t>=0){let c=e.split(`
|
|
589
|
-
`),b=0;for(let v=0;v<c.length;v++)if(b+=c[v].length+1,b>=t){i=v+1,a=c[v].trim();let T=Math.max(0,v-2),P=Math.min(c.length,v+3);l=c.slice(T,P).map((D,H)=>{let O=T+H+1;return`${O===i?"> ":" "}${O}: ${D}`}).join(`
|
|
590
|
-
`);break}}else if(n){let c=e.indexOf(n);if(c>=0)return al(e,c)}}catch{}return{lineNumber:i,lineContent:a,context:l}}var Re={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function m(e,t,n,i,a,l){let{lineNumber:c,context:b}=al(i,a,l),v=n.split("/").pop(),T=0;if(typeof a==="number"&&a>=0&&i){let D=i.lastIndexOf(`
|
|
591
|
-
`,Math.max(0,a-1));T=a-(D+1)+1}let P="";if(c>0)P+=`
|
|
592
|
-
${n}:${c}${T>0?`:${T}`:""}: ${e.toLowerCase()} error: ${t}
|
|
593
|
-
`;if(P+=`
|
|
594
|
-
${Re.bold}${Re.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${Re.reset}
|
|
595
|
-
`,P+=`${Re.bold}${Re.red}\u2502${Re.reset} ${Re.bold}${Re.bgRed} ERROR ${Re.reset} ${Re.red}${e} Error${Re.reset}${" ".repeat(Math.max(0,43-e.length))}${Re.bold}${Re.red}\u2502${Re.reset}
|
|
596
|
-
`,P+=`${Re.bold}${Re.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${Re.reset}
|
|
597
|
-
`,P+=`
|
|
598
|
-
${Re.cyan}${Re.bold}File:${Re.reset} ${Re.dim}${v}${Re.reset}`,c>0)P+=` ${Re.gray}(line ${c}${T>0?`, col ${T}`:""})${Re.reset}`;if(P+=`
|
|
599
|
-
${Re.yellow}${Re.bold}Message:${Re.reset} ${t}
|
|
600
|
-
`,b)P+=`
|
|
601
|
-
${Re.blue}${Re.bold}Context:${Re.reset}
|
|
602
|
-
${Re.dim}${b}${Re.reset}
|
|
603
|
-
`;return P}function me(){un.clear(),cr.clear(),ns.clear(),lr.clear(),ur.clear(),fr.clear(),ss.clear()}function uy(){return{size:un.size,maxSize:500}}var ar=w(128);async function $u(e,t,n){let i=S(e,t,n),a=ar.get(i);if(a){if(Fs(a.deps))return a;ar.delete(i)}let l=Si(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=ki(l.styles);c=jt(c).code;let{hasUserImports:v,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-xhnpgey5.js")),P=[],D=!1;if(v(c)){let X=c;c=await T(X,t,{projectRoot:process.cwd(),minify:n,collectInputs:P}),D=c===X}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-1z46g29d.js"));c=H(c);let O=I(c),L=mu(O),F=new Set(V(O,!0).split(",").map((X)=>X.trim())),B=`function(__scopeId) {
|
|
604
|
-
${ut("const",[...vl,...L],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
|
-
${L.map((X)=>F.has(X)?`Object.defineProperty(__localVars, '${X}', ${Ms(X)});`:`if (typeof ${X} !== 'undefined') __localVars['${X}'] = ${X};`).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
|
-
}`,ee={vendorStyleTags:b,factoryBody:B,clientCode:O,deps:Sr([...P,...l.styles.map((X)=>X.resolvedPath)])};if(!D&&l.unresolved.length===0)ar.set(i,ee);return ee}var wn=["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 vu=100,Eu=599,mr="__stxResponseStatus",fn="__stxResponseHeaders";function is(e){return typeof e==="number"&&Number.isInteger(e)&&e>=vu&&e<=Eu}function yn(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(is(i))return i}return}function gr(e,t){if(!e||typeof e!=="object")return!1;let n=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!is(n))return!1;return e[mr]=n,!0}function ku(e,t,n){if(!e||typeof e!=="object")return;let i=String(t??"").trim();if(!i)return;e[fn]={...e[fn],[i]:String(n)}}function Dt(e){let t=e?.[mr];return is(t)?t:void 0}function Lt(e){let t=e?.[fn];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 Kc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let n=Dt(e);if(n!==void 0)t[mr]=n;let i=Lt(e);if(i)t[fn]={...t[fn],...i}}function Us(e){return{setResponseStatus:(t)=>{gr(e,t)},notFound:(t=404)=>{let n=is(t)&&t>=400?t:404;gr(e,n)},setResponseHeader:(t,n)=>{ku(e,t,n)}}}function Gc(e,t,n={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=n,l=a==="compile",c="",b=0,v=/@status\s*\(/g,T;while((T=v.exec(e))!==null){let P=Cu(e,T.index+T[0].length-1);if(P<0)break;let D=e.slice(T.index+T[0].length,P).trim(),H=/^\d+$/.test(D)?Number(D):u(D,t),O=i?` in ${i}`:"";if(l)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(!gr(t,H))console.warn(`[stx] @status(${D})${O} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(b,T.index),b=P+1+(e.slice(P+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=b}return b===0?e:c+e.slice(b)}function Cu(e,t){let n=1,i=null,a=!1;for(let l=t+1;l<e.length;l++){let c=e[l];if(a){a=!1;continue}if(i){if(c==="\\")a=!0;else if(c===i)i=null;continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="(")n++;else if(c===")"&&--n===0)return l}return-1}var ea=new Set(wn),Ru=new Set(["props","$props","defineProps"]),Tu=new Set(["stx","@stacksjs/stx"]),ta=w(128),na=w(64);function Au(e){let t=[],n=0,i=e.split(`
|
|
693
|
-
`);for(let a of i){let l=n,c=null,b=!1;for(let v=0;v<a.length;v++){let T=a[v];if(b){b=!1;continue}if(T==="\\"){b=!0;continue}if(c){if(T===c)c=null;continue}if(T==="'"||T==='"'||T==="`"){c=T;continue}if(T==="/"&&v+1<a.length&&a[v+1]==="/")break;if(T==="{")n++;else if(T==="}")n--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)t.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let T=a.match(/(?:const|let|var)\s+(\w+)/);if(T)t.push(T[1])}else{let T=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(T){let D=T[1].slice(1,-1).split(",").map((H)=>{let O=H.split(":");return(O.length>1?O[1]:O[0]).trim()}).filter((H)=>/^\w+$/.test(H));t.push(...D)}}}}return[...new Set(t)]}function dg(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=[],l="",c=0,b=0,v=null;for(let T=0;T<i.length;T++){let P=i[T];if(v){if(l+=P,P===v)v=null;continue}if(P==='"'||P==="'"||P==="`"){v=P,l+=P;continue}if(P==="<")c++;else if(P===">"&&c>0)c--;else if(P==="(")b++;else if(P===")")b--;if(P===","&&c===0&&b===0){a.push(l),l="";continue}l+=P}if(l)a.push(l);return a.map((T)=>{let P=T.trim(),D=P.startsWith("..."),H=D?P.slice(3):P,O=-1,L=0;for(let se=0;se<H.length;se++)if(H[se]==="<")L++;else if(H[se]===">")L--;else if(H[se]===":"&&L===0){O=se;break}if(O===-1)return T;let B=H.substring(0,O).trim().replace(/\?$/,""),ee=H.substring(O+1),X=-1,j=0;for(let se=0;se<ee.length;se++)if(ee[se]==="<")j++;else if(ee[se]===">")j--;else if(ee[se]==="="&&j===0){X=se;break}let te=D?"...":"";if(X!==-1)return`${te}${B} = ${ee.substring(X+1).trim()}`;return`${te}${B}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,l)=>{if(!l.includes(":"))return i;return`${a}(${n(l)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=i.exec(t))!==null){let c=a.index+a[0].length-1,b=1,v=c+1,T=0,P=null;while(v<t.length&&b>0){let O=t[v];if(P){if(O===P)P=null;v++;continue}if(O==='"'||O==="'"||O==="`"){P=O,v++;continue}if(O==="<")T++;else if(O===">"&&T>0)T--;else if(T===0){if(O==="(")b++;else if(O===")")b--}if(b>0)v++}if(b!==0)continue;let D=t.substring(c+1,v);if(!D.includes(":"))continue;let H=n(D);l.push({start:c+1,end:v,replacement:H})}for(let c=l.length-1;c>=0;c--){let{start:b,end:v,replacement:T}=l[c];t=t.substring(0,b)+T+t.substring(v)}}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((c)=>{let[b,...v]=c.split("="),T=b.split(":")[0].trim();if(v.length>0)return`${T} = ${v.join("=").trim()}`;return T}).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 pg(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...n)=>{let[,i,a]=n,l=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":t})}function fg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function gg(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 mg(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 sa=new Set;async function g(e,t,n,i={}){if(!e.trim())return;let a=C(),l=S(e,JSON.stringify(a)),c=ta.get(l);if(c===void 0){try{let re=Z({loader:"ts",target:"browser",define:a}),oe=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");oe=oe.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=re.transformSync(oe)}catch{c=dg(e)}ta.set(l,c)}let b={exports:{}},v=b.exports,T=Vt.cwd(),P={},D=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((re)=>re[1]).filter((re)=>!re.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(re)),H=new Map;for(let re of D)try{if(re.startsWith(".")){P[re]=await import(lt.resolve(lt.dirname(n),re));continue}let oe=lt.resolve(T,"node_modules",re),xe=lt.join(oe,"package.json"),ve=JSON.parse(h("fs").readFileSync(xe,"utf8")),Pe=ve.main||"index.js";if(ve.exports){let qe=typeof ve.exports==="string"?ve.exports:ve.exports["."];if(typeof qe==="string")Pe=qe;else if(qe?.bun)Pe=qe.bun;else if(qe?.import)Pe=qe.import;else if(qe?.default)Pe=qe.default}P[re]=await import(lt.resolve(oe,Pe))}catch(oe){if(re.startsWith("."))H.set(re,oe instanceof Error?oe.message:String(oe))}let O=(re)=>{if(P[re])return P[re];let oe=H.get(re);if(oe!==void 0)throw Error(`Cannot require '${re}' from ${n}: ${oe}`);return h(re)},L=t.props||{},F=(re)=>{if(!re)return L;let oe={};for(let[xe,ve]of Object.entries(re)){let Pe=L[xe];if(Pe!==void 0)oe[xe]=Pe;else if(typeof ve==="function")oe[xe]=ve();else oe[xe]=ve}return oe};for(let[re,oe]of Object.entries(L))Object.defineProperty(F,re,{value:oe,enumerable:!0,configurable:!0,writable:!0});let B=(re,oe=!1)=>{if(re===void 0||re===null)return oe;if(typeof re==="string"){let xe=re.trim().toLowerCase();if(xe===""||xe==="true"||xe==="1"||xe==="on"||xe==="yes")return!0;if(xe==="false"||xe==="0"||xe==="off"||xe==="no")return!1;return!0}return Boolean(re)},ee=(re,oe=0)=>{if(re===void 0||re===null)return oe;if(typeof re==="string"){let ve=re.trim();if(ve==="")return oe;let Pe=Number(ve);return Number.isFinite(Pe)?Pe:oe}let xe=Number(re);return Number.isFinite(xe)?xe:oe};for(let re of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(L,re))continue;try{Object.defineProperty(F,re,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let X=(re)=>{if(!re)return L;let oe={...L};for(let[xe,ve]of Object.entries(re)){let Pe=ve&&typeof ve==="object"&&!Array.isArray(ve)?ve:{type:ve};if(oe[xe]===void 0&&Pe.default!==void 0)oe[xe]=typeof Pe.default==="function"?Pe.default():Pe.default}return oe},j=()=>t.slots||{},te=(re,oe)=>{let xe={...re};for(let[ve,Pe]of Object.entries(oe))if(xe[ve]===void 0)if(typeof Pe==="function")xe[ve]=Pe();else xe[ve]=Pe;return xe},se=(re)=>{let oe=()=>re;return oe.set=(xe)=>{},oe.update=(xe)=>{},oe},ne=(re)=>{let oe,xe=!1;return()=>{if(!xe)try{oe=re(),xe=!0}catch{oe=void 0}return oe}},pe=(re)=>{},ye=(re)=>re(),de=(re)=>{},Ie=(re)=>{},Ke=Us(t);function Te(re){let oe=re||{};if(oe.title!==void 0||oe.description!==void 0)tt({title:oe.title,description:oe.description})}function Xe(re){if(!re||typeof re!=="object")return;let oe=t.__stxClientPayload??{};Object.assign(oe,re),t.__stxClientPayload=oe}let Qe=()=>{let re=t.__stxServeContext,oe=t.__stxServeSearch??re?.search??"",xe=re?.path??"",ve=Object.fromEntries(new URLSearchParams(oe)),Pe=t.query,qe=Object.keys(ve).length>0?ve:Pe??{},at=oe||(Object.keys(qe).length>0?`?${new URLSearchParams(qe).toString()}`:"");return{params:t.params??{},query:qe,path:xe,name:"",fullPath:xe+at,hash:"",matched:[]}},Ge=()=>({push:(re)=>{},replace:(re)=>{},back:()=>{},forward:()=>{},go:(re)=>{}}),rt=(re)=>{let oe=t.__stx_runtime_head||{};t.__stx_runtime_head=We(oe,Ee(re||{},{known:eo,source:"useHead()"}))},tt=(re)=>{rt(to(re||{}))},wt=(re)=>({value:re}),Ut=(re)=>re,br=(re)=>({value:typeof re==="function"?re():re}),ft=(re,oe)=>{},Ue=(re)=>{},Ht=(re)=>{},pn=(re)=>re?re():Promise.resolve(),os=(re)=>(oe,...xe)=>{},qt=(re)=>{},nt=(re,oe)=>{},Zt=(re,oe)=>oe,as=()=>({value:"light"}),kt=()=>se(!1),pt=(re)=>se(!1),Kt=()=>se(!1),dn=()=>pt("(prefers-color-scheme: dark)"),Xt=()=>pt("(prefers-color-scheme: light)"),Jt=()=>pt("(prefers-reduced-motion: reduce)"),yr=()=>pt("(prefers-contrast: more)"),st={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:{}},Gt=new Proxy(st,{get(re,oe){if(oe in re)return re[oe];return},set(re,oe,xe){return re[oe]=xe,!0}}),cs={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},dt=console;try{let re=xi(c,n),oe=new Set(Object.keys(L)),xe=Object.keys(t).filter((ie)=>!oe.has(ie)&&!Ru.has(ie)&&zt(ie)),ve=xe.map((ie)=>t[ie]);if(!xe.includes("__stxServeContext"))xe.push("__stxServeContext"),ve.push(void 0);if(!oe.has("cookies")){let ie=t.cookies??t.__stxServeContext?.cookies??{},ue=xe.indexOf("cookies");if(ue<0)xe.push("cookies"),ve.push(ie);else ve[ue]=ie}let Pe=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),qe=[],at=[];for(let[ie,ue]of Object.entries(L)){if(!zt(ie))continue;if(Pe.has(ie))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ie}\\b`).test(re))continue;qe.push(ie),at.push(ue)}let us=Au(re).map((ie)=>`module.exports.${ie} = typeof ${ie} !== 'undefined' ? ${ie} : module.exports.${ie};`).join(`
|
|
696
|
-
`),gn=t.params??{},Yt=[],Qt=[];for(let ie=0;ie<xe.length;ie++){if(xe[ie]==="params")continue;Yt.push(xe[ie]),Qt.push(ve[ie])}let $n=[...wn,...qe,...Yt],En=`return (async () => {
|
|
697
|
-
${re}
|
|
698
|
-
${us}
|
|
699
|
-
return module.exports
|
|
700
|
-
})()`,gt=S(En,$n.join("\x00")),bt=na.get(gt);if(!bt)bt=Function(...$n,En),na.set(gt,bt);let mt=t.__stx_options?.runtimeConfig;if(mt||/\buse(?:Server)?RuntimeConfig\b/.test(c))await _n(t,n,mt);let Ze=await Ve(t.__stx_runtime_config??Cn()??M(),()=>Dr(t,()=>bt(b,v,O,L,F,B,ee,X,te,Xe,Mr,Ri,Xs,se,ne,pe,ye,de,Ie,Te,Qe,Ge,rt,tt,Ke.setResponseStatus,Ke.setResponseHeader,Ke.notFound,wt,Ut,br,ft,Ue,Ht,pn,os,qt,j,nt,Zt,as,kt,pt,Kt,dn,Xt,Jt,yr,Gt,cs,dt,st.confirm,st.alert,st.fetch,gn,...at,...Qt)));if(i.preserveExisting){for(let[ie,ue]of Object.entries(Ze))if(!(ie in t)||t[ie]===void 0)t[ie]=ue}else Object.assign(t,Ze);for(let[ie,ue]of Object.entries(L))if(!(ie in t))t[ie]=ue}catch(re){if(t.__stx_strict_hydration)throw re;let oe=pg(re instanceof Error?re.message:String(re));if(fg(oe))console.warn(`[stx] server <script> in ${n??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${oe}`),i.onFailure?.({kind:"module-resolution",message:oe,error:re});else if(gg(re))console.warn(`[stx] server <script> in ${n??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${oe}`),i.onFailure?.({kind:"syntax",message:oe,error:re});else if(mg(oe))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: ${oe}`),i.onFailure?.({kind:"missing-binding",message:oe,error:re});else{let xe=`${n??"<unknown>"}\x00${oe}`;if(Vt.env.STX_DEBUG||!sa.has(xe))sa.add(xe),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: ${oe}`);i.onFailure?.({kind:"unknown",message:oe,error:re})}try{await ju(c,t,n)}catch(xe){if(Vt.env.STX_DEBUG){let ve=xe instanceof Error?xe.message:String(xe);console.warn(`[stx] fallback extraction also failed in ${n??"<unknown>"}: ${ve}`)}}}}function hg(e){let t=0,n=null,i=!1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(n){if(c===n){if(n=null,i||t===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){n=c;continue}if(c==="{")t++;else if(c==="}")t--;else if(e.startsWith("from",l)&&t===0)i=!0}return n===null&&t===0&&a}var Iu=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function xi(e,t){let n=t?lt.dirname(t):Vt.cwd(),i=Vt.cwd(),a=e.split(`
|
|
701
|
-
`),l=[],c=0;while(c<a.length){let b=a[c].trim();if(b.startsWith("interface ")||b.startsWith("export interface ")||b.startsWith("type ")||b.startsWith("export type ")){if(b.includes("{")&&!b.includes("}")){let v=0;for(;c<a.length;c++){for(let T of a[c])if(T==="{")v++;else if(T==="}")v--;if(v<=0)break}}c++;continue}if(b.startsWith("definePageMeta(")){let v=0,T=!1,P=c;for(let O=c;O<a.length&&!T;O++){let L=null,F=!1,B=a[O];for(let ee=0;ee<B.length;ee++){let X=B[ee];if(F){F=!1;continue}if(X==="\\"){F=!0;continue}if(L){if(X===L)L=null;continue}if(X==='"'||X==="'"||X==="`"){L=X;continue}if(X==="(")v++;else if(X===")"){if(v--,v===0){c=O+1,T=!0;break}}}}if(!T)c=a.length;let D=a.slice(P,c).join(`
|
|
702
|
-
`),H=[];for(let O of["title","description"]){let L=new RegExp(`\\b${O}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(D);if(L)H.push(`${O}: ${JSON.stringify(L[2])}`)}if(H.length>0)l.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(b.startsWith("import ")||b==="import"||b.startsWith("import{")||/^import['"]/.test(b)){let v=b,T=0;while(!hg(v)&&c+T+1<a.length)T++,v=`${v} ${a[c+T].trim()}`;c+=T;let P=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),D=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=v.match(/^import\s*['"](.+?)['"]/),O=v,L=(F)=>{if(F.startsWith("."))return lt.resolve(n,F);if(F.startsWith("~/")||F.startsWith("@/"))return lt.resolve(i,F.slice(2));try{return Bun.resolveSync(F,n)}catch{return F}};if(P){let[,F,B]=P,ee=L(B);l.push(`const ${F} = (await import('${ee}')).default`),l.push(`module.exports.${F} = ${F};`)}else if(D){let[,F,B]=D,ee=L(B),X=[],j=[],te=Tu.has(B);for(let se of F.split(",")){let ne=se.trim();if(!ne)continue;let pe=ne.split(/\s+as\s+/);if(pe.length===2){let[ye,de]=[pe[0].trim(),pe[1].trim()];if(te&&ea.has(ye)){l.push(`const ${de} = ${ye};`);continue}X.push(`${ye}: ${de}`),j.push(de)}else{if(te&&ea.has(ne))continue;X.push(ne),j.push(ne)}}if(X.length>0)l.push(`const { ${X.join(", ")} } = await import('${ee}')`);for(let se of j)l.push(`module.exports.${se} = ${se};`)}else if(H){let F=L(H[1]);l.push(`await import('${F}')`)}else l.push(O);c++;continue}if(Iu.test(b))l.push(a[c]),c++;else if(b.startsWith("export const ")||b.startsWith("export let ")||b.startsWith("export var ")){let v=ia(a,c),{type:T,name:P,value:D}=v;l.push(`${T} ${P} = ${D};`),l.push(`module.exports.${P} = ${P};`),c=v.nextIndex}else if(b.startsWith("export function ")||b.startsWith("export async function ")){let v=hr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("const ")||b.startsWith("let ")||b.startsWith("var ")){let v=ia(a,c),{type:T,name:P,value:D}=v;l.push(`${T} ${P} = ${D};`),l.push(`module.exports.${P} = ${P};`),c=v.nextIndex}else if(b.startsWith("function ")||b.startsWith("async function ")){let v=hr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("export default function ")||b.startsWith("export default async function ")){let v=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),T=[...a];T[c]=v;let P=hr(T,c);if(l.push(P.functionCode),P.name)l.push(`module.exports.default = ${P.name};`);c=P.nextIndex}else if(b.startsWith("export default ")){let v=b.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),c++}else if(b.startsWith("class ")||b.startsWith("export class ")){let v=b.match(/(?:export\s+)?class\s+(\w+)/);if(v){let T=v[1],P=a[c].replace(/^export\s+/,""),D=0,H=c;for(;H<a.length;H++){let O=a[H];for(let L of O)if(L==="{")D++;else if(L==="}")D--;if(H>c)P+=`
|
|
703
|
-
`+O;if(D<=0&&H>=c)break}l.push(P),l.push(`module.exports.${T} = ${T};`),c=H+1}else l.push(b),c++}else if(b.includes("module.exports"))l.push(b),c++;else if(b.trim()&&!b.startsWith("//"))l.push(b),c++;else c++}return Pu(l.join(`
|
|
704
|
-
`),n,i)}function Pu(e,t,n){let i=e.length,a="",l=0,c=null,b=!1,v=!1,T=0;while(l<i){let P=e[l],D=e[l+1];if(b){if(a+=P,P===`
|
|
705
|
-
`)b=!1;l++;continue}if(v){if(a+=P,P==="*"&&D==="/"){a+=D,l+=2,v=!1;continue}l++;continue}if(!c&&P==="/"&&D==="/"){b=!0,a+=P,l++;continue}if(!c&&P==="/"&&D==="*"){v=!0,a+=P,l++;continue}if(c){if(a+=P,P==="\\"){a+=D,l+=2;continue}if(P===c&&c!=="`"){c=null,l++;continue}if(c==="`"){if(P==="$"&&D==="{"){T++,a+=D,l+=2;continue}if(P==="`"){c=null,l++;continue}}l++;continue}if(T>0){if(P==="{")T++;else if(P==="}")T--}if(P==='"'||P==="'"||P==="`"){c=P,a+=P,l++;continue}if(P==="a"&&e.startsWith("await",l)){let H=Ou(e,l);if(H){let{quote:O,path:L,end:F}=H;if(L.startsWith(".")||L.startsWith("~/")||L.startsWith("@/")){let B=L.startsWith(".")?lt.resolve(t,L):lt.resolve(n,L.slice(2));a+=`await import(${O}${B}${O})`,l=F;continue}}}a+=P,l++}return a}function Ou(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 l=e.slice(a,n);n++;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!==")")return null;return{quote:i,path:l,end:n+1}}function la(e,t){let n=e[t];if(n!=="{"&&n!=="[")return null;let a=x(e,n,n==="{"?"}":"]",t);if(a===-1)return null;return{pattern:e.slice(t,a+1),endPos:a+1}}function ua(e){let t=[],n=e.slice(1,-1).trim();if(!n)return t;let i=0,a=0,l="";while(i<n.length){let c=n[i];if(c==="{"||c==="["){let b=a===0?la(n,i):null;if(b){t.push(...ua(b.pattern)),i=b.endPos,l="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){i++;continue}if(c===","){if(l.trim())t.push(l.trim());l="",i++;continue}if(c===":"){l="",i++;continue}if(c==="="){if(l.trim())t.push(l.trim());l="",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(c))l+=c;i++}if(l.trim())t.push(l.trim());return t}function yg(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,l=null;n++;for(;n<e.length;n++){let c=e[n];if(l){if(c==="\\"){n++;continue}if(c===l)l=null;continue}if(c==="'"||c==='"'||c==="`"){l=c;continue}if(c==="("||c==="["||c==="{"||c==="<"){a++;continue}if(c===")"||c==="]"||c==="}"||c===">"){a--;continue}if(c==="="&&a<=0){let b=e[n+1],v=e[n-1];if(b!=="="&&b!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")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 ra(e,t,n,i){let a=null,l=!1;for(let c of e){if(l){l=!1;continue}if(c==="\\"){l=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c===t)i++;else if(c===n)i--}return i}function ia(e,t){let n=e[t].trim(),i=yg(n),a=i?[n,i.type,i.name,i.value]:null;if(!a){let P=n.match(/^(?:export\s+)?(const|let|var)\s+/);if(P){let D=n.slice(P[0].length),H=t;if(D.startsWith("{")||D.startsWith("[")){let L=D[0],F=L==="{"?"}":"]",B=ra(D,L,F,0),ee=D;for(let X=t+1;X<e.length&&B>0;X++)ee+=` ${e[X].trim()}`,H=X,B=ra(e[X],L,F,B);if(B>0)ee=D,H=t;D=ee}let O=la(D,0);if(O){let L=P[1],F=O.pattern,B=D.slice(O.endPos).trim();if(B.startsWith("=")){let ee=B.slice(1).trim(),X=ee,j=Math.max(H,t);if(oa(ee)){let pe=aa(e,j,ee);X=pe.value,j=pe.nextIndex}else j=j+1;X=X.trim().replace(/;$/,"");let te=ua(F),se=`__stx_src_${t}`,ne=te.map((pe)=>`module.exports.${pe} = ${pe};`).join(`
|
|
706
|
-
`);return{type:L,name:se,value:`${X}; ${L} ${F} = ${se};
|
|
707
|
-
${ne}`,nextIndex:j}}}}throw Error(`Failed to parse variable declaration: ${n}`)}let[,l,c,b]=a,v=b,T=t;if(oa(b)){let P=aa(e,t,b);v=P.value,T=P.nextIndex}else T=t+1;while(T<e.length){let P=e[T].trim();if(P.startsWith(".")||P.startsWith("?."))v+=`
|
|
708
|
-
${e[T]}`,T++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:c,value:v,nextIndex:T}}function hr(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,l=n.replace(/^export\s+/,""),c=t;if(Du(n)){let b=Mu(e,t,l);l=b.functionCode,c=b.nextIndex}else c=t+1;return{name:a,functionCode:l,nextIndex:c}}function oa(e){let t=e.trim();if(t.startsWith("{"))return x(t,"{","}",0)===-1;if(t.startsWith("["))return x(t,"[","]",0)===-1;return!fa(t)}function fa(e){let t={paren:0,bracket:0,brace:0},n=null,i=0;for(let a=0;a<e.length;a++){let l=e[a];if((a>0?e[a-1]:"")==="\\"&&n)continue;if((l==='"'||l==="'")&&!n){n=l;continue}if(l===n&&n!=="`"){n=null;continue}if(l==="`"&&!n){n="`";continue}if(l==="`"&&n==="`"&&i===0){n=null;continue}if(n==="`"&&l==="$"&&e[a+1]==="{"){i++,a++;continue}if(i>0&&l==="{"){i++;continue}if(i>0&&l==="}"){i--;continue}if(n)continue;if(l==="(")t.paren++;else if(l===")")t.paren--;else if(l==="[")t.bracket++;else if(l==="]")t.bracket--;else if(l==="{")t.brace++;else if(l==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&n===null}function pa(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let n=x(e,"(",")",t);if(n===-1)return-1;return e.indexOf("{",n)}function Du(e){let t=pa(e);if(t===-1)return!0;return x(e,"{","}",t)===-1}function aa(e,t,n){let i=n,a=t+1;while(a<e.length&&!fa(i)){let l=e[a];i+=`
|
|
709
|
-
${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))i+=`
|
|
710
|
-
${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function Mu(e,t,n){let i=n,a=t+1;while(a<e.length){let l=pa(i);if(l!==-1){if(x(i,"{","}",l)!==-1)break}let c=e[a];i+=`
|
|
711
|
-
${c}`,a++}return{functionCode:i,nextIndex:a}}function ca(e,t){let n=u(e,t)??u(`(${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(zt),l=a.map((c)=>i[c]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function ju(e,t,n){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of i){let[,,c,b]=l;try{let v=b.trim().replace(/;$/,""),T=ca(v,t);if(T!==void 0)t[c]=T}catch(v){console.warn(`Failed to parse export ${c} in fallback:`,v)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let l of a){let[,,c,b]=l;if(!(c in t))try{let v=b.trim().replace(/;$/,""),T=ca(v,t);if(T!==void 0)t[c]=T}catch{}}}function tl(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 nl(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
|
|
712
|
-
export{Oe,Se,V,Ms,Ds,U,xr,Ls,js,ui,di,pi,Bs,fi,jc,It,Ne,o,ae,w,Bc,S,Sr,Fs,ke,C,Me,fe,Ot,Nt,q,mn,De,y,Fc,ge,J,kr,_r,Cr,ce,Mt,Y,N,ot,Er,Tr,it,gi,zs,ug,Le,zc,Hc,mi,Vc,hi,Uc,Hs,yi,Wc,qc,bi,wi,hn,Vs,yn,Dt,Lt,Kc,Us,Gc,Xc,bn,$r,Ws,qs,Jc,vi,Yc,Zc,Qc,el,wn,dg,pg,fg,gg,mg,g,hg,xi,yg,tl,nl,Si,ki,bg,jt,rl,wg,sl,ly,je,vn,Be,vg,xg,Sg,kg,_g,Ks,Cg,Fe,Z,ze,Eg,Rr,Tg,ol,il,_i,He,s,xn,al,m,me,uy,cl,ll,ul,Ci,Gs,$g,dy,Rg,py,Sn,p,W,Q,kn,_e,Ag,Ei,Pg,fy,E,Ti,Ig,gy,A,my};
|