@stacksjs/stx 0.2.647 → 0.2.648
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-ma7d95f0.js → chunk-06w0z1cm.js} +5 -5
- package/dist/chunk-0en5jwjy.js +2 -0
- package/dist/{chunk-3ghbxena.js → chunk-0h8tg21j.js} +1 -1
- package/dist/{chunk-x8k64g1e.js → chunk-0jhdrgpr.js} +2 -2
- package/dist/{chunk-xnjf1zbn.js → chunk-0vkawews.js} +2 -2
- package/dist/{chunk-5t4qtxgr.js → chunk-2h8ea0we.js} +2 -2
- package/dist/{chunk-jsb4pvj1.js → chunk-2jh21f1n.js} +1 -1
- package/dist/chunk-2n3pa5gm.js +2 -0
- package/dist/chunk-3b5bphcn.js +2 -0
- package/dist/{chunk-h5zr710w.js → chunk-3p7mk3mw.js} +1 -1
- package/dist/{chunk-yfrvbnc6.js → chunk-3q163st5.js} +10 -10
- package/dist/{chunk-nph4d1ff.js → chunk-3zyjqvsq.js} +2 -2
- package/dist/{chunk-aah6csjm.js → chunk-481d4kr9.js} +1 -1
- package/dist/{chunk-0m08316b.js → chunk-4q2dtxdk.js} +1 -1
- package/dist/{chunk-bk96wjaz.js → chunk-55zaxb4s.js} +8 -8
- package/dist/chunk-57md41g9.js +2 -0
- package/dist/{chunk-42rghbqe.js → chunk-67xhsacd.js} +1 -1
- package/dist/{chunk-b0vhe6d4.js → chunk-6ea6az61.js} +1 -1
- package/dist/chunk-6vh8s0pg.js +2 -0
- package/dist/{chunk-myq3hrww.js → chunk-88z4wkrj.js} +2 -2
- package/dist/{chunk-e7sg0fa0.js → chunk-89yj6tcd.js} +1 -1
- package/dist/{chunk-y3vget29.js → chunk-8d2f2e42.js} +1 -1
- package/dist/chunk-8fsq2ynj.js +2 -0
- package/dist/{chunk-c7fs96n6.js → chunk-8p9kpfk8.js} +1 -1
- package/dist/chunk-8tpmz4as.js +2 -0
- package/dist/{chunk-hgy4c6mm.js → chunk-9121nkpj.js} +1 -1
- package/dist/{chunk-zevx9866.js → chunk-9txn4rvb.js} +1 -1
- package/dist/chunk-9x0zt65f.js +2 -0
- package/dist/chunk-a2bw46t9.js +2 -0
- package/dist/chunk-a4sggwcz.js +2 -0
- package/dist/{chunk-7s32fe6k.js → chunk-ab7zqtax.js} +1 -1
- package/dist/chunk-b0hpshvk.js +2 -0
- package/dist/chunk-c1479y92.js +2 -0
- package/dist/{chunk-gc9ftf7r.js → chunk-c1dkh0es.js} +3 -3
- package/dist/{chunk-pw9bhdaz.js → chunk-e87xa4r3.js} +1 -1
- package/dist/chunk-embejqx4.js +2 -0
- package/dist/chunk-er60h3j3.js +2 -0
- package/dist/chunk-eyfxw7ds.js +2 -0
- package/dist/chunk-f3y4fnaa.js +2 -0
- package/dist/{chunk-wzgn9fv7.js → chunk-f46ht5kq.js} +3 -3
- package/dist/chunk-f7930sce.js +2 -0
- package/dist/{chunk-emaexvgz.js → chunk-fsbjat59.js} +1 -1
- package/dist/{chunk-vgt9f7ac.js → chunk-gv793yqq.js} +2 -2
- package/dist/chunk-gz90fqn8.js +2 -0
- package/dist/chunk-h15xb2vd.js +2 -0
- package/dist/{chunk-31714f76.js → chunk-h5nmf98w.js} +1 -1
- package/dist/{chunk-da7x7y7j.js → chunk-hfpv56cp.js} +1 -1
- package/dist/chunk-hhmj9gpk.js +2 -0
- package/dist/{chunk-5yg3tkth.js → chunk-hjm69qnj.js} +1 -1
- package/dist/{chunk-shkysa02.js → chunk-j393gsfd.js} +2 -2
- package/dist/{chunk-p22w6mwr.js → chunk-j5gd0e53.js} +1 -1
- package/dist/{chunk-msr25dhc.js → chunk-jkaszw24.js} +2 -2
- package/dist/{chunk-rwrbdpdk.js → chunk-m6qfqkbh.js} +1 -1
- package/dist/{chunk-ztbzktzg.js → chunk-mnp8ecj9.js} +1 -1
- package/dist/chunk-ncqh5qe5.js +2 -0
- package/dist/{chunk-rb5xdcen.js → chunk-nj1t4g3a.js} +3 -3
- package/dist/{chunk-p08x0z86.js → chunk-np4zm2ph.js} +1 -1
- package/dist/{chunk-0z5cc7qn.js → chunk-nt0n0vjm.js} +2 -2
- package/dist/{chunk-0jq3w712.js → chunk-p44kmbdg.js} +3 -3
- package/dist/{chunk-dpjnjs09.js → chunk-pbtkbe48.js} +23 -23
- package/dist/{chunk-jx3wpgv0.js → chunk-pg0xzsss.js} +2 -2
- package/dist/{chunk-xyjn0rvj.js → chunk-pxs7sgnp.js} +1 -1
- package/dist/{chunk-74pej67a.js → chunk-qfe7ps3v.js} +7 -7
- package/dist/{chunk-b07djygp.js → chunk-qm4672dj.js} +3 -3
- package/dist/chunk-r1r6311d.js +14 -0
- package/dist/{chunk-55x799st.js → chunk-radggg3p.js} +5 -5
- package/dist/{chunk-ar22s1e1.js → chunk-sgptbhrc.js} +1 -1
- package/dist/{chunk-fygp3cs9.js → chunk-sszhz1zh.js} +1 -1
- package/dist/{chunk-mmm6mm16.js → chunk-szyqxcfj.js} +2 -2
- package/dist/{chunk-cj2xj1v6.js → chunk-t1k9160w.js} +4 -4
- package/dist/{chunk-tkkvvt26.js → chunk-t82be9yf.js} +1 -1
- package/dist/{chunk-9y2ncrnq.js → chunk-v2x9vzgw.js} +2 -2
- package/dist/{chunk-w2q32x72.js → chunk-w2zceynt.js} +1 -1
- package/dist/{chunk-pfk9ffbz.js → chunk-wjt0kej9.js} +1 -1
- package/dist/{chunk-9am6dsb1.js → chunk-wpm58d6p.js} +2 -2
- package/dist/{chunk-9z9jtwct.js → chunk-wq6j2h32.js} +1 -1
- package/dist/{chunk-20f1veqy.js → chunk-x34scshq.js} +2 -2
- package/dist/{chunk-pdc9s7bg.js → chunk-x5tjb4y4.js} +1 -1
- package/dist/chunk-xfzcv0jc.js +2 -0
- package/dist/{chunk-ajv5xmjx.js → chunk-xm2mee4a.js} +14 -14
- package/dist/{chunk-ggwm8w5m.js → chunk-xvs04cnp.js} +1 -1
- package/dist/{chunk-3e7haxwt.js → chunk-ye8tgmd3.js} +1 -1
- package/dist/{chunk-asqnaddf.js → chunk-ymymwzt5.js} +1 -1
- package/dist/{chunk-a8j91pqz.js → chunk-yq021b3r.js} +3 -3
- package/dist/{chunk-jyth1zjy.js → chunk-zdnc7a4t.js} +3 -3
- package/dist/{chunk-5gtpswnm.js → chunk-zmh9p9aa.js} +1 -1
- package/dist/{chunk-w1v1d7rq.js → chunk-zsgcsqat.js} +94 -94
- package/dist/chunk-zyqs6a3p.js +2 -0
- package/dist/cli.js +12 -12
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/interpolation-context.js +111 -8
- package/dist/pwa.js +3 -3
- package/dist/runtime-injection.js +9 -3
- package/dist/ssg.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-0ky1j84b.js +0 -2
- package/dist/chunk-1c5p7ede.js +0 -2
- package/dist/chunk-1q6yvbdx.js +0 -2
- package/dist/chunk-1x4qn6fy.js +0 -2
- package/dist/chunk-2c3w367n.js +0 -2
- package/dist/chunk-2cxav9xe.js +0 -2
- package/dist/chunk-2v4s7xtx.js +0 -2
- package/dist/chunk-40y6mb8t.js +0 -2
- package/dist/chunk-4fz2eq7g.js +0 -2
- package/dist/chunk-5e20mvke.js +0 -2
- package/dist/chunk-5fzh8n52.js +0 -2
- package/dist/chunk-70pmthc3.js +0 -2
- package/dist/chunk-8ttg2d3m.js +0 -2
- package/dist/chunk-9qeg5trh.js +0 -2
- package/dist/chunk-apgb7r22.js +0 -2
- package/dist/chunk-aze7k3a5.js +0 -2
- package/dist/chunk-cs0dd5w8.js +0 -2
- package/dist/chunk-cwd65649.js +0 -2
- package/dist/chunk-edz1h5f9.js +0 -2
- package/dist/chunk-ek2adv0n.js +0 -2
- package/dist/chunk-n4cvg2sw.js +0 -2
- package/dist/chunk-qn63btbf.js +0 -2
- package/dist/chunk-vac56rgd.js +0 -12
- package/dist/chunk-vn3yx05b.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Le,mn,ys,Bo,A}from"./chunk-2h8ea0we.js";import{gn}from"./chunk-x5tjb4y4.js";import{br,x,ic,rt,Go,ac}from"./chunk-7rta163c.js";import{T}from"./chunk-ce6zddpf.js";import{bs,l,d,Nt,u,z,D,w,Ss,we,Be,ks}from"./chunk-55zaxb4s.js";import{o,Qe}from"./chunk-egg54kd0.js";import{p}from"./chunk-2a4szpje.js";import{H}from"./chunk-354jmw2k.js";import Je from"path";import kt from"process";import{AsyncLocalStorage as so}from"async_hooks";var er=new so;function ln(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function tr(e,s){return er.run(ln(e),s)}async function nr(e,s){let t=er.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(s).then((h)=>{let c=JSON.stringify(h,(E,R)=>{if(R===void 0||typeof R==="function"||typeof R==="symbol"||typeof R==="bigint"||typeof R==="number"&&!Number.isFinite(R))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(R&&typeof R==="object"&&!Array.isArray(R)&&Object.getPrototypeOf(R)!==Object.prototype&&Object.getPrototypeOf(R)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return R}),v=JSON.parse(c);return t.values.set(e,v),v}).catch((h)=>{throw t.pending.delete(e),h});return t.pending.set(e,a),a}function cr(e){let s=e.__stx_server_data;if(!s?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(s.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function L(e,s=!1){let t=o(e),i=[],a=new Set,h=0,c=0,v=t.length,E=()=>{if(h!==0)return;let R=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(R){if(s&&R[1]==="const")return;let I=R[2];if(!a.has(I))i.push(I),a.add(I);return}let C=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){if(s&&t.slice(c).startsWith("const"))return;C[1].split(",").forEach((I)=>{let P=I.trim();if(!P)return;let Z=P.indexOf(":"),V=(Z>=0?P.slice(Z+1).trim():P).split(/[\s=]/)[0];if(V&&!a.has(V))i.push(V),a.add(V)});return}let O=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){if(s&&t.slice(c).startsWith("const"))return;O[1].split(",").forEach((I)=>{let P=I.trim().replace(/^\.\.\./,"");if(!P)return;let Z=P.split(/[\s=]/)[0];if(Z&&!a.has(Z))i.push(Z),a.add(Z)});return}if(s)return;let M=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!a.has(I))i.push(I),a.add(I);return}let N=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!a.has(I))i.push(I),a.add(I)}};while(c<v){if(t[c]==="{"){h++,c++;continue}if(t[c]==="}"){h--,c++;continue}if(h===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))E();c++}return i.join(", ")}function ns(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ro(e,s=L(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(L(e,!0).split(",").map((i)=>i.trim()));return s.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function rs(e,s){let t=`{ ${ro(e,s)} }`;return L(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import Rn from"fs";import Ce from"path";function j(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var ur=new Map;function ss(e,s=!0){let t=ur.get(e);if(s&&t)return t;let i=new Map,a=[Ce.join(e,"src"),Ce.join(e,"dist"),e];function h(c,v){if(v>6)return;let E;try{E=Rn.readdirSync(c,{withFileTypes:!0})}catch{return}for(let R of E){let C=Ce.join(c,R.name);if(R.isDirectory()){if(R.name==="node_modules"||R.name.startsWith("."))continue;h(C,v+1)}else if(R.isFile()&&R.name.endsWith(".stx")){let O=R.name.slice(0,-4);if(!i.has(O))i.set(O,C);let M=O.toLowerCase();if(!i.has(M))i.set(M,C);let N=j(O);if(!i.has(N))i.set(N,C)}}}for(let c of a)if(h(c,0),i.size>0)break;if(s)ur.set(e,i);return i}function os(e,s){if(e.startsWith(".")||e.startsWith("/"))return null;let t=s;while(!0){let i=Ce.join(t,"node_modules",e);try{if(Rn.statSync(i).isDirectory())return i}catch{}let a=Ce.dirname(t);if(a===t)return null;t=a}}function is(e,s,t={}){return[Ce.resolve(Ce.dirname(s),`${e}.stx`),Ce.resolve(Ce.dirname(s),e),Ce.resolve(t.componentsDir||"components",`${e}.stx`),Ce.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function fr(e){let s=e.endsWith(".stx")?e.slice(0,-4):e,t=s.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=j(s);return[s,t,i]}function So(e,s){let[t,i,a]=fr(e);for(let h of[t,t.toLowerCase(),i,a]){let c=s?.__importedComponents?.get(h);if(c!==void 0)return c}}function*ko(e,s,t={},i){let a=fr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ce.resolve(Ce.dirname(s),`${a[0]}.stx`);return}let h=[...new Set(a.map((E)=>`${E}.stx`))],c=t.projectRoot||process.cwd(),v=[...i?.__originalFilePath?[Ce.join(Ce.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ce.join(Ce.dirname(s),"components"),Ce.resolve(c,"src/components"),Ce.resolve(c,"components"),...import.meta.dir?[Ce.resolve(import.meta.dir,"components")]:[]];for(let E of new Set(v)){for(let R of h)yield Ce.join(E,R);try{for(let R of Rn.readdirSync(E,{withFileTypes:!0}))if(R.isDirectory())for(let C of h)yield Ce.join(E,R.name,C)}catch{}}}function pr(e,s,t={},i){let a=So(e,i);if(a!==void 0)return a;for(let h of ko(e,s,t,i))try{if(Rn.statSync(h,{throwIfNoEntry:!1})?.isFile())return h}catch{}return null}import Hs from"fs";import oe from"path";import dt from"path";import Kt from"fs";var io=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Qn(e,s){if(s.passive)return!0;if(s.prevent||s.nonpassive)return!1;return io.has(e.toLowerCase())}var dr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),gr={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"},oo=new Set(["ctrl","alt","shift","meta"]),xr={left:0,middle:1,right:2};function mr(e){let s={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")s.prevent=!0;else if(i==="stop")s.stop=!0;else if(i==="once")s.once=!0;else if(i==="capture")s.capture=!0;else if(i==="self")s.self=!0;else if(i==="passive")s.passive=!0;else if(i==="nonpassive")s.nonpassive=!0;else if(oo.has(i))s.systemKeys.push(i);else if(i in xr)s.mouse=i;else if(i in gr||/^[a-z]$/.test(i))s.keys.push(gr[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);s.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);s.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return s}function yr(e,s=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,h;while((h=a.exec(e))!==null){let[c,v,E]=h,R=h.index,C=R+c.length,O=`__stx_evt_${s}${i++}`,M=[],N=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=N.exec(E))!==null){let[,Z,U]=I,V=Z.split("."),X=V[0];if(!dr.has(X))continue;M.push({attribute:`@${Z}`,event:X,handler:U,modifiers:mr(V.slice(1)),elementId:O})}let P=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=P.exec(E))!==null){let[,Z,U]=I,V=Z.split("."),X=V[0];if(!dr.has(X))continue;M.push({attribute:`@${Z}`,event:X,handler:U,modifiers:mr(V.slice(1)),elementId:O})}if(M.length>0)t.push({originalTag:c,elementId:O,events:M,startIndex:R,endIndex:C})}return t}function ao(e){let s=[],{modifiers:t}=e;if(t.self)s.push("if ($event.target !== $el) return");for(let i of t.systemKeys)s.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");s.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=xr[t.mouse];s.push(`if ($event.button !== ${i}) return`)}if(t.prevent)s.push("$event.preventDefault()");if(t.stop)s.push("$event.stopPropagation()");return s.join("; ")}function co(e,s){let t=e;if(s.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${s.debounce})`;else if(s.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${s.throttle})`;return t}function es(e){let s=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(s))return e;return`if (typeof ${s} === 'function' && !${s}._isSignal) ${s}($event);`}function lo(e){let{modifiers:s}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=ao(e),a=co(es(e.handler),s),h=[];if(s.once)h.push("once: true");if(s.capture)h.push("capture: true");if(Qn(e.event,s))h.push("passive: true");let c=h.length>0?`, { ${h.join(", ")} }`:"",v=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${t}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -108,11 +108,11 @@ else {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
// Event listeners
|
|
111
|
-
${e.map(
|
|
111
|
+
${e.map(lo).join(`
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
|
-
</script>`}function
|
|
115
|
-
`+a.slice(c);else a+=h;return a}function
|
|
114
|
+
</script>`}function uo(e,s=""){let t=yr(e,s);if(t.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let h=t.length-1;h>=0;h--){let c=t[h],v=c.originalTag;if(!v.includes(" id="))v=v.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let E=v.match(/id=["']([^"']+)["']/);if(E)for(let R of c.events)R.elementId=E[1]}for(let E of c.events){let R=E.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),C=new RegExp(`\\s*${R}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${R}\\s*=\\s*'[^']*'`,"g");v=v.replace(C,""),v=v.replace(O,"")}i=i.slice(0,c.startIndex)+v+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function hr(e){let s=e.$uid;return typeof s==="string"&&s?`${s}_`:""}function Ea(e,s,t){if(ac(e))return e;if(s.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:v,bindings:E}=uo(e,hr(s)),R=s.__stx_event_bindings||[];return s.__stx_event_bindings=[...R,...E],v}let i=yr(e,hr(s));if(i.length===0)return e;let a=e;for(let v=i.length-1;v>=0;v--){let E=i[v],R=E.originalTag;if(!R.includes(" id="))R=R.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${E.elementId}"`);else{let C=R.match(/id=["']([^"']+)["']/);if(C)for(let O of E.events)O.elementId=C[1]}for(let C of E.events){let O=C.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),M=new RegExp(`\\s*${O}\\s*=\\s*"[^"]*"`,"g"),N=new RegExp(`\\s*${O}\\s*=\\s*'[^']*'`,"g");R=R.replace(M,""),R=R.replace(N,"")}a=a.slice(0,E.startIndex)+R+a.slice(E.endIndex)}let h=_o(i.flatMap((v)=>v.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+h+`
|
|
115
|
+
`+a.slice(c);else a+=h;return a}function _r(e,s){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(s){let h=a.lastIndexOf(":");if(h!==-1)a=a.slice(h+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Ht(e,s){let t=o(e),{depths:i,balanced:a}=Qe(t),h=(v)=>!a||i[v]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${s}\\b)`,"g");for(let v of t.matchAll(c)){let E=(v.index??0)+v[0].length-v[1].length;if(h(E))return!0}for(let v of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h(v.index??0)&&_r(v[1],!0).has(s))return!0;for(let v of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h(v.index??0)&&_r(v[1],!1).has(s))return!0;return!1}var wr="",Cn,at=/^[A-Za-z_$][\w$]*$/,fo=new Set(["if","for","while","switch","with"]),Sr=["(","[","{"],$r=[")","]","}"],po=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function go(e){let s=o(e),t=[];for(let i of s.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:s,tokens:t}}function ts(e){if(Cn&&e===wr)return Cn;let{code:s,tokens:t}=go(e),i=new Map,a=[];for(let I=0;I<t.length;I++){let P=t[I].text;if(["(","[","{"].includes(P))a.push(I);else if([")","]","}"].includes(P)){let Z=a.at(-1);if(Z!==void 0&&["()","[]","{}"].includes(t[Z].text+P))a.pop(),i.set(Z,I),i.set(I,Z)}}function h(I,P){let Z=[],U=I;for(let V=I;V<P;V++){if(["(","[","{"].includes(t[V].text)&&(i.get(V)??P)<P){V=i.get(V);continue}if(t[V].text===",")Z.push([U,V]),U=V+1}return Z.push([U,P]),Z}let c=[];function v(I,P,Z,U=!1){if(t[I]?.text==="...")I++;if(I>=P)return;let V=t[I].text;if(at.test(V)){if(Z.add(V),Z===C)c.push({name:V,token:I,functionScoped:U});return}if(V!=="{"&&V!=="[")return;let X=i.get(I);if(X===void 0||X>=P)return;for(let[Y,Q]of h(I+1,X)){let se=Y;if(V==="{")for(let pe=Y;pe<Q;pe++){if(t[pe].text===":"){se=pe+1;break}if(t[pe].text==="=")break;if(["(","[","{"].includes(t[pe].text)&&i.has(pe))pe=i.get(pe)}v(se,Q,Z,U)}}function E(I,P){let Z=new Set;for(let[U,V]of h(I,P))v(U,V,Z);return Z}function R(I){let P=I;for(;P<t.length;P++){let Z=t[P].text;if(["(","[","{"].includes(Z)&&i.has(P)){P=i.get(P);continue}if([",",";",")","]","}"].includes(Z))break}return t[Math.max(I,P-1)]?.end??s.length}let C=new Set,O=[];for(let I=0;I<t.length;I++)if(t[I].text==="=>"){let P=I-1,Z=P,U;if(t[P]?.text===")"&&i.has(P))Z=i.get(P),U=E(Z+1,P);else if(t[P]&&at.test(t[P].text))U=new Set([t[P].text]);else continue;let V=I+1,X=t[V]?.text==="{"&&i.has(V)?t[i.get(V)].end:R(V);O.push({start:t[Z].start,end:X,bodyStart:t[V]?.start??X,functionBody:!0,names:U})}else if(t[I].text==="("&&i.has(I)){let P=t[I-1]?.text;if(!P||fo.has(P)||!at.test(P)&&P!=="*"&&P!=="]")continue;let Z=i.get(I),U=Z+1;if(t[U]?.text===":"){U++;while(U<t.length&&!["{","=>",";","="].includes(t[U].text))U++}if(t[U]?.text!=="{"||!i.has(U))continue;O.push({start:t[I].start,end:t[i.get(U)].end,bodyStart:t[U].start,functionBody:P!=="catch",names:E(I+1,Z)})}function M(I){let P=I;for(;P<t.length;P++){let Z=t[P].text;if(Sr.includes(Z)&&i.has(P)){P=i.get(P);continue}if(Z===";"||$r.includes(Z))break;let U=t[P-1];if(P>I&&po.has(Z)&&U.text!==".")break;if(P>I&&/[\n\r]/.test(s.slice(U.end,t[P].start))&&(/^[\w$]+$/.test(U.text)||$r.includes(U.text)||['"',"'","`"].includes(U.text))&&at.test(Z)&&!["in","of","instanceof"].includes(Z))break}return P}let N=[];for(let I=0;I<t.length;I++){if(t[I].text!=="for")continue;let P=t[I+1]?.text==="await"?I+2:I+1;if(t[P]?.text!=="("||!i.has(P))continue;let Z=i.get(P),U=Z+1,V=t[U]?.text==="{"&&i.has(U)?i.get(U):M(U),X=t[V]?.text===";"||t[V]?.text==="}"?t[V].end:t[Math.max(U,V-1)]?.end??s.length;N.push({headStart:P,headEnd:Z,start:t[P].start,end:X})}for(let I=0;I<t.length;I++){let P=t[I].text,Z=t[I-1]?.text;if(Z==="."||t[I+1]?.text===":")continue;if(Z==="as"||Z==="<")continue;if(P==="const"||P==="let"||P==="var"){let U=M(I+1),V=I+1,X=!1,Y=!1,Q=0;for(let se=I+1;se<=U;se++){let pe=t[se]?.text;if(se<U&&Sr.includes(pe)&&i.has(se)&&i.get(se)<U){se=i.get(se);continue}if(se<U&&pe===":"&&!Y)X=!0;else if(se<U&&pe==="="&&Q===0)X=!1,Y=!0;else if(se<U&&X&&pe==="<")Q++;else if(se<U&&X&&pe===">"&&Q>0)Q--;else if(se===U||pe===","&&Q===0)v(V,se,C,P==="var"),V=se+1,X=!1,Y=!1}}else if(P==="function"||P==="class"){let U=I+1;if(t[U]?.text==="*")U++;if(t[U]&&at.test(t[U].text)&&t[U].text!=="extends")C.add(t[U].text),c.push({name:t[U].text,token:U})}else if(P==="import"){let U=I+1;if(t[U]?.text==="*"&&t[U+1]?.text==="as")U+=2;let V=t[U]?.text;if(V&&at.test(V)&&V!=="type"&&t[U+1]?.text!=="("&&t[U+1]?.text!==".")C.add(V),c.push({name:V,token:U,file:!0});let X=t[U]?.text==="{"?U:t[U+1]?.text===","&&t[U+2]?.text==="{"?U+2:-1;if(X!==-1&&i.has(X)){let Y=i.get(X);for(let[Q,se]of h(X+1,Y)){let pe=se-1;while(pe>=Q&&!at.test(t[pe].text))pe--;if(pe>=Q&&t[pe].text!=="type")c.push({name:t[pe].text,token:pe,file:!0})}}}}return wr=e,Cn={code:s,scopes:O,loops:N,declarations:C,sites:c,tokens:t,pairs:i},Cn}function fs(e){let s=ts(e);return{code:s.code,shadows:(t,i)=>s.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function Tn(e){return new Set(ts(e).declarations)}function rn(e,s){let{scopes:t,loops:i,sites:a,tokens:h,pairs:c}=ts(e),v=Array.from({length:h.length},()=>-1),E=[];for(let N=0;N<h.length;N++){v[N]=E.length?E[E.length-1]:-1;let I=h[N].text;if(I==="{"&&c.has(N))E.push(N);else if(I==="}"&&E.length&&c.get(N)===E[E.length-1])E.pop()}let R=new Set,C=new Map;for(let N of a){if(!s.has(N.name))continue;R.add(N.token);let I=N.file?-1:v[N.token],P=I===-1?[0,Number.POSITIVE_INFINITY]:[h[I].start,h[c.get(I)].end];if(N.functionScoped){let U=h[N.token].start,V=t.filter((X)=>X.functionBody&&U>=X.bodyStart&&U<X.end).sort((X,Y)=>X.end-X.bodyStart-(Y.end-Y.bodyStart))[0];P=V?[V.bodyStart,V.end]:[0,Number.POSITIVE_INFINITY]}else if(!N.file){let U=i.filter((V)=>N.token>V.headStart&&N.token<V.headEnd).sort((V,X)=>V.headEnd-V.headStart-(X.headEnd-X.headStart))[0];if(U)P=[U.start,U.end]}let Z=C.get(N.name);if(Z)Z.push(P);else C.set(N.name,[P])}let O=new Set;for(let N=0;N<h.length;N++){if(h[N].text!=="import"||h[N-1]?.text===".")continue;let I=N+1;if(h[I]?.text==="type")I++;if(h[I]&&at.test(h[I].text)&&h[I+1]?.text===",")I+=2;if(h[I]?.text==="{"&&c.has(I))for(let P=I+1;P<c.get(I);P++)O.add(P)}let M=new Set;for(let N=0;N<h.length;N++){let I=h[N].text;if(!s.has(I)||M.has(I)||R.has(N)||O.has(N))continue;let P=h[N-1]?.text;if(P==="#"||P==="."&&h[N-2]?.text!=="..")continue;if(h[N+1]?.text===":"&&(P==="{"||P===","))continue;let Z=h[N].start;if(C.get(I)?.some(([U,V])=>Z>=U&&Z<V))continue;if(t.some((U)=>Z>=U.start&&Z<U.end&&U.names.has(I)))continue;M.add(I)}return M}var $e="0.2.648";var vr=Symbol.for(`stx.lazy-module-promises.${$e}`);function ho(){let e=globalThis;return e[vr]??=new Map,e[vr]}function r(e,s){let t=ho(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let h=s();return t.set(i,h),h.catch(()=>{if(t.get(i)===h)t.delete(i)}),h}var xo=/<\/(script)/gi;function sn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(xo,"<\\/$1")}import Rr from"fs";class B{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,s){this.maxSize=e,this.options=s??null,this.sizes=s?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let s=this.cache.keys().next().value;if(s===void 0)break;this.delete(s)}}get(e){if(!this.cache.has(e))return;let s=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,s),s}set(e,s){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(s):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,s),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let s=this.sizes.get(e);if(s!==void 0)this.bytes-=s,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var wt=new Map,bo=500;function Ct(e,s){if(s?.includes("g"))return new RegExp(e,s);let t=`${e}:${s||""}`;if(!wt.has(t)){if(wt.size>=bo){let i=wt.keys().next().value;if(i)wt.delete(i)}wt.set(t,new RegExp(e,s))}return wt.get(t)}class Er{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let s=Array.from(new Set(e)),t=s.sort().join(","),i=this.pool.find((v)=>v.context.join(",")===t);if(i)return i.func;let a=this.fnCache,h=this.fnCacheMaxSize,c=(...v)=>(E)=>{try{let R=`${t}:${E}`,C=a.get(R);if(!C){if(a.size>=h){let O=a.keys().next().value;if(O)a.delete(O)}C=Function(...s,`
|
|
116
116
|
'use strict';
|
|
117
117
|
try {
|
|
118
118
|
return ${E};
|
|
@@ -123,18 +123,18 @@ catch (e) {
|
|
|
123
123
|
}
|
|
124
124
|
throw e;
|
|
125
125
|
}
|
|
126
|
-
`),a.set(R,C)}return C(...v)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:c,context:s.slice()});return c}clear(){this.pool.length=0,this.fnCache.clear()}}var
|
|
126
|
+
`),a.set(R,C)}return C(...v)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:c,context:s.slice()});return c}clear(){this.pool.length=0,this.fnCache.clear()}}var du=new Er;class kr{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,s){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...s})}setBudgets(e){for(let[s,t]of Object.entries(e))this.setBudget(s,t)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[s,t]of this.budgets.entries())e[s]=t;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let s=this.violationHandlers.indexOf(e);if(s!==-1)this.violationHandlers.splice(s,1)}time(e,s){if(!this.enabled)return s();let t=performance.now(),i=s(),a=performance.now()-t;return this.recordTime(e,a),this.checkBudget(e,a),i}async timeAsync(e,s){if(!this.enabled)return s();let t=performance.now(),i=await s(),a=performance.now()-t;return this.recordTime(e,a),this.checkBudget(e,a),i}checkBudget(e,s){let t=this.budgets.get(e);if(!t)return;let i=s/t.maxTime*100,a=t.warnThreshold!==void 0?s>=t.maxTime*t.warnThreshold&&s<t.maxTime:!1,h=s>=t.maxTime;if(!a&&!h)return;let c={label:e,actualTime:s,budgetTime:t.maxTime,exceedancePercent:i,timestamp:new Date,isWarning:a};this.violations.push(c);while(this.violations.length>this.maxViolations)this.violations.shift();for(let E of this.violationHandlers)try{E(c)}catch{}let v=a?`[Performance Warning] "${e}" took ${s.toFixed(2)}ms (${i.toFixed(1)}% of ${t.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${s.toFixed(2)}ms (exceeded ${t.maxTime}ms budget by ${(i-100).toFixed(1)}%)`;switch(t.action){case"log":console.log(v);break;case"warn":console.warn(v);break;case"error":console.error(v);break;case"throw":if(h)throw Error(v);else console.warn(v);break}}recordTime(e,s){let t=this.metrics.get(e);if(t)t.count++,t.totalTime+=s,t.maxTime=Math.max(t.maxTime,s),t.minTime=Math.min(t.minTime,s);else this.metrics.set(e,{count:1,totalTime:s,maxTime:s,minTime:s})}getStats(e){if(e){let t=this.metrics.get(e);if(!t)return{};let i=this.budgets.get(e);return{count:t.count,avgTime:t.totalTime/t.count,totalTime:t.totalTime,maxTime:t.maxTime,minTime:t.minTime,budget:i?.maxTime,budgetUtilization:i?t.totalTime/t.count/i.maxTime*100:void 0}}let s={};for(let[t,i]of this.metrics.entries()){let a=this.budgets.get(t);s[t]={count:i.count,avgTime:i.totalTime/i.count,totalTime:i.totalTime,maxTime:i.maxTime,minTime:i.minTime,budget:a?.maxTime,budgetUtilization:a?i.totalTime/i.count/a.maxTime*100:void 0}}return s}getViolations(e){if(e)return this.violations.filter((s)=>s.label===e);return[...this.violations]}getViolationStats(){let e={},s=0,t=0;for(let i of this.violations)if(e[i.label]=(e[i.label]||0)+1,i.isWarning)s++;else t++;return{total:this.violations.length,byLabel:e,warnings:s,errors:t}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var xs=null;function yo(){if(!xs)xs=new kr;return xs}var te=new Proxy({},{get(e,s){return yo()[s]}});var Cr=[];function y(e){let s=new B(e);return Cr.push(s),s}function Ta(){for(let e of Cr)e.clear()}function b(e,...s){return`${s.map((t)=>String(t??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function rr(e){let s=[];for(let t of new Set(e))try{s.push({path:t,mtimeMs:Rr.statSync(t).mtimeMs})}catch{}return s}function as(e){for(let s of e)try{if(Rr.statSync(s.path).mtimeMs!==s.mtimeMs)return!1}catch{return!1}return!0}var ye=["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 wo=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function vo(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let t=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}let s=e.match(/^([^/]+)(\/.*)?$/);if(!s)return null;return{pkg:s[1],subpath:s[2]||""}}function jo(e,s){let t=s;while(!0){let i=dt.join(t,"node_modules",e,"package.json");if(Kt.existsSync(i))return dt.dirname(i);let a=dt.dirname(t);if(a===t)return null;t=a}}function zo(e,s){if(!e||typeof e!=="object")return null;let t=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return t(a.import);if(typeof a.default==="object")return t(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,s))return t(e[s]);let i=null;for(let a of Object.keys(e)){let h=a.indexOf("*");if(h===-1)continue;let c=a.slice(0,h),v=a.slice(h+1);if(!s.startsWith(c)||!s.endsWith(v))continue;if(s.length<c.length+v.length)continue;if(!i||c.length>i.prefix.length)i={pattern:a,prefix:c,suffix:v}}if(i){let a=s.slice(i.prefix.length,s.length-i.suffix.length),h=t(e[i.pattern]);if(h)return h.replace("*",a)}return null}function Wo(e,s){let t=vo(e);if(!t||!t.subpath)return null;let i=jo(t.pkg,s);if(!i)return null;let a;try{a=JSON.parse(Kt.readFileSync(dt.join(i,"package.json"),"utf8"))}catch{return null}let h=`.${t.subpath}`,c=zo(a.exports,h);if(!c)return null;let v=dt.resolve(i,c);return Kt.existsSync(v)?v:null}function Io(e,s){let t=s.filePath?dt.dirname(s.filePath):s.projectRoot||process.cwd(),i=s.projectRoot||process.cwd(),a=new Set,h=[],c=[];return{code:e.replace(wo,(E,R)=>{let C;try{if(R.startsWith("./")||R.startsWith("../")||R.startsWith("/")){if(C=R.startsWith("/")?R:dt.resolve(t,R),!Kt.existsSync(C))throw Error(`file not found: ${C}`)}else{let O=null;try{O=Bun.resolveSync(R,i)}catch{O=Wo(R,i)}if(!O)throw Error(`could not resolve ${R} (Bun.resolveSync + exports fallback both failed)`);C=O}}catch(O){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(R)} (from ${s.filePath||"<unknown>"}): ${O?.message||O}`),c.push(R),""}if(a.has(C))return"";a.add(C);try{let O=Kt.readFileSync(C,"utf8");h.push({source:R,resolvedPath:C,contents:O})}catch(O){console.warn(`[stx:vendor-css] could not read ${C}: ${O?.message||O}`),c.push(R)}return""}),styles:h,unresolved:c}}function Fo(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Oo(e){if(e.length===0)return"";return`${e.map((s)=>`<style data-stx-vendor="${Fo(s.source)}" data-stx-layer="vendor">
|
|
127
127
|
@layer vendor {
|
|
128
128
|
${s.contents}
|
|
129
129
|
}
|
|
130
130
|
</style>`).join(`
|
|
131
131
|
`)}
|
|
132
|
-
`}var Kl=x,
|
|
132
|
+
`}var Kl=x,Tr=y(256);function Pt(e){let s=b(e),t=Tr.get(s);if(!t)t=Vo(e),Tr.set(s,t);return{code:t.code,imports:[...t.imports],models:[...t.models]}}function Vo(e){let s=o(e),t=new Set;for(let v of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let E of v[1].split(",")){let R=E.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(R)t.add(R)}let i=Tn(s),a=ye.filter((v)=>{if(t.has(v)||i.has(v))return!1;return No(s,v,!0)}),h=Pr(s).filter((v)=>!t.has(v)&&!i.has(v));if(a.length===0&&h.length===0)return{code:e,imports:a,models:h};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",h.length>0?"import '@stacksjs/browser'":"",h.length>0?`const { ${h.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
133
133
|
`)}
|
|
134
|
-
${e}`,imports:a,models:h}}var
|
|
134
|
+
${e}`,imports:a,models:h}}var Uo=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 Pr(e){let s=new Set,t=fs(e),i=Tn(e),a=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let h of t.code.matchAll(a)){let c=h[1];if(Uo.has(c)||i.has(c)||c.length<3)continue;if(t.shadows(c,h.index??0))continue;s.add(c)}return Array.from(s)}function Ho(e){return Tn(e)}var Ar=y(128);function Wa(e){let s=b(e),t=Ar.get(s);if(!t)t=Ko(e),Ar.set(s,t);return{code:t.code,stxImports:[...t.stxImports],browserImports:[...t.browserImports]}}function Ko(e){let s=new Set,t=new Set,i=e;i=i.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,h=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,c;while((c=h.exec(e))!==null){let O=c[1],M=c[2];if(c[0].includes("import type"))continue;let N=[];for(let P of O.split(",")){let Z=P.trim();if(!Z||Z.startsWith("type "))continue;let U=Z.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!U)continue;let V=U[1],X=U[2]||V;if(a.add(V),a.add(X),M==="stx"||M==="@stacksjs/stx")s.add(V);else t.add(V);if(X!==V)N.push(`${X} = ${V}`)}let I=N.length>0?`var ${N.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";i=i.replace(c[0],I)}let v=Ho(i);for(let O of Kl){if(a.has(O)||v.has(O))continue;if(No(i,O,!0))s.add(O)}let E=o(i),R=new Set;for(let O of i.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let M of O[1].split(",")){let N=M.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let I of N){let P=I.trim();if(P)R.add(P)}}for(let O of ye){if(a.has(O)||v.has(O)||R.has(O))continue;if(No(E,O))t.add(O)}let C=Pr(E);for(let O of C)if(!a.has(O)&&!v.has(O))t.add(O);return{code:i,stxImports:Array.from(s),browserImports:Array.from(t)}}function No(e,s,t=!1){let i=fs(e);e=i.code;let a=new RegExp(`\\b${s.replace(/[$]/g,"\\$")}\\b`,"g");for(let h of e.matchAll(a)){let c=h.index??0;if(i.shadows(s,c))continue;let v=c+s.length,E=c-1;while(E>=0&&/\s/.test(e[E]))E--;if(e[E]==="."&&e.slice(Math.max(0,E-2),E+1)!=="...")continue;let R=v;while(R<e.length&&/\s/.test(e[R]))R++;if(e[R]===":"&&e[R+1]!==":"&&(e[E]==="{"||e[E]===","))continue;if(t&&!/^\s*(?:<[^>]*>)?\s*\(/.test(e.slice(v)))continue;if(Zo(e,v))continue;return!0}return!1}function Zo(e,s){let t=s;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;if(e[t]!=="(")return!1;let i=0;for(;t<e.length;t++){let a=e[t];if(a==="(")i++;else if(a===")"){if(i--,i===0)break}}if(i!==0)return!1;t++;while(t<e.length&&(e[t]===" "||e[t]==="\t"))t++;return e[t]==="{"}function qa(e,s){let t=[];if(e.length>0)t.push(` var { ${e.join(", ")} } = window.stx || window;`);if(s.length>0)t.push(` var { ${s.join(", ")} } = window.StacksBrowser || {};`);if(t.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
135
135
|
${t.join(`
|
|
136
136
|
`)}
|
|
137
|
-
${
|
|
137
|
+
${qo(e,s)}`;return""}function $p(e,s=[]){let{browserImports:t}=Wa(e),i=new Set(s);return qa([],t.filter((a)=>!i.has(a)))}function qo(e,s){let t=[...e.map((i)=>`['${i}', typeof ${i}, 'stx']`),...s.map((i)=>`['${i}', typeof ${i}, '@stacksjs/browser']`)];if(t.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
138
138
|
[${t.join(", ")}].forEach(function (e) {
|
|
139
139
|
if (e[1] !== 'undefined') return;
|
|
140
140
|
console.error(
|
|
@@ -143,18 +143,18 @@ ${Zo(e,s)}`;return""}function $p(e,s=[]){let{browserImports:t}=Wa(e),i=new Set(s
|
|
|
143
143
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
144
144
|
);
|
|
145
145
|
});
|
|
146
|
-
`}function
|
|
146
|
+
`}function Ie(e){let s=e.__stxClientPayload;if(s&&typeof s==="object"){let i={};for(let a in s){let h=s[a];if(typeof h==="function")continue;i[a]=h}return i.__stxDeclaredPayload=!0,i}let t={};for(let i in e){if(i.startsWith("__")||i.startsWith("$"))continue;let a=e[i];if(typeof a==="function")continue;t[i]=a}return t}var Xo=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Ir=new Set;function Jo(e,s){let t=Xo.test(e),i=s.length>32768;if(!t&&!i)return;if(Ir.has(e))return;if(Ir.add(e),t)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 ${(s.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 dn(e,s){if(!s)return"";let t=rn(e,new Set(Object.keys(s))),i=s.__stxDeclaredPayload===!0,a=[],h=Object.entries(s).sort(([c],[v])=>c<v?-1:c>v?1:0);for(let[c,v]of h){if(!/^[A-Za-z_$][\w$]*$/.test(c))continue;if(c.startsWith("__")||c.startsWith("$"))continue;if(!i&&!t.has(c))continue;if(Ht(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 E;try{E=JSON.stringify(v)}catch{continue}if(E===void 0)continue;Jo(c,E),a.push(` var ${c} = ${E.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
147
147
|
${a.join(`
|
|
148
148
|
`)}
|
|
149
|
-
`}var
|
|
149
|
+
`}var Yo={left:0,middle:1,right:2};function Qo(e){let s=[];if(e.self)s.push("if ($event.target !== $el) return");for(let t of e.systemKeys)s.push(`if (!$event.${t}Key) return`);if(e.keys.length>0){let t=e.keys.map((i)=>`$event.key === '${i}'`).join(" || ");s.push(`if (!(${t})) return`)}if(e.mouse!==null){let t=Yo[e.mouse];s.push(`if ($event.button !== ${t}) return`)}if(e.prevent)s.push("$event.preventDefault()");if(e.stop)s.push("$event.stopPropagation()");return s.join("; ")}function ea(e,s){let{elementId:t,event:i,modifiers:a}=e,h=es(e.handler),c=Qo(a),v=[];if(a.once)v.push("once: true");if(a.capture)v.push("capture: true");if(Qn(i,a))v.push("passive: true");let E=v.length>0?`, { ${v.join(", ")} }`:"",R="";if(c)R+=`${c}; `;let C=h.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),O=`var $emit = function(name, detail) {
|
|
150
150
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
151
|
-
};`;function
|
|
152
|
-
${
|
|
151
|
+
};`;function M(N){if(/\$emit\s*\(/.test(N))return`${O}
|
|
152
|
+
${N}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
153
153
|
if (scope && scope.__stx_execute) {
|
|
154
154
|
scope.__stx_execute('${C}', $event, $el);
|
|
155
155
|
}
|
|
156
156
|
else {
|
|
157
|
-
${
|
|
157
|
+
${N}
|
|
158
158
|
}`}if(a.debounce!==null)return` ;(function() {
|
|
159
159
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
160
160
|
var $el = document.getElementById('${t}')
|
|
@@ -162,7 +162,7 @@ else {
|
|
|
162
162
|
var __timer
|
|
163
163
|
$el.addEventListener('${i}', function($event) {
|
|
164
164
|
${c?c+"; ":""}clearTimeout(__timer)
|
|
165
|
-
__timer = setTimeout(function() { ${
|
|
165
|
+
__timer = setTimeout(function() { ${M(h)} }, ${a.debounce})
|
|
166
166
|
}${E})
|
|
167
167
|
})()`;if(a.throttle!==null)return` ;(function() {
|
|
168
168
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
@@ -173,7 +173,7 @@ else {
|
|
|
173
173
|
${c?c+"; ":""}var __now = Date.now()
|
|
174
174
|
if (__now - __last >= ${a.throttle}) {
|
|
175
175
|
__last = __now
|
|
176
|
-
${
|
|
176
|
+
${M(h)}
|
|
177
177
|
}
|
|
178
178
|
}${E})
|
|
179
179
|
})()`;if(/\$emit\s*\(/.test(h))return` var $el = document.getElementById('${t}')
|
|
@@ -189,14 +189,14 @@ else {
|
|
|
189
189
|
else {
|
|
190
190
|
${h}
|
|
191
191
|
}
|
|
192
|
-
}${E})`}function
|
|
192
|
+
}${E})`}function ta(e){if(e.length===0)return"";return`
|
|
193
193
|
// STX: auto-generated event bindings
|
|
194
|
-
${e.map((t,i)=>
|
|
195
|
-
`)}`}function
|
|
196
|
-
`)c++;continue}if(v==="/"&&i[c+1]==="*"){c+=2;while(c<h-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(v==="{"){a++,c++;continue}if(v==="}"){a--,c++;continue}if(a===0){let E=i.slice(c),R=E.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let
|
|
194
|
+
${e.map((t,i)=>ea(t,i)).join(`
|
|
195
|
+
`)}`}function Or(e){let s=[],t=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,h=i.length,c=0;while(c<h){let v=i[c];if(v==="'"||v==='"'||v==="`"){let E=v;if(c++,E==="`"){let R=0;while(c<h){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&R===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){R++,c+=2;continue}if(i[c]==="}"&&R>0){R--,c++;continue}c++}}else while(c<h){if(i[c]==="\\"){c+=2;continue}if(i[c]===E){c++;break}c++}continue}if(v==="/"&&i[c+1]==="/"){while(c<h&&i[c]!==`
|
|
196
|
+
`)c++;continue}if(v==="/"&&i[c+1]==="*"){c+=2;while(c<h-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(v==="{"){a++,c++;continue}if(v==="}"){a--,c++;continue}if(a===0){let E=i.slice(c),R=E.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let M=R[1];if(!M.startsWith("_")&&!t.has(M))s.push(M),t.add(M);c+=R[0].length;continue}let C=E.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(C){C[1].split(",").forEach((M)=>{let N=M.trim(),I=N.indexOf(":"),P=I>=0?N.slice(I+1).trim().split(/[\s=]/)[0]:N.split(/[\s=]/)[0];if(P&&!P.startsWith("_")&&!t.has(P))s.push(P),t.add(P)}),c+=C[0].length;continue}let O=E.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(O){let M=O[1];if(!M.startsWith("_")&&!t.has(M))s.push(M),t.add(M);c+=O[0].length;continue}}c++}return s}var na=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 sa(e){let s=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(M){let N;while((N=t.exec(M))!==null){let I=N[0];if(!na.has(I))s.add(I)}}let a=/\{\{([\s\S]*?)\}\}/g,h;while((h=a.exec(e))!==null)i(h[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((h=c.exec(e))!==null)i(h[1]);let v=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((h=v.exec(e))!==null)i(h[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((h=E.exec(e))!==null)i(h[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((h=R.exec(e))!==null)i(h[1]);let C=/@model\s*=\s*["']([^"']*)["']/gi;while((h=C.exec(e))!==null)i(h[1]);let O=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((h=O.exec(e))!==null)i(h[1]);return s}async function Oe(e,s={}){let t=e,i="",a=!1,h=[],c=Io(t,{filePath:s.filePath,projectRoot:s.projectRoot});t=c.code;let v=Oo(c.styles),E=Pt(t);t=E.code,h=[...E.imports,...E.models];let{hasUserImports:R,bundleClientScript:C}=await r("stx/client-script-bundler",()=>import("./chunk-h15xb2vd.js"));if(R(t))t=await C(t,s.filePath||"",{projectRoot:s.projectRoot,minify:s.production}),a=!0;if(s.autoImports!==!1){let X=Wa(t);t=X.code,i=qa(X.stxImports,X.browserImports.filter((Y)=>!h.includes(Y)))}if(i=`${dn(t,s.serverData)}${i}`,t=T(t),!a&&Ne(s.attrs||""))t=De(t);let O=ta(s.eventBindings||[]),M=(s.attrs||"").trim(),N=/\btype\s*=\s*["']module["']/i.test(M),I=s.instanceId?` data-stx-instance="${s.instanceId}"`:"";if(N){let X=M.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Y=`type="module" data-stx-scoped${I}${X?` ${X}`:""}`;return`${v}<script ${Y}>
|
|
197
197
|
${sn(`${i}${t}
|
|
198
198
|
${O}`)}
|
|
199
|
-
</script>`}let
|
|
199
|
+
</script>`}let P=Go(e),Z=/function __stx_setup_/.test(t),U=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function V(X){let Y=X.length>0?`
|
|
200
200
|
return ${rs(t,X)};`:"",Q=JSON.stringify(`[stx] client block failed${s.filePath?` (${s.filePath})`:""}; this block will not hydrate`);return`${v}<script data-stx-scoped data-stx-run="always"${I}>
|
|
201
201
|
window.stx.mount(function() {
|
|
202
202
|
'use strict';
|
|
@@ -207,7 +207,7 @@ ${O}${Y}`)}
|
|
|
207
207
|
console.error(${Q}, error);
|
|
208
208
|
return {};
|
|
209
209
|
}
|
|
210
|
-
})</script>`}if(!U&&!Z){if(
|
|
210
|
+
})</script>`}if(!U&&!Z){if(P)return V(Or(e));if(s.templateContent){let X=Or(e);if(X.length>0){let Y=sa(s.templateContent);if(X.some((se)=>Y.has(se)))return V(X)}}}return`${v}<script data-stx-scoped data-stx-run="always"${I}>
|
|
211
211
|
;(function() {
|
|
212
212
|
'use strict';
|
|
213
213
|
try {
|
|
@@ -216,7 +216,7 @@ ${O}`)}
|
|
|
216
216
|
} catch (error) {
|
|
217
217
|
console.error(${JSON.stringify(`[stx] client block failed${s.filePath?` (${s.filePath})`:""}; this block will not hydrate`)}, error);
|
|
218
218
|
}
|
|
219
|
-
})()</script>`}import{createHash as
|
|
219
|
+
})()</script>`}import{createHash as ra}from"crypto";var An="__stx_component_client_factories";function In(e){let s=e[An];return s instanceof Map?s:null}function za(e){e[An]=new Map}function _s(e,s){let t=In(e);if(!t)return null;let i=ra("sha256").update(s).digest("hex").slice(0,16),a=t.get(i);if(a)a.instances++;else t.set(i,{body:s,instances:1});return i}function Ha(e,s){let t=In(s);if(!t?.size)return e;let i=new Map;for(let[C,O]of t)if(O.instances===1)i.set(C,O.body);let a=[];if(i.size>0){let C=[...i.keys()].map((N)=>JSON.stringify(N).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),O=new RegExp(`window\\.__stxComponentFactories\\[(${C})\\]\\(("[^"]+")\\);`,"g"),M=O.exec(e);while(M!==null){let N=i.get(JSON.parse(M[1]));if(N!==void 0)a.push({start:M.index,end:M.index+M[0].length,replacement:`(${N})(${M[2]});`});M=O.exec(e)}}let h=[...t].filter(([,C])=>C.instances>1);if(h.length===0)return Mr(e,a);let v=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
220
220
|
(function() {
|
|
221
221
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
222
222
|
${h.map(([C,O])=>` try { factories[${JSON.stringify(C)}] = factories[${JSON.stringify(C)}] || ${O.body}; }
|
|
@@ -224,14 +224,14 @@ ${h.map(([C,O])=>` try { factories[${JSON.stringify(C)}] = factories[${JSON.str
|
|
|
224
224
|
`)}
|
|
225
225
|
})();
|
|
226
226
|
</script>`,E=e.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),R=E<0?0:E;return a.push({start:R,end:R,replacement:`${v}
|
|
227
|
-
`}),Pr(e,a)}function Pr(e,s){if(s.length===0)return e;s.sort((h,c)=>h.start-c.start||h.end-c.end);let t=Array(s.length*2+1),i=0,a=0;for(let h of s)t[a++]=e.slice(i,h.start),t[a++]=h.replacement,i=h.end;return t[a]=e.slice(i),t.join("")}function Mr(e){let s=In(e),t=new Map;if(s)for(let[i,a]of s)t.set(i,a.instances);return t}function Dr(e,s){let t=In(e);if(!t)return[];let i=[];for(let[a,h]of t){let c=h.instances-(s.get(a)??0);if(c>0)i.push({body:h.body,count:c})}return i}function jr(e,s){for(let{body:t,count:i}of s)for(let a=0;a<i;a++)xs(e,t)}function Ye(e,s,t=2){let i=0,a=null;for(let h=s+t;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){i++;continue}if(c==="}"){if(i>0){i--;continue}let v=0;while(e[h+v]==="}")v++;if(v>=t)return h}}return-1}import Zr from"fs";var Nr=0,_s=new Map;function Xa(){Nr=0,_s.clear()}function On(e,s){let t=Nr++,i=`<!--__STX_${e.toUpperCase()}_${t}__-->`;return _s.set(i,{type:e,expression:s}),i}function Ja(){let e={};for(let[s,t]of _s)e[s]={type:t.type,expression:t.expression};return e}function Ya(e,s){let t=e;for(let[i,a]of s)t=t.split(i).join(a);return t}function Mo(e){return e.includes("<!--__STX_")}var ra=/@(?=[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 ia(e){return Array.from({length:e},()=>"{").join("⁠")}function Lr(e){return e.replace(/\{{2,}/g,(s)=>ia(s.length)).replace(/\{(?=!)/g,"{⁠").replace(ra,"@")}function cs(e,s,t=!1){let i="",a=0;for(let R=0;R<s;R++){if(!e.startsWith("{{",R))continue;let C=Ye(e,R);if(C<0||C+2>s)break;i+=e.slice(a,R)+"x",R=C+1,a=C+2}i+=e.slice(a,s);let h=-1,c=null;for(let R=0;R<i.length;R++){let C=i[R];if(c){if(C===c)c=null;continue}if(h>=0||t){if(C==='"'||C==="'"){c=C;continue}if(C===">"){h=-1;continue}}if(C==="<")h=R}if(h<0&&!t)return null;let v=h>=0?i.slice(h+1):i;if(h>=0&&/^\s*[!/?]/.test(v))return/^\s*\/?\s*$/.test(v)?{kind:"tag-name"}:null;if(h>=0&&/^\s*$/.test(v))return{kind:"tag-name"};let E=0;if(h>=0)while(E<v.length&&!/\s/.test(v[E]))E++;while(E<v.length){while(/\s/.test(v[E]??"")&&E<v.length)E++;let R=E;while(E<v.length&&!/[\s=/>]/.test(v[E]))E++;let C=v.slice(R,E);if(!C)break;while(E<v.length&&/\s/.test(v[E]))E++;if(v[E]!=="=")continue;E++;while(E<v.length&&/\s/.test(v[E]))E++;let O=v[E];if(O==='"'||O==="'"){let P=++E,M=v.indexOf(O,E);if(M===-1)return{kind:"attribute",name:C,quote:O,valuePrefix:v.slice(P)};E=M+1}else{let P=E;while(E<v.length&&!/\s/.test(v[E]))E++;if(E===v.length)return{kind:"attribute",name:C,quote:null,valuePrefix:v.slice(P)}}}return{kind:"tag"}}class le extends Error{attribute;constructor(e,s){super(`Unsafe interpolation in ${e}: ${s}`);this.name="UnsafeInterpolationContextError",this.attribute=e}}var Br="unsafe:";var oa=/^(?:javascript|vbscript|livescript|mocha|view-source):/,aa=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,ca=/^data:(?:text\/html|application\/xhtml\+xml)/,la=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function ua(e){return e.replace(la,"").toLowerCase()}function ws(e){let s=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(s))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(s))return"fetched";return null}function Pn(e,s="navigable"){let t=ua(e);if(oa.test(t))return!0;return s==="navigable"?aa.test(t):ca.test(t)}function sr(e,s="navigable"){return Pn(e,s)?"unsafe:"+e:e}function fa(e){let s=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!s)return null;if(s[3].trim()!=="")return null;return ws(s[1])}function zr(e,s,t=256){if(s<=t)return e.slice(0,s);let i=e.slice(s-t,s),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function Wr(e,s,t=s){let i=fa(e);return i&&Pn(s,i)?"unsafe:"+t:t}var Mn=/<script\b[^>]*>/iy,Rs=/<\/script\s*>/ig,Dn=/<style\b[^>]*>/iy,Cs=/<\/style\s*>/ig;function Fr(e,s,t,i){t.lastIndex=s;let a=t.exec(e);if(!a||a.index!==s)return-1;i.lastIndex=t.lastIndex;let h=i.exec(e);if(!h)return-1;return h.index+h[0].length}function W(e,s){return Fr(e,s,Mn,Rs)}function on(e,s){return Fr(e,s,Dn,Cs)}function Re(e,s){if(!e.startsWith("<!--",s))return-1;let t=e.indexOf("-->",s+4);if(t===-1)return-1;return t+3}function Vr(e,s){if(e.startsWith("<!--",s)){let a=Re(e,s);return a===-1?e.length:a}if(Mn.lastIndex=s,Mn.exec(e)?.index===s){Rs.lastIndex=Mn.lastIndex;let a=Rs.exec(e);return a?a.index+a[0].length:e.length}if(Dn.lastIndex=s,Dn.exec(e)?.index===s){Cs.lastIndex=Dn.lastIndex;let a=Cs.exec(e);return a?a.index+a[0].length:e.length}return-1}function ae(e,s){let t=[],i=0,a=e.length,h=!1,c=null;while(i<a){let v=e[i];if(h){if(c){if(v===c)c=null}else if(v==='"'||v==="'")c=v;else if(v===">")h=!1;i++;continue}if(v!=="<"){let O=e.indexOf("<",i+1);if(O===-1)break;i=O;continue}let E=s(e,i);if(E>i){t.push({start:i,end:E,token:e.slice(i,E)}),i=E;continue}let R=Vr(e,i);if(R>i){i=R;continue}let C=e.charCodeAt(i+1);if(C>=65&&C<=90||C>=97&&C<=122)h=!0;i++}return t}function Ur(e){let s=0,t=0,i=0,a=!1,h=null;while(i<e.length){if(a){let O=e[i];if(h){if(O===h)h=null}else if(O==='"'||O==="'")h=O;else if(O===">")a=!1;i++;continue}let c=e.indexOf("<",i),v=c===-1?e.length:c;while(i<v){let O=e[i++];if(O==="{")s++;else if(O==="}")t++;if(s>=2&&t>=2)return!0}if(c===-1)break;let E=Vr(e,c);if(E>c){i=E;continue}let R=e.charCodeAt(c+1),C=R===47?e.charCodeAt(c+2):R;if(C>=65&&C<=90||C>=97&&C<=122)a=!0;i=c+1}return!1}function $a(e,s){while(e.size>=s){let t=e.keys().next();if(t.done)return;e.delete(t.value)}}var pa=1024,da=16777216,St=new Map,$s=0;function ga(e,s){St.set(e,s),$s+=e.length+s.output.length;for(let[t,i]of St){if($s<=da)break;St.delete(t),$s-=t.length+i.output.length}}function ce(e,s,t,i){let a=i!==void 0&&e.length>=pa,h=a?`${i}\x00${e}`:"";if(a){let C=St.get(h);if(C)return St.delete(h),St.set(h,C),{output:C.output,tokens:C.tokens.slice()}}let c=ae(e,s);if(c.length===0)return{output:e,tokens:[]};let v=c.map((C)=>C.token),E="",R=0;for(let C=0;C<c.length;C++){let O=c[C];E+=e.slice(R,O.start),E+=t(O.token,C),R=O.end}if(E+=e.slice(R),a)return ga(h,{output:E,tokens:v}),{output:E,tokens:v.slice()};return{output:E,tokens:v}}var ma=1024,ha=16777216,vt=new Map,vs=0;function xa(e,s){vt.set(e,s),vs+=e.length+s.output.length;for(let[t,i]of vt){if(vs<=ha)break;vt.delete(t),vs-=t.length+i.output.length}}function Es(e,s,t){return{output:s,scripts:t,restore:(i)=>i===s?e:or(i,t)}}function q(e){let s=e.length>=ma;if(s){let a=vt.get(e);if(a)return vt.delete(e),vt.set(e,a),Es(e,a.output,a.scripts.slice())}let{output:t,tokens:i}=ce(e,W,(a,h)=>`\x00STX_SCRIPT_${h}\x00`);if(s)return xa(e,{output:t,scripts:i}),Es(e,t,i.slice());return Es(e,t,i)}function or(e,s){if(s.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(t,i)=>s[+i]??"")}function Et(e){let s=e.indexOf(" as ");if(s!==-1){let h=e.slice(0,s).trim(),c=e.slice(s+4).trim();return h&&c?{arrayExpr:h,itemVar:c}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let i=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=t[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function jn(e){let s=[],t=0,i="",a=0;for(let h=0;h<e.length;h++){let c=e[h];if(i){if(c==="\\")h++;else if(c===i)i="";continue}if(c==="'"||c==='"'||c==="`")i=c;else if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)s.push(e.slice(a,h)),a=h+1}return s.push(e.slice(a)),s}function Hr(e,s){let t=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a===s&&t===0)return i}return-1}function Kr(e){let s=0;for(let t=0;t<e.length;t++){let i=e[t];if(i==="("||i==="["||i==="{")s++;else if((i===")"||i==="]"||i==="}")&&--s===0)return t}return-1}function gt(e,s){let t=e.trim().replace(/^\.\.\./,"").trim(),i=Hr(t,"=");if(i!==-1&&t[i+1]!==">")t=t.slice(0,i).trim();if(!t)return;if(t.startsWith("{")&&t.endsWith("}")){for(let a of jn(t.slice(1,-1))){let h=a.trim();if(!h)continue;if(h.startsWith("...")){gt(h,s);continue}let c=Hr(h,":");gt(c===-1?h:h.slice(c+1),s)}return}if(t.startsWith("[")&&t.endsWith("]")){for(let a of jn(t.slice(1,-1)))gt(a,s);return}if(/^[A-Z_$][\w$]*$/i.test(t))s.push(t)}function Tt(e){let s=e.trim(),t=[],i=0;for(let h=0;h<s.length;h++){let c=s[h];if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(i===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(s.slice(h)))continue;let E=s.slice(0,h).trim();if(E.startsWith("(")&&Kr(E)===E.length-1)E=E.slice(1,-1);for(let R of jn(E))gt(R,t);if(t.length>0)return t;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(s);if(a){let h=a[1].trim();if(h.startsWith("(")&&Kr(h)===h.length-1)h=h.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(h);if(c)gt(c[2],t),gt(c[1],t);else for(let v of jn(h))gt(v,t)}return t}function ue(e,s){let t=s instanceof Set?s:new Set(s);if(t.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let v of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(t.has(v))return!0;return!1}var Nn="__stx_client_loop_names";function Ze(e){let s=e?.[Nn];return Array.isArray(s)?s:[]}function Ln(e){if(!e.includes("#")&&!e.includes("v-slot:"))return[];let s=[],t=[],i=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(i)){let h=a[0];if(/^<\/template\s*>$/i.test(h)){let c=t.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(h)&&!/\/\s*>$/.test(h)){let v=[...h.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((C)=>/^(?:#[\w-]+|v-slot:[\w-]+)$/i.test(C[1])),E=(v?.[2]??v?.[3])?.trim(),R=E?{start:a.index+h.length,end:e.length,binding:E}:void 0;if(t.push(R),R)s.push(R)}}return s}var qt={},qr=new Map;function ba(e){let s=qr.get(e);if(!s){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");s=new RegExp(`:${t}(?!\\w)`,"g"),qr.set(e,s)}return s.lastIndex=0,s}var hs={uppercase:(e,s)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,s)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,s)=>{if(e===void 0||e===null)return"";let t=String(e);return t.charAt(0).toUpperCase()+t.slice(1)},number:(e,s,t=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(t),10))}catch{return""}},fmt:(e,s,t="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(t)}catch{return String(e)}},join:(e,s,t=",")=>{if(!Array.isArray(e))return"";return e.join(String(t))},escape:(e,s)=>{if(e===void 0||e===null)return"";return F(String(e))},translate:(e,s,t={})=>{if(!s||!s.__translations)return e;let i=s.__translations,a=s.__i18nConfig?.fallbackToKey??!0,h=String(e).split("."),c=i;for(let E of h){if(c===void 0||c===null)break;c=c[E]}if(c===void 0||c===null)return a?e:"";let v=String(c);return Object.entries(t).forEach(([E,R])=>{v=v.replace(ba(E),()=>String(R))}),v},t:(e,s,t={})=>hs.translate(e,s,t),truncate:(e,s,t=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=t)return a;if(t<=i.length)return i.substring(0,t);return a.substring(0,t-i.length)+i},date:(e,s,t="short",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let h={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(t==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,h[t]||h.short).format(a)}catch{return String(e)}},currency:(e,s,t="USD",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(i,{style:"currency",currency:t}).format(a)}catch{return String(e)}},pluralize:(e,s,t,i)=>{let a=Number(e);if(Number.isNaN(a))return t;let h=i||`${t}s`;return a===1?t:h},first:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let t=String(e);return t.charAt(t.length-1)},length:(e,s)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,s,t=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return t?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,s,t="")=>e===void 0||e===null||e===""?t:e,reverse:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,s,t=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(t,i);return e},replace:(e,s,t,i="")=>{if(e===void 0||e===null)return"";let a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,s)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,s)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,s)=>{let t=Number(e);return Number.isNaN(t)?0:Math.abs(t)},round:(e,s,t=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**t;return Math.round(i*a)/a}};function ru(e,s){if(e in hs)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);qt[e]=s}function Ap(e){for(let[s,t]of Object.entries(e))ru(s,t)}function su(){return{...hs,...qt}}function Pp(){for(let e of Object.keys(qt))delete qt[e]}function It(e,s,t=2){let i="{".repeat(t);if(!e.includes(i))return e;let a="",h=0;for(;;){let c=e.indexOf(i,h);if(c===-1)break;let v=Ye(e,c,t);if(v===-1)break;a+=e.slice(h,c)+s(e.slice(c,v+t),e.slice(c+t,v),c),h=v+t}return h===0?e:a+e.slice(h)}function m(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function F(e){return Lr(m(e))}function ya(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function _a(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(s,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function wa(e,s){let t=_a(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(t))throw new le(s,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(t))!==null){let h=a[1].replace(/^["']|["']$/g,""),c=h.startsWith("/")&&!h.startsWith("//")||h.startsWith("./")||h.startsWith("../")||h.startsWith("#"),v=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(h);if(!c&&!v)throw new le(s,"CSS URLs must be local paths or base64 raster images")}}function K(e,s,t,i=!1,a=0){let h=cs(e,s,i),c=F(t);if(!h)return c;if(h.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(t))throw new le("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return t}if(h.kind==="tag"){let R=e.slice(s+a).trimStart(),C=t.trim();if(!R.startsWith("=")&&(C===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(C)))return C;throw new le("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let v=h.name.toLowerCase();if(/^on[a-z]/.test(v))throw new le(h.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(v==="srcdoc")c=F(c);if(v==="style")wa(t,h.name);if(h.quote===null)c=ya(c);let E=ws(v);if(E&&h.valuePrefix.trim()===""&&Pn(t,E))return Br+c;return Wr(zr(e,s),t,c)}function fn(e,s){let t=` ${e}="`;return K(t,t.length,s,!0)}function ei(e){return e.flatMap((s)=>{let t=s.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!t||/\bserver\b|\bsrc\s*=/.test(t[1])?[]:[t[2]]})}function ye(e,s){let{scripts:t}=q(e);for(let i of ei(t)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i))return!0;if(br(i,s))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function ou(e){let s=[],t=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=t.exec(e);i;i=t.exec(e)){let a=i[1].toLowerCase(),h=new Set(Tt(i[3]));if(h.size===0)continue;let c=i.index+i[0].length;if(i[0].endsWith("/>")){s.push({start:i.index,end:c,names:h});continue}let v=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");v.lastIndex=c;let E=1,R=e.length;for(let C=v.exec(e);C;C=v.exec(e)){if(C[2]==="/")continue;if(E+=C[1]==="/"?-1:1,E===0){R=C.index+C[0].length;break}}s.push({start:i.index,end:R,names:h})}return s}function Xr(e,s,t){let i=o(t);for(let a of e){if(s<a.start||s>=a.end)continue;for(let h of a.names)if(new RegExp(`(?<![.#\\w$])${h.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function Jr(e,s){let t=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",h=!1,c=0;for(let R=0;R<i.length;R++){let C=i[R];if(!h&&C==="`"){h=!0,c=0;continue}if(h){if(C==="`"&&c===0){h=!1;continue}if(C==="$"&&i[R+1]==="{"){c++,R++,a+=" ";continue}if(C==="}"&&c>0){c--;continue}if(c>0){a+=C;continue}continue}a+=C}i=a;let v=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,E;while((E=v.exec(i))!==null){let R=E[1];if(!i.substring(0,E.index).trimEnd().endsWith(".")){if(!t.includes(R)&&!(R in s))return!1}}return!0}function Sa(e,s){let t=s.__stx_serverDeclared;if(!t||t.size===0)return!1;let i=o(e);for(let a of t)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var Gr=new Set;function Yr(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function Qr(e,s){let t=`${s??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Gr.has(t))Gr.add(t),console.warn(`[stx] {{ ${e} }} in a <script> in ${s??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function Lo(e,s,t){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,h)=>{try{let c=_(h,s);if(c===void 0)return Yr(h)?Qr(h.trim(),t):a;return c===null?"":String(c)}catch{return a}}),i=It(i,(a,h,c)=>{let v=h.trim();if(/^__[A-Z_]+__$/.test(v))return a;try{let E=_(h,s);if(E===void 0)return Yr(v)?Qr(v,t):a;return JSON.stringify(E).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(R)=>"\\u007b".repeat(R.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function iu(e,s){if(!e.includes("{"))return e;let t=e;return t=t.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let h=_(a,s);if(h===void 0)return i;return h===null?"":String(h)}catch{return i}}),t=It(t,(i,a,h)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return i;try{let v=_(a,s);if(v===void 0)return i;if(v===null)return"";let E=String(v);return K(t,h,E,!0,i.length)}catch(v){if(v instanceof le)throw v;return i}}),t}function Ip(e,s,t={}){let{output:i,scripts:a}=q(e),h=a.map((c)=>{let v=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),E=c.search(/<\/script\s*>$/i);if(!v||E===-1)return c;let R=v[1],C=c.slice(v[0].length,E);if(/\bdata-raw\b/.test(R))return c;if(t.skipServer&&/\bserver\b/.test(R))return c;let P=`<script${iu(R,s)}>`;if(/\bsrc\s*=/.test(R)||/\btype\s*=\s*["']application\/json["']/.test(R))return P+C+c.slice(E);return P+Lo(C,s)+c.slice(E)});return or(i,h)}function k(e,s,t){let i=e,a=(I,N)=>{let Z=on(I,N);if(Z===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(I.slice(N,Z))?-1:Z},h=(I,N,Z,U)=>{let V=Z.length,{output:X,tokens:Y}=ce(I,N,(Q,se)=>U(V+se));return Z.push(...Y),X},c=[];i=h(i,a,c,(I)=>`<!--__STX_STYLE_${I}__-->`);let v=[];i=h(i,W,v,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`);let E=s?.__stx_signals_gate===!0||ye(e),R=new Set([...Array.isArray(s?.__stx_client_signal_names)?s.__stx_client_signal_names:[],...Do(ei(v))]),C=new Set(Array.isArray(s?.__stx_preserved_client_expressions)?s.__stx_preserved_client_expressions:[]);i=It(i,(I,N,Z)=>{try{let U=_(N,s,!1,(V)=>Ts(V,I,t,e));return U!==void 0&&U!==null?String(U):""}catch(U){let V=U instanceof Error?U.message:String(U);return g("Expression",`Error evaluating: {{{ ${N.trim()}}}}: ${V}`,t,e,Z,I)}},3),i=i.replace(/\{!!([\s\S]*?)!!\}/g,(I,N,Z)=>{try{let U=_(N,s,!1,(V)=>Ts(V,I,t,e));if(U===void 0&&s.__stx_buildMode==="compile")return On("raw",N.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(s.__stx_buildMode==="compile")return On("raw",N.trim());let V=U instanceof Error?U.message:String(U);return g("Expression",`Error evaluating: {!! ${N.trim()} !!}: ${V}`,t,e,Z,I)}}),i=h(i,W,v,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`),i=h(i,a,c,(I)=>`<!--__STX_STYLE_${I}__-->`);let O=E?ou(i):[],P=Ln(i).map((I)=>({...I,names:new Set(Tt(`${I.binding} in __slot`))})),M=new Set(Ze(s));if(i=It(i,(I,N,Z)=>{let U=N.trim();if(Xr(P,Z,U))return I;if(ue(U,M))return I;if(O.length>0&&Xr(O,Z,U))return I;if(C.has(U))return I;let V=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],X=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,Q=U.match(X)?.[1],se=Q&&((Q in s)||V.includes(Q)),pe=Boolean(Q&&R.has(Q)),Se=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Ee=U.match(Se),Be=Ee&&!V.includes(Ee[1])&&!(Ee[1]in s);if(/^__[A-Z_]+__$/.test(U))return"";if(pe)return I;let Ce;try{let Ue=_(N,s,!1,(mt)=>{Ce=mt});if(E&&!Jr(U,s))return I;if(Ce)Ts(Ce,I,t,e);if(s.__stx_buildMode==="compile"&&!E&&(Ue===void 0||Sa(U,s)))return On("expr",U);if(Ue===void 0||Ue===null)return"";let Je=String(Ue);return K(i,Z,Je,!1,I.length)}catch(Ue){if(Ue instanceof le)throw Ue;if(E&&!Jr(U,s))return I;if(Be)return I;let Je=Ue instanceof Error?Ue.message:String(Ue);return g("Expression",`Error evaluating: {{ ${U} }}: ${Je}`,t,e,Z,I)}}),v.length>0)i=i.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(I,N)=>v[Number(N)]??I);if(c.length>0)i=i.replace(/<!--__STX_STYLE_(\d+)__-->/g,(I,N)=>c[Number(N)]??I);return i}function au(e,s,t){if(!s.trim())return e;let i=e,a=s.trim();while(a.length>0){let h=a.match(/^(\w+)/);if(!h)break;let c=h[1];a=a.substring(c.length).trim();let v=qt[c]||hs[c];if(!v)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(su()).join(", ")}`);let E=[];if(a.startsWith(":")){let R=a.match(/^:([^|\s]+)/);if(R){let C=R[1].trim();try{let O=Number(C);E=[Number.isNaN(O)?C:O]}catch{E=[C]}a=a.substring(R[0].length).trim()}}else if(a.startsWith("(")){let R=1,C=1;while(R>0&&C<a.length){if(a[C]==="(")R++;if(a[C]===")")R--;C++}if(R===0){let O=a.substring(1,C-1).trim();if(O)try{if(O.startsWith("{")&&O.endsWith("}"))E=[_(`(${O})`,t,!0)];else{let P=[],M="",I=null,N=0,Z=0,U=0,V=!1;for(let X=0;X<O.length;X++){let Y=O[X];if(V){M+=Y,V=!1;continue}if(Y==="\\"){M+=Y,V=!0;continue}if(I){if(M+=Y,Y===I)I=null;continue}if(Y==='"'||Y==="'"||Y==="`"){I=Y,M+=Y;continue}if(Y==="(")N++;else if(Y===")")N--;else if(Y==="[")Z++;else if(Y==="]")Z--;else if(Y==="{")U++;else if(Y==="}")U--;if(Y===","&&N===0&&Z===0&&U===0){P.push(M),M="";continue}M+=Y}if(M)P.push(M);E=P.map((X)=>{let Y=X.trim();return _(Y,t,!0)})}}catch{E=[O]}a=a.substring(C).trim()}}try{i=v(i,t,...E)}catch(R){let C=R instanceof Error?R.message:String(R);throw Error(`Error applying filter '${c}': ${C}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function va(e){let s=!1,t="",i=0,a=0,h=0,c=!1;for(let v=0;v<e.length;v++){let E=e[v],R=e[v+1];if(s&&c){c=!1;continue}if(s&&E==="\\"){c=!0;continue}if(c=!1,(E==='"'||E==="'"||E==="`")&&!c){if(!s)s=!0,t=E;else if(E===t)s=!1,t="";continue}if(s&&t==="`"&&E==="$"&&R==="{"){let C=1;v+=2;while(v<e.length&&C>0){if(e[v]==="{")C++;else if(e[v]==="}")C--;if(C>0)v++}continue}if(s)continue;if(E==="(")i++;else if(E===")")i--;else if(E==="[")a++;else if(E==="]")a--;else if(E==="{")h++;else if(E==="}")h--;if(E==="|"&&i===0&&a===0&&h===0){if(R==="|"){v++;continue}if(R==="="){v++;continue}return v}}return-1}var Zt=new Set,ka=1000;function Op(){Zt.clear()}function Ts(e,s,t,i){if(!H())return;let a=`${t}\x00${e.expression}`;if(Zt.has(a))return;if(Zt.size>=ka)Zt.clear();Zt.add(a);let h=t,c=i;try{if(t&&Zr.existsSync(t))c=Zr.readFileSync(t,"utf8")}catch{}let v=c.indexOf(s);if(v>=0)h=`${t}:${c.slice(0,v).split(`
|
|
228
|
-
`).length}`;console.warn(`${h}: stx warning: ${s} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function _(e,s,t=!1,i){try{let a=e.trim(),h=
|
|
227
|
+
`}),Mr(e,a)}function Mr(e,s){if(s.length===0)return e;s.sort((h,c)=>h.start-c.start||h.end-c.end);let t=Array(s.length*2+1),i=0,a=0;for(let h of s)t[a++]=e.slice(i,h.start),t[a++]=h.replacement,i=h.end;return t[a]=e.slice(i),t.join("")}function Dr(e){let s=In(e),t=new Map;if(s)for(let[i,a]of s)t.set(i,a.instances);return t}function jr(e,s){let t=In(e);if(!t)return[];let i=[];for(let[a,h]of t){let c=h.instances-(s.get(a)??0);if(c>0)i.push({body:h.body,count:c})}return i}function Nr(e,s){for(let{body:t,count:i}of s)for(let a=0;a<i;a++)_s(e,t)}function he(e,s,t=2){let i=0,a=null;for(let h=s+t;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){i++;continue}if(c==="}"){if(i>0){i--;continue}let v=0;while(e[h+v]==="}")v++;if(v>=t)return h}}return-1}import qr from"fs";var Lr=0,ws=new Map;function Xa(){Lr=0,ws.clear()}function On(e,s){let t=Lr++,i=`<!--__STX_${e.toUpperCase()}_${t}__-->`;return ws.set(i,{type:e,expression:s}),i}function Ja(){let e={};for(let[s,t]of ws)e[s]={type:t.type,expression:t.expression};return e}function Ya(e,s){let t=e;for(let[i,a]of s)t=t.split(i).join(a);return t}function Mo(e){return e.includes("<!--__STX_")}var ia=/@(?=[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 oa(e){return Array.from({length:e},()=>"{").join("⁠")}function Br(e){return e.replace(/\{{2,}/g,(s)=>oa(s.length)).replace(/\{(?=!)/g,"{⁠").replace(ia,"@")}function cs(e,s,t=!1){let{openTag:i,tail:a}=t?aa(e,s):ca(e).at(s);return ua(a,i,t)}function aa(e,s){let t="",i=0;for(let c=0;c<s;c++){if(!e.startsWith("{{",c))continue;let v=he(e,c);if(v<0||v+2>s)break;t+=e.slice(i,c)+"x",c=v+1,i=v+2}t+=e.slice(i,s);let a=-1,h=null;for(let c=0;c<t.length;c++){let v=t[c];if(h){if(v===h)h=null;continue}if(v==='"'||v==="'"){h=v;continue}if(v===">"){a=-1;continue}if(v==="<")a=c}return{openTag:a,tail:a>=0?t.slice(a+1):t}}var Pn=null;function ca(e){if(Pn&&Pn.source===e)return Pn.scanner;let s=la(e);return Pn={source:e,scanner:s},s}function la(e){let s=0,t=-1,i=null,a=-1,h=(v,E)=>{let R=e[v];if(E.quote){if(R===E.quote)E.quote=null;return}if(E.openTag>=0){if(R==='"'||R==="'"){E.quote=R;return}if(R===">"){E.openTag=-1;return}}if(R==="<")E.openTag=v},c=(v,E)=>{if(E.openTag>=0||!e.startsWith("<!--",v))return-1;let R=e.indexOf("-->",v+4);return R<0?e.length:R+3};return{at(v){if(v<s)s=0,t=-1,i=null,a=-1;let E={openTag:t,quote:i},R=!1;while(s<v){if(a<0&&e.startsWith("{{",s)){let P=he(e,s);if(P<0)a=s;else if(P+2<=v){s=P+2;continue}else break}let I=c(s,E);if(I>=0){if(I>v){R=!0;break}s=I;continue}h(s,E),s++}if(t=E.openTag,i=E.quote,R)return{openTag:-1,tail:""};let C=a>=0?a:s,O={openTag:t,quote:i};for(let I=s;I<v;I++){let P=c(I,O);if(P>=0){if(P>v)return{openTag:-1,tail:""};I=P-1;continue}h(I,O)}if(O.openTag<0)return{openTag:-1,tail:""};let M="",N=O.openTag+1;for(let I=N;I<Math.min(v,C);I++){if(!e.startsWith("{{",I))continue;let P=he(e,I);M+=e.slice(N,I)+"x",I=P+1,N=P+2}return M+=e.slice(N,v),{openTag:O.openTag,tail:M}}}}function ua(e,s,t){if(s<0&&!t)return null;if(s>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(s>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let i=0;if(s>=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 h=e.slice(a,i);if(!h)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 v=++i,E=e.indexOf(c,i);if(E===-1)return{kind:"attribute",name:h,quote:c,valuePrefix:e.slice(v)};i=E+1}else{let v=i;while(i<e.length&&!/\s/.test(e[i]))i++;if(i===e.length)return{kind:"attribute",name:h,quote:null,valuePrefix:e.slice(v)}}}return{kind:"tag"}}class le extends Error{attribute;constructor(e,s){super(`Unsafe interpolation in ${e}: ${s}`);this.name="UnsafeInterpolationContextError",this.attribute=e}}var zr="unsafe:";var fa=/^(?:javascript|vbscript|livescript|mocha|view-source):/,pa=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,da=/^data:(?:text\/html|application\/xhtml\+xml)/,ga=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function ma(e){return e.replace(ga,"").toLowerCase()}function $s(e){let s=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(s))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(s))return"fetched";return null}function Mn(e,s="navigable"){let t=ma(e);if(fa.test(t))return!0;return s==="navigable"?pa.test(t):da.test(t)}function sr(e,s="navigable"){return Mn(e,s)?"unsafe:"+e:e}function ha(e){let s=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!s)return null;if(s[3].trim()!=="")return null;return $s(s[1])}function Wr(e,s,t=256){if(s<=t)return e.slice(0,s);let i=e.slice(s-t,s),a=i.search(/[\s"'`/]/);return a===-1?"":i.slice(a)}function Fr(e,s,t=s){let i=ha(e);return i&&Mn(s,i)?"unsafe:"+t:t}var Dn=/<script\b[^>]*>/iy,Cs=/<\/script\s*>/ig,jn=/<style\b[^>]*>/iy,Ts=/<\/style\s*>/ig;function Vr(e,s,t,i){t.lastIndex=s;let a=t.exec(e);if(!a||a.index!==s)return-1;i.lastIndex=t.lastIndex;let h=i.exec(e);if(!h)return-1;return h.index+h[0].length}function W(e,s){return Vr(e,s,Dn,Cs)}function on(e,s){return Vr(e,s,jn,Ts)}function Ae(e,s){if(!e.startsWith("<!--",s))return-1;let t=e.indexOf("-->",s+4);if(t===-1)return-1;return t+3}function Ur(e,s){if(e.startsWith("<!--",s)){let a=Ae(e,s);return a===-1?e.length:a}if(Dn.lastIndex=s,Dn.exec(e)?.index===s){Cs.lastIndex=Dn.lastIndex;let a=Cs.exec(e);return a?a.index+a[0].length:e.length}if(jn.lastIndex=s,jn.exec(e)?.index===s){Ts.lastIndex=jn.lastIndex;let a=Ts.exec(e);return a?a.index+a[0].length:e.length}return-1}function ae(e,s){let t=[],i=0,a=e.length,h=!1,c=null;while(i<a){let v=e[i];if(h){if(c){if(v===c)c=null}else if(v==='"'||v==="'")c=v;else if(v===">")h=!1;i++;continue}if(v!=="<"){let O=e.indexOf("<",i+1);if(O===-1)break;i=O;continue}let E=s(e,i);if(E>i){t.push({start:i,end:E,token:e.slice(i,E)}),i=E;continue}let R=Ur(e,i);if(R>i){i=R;continue}let C=e.charCodeAt(i+1);if(C>=65&&C<=90||C>=97&&C<=122)h=!0;i++}return t}function Hr(e){let s=0,t=0,i=0,a=!1,h=null;while(i<e.length){if(a){let O=e[i];if(h){if(O===h)h=null}else if(O==='"'||O==="'")h=O;else if(O===">")a=!1;i++;continue}let c=e.indexOf("<",i),v=c===-1?e.length:c;while(i<v){let O=e[i++];if(O==="{")s++;else if(O==="}")t++;if(s>=2&&t>=2)return!0}if(c===-1)break;let E=Ur(e,c);if(E>c){i=E;continue}let R=e.charCodeAt(c+1),C=R===47?e.charCodeAt(c+2):R;if(C>=65&&C<=90||C>=97&&C<=122)a=!0;i=c+1}return!1}function $a(e,s){while(e.size>=s){let t=e.keys().next();if(t.done)return;e.delete(t.value)}}var xa=1024,ba=16777216,St=new Map,vs=0;function ya(e,s){St.set(e,s),vs+=e.length+s.output.length;for(let[t,i]of St){if(vs<=ba)break;St.delete(t),vs-=t.length+i.output.length}}function ce(e,s,t,i){let a=i!==void 0&&e.length>=xa,h=a?`${i}\x00${e}`:"";if(a){let C=St.get(h);if(C)return St.delete(h),St.set(h,C),{output:C.output,tokens:C.tokens.slice()}}let c=ae(e,s);if(c.length===0)return{output:e,tokens:[]};let v=c.map((C)=>C.token),E="",R=0;for(let C=0;C<c.length;C++){let O=c[C];E+=e.slice(R,O.start),E+=t(O.token,C),R=O.end}if(E+=e.slice(R),a)return ya(h,{output:E,tokens:v}),{output:E,tokens:v.slice()};return{output:E,tokens:v}}var _a=1024,wa=16777216,vt=new Map,Es=0;function Sa(e,s){vt.set(e,s),Es+=e.length+s.output.length;for(let[t,i]of vt){if(Es<=wa)break;vt.delete(t),Es-=t.length+i.output.length}}function Rs(e,s,t){return{output:s,scripts:t,restore:(i)=>i===s?e:or(i,t)}}function q(e){let s=e.length>=_a;if(s){let a=vt.get(e);if(a)return vt.delete(e),vt.set(e,a),Rs(e,a.output,a.scripts.slice())}let{output:t,tokens:i}=ce(e,W,(a,h)=>`\x00STX_SCRIPT_${h}\x00`);if(s)return Sa(e,{output:t,scripts:i}),Rs(e,t,i.slice());return Rs(e,t,i)}function or(e,s){if(s.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(t,i)=>s[+i]??"")}function Et(e){let s=e.indexOf(" as ");if(s!==-1){let h=e.slice(0,s).trim(),c=e.slice(s+4).trim();return h&&c?{arrayExpr:h,itemVar:c}:null}let t=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!t)return null;let i=t[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=t[2].trim();return i&&a?{arrayExpr:a,itemVar:i}:null}function Nn(e){let s=[],t=0,i="",a=0;for(let h=0;h<e.length;h++){let c=e[h];if(i){if(c==="\\")h++;else if(c===i)i="";continue}if(c==="'"||c==='"'||c==="`")i=c;else if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)s.push(e.slice(a,h)),a=h+1}return s.push(e.slice(a)),s}function Kr(e,s){let t=0;for(let i=0;i<e.length;i++){let a=e[i];if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a===s&&t===0)return i}return-1}function Zr(e){let s=0;for(let t=0;t<e.length;t++){let i=e[t];if(i==="("||i==="["||i==="{")s++;else if((i===")"||i==="]"||i==="}")&&--s===0)return t}return-1}function gt(e,s){let t=e.trim().replace(/^\.\.\./,"").trim(),i=Kr(t,"=");if(i!==-1&&t[i+1]!==">")t=t.slice(0,i).trim();if(!t)return;if(t.startsWith("{")&&t.endsWith("}")){for(let a of Nn(t.slice(1,-1))){let h=a.trim();if(!h)continue;if(h.startsWith("...")){gt(h,s);continue}let c=Kr(h,":");gt(c===-1?h:h.slice(c+1),s)}return}if(t.startsWith("[")&&t.endsWith("]")){for(let a of Nn(t.slice(1,-1)))gt(a,s);return}if(/^[A-Z_$][\w$]*$/i.test(t))s.push(t)}function Tt(e){let s=e.trim(),t=[],i=0;for(let h=0;h<s.length;h++){let c=s[h];if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(i===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(s.slice(h)))continue;let E=s.slice(0,h).trim();if(E.startsWith("(")&&Zr(E)===E.length-1)E=E.slice(1,-1);for(let R of Nn(E))gt(R,t);if(t.length>0)return t;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(s);if(a){let h=a[1].trim();if(h.startsWith("(")&&Zr(h)===h.length-1)h=h.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(h);if(c)gt(c[2],t),gt(c[1],t);else for(let v of Nn(h))gt(v,t)}return t}function ue(e,s){let t=s instanceof Set?s:new Set(s);if(t.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let v of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(t.has(v))return!0;return!1}var Ln="__stx_client_loop_names";function Ze(e){let s=e?.[Ln];return Array.isArray(s)?s:[]}function Bn(e){if(!e.includes("#")&&!e.includes("v-slot:"))return[];let s=[],t=[],i=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(i)){let h=a[0];if(/^<\/template\s*>$/i.test(h)){let c=t.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(h)&&!/\/\s*>$/.test(h)){let v=[...h.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((C)=>/^(?:#[\w-]+|v-slot:[\w-]+)$/i.test(C[1])),E=(v?.[2]??v?.[3])?.trim(),R=E?{start:a.index+h.length,end:e.length,binding:E}:void 0;if(t.push(R),R)s.push(R)}}return s}var qt={},Xr=new Map;function va(e){let s=Xr.get(e);if(!s){let t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");s=new RegExp(`:${t}(?!\\w)`,"g"),Xr.set(e,s)}return s.lastIndex=0,s}var hs={uppercase:(e,s)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,s)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,s)=>{if(e===void 0||e===null)return"";let t=String(e);return t.charAt(0).toUpperCase()+t.slice(1)},number:(e,s,t=0)=>{if(e===void 0||e===null)return"";try{let i=Number(e);return Number.isNaN(i)?"":i.toFixed(Number.parseInt(String(t),10))}catch{return""}},fmt:(e,s,t="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return i.toLocaleString(t)}catch{return String(e)}},join:(e,s,t=",")=>{if(!Array.isArray(e))return"";return e.join(String(t))},escape:(e,s)=>{if(e===void 0||e===null)return"";return F(String(e))},translate:(e,s,t={})=>{if(!s||!s.__translations)return e;let i=s.__translations,a=s.__i18nConfig?.fallbackToKey??!0,h=String(e).split("."),c=i;for(let E of h){if(c===void 0||c===null)break;c=c[E]}if(c===void 0||c===null)return a?e:"";let v=String(c);return Object.entries(t).forEach(([E,R])=>{v=v.replace(va(E),()=>String(R))}),v},t:(e,s,t={})=>hs.translate(e,s,t),truncate:(e,s,t=50,i="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=t)return a;if(t<=i.length)return i.substring(0,t);return a.substring(0,t-i.length)+i},date:(e,s,t="short",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let h={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(t==="iso")return a.toISOString();return new Intl.DateTimeFormat(i,h[t]||h.short).format(a)}catch{return String(e)}},currency:(e,s,t="USD",i="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(i,{style:"currency",currency:t}).format(a)}catch{return String(e)}},pluralize:(e,s,t,i)=>{let a=Number(e);if(Number.isNaN(a))return t;let h=i||`${t}s`;return a===1?t:h},first:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let t=String(e);return t.charAt(t.length-1)},length:(e,s)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,s,t=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return t?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,s,t="")=>e===void 0||e===null||e===""?t:e,reverse:(e,s)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,s,t=0,i)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(t,i);return e},replace:(e,s,t,i="")=>{if(e===void 0||e===null)return"";let a=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>i)},stripTags:(e,s)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,s)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,s)=>{let t=Number(e);return Number.isNaN(t)?0:Math.abs(t)},round:(e,s,t=0)=>{let i=Number(e);if(Number.isNaN(i))return 0;let a=10**t;return Math.round(i*a)/a}};function ru(e,s){if(e in hs)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);qt[e]=s}function Ap(e){for(let[s,t]of Object.entries(e))ru(s,t)}function su(){return{...hs,...qt}}function Pp(){for(let e of Object.keys(qt))delete qt[e]}function It(e,s,t=2){let i="{".repeat(t);if(!e.includes(i))return e;let a="",h=0;for(;;){let c=e.indexOf(i,h);if(c===-1)break;let v=he(e,c,t);if(v===-1)break;a+=e.slice(h,c)+s(e.slice(c,v+t),e.slice(c+t,v),c),h=v+t}return h===0?e:a+e.slice(h)}function m(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function F(e){return Br(m(e))}function ka(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function Ca(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(s,t)=>String.fromCodePoint(Number.parseInt(t,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function Za(e,s){let t=Ca(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(t))throw new le(s,"network-capable or executable CSS is not allowed in an escaped interpolation");let i=/url\(([^)]*)\)/g,a;while((a=i.exec(t))!==null){let h=a[1].replace(/^["']|["']$/g,""),c=h.startsWith("/")&&!h.startsWith("//")||h.startsWith("./")||h.startsWith("../")||h.startsWith("#"),v=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(h);if(!c&&!v)throw new le(s,"CSS URLs must be local paths or base64 raster images")}}function K(e,s,t,i=!1,a=0){let h=cs(e,s,i),c=F(t);if(!h)return c;if(h.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(t))throw new le("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return t}if(h.kind==="tag"){let R=e.slice(s+a).trimStart(),C=t.trim();if(!R.startsWith("=")&&(C===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(C)))return C;throw new le("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let v=h.name.toLowerCase();if(/^on[a-z]/.test(v))throw new le(h.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(v==="srcdoc")c=F(c);if(v==="style")Za(t,h.name);if(h.quote===null)c=ka(c);let E=$s(v);if(E&&h.valuePrefix.trim()===""&&Mn(t,E))return zr+c;return Fr(Wr(e,s),t,c)}function fn(e,s){let t=` ${e}="`;return K(t,t.length,s,!0)}function ti(e){return e.flatMap((s)=>{let t=s.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!t||/\bserver\b|\bsrc\s*=/.test(t[1])?[]:[t[2]]})}function be(e,s){let{scripts:t}=q(e);for(let i of ti(t)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(i))return!0;if(br(i,s))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function ou(e){let s=[],t=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let i=t.exec(e);i;i=t.exec(e)){let a=i[1].toLowerCase(),h=new Set(Tt(i[3]));if(h.size===0)continue;let c=i.index+i[0].length;if(i[0].endsWith("/>")){s.push({start:i.index,end:c,names:h});continue}let v=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");v.lastIndex=c;let E=1,R=e.length;for(let C=v.exec(e);C;C=v.exec(e)){if(C[2]==="/")continue;if(E+=C[1]==="/"?-1:1,E===0){R=C.index+C[0].length;break}}s.push({start:i.index,end:R,names:h})}return s}function Jr(e,s,t){let i=o(t);for(let a of e){if(s<a.start||s>=a.end)continue;for(let h of a.names)if(new RegExp(`(?<![.#\\w$])${h.replace(/\$/g,"\\$")}(?![\\w$])`).test(i))return!0}return!1}function Gr(e,s){let t=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],i=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",h=!1,c=0;for(let R=0;R<i.length;R++){let C=i[R];if(!h&&C==="`"){h=!0,c=0;continue}if(h){if(C==="`"&&c===0){h=!1;continue}if(C==="$"&&i[R+1]==="{"){c++,R++,a+=" ";continue}if(C==="}"&&c>0){c--;continue}if(c>0){a+=C;continue}continue}a+=C}i=a;let v=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,E;while((E=v.exec(i))!==null){let R=E[1];if(!i.substring(0,E.index).trimEnd().endsWith(".")){if(!t.includes(R)&&!(R in s))return!1}}return!0}function Qa(e,s){let t=s.__stx_serverDeclared;if(!t||t.size===0)return!1;let i=o(e);for(let a of t)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(i))return!0;return!1}var Yr=new Set;function Qr(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function ei(e,s){let t=`${s??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Yr.has(t))Yr.add(t),console.warn(`[stx] {{ ${e} }} in a <script> in ${s??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function Lo(e,s,t){let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(a,h)=>{try{let c=_(h,s);if(c===void 0)return Qr(h)?ei(h.trim(),t):a;return c===null?"":String(c)}catch{return a}}),i=It(i,(a,h,c)=>{let v=h.trim();if(/^__[A-Z_]+__$/.test(v))return a;try{let E=_(h,s);if(E===void 0)return Qr(v)?ei(v,t):a;return JSON.stringify(E).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(R)=>"\\u007b".repeat(R.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),i}function iu(e,s){if(!e.includes("{"))return e;let t=e;return t=t.replace(/\{!!([\s\S]*?)!!\}/g,(i,a)=>{try{let h=_(a,s);if(h===void 0)return i;return h===null?"":String(h)}catch{return i}}),t=It(t,(i,a,h)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return i;try{let v=_(a,s);if(v===void 0)return i;if(v===null)return"";let E=String(v);return K(t,h,E,!0,i.length)}catch(v){if(v instanceof le)throw v;return i}}),t}function Ip(e,s,t={}){let{output:i,scripts:a}=q(e),h=a.map((c)=>{let v=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),E=c.search(/<\/script\s*>$/i);if(!v||E===-1)return c;let R=v[1],C=c.slice(v[0].length,E);if(/\bdata-raw\b/.test(R))return c;if(t.skipServer&&/\bserver\b/.test(R))return c;let M=`<script${iu(R,s)}>`;if(/\bsrc\s*=/.test(R)||/\btype\s*=\s*["']application\/json["']/.test(R))return M+C+c.slice(E);return M+Lo(C,s)+c.slice(E)});return or(i,h)}function k(e,s,t){let i=e,a=(I,P)=>{let Z=on(I,P);if(Z===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(I.slice(P,Z))?-1:Z},h=(I,P,Z,U)=>{let V=Z.length,{output:X,tokens:Y}=ce(I,P,(Q,se)=>U(V+se));return Z.push(...Y),X},c=[];i=h(i,a,c,(I)=>`<!--__STX_STYLE_${I}__-->`);let v=[];i=h(i,W,v,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`);let E=s?.__stx_signals_gate===!0||be(e),R=new Set([...Array.isArray(s?.__stx_client_signal_names)?s.__stx_client_signal_names:[],...Do(ti(v))]),C=new Set(Array.isArray(s?.__stx_preserved_client_expressions)?s.__stx_preserved_client_expressions:[]);i=It(i,(I,P,Z)=>{try{let U=_(P,s,!1,(V)=>As(V,I,t,e));return U!==void 0&&U!==null?String(U):""}catch(U){let V=U instanceof Error?U.message:String(U);return g("Expression",`Error evaluating: {{{ ${P.trim()}}}}: ${V}`,t,e,Z,I)}},3),i=i.replace(/\{!!([\s\S]*?)!!\}/g,(I,P,Z)=>{try{let U=_(P,s,!1,(V)=>As(V,I,t,e));if(U===void 0&&s.__stx_buildMode==="compile")return On("raw",P.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(s.__stx_buildMode==="compile")return On("raw",P.trim());let V=U instanceof Error?U.message:String(U);return g("Expression",`Error evaluating: {!! ${P.trim()} !!}: ${V}`,t,e,Z,I)}}),i=h(i,W,v,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`),i=h(i,a,c,(I)=>`<!--__STX_STYLE_${I}__-->`);let O=E?ou(i):[],M=Bn(i).map((I)=>({...I,names:new Set(Tt(`${I.binding} in __slot`))})),N=new Set(Ze(s));if(i=It(i,(I,P,Z)=>{let U=P.trim();if(Jr(M,Z,U))return I;if(ue(U,N))return I;if(O.length>0&&Jr(O,Z,U))return I;if(C.has(U))return I;let V=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],X=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,Q=U.match(X)?.[1],se=Q&&((Q in s)||V.includes(Q)),pe=Boolean(Q&&R.has(Q)),Ee=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,ke=U.match(Ee),ze=ke&&!V.includes(ke[1])&&!(ke[1]in s);if(/^__[A-Z_]+__$/.test(U))return"";if(pe)return I;let Te;try{let He=_(P,s,!1,(mt)=>{Te=mt});if(E&&!Gr(U,s))return I;if(Te)As(Te,I,t,e);if(s.__stx_buildMode==="compile"&&!E&&(He===void 0||Qa(U,s)))return On("expr",U);if(He===void 0||He===null)return"";let Ge=String(He);return K(i,Z,Ge,!1,I.length)}catch(He){if(He instanceof le)throw He;if(E&&!Gr(U,s))return I;if(ze)return I;let Ge=He instanceof Error?He.message:String(He);return g("Expression",`Error evaluating: {{ ${U} }}: ${Ge}`,t,e,Z,I)}}),v.length>0)i=i.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(I,P)=>v[Number(P)]??I);if(c.length>0)i=i.replace(/<!--__STX_STYLE_(\d+)__-->/g,(I,P)=>c[Number(P)]??I);return i}function au(e,s,t){if(!s.trim())return e;let i=e,a=s.trim();while(a.length>0){let h=a.match(/^(\w+)/);if(!h)break;let c=h[1];a=a.substring(c.length).trim();let v=qt[c]||hs[c];if(!v)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(su()).join(", ")}`);let E=[];if(a.startsWith(":")){let R=a.match(/^:([^|\s]+)/);if(R){let C=R[1].trim();try{let O=Number(C);E=[Number.isNaN(O)?C:O]}catch{E=[C]}a=a.substring(R[0].length).trim()}}else if(a.startsWith("(")){let R=1,C=1;while(R>0&&C<a.length){if(a[C]==="(")R++;if(a[C]===")")R--;C++}if(R===0){let O=a.substring(1,C-1).trim();if(O)try{if(O.startsWith("{")&&O.endsWith("}"))E=[_(`(${O})`,t,!0)];else{let M=[],N="",I=null,P=0,Z=0,U=0,V=!1;for(let X=0;X<O.length;X++){let Y=O[X];if(V){N+=Y,V=!1;continue}if(Y==="\\"){N+=Y,V=!0;continue}if(I){if(N+=Y,Y===I)I=null;continue}if(Y==='"'||Y==="'"||Y==="`"){I=Y,N+=Y;continue}if(Y==="(")P++;else if(Y===")")P--;else if(Y==="[")Z++;else if(Y==="]")Z--;else if(Y==="{")U++;else if(Y==="}")U--;if(Y===","&&P===0&&Z===0&&U===0){M.push(N),N="";continue}N+=Y}if(N)M.push(N);E=M.map((X)=>{let Y=X.trim();return _(Y,t,!0)})}}catch{E=[O]}a=a.substring(C).trim()}}try{i=v(i,t,...E)}catch(R){let C=R instanceof Error?R.message:String(R);throw Error(`Error applying filter '${c}': ${C}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return i}function ec(e){let s=!1,t="",i=0,a=0,h=0,c=!1;for(let v=0;v<e.length;v++){let E=e[v],R=e[v+1];if(s&&c){c=!1;continue}if(s&&E==="\\"){c=!0;continue}if(c=!1,(E==='"'||E==="'"||E==="`")&&!c){if(!s)s=!0,t=E;else if(E===t)s=!1,t="";continue}if(s&&t==="`"&&E==="$"&&R==="{"){let C=1;v+=2;while(v<e.length&&C>0){if(e[v]==="{")C++;else if(e[v]==="}")C--;if(C>0)v++}continue}if(s)continue;if(E==="(")i++;else if(E===")")i--;else if(E==="[")a++;else if(E==="]")a--;else if(E==="{")h++;else if(E==="}")h--;if(E==="|"&&i===0&&a===0&&h===0){if(R==="|"){v++;continue}if(R==="="){v++;continue}return v}}return-1}var Zt=new Set,tc=1000;function Op(){Zt.clear()}function As(e,s,t,i){if(!H())return;let a=`${t}\x00${e.expression}`;if(Zt.has(a))return;if(Zt.size>=tc)Zt.clear();Zt.add(a);let h=t,c=i;try{if(t&&qr.existsSync(t))c=qr.readFileSync(t,"utf8")}catch{}let v=c.indexOf(s);if(v>=0)h=`${t}:${c.slice(0,v).split(`
|
|
228
|
+
`).length}`;console.warn(`${h}: stx warning: ${s} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function _(e,s,t=!1,i){try{let a=e.trim(),h=ec(a);if(h>0){let v=a.substring(0,h).trim(),E=a.substring(h+1).trim(),R=_(v,s,!0,i);return au(R,E,s)}let c=bs(a);if(c!==null){i?.({expression:a,rule:c});return}try{let v=Object.keys(s),E=Object.values(s);return u(a,v)(...E)}catch{return l(a,s)}}catch(a){if(a instanceof ReferenceError){let h=/(\b\w+)\s+is not defined/.exec(a.message);if(h){let c=h[1],v=nc(c,Object.keys(s));if(v&&v!==c)a.message=`${a.message} \u2014 did you mean '${v}'?`}}if(!t)console.error(`Error evaluating expression: ${e}`,a);throw a}}function nc(e,s){let t=null;for(let a of s){if(a===e)continue;let h=sc(e,a);if(t===null||h<t.dist)t={key:a,dist:h}}if(!t)return null;let i=Math.max(e.length,t.key.length);if(t.dist<=2||t.dist/i<=0.35)return t.key;return null}function sc(e,s){if(e===s)return 0;if(e.length===0)return s.length;if(s.length===0)return e.length;let[t,i]=e.length<s.length?[e,s]:[s,e],a=Array(t.length+1),h=Array(t.length+1);for(let c=0;c<=t.length;c++)a[c]=c;for(let c=1;c<=i.length;c++){h[0]=c;for(let v=1;v<=t.length;v++){let E=t[v-1]===i[c-1]?0:1;h[v]=Math.min(h[v-1]+1,a[v]+1,a[v-1]+E)}for(let v=0;v<=t.length;v++)a[v]=h[v]}return a[t.length]}function Np(e){if(!e)return"";return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import rc from"process";function S(e="STX_PUBLIC_"){let s={},t={};for(let[i,a]of Object.entries(rc.env)){if(!i.startsWith(e)||a===void 0)continue;s[`import.meta.env.${i}`]=JSON.stringify(a),t[i]=a}return s["import.meta.env"]=JSON.stringify(t),s}function ni(e,s=""){let t=`${e}${s}`,i=0;for(let a=0;a<t.length;a++){let h=t.charCodeAt(a);i=(i<<5)-i+h,i=i&i}return`stx-${Math.abs(i).toString(36)}`}function si(e,s,t={}){let{prefix:i="",preserveHost:a=!0,scopeKeyframes:h=!0,scopeCustomProperties:c=!1}=t;if(!e.trim())return"";let v=Is(e),E=[],R=new Map;if(h)for(let C of v){let O=C.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(O){let M=O[1],N=`${s}_${M}`;R.set(M,N)}}for(let C of v){let O=ri(C,s,i,a,R,c);E.push(O)}return E.join(`
|
|
229
229
|
|
|
230
|
-
`)}function
|
|
231
|
-
`)})}else s.push({selector:`@${C} ${O.trim()}`,declarations:
|
|
230
|
+
`)}function Is(e){let s=[],t=e.replace(/\/\*[\s\S]*?\*\//g,""),i=0,a="",h=!1,c="";for(let v=0;v<t.length;v++){let E=t[v];if(E==="@"&&i===0)h=!0;if(E==="{")i++;else if(E==="}"){if(i--,i===0){if(h){c+=E;let R=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(R){let[,C,O,M]=R;if(C==="keyframes")s.push({selector:`@keyframes ${O.trim()}`,declarations:M.trim()});else if(C==="media"||C==="supports"||C==="container"){let N=Is(M);s.push({selector:`@${C} ${O.trim()}`,declarations:N.map((I)=>`${I.selector} { ${I.declarations} }`).join(`
|
|
231
|
+
`)})}else s.push({selector:`@${C} ${O.trim()}`,declarations:M.trim()})}c="",h=!1}else if(a.trim()){a+=E;let R=a.match(/([^{]+)\{([^}]*)\}/);if(R)s.push({selector:R[1].trim(),declarations:R[2].trim()});a=""}continue}}if(h)c+=E;else a+=E}return s}function ri(e,s,t,i,a,h){let{selector:c,declarations:v}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let C=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(C)||C} { ${v} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let O=Is(`x { ${v} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((M)=>ri(M,s,t,i,a,h)).join(`
|
|
232
232
|
`);return`${c} {
|
|
233
233
|
${O}
|
|
234
|
-
}`}return`${c} { ${v} }`}let E=ec(c,s,t,i),R=v;for(let[C,O]of a)R=R.replace(new RegExp(`\\b${C}\\b`,"g"),O);if(h)R=R.replace(/--([a-z-]+)/gi,`--${s}-$1`);return`${E} { ${R} }`}function ec(e,s,t,i){let a=e.split(",").map((c)=>c.trim()),h=[];for(let c of a){if(c.startsWith(":host")){if(i)h.push(c);else{let R=c.replace(/:host(\([^)]*\))?/,`.${s}$1`);h.push(R)}continue}if(c.includes("::slotted")){h.push(c);continue}if(c===":root"){h.push(`:root .${s}`);continue}let v=t?`${t} .${s}`:`.${s}`;h.push(`${v} ${c}`);let E=tc(c,s);if(E)h.push(t?`${t} ${E}`:E)}return h.join(", ")}function tc(e,s){let t=0,i=e.length;for(let E=0;E<e.length;E++){let R=e[E];if(R==="["||R==="(")t++;else if(R==="]"||R===")")t--;else if(t===0&&(R===" "||R===">"||R==="+"||R==="~")){i=E;break}}let a=e.slice(0,i),h=e.slice(i);if(!a)return"";let c=a.length,v=0;for(let E=0;E<a.length;E++){let R=a[E];if(R==="["||R==="(")v++;else if(R==="]"||R===")")v--;else if(t===0&&v===0&&R===":"){c=E;break}}return`${a.slice(0,c)}.${s}${a.slice(c)}${h}`}var oi=String.raw`(?<![\w-])scoped(?![\w-])`,Is=/<style\s+([^>]*)>/gi,ri=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,ai=new RegExp(oi,"i"),nc=new RegExp(oi,"gi"),Os=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function sc(e){Is.lastIndex=0;let s=Is.exec(e);while(s!==null){if(ai.test(s[1]))return!0;s=Is.exec(e)}return!1}function Ro(e){let s=new Set,t=[];Os.lastIndex=0;let i=Os.exec(e);while(i!==null){let a=i[0].trim();if(s.has(a))t.push({start:i.index,end:i.index+i[0].length});else s.add(a);i=Os.exec(e)}return t}function an(e){let s=Ro(e);if(s.length===0)return e;let t=Array(s.length+1),i=0;for(let a=0;a<s.length;a++){let h=s[a];t[a]=e.slice(i,h.start),i=h.end}return t[s.length]=e.slice(i),t.join("")}function us(e,s){if(!sc(e))return{html:e,hasScoped:!1};let t=ti(s),i=`data-v-${t}`,a=e,h=!1;if(ri.lastIndex=0,a=a.replace(ri,(c,v,E)=>{if(!ai.test(v))return c;h=!0;let R=rc(E,i),C=v.replace(nc,"").trim(),O=C?` ${C}`:"";return`<style data-stx-scoped="${t}"${O}>${R}</style>`}),!h)return{html:e,hasScoped:!1};return a=cc(a,i),{html:a,hasScoped:!0}}function rc(e,s){return ni(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${s}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${s}]`)}var oc=(e)=>`\x00stx-scope-mask-${e}\x00`,ii=/\u0000stx-scope-mask-(\d+)\u0000/g;function cc(e,s){let t=ce(e,(a,h)=>{let c=W(a,h);return c>h?c:on(a,h)},(a,h)=>oc(h)),i=lc(t.output,s);return ii.lastIndex=0,i.replace(ii,(a,h)=>t.tokens[Number(h)])}function lc(e,s){let t=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(i,a,h)=>{if(t.has(a.toLowerCase()))return i;if(i.includes(s))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(h)return i.replace(`<${a}${h}`,`<${a} ${s}${h}`);if(i.endsWith("/>"))return`<${a} ${s} />`;return`<${a} ${s}>`})}var Xt=/<\/?template\b[^>]*>/gi,uc=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function fc(e){let s=e.replace(/^<template\b/i,"").replace(/>$/,"");return uc.test(s)}function ie(e){Xt.lastIndex=0;let s;while((s=Xt.exec(e))!==null){if(s[0].startsWith("</")||fc(s[0]))continue;let t=s.index,i=Xt.lastIndex,a=1,h;while((h=Xt.exec(e))!==null)if(h[0].startsWith("</")){if(a--,a===0){let c=h.index;return{start:t,openEnd:i,closeStart:c,end:Xt.lastIndex,content:e.slice(i,c)}}}else a++;return null}return null}function ps(e,s){let t=e,i=/@json\s*\(/g,a;while((a=i.exec(t))!==null){let h=a.index,c=h+a[0].length-1,v=1,E=c+1,R=null,C=!1;while(E<t.length&&v>0){let X=t[E];if(C){C=!1,E++;continue}if(X==="\\"&&R){C=!0,E++;continue}if(R){if(X===R)R=null;E++;continue}if(X==='"'||X==="'"||X==="`"){R=X,E++;continue}if(X==="(")v++;else if(X===")"){if(v--,v===0)break}E++}if(v!==0)break;let O=t.substring(c+1,E).trim(),P=t.substring(h,E+1),M=-1,I=0,N=null,Z=!1;for(let X=0;X<O.length;X++){let Y=O[X];if(Z){Z=!1;continue}if(Y==="\\"&&N){Z=!0;continue}if(N){if(Y===N)N=null;continue}if(Y==='"'||Y==="'"||Y==="`"){N=Y;continue}if(Y==="("||Y==="["||Y==="{")I++;else if(Y===")"||Y==="]"||Y==="}")I--;if(Y===","&&I===0){M=X;break}}let U=M>=0?O.substring(0,M).trim():O,V=M>=0?O.substring(M+1).trim():void 0;try{let X=U.trim(),Y;if(d(X))Y=u(X,Object.keys(s))(...Object.values(s));else Y=void 0;let Q;if(V==="true")Q=JSON.stringify(Y,null,2);else Q=JSON.stringify(Y);let se=Q.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");t=t.substring(0,h)+se+t.substring(E+1),i.lastIndex=h+se.length}catch(X){D.log(X instanceof Error?X:Error(String(X)),{directive:"@json"},"error"),i.lastIndex=h+P.length}}return t}function gs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function ja(e){let s=e,t=/@memo\s*\(/g,i,a=[];while((i=t.exec(s))!==null){let h=i.index,c=h+i[0].length,v=1,E=c;while(E<s.length&&v>0){if(s[E]==="(")v++;else if(s[E]===")")v--;E++}if(v!==0)continue;let R=s.slice(c,E-1).trim(),C=E,O=s.slice(C),P=O.indexOf("@endmemo");if(P===-1)continue;let M=O.slice(0,P),I=C+P+8,N=M.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),Z=N?N[0].length:0,U=M.slice(Z),V=M.match(/(\s*)$/),X=V?V[0].length:0,Y=U.slice(0,U.length-X),Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),se;if(Q){let[pe,Se,Ee="",Be]=Q,Ce=`<${Se}${Ee} data-stx-memo="${R}"${Be}>`;se=M.slice(0,Z)+Ce+Y.slice(pe.length)+M.slice(Z+Y.length)}else se=`${M.slice(0,Z)}<div data-stx-memo="${R}">${Y}</div>${M.slice(Z+Y.length)}`;a.push({start:h,end:I,replacement:se}),t.lastIndex=I}for(let h=a.length-1;h>=0;h--){let c=a[h];s=s.slice(0,c.start)+c.replacement+s.slice(c.end)}return s.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Ao(e){let s=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return s=s.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),s}function fi(e,s){if(!/\bref\s*=/.test(e))return e;let t=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=ae(e,(E,R)=>{t.lastIndex=R;let C=t.exec(E);if(!C||/^(?:script|style)$/i.test(C[1]))return-1;return t.lastIndex}),a=[],h=0,c=0,v=[];for(let{start:E,end:R,token:C}of i){let O=/^<\/?([\w-]+)/.exec(C)[1].toLowerCase();if(C.startsWith("</")){let M;while(M=a.pop()){if(M.scoped)h--;if(M.name===O)break}continue}let P=/\sdata-stx-scope\s*=/.test(C);if(!h&&!P&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(C)&&!/\sdata-stx-ref-caller\s*=/.test(C))v.push(e.slice(c,E),C.replace(/\s*\/?>$/,(M)=>` data-stx-ref-caller="${s}"${M}`)),c=R;if(!pi.has(O)&&!/\/>$/.test(C)){if(a.push({name:O,scoped:P}),P)h++}}return v.push(e.slice(c)),v.join("")}var pi=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),di=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,ci=/<\/?\s*([a-z][\w-]*)/iy,pc=/\s/;function dc(e,s){let t=s-1;while(t>=0&&pc.test(e[t]))t--;return t>=0&&e[t]==="/"}function gc(e,s){let t=!1,i=!1;for(let a=s;a<e.length;a++){let h=e[a];if(t){if(h==="'")t=!1}else if(i){if(h==='"')i=!1}else if(h==="'")t=!0;else if(h==='"')i=!0;else if(h===">")return a}return-1}function mc(e,s){if(e.indexOf("{",s)===-1||e.indexOf("}",s)===-1)return!1;let t=0,i=s,a=!1,h=!1,c=!1;while(i<e.length){let v=e.indexOf("<",i),E=v===-1?e.length:v;if(E>i){if(t===0)while(i<E){let O=e.indexOf(h?"}":"{",i);if(O===-1||O>=E){if(h)c=!1;else a=!1;break}if(O>i)if(h)c=!1;else a=!1;if(h){if(c)return!0;c=!0}else if(a)h=!0,c=!1;else a=!0;i=O+1}i=E;continue}if(e.startsWith("<!--",i)){let O=e.indexOf("-->",i);i=O===-1?e.length:O+3;continue}let R=gc(e,i);if(R===-1)break;ci.lastIndex=i;let C=ci.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(t===0)break;t--}else if(!dc(e,R)&&!pi.has(C))t++;i=R+1}return!1}var li=y(256);function Ba(e){if(e.length<1024)return ui(e);let s=b(e),t=li.get(s);if(t!==void 0)return t;let i=ui(e);return li.set(s,i),i}function ui(e){if(e.length>=32768&&!Ur(e))return e;let t=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),i="",a=0,h;while((h=t.exec(e))!==null){let c=h.index,v=c+h[0].length,E=!1,R=!1,C=-1;while(v<e.length){let P=e[v];if(E){if(P==="'")E=!1}else if(R){if(P==='"')R=!1}else if(P==="'")E=!0;else if(P==='"')R=!0;else if(P===">"){C=v;break}v++}if(C===-1)continue;let O=e.slice(c,C+1);if(di.test(O))continue;if(O.includes("x-cloak"))continue;if(mc(e,C+1))i+=e.slice(a,C)+" x-cloak>",a=C+1}return i+=e.slice(a),i}var hc=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,xc=/<\/script>/gi,bc=/<\/style>/gi;function Fa(e){let s=/<[a-z][\w-]*/gi,t="",i=0,a;while((a=s.exec(e))!==null){let h=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let I=c==="script"?xc:bc;I.lastIndex=h;let N=I.exec(e);if(N!==null)s.lastIndex=N.index+N[0].length;continue}let v=h+a[0].length,E=!1,R=!1,C=-1;while(v<e.length){let I=e[v];if(E){if(I==="'")E=!1}else if(R){if(I==='"')R=!1}else if(I==="'")E=!0;else if(I==='"')R=!0;else if(I===">"){C=v;break}v++}if(C===-1)continue;let O=e.slice(h+a[0].length,C);if(di.test(O))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(O))continue;if(!hc.test(O))continue;let P=e[C-1]==="/",M=P?C-1:C;t+=`${e.slice(i,M)} x-cloak${P?" ":""}`,i=M}return t+=e.slice(i),t}import ki from"path";import Ms from"fs";import Jt from"path";function gi(e,s,t,i){let a=0;for(let h=s;h<e.length;h++)if(e[h]===t)a++;else if(e[h]===i&&!(i===">"&&e[h-1]==="=")){if(--a===0)return h}return-1}function yc(e){let s=o(e),t=0,i=0,a=[];for(let h=0;h<s.length;h++)if("([{".includes(s[h]))t++;else if(")]}".includes(s[h]))t--;else if(s[h]===","&&t===0)a.push(e.slice(i,h).trim()),i=h+1;return a.push(e.slice(i).trim()),a}function Ps(e,s){let t=o(e),i=new RegExp(`\\b(?:${s.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of t.matchAll(i)){let h=a.index+a[0].length,c="";if(t[h]==="<"){let E=gi(t,h,"<",">");if(E<0)continue;c=e.slice(h+1,E),h=E+1;while(/\s/.test(t[h]||"")&&h<t.length)h++}if(t[h]!=="(")continue;let v=gi(t,h,"(",")");if(v>=0)return{type:c,args:yc(e.slice(h+1,v))}}return null}var mi=`
|
|
234
|
+
}`}return`${c} { ${v} }`}let E=oc(c,s,t,i),R=v;for(let[C,O]of a)R=R.replace(new RegExp(`\\b${C}\\b`,"g"),O);if(h)R=R.replace(/--([a-z-]+)/gi,`--${s}-$1`);return`${E} { ${R} }`}function oc(e,s,t,i){let a=e.split(",").map((c)=>c.trim()),h=[];for(let c of a){if(c.startsWith(":host")){if(i)h.push(c);else{let R=c.replace(/:host(\([^)]*\))?/,`.${s}$1`);h.push(R)}continue}if(c.includes("::slotted")){h.push(c);continue}if(c===":root"){h.push(`:root .${s}`);continue}let v=t?`${t} .${s}`:`.${s}`;h.push(`${v} ${c}`);let E=cc(c,s);if(E)h.push(t?`${t} ${E}`:E)}return h.join(", ")}function cc(e,s){let t=0,i=e.length;for(let E=0;E<e.length;E++){let R=e[E];if(R==="["||R==="(")t++;else if(R==="]"||R===")")t--;else if(t===0&&(R===" "||R===">"||R==="+"||R==="~")){i=E;break}}let a=e.slice(0,i),h=e.slice(i);if(!a)return"";let c=a.length,v=0;for(let E=0;E<a.length;E++){let R=a[E];if(R==="["||R==="(")v++;else if(R==="]"||R===")")v--;else if(t===0&&v===0&&R===":"){c=E;break}}return`${a.slice(0,c)}.${s}${a.slice(c)}${h}`}var ai=String.raw`(?<![\w-])scoped(?![\w-])`,Os=/<style\s+([^>]*)>/gi,ii=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,ci=new RegExp(ai,"i"),lc=new RegExp(ai,"gi"),Ps=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function uc(e){Os.lastIndex=0;let s=Os.exec(e);while(s!==null){if(ci.test(s[1]))return!0;s=Os.exec(e)}return!1}function Ro(e){let s=new Set,t=[];Ps.lastIndex=0;let i=Ps.exec(e);while(i!==null){let a=i[0].trim();if(s.has(a))t.push({start:i.index,end:i.index+i[0].length});else s.add(a);i=Ps.exec(e)}return t}function an(e){let s=Ro(e);if(s.length===0)return e;let t=Array(s.length+1),i=0;for(let a=0;a<s.length;a++){let h=s[a];t[a]=e.slice(i,h.start),i=h.end}return t[s.length]=e.slice(i),t.join("")}function us(e,s){if(!uc(e))return{html:e,hasScoped:!1};let t=ni(s),i=`data-v-${t}`,a=e,h=!1;if(ii.lastIndex=0,a=a.replace(ii,(c,v,E)=>{if(!ci.test(v))return c;h=!0;let R=fc(E,i),C=v.replace(lc,"").trim(),O=C?` ${C}`:"";return`<style data-stx-scoped="${t}"${O}>${R}</style>`}),!h)return{html:e,hasScoped:!1};return a=dc(a,i),{html:a,hasScoped:!0}}function fc(e,s){return si(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${s}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${s}]`)}var pc=(e)=>`\x00stx-scope-mask-${e}\x00`,oi=/\u0000stx-scope-mask-(\d+)\u0000/g;function dc(e,s){let t=ce(e,(a,h)=>{let c=W(a,h);return c>h?c:on(a,h)},(a,h)=>pc(h)),i=gc(t.output,s);return oi.lastIndex=0,i.replace(oi,(a,h)=>t.tokens[Number(h)])}function gc(e,s){let t=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(i,a,h)=>{if(t.has(a.toLowerCase()))return i;if(i.includes(s))return i;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return i;if(h)return i.replace(`<${a}${h}`,`<${a} ${s}${h}`);if(i.endsWith("/>"))return`<${a} ${s} />`;return`<${a} ${s}>`})}var Xt=/<\/?template\b[^>]*>/gi,mc=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function hc(e){let s=e.replace(/^<template\b/i,"").replace(/>$/,"");return mc.test(s)}function ie(e){Xt.lastIndex=0;let s;while((s=Xt.exec(e))!==null){if(s[0].startsWith("</")||hc(s[0]))continue;let t=s.index,i=Xt.lastIndex,a=1,h;while((h=Xt.exec(e))!==null)if(h[0].startsWith("</")){if(a--,a===0){let c=h.index;return{start:t,openEnd:i,closeStart:c,end:Xt.lastIndex,content:e.slice(i,c)}}}else a++;return null}return null}function ps(e,s){let t=e,i=/@json\s*\(/g,a;while((a=i.exec(t))!==null){let h=a.index,c=h+a[0].length-1,v=1,E=c+1,R=null,C=!1;while(E<t.length&&v>0){let X=t[E];if(C){C=!1,E++;continue}if(X==="\\"&&R){C=!0,E++;continue}if(R){if(X===R)R=null;E++;continue}if(X==='"'||X==="'"||X==="`"){R=X,E++;continue}if(X==="(")v++;else if(X===")"){if(v--,v===0)break}E++}if(v!==0)break;let O=t.substring(c+1,E).trim(),M=t.substring(h,E+1),N=-1,I=0,P=null,Z=!1;for(let X=0;X<O.length;X++){let Y=O[X];if(Z){Z=!1;continue}if(Y==="\\"&&P){Z=!0;continue}if(P){if(Y===P)P=null;continue}if(Y==='"'||Y==="'"||Y==="`"){P=Y;continue}if(Y==="("||Y==="["||Y==="{")I++;else if(Y===")"||Y==="]"||Y==="}")I--;if(Y===","&&I===0){N=X;break}}let U=N>=0?O.substring(0,N).trim():O,V=N>=0?O.substring(N+1).trim():void 0;try{let X=U.trim(),Y;if(d(X))Y=u(X,Object.keys(s))(...Object.values(s));else Y=void 0;let Q;if(V==="true")Q=JSON.stringify(Y,null,2);else Q=JSON.stringify(Y);let se=Q.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");t=t.substring(0,h)+se+t.substring(E+1),i.lastIndex=h+se.length}catch(X){D.log(X instanceof Error?X:Error(String(X)),{directive:"@json"},"error"),i.lastIndex=h+M.length}}return t}function gs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function ja(e){let s=e,t=/@memo\s*\(/g,i,a=[];while((i=t.exec(s))!==null){let h=i.index,c=h+i[0].length,v=1,E=c;while(E<s.length&&v>0){if(s[E]==="(")v++;else if(s[E]===")")v--;E++}if(v!==0)continue;let R=s.slice(c,E-1).trim(),C=E,O=s.slice(C),M=O.indexOf("@endmemo");if(M===-1)continue;let N=O.slice(0,M),I=C+M+8,P=N.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),Z=P?P[0].length:0,U=N.slice(Z),V=N.match(/(\s*)$/),X=V?V[0].length:0,Y=U.slice(0,U.length-X),Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),se;if(Q){let[pe,Ee,ke="",ze]=Q,Te=`<${Ee}${ke} data-stx-memo="${R}"${ze}>`;se=N.slice(0,Z)+Te+Y.slice(pe.length)+N.slice(Z+Y.length)}else se=`${N.slice(0,Z)}<div data-stx-memo="${R}">${Y}</div>${N.slice(Z+Y.length)}`;a.push({start:h,end:I,replacement:se}),t.lastIndex=I}for(let h=a.length-1;h>=0;h--){let c=a[h];s=s.slice(0,c.start)+c.replacement+s.slice(c.end)}return s.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Ao(e){let s=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return s=s.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),s}function pi(e,s){if(!/\bref\s*=/.test(e))return e;let t=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,i=ae(e,(E,R)=>{t.lastIndex=R;let C=t.exec(E);if(!C||/^(?:script|style)$/i.test(C[1]))return-1;return t.lastIndex}),a=[],h=0,c=0,v=[];for(let{start:E,end:R,token:C}of i){let O=/^<\/?([\w-]+)/.exec(C)[1].toLowerCase();if(C.startsWith("</")){let N;while(N=a.pop()){if(N.scoped)h--;if(N.name===O)break}continue}let M=/\sdata-stx-scope\s*=/.test(C);if(!h&&!M&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(C)&&!/\sdata-stx-ref-caller\s*=/.test(C))v.push(e.slice(c,E),C.replace(/\s*\/?>$/,(N)=>` data-stx-ref-caller="${s}"${N}`)),c=R;if(!di.has(O)&&!/\/>$/.test(C)){if(a.push({name:O,scoped:M}),M)h++}}return v.push(e.slice(c)),v.join("")}var di=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),gi=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,li=/<\/?\s*([a-z][\w-]*)/iy,xc=/\s/;function bc(e,s){let t=s-1;while(t>=0&&xc.test(e[t]))t--;return t>=0&&e[t]==="/"}function yc(e,s){let t=!1,i=!1;for(let a=s;a<e.length;a++){let h=e[a];if(t){if(h==="'")t=!1}else if(i){if(h==='"')i=!1}else if(h==="'")t=!0;else if(h==='"')i=!0;else if(h===">")return a}return-1}function _c(e,s){if(e.indexOf("{",s)===-1||e.indexOf("}",s)===-1)return!1;let t=0,i=s,a=!1,h=!1,c=!1;while(i<e.length){let v=e.indexOf("<",i),E=v===-1?e.length:v;if(E>i){if(t===0)while(i<E){let O=e.indexOf(h?"}":"{",i);if(O===-1||O>=E){if(h)c=!1;else a=!1;break}if(O>i)if(h)c=!1;else a=!1;if(h){if(c)return!0;c=!0}else if(a)h=!0,c=!1;else a=!0;i=O+1}i=E;continue}if(e.startsWith("<!--",i)){let O=e.indexOf("-->",i);i=O===-1?e.length:O+3;continue}let R=yc(e,i);if(R===-1)break;li.lastIndex=i;let C=li.exec(e)?.[1]?.toLowerCase()??"";if(e[i+1]==="/"){if(t===0)break;t--}else if(!bc(e,R)&&!di.has(C))t++;i=R+1}return!1}var ui=y(256);function Ba(e){if(e.length<1024)return fi(e);let s=b(e),t=ui.get(s);if(t!==void 0)return t;let i=fi(e);return ui.set(s,i),i}function fi(e){if(e.length>=32768&&!Hr(e))return e;let t=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),i="",a=0,h;while((h=t.exec(e))!==null){let c=h.index,v=c+h[0].length,E=!1,R=!1,C=-1;while(v<e.length){let M=e[v];if(E){if(M==="'")E=!1}else if(R){if(M==='"')R=!1}else if(M==="'")E=!0;else if(M==='"')R=!0;else if(M===">"){C=v;break}v++}if(C===-1)continue;let O=e.slice(c,C+1);if(gi.test(O))continue;if(O.includes("x-cloak"))continue;if(_c(e,C+1))i+=e.slice(a,C)+" x-cloak>",a=C+1}return i+=e.slice(a),i}var wc=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,Sc=/<\/script>/gi,$c=/<\/style>/gi;function Fa(e){let s=/<[a-z][\w-]*/gi,t="",i=0,a;while((a=s.exec(e))!==null){let h=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let I=c==="script"?Sc:$c;I.lastIndex=h;let P=I.exec(e);if(P!==null)s.lastIndex=P.index+P[0].length;continue}let v=h+a[0].length,E=!1,R=!1,C=-1;while(v<e.length){let I=e[v];if(E){if(I==="'")E=!1}else if(R){if(I==='"')R=!1}else if(I==="'")E=!0;else if(I==='"')R=!0;else if(I===">"){C=v;break}v++}if(C===-1)continue;let O=e.slice(h+a[0].length,C);if(gi.test(O))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(O))continue;if(!wc.test(O))continue;let M=e[C-1]==="/",N=M?C-1:C;t+=`${e.slice(i,N)} x-cloak${M?" ":""}`,i=N}return t+=e.slice(i),t}import Ri from"path";import Ds from"fs";import Jt from"path";function mi(e,s,t,i){let a=0;for(let h=s;h<e.length;h++)if(e[h]===t)a++;else if(e[h]===i&&!(i===">"&&e[h-1]==="=")){if(--a===0)return h}return-1}function vc(e){let s=o(e),t=0,i=0,a=[];for(let h=0;h<s.length;h++)if("([{".includes(s[h]))t++;else if(")]}".includes(s[h]))t--;else if(s[h]===","&&t===0)a.push(e.slice(i,h).trim()),i=h+1;return a.push(e.slice(i).trim()),a}function Ms(e,s){let t=o(e),i=new RegExp(`\\b(?:${s.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of t.matchAll(i)){let h=a.index+a[0].length,c="";if(t[h]==="<"){let E=mi(t,h,"<",">");if(E<0)continue;c=e.slice(h+1,E),h=E+1;while(/\s/.test(t[h]||"")&&h<t.length)h++}if(t[h]!=="(")continue;let v=mi(t,h,"(",")");if(v>=0)return{type:c,args:vc(e.slice(h+1,v))}}return null}var hi=`
|
|
235
235
|
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
236
236
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
237
237
|
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
@@ -239,82 +239,82 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
|
|
|
239
239
|
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
240
240
|
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
241
241
|
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
242
|
-
`;function
|
|
243
|
-
`)}),c=
|
|
242
|
+
`;function xi(e,s){let t=[],i={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=o(e),h=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(M,N,I,P,Z)=>{if(a.slice(Z,Z+6)!=="import")return M;if(P.endsWith(".stx"))return"";let U=`${s}Import${t.length}`;if(t.push(`import * as ${U} from ${JSON.stringify(P)};`),N.startsWith("*"))return`import ${N.replace(/^\*\s+as\s+/,"")} = ${U};`;if(!N.startsWith("{"))return`import ${N} = ${U}.default;`;return N.slice(1,-1).split(",").map((V)=>{let[X,Y=X]=V.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!X)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(P)&&X in i)i[X].push(Y);return`import ${Y} = ${U}.${X};`}).join(`
|
|
243
|
+
`)}),c=Ms(e,i.defineProps),v=Ms(e,i.defineEmits),E=Ms(e,i.withDefaults);if(!c&&!v)return{declarations:"",props:null,events:null};let R=[],C=null,O=null;if(c){R.push(`const __options = (${c.args[0]||"{}"}) as const;`),R.push(`const __defaults = (${E?.args[1]||"{}"});`);let M=c.type||"__StxOptions<typeof __options>";R.push(`export type __StxProps = __StxDefaults<${M}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),C=`${s}.__StxProps`}if(v)R.push(`const __events = (${v.args[0]||"[]"}) as const;`),R.push(`export type __StxEvents = ${v.type||"Record<(typeof __events)[number], any[]>"};`),O=`${s}.__StxEvents`;return{declarations:`${t.join(`
|
|
244
244
|
`)}
|
|
245
245
|
namespace ${s} {
|
|
246
246
|
${h}
|
|
247
247
|
${R.join(`
|
|
248
248
|
`)}
|
|
249
|
-
}`,props:C,events:O}}var ir=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function ar(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...ir].some((s)=>s.toLowerCase()===e.toLowerCase());return ir.has(e)||/[A-Z]/.test(e)}function*
|
|
249
|
+
}`,props:C,events:O}}var ir=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function ar(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...ir].some((s)=>s.toLowerCase()===e.toLowerCase());return ir.has(e)||/[A-Z]/.test(e)}function*Ec(e){let s=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,t;while(t=s.exec(e)){let i=s.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 h=/^[^\s=/>]+/.exec(e.slice(i))?.[0];if(!h){i++;continue}let c=i;i+=h.length;while(/\s/.test(e[i]||""))i++;if(e[i]!=="="){a.push({name:h,value:!0,offset:c,braced:!1});continue}i++;while(/\s/.test(e[i]||""))i++;let v=e[i],E=v==="{",R=v==='"'||v==="'";if(R||E)i++;let C=i;if(E){let O=o(e.slice(i)),M=1,N=0;for(;N<O.length;N++){if(O[N]==="{")M++;if(O[N]==="}"&&--M===0)break}i+=N}else if(R)while(i<e.length&&e[i]!==v)i++;else while(i<e.length&&!/[\s/>]/.test(e[i]))i++;if(a.push({name:h,value:e.slice(C,i),offset:C,braced:E}),R||E)i++}s.lastIndex=i,yield{name:t[1],offset:t.index,attributes:a}}}function bi(e,s,t){let i=[],a=[hi,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],h=new Map,c=new Map,v=new Map,E=t.scriptCode(e,t.filePath),R=o(E);for(let I of E.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(R.slice(I.index,I.index+6)!=="import")continue;let P=I[2],Z=Jt.isAbsolute(P)||P.startsWith(".")?Jt.resolve(Jt.dirname(t.filePath),P):os(P,Jt.dirname(t.filePath));if(!Z)continue;let U=Z.endsWith(".stx")?Z:Ds.existsSync(`${Z}.stx`)?`${Z}.stx`:void 0,V=U?null:ss(Z,!1),X=I[1].startsWith("{")?I[1].slice(1,-1).split(","):[I[1]];for(let Y of X){let[Q,se=Q]=Y.trim().split(/\s+as\s+/),pe=U||V?.get(Q)||V?.get(Q.toLowerCase());if(pe)v.set(se,pe),v.set(se.toLowerCase(),pe),v.set(se.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),pe)}}for(let I of s.matchAll(/@import\s*\(([^)]+)\)/g))for(let P of I[1].matchAll(/['"]([^'"]+)['"]/g)){let Z=is(P[1],t.filePath,t).find((U)=>Ds.statSync(U,{throwIfNoEntry:!1})?.isFile());if(Z)v.set(Jt.basename(P[1]).replace(/\.stx$/,""),Z)}let C={__importedComponents:v},O=new Map,M=(I,P,Z)=>{let U=e.slice(0,I);return{code:P,offset:I,attribute:Z,anchor:!0,kind:"directive",line:U.split(`
|
|
250
250
|
`).length,column:I-U.lastIndexOf(`
|
|
251
|
-
`)}},
|
|
252
|
-
`):"",checks:i,events:h,dependencies:c}}var
|
|
253
|
-
`,s-1)+1;return s-t+1}function
|
|
254
|
-
`)s[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 h;while((h=a.exec(e))!==null)t(h.index,h.index+h[0].length)}return s.join("")}function
|
|
251
|
+
`)}},N=(I,P,Z)=>i.push({expression:I,statement:{text:P+I.code+Z,prefixLength:P.length}});for(let I of Ec(s)){if(ar(I.name)||I.name==="component")continue;let P=pr(I.name,t.filePath,t,C);if(!P)continue;let Z=O.get(P);if(!Z){let V;try{V=t.readComponent?t.readComponent(P):Ds.readFileSync(P,"utf8")}catch{continue}if(V===void 0)continue;c.set(P,V),Z=xi(t.scriptCode(V,P),`__StxComponent${O.size}`),O.set(P,Z),a.push(Z.declarations)}let U=[];for(let V of I.attributes){let{name:X,offset:Y}=V,Q=V.value===!0?"true":V.value;if(X.startsWith("@")||X.startsWith("v-on:")){if(Z.events&&V.value!==!0)h.set(Y,`__StxEvent<${Z.events}, ${JSON.stringify(X.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let se=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(X);if(X.startsWith("v-")&&!X.startsWith("v-bind:")&&!se)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(X))continue;let pe=(se?se[1]||"modelValue":X.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(ze,Te)=>Te.toUpperCase());if(U.push(pe),!Z.props)continue;let ke=X.startsWith(":")||X.startsWith("v-bind:")||!!se||V.braced?Q:V.value!==!0?JSON.stringify(Q):"true";N(M(Y,ke,X),";void ((",`) satisfies __StxProp<${Z.props}, ${JSON.stringify(pe)}>);`)}if(Z.props){let V=[...new Set(U)].map((Y)=>`${JSON.stringify(Y)}: undefined as any`).join(", "),X=M(I.offset,`<${I.name}>`);i.push({expression:X,statement:{text:`;void ({ ${V} } satisfies ${Z.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:O.size?a.join(`
|
|
252
|
+
`):"",checks:i,events:h,dependencies:c}}var yi=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function kc(e){let s=(t)=>t.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,s).replace(/\{\{--[\s\S]*?--\}\}/g,s)}function $t(e){let s=[],t=kc(e);yi.lastIndex=0;let i;while((i=yi.exec(t))!==null){let a=(i[1]||"").trim(),h=(i[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(i[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,v=i.index+h,E=i.index+i[0].length-c,R=e.slice(v,E);if(/\bsrc\s*=/.test(a))continue;let C=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(C&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(C[1]))continue;let O=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",M=Gt(e,v);s.push({kind:O,code:R,startLine:M,startColumn:Yt(e,v),offset:v,attrs:a})}return s}function Gt(e,s){let t=1;for(let i=0;i<s&&i<e.length;i++)if(e.charCodeAt(i)===10)t++;return t}function Yt(e,s){let t=e.lastIndexOf(`
|
|
253
|
+
`,s-1)+1;return s-t+1}function zn(e){let s=e.split(""),t=(a,h)=>{for(let c=a;c<h&&c<s.length;c++)if(s[c]!==`
|
|
254
|
+
`)s[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 h;while((h=a.exec(e))!==null)t(h.index,h.index+h[0].length)}return s.join("")}function Rc(e){let s=0,t="";for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t="";continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{"){s++;continue}if(a===")"||a==="]"||a==="}"){s--;continue}if(a==="|"&&s===0){if(e[i+1]==="|"){i++;continue}if(e[i-1]==="|")continue;return e.slice(0,i)}}return e}var Ci=new Set([":for","x-for","v-for"]),Wn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,js="__stx_interpolated",_i="__StxElement",Ti="__StxTemplateValue",Cc=`type ${Ti}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function wi(e){return e.replace(/\{\{[\s\S]*?\}\}/g,js).replace(/\{!![\s\S]*?!!\}/g,js)}function Co(e){return e.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(s)=>{let t=s.split(`
|
|
255
255
|
`).length-1,i=s.length-t;return`0${" ".repeat(Math.max(0,i-1))}${`
|
|
256
|
-
`.repeat(t)}`})}var
|
|
257
|
-
`)}function Aa(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((s)=>s[1]))}function
|
|
256
|
+
`.repeat(t)}`})}var Tc=["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"],Ac=new RegExp(String.raw`^[ \t]*@(?:${Tc.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Eo(e){return e.replace(Ac,(s)=>s.replace(/[^\n]/g," "))}var Si=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Fl(e){let s=zn(e),t=[],i=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=i.exec(s))!==null){if(a[1]||a[3])continue;let v=a[2]??a[4]??"",E=a[2]!==void 0?2:3,R=Rc(v);if(!R.trim())continue;let C=a.index+E+(R.length-R.trimStart().length);t.push({code:R.trim(),line:Gt(s,C),column:Yt(s,C),offset:C,kind:"interpolation"})}let h=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=h.exec(s))!==null){let c=a.index+a[0].length-1,v=0,E=c;for(;E<s.length;E++){let M=s[E];if(M==="(")v++;else if(M===")"){if(v--,v===0)break}}if(v!==0)continue;let R=s.slice(c+1,E),C=R.trim();if(h.lastIndex=E+1,!C)continue;let O=c+1+(R.length-R.trimStart().length);t.push({code:C,line:Gt(s,O),column:Yt(s,O),offset:a.index,kind:"condition"})}Wn.lastIndex=0;while((a=Wn.exec(s))!==null){let c=a[1],v=a[3]??"",E=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Si.has(E)||Si.has(c))continue;if(!v.trim())continue;let R=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(Ci.has(E)){let O=v.match(/\s+(?:in|of)\s+/);if(!O||O.index===void 0)continue;let M=v.slice(O.index+O[0].length),N=O.index+O[0].length+(M.length-M.trimStart().length);t.push({code:wi(M.trim()),line:Gt(s,R+N),column:Yt(s,R+N),offset:R+N,kind:"directive",attribute:E});continue}let C=v.length-v.trimStart().length;t.push({code:wi(v.trim()),line:Gt(s,R+C),column:Yt(s,R+C),offset:R+C,kind:"directive",attribute:E})}return t.sort((c,v)=>c.line-v.line||c.column-v.column),t}var Ic=2000;function Oc(e,s){let t=0,i=Math.min(e.length,s+Ic);for(let a=s;a<i;a++){let h=e[a];if(h==="(")t++;else if(h===")"){if(t--,t===0)return e.slice(s+1,a)}}return null}function Pc(e){let s=new Map,t=(v,E)=>{let R=v.split(/[,[\]{}()\s]+/).filter(Boolean);for(let C of R){let O=C.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(O))continue;let M=R.length===1?E:void 0,N=s.get(O);if(!N)s.set(O,{name:O,iterable:M});else if(N.iterable!==M)N.iterable=void 0}},i=/^\$?[A-Z_$][\w$]*$/i,a=(v)=>{let E=v.trim();return i.test(E)?E:void 0};for(let v of e.matchAll(/@for(?:each|else)\s*\(/g)){let E=Oc(e,v.index+v[0].length-1);if(E===null)continue;let R=Et(E);if(!R)continue;t(R.itemVar.replace(/=>/g," "),a(R.arrayExpr))}for(let v of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))t(v[1],v[2]==="of"?a(v[3]):void 0);for(let v of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))t(v[1]);let h=zn(e);Wn.lastIndex=0;let c;while((c=Wn.exec(h))!==null){let v=c[1].replace(/\..*$/,"");if(!Ci.has(v))continue;let E=c[3].match(/\s+(?:in|of)\s+/);if(!E||E.index===void 0)continue;t(c[3].slice(0,E.index),a(c[3].slice(E.index+E[0].length)))}for(let v of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let E of v[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))t(E[1]);return[...s.values()].sort((v,E)=>v.name.localeCompare(E.name))}function Pe(e){let s=new Set;for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))s.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))s.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))s.add(t[1]);for(let t of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let i of t[1].split(",")){let a=i.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))s.add(a)}return[...s].sort()}var Ns=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Mc={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function Ra(e=new Set){return[...Ns.filter((s)=>!e.has(s)).map((s)=>`declare var ${s}: any`),...Object.entries(Mc).filter(([s])=>!e.has(s)).map(([,s])=>s)].join(`
|
|
257
|
+
`)}function Aa(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((s)=>s[1]))}function Ai(e){let s=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,t,i=!1,a=new Set,h=o(e);while((t=s.exec(h))!==null){i=!0;for(let c of Dc(t[1])){let v=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(v))a.add(v)}}return i?[...a]:null}function Dc(e){let s=[],t=0,i="";for(let a of e){if(a===","&&t===0){s.push(i),i="";continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;i+=a}return s.push(i),s.filter((a)=>a.trim().length>0)}function jc(e){let s=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,t=[],i=e.replace(s,(a)=>(t.push(a.trim()),a.split(`
|
|
258
258
|
`).map(()=>"").join(`
|
|
259
259
|
`)));return{imports:t.join(`
|
|
260
|
-
`),body:i}}function
|
|
261
|
-
`&&!/[=|&,<([{]\s*$/.test(s.slice(Math.max(0,O-40),O)))){R=
|
|
262
|
-
`)}if(t.length===0)return a.length>0?["",`// ${
|
|
263
|
-
`):"";let{imports:h,body:c}=
|
|
260
|
+
`),body:i}}function Ii(e){let s=o(e),t=Array(s.length),i=0;for(let v=0;v<s.length;v++){let E=s[v];if(E==="}"||E===")"||E==="]")i=Math.max(0,i-1);if(t[v]=i,E==="{"||E==="("||E==="[")i++}let a=[],h=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=h.exec(s))!==null){if(t[c.index]!==0)continue;let v=c[1],E=c[2],R;if(v==="interface"){let C=s.indexOf("{",c.index);if(C===-1)continue;let O=0;R=-1;for(let M=C;M<s.length;M++)if(s[M]==="{")O++;else if(s[M]==="}"&&--O===0){R=M+1;break}if(R===-1)continue}else{let C=0;R=s.length;for(let O=s.indexOf("=",c.index)+1;O<s.length;O++){let M=s[O];if(M==="{"||M==="["||M==="("||M==="<")C++;else if(M==="}"||M==="]"||M===")"||M===">")C--;else if(C<=0&&(M===";"||M===`
|
|
261
|
+
`&&!/[=|&,<([{]\s*$/.test(s.slice(Math.max(0,O-40),O)))){R=M===";"?O+1:O;break}}}a.push({name:E,text:e.slice(c.index,R).replace(/^[ \t]*export[ \t]+/,"")}),h.lastIndex=R}return a}function Nc(e){return new Set(Ii(e).map((s)=>s.name))}function Pa(e,s=""){let t=Ai(e),i=Nc(s),a=Ii(e).filter((R)=>!i.has(R.name)).map((R)=>R.text);if(!t){let R=Pe(e).filter((C)=>!Ht(s,C));if(R.length===0&&a.length===0)return"";return["",`// ${Lc}`,...a,...R.map((C)=>`declare var ${C}: any`)].join(`
|
|
262
|
+
`)}if(t.length===0)return a.length>0?["",`// ${$i}`,...a].join(`
|
|
263
|
+
`):"";let{imports:h,body:c}=jc(e),v=c.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),E=["",`// ${$i}`];if(h)E.push(h);return E.push(...a),E.push(`async function ${vi}() {`,v,` return { ${t.join(", ")} }`,"}",`type ${Ei} = Awaited<ReturnType<typeof ${vi}>>`,...t.map((R)=>`declare var ${R}: ${Ei}[${JSON.stringify(R)}]`)),E.join(`
|
|
264
264
|
`)}function To(e){let t=o(e).split(""),i=0;for(let a=0;a<t.length;a++){let h=t[a];if(h==="{"||h==="("||h==="["){i++;continue}if(h==="}"||h===")"||h==="]"){i=Math.max(0,i-1);continue}if(i>0&&h!==`
|
|
265
|
-
`)t[a]=" "}return
|
|
266
|
-
`),a=Array.from({length:i.length},()=>""),h=new Map,c=s.filePath&&s.templateExpressions!==!1?
|
|
267
|
-
`)}):void 0,v=new Set,E=[];for(let O of t){let
|
|
268
|
-
`);
|
|
269
|
-
`).entries())if(a.push(I),
|
|
270
|
-
`))R(
|
|
271
|
-
`),lineMap:h,sourceLineCount:i.length,componentDependencies:c?.dependencies,referenced:C}}function Na(e,s){if(!e.expression)return!1;return e.inGuard===!0||s===2774}function Da(e,s,t){let i=e.lineMap.get(s);if(!i)return s<=e.sourceLineCount?{line:s,column:t}:null;let a=i.expression?.anchor?0:Math.max(0,t-1-(i.prefixLength??0));return{line:i.line,column:i.column+a,expression:i.expression,inGuard:t<=(i.guardPrefixLength??0)}}var
|
|
265
|
+
`)t[a]=" "}return Pe(t.join(""))}function Ia(e,s){if(Ai(e)!==null)return[];let t=To(e),i=rn(s,new Set(t)),a=new Set(x);return t.filter((h)=>{if(a.has(h))return!1;if(Ht(s,h))return!1;return i.has(h)})}var $i="stx: types for the declared client payload (#1868)",Lc="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",vi="__stxServerScope",Ei="__StxClientPayload";var ki=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Bc=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function zc(e){let s=new Map,t=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let i of e){let a=o(i),{depths:h,balanced:c}=Qe(a);if(!c)continue;let v=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let E of a.matchAll(v)){let R=E.index??0;if(h[R+E[1].length]!==0)continue;let C=E[2],O=R+E[0].length-E[3].length,M=i.slice(O,R+E[0].length).trim().replace(/;$/,"").trim(),N=E[3],I=t.test(N)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(N)&&!/[,+\-*/%&|?:=]$/.test(M)&&Qe(N).balanced;s.set(C,s.has(C)||!I?null:M)}}return new Map([...s].filter((i)=>i[1]!==null))}function Oi(e,s,t=0,i=new Set){if(s.size===0||t>=5)return e;let a=o(e),h="",c=0;for(let v of a.matchAll(/[A-Za-z_$][\w$]*/g)){let E=v.index??0,R=v[0],C=s.get(R);if(!C||i.has(R))continue;let O=a.slice(0,E).trimEnd(),M=a.slice(E+R.length).trimStart();if(O.endsWith(".")||/^:(?!:)/.test(M)&&/[{,]$/.test(O))continue;if(E>0&&/[\w$]/.test(a[E-1]))continue;h+=`${e.slice(c,E)}(${Oi(C,s,t+1,new Set([...i,R]))})`,c=E+R.length}return h+e.slice(c)}function Wc(e,s){let t=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,i=[],a;while((a=t.exec(e))!==null){if(a.index>s)break;let h=a[1];if(a.index===s){if(h==="elseif"){let v=i[i.length-1];if(v?.current)v.seen.push(v.current);if(v)v.current=null}break}if(h==="endif"||h==="endunless"){i.pop();continue}let c="";if(a[2]==="("){let v=0,E=a.index+a[0].length-1,R=E+1;for(;E<e.length;E++){let C=e[E];if(C==="(")v++;else if(C===")"){if(v--,v===0)break}}c=e.slice(R,E).trim(),t.lastIndex=E+1}if(h==="if")i.push({seen:[],current:c});else if(h==="unless")i.push({seen:[],current:`!(${c})`});else if(h==="elseif"||h==="else"){let v=i[i.length-1];if(!v)continue;if(v.current)v.seen.push(v.current);v.current=h==="elseif"?c:null}}return i.flatMap((h)=>[...h.seen.map((c)=>`!(${c})`),...h.current?[h.current]:[]]).filter(Boolean)}function Fc(e){let s=e.code.trim();if(!s)return null;if(e.attribute?.startsWith("@")){if(Bc.test(s))return null;let i=";(($event: any): void => { ";return{text:`${i}${s} });`,prefixLength:i.length}}let t=";void ((";return{text:`${t}${s}));`,prefixLength:t.length}}var Vc=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function ls(e,s){if(!s)return e;return e.replace(Vc,(t,i,a,h)=>{let c=Ri.resolve(s,h).replace(/\\/g,"/");return`${i}${a}${c}${a}`})}function $o(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function Uc(e){let s=new Set,t=o(e);for(let i of t.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=i[1],h=/\{([^}]*)\}/.exec(a);for(let R of h?.[1].split(",")??[]){let C=R.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(C&&/^[A-Z_$][\w$]*$/i.test(C))s.add(C)}let c=a.replace(/\{[^}]*\}/,""),v=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(v)s.add(v[1]);let E=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(E&&E[1]!=="type")s.add(E[1])}return[...s].sort()}function Oa(e,s={}){let t=$t(e),i=e.split(`
|
|
266
|
+
`),a=Array.from({length:i.length},()=>""),h=new Map,c=s.filePath&&s.templateExpressions!==!1?bi(e,zn(e),{filePath:s.filePath,componentsDir:s.componentsDir,projectRoot:s.projectRoot,readComponent:s.readComponent,scriptCode:(O,M)=>$t(O).map((N)=>ls(N.code,Ri.dirname(M))).join(`
|
|
267
|
+
`)}):void 0,v=new Set,E=[];for(let O of t){let M=Eo(Co(O.code)),N=ls(M,s.originDir??"").split(`
|
|
268
|
+
`);N.forEach((I,P)=>{let Z=O.startLine-1+P;if(Z<a.length)a[Z]=P===0?$o(O)+I:I,v.add(Z)}),E.push(O.startLine-1+N.length-1)}for(let O of E){let M=a[O]?.trim()===""?O:O+1;if(M<a.length&&a[M].trim()===""&&(M===O||!v.has(M)))a[M]=";"}let R=(O,M)=>{for(let[N,I]of O.split(`
|
|
269
|
+
`).entries())if(a.push(I),M)h.set(a.length,N===0?M:{...M,line:M.line+N,column:1,prefixLength:0})};if(s.globals!==!1){R("");let O=new Set([...t.flatMap((P)=>Pe(P.code)),...t.flatMap((P)=>Uc(P.code))]),M=(P)=>{if(!O.has(P))R(`declare var ${P}: any`)};if(s.runtimeGlobals!==!1){if(!O.has("window"))R("declare var window: any");for(let P of x)M(P)}let N=[...new Set([...Ns,...ye,...ki])].filter((P)=>s.runtimeGlobals!==!1||!x.includes(P));if(s.contextScope==="global"){R("declare global {");for(let P of N)R(` var ${P}: any`);R("}")}else{for(let P of Ns)M(P);for(let P of ye)M(P);for(let P of ki)M(P)}R(`declare var ${js}: any`);let I=new Set(t.flatMap((P)=>Pe(P.code)));R(`type ${_i}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let P of Pc(e)){if(I.has(P.name))continue;let Z=P.iterable&&I.has(P.iterable)?`${_i}<typeof ${P.iterable}>`:"any";R(`declare var ${P.name}: ${Z}`)}}if(s.templateExpressions!==!1){if(c?.declarations)for(let M of c.declarations.split(`
|
|
270
|
+
`))R(M);let O=Fl(e).map((M)=>{let N=c?.events.get(M.offset??-1);if(N){M.anchor=!0;let I=M.code.trim(),P=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(I),Z=P?`void ((${P[2]}) satisfies __StxAssignedValue<typeof ${P[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(I)?`${I} satisfies (($event: ${N}) => unknown)`:I,U=`;(($event: ${N}): void => { `;return{expression:M,statement:{text:`${U}${Z} });`,prefixLength:U.length}}}return{expression:M,statement:Fc(M)}}).filter((M)=>M.statement!==null);if(O.push(...c?.checks||[]),O.length>0){let M=zn(e),N=Bn(M),I=zc(t.map((V)=>V.code)),Z=[...new Set(t.flatMap((V)=>Pe(V.code)))].filter((V)=>/^[A-Z_$][\w$]*$/i.test(V)),U=0;if(Z.length>0){R(Cc);for(let V of Z)R(`function __StxRead_${V}() { return ${V} }`),R(`type __StxT_${V} = ${Ti}<ReturnType<typeof __StxRead_${V}>>`);R(`;((${Z.map((V)=>`${V}: __StxT_${V}`).join(", ")}) => {`),U=1}for(let{expression:V,statement:X}of O){let Y=" ".repeat(U),Q=V.offset===void 0?[]:N.filter((Te)=>V.offset>=Te.start&&V.offset<Te.end),se=Q.map((Te)=>`;((${Te.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),pe=" });".repeat(Q.length),Ee=V.offset===void 0?[]:Wc(M,V.offset),ke=Ee.length>0?`${Ee.map((Te)=>`if (${Oi(Te,I)}) `).join("")}{ `:"",ze=Ee.length>0?" }":"";R(Y+se+ke+X.text+ze+pe,{line:V.line,column:V.column,expression:V,prefixLength:X.prefixLength+Y.length+se.length+ke.length,guardPrefixLength:Y.length+se.length+ke.length})}if(U>0)R("});")}}let C=!1;if(s.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(s.reference.replace(/\\/g,"/"))} />`,C=!0;return R("export {}"),{text:a.join(`
|
|
271
|
+
`),lineMap:h,sourceLineCount:i.length,componentDependencies:c?.dependencies,referenced:C}}function Na(e,s){if(!e.expression)return!1;return e.inGuard===!0||s===2774}function Da(e,s,t){let i=e.lineMap.get(s);if(!i)return s<=e.sourceLineCount?{line:s,column:t}:null;let a=i.expression?.anchor?0:Math.max(0,t-1-(i.prefixLength??0));return{line:i.line,column:i.column+a,expression:i.expression,inGuard:t<=(i.guardPrefixLength??0)}}var Ls=y(256),Hc=[{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"}],Pi=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Kc(e){let s=Array.from(e,(a)=>a===`
|
|
272
272
|
`?`
|
|
273
273
|
`:" "),t=0,i="";while(t<e.length){let a=e[t],h=e[t+1];if(i){if(a==="\\"){t+=2;continue}if(a===i)i="";t++;continue}if(a==='"'||a==="'"||a==="`"){i=a,t++;continue}if(a==="/"&&h==="/"){while(t<e.length&&e[t]!==`
|
|
274
|
-
`)s[t]=e[t],t++;continue}if(a==="/"&&h==="*"){let c=e.indexOf("*/",t+2),v=c===-1?e.length:c+2;for(;t<v;t++)s[t]=e[t];continue}if(a==="{"&&h==="{"&&e.slice(t,t+4)==="{{--"){let c=e.indexOf("--}}",t+4),v=c===-1?e.length:c+4;for(;t<v;t++)s[t]=e[t];continue}t++}return s.join("")}function
|
|
274
|
+
`)s[t]=e[t],t++;continue}if(a==="/"&&h==="*"){let c=e.indexOf("*/",t+2),v=c===-1?e.length:c+2;for(;t<v;t++)s[t]=e[t];continue}if(a==="{"&&h==="{"&&e.slice(t,t+4)==="{{--"){let c=e.indexOf("--}}",t+4),v=c===-1?e.length:c+4;for(;t<v;t++)s[t]=e[t];continue}t++}return s.join("")}function Zc(e){let s=new Map,t=Kc(e).split(`
|
|
275
275
|
`),i=e.split(`
|
|
276
|
-
`);return t.forEach((a,h)=>{
|
|
276
|
+
`);return t.forEach((a,h)=>{Pi.lastIndex=0;for(let c of a.matchAll(Pi)){let v=c[1]==="-next-line",E=(i[h]??"").slice(0,c.index).trim(),R=v||E===""?h+2:h+1,O=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),M=O.filter((I)=>/\w/.test(I));if(O.length>0&&M.length===0)continue;let N=s.get(R);if(N&&N.size===0)continue;if(M.length===0){s.set(R,new Set);continue}if(N)M.forEach((I)=>N.add(I));else s.set(R,new Set(M))}}),s}function qc(e,s,t){let i=e.get(s);if(!i)return!1;if(i.size===0)return!0;return[...i].some((a)=>t.includes(a))}function Re(e,s,t,i){let a=typeof t==="boolean"?{enabled:t,failOnViolation:t}:t??{enabled:!1};if(!a.enabled)return;let h=b(e,s,i,JSON.stringify(a)),c=Ls.get(h);if(c!==void 0){if(c&&a.failOnViolation)throw new z(c,i??s);return}let v=a.allowPatterns??[],E=Zc(e),R=[],C=o(e.replace(/\{\{--[\s\S]*?--\}\}/g,(I)=>I.replace(/[^\n]/g," ")));for(let{pattern:I,message:P,suggestion:Z}of Hc){if(v.some((V)=>/\w/.test(V)&&P.includes(V)))continue;I.lastIndex=0;let U=C.match(I);if(U&&U.length>0){let V=C.split(`
|
|
277
277
|
`),X=e.split(`
|
|
278
|
-
`),Y=[];if(V.forEach((
|
|
278
|
+
`),Y=[];if(V.forEach((Ee,ke)=>{if(I.lastIndex=0,I.test(Ee)&&!qc(E,ke+1,P))Y.push(ke+1)}),Y.length===0&&V.some((Ee)=>(I.lastIndex=0,I.test(Ee))))continue;let Q=Y.length>0?` (script line${Y.length>1?"s":""} ${Y.join(", ")})`:"",se=Y.slice(0,3).map((Ee)=>` ${Ee} | ${(X[Ee-1]??"").trim().slice(0,100)}`).join(`
|
|
279
279
|
`),pe=se?`
|
|
280
|
-
${se}`:"";R.push(` \u2717 ${
|
|
281
|
-
\u2192 ${Z}${pe}`)}}if(R.length===0){
|
|
280
|
+
${se}`:"";R.push(` \u2717 ${P}${Q}
|
|
281
|
+
\u2192 ${Z}${pe}`)}}if(R.length===0){Ls.set(h,"");return}let O=(I)=>{let P=`${process.cwd()}/`;return I.startsWith(P)?I.slice(P.length):I},N=`[STX] DOM API violation in ${i&&i!==s?`${O(i)} (composed into ${O(s)})`:O(s)}:
|
|
282
282
|
${R.join(`
|
|
283
283
|
`)}
|
|
284
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(
|
|
285
|
-
`);return{line:t.length,column:t[t.length-1].length+1}}function Yl(e,s,t){let i=[];switch(e){case"if":case"elseif":case"unless":if(t.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(t.length===0||!t[0].includes(" as "))i.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(t.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(t.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(t.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(t.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function Zl(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function Ql(e){let s=e.matchAll(/@([a-z]+)/gi),t=new Set;for(let i of s){let a=i[1].toLowerCase();if(!a.startsWith("end"))t.add(a)}return Array.from(t)}var Qt=new B(500),
|
|
286
|
-
`)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<h-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},R=()=>{if(i!==0)return;let C=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(C){let I=C[2].split(",").map((
|
|
284
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(Ls.set(h,N),console.warn(N),a.failOnViolation)throw new z(N,i??s)}var Xc=[{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"}],Jc=[{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')"}],Gc=[{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 Xl(e){let s=[],t=[];return Yc(e,s),Qc(e,s,t),el(e,t),tl(e,s),{valid:s.length===0,errors:s,warnings:t}}function Yc(e,s){let t=(e.match(/\{\{/g)||[]).length,i=(e.match(/\}\}/g)||[]).length;if(t!==i)s.push({type:"expression",message:`Unclosed expression brackets: found ${t} opening '{{' and ${i} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Qc(e,s,t){for(let i of Xc){let a=new RegExp(`${i.open}(?:\\s|\\()`,"g"),h=new RegExp(i.close,"g"),c=(e.match(a)||[]).length,v=(e.match(h)||[]).length;if(i.altClose){let E=new RegExp(i.altClose,"g");v+=(e.match(E)||[]).length}if(c>v)s.push({type:"directive",message:`Unclosed @${i.name} directive: found ${c} opening and ${v} closing`,suggestion:`Add ${c-v} missing ${i.close} tag(s)`});else if(v>c)t.push({type:"directive",message:`Extra ${i.close} found: ${v-c} more closing than opening`,suggestion:`Check for orphaned ${i.close} tags`})}}function el(e,s){for(let t of Jc)if(t.pattern.test(e))s.push({type:"syntax",message:t.message,suggestion:t.suggestion})}function tl(e,s){for(let t of Gc)if(t.pattern.test(e))s.push({type:"expression",message:`Security warning: ${t.message}`,suggestion:"Remove dangerous code from template expressions"})}function Jl(e,s){let t=e.slice(0,s).split(`
|
|
285
|
+
`);return{line:t.length,column:t[t.length-1].length+1}}function Yl(e,s,t){let i=[];switch(e){case"if":case"elseif":case"unless":if(t.length===0)i.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(t.length===0||!t[0].includes(" as "))i.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(t.length===0)i.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(t.length===0)i.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(t.length===0)i.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(t.length===0)i.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return i}function Zl(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function Ql(e){let s=e.matchAll(/@([a-z]+)/gi),t=new Set;for(let i of s){let a=i[1].toLowerCase();if(!a.startsWith("end"))t.add(a)}return Array.from(t)}var Qt=new B(500),Vn=new B(1000),Ws=new B(2000),Fs=new B(500),zi=33554432,Vs=zi;function nl(e){let s=e.componentRenderCacheBytes;if(typeof s!=="number"||s<0||s===Vs)return;Vs=s,Un.setMaxBytes(s)}var Un=new B(2000,{maxBytes:zi,sizeOf:(e)=>e.output.length});function sl(e){let s=new WeakSet;try{let t=(i)=>{if(i===void 0)return{__stxType:"undefined"};if(typeof i==="bigint")return{__stxType:"bigint",value:i.toString()};if(typeof i==="function"||typeof i==="symbol")throw TypeError("Non-serializable component input");if(i===null||typeof i!=="object")return i;if(s.has(i))throw TypeError("Circular component input");s.add(i);try{if(i instanceof Date)return{__stxType:"date",value:i.toISOString()};if(Array.isArray(i))return i.map(t);let a=Object.getPrototypeOf(i);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let h={};for(let c of Object.keys(i).sort())h[c]=t(i[c]);return h}finally{s.delete(i)}};return JSON.stringify(t(e))}catch{return null}}function rl(e){let s={};for(let[t,i]of Object.entries(e))if(!t.startsWith("__")||t==="__stxServeContext")s[t]=i;return s}function Bs(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ms(e){let s=process.cwd(),t=`${s}\x00${e}`,i=Mi.get(t);if(i===void 0)i=Bun.hash(Wi(e,s).split(oe.sep).join("/")).toString(36).slice(0,6),Mi.set(t,i);return i}var Mi=new Map;function Wi(e,s){if(!oe.isAbsolute(e))return e;let t=(i)=>{try{return Hs.realpathSync(i)}catch{return i}};return oe.relative(t(s),t(e))}function eu(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Ne(e){return!eu(e)}var Fn=new Map;function G(e){let s;try{s=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let t=Fn.get(s);if(t)return t;if(Fn.size>=16)Fn.clear();let i=new Bun.Transpiler(e);return Fn.set(s,i),i}var Di=new WeakMap,il=256;function De(e){try{let s=G({loader:"ts",target:"browser",define:S()}),t=Di.get(s);if(!t)t=new Map,Di.set(s,t);let i=t.get(e);if(i!==void 0)return i;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let h=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(v)=>{let E=h.length;return h.push(v),`"__STX_EXPR_${E}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(v)=>{let E=h.length;return h.push(v),`"__STX_EXPR_${E}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(v)=>{let E=h.length;return h.push(v),`"__STX_EXPR_${E}__"`});let c=s.transformSync(a);for(let v=0;v<h.length;v++)c=c.replace(`"__STX_EXPR_${v}__"`,h[v]),c=c.replace(`'__STX_EXPR_${v}__'`,h[v]);if(t.size>=il){let v=t.keys().next();if(!v.done)t.delete(v.value)}return t.set(e,c),c}catch(s){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",s);return e}}function ol(e){let s=[],t=new Set,i=0,a=0,h=e.length,c=(C)=>{a++;while(a<h){if(e[a]==="\\"){a+=2;continue}if(e[a]===C){a++;return}a++}},v=()=>{a++;while(a<h){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let C=1;while(a<h&&C>0)if(e[a]==="{")C++,a++;else if(e[a]==="}")C--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")v();else a++;continue}a++}},E=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<h&&e[a]!==`
|
|
286
|
+
`)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<h-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},R=()=>{if(i!==0)return;let C=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(C){let I=C[2].split(",").map((P)=>{let Z=P.trim().split(":");return Z[Z.length-1].trim()});for(let P of I)if(P&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(P)&&!t.has(P))s.push(P),t.add(P);return}let O=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(O){let I=O[2];if(!t.has(I))s.push(I),t.add(I);return}let M=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!t.has(I))s.push(I),t.add(I);return}let N=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let I=N[1];if(!t.has(I))s.push(I),t.add(I)}};while(a<h){if(E())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){v();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))R();a++}return s}function al(e){let s=[],t=0,i=0,a=null;for(let h=0;h<e.length;h++){let c=e[h];if(a){if(c==="\\"){h++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)s.push(e.slice(i,h)),i=h+1}if(i<e.length)s.push(e.slice(i));return s}function cl(e){let s=0,t=null;for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")s++;else if(a===")"||a==="]"||a==="}")s--;else if(a==="="&&s===0){let h=e[i-1],c=e[i+1];if(h==="!"||h==="<"||h===">"||h==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function ll(e,s){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let i=t.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,h=0,c=-1;for(;i>=0;i--){let E=e[i];if(E==="}")h++;else if(E==="{"){if(h--,h===0){c=i;break}}}if(c===-1)return;let v=e.slice(c+1,a);for(let E of al(v)){let R=E.trim();if(!R||R.startsWith("..."))continue;let C=cl(R);if(C===-1)continue;let O=R.slice(0,C).trim();if(!/^[A-Z_$][\w$]*$/i.test(O))continue;if(s[O]!==void 0)continue;let M=R.slice(C+1).trim();if(!M)continue;try{let N=Object.keys(s).filter(Nt),I=Function(...N,`"use strict"; return (${M});`);s[O]=I(...N.map((P)=>s[P]))}catch{}}}catch{}}var ul=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function tu(e,s){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let i=t[2].toLowerCase();if(!ul.has(i))return null;let a=new RegExp(`<\\/?${i}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),h=ae(e,(R,C)=>(a.lastIndex=C,a.exec(R)?.index===C?a.lastIndex:-1));if(i==="span"&&/\sdata-stx-scope\s*=/.test(h[0]?.token||""))return null;let c=0,v=!1;for(let R of h){if(c+=R.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(R.end).trim())return null;v=!0;break}}if(!v)return null;let E=t[0].length;return e.slice(0,E)+s+e.slice(E)}async function lr(e,s,t,i,a){let h=e.endsWith(".stx")?e.slice(0,-4):e,c=(Q)=>Q.split("-").map((se)=>se.charAt(0).toUpperCase()+se.slice(1)).join(""),v=t.__importedComponents;if(v){for(let Q of[h,h.toLowerCase(),c(h),j(h)])if(v.has(Q))return!0}let E=[...new Set([`${h}.stx`,`${c(h)}.stx`,`${j(h)}.stx`])],R=typeof a.root==="string"?oe.resolve(a.root):void 0,C=R??oe.dirname(i),O=[],M=(Q)=>{if(Q&&!O.includes(Q))O.push(Q)},N=t.__originalFilePath;if(N)M(oe.join(oe.dirname(N),"components"));M(s),M(a._rootComponentsDir),M(oe.join(oe.dirname(i),"components")),M(a.componentsDir);let I=a._targetComponentFallbackNames?.some((Q)=>Q.toLowerCase()===h.toLowerCase());if(!I)for(let Q of a._targetComponentDirs??[])M(Q);if(R)M(oe.resolve(R,"resources/views/components")),M(oe.resolve(R,"resources/components")),M(oe.resolve(R,"src/components")),M(oe.resolve(R,"components"));for(let Q of a._layerComponentDirs??[])M(Q);let P=a._pluginComponentDirs;if(Array.isArray(P))for(let Q of P)M(typeof Q==="string"?Q:null);if(M(a.fallbackComponentsDir),I)for(let Q of a._targetComponentDirs??[])M(Q);if(h.startsWith("./")||h.startsWith("../"))return n(oe.resolve(oe.dirname(i),`${h}.stx`));let Z=ji(oe.resolve(import.meta.dir,"components")),U=O.map((Q)=>oe.isAbsolute(Q)?Q:oe.resolve(C,Q)),V=`${E.join("\x00")}\x00\x00${U.join("\x00")}`,X=Ws.get(V);if(X!==void 0)return X;let Y=!1;e:for(let Q of U){if(ji(Q)===Z)continue;for(let se of E)if(await n(oe.join(Q,se))){Y=!0;break e}}return Ws.set(V,Y),Y}function ji(e){let s=Fs.get(e);if(s!==void 0)return s;let t=e;try{t=Hs.realpathSync(e)}catch{}return Fs.set(e,t),t}function nu(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Ga(e){if(!e)return!1;let s=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(s)}function fl(e,s,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,h)=>{let c;try{c=_(a,s)}catch{return h}if(c===void 0||c===null)return"";let v=String(c);if(/<\/style/i.test(v))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return v};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,h)=>i(h,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,h)=>i(h,a))}var Ni=new Set;function Li(e,s,t,i){let a=`${e}\x00${s}\x00${i??""}`;if(!process.env.STX_DEBUG&&Ni.has(a))return;Ni.add(a);let h=s?` used in ${s}`:"",c=i?` Cause: ${i}.`:"",v=t.length>0?`
|
|
287
287
|
searched:
|
|
288
288
|
${t.map((E)=>` - ${E}`).join(`
|
|
289
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${v}`)}function
|
|
290
|
-
`)}`}if(t&&ee.includes("{{ text || slot }}"))ee=ee.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:fe}=await r("stx/slots",()=>import("./chunk-
|
|
289
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${h}, so it rendered as nothing.${c}${v}`)}function Bi(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Do(e){let s=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let i of e){let a;while((a=t.exec(i))!==null)s.add(a[1]);t.lastIndex=0}return[...s]}async function Me(e,s,t,i,a,h,c,v=new Set,E,R=Ze(a),C,O=e){let{extractVariables:M}=await r("stx/variable-extractor",()=>import("./chunk-t82be9yf.js")),N=v??new Set;if(N.has(e))return`[Circular component reference: ${e}]`;let I=new Set(N);I.add(e);let P=typeof s.client==="string"?s.client.trim():"";if("client"in s)delete s.client;let Z=P&&P!=="load"&&nu(P)?P:"";try{let U=(re)=>re.split("-").map((ne)=>ne.charAt(0).toUpperCase()+ne.slice(1)).join(""),V=O.endsWith(".stx")?O.slice(0,-4):O,X=null,Y=a.__importedComponents;if(Y){let re=[V,V.toLowerCase(),U(V),j(V)];for(let ne of re)if(Y.has(ne)){X=Y.get(ne);break}}let Q=[];if(!X){let re=[`${V}.stx`,`${U(V)}.stx`,`${j(V)}.stx`],ne=[...new Set(re)],ge=a.__originalFilePath,me=[];if(me.push(...c._layerComponentDirs??[]),ge){let Se=oe.join(oe.dirname(ge),"components");me.push(Se)}if(i)me.push(i);let Ue=c._rootComponentsDir;if(typeof Ue==="string"&&!me.includes(Ue))me.push(Ue);let je=oe.join(oe.dirname(h),"components");if(!me.includes(je))me.push(je);if(c.componentsDir&&c.componentsDir!==i&&!me.includes(c.componentsDir))me.push(c.componentsDir);let it=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(V),bt=(C?.events??[]).map((Se)=>Se.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),ot=Object.hasOwn(s,"checked")||Boolean(C?.reactiveProps?.includes("checked")),yt=Object.hasOwn(s,"value")||Boolean(C?.reactiveProps?.includes("value")),_n=!bt.includes("valuechange")&&(ot||bt.includes("change")&&!yt),wn=c._targetComponentFallbackNames?.some((Se)=>Se.toLowerCase()===V.toLowerCase())&&(!it||_n);for(let Se of wn?[]:c._targetComponentDirs??[])if(Se&&!me.includes(Se))me.push(Se);let Xe=typeof c.root==="string"?oe.resolve(c.root):void 0,Sn=Xe??oe.dirname(h),nt=[];if(Xe)nt.push(oe.resolve(Xe,"resources/views/components")),nt.push(oe.resolve(Xe,"resources/components")),nt.push(oe.resolve(Xe,"src/components")),nt.push(oe.resolve(Xe,"components"));nt.push(oe.resolve(import.meta.dir,"components"));for(let Se of nt)if(!me.includes(Se))me.push(Se);let Vt=c._pluginComponentDirs;if(Array.isArray(Vt)){for(let Se of Vt)if(typeof Se==="string"&&!me.includes(Se))me.push(Se)}if(c.fallbackComponentsDir&&!me.includes(c.fallbackComponentsDir))me.push(c.fallbackComponentsDir);if(wn){for(let Se of c._targetComponentDirs??[])if(Se&&!me.includes(Se))me.push(Se)}let Ut=[...new Set(me.map((Se)=>{if(!Se)return Se;return oe.isAbsolute(Se)?Se:oe.resolve(Sn,Se)}))];me.length=0,me.push(...Ut);let _t=`${V}\x00${h}\x00${Ut.join("\x00")}`,Jn=Vn.get(_t);if(Jn)if(await n(Jn))X=Jn;else Vn.delete(_t);if(!X&&(V.startsWith("./")||V.startsWith("../")))X=oe.resolve(oe.dirname(h),`${V}.stx`),Q.push(X);else if(!X)for(let Se of me){if(!Se)continue;for(let $n of ne){let vn=oe.join(Se,$n);if(Q.push(vn),await n(vn)){X=vn;break}}if(X)break;if(!X)try{let $n=await import("fs");if(!$n.statSync(Se,{throwIfNoEntry:!1})?.isDirectory())continue;let to=8,Gn=[{path:Se,depth:0}];while(Gn.length>0&&!X){let En=Gn.pop();if(En.depth>=to)continue;let Ys;try{Ys=$n.readdirSync(En.path,{withFileTypes:!0})}catch{continue}for(let kn of Ys){if(!kn.isDirectory())continue;if(kn.name==="node_modules"||kn.name.startsWith("."))continue;let Qs=oe.join(En.path,kn.name);for(let no of ne){let Yn=oe.join(Qs,no);if(Q.push(Yn),await n(Yn)){X=Yn;break}}if(X)break;Gn.push({path:Qs,depth:En.depth+1})}}}catch{}if(X)break}if(X)Vn.set(_t,X)}if(!X||!await n(X))return Li(e,h,Q),Bi(e);E.add(X);let se;if(Qt.has(X))se=Qt.get(X);else try{se=await Bun.file(X).text(),Qt.set(X,se)}catch(re){let ne=re instanceof Error?re.message:String(re);return Li(e,h,[X],ne),Bi(e)}if(C)for(let re of new Set([...Object.keys(s),...C.reactiveProps??[]])){let ne=re.toLowerCase();if(ne.startsWith("aria-")||ne.startsWith("data-"))continue;let ge=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${ge}\\b`).test(se))C.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${ge}\\b|\\[\\s*['"]${ge}['"]\\s*\\])`).test(se)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${ge}['"]`).test(se))C.consumedProps?.add(re)}let pe=new Set(["__originalFilePath","__importedComponents",An,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[re,ne]of Object.entries(a))if(!re.startsWith("__")||pe.has(re))Ee[re]=ne;let ke=R.length>0?{[Ln]:[...R]}:{},ze=t;if(t.includes("@include")){let{processIncludes:re}=await r("stx/includes",()=>import("./chunk-f7930sce.js"));ze=await re(t,a,h,c,E)}if(/<[A-Z][\w.-]*[\s/>]/.test(ze)){let{processComponents:re}=await r("stx/component-renderer",()=>import("./chunk-8tpmz4as.js"));ze=await re(ze,{...a,__processedComponents:N,...ke},h,c,E)}let Te=[];if(Ga(ze)){let{processExpressions:re}=await r("stx/expressions",()=>import("./chunk-j5gd0e53.js")),ne=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ke}:R.length>0?{...a,...ke}:a;ze=re(ze,ne,h);for(let ge of ze.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(ge[1].trim())}let He=q(ze),Ge=[],mt=He.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ne)=>{let ge=He.scripts[Number(ne)]||"",me=ge.match(/^<script\b([^>]*)>/i)?.[1]||"",Ue=me.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),je=!Ue||["module","text/javascript","application/javascript"].includes(Ue),it=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${me}`);if(!/\bserver\b/i.test(me)&&je&&!it)return Ge.push(ge),"";return ge}),{extractSlotContent:Kn}=await r("stx/slots",()=>import("./chunk-f3y4fnaa.js")),ct=Kn(mt),lt={};if(ct.defaultSlot?.trim())lt.default=ct.defaultSlot;for(let[re,ne]of ct.namedSlots)lt[re]=ne.content;let ut=a.__stx_scope_seq??={n:0,key:ms(String(a.__filename??h))},Ot=Wi(e,process.cwd()),ft=`stx_${(Ot.endsWith(".stx")?Ot.slice(0,-4):Ot).replace(/[^a-zA-Z0-9]/g,"_")}_${++ut.n}_${ut.key}`,Fe={...Ee,$uid:ft,...s,props:s,slot:mt,$slots:lt,__processedComponents:I,__sections:{},__stx_signals_gate:be(se)||Ga(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};ll(se,Fe);let Mt=se,tn=ie(Mt);if(tn)Mt=tn.content.trim();let Zn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Dt=[...se.matchAll(Zn)];for(let[,re,ne]of Dt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Re(ne,X,c.strict);let Ye=[],jt=null,qn=Dt.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),ht=null,et=null,Lt=null,nn=0,Bt=null;if(nl(c),qn&&Vs>0){let re=sl({props:s,slot:ze,slotContext:t.trim()?rl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,clientLoopNames:[...R].sort(),layers:c._layerGraph?.layers.map((ne)=>ne.configFile),uid:ft});if(re!==null){ht=`${X}\x00${b(se)}\x00${re}`;let ne=Un.get(ht);if(ne){for(let ge of ne.dependencies)E.add(ge);if(Nr(a,ne.clientFactories),ut.n+=ne.uidsConsumed,ne.preservedClientExpressions.length>0){let ge=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let me of ne.preservedClientExpressions)ge.add(me);a.__stx_preserved_client_expressions=[...ge]}return ne.output}et=new Set(E),Lt=Dr(a),nn=ut.n,Bt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let zt=new Set;for(let re of Dt){let ne=re[1]||"",ge=re[2]||"",me=ne.includes("server");if(Ne(ne)&&ge.trim())ge=De(ge);if(me&&ge){for(let je of Pe(ge))zt.add(je);try{await M(ge,Fe,X,{onFailure:(je)=>{if(je.kind!=="unknown")jt=je.kind}})}catch(je){}}if(!me){let je=ge.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),it=je.includes("{{")&&je.includes("}}"),bt=je.includes("{!!")&&je.includes("!!}");if(it||bt)je=Lo(je,Fe,X);let ot=ne.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ye.push(`<script${ot}>${je}</script>`)}}let Ke=q(se).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Wt=Ke?Ke[1]:"",Xn=Ke?Ke[2]:"",tt="",J=Wt&&/\bscoped\b/i.test(Wt);if(Ke)tt=`<style${Wt}>${fl(Xn,Fe,X)}</style>`;let ee=Mt;if(ee=ee.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ke)ee=ee.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ne=[];if(ee=ee.replace(re,(ge,me)=>{let Ue=me.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ue)ne.push(`<style${Ue[1]}>${Ue[2]}</style>`);return""}),ee=ee.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ne.length>0)tt=`${tt}${ne.join(`
|
|
290
|
+
`)}`}if(t&&ee.includes("{{ text || slot }}"))ee=ee.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:fe}=await r("stx/slots",()=>import("./chunk-f3y4fnaa.js")),{defaultSlot:xe,namedSlots:ve}=ct,We=Ye.some((re)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(re)),pt=(re)=>We?pi(re,ft):re,Gs=new Map([...ve].map(([re,ne])=>[re,{...ne,content:pt(ne.content)}]));ee=await fe(ee,pt(xe),Gs,Fe);let hn=Do(Ye),xn=(Array.isArray(Fe.__stx_client_signal_names)?Fe.__stx_client_signal_names:[]).filter((re)=>!zt.has(re));if(hn.length>0||xn.length>0)Fe.__stx_client_signal_names=[...new Set([...xn,...hn])];else delete Fe.__stx_client_signal_names;let Ft=R.filter((re)=>!zt.has(re)&&!(re in s));if(Ft.length>0)Fe[Ln]=Ft;let bn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:oe.dirname(X),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||We||Ye.length===0,defaultLayout:void 0};Fe.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:yn}=await r("stx/process",()=>import("./chunk-zyqs6a3p.js")),st=await yn(ee,Fe,X,bn,E),xt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let re of st.matchAll(/\{\{([\s\S]*?)\}\}/g))xt.add(re[1].trim());if(xt.size>0)a.__stx_preserved_client_expressions=[...xt];let qe=ft,Ve=st;if(We){let re="";if(Object.keys(s).length>0)try{re=` data-stx-props="${Bs(JSON.stringify(s))}"`}catch{}let ne=Z?` stx-hydrate="${Bs(Z)}"`:"",ge=Object.fromEntries(Object.entries(lt).map(([ot,yt])=>[ot,Boolean(yt)])),me=Object.keys(ge).length>0?` data-stx-slots="${Bs(JSON.stringify(ge))}"`:"",Ue=` data-stx-scope="${qe}"${re}${me}${ne}`,je=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(st),it=je?"span":"div";Ve=tu(st,Ue)??`<${it}${Ue} data-stx-component-wrapper${je?' style="display:contents"':""}>${st}</${it}>`;let bt=await Promise.all(Ye.map(async(ot)=>{let yt=ot.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!yt)return ot;let[,_n,wn]=yt,Xe=await gl(wn,X,c.buildMode==="compile"),Sn=dn(Xe.clientCode,Ie(Fe)),{vendorStyleTags:nt}=Xe,Vt=Sn?`function(__scopeId) {
|
|
291
291
|
${Sn}
|
|
292
|
-
return (${
|
|
293
|
-
}`:
|
|
292
|
+
return (${Xe.factoryBody})(__scopeId);
|
|
293
|
+
}`:Xe.factoryBody,Ut=Z?null:_s(a,Vt),_t=Ut?`window.__stxComponentFactories[${JSON.stringify(Ut)}](${JSON.stringify(qe)});`:`(${Vt})(${JSON.stringify(qe)});`;if(Z)return`${nt}<script type="stx/island" data-stx-island="${qe}" data-stx-scoped data-stx-owner="${qe}"${_n}>${_t}</script>`;return`${nt}<script data-stx-scoped data-stx-run="always" data-stx-owner="${qe}"${_n}>${_t}</script>`}));if(Ve=Ve+`
|
|
294
294
|
`+bt.join(`
|
|
295
|
-
`),tt)
|
|
296
|
-
`+tt}else{if(tt)
|
|
297
|
-
`+tt;if(
|
|
295
|
+
`),tt)Ve+=`
|
|
296
|
+
`+tt}else{if(tt)Ve+=`
|
|
297
|
+
`+tt;if(Ye.length>0){let re=Fe.__stx_event_bindings||[],ne=Ie(Fe),ge=await Promise.all(Ye.map(async(me)=>{let Ue=me.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Ue)return me;return await Oe(Ue[1],{eventBindings:re,templateContent:Ve,filePath:X,projectRoot:process.cwd(),serverData:ne,instanceId:ft})}));Ve+=`
|
|
298
298
|
`+ge.join(`
|
|
299
|
-
`),
|
|
300
|
-
${
|
|
301
|
-
`)}`:
|
|
302
|
-
`),v=0;for(let E=0;E<c.length;E++)if(v+=c[E].length+1,v>=s){i=E+1,a=c[E].trim();let R=Math.max(0,E-2),C=Math.min(c.length,E+3);h=c.slice(R,C).map((O,
|
|
303
|
-
`);break}}else if(t){let c=e.indexOf(t);if(c>=0)return Ka(e,c)}}catch{}return{lineNumber:i,lineContent:a,context:h}}var
|
|
299
|
+
`),Fe.__stx_event_bindings=[]}}if(J){let re=us(Ve,X);if(re.hasScoped)Ve=re.html}if(ht&&et){let re=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];Un.set(ht,{output:Ve,dependencies:[...E].filter((ne)=>!et.has(ne)),clientFactories:Lt?jr(a,Lt):[],uidsConsumed:ut.n-nn,preservedClientExpressions:Bt?re.filter((ne)=>!Bt.has(ne)):[]})}if(jt)Ve=`<!--stx-render-failed:${jt}-->${Ve}`;return Ge.length>0?`${Ve}
|
|
300
|
+
${Ge.join(`
|
|
301
|
+
`)}`:Ve}catch(U){if(U instanceof z)throw U;return`[Error processing component: ${U instanceof Error?U.message:String(U)}]`}finally{N.delete(e)}}async function n(e){return Bun.file(e).exists()}function Us(e,s){let t=oe.resolve(s),i=oe.resolve(e),a=t.endsWith(oe.sep)?t:t+oe.sep;if(i===t||i.startsWith(a))return i;return null}async function pl(e,s,t,i){let a=s.startsWith("layouts/")?s.slice(8):s,h=oe.join(e,a);for(let c of h.endsWith(".stx")?[h]:[h,`${h}.stx`])if(await n(c)){if(i)console.log(`Found layout in ${e}: ${c}`);return t?.add(c),c}return null}async function pn(e,s,t,i){let a=await dl(e,s,t,i);if(a===null)return null;let h=Us(a,process.cwd());if(h)return h;let c=[t.root,t.layoutsDir,t.fallbackLayoutsDir,t.componentsDir,t.partialsDir,t.pagesDir,...t._layerLayoutDirs??[]].filter((v)=>typeof v==="string"&&v.length>0);for(let v of c){let E=oe.isAbsolute(v)?v:oe.resolve(process.cwd(),v);if(Us(a,E))return oe.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${s})`),null}async function dl(e,s,t,i){if(t.debug)console.log(`Resolving template path: ${e} from ${s}`);let a=oe.dirname(s),h=process.cwd();if(e.startsWith("/")){let M=oe.join(h,e),N=Us(M,h);if(!N)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${s})`),null;if(t.debug)console.log(`Checking absolute path: ${N}`);if(await n(N)&&i)i.add(N);return N}let c=oe.join(a,e);if(await n(c)){if(t.debug)console.log(`Found direct path: ${c}`);if(i)i.add(c);return c}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let M of[".stx",".tsx",".jsx"]){let N=`${c}${M}`;if(await n(N)){if(t.debug)console.log(`Found direct path with extension: ${N}`);if(i)i.add(N);return N}}let v=[];if(v.push(...t._layerLayoutDirs??[]),t.layoutsDir)v.push(oe.isAbsolute(t.layoutsDir)?t.layoutsDir:oe.resolve(process.cwd(),t.layoutsDir));let E=oe.resolve(a),R=process.cwd();for(let M=0;M<10;M++){let N=oe.join(E,"layouts"),I=!1;try{I=Hs.statSync(N,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(I){v.push(N);break}let P=oe.dirname(E);if(P===E||P.length<R.length)break;E=P}for(let M of v){let N=await pl(M,e,i,t.debug);if(N)return N}if(t.fallbackLayoutsDir){let M=oe.isAbsolute(t.fallbackLayoutsDir)?t.fallbackLayoutsDir:oe.resolve(process.cwd(),t.fallbackLayoutsDir),N=e.startsWith("layouts/")?e.slice(8):e,I=[oe.join(M,N)];if(!e.endsWith(".stx"))I.push(`${I[0]}.stx`);for(let P of I)if(await n(P)){if(t.debug)console.log(`Found in options.fallbackLayoutsDir: ${P}`);if(i)i.add(P);return P}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let M=e.split("layouts/"),N=oe.join(t.partialsDir||a,"layouts",M[1]);if(await n(N)){if(t.debug)console.log(`Found in layouts path: ${N}`);if(i)i.add(N);return N}if(!N.endsWith(".stx")){let I=`${N}.stx`;if(await n(I)){if(t.debug)console.log(`Found in layouts path with extension: ${I}`);if(i)i.add(I);return I}}}if(t.partialsDir){let M=oe.join(t.partialsDir,"layouts");if(await n(M)){let N=oe.join(M,e);if(await n(N)){if(t.debug)console.log(`Found in partials layouts dir: ${N}`);if(i)i.add(N);return N}if(!e.endsWith(".stx")){let I=`${N}.stx`;if(await n(I)){if(t.debug)console.log(`Found in partials layouts dir with extension: ${I}`);if(i)i.add(I);return I}}}}let C=t.partialsDir||oe.join(process.cwd(),"views"),O=oe.join(C,e);if(await n(O)){if(t.debug)console.log(`Found in views path: ${O}`);if(i)i.add(O);return O}if(!e.endsWith(".stx")){let M=`${O}.stx`;if(await n(M)){if(t.debug)console.log(`Found in views path with extension: ${M}`);if(i)i.add(M);return M}}if(a.includes("temp")){let M=oe.join(oe.dirname(a),"layouts",e);if(await n(M)){if(t.debug)console.log(`Found in temp layouts dir: ${M}`);if(i)i.add(M);return M}if(!e.endsWith(".stx")){let N=`${M}.stx`;if(await n(N)){if(t.debug)console.log(`Found in temp layouts dir with extension: ${N}`);if(i)i.add(N);return N}}}if(t.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${s})`);else console.warn(`Template not found: ${e} (referenced from ${s})`);return null}function Ka(e,s,t){let i=0,a="",h="";try{if(typeof s==="number"&&s>=0){let c=e.split(`
|
|
302
|
+
`),v=0;for(let E=0;E<c.length;E++)if(v+=c[E].length+1,v>=s){i=E+1,a=c[E].trim();let R=Math.max(0,E-2),C=Math.min(c.length,E+3);h=c.slice(R,C).map((O,M)=>{let N=R+M+1;return`${N===i?"> ":" "}${N}: ${O}`}).join(`
|
|
303
|
+
`);break}}else if(t){let c=e.indexOf(t);if(c>=0)return Ka(e,c)}}catch{}return{lineNumber:i,lineContent:a,context:h}}var _e={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 g(e,s,t,i,a,h){let{lineNumber:c,context:v}=Ka(i,a,h),E=t.split("/").pop(),R=0;if(typeof a==="number"&&a>=0&&i){let O=i.lastIndexOf(`
|
|
304
304
|
`,Math.max(0,a-1));R=a-(O+1)+1}let C="";if(c>0)C+=`
|
|
305
305
|
${t}:${c}${R>0?`:${R}`:""}: ${e.toLowerCase()} error: ${s}
|
|
306
306
|
`;if(C+=`
|
|
307
|
-
${
|
|
308
|
-
`,C+=`${
|
|
309
|
-
`,C+=`${
|
|
307
|
+
${_e.bold}${_e.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${_e.reset}
|
|
308
|
+
`,C+=`${_e.bold}${_e.red}\u2502${_e.reset} ${_e.bold}${_e.bgRed} ERROR ${_e.reset} ${_e.red}${e} Error${_e.reset}${" ".repeat(Math.max(0,43-e.length))}${_e.bold}${_e.red}\u2502${_e.reset}
|
|
309
|
+
`,C+=`${_e.bold}${_e.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${_e.reset}
|
|
310
310
|
`,C+=`
|
|
311
|
-
${
|
|
312
|
-
${
|
|
311
|
+
${_e.cyan}${_e.bold}File:${_e.reset} ${_e.dim}${E}${_e.reset}`,c>0)C+=` ${_e.gray}(line ${c}${R>0?`, col ${R}`:""})${_e.reset}`;if(C+=`
|
|
312
|
+
${_e.yellow}${_e.bold}Message:${_e.reset} ${s}
|
|
313
313
|
`,v)C+=`
|
|
314
|
-
${
|
|
315
|
-
${
|
|
316
|
-
`;return C}function de(){Qt.clear(),
|
|
317
|
-
${rt("const",[...ic,...I],
|
|
314
|
+
${_e.blue}${_e.bold}Context:${_e.reset}
|
|
315
|
+
${_e.dim}${v}${_e.reset}
|
|
316
|
+
`;return C}function de(){Qt.clear(),Vn.clear(),Ws.clear(),Fs.clear(),Un.clear()}function Rp(){return{size:Qt.size,maxSize:500}}var zs=y(128);async function gl(e,s,t){let i=b(e,s,t),a=zs.get(i);if(a){if(as(a.deps))return a;zs.delete(i)}let h=Io(e,{filePath:s,projectRoot:process.cwd()}),c=h.code,v=Oo(h.styles);c=Pt(c).code;let{hasUserImports:E,bundleClientScript:R}=await r("stx/client-script-bundler",()=>import("./chunk-h15xb2vd.js")),C=[],O=!1;if(E(c)){let V=c;c=await R(V,s,{projectRoot:process.cwd(),minify:t,collectInputs:C}),O=c===V}let{stripStxRuntimeImports:M}=await r("stx/signal-processing",()=>import("./chunk-sszhz1zh.js"));c=M(c);let N=T(c),I=ol(N),P=new Set(L(N,!0).split(",").map((V)=>V.trim())),Z=`function(__scopeId) {
|
|
317
|
+
${rt("const",[...ic,...I],N)}
|
|
318
318
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
319
319
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
320
320
|
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
@@ -366,12 +366,12 @@ ${be.dim}${v}${be.reset}
|
|
|
366
366
|
};
|
|
367
367
|
|
|
368
368
|
try {
|
|
369
|
-
${
|
|
369
|
+
${N}
|
|
370
370
|
|
|
371
371
|
// Register all defined signals and functions in this scope
|
|
372
372
|
const __localVars = {};
|
|
373
373
|
try {
|
|
374
|
-
${I.map((V)=>
|
|
374
|
+
${I.map((V)=>P.has(V)?`Object.defineProperty(__localVars, '${V}', ${ns(V)});`:`if (typeof ${V} !== 'undefined') __localVars['${V}'] = ${V};`).join(`
|
|
375
375
|
`)}
|
|
376
376
|
}
|
|
377
377
|
catch (e) {}
|
|
@@ -383,24 +383,24 @@ finally {
|
|
|
383
383
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
384
384
|
window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
|
|
385
385
|
}
|
|
386
|
-
}`,U={vendorStyleTags:v,factoryBody:Z,clientCode:
|
|
387
|
-
`);for(let a of i){let h=t,c=null,v=!1;for(let E=0;E<a.length;E++){let R=a[E];if(v){v=!1;continue}if(R==="\\"){v=!0;continue}if(c){if(R===c)c=null;continue}if(R==="'"||R==='"'||R==="`"){c=R;continue}if(R==="/"&&E+1<a.length&&a[E+1]==="/")break;if(R==="{")t++;else if(R==="}")t--}if(h===0){let E=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(E)s.push(E[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let R=a.match(/(?:const|let|var)\s+(\w+)/);if(R)s.push(R[1])}else{let R=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(R){let O=R[1].slice(1,-1).split(",").map((
|
|
386
|
+
}`,U={vendorStyleTags:v,factoryBody:Z,clientCode:N,deps:rr([...C,...h.styles.map((V)=>V.resolvedPath)])};if(!O&&h.unresolved.length===0)zs.set(i,U);return U}var un=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];var ml=100,hl=599,Zs="__stxResponseStatus",en="__stxResponseHeaders";function Hn(e){return typeof e==="number"&&Number.isInteger(e)&&e>=ml&&e<=hl}function cn(e){for(let s of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let t=s[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!t)continue;let i=Number(t[1]);if(Hn(i))return i}return}function Ks(e,s){if(!e||typeof e!=="object")return!1;let t=typeof s==="string"&&/^\d+$/.test(s.trim())?Number(s.trim()):s;if(!Hn(t))return!1;return e[Zs]=t,!0}function xl(e,s,t){if(!e||typeof e!=="object")return;let i=String(s??"").trim();if(!i)return;e[en]={...e[en],[i]:String(t)}}function Rt(e){let s=e?.[Zs];return Hn(s)?s:void 0}function At(e){let s=e?.[en];if(!s||typeof s!=="object")return;let t=Object.entries(s).map(([i,a])=>[i,String(a)]);return t.length>0?Object.fromEntries(t):void 0}function Ma(e,s){if(!e||!s||e===s||typeof s!=="object")return;let t=Rt(e);if(t!==void 0)s[Zs]=t;let i=At(e);if(i)s[en]={...s[en],...i}}function ds(e){return{setResponseStatus:(s)=>{Ks(e,s)},notFound:(s=404)=>{let t=Hn(s)&&s>=400?s:404;Ks(e,t)},setResponseHeader:(s,t)=>{xl(e,s,t)}}}function La(e,s,t={}){if(!e.includes("@status"))return e;let{filePath:i,buildMode:a}=t,h=a==="compile",c="",v=0,E=/@status\s*\(/g,R;while((R=E.exec(e))!==null){let C=bl(e,R.index+R[0].length-1);if(C<0)break;let O=e.slice(R.index+R[0].length,C).trim(),M=/^\d+$/.test(O)?Number(O):l(O,s),N=i?` in ${i}`:"";if(h)console.warn(`[stx] @status(${O})${N} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${O}) from <script server> instead \u2014 that runs per request.`);else if(!Ks(s,M))console.warn(`[stx] @status(${O})${N} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(v,R.index),v=C+1+(e.slice(C+1).match(/^[^\S\n]*\n?/)?.[0].length??0),E.lastIndex=v}return v===0?e:c+e.slice(v)}function bl(e,s){let t=1,i=null,a=!1;for(let h=s+1;h<e.length;h++){let c=e[h];if(a){a=!1;continue}if(i){if(c==="\\")a=!0;else if(c===i)i=null;continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="(")t++;else if(c===")"&&--t===0)return h}return-1}var Fi=new Set(un),yl=new Set(["props","$props","defineProps"]),_l=new Set(["stx","@stacksjs/stx"]),Vi=y(128),Ui=y(64);function wl(e){let s=[],t=0,i=e.split(`
|
|
387
|
+
`);for(let a of i){let h=t,c=null,v=!1;for(let E=0;E<a.length;E++){let R=a[E];if(v){v=!1;continue}if(R==="\\"){v=!0;continue}if(c){if(R===c)c=null;continue}if(R==="'"||R==='"'||R==="`"){c=R;continue}if(R==="/"&&E+1<a.length&&a[E+1]==="/")break;if(R==="{")t++;else if(R==="}")t--}if(h===0){let E=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(E)s.push(E[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let R=a.match(/(?:const|let|var)\s+(\w+)/);if(R)s.push(R[1])}else{let R=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(R){let O=R[1].slice(1,-1).split(",").map((M)=>{let N=M.split(":");return(N.length>1?N[1]:N[0]).trim()}).filter((M)=>/^\w+$/.test(M));s.push(...O)}}}}return[...new Set(s)]}function zl(e){let s=e;s=s.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),s=s.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),s=s.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),s=s.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),s=s.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function t(i){if(!i.includes(":"))return i;let a=[],h="",c=0,v=0,E=null;for(let R=0;R<i.length;R++){let C=i[R];if(E){if(h+=C,C===E)E=null;continue}if(C==='"'||C==="'"||C==="`"){E=C,h+=C;continue}if(C==="<")c++;else if(C===">"&&c>0)c--;else if(C==="(")v++;else if(C===")")v--;if(C===","&&c===0&&v===0){a.push(h),h="";continue}h+=C}if(h)a.push(h);return a.map((R)=>{let C=R.trim(),O=C.startsWith("..."),M=O?C.slice(3):C,N=-1,I=0;for(let Q=0;Q<M.length;Q++)if(M[Q]==="<")I++;else if(M[Q]===">")I--;else if(M[Q]===":"&&I===0){N=Q;break}if(N===-1)return R;let Z=M.substring(0,N).trim().replace(/\?$/,""),U=M.substring(N+1),V=-1,X=0;for(let Q=0;Q<U.length;Q++)if(U[Q]==="<")X++;else if(U[Q]===">")X--;else if(U[Q]==="="&&X===0){V=Q;break}let Y=O?"...":"";if(V!==-1)return`${Y}${Z} = ${U.substring(V+1).trim()}`;return`${Y}${Z}`}).join(", ")}s=s.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(i,a,h)=>{if(!h.includes(":"))return i;return`${a}(${t(h)})`});{let i=/\b(function\s+\w*\s*)\(/g,a,h=[];while((a=i.exec(s))!==null){let c=a.index+a[0].length-1,v=1,E=c+1,R=0,C=null;while(E<s.length&&v>0){let N=s[E];if(C){if(N===C)C=null;E++;continue}if(N==='"'||N==="'"||N==="`"){C=N,E++;continue}if(N==="<")R++;else if(N===">"&&R>0)R--;else if(R===0){if(N==="(")v++;else if(N===")")v--}if(v>0)E++}if(v!==0)continue;let O=s.substring(c+1,E);if(!O.includes(":"))continue;let M=t(O);h.push({start:c+1,end:E,replacement:M})}for(let c=h.length-1;c>=0;c--){let{start:v,end:E,replacement:R}=h[c];s=s.substring(0,v)+R+s.substring(E)}}return s=s.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(i,a)=>{if(!a.includes(":"))return i;if(a.includes("{")||a.includes("}"))return i;return`(${a.split(",").map((c)=>{let[v,...E]=c.split("="),R=v.split(":")[0].trim();if(E.length>0)return`${R} = ${E.join("=").trim()}`;return R}).join(", ")}) =>`}),s=s.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),s=s.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),s=s.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),s=s.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),s=s.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),s=s.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),s=s.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),s=s.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),s=s.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),s=s.replace(/\n\s*\n\s*\n/g,`
|
|
388
388
|
|
|
389
|
-
`),s}function Hl(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(s,...t)=>{let[,i,a]=t,h=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(h)?"":s})}function Vl(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function Ul(e){if(e instanceof SyntaxError)return!0;let s=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(s)}function Wl(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
|
|
390
|
-
`),xn=s.params??{},Ft=[],bn=[];for(let ne=0;ne<fe.length;ne++){if(fe[ne]==="params")continue;Ft.push(fe[ne]),bn.push(xe[ne])}let yn=[...un,...
|
|
389
|
+
`),s}function Hl(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(s,...t)=>{let[,i,a]=t,h=i??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(h)?"":s})}function Vl(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function Ul(e){if(e instanceof SyntaxError)return!0;let s=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(s)}function Wl(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 Hi=new Set;async function f(e,s,t,i={}){if(!e.trim())return;let a=S(),h=b(e,JSON.stringify(a)),c=Vi.get(h);if(c===void 0){try{let J=G({loader:"ts",target:"browser",define:a}),ee=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ee=ee.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=J.transformSync(ee)}catch{c=zl(e)}Vi.set(h,c)}let v={exports:{}},E=v.exports,R=kt.cwd(),C={},O=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((J)=>J[1]).filter((J)=>!J.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(J)),M=new Map;for(let J of O)try{if(J.startsWith(".")){C[J]=await import(Je.resolve(Je.dirname(t),J));continue}let ee=Je.resolve(R,"node_modules",J),fe=Je.join(ee,"package.json"),xe=JSON.parse(p("fs").readFileSync(fe,"utf8")),ve=xe.main||"index.js";if(xe.exports){let We=typeof xe.exports==="string"?xe.exports:xe.exports["."];if(typeof We==="string")ve=We;else if(We?.bun)ve=We.bun;else if(We?.import)ve=We.import;else if(We?.default)ve=We.default}C[J]=await import(Je.resolve(ee,ve))}catch(ee){if(J.startsWith("."))M.set(J,ee instanceof Error?ee.message:String(ee))}let N=(J)=>{if(C[J])return C[J];let ee=M.get(J);if(ee!==void 0)throw Error(`Cannot require '${J}' from ${t}: ${ee}`);return p(J)},I=s.props||{},P=(J)=>{if(!J)return I;let ee={};for(let[fe,xe]of Object.entries(J)){let ve=I[fe];if(ve!==void 0)ee[fe]=ve;else if(typeof xe==="function")ee[fe]=xe();else ee[fe]=xe}return ee};for(let[J,ee]of Object.entries(I))Object.defineProperty(P,J,{value:ee,enumerable:!0,configurable:!0,writable:!0});let Z=(J,ee=!1)=>{if(J===void 0||J===null)return ee;if(typeof J==="string"){let fe=J.trim().toLowerCase();if(fe===""||fe==="true"||fe==="1"||fe==="on"||fe==="yes")return!0;if(fe==="false"||fe==="0"||fe==="off"||fe==="no")return!1;return!0}return Boolean(J)},U=(J,ee=0)=>{if(J===void 0||J===null)return ee;if(typeof J==="string"){let xe=J.trim();if(xe==="")return ee;let ve=Number(xe);return Number.isFinite(ve)?ve:ee}let fe=Number(J);return Number.isFinite(fe)?fe:ee};for(let J of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(I,J))continue;try{Object.defineProperty(P,J,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let V=(J)=>{if(!J)return I;let ee={...I};for(let[fe,xe]of Object.entries(J)){let ve=xe&&typeof xe==="object"&&!Array.isArray(xe)?xe:{type:xe};if(ee[fe]===void 0&&ve.default!==void 0)ee[fe]=typeof ve.default==="function"?ve.default():ve.default}return ee},X=()=>s.slots||{},Y=(J,ee)=>{let fe={...J};for(let[xe,ve]of Object.entries(ee))if(fe[xe]===void 0)if(typeof ve==="function")fe[xe]=ve();else fe[xe]=ve;return fe},Q=(J)=>{let ee=()=>J;return ee.set=(fe)=>{},ee.update=(fe)=>{},ee},se=(J)=>{let ee,fe=!1;return()=>{if(!fe)try{ee=J(),fe=!0}catch{ee=void 0}return ee}},pe=(J)=>{},Ee=(J)=>J(),ke=(J)=>{},ze=(J)=>{},Te=ds(s);function He(J){let ee=J||{};if(ee.title!==void 0||ee.description!==void 0)lt({title:ee.title,description:ee.description})}function Ge(J){if(!J||typeof J!=="object")return;let ee=s.__stxClientPayload??{};Object.assign(ee,J),s.__stxClientPayload=ee}let mt=()=>{let J=s.__stxServeContext,ee=s.__stxServeSearch??J?.search??"",fe=J?.path??"",xe=Object.fromEntries(new URLSearchParams(ee)),ve=s.query,We=Object.keys(xe).length>0?xe:ve??{},pt=ee||(Object.keys(We).length>0?`?${new URLSearchParams(We).toString()}`:"");return{params:s.params??{},query:We,path:fe,name:"",fullPath:fe+pt,hash:"",matched:[]}},Kn=()=>({push:(J)=>{},replace:(J)=>{},back:()=>{},forward:()=>{},go:(J)=>{}}),ct=(J)=>{let ee=s.__stx_runtime_head||{};s.__stx_runtime_head=Be(ee,we(J||{},{known:Ss,source:"useHead()"}))},lt=(J)=>{ct(ks(J||{}))},ut=(J)=>({value:J}),Ot=(J)=>J,Xs=(J)=>({value:typeof J==="function"?J():J}),ft=(J,ee)=>{},Fe=(J)=>{},Mt=(J)=>{},tn=(J)=>J?J():Promise.resolve(),Zn=(J)=>(ee,...fe)=>{},Dt=(J)=>{},Ye=(J,ee)=>{},jt=(J,ee)=>ee,qn=()=>({value:"light"}),ht=()=>Q(!1),et=(J)=>Q(!1),Lt=()=>Q(!1),nn=()=>et("(prefers-color-scheme: dark)"),Bt=()=>et("(prefers-color-scheme: light)"),zt=()=>et("(prefers-reduced-motion: reduce)"),Js=()=>et("(prefers-contrast: more)"),Ke={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},Wt=new Proxy(Ke,{get(J,ee){if(ee in J)return J[ee];return},set(J,ee,fe){return J[ee]=fe,!0}}),Xn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},tt=console;try{let J=Po(c,t),ee=new Set(Object.keys(I)),fe=Object.keys(s).filter((ne)=>!ee.has(ne)&&!yl.has(ne)&&Nt(ne)),xe=fe.map((ne)=>s[ne]);if(!fe.includes("__stxServeContext"))fe.push("__stxServeContext"),xe.push(void 0);if(!ee.has("cookies")){let ne=s.cookies??s.__stxServeContext?.cookies??{},ge=fe.indexOf("cookies");if(ge<0)fe.push("cookies"),xe.push(ne);else xe[ge]=ne}let ve=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),We=[],pt=[];for(let[ne,ge]of Object.entries(I)){if(!Nt(ne))continue;if(ve.has(ne))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ne}\\b`).test(J))continue;We.push(ne),pt.push(ge)}let hn=wl(J).map((ne)=>`module.exports.${ne} = typeof ${ne} !== 'undefined' ? ${ne} : module.exports.${ne};`).join(`
|
|
390
|
+
`),xn=s.params??{},Ft=[],bn=[];for(let ne=0;ne<fe.length;ne++){if(fe[ne]==="params")continue;Ft.push(fe[ne]),bn.push(xe[ne])}let yn=[...un,...We,...Ft],st=`return (async () => {
|
|
391
391
|
${J}
|
|
392
392
|
${hn}
|
|
393
393
|
return module.exports
|
|
394
|
-
})()`,xt=b(st,yn.join("\x00")),
|
|
395
|
-
`),h=[],c=0;while(c<a.length){let v=a[c].trim();if(v.startsWith("interface ")||v.startsWith("export interface ")||v.startsWith("type ")||v.startsWith("export type ")){if(v.includes("{")&&!v.includes("}")){let E=0;for(;c<a.length;c++){for(let R of a[c])if(R==="{")E++;else if(R==="}")E--;if(E<=0)break}}c++;continue}if(v.startsWith("definePageMeta(")){let E=0,R=!1,C=c;for(let
|
|
396
|
-
`),
|
|
397
|
-
`+
|
|
398
|
-
`),t,i)}function
|
|
399
|
-
`)v=!1;h++;continue}if(E){if(a+=C,C==="*"&&O==="/"){a+=O,h+=2,E=!1;continue}h++;continue}if(!c&&C==="/"&&O==="/"){v=!0,a+=C,h++;continue}if(!c&&C==="/"&&O==="*"){E=!0,a+=C,h++;continue}if(c){if(a+=C,C==="\\"){a+=O,h+=2;continue}if(C===c&&c!=="`"){c=null,h++;continue}if(c==="`"){if(C==="$"&&O==="{"){R++,a+=O,h+=2;continue}if(C==="`"){c=null,h++;continue}}h++;continue}if(R>0){if(C==="{")R++;else if(C==="}")R--}if(C==='"'||C==="'"||C==="`"){c=C,a+=C,h++;continue}if(C==="a"&&e.startsWith("await",h)){let
|
|
400
|
-
`);return{type:I,name:Q,value:`${V}; ${I} ${
|
|
401
|
-
${se}`,nextIndex:X}}}}throw Error(`Failed to parse variable declaration: ${t}`)}let[,h,c,v]=a,E=v,R=s;if(
|
|
402
|
-
${e[R]}`,R++;else break}return E=E.trim().replace(/;$/,""),{type:h,name:c,value:E,nextIndex:R}}function
|
|
394
|
+
})()`,xt=b(st,yn.join("\x00")),qe=Ui.get(xt);if(!qe)qe=Function(...yn,st),Ui.set(xt,qe);let Ve=s.__stx_options?.runtimeConfig;if(Ve||/\buse(?:Server)?RuntimeConfig\b/.test(c))await gn(s,t,Ve);let re=await Le(s.__stx_runtime_config??mn()??A(),()=>tr(s,()=>qe(v,E,N,I,P,Z,U,V,Y,Ge,nr,Bo,ys,Q,se,pe,Ee,ke,ze,He,mt,Kn,ct,lt,Te.setResponseStatus,Te.setResponseHeader,Te.notFound,ut,Ot,Xs,ft,Fe,Mt,tn,Zn,Dt,X,Ye,jt,qn,ht,et,Lt,nn,Bt,zt,Js,Wt,Xn,tt,Ke.confirm,Ke.alert,Ke.fetch,xn,...pt,...bn)));if(i.preserveExisting){for(let[ne,ge]of Object.entries(re))if(!(ne in s)||s[ne]===void 0)s[ne]=ge}else Object.assign(s,re);for(let[ne,ge]of Object.entries(I))if(!(ne in s))s[ne]=ge}catch(J){if(s.__stx_strict_hydration)throw J;let ee=Hl(J instanceof Error?J.message:String(J));if(Vl(ee))console.warn(`[stx] server <script> in ${t??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ee}`),i.onFailure?.({kind:"module-resolution",message:ee,error:J});else if(Ul(J))console.warn(`[stx] server <script> in ${t??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ee}`),i.onFailure?.({kind:"syntax",message:ee,error:J});else if(Wl(ee))console.warn(`[stx] server <script> in ${t??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${ee}`),i.onFailure?.({kind:"missing-binding",message:ee,error:J});else{let fe=`${t??"<unknown>"}\x00${ee}`;if(kt.env.STX_DEBUG||!Hi.has(fe))Hi.add(fe),console.warn(`[stx] server <script> in ${t??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ee}`);i.onFailure?.({kind:"unknown",message:ee,error:J})}try{await Rl(c,s,t)}catch(fe){if(kt.env.STX_DEBUG){let xe=fe instanceof Error?fe.message:String(fe);console.warn(`[stx] fallback extraction also failed in ${t??"<unknown>"}: ${xe}`)}}}}function ql(e){let s=0,t=null,i=!1,a=!1;for(let h=0;h<e.length;h++){let c=e[h];if(t){if(c===t){if(t=null,i||s===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){t=c;continue}if(c==="{")s++;else if(c==="}")s--;else if(e.startsWith("from",h)&&s===0)i=!0}return t===null&&s===0&&a}var Sl=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Po(e,s){let t=s?Je.dirname(s):kt.cwd(),i=kt.cwd(),a=e.split(`
|
|
395
|
+
`),h=[],c=0;while(c<a.length){let v=a[c].trim();if(v.startsWith("interface ")||v.startsWith("export interface ")||v.startsWith("type ")||v.startsWith("export type ")){if(v.includes("{")&&!v.includes("}")){let E=0;for(;c<a.length;c++){for(let R of a[c])if(R==="{")E++;else if(R==="}")E--;if(E<=0)break}}c++;continue}if(v.startsWith("definePageMeta(")){let E=0,R=!1,C=c;for(let N=c;N<a.length&&!R;N++){let I=null,P=!1,Z=a[N];for(let U=0;U<Z.length;U++){let V=Z[U];if(P){P=!1;continue}if(V==="\\"){P=!0;continue}if(I){if(V===I)I=null;continue}if(V==='"'||V==="'"||V==="`"){I=V;continue}if(V==="(")E++;else if(V===")"){if(E--,E===0){c=N+1,R=!0;break}}}}if(!R)c=a.length;let O=a.slice(C,c).join(`
|
|
396
|
+
`),M=[];for(let N of["title","description"]){let I=new RegExp(`\\b${N}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(O);if(I)M.push(`${N}: ${JSON.stringify(I[2])}`)}if(M.length>0)h.push(`useSeoMeta({ ${M.join(", ")} });`);continue}if(v.startsWith("import ")||v==="import"||v.startsWith("import{")||/^import['"]/.test(v)){let E=v,R=0;while(!ql(E)&&c+R+1<a.length)R++,E=`${E} ${a[c+R].trim()}`;c+=R;let C=E.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),O=E.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),M=E.match(/^import\s*['"](.+?)['"]/),N=E,I=(P)=>{if(P.startsWith("."))return Je.resolve(t,P);if(P.startsWith("~/")||P.startsWith("@/"))return Je.resolve(i,P.slice(2));try{return Bun.resolveSync(P,t)}catch{return P}};if(C){let[,P,Z]=C,U=I(Z);h.push(`const ${P} = (await import('${U}')).default`),h.push(`module.exports.${P} = ${P};`)}else if(O){let[,P,Z]=O,U=I(Z),V=[],X=[],Y=_l.has(Z);for(let Q of P.split(",")){let se=Q.trim();if(!se)continue;let pe=se.split(/\s+as\s+/);if(pe.length===2){let[Ee,ke]=[pe[0].trim(),pe[1].trim()];if(Y&&Fi.has(Ee)){h.push(`const ${ke} = ${Ee};`);continue}V.push(`${Ee}: ${ke}`),X.push(ke)}else{if(Y&&Fi.has(se))continue;V.push(se),X.push(se)}}if(V.length>0)h.push(`const { ${V.join(", ")} } = await import('${U}')`);for(let Q of X)h.push(`module.exports.${Q} = ${Q};`)}else if(M){let P=I(M[1]);h.push(`await import('${P}')`)}else h.push(N);c++;continue}if(Sl.test(v))h.push(a[c]),c++;else if(v.startsWith("export const ")||v.startsWith("export let ")||v.startsWith("export var ")){let E=Zi(a,c),{type:R,name:C,value:O}=E;h.push(`${R} ${C} = ${O};`),h.push(`module.exports.${C} = ${C};`),c=E.nextIndex}else if(v.startsWith("export function ")||v.startsWith("export async function ")){let E=qs(a,c);h.push(E.functionCode),h.push(`module.exports.${E.name} = ${E.name};`),c=E.nextIndex}else if(v.startsWith("const ")||v.startsWith("let ")||v.startsWith("var ")){let E=Zi(a,c),{type:R,name:C,value:O}=E;h.push(`${R} ${C} = ${O};`),h.push(`module.exports.${C} = ${C};`),c=E.nextIndex}else if(v.startsWith("function ")||v.startsWith("async function ")){let E=qs(a,c);h.push(E.functionCode),h.push(`module.exports.${E.name} = ${E.name};`),c=E.nextIndex}else if(v.startsWith("export default function ")||v.startsWith("export default async function ")){let E=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),R=[...a];R[c]=E;let C=qs(R,c);if(h.push(C.functionCode),C.name)h.push(`module.exports.default = ${C.name};`);c=C.nextIndex}else if(v.startsWith("export default ")){let E=v.replace(/^export\s+default\s+/,"").replace(/;$/,"");h.push(`module.exports.default = ${E};`),c++}else if(v.startsWith("class ")||v.startsWith("export class ")){let E=v.match(/(?:export\s+)?class\s+(\w+)/);if(E){let R=E[1],C=a[c].replace(/^export\s+/,""),O=0,M=c;for(;M<a.length;M++){let N=a[M];for(let I of N)if(I==="{")O++;else if(I==="}")O--;if(M>c)C+=`
|
|
397
|
+
`+N;if(O<=0&&M>=c)break}h.push(C),h.push(`module.exports.${R} = ${R};`),c=M+1}else h.push(v),c++}else if(v.includes("module.exports"))h.push(v),c++;else if(v.trim()&&!v.startsWith("//"))h.push(v),c++;else c++}return $l(h.join(`
|
|
398
|
+
`),t,i)}function $l(e,s,t){let i=e.length,a="",h=0,c=null,v=!1,E=!1,R=0;while(h<i){let C=e[h],O=e[h+1];if(v){if(a+=C,C===`
|
|
399
|
+
`)v=!1;h++;continue}if(E){if(a+=C,C==="*"&&O==="/"){a+=O,h+=2,E=!1;continue}h++;continue}if(!c&&C==="/"&&O==="/"){v=!0,a+=C,h++;continue}if(!c&&C==="/"&&O==="*"){E=!0,a+=C,h++;continue}if(c){if(a+=C,C==="\\"){a+=O,h+=2;continue}if(C===c&&c!=="`"){c=null,h++;continue}if(c==="`"){if(C==="$"&&O==="{"){R++,a+=O,h+=2;continue}if(C==="`"){c=null,h++;continue}}h++;continue}if(R>0){if(C==="{")R++;else if(C==="}")R--}if(C==='"'||C==="'"||C==="`"){c=C,a+=C,h++;continue}if(C==="a"&&e.startsWith("await",h)){let M=vl(e,h);if(M){let{quote:N,path:I,end:P}=M;if(I.startsWith(".")||I.startsWith("~/")||I.startsWith("@/")){let Z=I.startsWith(".")?Je.resolve(s,I):Je.resolve(t,I.slice(2));a+=`await import(${N}${Z}${N})`,h=P;continue}}}a+=C,h++}return a}function vl(e,s){let t=s+5;if(t>=e.length)return null;if(!/\s/.test(e[t]))return null;while(t<e.length&&/\s/.test(e[t]))t++;if(!e.startsWith("import",t))return null;t+=6;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!=="(")return null;t++;while(t<e.length&&/\s/.test(e[t]))t++;let i=e[t];if(i!=="'"&&i!=='"')return null;t++;let a=t;while(t<e.length&&e[t]!==i)if(e[t]==="\\")t+=2;else t++;if(t>=e.length)return null;let h=e.slice(a,t);t++;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!==")")return null;return{quote:i,path:h,end:t+1}}function Gi(e,s){let t=e[s];if(t!=="{"&&t!=="[")return null;let a=w(e,t,t==="{"?"}":"]",s);if(a===-1)return null;return{pattern:e.slice(s,a+1),endPos:a+1}}function Yi(e){let s=[],t=e.slice(1,-1).trim();if(!t)return s;let i=0,a=0,h="";while(i<t.length){let c=t[i];if(c==="{"||c==="["){let v=a===0?Gi(t,i):null;if(v){s.push(...Yi(v.pattern)),i=v.endPos,h="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){i++;continue}if(c===","){if(h.trim())s.push(h.trim());h="",i++;continue}if(c===":"){h="",i++;continue}if(c==="="){if(h.trim())s.push(h.trim());h="",i++;while(i<t.length&&t[i]!==","&&a===0){if(t[i]==="{"||t[i]==="[")a++;else if(t[i]==="}"||t[i]==="]")a--;i++}continue}if(/[\w$]/.test(c))h+=c;i++}if(h.trim())s.push(h.trim());return s}function Gl(e){let s=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!s)return null;let t=s[0].length,i=(a)=>a===" "||a==="\t";while(t<e.length&&i(e[t]))t++;if(e[t]===":"){let a=0,h=null;t++;for(;t<e.length;t++){let c=e[t];if(h){if(c==="\\"){t++;continue}if(c===h)h=null;continue}if(c==="'"||c==='"'||c==="`"){h=c;continue}if(c==="("||c==="["||c==="{"||c==="<"){a++;continue}if(c===")"||c==="]"||c==="}"||c===">"){a--;continue}if(c==="="&&a<=0){let v=e[t+1],E=e[t-1];if(v!=="="&&v!==">"&&E!=="="&&E!=="!"&&E!=="<"&&E!==">")break}}if(e[t]!=="=")return null}while(t<e.length&&i(e[t]))t++;if(e[t]!=="=")return null;return{type:s[1],name:s[2],value:e.slice(t+1).trim()}}function Ki(e,s,t,i){let a=null,h=!1;for(let c of e){if(h){h=!1;continue}if(c==="\\"){h=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c===s)i++;else if(c===t)i--}return i}function Zi(e,s){let t=e[s].trim(),i=Gl(t),a=i?[t,i.type,i.name,i.value]:null;if(!a){let C=t.match(/^(?:export\s+)?(const|let|var)\s+/);if(C){let O=t.slice(C[0].length),M=s;if(O.startsWith("{")||O.startsWith("[")){let I=O[0],P=I==="{"?"}":"]",Z=Ki(O,I,P,0),U=O;for(let V=s+1;V<e.length&&Z>0;V++)U+=` ${e[V].trim()}`,M=V,Z=Ki(e[V],I,P,Z);if(Z>0)U=O,M=s;O=U}let N=Gi(O,0);if(N){let I=C[1],P=N.pattern,Z=O.slice(N.endPos).trim();if(Z.startsWith("=")){let U=Z.slice(1).trim(),V=U,X=Math.max(M,s);if(qi(U)){let pe=Xi(e,X,U);V=pe.value,X=pe.nextIndex}else X=X+1;V=V.trim().replace(/;$/,"");let Y=Yi(P),Q=`__stx_src_${s}`,se=Y.map((pe)=>`module.exports.${pe} = ${pe};`).join(`
|
|
400
|
+
`);return{type:I,name:Q,value:`${V}; ${I} ${P} = ${Q};
|
|
401
|
+
${se}`,nextIndex:X}}}}throw Error(`Failed to parse variable declaration: ${t}`)}let[,h,c,v]=a,E=v,R=s;if(qi(v)){let C=Xi(e,s,v);E=C.value,R=C.nextIndex}else R=s+1;while(R<e.length){let C=e[R].trim();if(C.startsWith(".")||C.startsWith("?."))E+=`
|
|
402
|
+
${e[R]}`,R++;else break}return E=E.trim().replace(/;$/,""),{type:h,name:c,value:E,nextIndex:R}}function qs(e,s){let t=e[s].trim(),i=t.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!i)throw Error(`Failed to parse function declaration: ${t}`);let[,a]=i,h=t.replace(/^export\s+/,""),c=s;if(El(t)){let v=kl(e,s,h);h=v.functionCode,c=v.nextIndex}else c=s+1;return{name:a,functionCode:h,nextIndex:c}}function qi(e){let s=e.trim();if(s.startsWith("{"))return w(s,"{","}",0)===-1;if(s.startsWith("["))return w(s,"[","]",0)===-1;return!Qi(s)}function Qi(e){let s={paren:0,bracket:0,brace:0},t=null,i=0;for(let a=0;a<e.length;a++){let h=e[a];if((a>0?e[a-1]:"")==="\\"&&t)continue;if((h==='"'||h==="'")&&!t){t=h;continue}if(h===t&&t!=="`"){t=null;continue}if(h==="`"&&!t){t="`";continue}if(h==="`"&&t==="`"&&i===0){t=null;continue}if(t==="`"&&h==="$"&&e[a+1]==="{"){i++,a++;continue}if(i>0&&h==="{"){i++;continue}if(i>0&&h==="}"){i--;continue}if(t)continue;if(h==="(")s.paren++;else if(h===")")s.paren--;else if(h==="[")s.bracket++;else if(h==="]")s.bracket--;else if(h==="{")s.brace++;else if(h==="}")s.brace--}return s.paren===0&&s.bracket===0&&s.brace===0&&t===null}function eo(e){let s=e.indexOf("(");if(s===-1)return e.indexOf("{");let t=w(e,"(",")",s);if(t===-1)return-1;return e.indexOf("{",t)}function El(e){let s=eo(e);if(s===-1)return!0;return w(e,"{","}",s)===-1}function Xi(e,s,t){let i=t,a=s+1;while(a<e.length&&!Qi(i)){let h=e[a];i+=`
|
|
403
403
|
${h}`,a++}while(a<e.length){let h=e[a].trim();if(h.startsWith(".")||h.startsWith("?."))i+=`
|
|
404
|
-
${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function
|
|
405
|
-
${c}`,a++}return{functionCode:i,nextIndex:a}}function
|
|
406
|
-
export{
|
|
404
|
+
${e[a]}`,a++;else break}return{value:i,nextIndex:a}}function kl(e,s,t){let i=t,a=s+1;while(a<e.length){let h=eo(i);if(h!==-1){if(w(i,"{","}",h)!==-1)break}let c=e[a];i+=`
|
|
405
|
+
${c}`,a++}return{functionCode:i,nextIndex:a}}function Ji(e,s){let t=l(e,s)??l(`(${e})`,s);if(t!==void 0)return t;if(!/\bprocess\b/.test(e))return;let i={...s,process:Object.freeze({env:{...kt.env}})},a=Object.keys(i).filter(Nt),h=a.map((c)=>i[c]);try{return Function(...a,`'use strict'; return (${e});`)(...h)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...h)}catch{return}}}async function Rl(e,s,t){let i=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let h of i){let[,,c,v]=h;try{let E=v.trim().replace(/;$/,""),R=Ji(E,s);if(R!==void 0)s[c]=R}catch(E){console.warn(`Failed to parse export ${c} in fallback:`,E)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let h of a){let[,,c,v]=h;if(!(c in s))try{let E=v.trim().replace(/;$/,""),R=Ji(E,s);if(R!==void 0)s[c]=R}catch{}}}function Va(e){let s=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),t=s?s[1]:"",i=s?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:t,templateWithoutScript:i}}function Ua(e){let s=e.trim();if(!s)return!1;return/(?:const|let|var|function)\s+\w+/.test(s)}
|
|
406
|
+
export{$e,he,L,ns,rs,j,ss,os,is,So,ko,_o,Ea,rn,r,sn,B,Ct,te,y,Ta,b,rr,as,ye,S,Re,ie,sr,W,on,Ae,ae,$a,ce,q,or,cs,le,Et,Tt,ue,Ze,ir,ar,$t,Co,Eo,Fl,Pe,Ra,Aa,Pa,To,Ia,ls,$o,Oa,Na,Da,Ro,an,us,cn,Rt,At,Ma,ds,La,ln,cr,ps,gs,ja,Ao,Ba,Fa,za,Ha,un,zl,Hl,Vl,Ul,Wl,f,ql,Po,Gl,Va,Ua,Io,Oo,Kl,Pt,Wa,No,qa,$p,Ie,dn,Oe,Xl,Jl,Yl,Zl,Ql,ms,eu,Ne,G,De,tu,lr,nu,Ga,Do,Me,n,pn,Ka,g,de,Rp,Xa,Ja,Ya,Mo,hs,ru,Ap,su,Pp,It,m,F,K,fn,be,ou,Lo,iu,Ip,k,au,Op,_,Np};
|