@stacksjs/stx 0.2.197 → 0.2.199
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/README.md +1 -1
- package/dist/{chunk-1yk07x7b.js → chunk-0kp3c02b.js} +1 -1
- package/dist/{chunk-338316c2.js → chunk-1ms6ey5t.js} +1 -1
- package/dist/{chunk-12nvcvtn.js → chunk-237jkeca.js} +1 -1
- package/dist/{chunk-14ynv5ah.js → chunk-241d3ex6.js} +1 -1
- package/dist/{chunk-hyyzp99b.js → chunk-2tfcqkdd.js} +1 -1
- package/dist/{chunk-tywvd1zc.js → chunk-31xczh3c.js} +1 -1
- package/dist/{chunk-g19skgmw.js → chunk-3jfg5kdy.js} +2 -2
- package/dist/{chunk-yab6d6kb.js → chunk-4v5fsrdd.js} +1 -1
- package/dist/{chunk-q020t182.js → chunk-6v4ddvfk.js} +1 -1
- package/dist/{chunk-r6p4ws0a.js → chunk-6wx32fa5.js} +17 -17
- package/dist/{chunk-6msvxnbr.js → chunk-79m0qkj6.js} +1 -1
- package/dist/{chunk-0w0mrtme.js → chunk-8a1524ge.js} +1 -1
- package/dist/{chunk-rdf7d42n.js → chunk-8gf8p3hq.js} +1 -1
- package/dist/{chunk-q4gp9egt.js → chunk-a2rry0gq.js} +1 -1
- package/dist/{chunk-v3ryxw4v.js → chunk-a438xffx.js} +1 -1
- package/dist/{chunk-avwj12at.js → chunk-a4mcc2dm.js} +1 -1
- package/dist/{chunk-p5kp35dy.js → chunk-ajr4qgbe.js} +1 -1
- package/dist/{chunk-s018d32j.js → chunk-bw1b1sw8.js} +1 -1
- package/dist/{chunk-4a4h28pp.js → chunk-cd8qdf35.js} +1 -1
- package/dist/{chunk-1thssz8x.js → chunk-cr4yw01r.js} +1 -1
- package/dist/{chunk-3m49eb4v.js → chunk-ebrcakdt.js} +1 -1
- package/dist/{chunk-zqbw8zqq.js → chunk-eggn1f96.js} +1 -1
- package/dist/{chunk-vj320kyr.js → chunk-fk5a0t90.js} +1 -1
- package/dist/{chunk-yv340gxj.js → chunk-gfgpf7h8.js} +1 -1
- package/dist/{chunk-118a77bs.js → chunk-h4pwf1bv.js} +7 -7
- package/dist/{chunk-2zkj69dg.js → chunk-haawrsc8.js} +1 -1
- package/dist/{chunk-y35rktea.js → chunk-hdtca0hs.js} +1 -1
- package/dist/{chunk-fd77g6t6.js → chunk-hx338p3h.js} +1 -1
- package/dist/{chunk-z5cm0bwn.js → chunk-jn49sc7r.js} +1 -1
- package/dist/{chunk-bpa2jeyw.js → chunk-m1awve2j.js} +1 -1
- package/dist/{chunk-r4qnvxhv.js → chunk-mvb60bhh.js} +1 -1
- package/dist/{chunk-5xd7vge2.js → chunk-n4v5733m.js} +1 -1
- package/dist/{chunk-ede7zpjf.js → chunk-ncgvbje8.js} +1 -1
- package/dist/{chunk-5mkkre22.js → chunk-q02jg1pk.js} +1 -1
- package/dist/{chunk-937effkz.js → chunk-qw5gmsv7.js} +1 -1
- package/dist/{chunk-dxfcyj8t.js → chunk-seac724e.js} +1 -1
- package/dist/{chunk-7kger0se.js → chunk-tke3ff0z.js} +2 -2
- package/dist/{chunk-5anpcnde.js → chunk-tks9sy8c.js} +1 -1
- package/dist/{chunk-yr2wc2pa.js → chunk-wq5cp9p1.js} +1 -1
- package/dist/{chunk-w29sv5jf.js → chunk-wzytd8fh.js} +1 -1
- package/dist/{chunk-7s0wfa4e.js → chunk-xgejppzh.js} +1 -1
- package/dist/{chunk-5v64c8tr.js → chunk-znes1shx.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/inline-assets.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Tr as v9,bs as U6,cs as W6}from"./chunk-8src5smc.js";import{hs as p0}from"./chunk-xp3fp266.js";import{ms as d5}from"./chunk-nye9brje.js";import{Gs as x9}from"./chunk-
|
|
2
|
+
import{Tr as v9,bs as U6,cs as W6}from"./chunk-8src5smc.js";import{hs as p0}from"./chunk-xp3fp266.js";import{ms as d5}from"./chunk-nye9brje.js";import{Gs as x9}from"./chunk-31xczh3c.js";import{Hs as K6,Js as z6,Ks as H6,Ms as j5}from"./chunk-cbc56wpd.js";import{Ns as g9,Rs as o5,Ts as i9}from"./chunk-x0zh76yv.js";import{ct as h9}from"./chunk-0ae6chzd.js";import{dt as Q8,et as $8,ft as l1,gt as G8,ht as E4,it as n2,jt as K2,kt as N9}from"./chunk-kjr22neh.js";import{Dt as f3,Ut as f9,Wt as dQ,Xt as h$,Zt as U5,tt as c3,wt as P2}from"./chunk-3952ykhb.js";import{cu as B6}from"./chunk-dtmwr674.js";import{hu as h}from"./chunk-pw0rzgpv.js";import b1 from"path";import I5 from"fs";var T4=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"]),I4={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"},H8=new Set(["ctrl","alt","shift","meta"]),b4={left:0,middle:1,right:2};function k4($){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 Y=X.toLowerCase();if(Y==="prevent")Z.prevent=!0;else if(Y==="stop")Z.stop=!0;else if(Y==="once")Z.once=!0;else if(Y==="capture")Z.capture=!0;else if(Y==="self")Z.self=!0;else if(Y==="passive")Z.passive=!0;else if(H8.has(Y))Z.systemKeys.push(Y);else if(Y in b4)Z.mouse=Y;else if(Y in I4||/^[a-z]$/.test(Y))Z.keys.push(I4[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);Z.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);Z.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return Z}function y4($){let Z=[],X=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec($))!==null){let[Q,G,q]=J,U=J.index,W=U+Q.length,K=`__stx_evt_${X++}`,z=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=H.exec(q))!==null){let[,_,V]=B,O=_.split("."),F=O[0];if(!T4.has(F))continue;z.push({attribute:`@${_}`,event:F,handler:V,modifiers:k4(O.slice(1)),elementId:K})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,V]=B,O=_.split("."),F=O[0];if(!T4.has(F))continue;z.push({attribute:`@${_}`,event:F,handler:V,modifiers:k4(O.slice(1)),elementId:K})}if(z.length>0)Z.push({originalTag:Q,elementId:K,events:z,startIndex:U,endIndex:W})}return Z}function B8($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let Y of X.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if(X.keys.length>0){let Y=X.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if(X.mouse!==null){let Y=b4[X.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function j8($,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 I$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function _8($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=B8($),J=j8(I$($.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=J.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 @@ ${l6($).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 nY($,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 J=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[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 m6=0,Bz=new O1(500),i6=new Set;function jz(){i6.clear()}function sY($){if($.__onceStore instanceof Set)return $.__onceStore;return i6}async function S3($,Z,X,Y,J,Q=new Set){let G=Y.partialsDir||U0.join(U0.dirname(X),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let q=cY($,"@partial","@include"),U=sY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,V,O)=>{let F=V.trim(),L=`${X}:${F}`;if(U.has(L))return"";return U.add(L),V});{let _=/@includeIf\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[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())J.add(T),A=`@include(${R})`;q=q.substring(0,O)+A+q.substring(w),_.lastIndex=0}}for(let[_,V]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.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=y3(N,0);if(T===-1){O.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=D;continue}let I=k[1],y=M.substring(k[0].length),E,b=y3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${A})`,x;if(Q0(C)){let m=G0(C,Object.keys(Z));x=Boolean(m(...Object.values(Z)))}else x=Boolean(X0(C,Z));let f=V?!x:x,n="";if(f){let m=W(I,G,X);if(m&&await Bun.file(m).exists())J.add(m);n=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+n+q.substring(D),O.lastIndex=0}catch(C){let x=C instanceof Error?C.message:String(C),f=W0("Include",`Error evaluating ${_} condition: ${x}`,X,$,L);q=q.substring(0,L)+f+q.substring(D),O.lastIndex=0}}}{let _=/@each\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[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(O,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(Q0(y))I=G0(y,Object.keys(Z))(...Object.values(Z));else I=X0(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},x=await H(T,C,$,O);E+=x}else if(k)E=await H(k,{},$,O);q=q.substring(0,O)+E+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,O)+W0("Each",`Error in @each: ${y}`,X,$,O)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[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(O,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=_0(M,Z)}catch(x){let f=x instanceof Error?x.message:String(x);if(Y.debug){let n=W0("Include",`Error parsing includeFirst variables: ${f}`,X,$,O,D);q=q.replace(D,()=>n)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let x of E){let f=W(x,G,X);if(!f)continue;if(await r(f)){let n=await H(x,b,$,O);q=q.replace(D,()=>n),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(Y.debug){let x=W0("Include",`None of the includeFirst paths exist: ${T}`,X,$,O,D);q=q.replace(D,()=>x)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=W0("Include",`Error processing @includeFirst: ${b}`,X,$,O,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,V,O){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let L=U0.resolve(V),w=U0.resolve(U0.dirname(O)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=U0.resolve(V,F);else R=U0.resolve(w,F);let D=U0.normalize(R),N=D.startsWith(L+U0.sep)||D===L,T=D.startsWith(w+U0.sep)||D===w,A=!1,M=U0.dirname(w);if(D.startsWith(M+U0.sep)){if(!U0.relative(M,D).split(U0.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 K=U0.resolve(X);Q.add(K);function z(_,V,O,F){return Y.onIncludeError?.({includePath:_,templatePath:X,message:V,partialsDir:G}),W0("Include",V,X,O,F)}async function H(_,V={},O,F){let L=W(_,G,X);if(!L)return z(_,`Could not resolve path for include: ${_}`,O,F);let w=U0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>U0.basename(D)).join(" -> ");return z(_,`Circular include detected: ${R}`,O,F)}try{J.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(f){let n=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${n}`,O,F)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-
|
|
3364
|
-
`;continue}if(V0)try{let{extractVariables:t}=await import("./chunk-
|
|
3365
|
-
`}}if(b){let f=nY(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await S3(D,k,L,Y,J,Q);let{processLoops:C}=await import("./chunk-
|
|
3363
|
+
})();`}function nY($,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 J=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[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 m6=0,Bz=new O1(500),i6=new Set;function jz(){i6.clear()}function sY($){if($.__onceStore instanceof Set)return $.__onceStore;return i6}async function S3($,Z,X,Y,J,Q=new Set){let G=Y.partialsDir||U0.join(U0.dirname(X),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let q=cY($,"@partial","@include"),U=sY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,V,O)=>{let F=V.trim(),L=`${X}:${F}`;if(U.has(L))return"";return U.add(L),V});{let _=/@includeIf\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[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())J.add(T),A=`@include(${R})`;q=q.substring(0,O)+A+q.substring(w),_.lastIndex=0}}for(let[_,V]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.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=y3(N,0);if(T===-1){O.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=D;continue}let I=k[1],y=M.substring(k[0].length),E,b=y3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${A})`,x;if(Q0(C)){let m=G0(C,Object.keys(Z));x=Boolean(m(...Object.values(Z)))}else x=Boolean(X0(C,Z));let f=V?!x:x,n="";if(f){let m=W(I,G,X);if(m&&await Bun.file(m).exists())J.add(m);n=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+n+q.substring(D),O.lastIndex=0}catch(C){let x=C instanceof Error?C.message:String(C),f=W0("Include",`Error evaluating ${_} condition: ${x}`,X,$,L);q=q.substring(0,L)+f+q.substring(D),O.lastIndex=0}}}{let _=/@each\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[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(O,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(Q0(y))I=G0(y,Object.keys(Z))(...Object.values(Z));else I=X0(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},x=await H(T,C,$,O);E+=x}else if(k)E=await H(k,{},$,O);q=q.substring(0,O)+E+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,O)+W0("Each",`Error in @each: ${y}`,X,$,O)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[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(O,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=_0(M,Z)}catch(x){let f=x instanceof Error?x.message:String(x);if(Y.debug){let n=W0("Include",`Error parsing includeFirst variables: ${f}`,X,$,O,D);q=q.replace(D,()=>n)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let x of E){let f=W(x,G,X);if(!f)continue;if(await r(f)){let n=await H(x,b,$,O);q=q.replace(D,()=>n),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(Y.debug){let x=W0("Include",`None of the includeFirst paths exist: ${T}`,X,$,O,D);q=q.replace(D,()=>x)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=W0("Include",`Error processing @includeFirst: ${b}`,X,$,O,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,V,O){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let L=U0.resolve(V),w=U0.resolve(U0.dirname(O)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=U0.resolve(V,F);else R=U0.resolve(w,F);let D=U0.normalize(R),N=D.startsWith(L+U0.sep)||D===L,T=D.startsWith(w+U0.sep)||D===w,A=!1,M=U0.dirname(w);if(D.startsWith(M+U0.sep)){if(!U0.relative(M,D).split(U0.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 K=U0.resolve(X);Q.add(K);function z(_,V,O,F){return Y.onIncludeError?.({includePath:_,templatePath:X,message:V,partialsDir:G}),W0("Include",V,X,O,F)}async function H(_,V={},O,F){let L=W(_,G,X);if(!L)return z(_,`Could not resolve path for include: ${_}`,O,F);let w=U0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>U0.basename(D)).join(" -> ");return z(_,`Circular include detected: ${R}`,O,F)}try{J.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(f){let n=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${n}`,O,F)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-a438xffx.js");R=f(R,Z)}if(R&&(Y.debug||!H5()&&!c5()))try{let{warnUnbalancedTags:f}=await import("./chunk-ehfzp7xe.js");f(R,L)}catch{}let D=R;try{let{processESImports:f}=await import("./chunk-ebrcakdt.js");await f(R,Z,L,Y,J)}catch(f){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,f instanceof Error?f.message:f)}let N=J$(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[f,n]of Object.entries(V))k[f]=n;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(I)],E="",b=null;for(let f of y){let n=f[1]||"",m=f[2]||"",V0=n.includes("server"),A0=N1(n),M0="";try{let{extractAndStripCssImports:t,renderVendorStyleTags:K0}=await import("./chunk-qw5gmsv7.js"),q0=t(m,{filePath:L,projectRoot:process.cwd()});m=q0.code,M0=K0(q0.styles)}catch(t){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,t instanceof Error?t.message:t)}if(A0&&m.trim())m=A1(m);if(!V0)try{let{hasUserImports:t,bundleClientScript:K0}=await import("./chunk-hx338p3h.js");if(t(m))m=await K0(m,L,{projectRoot:process.cwd()})}catch(t){if(Y.debug)console.warn(`[stx] bundler skipped for ${L}:`,t instanceof Error?t.message:t)}let g0=pY(m);if(g0&&!V0){b=`stx_scope_${U0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++m6}`;let t=o0(m),K0=iY(t,b);E+=`${M0}<script data-stx-scoped data-stx-run="always">${K0}</script>
|
|
3364
|
+
`;continue}if(V0)try{let{extractVariables:t}=await import("./chunk-8a1524ge.js");await t(m,k,L)}catch(t){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,t)}if(!V0&&!g0){let t=n.replace(/\bclient\b/i,"").trim();b=`stx_scope_${U0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++m6}`;let K0=o0(m),q0=p6(K0,b),B1=c6(K0,q0);E+=`${M0}<script data-stx-scoped data-stx-run="always"${t?` ${t}`:""}>${B1}</script>
|
|
3365
|
+
`}}if(b){let f=nY(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await S3(D,k,L,Y,J,Q);let{processLoops:C}=await import("./chunk-79m0qkj6.js"),x=C(D,k,L);if(x=a0(x,k,L),x=_1(x,k,L),M)x+=`
|
|
3366
3366
|
`+M;if(E)x+=`
|
|
3367
3367
|
`+E;return x}catch(R){let D=R instanceof Error?R.message:String(R);return z(_,`Error processing include ${_}: ${D}`,O,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,V=_+j[0].length-1,O=1,F=V+1;while(F<q.length&&O>0){if(q[F]==="(")O++;else if(q[F]===")")O--;F++}if(O!==0)break;let L=q.substring(_,F),w=q.substring(V+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=y3(T,0);if(A!==-1)N=T.substring(A+1).trim();let M={};if(N)try{M=_0(N,Z)}catch(I){let y=I instanceof Error?I.message:String(I);q=q.replace(L,W0("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 C3($,Z){let X=$;function Y(J,Q,G,q){let U=J,W=!0;while(W){W=!1;let K=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=U.match(K);if(!z||z.index===void 0)break;let H=z.index,B=z[1],j=H+z[0].length,_=new RegExp(`@${Q}\\(`),V=new RegExp(`@${G}(?![a-z])`),O=1,F=j,L=-1;while(O>0&&F<U.length){let R=U.slice(F),D=R.match(_),N=R.match(V),T=D?F+D.index:1/0,A=N?F+N.index:1/0;if(T<A)O++,F=T+(D[0].length||1);else if(A<1/0){if(O--,O===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=Y(X,"push","endpush",!1),X=Y(X,"prepend","endprepend",!0),X}function P3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,Y)=>{if(!Z[Y]||Z[Y].length===0)return"";return Z[Y].join(`
|
|
3368
3368
|
`)})}import*as v3 from"path";async function n6($,Z,X=""){if(v3.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 o6($,Z,X,"@js","@endjs")}async function s6($,Z,X=""){if(v3.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 o6($,Z,X,"@ts","@endts")}async function o6($,Z,X,Y,J){let Q=$,G=v1(`${Y}([\\s\\S]*?)${J}`,"g"),q=[],U;while((U=G.exec($))!==null)q.push({fullMatch:U[0],content:U[1]||"",index:U.index});for(let{fullMatch:W,content:K,index:z}of q)try{let H={...Z,global:Z},B=Object.keys(H),j=Object.values(H),_=K.trim();if(Y==="@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 O=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=O.length>0?`return { ${O.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 g5($,(G)=>`${G}
|
|
3536
3536
|
${Z}`);return`${Z}
|
|
3537
|
-
${$}`}async function B$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return i3($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return i3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-
|
|
3537
|
+
${$}`}async function B$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return i3($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return i3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-n4v5733m.js"),Y=await X(Z.debug);return i3($,`<script data-stx-scoped data-stx-runtime>${Y}</script>`)}function tJ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function d2($){if($.includes("data-stx-tooltip-runtime")||!tJ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${p3()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
|
|
3538
3538
|
${Z}`;return`${$.slice(0,X)}${Z}
|
|
3539
3539
|
${$.slice(X)}`}async function eJ($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let X=Z?.router,Y="";{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 x2(Z?.pagesDir);if(U.length>0)q.ownedRoutes=U}catch{}if(Object.keys(q).length>0)Y=`<script>window.__stxRouterConfig=${g2(q)};</script>
|
|
3540
|
-
`}let{getCachedRouterScript:J}=await import("./chunk-
|
|
3540
|
+
`}let{getCachedRouterScript:J}=await import("./chunk-n4v5733m.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 J()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+Y+Q+`
|
|
3541
3541
|
</body>`+$.slice(G+7)}var m2=Symbol.for("stx.lazy-module-promises");function $Q(){let $=globalThis;return $[m2]??=new Map,$[m2]}function a($,Z){let X=$Q(),Y=`${import.meta.url}\x00${$}`,J=X.get(Y);if(J)return J;let Q=Z();return X.set(Y,Q),Q.catch(()=>{if(X.get(Y)===Q)X.delete(Y)}),Q}var ZQ=0,s3=`(?:"[^"]*"|'[^']*'|[^>"'])*`,s2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function XQ($,Z={}){let X=[];for(let Y of f5($,Y1)){let J=Y.token.match(/^<script\b([^>]*)>/i),Q=Y.token.match(/<\/script\s*>$/i);if(!J||!Q)continue;let G=J[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=J[0].length,U=Y.token.length-Q[0].length;X.push({fullMatch:Y.token,attrs:G,body:Y.token.slice(q,U),start:Y.start,end:Y.end})}return X}function o2($){let Z=$.trim(),X=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(X){let J=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:q}=l2(Q);if(G)return{style:"as",iterable:J,itemVar:G,indexVar:q}}let Y=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let J=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:q}=l2(J);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function l2($){let Z=$.trim(),X=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(X)return{itemVar:X[2],indexVar:X[1]};let Y=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let J=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function r3($){return n2($)}function YQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,X=0,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(J.startsWith("if"))X++;else if(J==="endif")X--;else if(X===0)return!0}return!1}function JQ($){let Z=new Set,X=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=X.exec($))!==null){let Q=J[1],G;while((G=Y.exec(Q))!==null)Z.add(G[1])}return Z}function QQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${s3})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,Y=f5($,(Q,G)=>{Z.lastIndex=G;let q=Z.exec(Q);if(!q||q.index!==G||!X.test(q[2]))return-1;return Z.lastIndex}),J=[];for(let Q of Y){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let q=G[2].match(X),U=o2(q?.[1]??q?.[2]??""),W=[U.itemVar,U.indexVar].filter(Boolean);if(W.length===0)continue;let K=G[1],H=/\/\s*>$/.test(Q.token)||_$.has(K.toLowerCase())?Q.end:a2($,Q.start,K,Q.end);if(H!==-1)J.push({start:Q.start,end:H,vars:new Set(W)})}return J}var c2=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 GQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function p2($,Z,X,Y){if(!$)return!1;let J=GQ($),Q=!1,G=!1,q=!1,U=/([a-zA-Z_$][\w$]*)/g,W;while((W=U.exec(J))!==null){let B=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(c2.has(B))continue;if(Z.has(B)||Y?.has(B))Q=!0;else if(X&&B in X)G=!0}let K=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=K.exec(J))!==null){let B=z[1];if(J.slice(0,z.index).trimEnd().endsWith("."))continue;if(c2.has(B)||X&&B in X)continue;q=!0}return(Q||q)&&!G}function j$($,Z,X){let Y=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,""")}"`,J=$.trim(),Q=J.match(s2);if(Q&&qQ(Q[3],Q[1])){let[,G,q,U]=Q;return`<${G}${q}${Y}>${U}</${G}>`}return`<template${Y}>${J}</template>`}function qQ($,Z){let X=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),Y=0,J;while((J=X.exec($))!==null)if(J[1]){if(Y--,Y<0)return!1}else Y++;return!0}function r2($,Z){let X=JQ($);function Y(J){let Q=J,G=QQ(J),q=(z)=>{let H=new Set;for(let B of G)if(z>B.start&&z<B.end)for(let j of B.vars)H.add(j);return H},U=/@if\s*\(/g,W,K=[];while((W=U.exec(Q))!==null){let z=W.index,H=z+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(),V=j,O=1,F=V,L=/@(if\s*\(|endif)/g;L.lastIndex=V;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){F=w.index+w[0].length;break}}if(O!==0)continue;let R=Q.substring(V,F-6).trim(),D;if(YQ(R)){let N=_5(Q.substring(z,F));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),A=q(z);if(!(T.length>0&&T.every((I)=>p2(I.condition,X,Z,A))))continue;D=N[0].branches.map((I)=>{let y=Y(I.content);if(I.type==="elseif")return j$(y,"@else-if",I.condition??"");if(I.type==="else")return j$(y,"@else");return j$(y,"@if",I.condition??"")}).join(`
|
|
3542
3542
|
`)}else{if(!p2(_,X,Z,q(z)))continue;D=j$(Y(R),"@if",_)}K.push({start:z,end:F,replacement:D}),U.lastIndex=F}for(let z=K.length-1;z>=0;z--){let{start:H,end:B,replacement:j}=K[z];Q=Q.substring(0,H)+j+Q.substring(B)}return Q}return Y($)}function UQ($){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 J=Number(Z);return J!==0&&!Number.isNaN(J)}let X=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(X)return X[1].length>0;let Y=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}var _$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function a2($,Z,X,Y){if(_$.has(X.toLowerCase()))return Y;let J=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,U=Y;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 K=/^<(script|style)\b/i.exec($.slice(U,U+8));if(K){let B=$.indexOf(">",U);if(B===-1)return-1;if($[B-1]==="/"){U=B+1;continue}let j=Q.indexOf(`</${K[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()===J){if(q--,U+=B[0].length,q===0)return U;continue}U+=B[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(U,U+64));if(!z){U++;continue}let H=$.indexOf(">",U);if(H===-1)return-1;if(z[1].toLowerCase()===J){let B=$.slice(U,H+1);if(!(/\/\s*>$/.test(B)||_$.has(J)))q++}U=H+1}return-1}var WQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function KQ($,Z){let X=Z,Y=$.length;for(;;){while(X<Y&&$[X]!=="<")X++;if(X>=Y)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 J=$.indexOf(">",X);if(J===-1)return!1;let Q=$.slice(X,J+1);return WQ.test(Q)}function t2($){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,Y;while((Y=X.exec($))!==null)Z.push([Y.index,Y.index+Y[0].length]);let J=(z)=>Z.some(([H,B])=>z>=H&&z<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(J(q.index))continue;let[z,H,B,j,_,V,O]=q,F=UQ(_);if(F===void 0)continue;let L=q.index,w=L+z.length,N=!!O||/\/\s*>$/.test(z)||_$.has(H.toLowerCase())?w:a2($,L,H,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&KQ($,N)){Q.lastIndex=w;continue}if(F===!0){let A=`<${H}${B}${V}${O}>`;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((z,H)=>z.start-H.start);let U=[],W=-1;for(let z of G){if(z.start<W)continue;U.push(z),W=z.end}let K=$;for(let z=U.length-1;z>=0;z--){let{start:H,end:B,replacement:j}=U[z];K=K.substring(0,H)+j+K.substring(B)}return K}function e2($,Z){let X=$,Y=/@(for|foreach)\s*\(/g,J,Q=[],G=[];while((J=Y.exec(X))!==null){let q=J[1],U=J.index,W=U+J[0].length,K=1,z=W;while(z<X.length&&K>0){if(X[z]==="(")K++;else if(X[z]===")")K--;z++}if(K!==0)continue;let H=X.substring(W,z-1).trim(),B=z,j=o2(H),_=q==="for"?"@endfor":"@endforeach",V=1,O=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))V++;else if(V--,V===0){O=L.index+L[0].length;break}if(V!==0)continue;let w=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)G.push({start:U,end:O,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,O-_.length).trim(),D=R.match(s2),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:O,replacement:N})}for(let q=Q.length-1;q>=0;q--){let{start:U,end:W,replacement:K}=Q[q];X=X.substring(0,U)+K+X.substring(W)}return X}function zQ($){let Z=new Set,X=[],Y=0,J=0,Q=$.length,G=(K)=>{let z=Y+1;while(z<Q){let H=$[z];if(H==="\\"){z+=2;continue}if(H===K)return z+1;z++}return Q},q=()=>{let K=Y+2;while(K<Q&&$[K]!==`
|
|
3543
3543
|
`)K++;return K},U=()=>{let K=Y+2;while(K<Q-1){if($[K]==="*"&&$[K+1]==="/")return K+2;K++}return Q},W=(K)=>{let z=K,H=0;while(z<Q){let B=$[z];if(B==="/"&&$[z+1]==="/"){let j=z+2;while(j<Q&&$[j]!==`
|
|
3544
|
-
`)j++;z=j;continue}if(B==="/"&&$[z+1]==="*"){let j=z+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=z+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}z=j;continue}if(B==="("||B==="["||B==="{"){H++,z++;continue}if(B===")"||B==="]"||B==="}"){H--,z++;continue}if(B===";"&&H===0)return z+1;z++}return Q};while(Y<Q){let K=$[Y];if(K==="/"&&$[Y+1]==="/"){let z=q();X.push($.slice(Y,z)),Y=z;continue}if(K==="/"&&$[Y+1]==="*"){let z=U();X.push($.slice(Y,z)),Y=z;continue}if(K==='"'||K==="'"||K==="`"){let z=G(K);X.push($.slice(Y,z)),Y=z;continue}if(K==="{"){J++,X.push(K),Y++;continue}if(K==="}"){J--,X.push(K),Y++;continue}if(J===0){let z=Y>0?$[Y-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(Y+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),Y=_;continue}Z.add(j),X.push($.slice(Y,_)),Y=_;continue}}}X.push(K),Y++}return X.join("")}async function HQ($,Z,X){let Y=XQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\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 V of Y){let O=V.body;if(N1(V.attrs))O=A1(O);if(J.test(O))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${ZQ++}`,{hasUserImports:q,bundleClientScript:U}=await a("stx/client-script-bundler",()=>import("./chunk-
|
|
3544
|
+
`)j++;z=j;continue}if(B==="/"&&$[z+1]==="*"){let j=z+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=z+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}z=j;continue}if(B==="("||B==="["||B==="{"){H++,z++;continue}if(B===")"||B==="]"||B==="}"){H--,z++;continue}if(B===";"&&H===0)return z+1;z++}return Q};while(Y<Q){let K=$[Y];if(K==="/"&&$[Y+1]==="/"){let z=q();X.push($.slice(Y,z)),Y=z;continue}if(K==="/"&&$[Y+1]==="*"){let z=U();X.push($.slice(Y,z)),Y=z;continue}if(K==='"'||K==="'"||K==="`"){let z=G(K);X.push($.slice(Y,z)),Y=z;continue}if(K==="{"){J++,X.push(K),Y++;continue}if(K==="}"){J--,X.push(K),Y++;continue}if(J===0){let z=Y>0?$[Y-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(Y+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),Y=_;continue}Z.add(j),X.push($.slice(Y,_)),Y=_;continue}}}X.push(K),Y++}return X.join("")}async function HQ($,Z,X){let Y=XQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\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 V of Y){let O=V.body;if(N1(V.attrs))O=A1(O);if(J.test(O))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${ZQ++}`,{hasUserImports:q,bundleClientScript:U}=await a("stx/client-script-bundler",()=>import("./chunk-hx338p3h.js")),W=[];for(let V=0;V<Q.length;V++){let O=Q[V].content;if(O=R5(O).code,q(O))O=await U(O,Z||"",{projectRoot:process.cwd()});O=O.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L,w)=>jQ(w));let F=o0(O);W.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
|
|
3545
3545
|
${F}`)}let K=W.join(`
|
|
3546
3546
|
|
|
3547
3547
|
`);K=zQ(K);let z=BQ(K),H=z.split(",").map((V)=>V.trim()).filter(Boolean),B=o3(K,X),j=`
|
|
@@ -3597,7 +3597,7 @@ ${I}
|
|
|
3597
3597
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
3598
3598
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
3599
3599
|
</style>`}};import{existsSync as RQ,readFileSync as DQ}from"fs";var k1=new Map,K9=new Set;function z9($){if(K9.has($))return;K9.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function H9($){let Z=process.cwd();for(let X of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(RQ(X))return X;for(let X of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return h.resolve(X)}catch{}return null}function NQ($){if(k1.has($))return k1.get($);let Z=H9($);if(!Z)return z9($),null;try{let X=JSON.parse(DQ(Z,"utf8"));return k1.set($,X.icons),X.icons}catch{return null}}async function AQ($,Z=!1){if(k1.has($))return k1.get($);let X=H9($);if(!X){if(!Z)z9($);return null}try{let Y=await Bun.file(X).json();return k1.set($,Y.icons),Y.icons}catch{return null}}function t1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var K4={name:"Icon",aliases:["icon","stx-icon"],render($,Z,X){let Y=t1($,"name")??t1($,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",Q=Y;if(Y.includes(":")){let F=Y.split(":");J=F[0],Q=F[1]}let G=j0(t1($,"size")||"24"),q=j0(t1($,"color")||"currentColor"),U=j0(t1($,"class")||""),W=j0(t1($,"style")||""),K=k1.get(J)??NQ(J);if(!K)return`<!-- Icon: collection "${J}" not loaded -->`;let z=K[Q];if(!z)return`<!-- Icon: "${Q}" not found in ${J} -->`;let H=z.width||24,B=z.height||24,j=`0 0 ${H} ${B}`,_=z.body;if(q!=="currentColor")_=_.replace(/currentColor/g,q);let V=U?` class="${U}"`:"",O=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${V}${O}>${_}</svg>`}};async function MQ($="lucide",Z={}){await AQ($,Z.speculative??!0)}function B9($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Y=$.static[X];if(typeof Y==="string")return Y}return}function j9($,Z){let X=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=$.match(X);if(!Y)return{region:null,rest:$};return{region:Y[2],rest:$.replace(Y[0],"")}}var z4={name:"Suspense",aliases:["suspense"],render($,Z,X){let Y=j9(Z,"fallback"),J=Y.rest,Q=j9(J,"error"),G=Q.rest,q=Y.region??B9($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',U=Q.region??B9($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${q}</div><div data-stx-suspense-error hidden>${U}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function F$($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Y=$.static[X];if(typeof Y==="string")return Y}return}var H4={name:"TransitionGroup",aliases:["transition-group"],render($,Z,X){let Y=(F$($,"name")||"v").replace(/["'<>]/g,""),J=(F$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=F$($,"class"),G=F$($,"id"),q=[`data-stx-transition-group="${Y}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${J} ${q}>${Z}</${J}>`}};function _9(){k0.registerBuiltin(e3),k0.registerBuiltin(Y4),k0.registerBuiltin(J4),k0.registerBuiltin(G4),k0.registerBuiltin(q4),k0.registerBuiltin(U4),k0.registerBuiltin(W4),k0.registerBuiltin(K4),k0.registerBuiltin(z4),k0.registerBuiltin(H4)}function L$($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function O9($,Z,X){let Y=[],J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;let q=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!q){J=Q+1;continue}let U=q[1];if(X&&X.has(U.toLowerCase())){let _=Q+1+U.length;while(_<$.length&&$[_]!==">")_++;J=_+1;continue}let W=Q+1+U.length,K=null,z=W,H=-1,B=!1;while(W<$.length){let _=$[W];if(K){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===K)K=null;W++;continue}if(_==='"'||_==="'"){K=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){H=W+2,B=!0;break}if(_===">"){H=W+1;break}W++}if(H===-1){J=Q+1;continue}let j=$.slice(z,B?H-2:H-1).trim();if(B)Y.push({fullMatch:$.slice(Q,H),tagName:U,attributes:j,content:"",startIndex:Q,endIndex:H,isSelfClosing:!0}),J=H;else{let _=`<${U}`,V=`</${U}>`,O=1,F=H,L=-1;while(O>0&&F<$.length){let D=$.indexOf(_,F),N=$.indexOf(V,F);if(N===-1)break;if(D!==-1&&D<N){let T=$[D+_.length];if(T===" "||T===">"||T==="/"||T===`
|
|
3600
|
-
`||T==="\t")O++;F=D+_.length}else{if(O--,O===0){L=N;break}F=N+V.length}}if(L===-1){J=H;continue}let w=$.slice(H,L),R=L+V.length;Y.push({fullMatch:$.slice(Q,R),tagName:U,attributes:j,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),J=R}}return Y}function V9($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function F9($,Z){try{let X=Buffer.from($,"base64").toString("utf8");return JSON.parse(X)}catch{}try{let X=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(X)}catch(X){if(Z?.debug)console.error("Error decoding __stx_ prop:",X);return $}}import R$ from"fs";import C0 from"path";var L9=!1,TQ=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function IQ($,Z,X){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},J=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),Q=(W)=>{if(J.size===0)return!1;let K=p0(W),z=K.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(z&&J.has(z))return!0;for(let H of J){let B=H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(K))return!0}return!1},G=new Set(N9),q=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(K,z)=>z.toUpperCase())},U=(W,K)=>{let z=q(W);if(Y.static[z]=K,z!==W)Y.staticNames[z]=W};for(let[W,K]of Object.entries($)){let z=W.startsWith("x-")&&!G.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(z.startsWith("@")){Y.events[z]=K;continue}if(z.startsWith("__stx_")){let H=q(z.slice(6));Y.serverDynamic[H]=F9(K,X);continue}if(z.startsWith(":")){let H=q(z.slice(1)),B=K===I1?H:K;if(H==="if"||H==="for"||H==="show"){Y.clientReactive[H]=B;continue}if(Q(B)){Y.clientReactive[H]=B;continue}try{if(!Q0(B)){if(X.debug)console.error(`Unsafe expression in :${H} binding: ${B}`);Y.clientReactive[H]=B;continue}let j=Object.keys(Z),V=G0(B,j)(...Object.values(Z));if(V===void 0){let O=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],F=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(O.some((w)=>!F.has(w)&&!j.includes(w))){Y.clientReactive[H]=B;continue}}if(Y.serverDynamic[H]=V,H!==z.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[H]=z.slice(1)}catch{Y.clientReactive[H]=B}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let H=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(H)try{let B=H[1];if(Q0(B)){let _=G0(B,Object.keys(Z))(...Object.values(Z));U(z,_!=null?String(_):"")}else{if(X.debug)console.error(`Unsafe expression in ${z}: ${B}`);U(z,K)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${z}:`,B);U(z,K)}else{let B=K,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(K))!==null)try{let V=_[1];if(!Q0(V)){if(X.debug)console.error(`Unsafe expression in ${z}: ${V}`);continue}let F=G0(V,Object.keys(Z))(...Object.values(Z));B=B.replace(_[0],String(F??""))}catch(V){if(X.debug)console.error(`Error evaluating expression in ${z}:`,V)}U(z,B)}continue}U(z,K===I1?"true":V9(K))}return Y}var kQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function EQ($,Z,X){if(!$.includes("@"))return $;if(!kQ.some(([J,Q])=>J.test($)&&$.includes(Q)))return $;try{return a0($,Z,X)}catch{return $}}function bQ($){let Z={},X=0,Y=$.length;while(X<Y){while(X<Y&&/\s/.test($[X]))X++;if(X>=Y)break;let J="";while(X<Y&&!/[\s=]/.test($[X]))J+=$[X],X++;if(!J)break;while(X<Y&&/\s/.test($[X]))X++;if(X<Y&&$[X]==="="){X++;while(X<Y&&/\s/.test($[X]))X++;let Q="";if(X<Y&&($[X]==='"'||$[X]==="'")){let G=$[X];X++;while(X<Y){let q=$[X];if(q==="\\"&&X+1<Y){X++,Q+=$[X],X++;continue}if(q===G){X++;break}Q+=q,X++}}else while(X<Y&&!/\s/.test($[X]))Q+=$[X],X++;Z[J]=Q}else Z[J]=I1}return Z}function w9($){return Object.entries($).map(([Z,X])=>X===I1?Z:`${Z}="${yQ(X)}"`).join(" ")}function yQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function SQ($){let Z=new Set,X=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=X.exec($))!==null){let J=Y[1];if(k0.isBuiltin(J))Z.add(J)}return[...Z].sort()}var R9=new Map;function CQ($){let Z=R9.get($);if(Z)return Z;let X=new Map,Y=[C0.join($,"src"),C0.join($,"dist"),$];function J(Q,G){if(G>6)return;let q;try{q=R$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let U of q){let W=C0.join(Q,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;J(W,G+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let K=U.name.slice(0,-4);if(!X.has(K))X.set(K,W);let z=K.toLowerCase();if(!X.has(z))X.set(z,W);let H=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,W)}}}for(let Q of Y)if(J(Q,0),X.size>0)break;return R9.set($,X),X}function PQ($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let Y=C0.join(X,"node_modules",$);try{if(R$.statSync(Y).isDirectory())return Y}catch{}let J=C0.dirname(X);if(J===X)return null;X=J}}async function vQ($,Z,X,Y,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=C0.dirname(X),q=$,U=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(U,(W,K,z)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,_=[];while((j=H.exec(z))!==null){let[V,O,F,L]=j,w=null,R=null;if(L.startsWith(".")||L.startsWith("/")){let T=C0.resolve(G,L);if(T.endsWith(".stx"))R=T;else{let A=`${T}.stx`;try{if(R$.statSync(A).isFile())R=A}catch{try{if(R$.statSync(T).isDirectory())w=T}catch{}}}}else w=PQ(L,G);if(!w&&!R)continue;let D=!1,N=(T,A)=>{Q.set(T,A),Q.set(T.toLowerCase(),A);let M=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,A),J.add(A)};if(F&&R)N(F,R),D=!0;else if(O){let T=O.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let k=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:M,local:M}}),A=w?CQ(w):null;for(let{source:M,local:k}of T){let I=null;if(R)I=R;else if(A)I=A.get(M)??A.get(M.toLowerCase())??A.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(k,I),D=!0}}if(D)_.push({start:j.index,end:j.index+V.length})}if(_.length===0)return W;for(let V=_.length-1;V>=0;V--)B=B.slice(0,_[V].start)+B.slice(_[V].end);return`<script${K}>${B}</script>`}),q}async function fQ($,Z,X,Y,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,U;while((U=q.exec(Q))!==null){let[W,K]=U,z=K.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of z){let B=H.split("/"),_=B[B.length-1].replace(/\.stx$/,""),V=_.includes("-")?_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),O=null,F=[C0.resolve(C0.dirname(X),`${H}.stx`),C0.resolve(C0.dirname(X),H),C0.resolve(Y.componentsDir||"components",`${H}.stx`),C0.resolve(Y.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let L of F)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(V,O),G.set(_,O),G.set(_.toLowerCase(),O);let L=V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),J.add(O),Y.debug)console.log(`Imported component: ${V} -> ${O}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(W,""),q.lastIndex=0}return Q}async function xQ($,Z,X,Y,J){let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=/@component\s*\(/g,W;while((W=U.exec(Q))!==null){let K=W.index,z=K+W[0].length-1,H=1,B=z+1;while(B<Q.length&&H>0){if(Q[B]==="(")H++;else if(Q[B]===")"){if(H--,H===0)break}B++}if(H!==0)break;let j=Q.substring(z+1,B),_=B+1,V=j.match(/^\s*['"]([^'"]+)['"]/);if(!V){U.lastIndex=0;continue}let O=V[1],F,L=j.slice(V[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let R={};if(F)try{R=_0(F,Z)}catch(k){let I=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(K,_),`[Error parsing component props: ${I}]`);continue}let D="",N=_,A=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(A)D=A[1].trim(),N=_+A[0].length;let M=await T1(O,R,D,G,Z,X,Y,q,J);Q=Q.substring(0,K)+M+Q.substring(N),U.lastIndex=0}return Q}async function gQ($,Z,X,Y,J){if(!$)return $;let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=c0(Q);return Q=U.output,Q=await H(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await H(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await H(Q,/[a-z][a-z0-9]*/,!1,TQ),Q=C1(Q,U.scripts),Q;async function H(B,j,_,V){if(!B)return B;let O=B,F=O9(O,j,V);for(let L=F.length-1;L>=0;L--){let w=F[L],R=_?L$(w.tagName):w.tagName,D=bQ(EQ(w.attributes,Z,X)),N=IQ(D,Z,Y),T=k0.getBuiltin(w.tagName),A=T?await w$(R,G,Z,X,Y):!1;if(T&&!A){let y={context:Z,filePath:X,options:Y,dependencies:J},E=T.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)E=D9(E,N.clientReactive);if(Object.keys(N.events).length>0){let b=w9(N.events);E=E.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,w.startIndex)+E+O.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await w$(R,G,Z,X,Y))continue;let M={};for(let[y,E]of Object.entries(N.static))M[y]=E;for(let[y,E]of Object.entries(N.serverDynamic))M[y]=E;let I=await T1(R,M,C1(w.content,U.scripts),G,Z,X,Y,q,J);if(Object.keys(N.clientReactive).length>0)I=D9(I,N.clientReactive);if(Object.keys(N.events).length>0){let y=A9(I);if(y){let E=w9(N.events),b=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${E}`+I.substring(y.insertPos)}}O=O.substring(0,w.startIndex)+I+O.substring(w.endIndex)}return O}}function D9($,Z){let X=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries(Z).filter(([K])=>!X.has(K)),Q=J.filter(([K])=>!Y.has(K)).map(([K])=>L$(K)).join(" "),G=$,q=J.length>0?A9(G):null;if(q){let K=J.map(([H,B])=>`:${L$(H)}="${B.replace(/"/g,""")}"`).join(" "),z=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,q.insertPos)+`${z} ${K}`+G.substring(q.insertPos)}let U=Z.if;if(U)G=`<template :if="${U.replace(/"/g,""")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,""")}">${G}</template>`;return G}function A9($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let X=0;while(X<$.length){let Y=$.slice(X),J=Y.match(/^\s+/);if(J){X+=J[0].length;continue}if(Y.startsWith("<!--")){let q=$.indexOf("-->",X+4);if(q===-1)return null;X=q+3;continue}let Q=Y.match(/^<(script|style)\b[^>]*>/i);if(Q){let q=`</${Q[1].toLowerCase()}>`,U=$.toLowerCase().indexOf(q,X+Q[0].length);if(U===-1)return null;X=U+q.length;continue}let G=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:X+1+G[1].length}}return null}async function B4($,Z,X,Y,J){if(!L9)_9(),L9=!0;let Q=await vQ($,Z,X,Y,J);Q=await fQ(Q,Z,X,Y,J),Q=await xQ(Q,Z,X,Y,J);let G=[];for(let q=0;q<3;q++){let U=l0(Q,Q5,(K,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...U.tokens);let W=Q;if(Q=await gQ(U.output,Z,X,Y,J),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,U)=>G[Number(U)]??"");if(Y.debug){let q=SQ(Q);if(q.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import $5 from"path";import M9 from"process";function e1($="STX_PUBLIC_"){let Z={},X={};for(let[Y,J]of Object.entries(M9.env)){if(!Y.startsWith($)||J===void 0)continue;Z[`import.meta.env.${Y}`]=JSON.stringify(J),X[Y]=J}return Z["import.meta.env"]=JSON.stringify(X),Z}function $j($="STX_PUBLIC_"){let Z={};for(let[X,Y]of Object.entries(M9.env))if(X.startsWith($)&&Y!==void 0)Z[X]=Y;return Z}function T9($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function I9($,Z,X){try{let Y;if($.startsWith("/")){let J=Z;for(let Q=0;Q<5;Q++){let G=$5.join(J,$);if(await Bun.file(G).exists())return G;J=$5.dirname(J)}Y=$5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))Y=$5.resolve(Z,$);else Y=$5.resolve(Z,$);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function k9($,Z,X){let Y=$,J=$5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(Y))!==null){let[W,K,z,H]=G;if(T9(z))continue;let B=await I9(z,J,Z);if(B)try{let j=await Bun.file(B).text();if(X.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let V=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:e1()});if(V.outputs.length>0)j=await V.outputs[0].text()}let _=`<script>
|
|
3600
|
+
`||T==="\t")O++;F=D+_.length}else{if(O--,O===0){L=N;break}F=N+V.length}}if(L===-1){J=H;continue}let w=$.slice(H,L),R=L+V.length;Y.push({fullMatch:$.slice(Q,R),tagName:U,attributes:j,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),J=R}}return Y}function V9($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function F9($,Z){try{let X=Buffer.from($,"base64").toString("utf8");return JSON.parse(X)}catch{}try{let X=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(X)}catch(X){if(Z?.debug)console.error("Error decoding __stx_ prop:",X);return $}}import R$ from"fs";import C0 from"path";var L9=!1,TQ=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function IQ($,Z,X){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},J=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),Q=(W)=>{if(J.size===0)return!1;let K=p0(W),z=K.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(z&&J.has(z))return!0;for(let H of J){let B=H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(K))return!0}return!1},G=new Set(N9),q=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(K,z)=>z.toUpperCase())},U=(W,K)=>{let z=q(W);if(Y.static[z]=K,z!==W)Y.staticNames[z]=W};for(let[W,K]of Object.entries($)){let z=W.startsWith("x-")&&!G.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(z.startsWith("@")){Y.events[z]=K;continue}if(z.startsWith("__stx_")){let H=q(z.slice(6));Y.serverDynamic[H]=F9(K,X);continue}if(z.startsWith(":")){let H=q(z.slice(1)),B=K===I1?H:K;if(H==="if"||H==="for"||H==="show"){Y.clientReactive[H]=B;continue}if(Q(B)){Y.clientReactive[H]=B;continue}try{if(!Q0(B)){if(X.debug)console.error(`Unsafe expression in :${H} binding: ${B}`);Y.clientReactive[H]=B;continue}let j=Object.keys(Z),V=G0(B,j)(...Object.values(Z));if(V===void 0){let O=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],F=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(O.some((w)=>!F.has(w)&&!j.includes(w))){Y.clientReactive[H]=B;continue}}if(Y.serverDynamic[H]=V,H!==z.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[H]=z.slice(1)}catch{Y.clientReactive[H]=B}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let H=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(H)try{let B=H[1];if(Q0(B)){let _=G0(B,Object.keys(Z))(...Object.values(Z));U(z,_!=null?String(_):"")}else{if(X.debug)console.error(`Unsafe expression in ${z}: ${B}`);U(z,K)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${z}:`,B);U(z,K)}else{let B=K,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(K))!==null)try{let V=_[1];if(!Q0(V)){if(X.debug)console.error(`Unsafe expression in ${z}: ${V}`);continue}let F=G0(V,Object.keys(Z))(...Object.values(Z));B=B.replace(_[0],String(F??""))}catch(V){if(X.debug)console.error(`Error evaluating expression in ${z}:`,V)}U(z,B)}continue}U(z,K===I1?"true":V9(K))}return Y}var kQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function EQ($,Z,X){if(!$.includes("@"))return $;if(!kQ.some(([J,Q])=>J.test($)&&$.includes(Q)))return $;try{return a0($,Z,X)}catch{return $}}function bQ($){let Z={},X=0,Y=$.length;while(X<Y){while(X<Y&&/\s/.test($[X]))X++;if(X>=Y)break;let J="";while(X<Y&&!/[\s=]/.test($[X]))J+=$[X],X++;if(!J)break;while(X<Y&&/\s/.test($[X]))X++;if(X<Y&&$[X]==="="){X++;while(X<Y&&/\s/.test($[X]))X++;let Q="";if(X<Y&&($[X]==='"'||$[X]==="'")){let G=$[X];X++;while(X<Y){let q=$[X];if(q==="\\"&&X+1<Y){X++,Q+=$[X],X++;continue}if(q===G){X++;break}Q+=q,X++}}else while(X<Y&&!/\s/.test($[X]))Q+=$[X],X++;Z[J]=Q}else Z[J]=I1}return Z}function w9($){return Object.entries($).map(([Z,X])=>X===I1?Z:`${Z}="${yQ(X)}"`).join(" ")}function yQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function SQ($){let Z=new Set,X=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=X.exec($))!==null){let J=Y[1];if(k0.isBuiltin(J))Z.add(J)}return[...Z].sort()}var R9=new Map;function CQ($){let Z=R9.get($);if(Z)return Z;let X=new Map,Y=[C0.join($,"src"),C0.join($,"dist"),$];function J(Q,G){if(G>6)return;let q;try{q=R$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let U of q){let W=C0.join(Q,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;J(W,G+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let K=U.name.slice(0,-4);if(!X.has(K))X.set(K,W);let z=K.toLowerCase();if(!X.has(z))X.set(z,W);let H=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,W)}}}for(let Q of Y)if(J(Q,0),X.size>0)break;return R9.set($,X),X}function PQ($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let Y=C0.join(X,"node_modules",$);try{if(R$.statSync(Y).isDirectory())return Y}catch{}let J=C0.dirname(X);if(J===X)return null;X=J}}async function vQ($,Z,X,Y,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=C0.dirname(X),q=$,U=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(U,(W,K,z)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,_=[];while((j=H.exec(z))!==null){let[V,O,F,L]=j,w=null,R=null;if(L.startsWith(".")||L.startsWith("/")){let T=C0.resolve(G,L);if(T.endsWith(".stx"))R=T;else{let A=`${T}.stx`;try{if(R$.statSync(A).isFile())R=A}catch{try{if(R$.statSync(T).isDirectory())w=T}catch{}}}}else w=PQ(L,G);if(!w&&!R)continue;let D=!1,N=(T,A)=>{Q.set(T,A),Q.set(T.toLowerCase(),A);let M=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,A),J.add(A)};if(F&&R)N(F,R),D=!0;else if(O){let T=O.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let k=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:M,local:M}}),A=w?CQ(w):null;for(let{source:M,local:k}of T){let I=null;if(R)I=R;else if(A)I=A.get(M)??A.get(M.toLowerCase())??A.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(k,I),D=!0}}if(D)_.push({start:j.index,end:j.index+V.length})}if(_.length===0)return W;for(let V=_.length-1;V>=0;V--)B=B.slice(0,_[V].start)+B.slice(_[V].end);return`<script${K}>${B}</script>`}),q}async function fQ($,Z,X,Y,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,U;while((U=q.exec(Q))!==null){let[W,K]=U,z=K.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of z){let B=H.split("/"),_=B[B.length-1].replace(/\.stx$/,""),V=_.includes("-")?_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),O=null,F=[C0.resolve(C0.dirname(X),`${H}.stx`),C0.resolve(C0.dirname(X),H),C0.resolve(Y.componentsDir||"components",`${H}.stx`),C0.resolve(Y.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let L of F)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(V,O),G.set(_,O),G.set(_.toLowerCase(),O);let L=V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),J.add(O),Y.debug)console.log(`Imported component: ${V} -> ${O}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(W,""),q.lastIndex=0}return Q}async function xQ($,Z,X,Y,J){let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=/@component\s*\(/g,W;while((W=U.exec(Q))!==null){let K=W.index,z=K+W[0].length-1,H=1,B=z+1;while(B<Q.length&&H>0){if(Q[B]==="(")H++;else if(Q[B]===")"){if(H--,H===0)break}B++}if(H!==0)break;let j=Q.substring(z+1,B),_=B+1,V=j.match(/^\s*['"]([^'"]+)['"]/);if(!V){U.lastIndex=0;continue}let O=V[1],F,L=j.slice(V[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let R={};if(F)try{R=_0(F,Z)}catch(k){let I=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(K,_),`[Error parsing component props: ${I}]`);continue}let D="",N=_,A=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(A)D=A[1].trim(),N=_+A[0].length;let M=await T1(O,R,D,G,Z,X,Y,q,J);Q=Q.substring(0,K)+M+Q.substring(N),U.lastIndex=0}return Q}async function gQ($,Z,X,Y,J){if(!$)return $;let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=c0(Q);return Q=U.output,Q=await H(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await H(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await H(Q,/[a-z][a-z0-9]*/,!1,TQ),Q=C1(Q,U.scripts),Q;async function H(B,j,_,V){if(!B)return B;let O=B,F=O9(O,j,V);for(let L=F.length-1;L>=0;L--){let w=F[L],R=_?L$(w.tagName):w.tagName,D=bQ(EQ(w.attributes,Z,X)),N=IQ(D,Z,Y),T=k0.getBuiltin(w.tagName),A=T?await w$(R,G,Z,X,Y):!1;if(T&&!A){let y={context:Z,filePath:X,options:Y,dependencies:J},E=T.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)E=D9(E,N.clientReactive);if(Object.keys(N.events).length>0){let b=w9(N.events);E=E.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,w.startIndex)+E+O.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await w$(R,G,Z,X,Y))continue;let M={};for(let[y,E]of Object.entries(N.static))M[y]=E;for(let[y,E]of Object.entries(N.serverDynamic))M[y]=E;let I=await T1(R,M,C1(w.content,U.scripts),G,Z,X,Y,q,J);if(Object.keys(N.clientReactive).length>0)I=D9(I,N.clientReactive);if(Object.keys(N.events).length>0){let y=A9(I);if(y){let E=w9(N.events),b=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${E}`+I.substring(y.insertPos)}}O=O.substring(0,w.startIndex)+I+O.substring(w.endIndex)}return O}}function D9($,Z){let X=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries(Z).filter(([K])=>!X.has(K)),Q=J.filter(([K])=>!Y.has(K)).map(([K])=>L$(K)).join(" "),G=$,q=J.length>0?A9(G):null;if(q){let K=J.map(([H,B])=>`:${L$(H)}="${B.replace(/"/g,""")}"`).join(" "),z=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,q.insertPos)+`${z} ${K}`+G.substring(q.insertPos)}let U=Z.if;if(U)G=`<template :if="${U.replace(/"/g,""")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,""")}">${G}</template>`;return G}function A9($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let X=0;while(X<$.length){let Y=$.slice(X),J=Y.match(/^\s+/);if(J){X+=J[0].length;continue}if(Y.startsWith("<!--")){let q=$.indexOf("-->",X+4);if(q===-1)return null;X=q+3;continue}let Q=Y.match(/^<(script|style)\b[^>]*>/i);if(Q){let q=`</${Q[1].toLowerCase()}>`,U=$.toLowerCase().indexOf(q,X+Q[0].length);if(U===-1)return null;X=U+q.length;continue}let G=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:X+1+G[1].length}}return null}async function B4($,Z,X,Y,J){if(!L9)_9(),L9=!0;let Q=await vQ($,Z,X,Y,J);Q=await fQ(Q,Z,X,Y,J),Q=await xQ(Q,Z,X,Y,J);let G=[];for(let q=0;q<3;q++){let U=l0(Q,Q5,(K,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...U.tokens);let W=Q;if(Q=await gQ(U.output,Z,X,Y,J),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,U)=>G[Number(U)]??"");if(Y.debug){let q=SQ(Q);if(q.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import $5 from"path";import M9 from"process";function e1($="STX_PUBLIC_"){let Z={},X={};for(let[Y,J]of Object.entries(M9.env)){if(!Y.startsWith($)||J===void 0)continue;Z[`import.meta.env.${Y}`]=JSON.stringify(J),X[Y]=J}return Z["import.meta.env"]=JSON.stringify(X),Z}function $j($="STX_PUBLIC_"){let Z={};for(let[X,Y]of Object.entries(M9.env))if(X.startsWith($)&&Y!==void 0)Z[X]=Y;return Z}function T9($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function I9($,Z,X){try{let Y;if($.startsWith("/")){let J=Z;for(let Q=0;Q<5;Q++){let G=$5.join(J,$);if(await Bun.file(G).exists())return G;J=$5.dirname(J)}Y=$5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))Y=$5.resolve(Z,$);else Y=$5.resolve(Z,$);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function k9($,Z,X){let Y=$,J=$5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(Y))!==null){let[W,K,z,H]=G;if(T9(z))continue;let B=await I9(z,J,Z);if(B)try{let j=await Bun.file(B).text();if(X.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let V=await Bun.build({entrypoints:[B],target:"browser",minify:!0,define:e1()});if(V.outputs.length>0)j=await V.outputs[0].text()}let _=`<script>
|
|
3601
3601
|
// Source: ${z}
|
|
3602
3602
|
${j}
|
|
3603
3603
|
</script>`;Y=Y.replace(W,_),Q.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,U;while((U=q.exec(Y))!==null){let[W,K,z,H]=U,B=K+H;if(T9(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let _=await I9(z,J,Z);if(_)try{let V=await Bun.file(_).text();X.add(_);let O=`<style>
|
|
@@ -3619,9 +3619,9 @@ ${G.join(`
|
|
|
3619
3619
|
`+J.slice(Q)}async function F4($,Z,X,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=J1($);let Q=!Z.__stxProcessingDepth;if(Q)P4(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((Y.debug||!H5()&&!c5())&&X&&X.endsWith(".stx"))h9($,X);try{return await $7.timeAsync("template-processing",async()=>{let G=await pQ($,Z,X,Y,J);if(Q)G=O4(G);if(Q&&Y.autoShell&&Y.buildMode!=="compile"){let q=Y.app?.head||{},W=(Z.__stx_runtime_head||null)??g9(),K=(Z.__stx_head_raw||"").trim(),z,H=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)z=H[1].trim(),K=K.replace(H[0],"").trim();let B=Z.__sections?.title,j=W.title||z||B,_=!W.title&&(!!z||!!B),V=W.meta||[],O=new Set(V.map((N)=>i1(N)).filter(Boolean)),F={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!O.has(i1(N))),...V],link:[...q.link||[],...W.link||[]],script:[...q.script||[],...W.script||[]],headRaw:[q.headRaw,K].filter(Boolean).join(`
|
|
3620
3620
|
`),...W.htmlAttrs&&{htmlAttrs:E2(q.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...W.bodyAttrs}}},L=l3(G);if(G=C2(G,F,{..._&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),L)G=S2(G,q),G=b2(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],T=f9(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
|
|
3621
3621
|
<meta name="stx-layout" content="${S9(N)}">
|
|
3622
|
-
<meta name="stx-layout-group" content="${S9(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?q5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=g5(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=y2(G);let q=Y.app?.colorMode;if(q)G=A2(G,q);G=T2(G),G=cQ(G)}if(Q)try{let{getStoreScript:q}=await a("stx/store-loader",()=>import("./chunk-
|
|
3623
|
-
`+K+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await a("stx/framework-composables",()=>import("./chunk-
|
|
3624
|
-
`+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await a("stx/composable-loader",()=>import("./chunk-
|
|
3622
|
+
<meta name="stx-layout-group" content="${S9(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?q5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=g5(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=y2(G);let q=Y.app?.colorMode;if(q)G=A2(G,q);G=T2(G),G=cQ(G)}if(Q)try{let{getStoreScript:q}=await a("stx/store-loader",()=>import("./chunk-8gf8p3hq.js")),U=Y.storesDir,W=await q(U);if(W){let K=`<script data-stx-stores>${W}</script>`,z=Z5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
|
|
3623
|
+
`+K+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await a("stx/framework-composables",()=>import("./chunk-hdtca0hs.js")),U=await q(G);if(U){let W=Z5(G,"data-stx-stores")||Z5(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 a("stx/composable-loader",()=>import("./chunk-seac724e.js")),U=Y.composablesDir,W=await q(U,G);if(W){let K=`<script data-stx-composables>${W}</script>`,z=Z5(G,"data-stx-stores")||Z5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
|
|
3625
3625
|
`+K+G.slice(z.end)}}catch{}if(Q)G=M2(G);if(Q&&Z.__stx_inject_css!==!1)G=await x9(G,void 0,Y.buildMode==="serve");if(Q)G=N2(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof n5)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}),Z3.logDetailedError(U,{filePath:X,template:$.substring(0,500)}),Y.debug)throw U;return e$.createFallbackContent("Template Processing",U)}}async function pQ($,Z,X,Y,J){let Q=process.cwd(),G={...Y,partialsDir:Y.partialsDir&&!R0.isAbsolute(Y.partialsDir)?R0.resolve(Q,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!R0.isAbsolute(Y.componentsDir)?R0.resolve(Q,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!R0.isAbsolute(Y.layoutsDir)?R0.resolve(Q,Y.layoutsDir):Y.layoutsDir},q=G,U=$;await sQ(X,Z),nQ(Z,q),U=await h1(()=>G2(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 K=W.tokens,z=(L)=>K.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>K[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";U=U.replace(/@@/g,H),U=U.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),U=j2(U),U=await k9(U,X,J);let B={};U=C3(U,B);let j={...Z.__sections||{}},_="",V=O7(_7($)),O=/@nolayout\b/.test(U)||V===!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 V==="string"){if(_=V,!/@section\s*\(/.test(U))U=`@section('content')
|
|
3626
3626
|
${U.trim()}
|
|
3627
3627
|
@endsection`}if(!_&&!O&&q.defaultLayout){let L=m3(U),w=/@section\s*\(/.test(U);if(!L||w){let R="",D=R0.dirname(X),N=q.layoutsDir?R0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let A=R0.join(D,"_layout.stx");if(await r(A)){R=A;break}let M=R0.dirname(D);if(M===D||M.length<N.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let T=R0.isAbsolute(q.layoutsDir)?q.layoutsDir:R0.resolve(process.cwd(),q.layoutsDir),A=R0.join(T,`${q.defaultLayout}.stx`);if(await r(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=X0(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=P3(U,B),_){let L=[],w=c0(U),R=l0(w.output,S1,(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(R0.isAbsolute(_))L=_,J.add(_);else L=await h1(()=>r5(_,X,G,J),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=R0.isAbsolute(I)?I:R0.resolve(process.cwd(),I);return mQ.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 h1(()=>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 F4(I,k,L,G,J)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=C3(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=iQ(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=P3(N,B),Z.__originalFilePath=X,U=await P9(N,Z,L,G,J),U=`<!-- stx-layout: ${_} -->
|
|
3632
|
-
${U}`,z(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 z(await P9(U,Z,X,G,J))}function iQ($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,Y,J)=>{let Q=Z[Y];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return J||""})}function nQ($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",Y={};for(let[J,Q]of Object.entries(process.env))if(J.startsWith(X)&&Q!==void 0)Y[J]=Q;$.$env=Y}async function sQ($,Z){await h1(()=>W2($,Z),void 0,(X)=>{u0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function oQ($,Z,X){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec($))!==null){let Q=J[1],G=J[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await a("stx/variable-extractor",()=>import("./chunk-
|
|
3632
|
+
${U}`,z(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 z(await P9(U,Z,X,G,J))}function iQ($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,Y,J)=>{let Q=Z[Y];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return J||""})}function nQ($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",Y={};for(let[J,Q]of Object.entries(process.env))if(J.startsWith(X)&&Q!==void 0)Y[J]=Q;$.$env=Y}async function sQ($,Z){await h1(()=>W2($,Z),void 0,(X)=>{u0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function oQ($,Z,X){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec($))!==null){let Q=J[1],G=J[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await a("stx/variable-extractor",()=>import("./chunk-8a1524ge.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 rQ($,Z,X){try{let{interpolateScriptsInTemplate:Y}=await a("stx/expressions",()=>import("./chunk-gfgpf7h8.js"));return Y($,Z,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return u0.log(J,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${J.message}`),$}}async function P9($,Z,X,Y,J){let Q=$,G=Y;if(await oQ(Q,Z,X),Q=await rQ(Q,Z,X),Q=await n6(Q,Z,X),Q=await s6(Q,Z,X),Q=await b6(Q,Z,X,G),J1(Q))Q=r2(Q,Z),Q=e2(Q,Z);Q=t2(Q);let{processStreamDirectives:q}=await a("stx/streaming",()=>import("./chunk-a438xffx.js"));Q=q(Q,Z),Q=Z2(Q,Z,X,G),Q=await F2(Q,Z,X,G,J),Q=await B4(Q,Z,X,G,J),Q=j7(Q,Z,X,G);let{processDeferDirectives:U}=await a("stx/defer",()=>import("./chunk-3vy1q9da.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await a("stx/teleport",()=>import("./chunk-rs2fa3g1.js"));Q=W(Q,Z,X);let{processTransitionDirectives:K,processTransitionAttributes:z}=await a("stx/transitions",()=>import("./chunk-7w4c5w2b.js"));Q=K(Q,Z,X),Q=z(Q);let{processErrorBoundaryDirectives:H}=await a("stx/error-boundaries",()=>import("./chunk-qz75kx6n.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await a("stx/suspense",()=>import("./chunk-jr5tp4ks.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await a("stx/async-components",()=>import("./chunk-va9k88da.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await a("stx/keep-alive",()=>import("./chunk-dhpy0h9y.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:V,processVirtualGridDirectives:O,processInfiniteListDirectives:F}=await a("stx/virtual-scrolling",()=>import("./chunk-4pf61rcb.js"));Q=V(Q,Z,X),Q=O(Q,Z,X),Q=F(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await a("stx/partial-hydration",()=>import("./chunk-wtengj6h.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await a("stx/computed",()=>import("./chunk-zda3hvde.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await a("stx/forms-validation",()=>import("./chunk-5s2y052b.js"));Q=N(Q,Z,X);let{processHeadDirective:T,processTitleDirective:A,processMetaDirective:M,resetHead:k}=await a("stx/head",()=>import("./chunk-jpbk42j7.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=U2(Q),Q=B3(Q,Z),Q=E6(Q),Q=J2(Q),Q=await S3(Q,Z,X,G,J),Q=await B4(Q,Z,X,G,J),Z.__stxProcessingDepth===1)Q=f4(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=O4(Q),Q=a0(Q,Z,X),Q=j3(Q,Z),Q=_3(Q,Z),Q=F5(Q,Z),Q=D3(Q,Z),Q=N3(Q,Z),Q=await O6(Q,Z,X,G),Q=await N7(Q,Z,X),Q=await d6(Q,Z,X,G),Q=v9(Q,Z,X,G),Q=Z6(Q,Z,X,G),Q=X6(Q,Z,X),Q=Y6(Q,Z,X,G),Q=I6(Q,Z,X,G),Q=j4(Q,Z),Q=_4(Q),Q=E9(Q),!G.skipEventDirectives)Q=S4(Q,Z,X);if(Q=L7(Q,Z,X),G.debug){let p=/\bx-data\s*=/.test(Q),e=r3($);if(p&&e)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=H2(Q,Z),Q=await _1(Q,Z,X),Q=b9(Q),Q=y9(Q),Q=G7(Q);let{processXElementDirectives:y}=await a("stx/x-element",()=>import("./chunk-wnaddtv3.js"));Q=y(Q);let E=Z.__originalFilePath||X,b=D$(Z);if(Q=await $9(Q,G,E,b),Q=P6(Q,Z),Q=await q2(Q,Z,X,G),G.media?.image?.autoSiblings){let p=G.publicDir||"public",{rewriteImagesWithSiblings:e}=await a("stx/image-optimization/auto-sibling",()=>import("./chunk-6bxcjdp4.js"));Q=await e(Q,{publicDir:p})}if(G.seo?.enabled)Q=J6(Q,Z,G);let C=(p,e,J0=!0)=>{if(!e)return p;let T0=e.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),F0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(T0&&F0){if(J0)p=p.replace(F0[0],T0[0]);if(e=e.replace(T0[0],"").trim(),!e)return p}if(/<\/head>/i.test(p))return p.replace(/<\/head>/i,`${e}
|
|
@@ -3643,7 +3643,7 @@ ${Y7()}
|
|
|
3643
3643
|
`+S}else Q=Q.replace("</head>",`${e}
|
|
3644
3644
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3645
3645
|
${e}`);else Q=e+`
|
|
3646
|
-
`+Q}{let{scanScriptTags:p}=await a("stx/signal-processing",()=>import("./chunk-
|
|
3646
|
+
`+Q}{let{scanScriptTags:p}=await a("stx/signal-processing",()=>import("./chunk-wzytd8fh.js")),e=[];for(let J0 of p(Q)){if(!/\bserver\b/i.test(J0.attrs))continue;let T0=J0.start+J0.fullMatch.indexOf(">")+1,F0=lQ(Q,T0);if(F0===-1)continue;let P0=F0+9;while(P0<Q.length&&/\s/.test(Q[P0]))P0++;e.push({start:J0.start,end:P0})}for(let J0=e.length-1;J0>=0;J0--){let{start:T0,end:F0}=e[J0];Q=Q.substring(0,T0)+Q.substring(F0)}}let g0=W$(Q,X);if(g0.hasScoped)Q=g0.html;let t=Z.__stx_event_bindings||[],K0=!1,q0=[],B1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:Y5}=await a("stx/signal-processing",()=>import("./chunk-wzytd8fh.js"));for(let p of Y5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))q0.push({match:p.fullMatch,attrs:p.attrs,content:p.body});for(let{match:p,attrs:e,content:J0}of q0){K0=!0;let T0=J0;V4(J0,X,Y.strict,Z.__originalFilePath);let F0=await N$(J0,{eventBindings:t,attrs:e,hasColonDirectives:B1,templateContent:$,filePath:X,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:b});Q=Q.replace(p,()=>F0)}if(K0)Z.__stx_event_bindings=[];if(!K0&&Z.__stxProcessingDepth===1){let p=Z.__stx_event_bindings||[];if(p.length>0){let e=k$(p);if(e){let J0=Q.lastIndexOf("</body>");Q=J0===-1?Q+e:Q.slice(0,J0)+e+`
|
|
3647
3647
|
`+Q.slice(J0)}Z.__stx_event_bindings=[]}}if(!h2(Q)&&u2(Q))Q=await B$(Q,G);if(Q=d2(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=T6(Q,Z.cspNonce);return Q}var aQ=[{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"}],tQ=[{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')"}],eQ=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function $G($){let Z=[],X=[];return ZG($,Z),XG($,Z,X),YG($,X),JG($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function ZG($,Z){let X=($.match(/\{\{/g)||[]).length,Y=($.match(/\}\}/g)||[]).length;if(X!==Y)Z.push({type:"expression",message:`Unclosed expression brackets: found ${X} opening '{{' and ${Y} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function XG($,Z,X){for(let Y of aQ){let J=new RegExp(`${Y.open}(?:\\s|\\()`,"g"),Q=new RegExp(Y.close,"g"),G=($.match(J)||[]).length,q=($.match(Q)||[]).length;if(Y.altClose){let U=new RegExp(Y.altClose,"g");q+=($.match(U)||[]).length}if(G>q)Z.push({type:"directive",message:`Unclosed @${Y.name} directive: found ${G} opening and ${q} closing`,suggestion:`Add ${G-q} missing ${Y.close} tag(s)`});else if(q>G)X.push({type:"directive",message:`Extra ${Y.close} found: ${q-G} more closing than opening`,suggestion:`Check for orphaned ${Y.close} tags`})}}function YG($,Z){for(let X of tQ)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function JG($,Z){for(let X of eQ)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function QG($,Z){let X=$.slice(0,Z).split(`
|
|
3648
3648
|
`);return{line:X.length,column:X[X.length-1].length+1}}function GG($,Z,X){let Y=[];switch($){case"if":case"elseif":case"unless":if(X.length===0)Y.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(X.length===0||!X[0].includes(" as "))Y.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)Y.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(X.length===0)Y.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(X.length===0)Y.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(X.length===0)Y.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return Y}function qG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function UG($){let Z=$.matchAll(/@([a-z]+)/gi),X=new Set;for(let Y of Z){let J=Y[1].toLowerCase();if(!J.startsWith("end"))X.add(J)}return Array.from(X)}import n0 from"path";import X5 from"process";var n9=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","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"],u9=new Set(n9),WG=new Set(["props","$props","defineProps"]),KG=new Set(["stx","@stacksjs/stx"]);function zG($){let Z=[],X=0,Y=$.split(`
|
|
3649
3649
|
`);for(let J of Y){let Q=X,G=null,q=!1;for(let U=0;U<J.length;U++){let W=J[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<J.length&&J[U+1]==="/")break;if(W==="{")X++;else if(W==="}")X--}if(Q===0){let U=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(U)Z.push(U[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let W=J.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=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(...z)}}}}return[...new Set(Z)]}function HG($){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(Y){if(!Y.includes(":"))return Y;let J=[],Q="",G=0,q=0,U=null;for(let W=0;W<Y.length;W++){let K=Y[W];if(U){if(Q+=K,K===U)U=null;continue}if(K==='"'||K==="'"||K==="`"){U=K,Q+=K;continue}if(K==="<")G++;else if(K===">"&&G>0)G--;else if(K==="(")q++;else if(K===")")q--;if(K===","&&G===0&&q===0){J.push(Q),Q="";continue}Q+=K}if(Q)J.push(Q);return J.map((W)=>{let K=W.trim(),z=K.startsWith("..."),H=z?K.slice(3):K,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 V=H.substring(0,B).trim().replace(/\?$/,""),O=H.substring(B+1),F=-1,L=0;for(let R=0;R<O.length;R++)if(O[R]==="<")L++;else if(O[R]===">")L--;else if(O[R]==="="&&L===0){F=R;break}let w=z?"...":"";if(F!==-1)return`${w}${V} = ${O.substring(F+1).trim()}`;return`${w}${V}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,Q)=>{if(!Q.includes(":"))return Y;return`${J}(${X(Q)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,Q=[];while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,q=1,U=G+1,W=0,K=null;while(U<Z.length&&q>0){let B=Z[U];if(K){if(B===K)K=null;U++;continue}if(B==='"'||B==="'"||B==="`"){K=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 z=Z.substring(G+1,U);if(!z.includes(":"))continue;let H=X(z);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,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.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}`,J++}while(J<$.length){let Q=$[J].trim();if(Q.startsWith(".")||Q.startsWith("?."))Y+=`
|
|
3666
3666
|
${$[J]}`,J++;else break}return{value:Y,nextIndex:J}}function DG($,Z,X){let Y=X,J=Z+1;while(J<$.length){let Q=t9(Y);if(Q!==-1){if(H0(Y,"{","}",Q)!==-1)break}let G=$[J];Y+=`
|
|
3667
3667
|
${G}`,J++}return{functionCode:Y,nextIndex:J}}function p9($,Z){let X=X0($,Z)??X0(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let Y={...Z,process:Object.freeze({env:{...X5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${$});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${$};`)(...Object.values(Y))}catch{return}}}async function NG($,Z,X){let Y=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of Y){let[,,G,q]=Q;try{let U=q.trim().replace(/;$/,""),W=p9(U,Z);if(W!==void 0)Z[G]=W}catch(U){console.warn(`Failed to parse export ${G} in fallback:`,U)}}let J=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of J){let[,,G,q]=Q;if(!(G in Z))try{let U=q.trim().replace(/;$/,""),W=p9(U,Z);if(W!==void 0)Z[G]=W}catch{}}}function AG($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",Y=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:Y}}function MG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var T5=new O1(500),M$=new O1(1000),R4=new O1(2000),IG=0;function kG($){let Z=new WeakSet;try{let X=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if(Z.has(Y))throw TypeError("Circular component input");if(Z.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(X);let J={};for(let Q of Object.keys(Y).sort())J[Q]=X(Y[Q]);return J};return JSON.stringify(X($))}catch{return null}}function e9($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function EG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function N1($){return!EG($)}var A$=new Map;function w4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=A$.get(Z);if(X)return X;if(A$.size>=16)A$.clear();let Y=new Bun.Transpiler($);return A$.set(Z,Y),Y}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 J=w4({loader:"ts",target:"browser",define:e1()}).transformSync(Z);for(let Q=0;Q<X.length;Q++)J=J.replace(`"__STX_EXPR_${Q}__"`,X[Q]),J=J.replace(`'__STX_EXPR_${Q}__'`,X[Q]);return J}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function bG($){let Z=[],X=new Set,Y=0,J=0,Q=$.length,G=(K)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===K){J++;return}J++}},q=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let K=1;while(J<Q&&K>0)if($[J]==="{")K++,J++;else if($[J]==="}")K--,J++;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")q();else J++;continue}J++}},U=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
|
|
3668
|
-
`)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(Y!==0)return;let K=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let j=K[2].split(",").map((_)=>{let V=_.trim().split(":");return V[V.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let z=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(J).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(J).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(J<Q){if(U())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){q();continue}if($[J]==="{"){Y++,J++;continue}if($[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))W();J++}return Z}function yG($){let Z=[],X=0,Y=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G==="\\"){Q++;continue}if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(Y,Q)),Y=Q+1}if(Y<$.length)Z.push($.slice(Y));return Z}function SG($){let Z=0,X=null;for(let Y=0;Y<$.length;Y++){let J=$[Y];if(X){if(J==="\\"){Y++;continue}if(J===X)X=null;continue}if(J==='"'||J==="'"||J==="`"){X=J;continue}if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J==="="&&Z===0){let Q=$[Y-1],G=$[Y+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return Y}}return-1}function CG($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let Y=X.index-1;while(Y>=0&&/\s/.test($[Y]))Y--;if($[Y]!=="}")return;let J=Y,Q=0,G=-1;for(;Y>=0;Y--){let U=$[Y];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=Y;break}}}if(G===-1)return;let q=$.slice(G+1,J);for(let U of yG(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let K=SG(W);if(K===-1)continue;let z=W.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let H=W.slice(K+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[z]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function w$($,Z,X,Y,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(V)=>V.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),q=(V)=>V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let V of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(V))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],K=typeof J.root==="string"?g.resolve(J.root):void 0,z=K??g.dirname(Y),H=[],B=(V)=>{if(V&&!H.includes(V))H.push(V)},j=X.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));B(Z),B(J._rootComponentsDir),B(g.join(g.dirname(Y),"components")),B(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let V of _)B(typeof V==="string"?V:null);if(K)B(g.resolve(K,"resources/views/components")),B(g.resolve(K,"resources/components")),B(g.resolve(K,"src/components")),B(g.resolve(K,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return r(g.resolve(g.dirname(Y),`${Q}.stx`));for(let V of H){let O=g.isAbsolute(V)?V:g.resolve(z,V);for(let F of W)if(await r(g.join(O,F)))return!0}return!1}function PG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function vG($){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 fG($){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 Y of $){let J;while((J=X.exec(Y))!==null)Z.add(J[1]);X.lastIndex=0}return[...Z]}async function T1($,Z,X,Y,J,Q,G,q=new Set,U){let{extractVariables:W}=await a("stx/variable-extractor",()=>import("./chunk-
|
|
3668
|
+
`)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(Y!==0)return;let K=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let j=K[2].split(",").map((_)=>{let V=_.trim().split(":");return V[V.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let z=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(J).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(J).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(J<Q){if(U())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){q();continue}if($[J]==="{"){Y++,J++;continue}if($[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))W();J++}return Z}function yG($){let Z=[],X=0,Y=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G==="\\"){Q++;continue}if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(Y,Q)),Y=Q+1}if(Y<$.length)Z.push($.slice(Y));return Z}function SG($){let Z=0,X=null;for(let Y=0;Y<$.length;Y++){let J=$[Y];if(X){if(J==="\\"){Y++;continue}if(J===X)X=null;continue}if(J==='"'||J==="'"||J==="`"){X=J;continue}if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J==="="&&Z===0){let Q=$[Y-1],G=$[Y+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return Y}}return-1}function CG($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let Y=X.index-1;while(Y>=0&&/\s/.test($[Y]))Y--;if($[Y]!=="}")return;let J=Y,Q=0,G=-1;for(;Y>=0;Y--){let U=$[Y];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=Y;break}}}if(G===-1)return;let q=$.slice(G+1,J);for(let U of yG(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let K=SG(W);if(K===-1)continue;let z=W.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let H=W.slice(K+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[z]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function w$($,Z,X,Y,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(V)=>V.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),q=(V)=>V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let V of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(V))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],K=typeof J.root==="string"?g.resolve(J.root):void 0,z=K??g.dirname(Y),H=[],B=(V)=>{if(V&&!H.includes(V))H.push(V)},j=X.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));B(Z),B(J._rootComponentsDir),B(g.join(g.dirname(Y),"components")),B(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let V of _)B(typeof V==="string"?V:null);if(K)B(g.resolve(K,"resources/views/components")),B(g.resolve(K,"resources/components")),B(g.resolve(K,"src/components")),B(g.resolve(K,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return r(g.resolve(g.dirname(Y),`${Q}.stx`));for(let V of H){let O=g.isAbsolute(V)?V:g.resolve(z,V);for(let F of W)if(await r(g.join(O,F)))return!0}return!1}function PG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function vG($){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 fG($){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 Y of $){let J;while((J=X.exec(Y))!==null)Z.add(J[1]);X.lastIndex=0}return[...Z]}async function T1($,Z,X,Y,J,Q,G,q=new Set,U){let{extractVariables:W}=await a("stx/variable-extractor",()=>import("./chunk-8a1524ge.js")),K=q??new Set;if(K.has($))return`[Circular component reference: ${$}]`;let z=new Set(K);z.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=H&&H!=="load"&&PG(H)?H:"";try{let j=(P)=>P.split("-").map((u)=>u.charAt(0).toUpperCase()+u.slice(1)).join(""),_=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),V=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=J.__importedComponents;if(F){let P=[V,V.toLowerCase(),j(V),_(V)];for(let u of P)if(F.has(u)){O=F.get(u);break}}let L=[];if(!O){let P=[`${V}.stx`,`${j(V)}.stx`,`${_(V)}.stx`],u=[...new Set(P)],s=J.__originalFilePath,o=[];if(s){let Y0=g.join(g.dirname(s),"components");o.push(Y0)}if(Y)o.push(Y);let z0=G._rootComponentsDir;if(typeof z0==="string"&&!o.includes(z0))o.push(z0);let L0=g.join(g.dirname(Q),"components");if(!o.includes(L0))o.push(L0);if(G.componentsDir&&G.componentsDir!==Y&&!o.includes(G.componentsDir))o.push(G.componentsDir);let $1=G._pluginComponentDirs;if(Array.isArray($1)){for(let Y0 of $1)if(typeof Y0==="string"&&!o.includes(Y0))o.push(Y0)}let E0=typeof G.root==="string"?g.resolve(G.root):void 0,D0=E0??g.dirname(Q),v0=[];if(E0)v0.push(g.resolve(E0,"resources/views/components")),v0.push(g.resolve(E0,"resources/components")),v0.push(g.resolve(E0,"src/components")),v0.push(g.resolve(E0,"components"));v0.push(g.resolve(import.meta.dir,"components"));for(let Y0 of v0)if(!o.includes(Y0))o.push(Y0);let J5=[...new Set(o.map((Y0)=>{if(!Y0)return Y0;return g.isAbsolute(Y0)?Y0:g.resolve(D0,Y0)}))];o.length=0,o.push(...J5);let Z1=`${V}\x00${Q}\x00${J5.join("\x00")}`,i=M$.get(Z1);if(i)if(await r(i))O=i;else M$.delete(Z1);if(!O&&(V.startsWith("./")||V.startsWith("../")))O=g.resolve(g.dirname(Q),`${V}.stx`),L.push(O);else if(!O)for(let Y0 of o){if(!Y0)continue;for(let X1 of u){let j1=g.join(Y0,X1);if(L.push(j1),await r(j1)){O=j1;break}}if(O)break;if(!O)try{let X1=await import("fs");if(!X1.statSync(Y0,{throwIfNoEntry:!1})?.isDirectory())continue;let k5=8,y1=[{path:Y0,depth:0}];while(y1.length>0&&!O){let s0=y1.pop();if(s0.depth>=k5)continue;let E5;try{E5=X1.readdirSync(s0.path,{withFileTypes:!0})}catch{continue}for(let b5 of E5){if(!b5.isDirectory())continue;if(b5.name==="node_modules"||b5.name.startsWith("."))continue;let M4=g.join(s0.path,b5.name);for(let z8 of u){let T$=g.join(M4,z8);if(L.push(T$),await r(T$)){O=T$;break}}if(O)break;y1.push({path:M4,depth:s0.depth+1})}}}catch{}if(O)break}if(O)M$.set(Z1,O)}if(!O||!await r(O)){let P=L.length>0?`
|
|
3669
3669
|
Searched paths:
|
|
3670
3670
|
${L.map((u)=>` - ${u}`).join(`
|
|
3671
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(O);let w;if(T5.has(O))w=T5.get(O);else try{w=await Bun.file(O).text(),T5.set(O,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",y5,"__stx_client_signal_names","__stxServeContext"]),D={};for(let[P,u]of Object.entries(J))if(!P.startsWith("__")||R.has(P))D[P]=u;let N=c0(X),T=[],A=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let s=N.scripts[Number(u)]||"",o=s.match(/^<script\b([^>]*)>/i)?.[1]||"",z0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),L0=!z0||["module","text/javascript","application/javascript"].includes(z0);if(!/\bserver\b/i.test(o)&&L0)return T.push(s),"";return s}),{extractSlotContent:M}=await a("stx/slots",()=>import("./chunk-
|
|
3672
|
-
`)}`}if(X&&q0.includes("{{ text || slot }}"))q0=q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:B1}=await a("stx/slots",()=>import("./chunk-
|
|
3671
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(O);let w;if(T5.has(O))w=T5.get(O);else try{w=await Bun.file(O).text(),T5.set(O,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",y5,"__stx_client_signal_names","__stxServeContext"]),D={};for(let[P,u]of Object.entries(J))if(!P.startsWith("__")||R.has(P))D[P]=u;let N=c0(X),T=[],A=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let s=N.scripts[Number(u)]||"",o=s.match(/^<script\b([^>]*)>/i)?.[1]||"",z0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),L0=!z0||["module","text/javascript","application/javascript"].includes(z0);if(!/\bserver\b/i.test(o)&&L0)return T.push(s),"";return s}),{extractSlotContent:M}=await a("stx/slots",()=>import("./chunk-241d3ex6.js")),k=M(A),I={};if(k.defaultSlot?.trim())I.default=k.defaultSlot;for(let[P,u]of k.namedSlots)I[P]=u.content;let y={...D,...Z,props:Z,slot:A,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:J1(w)||vG(X)};CG(w,y);let E=w,b=J$(E);if(b)E=b.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...w.matchAll(C)],f=[],n=x.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&x.every((P)=>/\bserver\b/.test(P[1]||"")),m=null,V0=null;if(n){let P=kG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){m=`${O}\x00${P}`;let u=R4.get(m);if(u){for(let s of u.dependencies)U.add(s);return u.output}V0=new Set(U)}}for(let P of x){let u=P[1]||"",s=P[2]||"",o=u.includes("server");if(N1(u)&&s.trim())s=A1(s);if(o&&s)try{await W(s,y,O)}catch(L0){}if(!o){let L0=s.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),$1=L0.includes("{{")&&L0.includes("}}"),E0=L0.includes("{!!")&&L0.includes("!!}");if($1||E0)L0=y$(L0,y);let D0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");f.push(`<script${D0}>${L0}</script>`)}}let A0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M0=A0?A0[1]:"",g0=A0?A0[2]:"",t="",K0=M0&&/\bscoped\b/i.test(M0);if(A0)t=`<style${M0}>${g0}</style>`;let q0=E;if(q0=q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A0)q0=q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(q0=q0.replace(P,(s,o)=>{let z0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(z0)u.push(`<style${z0[1]}>${z0[2]}</style>`);return""}),q0=q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)t=`${t}${u.join(`
|
|
3672
|
+
`)}`}if(X&&q0.includes("{{ text || slot }}"))q0=q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:B1}=await a("stx/slots",()=>import("./chunk-241d3ex6.js")),{defaultSlot:Y5,namedSlots:p}=k;q0=await B1(q0,Y5,p,y);let e=f.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),J0=fG(f),T0=Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[];if(J0.length>0||T0.length>0)y.__stx_client_signal_names=[...new Set([...T0,...J0])];let F0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:e||f.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let P0=await F4(q0,y,O,F0,U),S=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let P of P0.matchAll(/\{\{([\s\S]*?)\}\}/g))S.add(P[1].trim());if(S.size>0)J.__stx_preserved_client_expressions=[...S];let v=`stx_${V.replace(/[^a-zA-Z0-9]/g,"_")}_${++IG}_${Math.random().toString(36).slice(2,8)}`,d=P0;if(e){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${e9(JSON.stringify(Z))}"`}catch{}let u=B?` stx-hydrate="${e9(B)}"`:"";d=`<div data-stx-scope="${v}"${P}${u}>${P0}</div>`;let s=await Promise.all(f.map(async(o)=>{let z0=o.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!z0)return o;let[,L0,$1]=z0,E0=N4($1,{filePath:O,projectRoot:process.cwd()}),D0=E0.code,v0=A4(E0.styles);D0=R5(D0).code;let{hasUserImports:J5,bundleClientScript:Z1}=await a("stx/client-script-bundler",()=>import("./chunk-hx338p3h.js"));if(J5(D0))D0=await Z1(D0,O,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:i}=await a("stx/signal-processing",()=>import("./chunk-wzytd8fh.js"));D0=D0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(s0,E5)=>i(E5));let Y0=o0(D0),X1=bG(Y0),j1=`function(__scopeId) {
|
|
3673
3673
|
${l1("const",[...$8,...X1],Y0)}
|
|
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,Y)=>Zq(X,Y)).join(`
|
|
3793
3793
|
`)}`}function J8($){let Z=[],X=new Set,Y=$.replace(/^\s*import\s+.*$/gm,""),J=0,Q=Y.length,G=0;while(G<Q){let q=Y[G];if(q==="'"||q==='"'||q==="`"){let U=q;if(G++,U==="`"){let W=0;while(G<Q){if(Y[G]==="\\"){G+=2;continue}if(Y[G]==="`"&&W===0){G++;break}if(Y[G]==="$"&&Y[G+1]==="{"){W++,G+=2;continue}if(Y[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<Q){if(Y[G]==="\\"){G+=2;continue}if(Y[G]===U){G++;break}G++}continue}if(q==="/"&&Y[G+1]==="/"){while(G<Q&&Y[G]!==`
|
|
3794
|
-
`)G++;continue}if(q==="/"&&Y[G+1]==="*"){G+=2;while(G<Q-1&&!(Y[G]==="*"&&Y[G+1]==="/"))G++;G+=2;continue}if(q==="{"){J++,G++;continue}if(q==="}"){J--,G++;continue}if(J===0){let U=Y.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 K=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[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+=K[0].length;continue}let z=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let H=z[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=z[0].length;continue}}G++}return Z}var Yq=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 Jq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!Yq.has(j))Z.add(j)}}let J=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=J.exec($))!==null)Y(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)Y(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)Y(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)Y(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)Y(Q[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=K.exec($))!==null)Y(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)Y(Q[1]);return Z}async function N$($,Z={}){let X=$,Y="",J=!1,Q=[],G=N4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=A4(G.styles),U=R5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:K}=await a("stx/client-script-bundler",()=>import("./chunk-
|
|
3794
|
+
`)G++;continue}if(q==="/"&&Y[G+1]==="*"){G+=2;while(G<Q-1&&!(Y[G]==="*"&&Y[G+1]==="/"))G++;G+=2;continue}if(q==="{"){J++,G++;continue}if(q==="}"){J--,G++;continue}if(J===0){let U=Y.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 K=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[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+=K[0].length;continue}let z=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let H=z[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=z[0].length;continue}}G++}return Z}var Yq=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 Jq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!Yq.has(j))Z.add(j)}}let J=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=J.exec($))!==null)Y(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)Y(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)Y(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)Y(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)Y(Q[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=K.exec($))!==null)Y(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)Y(Q[1]);return Z}async function N$($,Z={}){let X=$,Y="",J=!1,Q=[],G=N4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=A4(G.styles),U=R5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:K}=await a("stx/client-script-bundler",()=>import("./chunk-hx338p3h.js"));if(W(X))X=await K(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),J=!0;if(Z.autoImports!==!1){let F=W8(X);X=F.code,Y=K8(F.stxImports,F.browserImports.filter((L)=>!Q.includes(L)))}if(Y=`${o3(X,Z.serverData)}${Y}`,X=o0(X),!J&&N1(Z.attrs||""))X=A1(X);let z=Xq(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
|
${n1(`${Y}${X}
|
|
3796
3796
|
${z}`)}
|
|
3797
3797
|
</script>`}let j=G8($),_=/function __stx_setup_/.test(X),V=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function O(F){let L=F.length>0?`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{So as a,To as b}from"./chunk-
|
|
2
|
+
import{So as a,To as b}from"./chunk-6wx32fa5.js";import"./chunk-8src5smc.js";import"./chunk-gcnrdgrq.js";import"./chunk-xp3fp266.js";import"./chunk-nye9brje.js";import"./chunk-31xczh3c.js";import"./chunk-cbc56wpd.js";import"./chunk-x0zh76yv.js";import"./chunk-0ae6chzd.js";import"./chunk-kjr22neh.js";import"./chunk-3952ykhb.js";import"./chunk-dtmwr674.js";import"./chunk-pw0rzgpv.js";export{b as processLoops,a as parseLoopBinding};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Io as a,Jo as b,Ko as c,Lo as d,Mo as e,No as f,Oo as g,Po as h,Qo as i,Ro as j}from"./chunk-
|
|
2
|
+
import{Io as a,Jo as b,Ko as c,Lo as d,Mo as e,No as f,Oo as g,Po as h,Qo as i,Ro as j}from"./chunk-6wx32fa5.js";import"./chunk-8src5smc.js";import"./chunk-gcnrdgrq.js";import"./chunk-xp3fp266.js";import"./chunk-nye9brje.js";import"./chunk-31xczh3c.js";import"./chunk-cbc56wpd.js";import"./chunk-x0zh76yv.js";import"./chunk-0ae6chzd.js";import"./chunk-kjr22neh.js";import"./chunk-3952ykhb.js";import"./chunk-dtmwr674.js";import"./chunk-pw0rzgpv.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ui as a,Vi as b}from"./chunk-
|
|
2
|
+
import{Ui as a,Vi as b}from"./chunk-jn49sc7r.js";import"./chunk-ht51fz7w.js";import"./chunk-6wx32fa5.js";import"./chunk-8src5smc.js";import"./chunk-gcnrdgrq.js";import"./chunk-xp3fp266.js";import"./chunk-nye9brje.js";import"./chunk-31xczh3c.js";import"./chunk-cbc56wpd.js";import"./chunk-x0zh76yv.js";import"./chunk-0ae6chzd.js";import"./chunk-kjr22neh.js";import"./chunk-3952ykhb.js";import"./chunk-dtmwr674.js";import"./chunk-pw0rzgpv.js";export{a as getStoreScript,b as clearStoreCache};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Cg as a}from"./chunk-ndnc7k2n.js";import{Og as n,Qg as FF,Rg as YF,Sg as ZF}from"./chunk-
|
|
2
|
+
import{Cg as a}from"./chunk-ndnc7k2n.js";import{Og as n,Qg as FF,Rg as YF,Sg as ZF}from"./chunk-bw1b1sw8.js";import{xj as C,yj as D}from"./chunk-whq99ytc.js";import{Ak as XF,yk as JF,zk as QF}from"./chunk-yckd6ks5.js";import{Ir as c,Kr as N,Np as o,Up as e,Vp as t,Yl as l,_l as d,lq as u,zp as r}from"./chunk-6wx32fa5.js";import{Gs as s}from"./chunk-31xczh3c.js";import{Xt as S,Zt as zF}from"./chunk-3952ykhb.js";import G from"fs";import Z from"path";import{createHash as WF}from"crypto";zF();function g(J){return WF("sha256").update(J).digest("hex").slice(0,8)}function f(J=!1){let q=J?D():C(),z=g(q);return{content:q,filename:`runtime.${z}.js`,hash:z}}function m(){let J=S(),q=g(J);return{content:J,filename:`router.${q}.js`,hash:q}}function KF(J){return{runtimeTag:J.runtime?`<script src="/__stx/${J.runtime.filename}"></script>`:"",routerTag:J.router?`<script src="/__stx/${J.router.filename}"></script>`:"",cssTag:J.css?`<link rel="stylesheet" href="/__stx/${J.css.filename}">`:""}}import h from"path";import{createHash as $F}from"crypto";function GF(J={}){let q=new Set;return{context:new Proxy(J,{get(Q,X){if(X in Q)return Q[X];if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return},has(Q,X){if(X in Q)return!0;if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return!1}}),accessedKeys:q}}async function p(J,q,z={}){let Q=h.resolve(J),X=await Bun.file(Q).text(),I=$F("sha256").update(X).digest("hex").slice(0,16);l();let K={};try{K=await N()}catch{}let B=[],V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k;while((k=V.exec(X))!==null){let $=k[1];if(/\bserver\b/.test($))B.push(k[2])}let W=new Set(B.flatMap(($)=>a($))),{context:E}=GF({__filename:Q,__dirname:h.dirname(Q),__stx_serverDeclared:W}),L=new Set,_={...c,...K,...z,buildMode:"compile",strict:!1},w=await u(X,E,Q,_,L),U=n(w),H=d();return{route:q,sourceFile:J,html:w,fragment:U,placeholders:H,hasServerScripts:B.length>0,serverScriptContent:B,dependencies:Array.from(L),contentHash:I,streamTemplates:E.__streamTemplates}}var VF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function i(J,q){let z=0,Q=0;if(!G.existsSync(J))return{copied:z,bytes:Q};G.mkdirSync(q,{recursive:!0});function X(I,K){let B=G.readdirSync(I,{withFileTypes:!0});for(let V of B){if(VF.has(V.name))continue;let k=Z.join(I,V.name),W=Z.join(K,V.name);if(V.isDirectory())G.mkdirSync(W,{recursive:!0}),X(k,W);else if(V.isFile()){if(G.existsSync(W))continue;G.copyFileSync(k,W),z++,Q+=G.statSync(W).size}}}return X(J,q),{copied:z,bytes:Q}}async function mF(J={}){let q=Date.now(),z=Z.resolve(J.root||process.cwd()),Q=Z.resolve(z,J.outputDir||".output");console.log("[stx build] Starting production build...");let X={};try{X=await N()}catch{}let I=J.componentsDir??X.componentsDir??"components",K=J.partialsDir??X.partialsDir??"partials",B=J.layoutsDir??X.layoutsDir??"layouts",V=J.publicDir??X.publicDir??"public",k=X.app?.head||{},W=X.app?.colorMode,E=X.router?.container||"main";if(G.existsSync(Q))G.rmSync(Q,{recursive:!0});let L=[Z.join(Q,"public","__stx"),Z.join(Q,"public","assets"),Z.join(Q,"server","pages"),Z.join(Q,"server","fragments")];for(let Y of L)G.mkdirSync(Y,{recursive:!0});console.log("[stx build] Discovering routes...");let _=t(z),w=["components","layouts","partials"],U=_.filter((Y)=>{return!w.some((F)=>Y.pattern.startsWith(`/${F}/`)||Y.pattern===`/${F}`)});console.log(`[stx build] Found ${U.length} page routes (${_.length-U.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let H=f(J.debug),$=m();await Bun.write(Z.join(Q,"public","__stx",H.filename),H.content),await Bun.write(Z.join(Q,"public","__stx",$.filename),$.content),console.log(`[stx build] Runtime: ${H.filename} (${(H.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${$.filename} (${($.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],j=[];for(let Y of U)try{let F=await p(Y.filePath,Y.pattern,{componentsDir:I,partialsDir:K,layoutsDir:B,debug:J.debug});if(O.push(F),F.html=F.html.replace(/runtime\.__STX_HASH__\.js/g,H.filename).replace(/router\.__STX_HASH__\.js/g,$.filename),F.html=e(F.html,k,{bodyScripts:[`<script src="/__stx/${$.filename}"></script>`],...W&&{colorMode:W}}),W)F.html=r(F.html,W);if(k.htmlAttrs)F.html=o(F.html,k.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(F.html)){let T=F.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(T&&T[1]){let P=T[1];F.html=F.html.replace(" "+P,""),F.html=F.html.replace(/<body([^>]*)>/,`<body$1 ${P}>`)}}F.html=F.html.replace(/<style data-crosswind="generated">[\s\S]*?<\/style>\s*/g,""),F.html=await s(F.html),F.fragment=FF(F.html,E);let y=Y.pattern==="/"?"index":Y.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),b=Z.join("server","pages",`${y}.compiled.json`),A=Z.join("server","fragments",`${y}.html`);await Bun.write(Z.join(Q,b),JSON.stringify(F,null,2)),await Bun.write(Z.join(Q,A),F.fragment),j.push({pattern:Y.pattern,compiledPath:b,fragmentPath:A,isDynamic:F.hasServerScripts,hasParams:Y.pattern.includes(":")||Y.pattern.includes("[")}),console.log(`[stx build] \u2713 ${Y.pattern}`)}catch(F){console.error(`[stx build] \u2717 ${Y.pattern}:`,F instanceof Error?F.message:F)}let M=Z.resolve(z,V);if(G.existsSync(M)){let{copied:Y,bytes:F}=i(M,Z.join(Q,"public"));if(Y>0)console.log(`[stx build] Copied ${Y} public asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${V}/`)}let v=XF(z);if(v){let{copied:Y,bytes:F}=i(v,Z.join(Q,"public",QF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${JF}/`)}let R={runtime:H.filename,router:$.filename},qF=YF(j,R,Q);ZF(qF,Q);let x=Date.now()-q;return console.log(`
|
|
3
3
|
[stx build] Done in ${x}ms \u2014 ${O.length} pages compiled`),{pageCount:O.length,assets:R,outputDir:Q,duration:x}}
|
|
4
4
|
export{g as sg,f as tg,m as ug,KF as vg,p as wg,mF as xg};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{jj as a,kj as b,lj as c,mj as d,nj as e,oj as f,pj as g,qj as h,rj as i,sj as j,tj as k,uj as l,vj as m,wj as n}from"./chunk-
|
|
2
|
+
import{jj as a,kj as b,lj as c,mj as d,nj as e,oj as f,pj as g,qj as h,rj as i,sj as j,tj as k,uj as l,vj as m,wj as n}from"./chunk-a4mcc2dm.js";import"./chunk-6wx32fa5.js";import"./chunk-8src5smc.js";import"./chunk-gcnrdgrq.js";import"./chunk-xp3fp266.js";import"./chunk-nye9brje.js";import"./chunk-31xczh3c.js";import"./chunk-cbc56wpd.js";import"./chunk-x0zh76yv.js";import"./chunk-0ae6chzd.js";import"./chunk-kjr22neh.js";import"./chunk-3952ykhb.js";import"./chunk-dtmwr674.js";import"./chunk-pw0rzgpv.js";export{i as streamingSuspenseDirective,m as streamToResponse,g as streamTemplateSimple,a as streamTemplate,d as renderStreamingPage,k as registerStreamingDirectives,e as processStreamDirectives,l as processSectionDirectives,j as islandDirective,n as generateHydrationRuntime,f as extractStreamBoundaries,h as createStreamRenderer,b as buildSuspenseResolveScript,c as SUSPENSE_RESOLVER_RUNTIME};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Dq as x,Ir as g,Mo as R,jm as O,lq as H}from"./chunk-
|
|
2
|
+
import{Dq as x,Ir as g,Mo as R,jm as O,lq as H}from"./chunk-6wx32fa5.js";import b from"path";var v={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},M=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var T=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function f(q){let B=[],Q=0,G;T.lastIndex=0;while((G=T.exec(q))!==null){if(G.index>Q){let X=q.slice(Q,G.index);if(X.trim())B.push({type:B.length===0?"shell":"content",content:X})}let J=G[1],K=G[2];B.push({type:"suspense",name:J,content:K}),Q=G.index+G[0].length}if(Q<q.length){let J=q.slice(Q);if(J.trim())B.push({type:B.length===0?"shell":"content",content:J})}if(B.length===0)B.push({type:"shell",content:q});return B}async function r(q,B={},Q={}){let G={...g,...Q,streaming:{...v,...Q.streaming}},J=G.streaming?.bufferSize||16384;return new ReadableStream({async start(K){try{let X=await Bun.file(q).text(),z=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),L=z?z[1]:"",Y=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),j={...B,__filename:q,__dirname:b.dirname(q)};if(L.trim())await R(L,j,q);let D=f(Y),$=new Set;if(!D.some((w)=>w.type==="suspense")){let w=G.streaming?.strategy||"auto",U=new RegExp(M.source,"g");if(!(w!=="manual"&&U.test(Y))){let F=await H(Y,j,q,G,$);for(let V=0;V<F.length;V+=J)K.enqueue(F.slice(V,V+J)),await new Promise((W)=>setTimeout(W,0))}else{let F=[],V=new RegExp(M.source,"g"),W;while((W=V.exec(Y))!==null)F.push({name:W[1],content:W[2],start:W.index,end:W.index+W[0].length});let y=0;for(let A of F){if(A.start>y){let k=Y.slice(y,A.start);if(k.trim()){let E=await H(k,j,q,G,$);K.enqueue(E),await new Promise((S)=>setTimeout(S,0))}}let I=await H(A.content,j,q,G,$);K.enqueue(I),await new Promise((k)=>setTimeout(k,0)),y=A.end}if(y<Y.length){let A=Y.slice(y);if(A.trim()){let I=await H(A,j,q,G,$);K.enqueue(I)}}}}else{let w=new Map;for(let Z of D)if(Z.type==="shell"||Z.type==="content"){let F=await H(Z.content,j,q,G,$);K.enqueue(F)}else if(Z.type==="suspense"&&Z.name){let F=`stx-suspense-${Z.name}`;K.enqueue(`<div id="${F}" data-suspense="${Z.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(Z.name,H(Z.content,j,q,G,$))}K.enqueue(`
|
|
5
5
|
<script>
|