@stacksjs/stx 0.2.220 → 0.2.222
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-08031d2g.js → chunk-24271vkv.js} +1 -1
- package/dist/chunk-2gwfcgct.js +2 -0
- package/dist/{chunk-x0f34a44.js → chunk-409jrxj6.js} +1 -1
- package/dist/chunk-4a01b3qp.js +2 -0
- package/dist/{chunk-mcz70xms.js → chunk-4thj960e.js} +1 -1
- package/dist/{chunk-5a5efazd.js → chunk-53d24qhh.js} +1 -1
- package/dist/{chunk-20wgmax7.js → chunk-749d2abw.js} +1 -1
- package/dist/{chunk-e890s5em.js → chunk-7cqda8w2.js} +1 -1
- package/dist/{chunk-bj25jvsn.js → chunk-7ggk2vmy.js} +1 -1
- package/dist/{chunk-7x3nd6r4.js → chunk-7tzyw85k.js} +1 -1
- package/dist/{chunk-3zhhytkd.js → chunk-85yfwhdx.js} +1 -1
- package/dist/{chunk-qfsktf7s.js → chunk-8j2v2hnc.js} +1 -1
- package/dist/{chunk-q5w0fqd5.js → chunk-8rgd1mn9.js} +1 -1
- package/dist/{chunk-g3rg8afc.js → chunk-98a8ma06.js} +1 -1
- package/dist/{chunk-6sm1vr9h.js → chunk-ansvb340.js} +1 -1
- package/dist/{chunk-4svjne4w.js → chunk-bg595da5.js} +1 -1
- package/dist/{chunk-ejspksxd.js → chunk-bhz0py78.js} +1 -1
- package/dist/{chunk-tgaddq21.js → chunk-cc6b6cvn.js} +1 -1
- package/dist/{chunk-xqnwy1t6.js → chunk-ceqzwfcq.js} +1 -1
- package/dist/{chunk-6qjzx44j.js → chunk-dbvvgvwk.js} +2 -2
- package/dist/{chunk-fw5d1aev.js → chunk-egpmwqas.js} +2 -2
- package/dist/{chunk-38zpyb7q.js → chunk-epep418h.js} +1 -1
- package/dist/{chunk-2y8ss8b3.js → chunk-etnqfdcj.js} +1 -1
- package/dist/{chunk-5y731xe9.js → chunk-fm03jwb1.js} +1 -1
- package/dist/chunk-fqrfhf6n.js +2 -0
- package/dist/{chunk-zpskp2xb.js → chunk-ftdysk1n.js} +1 -1
- package/dist/{chunk-zh75hc6a.js → chunk-gyf7n2as.js} +1 -1
- package/dist/chunk-hzj77qay.js +2 -0
- package/dist/{chunk-4wdbmjmg.js → chunk-j51tsstz.js} +1 -1
- package/dist/{chunk-rmrnnv87.js → chunk-j8dg655g.js} +1 -1
- package/dist/{chunk-cw0352e8.js → chunk-jvxc59g1.js} +1 -1
- package/dist/{chunk-kdpy5rgk.js → chunk-kwpvv59c.js} +24 -5
- package/dist/{chunk-bgb5a3q6.js → chunk-m86nzprx.js} +1 -1
- package/dist/{chunk-5fz9n4wq.js → chunk-m8kn995q.js} +1 -1
- package/dist/{chunk-pzcf36xm.js → chunk-pbyxj0zr.js} +16 -16
- package/dist/{chunk-pscdy0gn.js → chunk-pd8cce9a.js} +9 -9
- package/dist/{chunk-1y3kc7mb.js → chunk-qpm1px64.js} +1 -1
- package/dist/{chunk-7cq5b6zp.js → chunk-rmyrzcac.js} +1 -1
- package/dist/chunk-s0perkbz.js +2 -0
- package/dist/{chunk-rq20qvkk.js → chunk-s8x2n1p6.js} +1 -1
- package/dist/{chunk-anenwsj3.js → chunk-szw6at2m.js} +1 -1
- package/dist/{chunk-7s3wrtpb.js → chunk-td2et1ek.js} +1 -1
- package/dist/{chunk-a4329ma8.js → chunk-yf4p02wy.js} +1 -1
- package/dist/{chunk-n1b7b20f.js → chunk-zztd93sa.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-25jkkv9d.js +0 -2
- package/dist/chunk-9ktvkzcc.js +0 -2
- package/dist/chunk-tc2d9en8.js +0 -2
- package/dist/chunk-th7snpq2.js +0 -2
- package/dist/chunk-yk45219d.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{hs as c2,rs as O6,ss as F6}from"./chunk-kvz7rg2x.js";import{xs as p0}from"./chunk-6b0xz02h.js";import{Cs as c5}from"./chunk-135mme4g.js";import{Ws as i2}from"./chunk-
|
|
2
|
+
import{hs as c2,rs as O6,ss as F6}from"./chunk-kvz7rg2x.js";import{xs as p0}from"./chunk-6b0xz02h.js";import{Cs as c5}from"./chunk-135mme4g.js";import{Ws as i2}from"./chunk-8j2v2hnc.js";import{Xs as L6,Zs as w6,_s as R6,at as _5}from"./chunk-80qre9zp.js";import{bt as n2,ft as t5,ht as Z8}from"./chunk-z794cdmn.js";import{st as s2}from"./chunk-dykhpgyx.js";import{At as S2,tt as j8,ut as W8,vt as c1,wt as _8,xt as f4,yt as X2,zt as L9}from"./chunk-ry86fd41.js";import{Jt as a3,Mt as l9,Tt as l3,iu as p2,ku as JG,lu as p$,nu as W5}from"./chunk-kwpvv59c.js";import{su as D6}from"./chunk-x0bcc9sj.js";import{xu as u}from"./chunk-8rn5e39c.js";import b1 from"path";import k5 from"fs";var C4=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"]),P4={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"},R8=new Set(["ctrl","alt","shift","meta"]),x4={left:0,middle:1,right:2};function v4($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let X of $){let J=X.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(R8.has(J))Z.systemKeys.push(J);else if(J in x4)Z.mouse=J;else if(J in P4||/^[a-z]$/.test(J))Z.keys.push(P4[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function g4($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,q]=Y,U=Y.index,W=U+Q.length,z=`__stx_evt_${X++}`,K=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=H.exec(q))!==null){let[,_,O]=B,V=_.split("."),F=V[0];if(!C4.has(F))continue;K.push({attribute:`@${_}`,event:F,handler:O,modifiers:v4(V.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,O]=B,V=_.split("."),F=V[0];if(!C4.has(F))continue;K.push({attribute:`@${_}`,event:F,handler:O,modifiers:v4(V.slice(1)),elementId:z})}if(K.length>0)Z.push({originalTag:Q,elementId:z,events:K,startIndex:U,endIndex:W})}return Z}function D8($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let J of X.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(X.keys.length>0){let J=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(X.mouse!==null){let J=x4[X.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function N8($,Z){let X=$;if(Z.debounce!==null)X=`__stx_debounce(() => { ${X} }, ${Z.debounce})`;else if(Z.throttle!==null)X=`__stx_throttle(() => { ${X} }, ${Z.throttle})`;return X}function y$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function A8($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=D8($),Y=N8(y$($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",q=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${X}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -3360,9 +3360,9 @@ ${t6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3360
3360
|
} finally {
|
|
3361
3361
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3362
3362
|
}
|
|
3363
|
-
})();`}function WY($,Z){let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1]};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}var a6=0,CK=new V1(500),Z9=new Set;function PK(){Z9.clear()}function zY($){if($.__onceStore instanceof Set)return $.__onceStore;return Z9}async function h3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||G0.join(G0.dirname(X),"partials");if(G&&!G0.isAbsolute(G))G=G0.resolve(process.cwd(),G);let q=GY($,"@partial","@include"),U=zY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,O,V)=>{let F=O.trim(),L=`${X}:${F}`;if(U.has(L))return"";return U.add(L),O});{let _=/@includeIf\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")")L--;w++}if(L!==0)break;let R=q.substring(F+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],T=W(N,G,X),A="";if(T&&await Bun.file(T).exists())Y.add(T),A=`@include(${R})`;q=q.substring(0,V)+A+q.substring(w),_.lastIndex=0}}for(let[_,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=V.exec(q))!==null){let L=F.index,w=L+F[0].length-1,R=1,D=w+1;while(D<q.length&&R>0){if(q[D]==="(")R++;else if(q[D]===")")R--;D++}if(R!==0)break;let N=q.substring(w+1,D-1),T=g3(N,0);if(T===-1){V.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){V.lastIndex=D;continue}let I=k[1],y=M.substring(k[0].length),E,b=g3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${A})`,g;if(Y0(C)){let c=Q0(C,Object.keys(Z));g=Boolean(c(...Object.values(Z)))}else g=Boolean(e(C,Z));let x=O?!g:g,s="";if(x){let c=W(I,G,X);if(c&&await Bun.file(c).exists())Y.add(c);s=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+s+q.substring(D),V.lastIndex=0}catch(C){let g=C instanceof Error?C.message:String(C),x=U0("Include",`Error evaluating ${_} condition: ${g}`,X,$,L);q=q.substring(0,L)+x+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(F+1,w),D=q.substring(V,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let[,T,A,M,k]=N;try{let I,y=A.trim();if(Y0(y))I=Q0(y,Object.keys(Z))(...Object.values(Z));else I=e(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},g=await H(T,C,$,V);E+=g}else if(k)E=await H(k,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,V)+U0("Each",`Error in @each: ${y}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(F+1,w),D=q.substring(V,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let T=N[1],A=R.slice(N[0].length),M,k=A.match(/^\s*,\s*\{/);if(k){A=A.slice(k[0].length-1);let E=1,b=1;while(b<A.length&&E>0){if(A[b]==="{")E++;else if(A[b]==="}"){if(E--,E===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let I,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=B0(M,Z)}catch(g){let x=g instanceof Error?g.message:String(g);if(J.debug){let s=U0("Include",`Error parsing includeFirst variables: ${x}`,X,$,V,D);q=q.replace(D,()=>s)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let g of E){let x=W(g,G,X);if(!x)continue;if(await o(x)){let s=await H(g,b,$,V);q=q.replace(D,()=>s),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let g=U0("Include",`None of the includeFirst paths exist: ${T}`,X,$,V,D);q=q.replace(D,()=>g)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=U0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,O,V){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let L=G0.resolve(O),w=G0.resolve(G0.dirname(V)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=G0.resolve(O,F);else R=G0.resolve(w,F);let D=G0.normalize(R),N=D.startsWith(L+G0.sep)||D===L,T=D.startsWith(w+G0.sep)||D===w,A=!1,M=G0.dirname(w);if(D.startsWith(M+G0.sep)){if(!G0.relative(M,D).split(G0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))A=!0}if(!N&&!T&&!A)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(F){return console.error(`Error resolving path ${_}: ${F}`),null}}let z=G0.resolve(X);Q.add(z);function K(_,O,V,F){return J.onIncludeError?.({includePath:_,templatePath:X,message:O,partialsDir:G}),U0("Include",O,X,V,F)}async function H(_,O={},V,F){let L=W(_,G,X);if(!L)return K(_,`Could not resolve path for include: ${_}`,V,F);let w=G0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>G0.basename(D)).join(" -> ");return K(_,`Circular include detected: ${R}`,V,F)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(x){let s=x instanceof Error?x.message:String(x);return K(_,`Error loading include file ${_}: ${s}`,V,F)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:x}=await import("./chunk-
|
|
3364
|
-
`;continue}if(_0)try{let{extractVariables:a}=await import("./chunk-
|
|
3365
|
-
`}}if(b){let x=WY(D,b);if(D=x.html,x.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),b=x.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await h3(D,k,L,J,Y,Q);let{processLoops:C}=await import("./chunk-
|
|
3363
|
+
})();`}function WY($,Z){let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1]};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}var a6=0,CK=new V1(500),Z9=new Set;function PK(){Z9.clear()}function zY($){if($.__onceStore instanceof Set)return $.__onceStore;return Z9}async function h3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||G0.join(G0.dirname(X),"partials");if(G&&!G0.isAbsolute(G))G=G0.resolve(process.cwd(),G);let q=GY($,"@partial","@include"),U=zY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,O,V)=>{let F=O.trim(),L=`${X}:${F}`;if(U.has(L))return"";return U.add(L),O});{let _=/@includeIf\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")")L--;w++}if(L!==0)break;let R=q.substring(F+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],T=W(N,G,X),A="";if(T&&await Bun.file(T).exists())Y.add(T),A=`@include(${R})`;q=q.substring(0,V)+A+q.substring(w),_.lastIndex=0}}for(let[_,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=V.exec(q))!==null){let L=F.index,w=L+F[0].length-1,R=1,D=w+1;while(D<q.length&&R>0){if(q[D]==="(")R++;else if(q[D]===")")R--;D++}if(R!==0)break;let N=q.substring(w+1,D-1),T=g3(N,0);if(T===-1){V.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){V.lastIndex=D;continue}let I=k[1],y=M.substring(k[0].length),E,b=g3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${A})`,g;if(Y0(C)){let c=Q0(C,Object.keys(Z));g=Boolean(c(...Object.values(Z)))}else g=Boolean(e(C,Z));let x=O?!g:g,s="";if(x){let c=W(I,G,X);if(c&&await Bun.file(c).exists())Y.add(c);s=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+s+q.substring(D),V.lastIndex=0}catch(C){let g=C instanceof Error?C.message:String(C),x=U0("Include",`Error evaluating ${_} condition: ${g}`,X,$,L);q=q.substring(0,L)+x+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(F+1,w),D=q.substring(V,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let[,T,A,M,k]=N;try{let I,y=A.trim();if(Y0(y))I=Q0(y,Object.keys(Z))(...Object.values(Z));else I=e(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},g=await H(T,C,$,V);E+=g}else if(k)E=await H(k,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,V)+U0("Each",`Error in @each: ${y}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,O;while((O=_.exec(q))!==null){let V=O.index,F=V+O[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(F+1,w),D=q.substring(V,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let T=N[1],A=R.slice(N[0].length),M,k=A.match(/^\s*,\s*\{/);if(k){A=A.slice(k[0].length-1);let E=1,b=1;while(b<A.length&&E>0){if(A[b]==="{")E++;else if(A[b]==="}"){if(E--,E===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let I,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=B0(M,Z)}catch(g){let x=g instanceof Error?g.message:String(g);if(J.debug){let s=U0("Include",`Error parsing includeFirst variables: ${x}`,X,$,V,D);q=q.replace(D,()=>s)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let g of E){let x=W(g,G,X);if(!x)continue;if(await o(x)){let s=await H(g,b,$,V);q=q.replace(D,()=>s),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let g=U0("Include",`None of the includeFirst paths exist: ${T}`,X,$,V,D);q=q.replace(D,()=>g)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=U0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,O,V){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let L=G0.resolve(O),w=G0.resolve(G0.dirname(V)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=G0.resolve(O,F);else R=G0.resolve(w,F);let D=G0.normalize(R),N=D.startsWith(L+G0.sep)||D===L,T=D.startsWith(w+G0.sep)||D===w,A=!1,M=G0.dirname(w);if(D.startsWith(M+G0.sep)){if(!G0.relative(M,D).split(G0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))A=!0}if(!N&&!T&&!A)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(F){return console.error(`Error resolving path ${_}: ${F}`),null}}let z=G0.resolve(X);Q.add(z);function K(_,O,V,F){return J.onIncludeError?.({includePath:_,templatePath:X,message:O,partialsDir:G}),U0("Include",O,X,V,F)}async function H(_,O={},V,F){let L=W(_,G,X);if(!L)return K(_,`Could not resolve path for include: ${_}`,V,F);let w=G0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>G0.basename(D)).join(" -> ");return K(_,`Circular include detected: ${R}`,V,F)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(x){let s=x instanceof Error?x.message:String(x);return K(_,`Error loading include file ${_}: ${s}`,V,F)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:x}=await import("./chunk-98a8ma06.js");R=x(R,Z)}if(R&&(J.debug||!B5()&&!n5()))try{let{warnUnbalancedTags:x}=await import("./chunk-hh2r7hrb.js");x(R,L)}catch{}let D=R;try{let{processESImports:x}=await import("./chunk-rmyrzcac.js");await x(R,Z,L,J,Y)}catch(x){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let N=U$(D);if(N)D=N.content.trim();let A=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(A)M=`<style${A[1]}>${A[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...Z};k.__stx_signals_gate=J1(R);for(let[x,s]of Object.entries(O))k[x]=s;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(I)],E="",b=null;for(let x of y){let s=x[1]||"",c=x[2]||"",_0=s.includes("server"),N0=N1(s),A0="";try{let{extractAndStripCssImports:a,renderVendorStyleTags:F0}=await import("./chunk-409jrxj6.js"),X0=a(c,{filePath:L,projectRoot:process.cwd()});c=X0.code,A0=F0(X0.styles)}catch(a){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,a instanceof Error?a.message:a)}if(N0&&c.trim())c=A1(c);if(!_0)try{let{hasUserImports:a,bundleClientScript:F0}=await import("./chunk-749d2abw.js");if(a(c))c=await F0(c,L,{projectRoot:process.cwd()})}catch(a){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,a instanceof Error?a.message:a)}let g0=qY(c);if(g0&&!_0){b=`stx_scope_${G0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++a6}`;let a=o0(c),F0=UY(a,b);E+=`${A0}<script data-stx-scoped data-stx-run="always">${F0}</script>
|
|
3364
|
+
`;continue}if(_0)try{let{extractVariables:a}=await import("./chunk-7ggk2vmy.js");await a(c,k,L)}catch(a){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,a)}if(!_0&&!g0){let a=s.replace(/\bclient\b/i,"").trim();b=`stx_scope_${G0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++a6}`;let F0=o0(c),X0=$9(F0,b),K1=e6(F0,X0);E+=`${A0}<script data-stx-scoped data-stx-run="always"${a?` ${a}`:""}>${K1}</script>
|
|
3365
|
+
`}}if(b){let x=WY(D,b);if(D=x.html,x.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),b=x.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await h3(D,k,L,J,Y,Q);let{processLoops:C}=await import("./chunk-s0perkbz.js"),g=C(D,k,L);if(g=a0(g,k,L),g=_1(g,k,L),M)g+=`
|
|
3366
3366
|
`+M;if(E)g+=`
|
|
3367
3367
|
`+E;return g}catch(R){let D=R instanceof Error?R.message:String(R);return K(_,`Error processing include ${_}: ${D}`,V,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,O=_+j[0].length-1,V=1,F=O+1;while(F<q.length&&V>0){if(q[F]==="(")V++;else if(q[F]===")")V--;F++}if(V!==0)break;let L=q.substring(_,F),w=q.substring(O+1,F-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let D=R[1],N,T=w.substring(R[0].length),A=g3(T,0);if(A!==-1)N=T.substring(A+1).trim();let M={};if(N)try{M=B0(N,Z)}catch(I){let y=I instanceof Error?I.message:String(I);q=q.replace(L,U0("Include",`Error parsing include variables for ${D}: ${y}`,X,$,_)),B.lastIndex=0;continue}let k=await H(D,M,$,_);q=q.substring(0,_)+k+q.substring(F),B.lastIndex=0}return q}function u3($,Z){let X=$;function J(Y,Q,G,q){let U=Y,W=!0;while(W){W=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),K=U.match(z);if(!K||K.index===void 0)break;let H=K.index,B=K[1],j=H+K[0].length,_=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),V=1,F=j,L=-1;while(V>0&&F<U.length){let R=U.slice(F),D=R.match(_),N=R.match(O),T=D?F+D.index:1/0,A=N?F+N.index:1/0;if(T<A)V++,F=T+(D[0].length||1);else if(A<1/0){if(V--,V===0){L=A;break}F=A+G.length+1}else break}if(L===-1)break;let w=U.slice(j,L);if(!Z[B])Z[B]=[];if(q)Z[B].unshift(w);else Z[B].push(w);U=U.substring(0,H)+U.substring(L+`@${G}`.length),W=!0}return U}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function d3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
|
|
3368
3368
|
`)})}import*as m3 from"path";async function X9($,Z,X=""){if(m3.basename(X)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return Y9($,Z,X,"@js","@endjs")}async function J9($,Z,X=""){if(m3.basename(X)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return Y9($,Z,X,"@ts","@endts")}async function Y9($,Z,X,J,Y){let Q=$,G=f1(`${J}([\\s\\S]*?)${Y}`,"g"),q=[],U;while((U=G.exec($))!==null)q.push({fullMatch:U[0],content:U[1]||"",index:U.index});for(let{fullMatch:W,content:z,index:K}of q)try{let H={...Z,global:Z},B=Object.keys(H),j=Object.values(H),_=z.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let V=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=V.length>0?`return { ${V.join(", ")} };`:"return {};",L=`
|
|
@@ -3534,14 +3534,14 @@ document.addEventListener("focusout",function(e){
|
|
|
3534
3534
|
${Z}${$.slice(G)}`}if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3535
3535
|
`+$.slice(G)}if(q5($))return u5($,(G)=>`${G}
|
|
3536
3536
|
${Z}`);return`${Z}
|
|
3537
|
-
${$}`}async function O$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return e3($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return e3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-
|
|
3537
|
+
${$}`}async function O$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return e3($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return e3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-etnqfdcj.js"),J=await X(Z.debug);return e3($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function jQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function r9($){if($.includes("data-stx-tooltip-runtime")||!jQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${t3()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
|
|
3538
3538
|
${Z}`;return`${$.slice(0,X)}${Z}
|
|
3539
3539
|
${$.slice(X)}`}async function _Q($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let X=Z?.router,J="";{let q={};if(X){if(X.container)q.container=X.container;if(X.interceptAllLinks!==void 0)q.interceptAllLinks=X.interceptAllLinks;if(X.progress!==void 0)q.progress=X.progress;if(X.viewTransitions!==void 0)q.viewTransitions=X.viewTransitions;if(X.viewTransitionDuration!==void 0)q.viewTransitionDuration=X.viewTransitionDuration;if(X.viewTransitionEasing!==void 0)q.viewTransitionEasing=X.viewTransitionEasing;if(X.scrollToTop!==void 0)q.scrollToTop=X.scrollToTop;if(X.prefetch!==void 0)q.prefetch=X.prefetch;if(X.cache!==void 0)q.cache=X.cache;if(X.progressColor!==void 0)q.progressColor=X.progressColor;if(X.progressHeight!==void 0)q.progressHeight=X.progressHeight}try{let U=await i9(Z?.pagesDir);if(U.length>0)q.ownedRoutes=U}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${n9(q)};</script>
|
|
3540
|
-
`}let{getCachedRouterScript:Y}=await import("./chunk-
|
|
3540
|
+
`}let{getCachedRouterScript:Y}=await import("./chunk-etnqfdcj.js"),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Y()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
|
|
3541
3541
|
</body>`+$.slice(G+7)}var a9=Symbol.for("stx.lazy-module-promises");function VQ(){let $=globalThis;return $[a9]??=new Map,$[a9]}function r($,Z){let X=VQ(),J=`${import.meta.url}\x00${$}`,Y=X.get(J);if(Y)return Y;let Q=Z();return X.set(J,Q),Q.catch(()=>{if(X.get(J)===Q)X.delete(J)}),Q}var OQ=0,Z4=`(?:"[^"]*"|'[^']*'|[^>"'])*`,J2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function FQ($,Z={}){let X=[];for(let J of g5($,X1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=Y[0].length,U=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,U),start:J.start,end:J.end})}return X}function Y2($){let Z=$.trim(),X=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:q}=t9(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:q}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:q}=t9(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function t9($){let Z=$.trim(),X=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(X)return{itemVar:X[2],indexVar:X[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function J4($){return X2($)}function LQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,X=0,J;while((J=Z.exec($))!==null){let Y=J[1];if(Y.startsWith("if"))X++;else if(Y==="endif")X--;else if(X===0)return!0}return!1}function wQ($){let Z=new Set,X=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=X.exec($))!==null){let Q=Y[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function RQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Z4})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=g5($,(Q,G)=>{Z.lastIndex=G;let q=Z.exec(Q);if(!q||q.index!==G||!X.test(q[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of J){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let q=G[2].match(X),U=Y2(q?.[1]??q?.[2]??""),W=[U.itemVar,U.indexVar].filter(Boolean);if(W.length===0)continue;let z=G[1],H=/\/\s*>$/.test(Q.token)||L$.has(z.toLowerCase())?Q.end:G2($,Q.start,z,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(W)})}return Y}var e9=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function DQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function $2($,Z,X,J){if(!$)return!1;let Y=DQ($),Q=!1,G=!1,q=!1,U=/([a-zA-Z_$][\w$]*)/g,W;while((W=U.exec(Y))!==null){let B=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(e9.has(B))continue;if(Z.has(B)||J?.has(B))Q=!0;else if(X&&B in X)G=!0}let z=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,K;while((K=z.exec(Y))!==null){let B=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(e9.has(B)||X&&B in X)continue;q=!0}return(Q||q)&&!G}function F$($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(J2);if(Q&&NQ(Q[3],Q[1])){let[,G,q,U]=Q;return`<${G}${q}${J}>${U}</${G}>`}return`<template${J}>${Y}</template>`}function NQ($,Z){let X=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Y;while((Y=X.exec($))!==null)if(Y[1]){if(J--,J<0)return!1}else J++;return!0}function Q2($,Z){let X=wQ($);function J(Y){let Q=Y,G=RQ(Y),q=(K)=>{let H=new Set;for(let B of G)if(K>B.start&&K<B.end)for(let j of B.vars)H.add(j);return H},U=/@if\s*\(/g,W,z=[];while((W=U.exec(Q))!==null){let K=W.index,H=K+W[0].length,B=1,j=H;while(j<Q.length&&B>0){if(Q[j]==="(")B++;else if(Q[j]===")")B--;j++}if(B!==0)continue;let _=Q.substring(H,j-1).trim(),O=j,V=1,F=O,L=/@(if\s*\(|endif)/g;L.lastIndex=O;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))V++;else if(w[1]==="endif"){if(V--,V===0){F=w.index+w[0].length;break}}if(V!==0)continue;let R=Q.substring(O,F-6).trim(),D;if(LQ(R)){let N=V5(Q.substring(K,F));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),A=q(K);if(!(T.length>0&&T.every((I)=>$2(I.condition,X,Z,A))))continue;D=N[0].branches.map((I)=>{let y=J(I.content);if(I.type==="elseif")return F$(y,"@else-if",I.condition??"");if(I.type==="else")return F$(y,"@else");return F$(y,"@if",I.condition??"")}).join(`
|
|
3542
3542
|
`)}else{if(!$2(_,X,Z,q(K)))continue;D=F$(J(R),"@if",_)}z.push({start:K,end:F,replacement:D}),U.lastIndex=F}for(let K=z.length-1;K>=0;K--){let{start:H,end:B,replacement:j}=z[K];Q=Q.substring(0,H)+j+Q.substring(B)}return Q}return J($)}function AQ($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let X=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(X)return X[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}var L$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function G2($,Z,X,J){if(L$.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,U=J;while(U<G){let W=$.indexOf("<",U);if(W===-1)return-1;if(U=W,$.startsWith("<!--",U)){let B=$.indexOf("-->",U+4);if(B===-1)return-1;U=B+3;continue}let z=/^<(script|style)\b/i.exec($.slice(U,U+8));if(z){let B=$.indexOf(">",U);if(B===-1)return-1;if($[B-1]==="/"){U=B+1;continue}let j=Q.indexOf(`</${z[1].toLowerCase()}`,U);if(j===-1)return-1;let _=$.indexOf(">",j);if(_===-1)return-1;U=_+1;continue}if($[U+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(U,U+64));if(!B){U++;continue}if(B[1].toLowerCase()===Y){if(q--,U+=B[0].length,q===0)return U;continue}U+=B[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec($.slice(U,U+64));if(!K){U++;continue}let H=$.indexOf(">",U);if(H===-1)return-1;if(K[1].toLowerCase()===Y){let B=$.slice(U,H+1);if(!(/\/\s*>$/.test(B)||L$.has(Y)))q++}U=H+1}return-1}var MQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function TQ($,Z){let X=Z,J=$.length;for(;;){while(X<J&&$[X]!=="<")X++;if(X>=J)return!1;if($.startsWith("<!--",X)){let G=$.indexOf("-->",X+4);if(G===-1)return!1;X=G+3;continue}break}if($[X+1]==="/")return!1;let Y=$.indexOf(">",X);if(Y===-1)return!1;let Q=$.slice(X,Y+1);return MQ.test(Q)}function q2($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=X.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Y=(K)=>Z.some(([H,B])=>K>=H&&K<B),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],q;while((q=Q.exec($))!==null){if(Y(q.index))continue;let[K,H,B,j,_,O,V]=q,F=AQ(_);if(F===void 0)continue;let L=q.index,w=L+K.length,N=!!V||/\/\s*>$/.test(K)||L$.has(H.toLowerCase())?w:G2($,L,H,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&TQ($,N)){Q.lastIndex=w;continue}if(F===!0){let A=`<${H}${B}${O}${V}>`;G.push({start:L,end:w,replacement:A});continue}G.push({start:L,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((K,H)=>K.start-H.start);let U=[],W=-1;for(let K of G){if(K.start<W)continue;U.push(K),W=K.end}let z=$;for(let K=U.length-1;K>=0;K--){let{start:H,end:B,replacement:j}=U[K];z=z.substring(0,H)+j+z.substring(B)}return z}function U2($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let q=Y[1],U=Y.index,W=U+Y[0].length,z=1,K=W;while(K<X.length&&z>0){if(X[K]==="(")z++;else if(X[K]===")")z--;K++}if(z!==0)continue;let H=X.substring(W,K-1).trim(),B=K,j=Y2(H),_=q==="for"?"@endfor":"@endforeach",O=1,V=B,F=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");F.lastIndex=B;let L;while((L=F.exec(X))!==null)if(L[1].startsWith(q))O++;else if(O--,O===0){V=L.index+L[0].length;break}if(O!==0)continue;let w=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)G.push({start:U,end:V,vars:T})};if(j.iterable){let T=j.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){w();continue}let A=T.split(/[.[(]/)[0].trim(),M=Z?A in Z:!1,k=G.some((I)=>U>I.start&&U<I.end&&I.vars.includes(A));if(A&&(M||k)){w();continue}}if(j.style==="as")H=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let R=X.substring(B,V-_.length).trim(),D=R.match(J2),N;if(D){let[,T,A,M]=D;N=`<${T}${A} @for="${H}">${M}</${T}>`}else N=`<template @for="${H}">${R}</template>`;Q.push({start:U,end:V,replacement:N})}for(let q=Q.length-1;q>=0;q--){let{start:U,end:W,replacement:z}=Q[q];X=X.substring(0,U)+z+X.substring(W)}return X}function IQ($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(z)=>{let K=J+1;while(K<Q){let H=$[K];if(H==="\\"){K+=2;continue}if(H===z)return K+1;K++}return Q},q=()=>{let z=J+2;while(z<Q&&$[z]!==`
|
|
3543
3543
|
`)z++;return z},U=()=>{let z=J+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},W=(z)=>{let K=z,H=0;while(K<Q){let B=$[K];if(B==="/"&&$[K+1]==="/"){let j=K+2;while(j<Q&&$[j]!==`
|
|
3544
|
-
`)j++;K=j;continue}if(B==="/"&&$[K+1]==="*"){let j=K+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;K=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=K+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}K=j;continue}if(B==="("||B==="["||B==="{"){H++,K++;continue}if(B===")"||B==="]"||B==="}"){H--,K++;continue}if(B===";"&&H===0)return K+1;K++}return Q};while(J<Q){let z=$[J];if(z==="/"&&$[J+1]==="/"){let K=q();X.push($.slice(J,K)),J=K;continue}if(z==="/"&&$[J+1]==="*"){let K=U();X.push($.slice(J,K)),J=K;continue}if(z==='"'||z==="'"||z==="`"){let K=G(z);X.push($.slice(J,K)),J=K;continue}if(z==="{"){Y++,X.push(z),J++;continue}if(z==="}"){Y--,X.push(z),J++;continue}if(Y===0){let K=J>0?$[J-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(z),J++}return X.join("")}async function kQ($,Z,X){let J=FQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let O of J){let V=O.body;if(N1(O.attrs))V=A1(V);if(Y.test(V))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${OQ++}`,{hasUserImports:q,bundleClientScript:U}=await r("stx/client-script-bundler",()=>import("./chunk-
|
|
3544
|
+
`)j++;K=j;continue}if(B==="/"&&$[K+1]==="*"){let j=K+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;K=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=K+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}K=j;continue}if(B==="("||B==="["||B==="{"){H++,K++;continue}if(B===")"||B==="]"||B==="}"){H--,K++;continue}if(B===";"&&H===0)return K+1;K++}return Q};while(J<Q){let z=$[J];if(z==="/"&&$[J+1]==="/"){let K=q();X.push($.slice(J,K)),J=K;continue}if(z==="/"&&$[J+1]==="*"){let K=U();X.push($.slice(J,K)),J=K;continue}if(z==='"'||z==="'"||z==="`"){let K=G(z);X.push($.slice(J,K)),J=K;continue}if(z==="{"){Y++,X.push(z),J++;continue}if(z==="}"){Y--,X.push(z),J++;continue}if(Y===0){let K=J>0?$[J-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(z),J++}return X.join("")}async function kQ($,Z,X){let J=FQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let O of J){let V=O.body;if(N1(O.attrs))V=A1(V);if(Y.test(V))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${OQ++}`,{hasUserImports:q,bundleClientScript:U}=await r("stx/client-script-bundler",()=>import("./chunk-749d2abw.js")),W=[];for(let O=0;O<Q.length;O++){let V=Q[O].content;if(V=D5(V).code,q(V))V=await U(V,Z||"",{projectRoot:process.cwd()});V=V.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L,w)=>bQ(w));let F=o0(V);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
|
|
3545
3545
|
${F}`)}let z=W.join(`
|
|
3546
3546
|
|
|
3547
3547
|
`);z=IQ(z);let K=EQ(z),H=K.split(",").map((O)=>O.trim()).filter(Boolean),B=X4(z,X),j=`
|
|
@@ -3619,9 +3619,9 @@ ${G.join(`
|
|
|
3619
3619
|
`+Y.slice(Q)}async function M4($,Z,X,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=J1($);let Q=!Z.__stxProcessingDepth;if(Q)d4(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!B5()&&!n5())&&X&&X.endsWith(".stx"))s2($,X);try{return await q7.timeAsync("template-processing",async()=>{let G=await qG($,Z,X,J,Y);if(Q)G=N4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},W=(Z.__stx_runtime_head||null)??n2(),z=(Z.__stx_head_raw||"").trim(),K,H=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)K=H[1].trim(),z=z.replace(H[0],"").trim();let B=Z.__sections?.title,j=W.title||K||B,_=!W.title&&(!!K||!!B),O=W.meta||[],V=new Set(O.map((N)=>n1(N)).filter(Boolean)),F={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!V.has(n1(N))),...O],link:[...q.link||[],...W.link||[]],script:[...q.script||[],...W.script||[]],headRaw:[q.headRaw,z].filter(Boolean).join(`
|
|
3620
3620
|
`),...W.htmlAttrs&&{htmlAttrs:g9(q.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...W.bodyAttrs}}},L=r3(G);if(G=m9(G,F,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)G=d9(G,q),G=h9(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],T=p2(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
|
|
3621
3621
|
<meta name="stx-layout" content="${d2(N)}">
|
|
3622
|
-
<meta name="stx-layout-group" content="${d2(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?q5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=u5(G,(T,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=u9(G);let q=J.app?.colorMode;if(q)G=C9(G,q);G=v9(G),G=GG(G)}if(Q)try{let{getStoreScript:q}=await r("stx/store-loader",()=>import("./chunk-
|
|
3623
|
-
`+z+G.slice(K.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await r("stx/framework-composables",()=>import("./chunk-
|
|
3624
|
-
`+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await r("stx/composable-loader",()=>import("./chunk-
|
|
3622
|
+
<meta name="stx-layout-group" content="${d2(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?q5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=u5(G,(T,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=u9(G);let q=J.app?.colorMode;if(q)G=C9(G,q);G=v9(G),G=GG(G)}if(Q)try{let{getStoreScript:q}=await r("stx/store-loader",()=>import("./chunk-fqrfhf6n.js")),U=J.storesDir,W=await q(U);if(W){let z=`<script data-stx-stores>${W}</script>`,K=X5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
|
|
3623
|
+
`+z+G.slice(K.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await r("stx/framework-composables",()=>import("./chunk-24271vkv.js")),U=await q(G);if(U){let W=X5(G,"data-stx-stores")||X5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
|
|
3624
|
+
`+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await r("stx/composable-loader",()=>import("./chunk-2gwfcgct.js")),U=J.composablesDir,W=await q(U,G);if(W){let z=`<script data-stx-composables>${W}</script>`,K=X5(G,"data-stx-stores")||X5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
|
|
3625
3625
|
`+z+G.slice(K.end)}}catch{}if(Q)G=P9(G);if(Q&&Z.__stx_inject_css!==!1)G=await i2(G,void 0,J.buildMode==="serve");if(Q)G=S9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof r5)throw G;let q=G instanceof Error?G.message:String(G),U=new L1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(u0.log(U,{filePath:X,context:Z}),q3.logDetailedError(U,{filePath:X,template:$.substring(0,500)}),J.debug)throw U;return Q3.createFallbackContent("Template Processing",U)}}async function qG($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!w0.isAbsolute(J.partialsDir)?w0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!w0.isAbsolute(J.componentsDir)?w0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!w0.isAbsolute(J.layoutsDir)?w0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,U=$;await zG(X,Z),WG(Z,q),U=await u1(()=>_9(U,Z,X,q),U,(L)=>{u0.log(L,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${L.message}`)}),U=U.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=l0(U,Q5,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);U=W.output;let z=W.tokens,K=(L)=>z.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>z[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";U=U.replace(/@@/g,H),U=U.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),U=N9(U),U=await x2(U,X,Y);let B={};U=u3(U,B);let j={...Z.__sections||{}},_="",O=N7(D7($)),V=/@nolayout\b/.test(U)||O===!1;if(/@nolayout\b/.test(U))U=U.replace(/@nolayout\b\s*/g,"");let F=U.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)_=F[1],U=U.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(U))U=`@section('content')
|
|
3626
3626
|
${U.trim()}
|
|
3627
3627
|
@endsection`}if(!_&&!V&&q.defaultLayout){let L=o3(U),w=/@section\s*\(/.test(U);if(!L||w){let R="",D=w0.dirname(X),N=q.layoutsDir?w0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let A=w0.join(D,"_layout.stx");if(await o(A)){R=A;break}let M=w0.dirname(D);if(M===D||M.length<N.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let T=w0.isAbsolute(q.layoutsDir)?q.layoutsDir:w0.resolve(process.cwd(),q.layoutsDir),A=w0.join(T,`${q.defaultLayout}.stx`);if(await o(A))_=A}if(_&&!w)U=`@section('content')
|
|
@@ -3629,7 +3629,7 @@ ${U.trim()}
|
|
|
3629
3629
|
@endsection`}}if(U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return j[w]=R,""}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=e(R.trim(),Z);if(D===void 0)return L;return j[w]=String(D??""),""}catch{return L}}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))j[w]=R.replace("@parent",E1);else j[w]=R.trim();return""}),Z.__sections=j,U=U.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return j[w]||R||""}),!("slot"in Z)||Z.slot===void 0)U=U.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(U=d3(U,B),_){let L=[],w=c0(U),R=l0(w.output,C1,(D,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(U=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,N,T)=>{let A=N==="SCRIPT"?w.scripts[Number(T)]:R.tokens[Number(T)];if(A)L.push(A);return""}),L.length>0){let D=L.join(`
|
|
3630
3630
|
`);j.content=j.content?`${j.content}
|
|
3631
3631
|
${D}`:D,Z.__sections=j}}if(_)try{let L;if(w0.isAbsolute(_))L=_,Y.add(_);else L=await u1(()=>e5(_,X,G,Y),null,()=>{throw new L1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!L){let A=(I)=>{if(!I)return[];try{let y=w0.isAbsolute(I)?I:w0.resolve(process.cwd(),I);return YG.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...A(G.layoutsDir),...A(G.fallbackLayoutsDir)].filter((I,y,E)=>E.indexOf(I)===y).sort(),k=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(u0.log(Error(k),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${k}`),G.debug)throw new L1(k,X);return U}let w=await u1(()=>Bun.file(L).text(),"",()=>{throw new L1(`Failed to read layout file: ${L}`,X,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${L}`);let A={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return A[E]=b.trim(),""});for(let[y,E]of Object.entries(A))if(j[y]&&j[y].includes(E1)){let b=j[y].indexOf(E1);j[y]=j[y].slice(0,b)+E+j[y].slice(b+E1.length)}else if(!j[y])j[y]=E;let k={...Z,__sections:j},I=`@layout('${R[1]}')${M}`;return await M4(I,k,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=u3(D,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(A,M,k)=>{return T[M]=k.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(A,M,k)=>{if(j[M]){let I=j[M];if(I.includes(E1)){let y=T[M]||"",E=I.indexOf(E1);I=I.slice(0,E)+y+I.slice(E+E1.length)}return I}return k||""}),N=UG(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=d3(N,B),Z.__originalFilePath=X,U=await l2(N,Z,L,G,Y),U=`<!-- stx-layout: ${_} -->
|
|
3632
|
-
${U}`,K(U)}catch(L){return u0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return K(await l2(U,Z,X,G,Y))}function UG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function WG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function zG($,Z){await u1(()=>F9($,Z),void 0,(X)=>{u0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function KG($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await r("stx/variable-extractor",()=>import("./chunk-
|
|
3632
|
+
${U}`,K(U)}catch(L){return u0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return K(await l2(U,Z,X,G,Y))}function UG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function WG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function zG($,Z){await u1(()=>F9($,Z),void 0,(X)=>{u0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function KG($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await r("stx/variable-extractor",()=>import("./chunk-7ggk2vmy.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));u0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function HG($,Z,X){try{let{interpolateScriptsInTemplate:J}=await r("stx/expressions",()=>import("./chunk-s8x2n1p6.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return u0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function l2($,Z,X,J,Y){let Q=$,G=J;if(await KG(Q,Z,X),Q=await HG(Q,Z,X),Q=await X9(Q,Z,X),Q=await J9(Q,Z,X),Q=await h6(Q,Z,X,G),J1(Q))Q=Q2(Q,Z),Q=U2(Q,Z);Q=q2(Q);let{processStreamDirectives:q}=await r("stx/streaming",()=>import("./chunk-98a8ma06.js"));Q=q(Q,Z),Q=z9(Q,Z,X,G),Q=await I9(Q,Z,X,G,Y),Q=await w4(Q,Z,X,G,Y),Q=R7(Q,Z,X,G);let{processDeferDirectives:U}=await r("stx/defer",()=>import("./chunk-7jhtvcy5.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await r("stx/teleport",()=>import("./chunk-vg0kzfcy.js"));Q=W(Q,Z,X);let{processTransitionDirectives:z,processTransitionAttributes:K}=await r("stx/transitions",()=>import("./chunk-4vhxtfkw.js"));Q=z(Q,Z,X),Q=K(Q);let{processErrorBoundaryDirectives:H}=await r("stx/error-boundaries",()=>import("./chunk-m6damb1f.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await r("stx/suspense",()=>import("./chunk-v7ggp28p.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await r("stx/async-components",()=>import("./chunk-hcqzbhc1.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await r("stx/keep-alive",()=>import("./chunk-1gy7fa09.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:O,processVirtualGridDirectives:V,processInfiniteListDirectives:F}=await r("stx/virtual-scrolling",()=>import("./chunk-2bxgan9p.js"));Q=O(Q,Z,X),Q=V(Q,Z,X),Q=F(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await r("stx/partial-hydration",()=>import("./chunk-txre2e2m.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await r("stx/computed",()=>import("./chunk-02k0pg5s.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await r("stx/forms-validation",()=>import("./chunk-4k5f40bb.js"));Q=N(Q,Z,X);let{processHeadDirective:T,processTitleDirective:A,processMetaDirective:M,resetHead:k}=await r("stx/head",()=>import("./chunk-rbnmbeda.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let I=T(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
|
|
3633
3633
|
`;if(Q=A(Q,Z),Q=M(Q,Z),Q=O9(Q),Q=w3(Q,Z),Q=g6(Q),Q=B9(Q),Q=await h3(Q,Z,X,G,Y),Q=await w4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=l4(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=N4(Q),Q=a0(Q,Z,X),Q=M7(Q,Z,{filePath:X,buildMode:G.buildMode}),Q=R3(Q,Z),Q=D3(Q,Z),Q=L5(Q,Z),Q=E3(Q,Z),Q=b3(Q,Z),Q=await M6(Q,Z,X,G),Q=await S7(Q,Z,X),Q=await r6(Q,Z,X,G),Q=c2(Q,Z,X,G),Q=z6(Q,Z,X,G),Q=K6(Q,Z,X),Q=H6(Q,Z,X,G),Q=f6(Q,Z,X,G),Q=R4(Q,Z),Q=D4(Q),Q=g2(Q),!G.skipEventDirectives)Q=h4(Q,Z,X);if(Q=k7(Q,Z,X),G.debug){let n=/\bx-data\s*=/.test(Q),t=J4($);if(n&&t)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3634
3634
|
Both work on the same page, but they manage separate scopes.
|
|
3635
3635
|
Prefer signals (state/derived/effect) for new components.`)}Q=R9(Q,Z),Q=await _1(Q,Z,X),Q=h2(Q),Q=u2(Q),Q=B7(Q);let{processXElementDirectives:y}=await r("stx/x-element",()=>import("./chunk-nnw1ka45.js"));Q=y(Q);let E=Z.__originalFilePath||X,b=T$(Z);if(Q=await W2(Q,G,E,b),Q=l6(Q,Z),Q=await V9(Q,Z,X,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:t}=await r("stx/image-optimization/auto-sibling",()=>import("./chunk-735atsqq.js"));Q=await t(Q,{publicDir:n})}if(G.seo?.enabled)Q=B6(Q,Z,G);let C=(n,t,J0=!0)=>{if(!t)return n;let V0=t.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),O0=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(V0&&O0){if(J0)n=n.replace(O0[0],V0[0]);if(t=t.replace(V0[0],"").trim(),!t)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${t}
|
|
@@ -3643,7 +3643,7 @@ ${z7()}
|
|
|
3643
3643
|
`+H1}else Q=Q.replace("</head>",`${t}
|
|
3644
3644
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3645
3645
|
${t}`);else Q=t+`
|
|
3646
|
-
`+Q}{let{scanScriptTags:n}=await r("stx/signal-processing",()=>import("./chunk-
|
|
3646
|
+
`+Q}{let{scanScriptTags:n}=await r("stx/signal-processing",()=>import("./chunk-gyf7n2as.js")),t=[];for(let J0 of n(Q)){if(!/\bserver\b/i.test(J0.attrs))continue;let V0=J0.start+J0.fullMatch.indexOf(">")+1,O0=QG(Q,V0);if(O0===-1)continue;let C0=O0+9;while(C0<Q.length&&/\s/.test(Q[C0]))C0++;t.push({start:J0.start,end:C0})}for(let J0=t.length-1;J0>=0;J0--){let{start:V0,end:O0}=t[J0];Q=Q.substring(0,V0)+Q.substring(O0)}}let g0=B$(Q,X);if(g0.hasScoped)Q=g0.html;let a=Z.__stx_event_bindings||[],F0=!1,X0=[],K1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:Y5}=await r("stx/signal-processing",()=>import("./chunk-gyf7n2as.js"));for(let n of Y5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))X0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:t,content:J0}of X0){F0=!0;let V0=J0;A4(J0,X,J.strict,Z.__originalFilePath);let O0=await I$(J0,{eventBindings:a,attrs:t,hasColonDirectives:K1,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(n,()=>O0)}if(F0)Z.__stx_event_bindings=[];if(!F0&&Z.__stxProcessingDepth===1){let n=Z.__stx_event_bindings||[];if(n.length>0){let t=S$(n);if(t){let J0=Q.lastIndexOf("</body>");Q=J0===-1?Q+t:Q.slice(0,J0)+t+`
|
|
3647
3647
|
`+Q.slice(J0)}Z.__stx_event_bindings=[]}}if(!s9(Q)&&o9(Q))Q=await O$(Q,G);if(Q=r9(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=v6(Q,Z.cspNonce);return Q}var BG=[{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"}],jG=[{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')"}],_G=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function VG($){let Z=[],X=[];return OG($,Z),FG($,Z,X),LG($,X),wG($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function OG($,Z){let X=($.match(/\{\{/g)||[]).length,J=($.match(/\}\}/g)||[]).length;if(X!==J)Z.push({type:"expression",message:`Unclosed expression brackets: found ${X} opening '{{' and ${J} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function FG($,Z,X){for(let J of BG){let Y=new RegExp(`${J.open}(?:\\s|\\()`,"g"),Q=new RegExp(J.close,"g"),G=($.match(Y)||[]).length,q=($.match(Q)||[]).length;if(J.altClose){let U=new RegExp(J.altClose,"g");q+=($.match(U)||[]).length}if(G>q)Z.push({type:"directive",message:`Unclosed @${J.name} directive: found ${G} opening and ${q} closing`,suggestion:`Add ${G-q} missing ${J.close} tag(s)`});else if(q>G)X.push({type:"directive",message:`Extra ${J.close} found: ${q-G} more closing than opening`,suggestion:`Check for orphaned ${J.close} tags`})}}function LG($,Z){for(let X of jG)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function wG($,Z){for(let X of _G)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function RG($,Z){let X=$.slice(0,Z).split(`
|
|
3648
3648
|
`);return{line:X.length,column:X[X.length-1].length+1}}function DG($,Z,X){let J=[];switch($){case"if":case"elseif":case"unless":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(X.length===0||!X[0].includes(" as "))J.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(X.length===0)J.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(X.length===0)J.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(X.length===0)J.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return J}function NG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function AG($){let Z=$.matchAll(/@([a-z]+)/gi),X=new Set;for(let J of Z){let Y=J[1].toLowerCase();if(!Y.startsWith("end"))X.add(Y)}return Array.from(X)}import n0 from"path";import J5 from"process";var X8=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","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"],o2=new Set(X8),MG=new Set(["props","$props","defineProps"]),TG=new Set(["stx","@stacksjs/stx"]);function IG($){let Z=[],X=0,J=$.split(`
|
|
3649
3649
|
`);for(let Y of J){let Q=X,G=null,q=!1;for(let U=0;U<Y.length;U++){let W=Y[U];if(q){q=!1;continue}if(W==="\\"){q=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&U+1<Y.length&&Y[U+1]==="/")break;if(W==="{")X++;else if(W==="}")X--}if(Q===0){let U=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(U)Z.push(U[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let W=Y.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let K=W[1].slice(1,-1).split(",").map((H)=>{let B=H.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...K)}}}}return[...new Set(Z)]}function kG($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function X(J){if(!J.includes(":"))return J;let Y=[],Q="",G=0,q=0,U=null;for(let W=0;W<J.length;W++){let z=J[W];if(U){if(Q+=z,z===U)U=null;continue}if(z==='"'||z==="'"||z==="`"){U=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")q++;else if(z===")")q--;if(z===","&&G===0&&q===0){Y.push(Q),Q="";continue}Q+=z}if(Q)Y.push(Q);return Y.map((W)=>{let z=W.trim(),K=z.startsWith("..."),H=K?z.slice(3):z,B=-1,j=0;for(let R=0;R<H.length;R++)if(H[R]==="<")j++;else if(H[R]===">")j--;else if(H[R]===":"&&j===0){B=R;break}if(B===-1)return W;let O=H.substring(0,B).trim().replace(/\?$/,""),V=H.substring(B+1),F=-1,L=0;for(let R=0;R<V.length;R++)if(V[R]==="<")L++;else if(V[R]===">")L--;else if(V[R]==="="&&L===0){F=R;break}let w=K?"...":"";if(F!==-1)return`${w}${O} = ${V.substring(F+1).trim()}`;return`${w}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,Q)=>{if(!Q.includes(":"))return J;return`${Y}(${X(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,q=1,U=G+1,W=0,z=null;while(U<Z.length&&q>0){let B=Z[U];if(z){if(B===z)z=null;U++;continue}if(B==='"'||B==="'"||B==="`"){z=B,U++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")q++;else if(B===")")q--}if(q>0)U++}if(q!==0)continue;let K=Z.substring(G+1,U);if(!K.includes(":"))continue;let H=X(K);Q.push({start:G+1,end:U,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:q,end:U,replacement:W}=Q[G];Z=Z.substring(0,q)+W+Z.substring(U)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.split(",").map((G)=>{let[q,...U]=G.split("="),W=q.split(":")[0].trim();if(U.length>0)return`${W} = ${U.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.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"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
@@ -3665,11 +3665,11 @@ ${$[W]}`,W++;else break}return U=U.trim().replace(/;$/,""),{type:Q,name:G,value:
|
|
|
3665
3665
|
${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
|
|
3666
3666
|
${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function gG($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=q8(J);if(Q!==-1){if(W0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
|
|
3667
3667
|
${G}`,Y++}return{functionCode:J,nextIndex:Y}}function $8($,Z){let X=e($,Z)??e(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...J5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function hG($,Z,X){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,q]=Q;try{let U=q.trim().replace(/;$/,""),W=$8(U,Z);if(W!==void 0)Z[G]=W}catch(U){console.warn(`Failed to parse export ${G} in fallback:`,U)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,q]=Q;if(!(G in Z))try{let U=q.trim().replace(/;$/,""),W=$8(U,Z);if(W!==void 0)Z[G]=W}catch{}}}function uG($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:J}}function dG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var I5=new V1(500),E$=new V1(1000),k4=new V1(2000),lG=0;function cG($){let Z=new WeakSet;try{let X=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(X);let Y={};for(let Q of Object.keys(J).sort())Y[Q]=X(J[Q]);return Y};return JSON.stringify(X($))}catch{return null}}function U8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function pG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function N1($){return!pG($)}var k$=new Map;function I4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=k$.get(Z);if(X)return X;if(k$.size>=16)k$.clear();let J=new Bun.Transpiler($);return k$.set(Z,J),J}function A1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let X=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`});let Y=I4({loader:"ts",target:"browser",define:$5()}).transformSync(Z);for(let Q=0;Q<X.length;Q++)Y=Y.replace(`"__STX_EXPR_${Q}__"`,X[Q]),Y=Y.replace(`'__STX_EXPR_${Q}__'`,X[Q]);return Y}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function iG($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(z)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===z){Y++;return}Y++}},q=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let z=1;while(Y<Q&&z>0)if($[Y]==="{")z++,Y++;else if($[Y]==="}")z--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")q();else Y++;continue}Y++}},U=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
|
|
3668
|
-
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let z=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let K=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let j=K[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(U())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return Z}function nG($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function sG($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function oG($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let U=$[J];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let U of nG(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let z=sG(W);if(z===-1)continue;let K=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if(Z[K]!==void 0)continue;let H=W.slice(z+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[K]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function A$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let O of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(O))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],z=typeof Y.root==="string"?h.resolve(Y.root):void 0,K=z??h.dirname(J),H=[],B=(O)=>{if(O&&!H.includes(O))H.push(O)},j=X.__originalFilePath;if(j)B(h.join(h.dirname(j),"components"));B(Z),B(Y._rootComponentsDir),B(h.join(h.dirname(J),"components")),B(Y.componentsDir);let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let O of _)B(typeof O==="string"?O:null);if(z)B(h.resolve(z,"resources/views/components")),B(h.resolve(z,"resources/components")),B(h.resolve(z,"src/components")),B(h.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return o(h.resolve(h.dirname(J),`${Q}.stx`));for(let O of H){let V=h.isAbsolute(O)?O:h.resolve(K,O);for(let F of W)if(await o(h.join(V,F)))return!0}return!1}function rG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function aG($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function tG($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function T1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await r("stx/variable-extractor",()=>import("./chunk-
|
|
3668
|
+
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let z=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let K=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let j=K[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(U())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return Z}function nG($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function sG($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function oG($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let U=$[J];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let U of nG(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let z=sG(W);if(z===-1)continue;let K=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if(Z[K]!==void 0)continue;let H=W.slice(z+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[K]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function A$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let O of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(O))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],z=typeof Y.root==="string"?h.resolve(Y.root):void 0,K=z??h.dirname(J),H=[],B=(O)=>{if(O&&!H.includes(O))H.push(O)},j=X.__originalFilePath;if(j)B(h.join(h.dirname(j),"components"));B(Z),B(Y._rootComponentsDir),B(h.join(h.dirname(J),"components")),B(Y.componentsDir);let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let O of _)B(typeof O==="string"?O:null);if(z)B(h.resolve(z,"resources/views/components")),B(h.resolve(z,"resources/components")),B(h.resolve(z,"src/components")),B(h.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return o(h.resolve(h.dirname(J),`${Q}.stx`));for(let O of H){let V=h.isAbsolute(O)?O:h.resolve(K,O);for(let F of W)if(await o(h.join(V,F)))return!0}return!1}function rG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function aG($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function tG($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function T1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await r("stx/variable-extractor",()=>import("./chunk-7ggk2vmy.js")),z=q??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let K=new Set(z);K.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=H&&H!=="load"&&rG(H)?H:"";try{let j=(P)=>P.split("-").map((f)=>f.charAt(0).toUpperCase()+f.slice(1)).join(""),_=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,V=null,F=Y.__importedComponents;if(F){let P=[O,O.toLowerCase(),j(O),_(O)];for(let f of P)if(F.has(f)){V=F.get(f);break}}let L=[];if(!V){let P=[`${O}.stx`,`${j(O)}.stx`,`${_(O)}.stx`],f=[...new Set(P)],l=Y.__originalFilePath,m=[];if(l){let d=h.join(h.dirname(l),"components");m.push(d)}if(J)m.push(J);let q0=G._rootComponentsDir;if(typeof q0==="string"&&!m.includes(q0))m.push(q0);let K0=h.join(h.dirname(Q),"components");if(!m.includes(K0))m.push(K0);if(G.componentsDir&&G.componentsDir!==J&&!m.includes(G.componentsDir))m.push(G.componentsDir);let B1=G._pluginComponentDirs;if(Array.isArray(B1)){for(let d of B1)if(typeof d==="string"&&!m.includes(d))m.push(d)}let k0=typeof G.root==="string"?h.resolve(G.root):void 0,M0=k0??h.dirname(Q),P0=[];if(k0)P0.push(h.resolve(k0,"resources/views/components")),P0.push(h.resolve(k0,"resources/components")),P0.push(h.resolve(k0,"src/components")),P0.push(h.resolve(k0,"components"));P0.push(h.resolve(import.meta.dir,"components"));for(let d of P0)if(!m.includes(d))m.push(d);let j1=[...new Set(m.map((d)=>{if(!d)return d;return h.isAbsolute(d)?d:h.resolve(M0,d)}))];m.length=0,m.push(...j1);let y1=`${O}\x00${Q}\x00${j1.join("\x00")}`,$1=E$.get(y1);if($1)if(await o($1))V=$1;else E$.delete(y1);if(!V&&(O.startsWith("./")||O.startsWith("../")))V=h.resolve(h.dirname(Q),`${O}.stx`),L.push(V);else if(!V)for(let d of m){if(!d)continue;for(let E0 of f){let Z1=h.join(d,E0);if(L.push(Z1),await o(Z1)){V=Z1;break}}if(V)break;if(!V)try{let E0=await import("fs");if(!E0.statSync(d,{throwIfNoEntry:!1})?.isDirectory())continue;let E5=8,S1=[{path:d,depth:0}];while(S1.length>0&&!V){let s0=S1.pop();if(s0.depth>=E5)continue;let b5;try{b5=E0.readdirSync(s0.path,{withFileTypes:!0})}catch{continue}for(let y5 of b5){if(!y5.isDirectory())continue;if(y5.name==="node_modules"||y5.name.startsWith("."))continue;let S4=h.join(s0.path,y5.name);for(let w8 of f){let b$=h.join(S4,w8);if(L.push(b$),await o(b$)){V=b$;break}}if(V)break;S1.push({path:S4,depth:s0.depth+1})}}}catch{}if(V)break}if(V)E$.set(y1,V)}if(!V||!await o(V)){let P=L.length>0?`
|
|
3669
3669
|
Searched paths:
|
|
3670
3670
|
${L.map((f)=>` - ${f}`).join(`
|
|
3671
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(V);let w;if(I5.has(V))w=I5.get(V);else try{w=await Bun.file(V).text(),I5.set(V,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",S5,"__stx_client_signal_names","__stxServeContext"]),D={};for(let[P,f]of Object.entries(Y))if(!P.startsWith("__")||R.has(P))D[P]=f;let N=c0(X),T=[],A=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,f)=>{let l=N.scripts[Number(f)]||"",m=l.match(/^<script\b([^>]*)>/i)?.[1]||"",q0=m.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),K0=!q0||["module","text/javascript","application/javascript"].includes(q0);if(!/\bserver\b/i.test(m)&&K0)return T.push(l),"";return l}),{extractSlotContent:M}=await r("stx/slots",()=>import("./chunk-
|
|
3672
|
-
`)}`}if(X&&X0.includes("{{ text || slot }}"))X0=X0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:K1}=await r("stx/slots",()=>import("./chunk-
|
|
3671
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(V);let w;if(I5.has(V))w=I5.get(V);else try{w=await Bun.file(V).text(),I5.set(V,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",S5,"__stx_client_signal_names","__stxServeContext"]),D={};for(let[P,f]of Object.entries(Y))if(!P.startsWith("__")||R.has(P))D[P]=f;let N=c0(X),T=[],A=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,f)=>{let l=N.scripts[Number(f)]||"",m=l.match(/^<script\b([^>]*)>/i)?.[1]||"",q0=m.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),K0=!q0||["module","text/javascript","application/javascript"].includes(q0);if(!/\bserver\b/i.test(m)&&K0)return T.push(l),"";return l}),{extractSlotContent:M}=await r("stx/slots",()=>import("./chunk-j8dg655g.js")),k=M(A),I={};if(k.defaultSlot?.trim())I.default=k.defaultSlot;for(let[P,f]of k.namedSlots)I[P]=f.content;let y={...D,...Z,props:Z,slot:A,$slots:I,__processedComponents:K,__sections:{},__stx_signals_gate:J1(w)||aG(X)};oG(w,y);let E=w,b=U$(E);if(b)E=b.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g=[...w.matchAll(C)],x=[],s=g.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&g.every((P)=>/\bserver\b/.test(P[1]||"")),c=null,_0=null;if(s){let P=cG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){c=`${V}\x00${P}`;let f=k4.get(c);if(f){for(let l of f.dependencies)U.add(l);return f.output}_0=new Set(U)}}for(let P of g){let f=P[1]||"",l=P[2]||"",m=f.includes("server");if(N1(f)&&l.trim())l=A1(l);if(m&&l)try{await W(l,y,V)}catch(K0){}if(!m){let K0=l.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),B1=K0.includes("{{")&&K0.includes("}}"),k0=K0.includes("{!!")&&K0.includes("!!}");if(B1||k0)K0=v$(K0,y);let M0=f.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");x.push(`<script${M0}>${K0}</script>`)}}let N0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),A0=N0?N0[1]:"",g0=N0?N0[2]:"",a="",F0=A0&&/\bscoped\b/i.test(A0);if(N0)a=`<style${A0}>${g0}</style>`;let X0=E;if(X0=X0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N0)X0=X0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,f=[];if(X0=X0.replace(P,(l,m)=>{let q0=m.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(q0)f.push(`<style${q0[1]}>${q0[2]}</style>`);return""}),X0=X0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),f.length>0)a=`${a}${f.join(`
|
|
3672
|
+
`)}`}if(X&&X0.includes("{{ text || slot }}"))X0=X0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:K1}=await r("stx/slots",()=>import("./chunk-j8dg655g.js")),{defaultSlot:Y5,namedSlots:n}=k;X0=await K1(X0,Y5,n,y);let t=x.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),J0=tG(x),V0=Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[];if(J0.length>0||V0.length>0)y.__stx_client_signal_names=[...new Set([...V0,...J0])];let O0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:t||x.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let C0=await M4(X0,y,V,O0,U),H1=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let P of C0.matchAll(/\{\{([\s\S]*?)\}\}/g))H1.add(P[1].trim());if(H1.size>0)Y.__stx_preserved_client_expressions=[...H1];let S=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++lG}_${Math.random().toString(36).slice(2,8)}`,v=C0;if(t){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${U8(JSON.stringify(Z))}"`}catch{}let f=B?` stx-hydrate="${U8(B)}"`:"";v=`<div data-stx-scope="${S}"${P}${f}>${C0}</div>`;let l=await Promise.all(x.map(async(m)=>{let q0=m.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!q0)return m;let[,K0,B1]=q0,k0=b4(B1,{filePath:V,projectRoot:process.cwd()}),M0=k0.code,P0=y4(k0.styles);M0=D5(M0).code;let{hasUserImports:j1,bundleClientScript:y1}=await r("stx/client-script-bundler",()=>import("./chunk-749d2abw.js"));if(j1(M0))M0=await y1(M0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:$1}=await r("stx/signal-processing",()=>import("./chunk-gyf7n2as.js"));M0=M0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(s0,b5)=>$1(b5));let d=o0(M0),E0=iG(d),Z1=`function(__scopeId) {
|
|
3673
3673
|
${c1("const",[...W8,...E0],d)}
|
|
3674
3674
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3675
3675
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -3791,7 +3791,7 @@ else {
|
|
|
3791
3791
|
// STX: auto-generated event bindings
|
|
3792
3792
|
${$.map((X,J)=>Oq(X,J)).join(`
|
|
3793
3793
|
`)}`}function B8($){let Z=[],X=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=J.length,G=0;while(G<Q){let q=J[G];if(q==="'"||q==='"'||q==="`"){let U=q;if(G++,U==="`"){let W=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&W===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){W++,G+=2;continue}if(J[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===U){G++;break}G++}continue}if(q==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
|
|
3794
|
-
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let z=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=z[0].length;continue}let K=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}}G++}return Z}var Lq=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 wq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!Lq.has(j))Z.add(j)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=K.exec($))!==null)J(Q[1]);return Z}async function I$($,Z={}){let X=$,J="",Y=!1,Q=[],G=b4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=y4(G.styles),U=D5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:z}=await r("stx/client-script-bundler",()=>import("./chunk-
|
|
3794
|
+
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let z=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=z[0].length;continue}let K=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}}G++}return Z}var Lq=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 wq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!Lq.has(j))Z.add(j)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=K.exec($))!==null)J(Q[1]);return Z}async function I$($,Z={}){let X=$,J="",Y=!1,Q=[],G=b4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=y4(G.styles),U=D5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:z}=await r("stx/client-script-bundler",()=>import("./chunk-749d2abw.js"));if(W(X))X=await z(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let F=F8(X);X=F.code,J=L8(F.stxImports,F.browserImports.filter((L)=>!Q.includes(L)))}if(J=`${X4(X,Z.serverData)}${J}`,X=o0(X),!Y&&N1(Z.attrs||""))X=A1(X);let K=Fq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let F=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${F?` ${F}`:""}`;return`${q}<script ${L}>
|
|
3795
3795
|
${s1(`${J}${X}
|
|
3796
3796
|
${K}`)}
|
|
3797
3797
|
</script>`}let j=_8($),_=/function __stx_setup_/.test(X),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(F){let L=F.length>0?`
|