@stacksjs/stx 0.2.272 → 0.2.273
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtins/image-delivery.js +6 -3
- package/dist/{chunk-j8681w5d.js → chunk-0vjgbyf7.js} +17 -17
- package/dist/{chunk-96140mfb.js → chunk-1eg447es.js} +1 -1
- package/dist/{chunk-xn2zy1gd.js → chunk-2ymz6nrt.js} +1 -1
- package/dist/{chunk-4qfm583k.js → chunk-3cacp3v6.js} +1 -1
- package/dist/{chunk-35kf50cw.js → chunk-4c6wz64s.js} +1 -1
- package/dist/{chunk-p0cneyek.js → chunk-51qxyf3s.js} +1 -1
- package/dist/{chunk-51yszp1w.js → chunk-5cket5g3.js} +2 -2
- package/dist/{chunk-c0pvdmfs.js → chunk-5z466wfw.js} +1 -1
- package/dist/{chunk-xzt8dzgv.js → chunk-6pshqqjt.js} +1 -1
- package/dist/{chunk-30143e31.js → chunk-75w11fde.js} +1 -1
- package/dist/{chunk-t42zxf25.js → chunk-76258rpp.js} +1 -1
- package/dist/chunk-8sg8tspq.js +2 -0
- package/dist/{chunk-m6026skx.js → chunk-980vbj13.js} +1 -1
- package/dist/{chunk-07z7y2a2.js → chunk-av7n7vdr.js} +1 -1
- package/dist/{chunk-fm2sz04y.js → chunk-b8mq8vaz.js} +1 -1
- package/dist/{chunk-fyd647kt.js → chunk-cdmnfb6q.js} +1 -1
- package/dist/{chunk-xcde8pyv.js → chunk-crkxdfsc.js} +1 -1
- package/dist/{chunk-9tg9p0q0.js → chunk-czsv3zcn.js} +1 -1
- package/dist/{chunk-8n0axwzb.js → chunk-dw3c9zg3.js} +1 -1
- package/dist/{chunk-tv9jqnnd.js → chunk-e5ncpk9f.js} +8 -8
- package/dist/{chunk-66e09mb8.js → chunk-e7b2p0h4.js} +1 -1
- package/dist/{chunk-9bcawqjd.js → chunk-eaqh53ea.js} +1 -1
- package/dist/{chunk-h8zkmta2.js → chunk-edt2q2bp.js} +1 -1
- package/dist/{chunk-7e7m858p.js → chunk-egbaw4bh.js} +1 -1
- package/dist/{chunk-nrhw244y.js → chunk-gwkxf766.js} +1 -1
- package/dist/chunk-h45js0cg.js +3 -0
- package/dist/{chunk-pzq1nng4.js → chunk-h7fzgd2n.js} +1 -1
- package/dist/{chunk-zvs473zc.js → chunk-hqpsxzxe.js} +1 -1
- package/dist/{chunk-xdmqw057.js → chunk-jjfet3b4.js} +1 -1
- package/dist/{chunk-9bmv5hxy.js → chunk-jks6f8f5.js} +1 -1
- package/dist/{chunk-1j4251qt.js → chunk-kmj6hxen.js} +1 -1
- package/dist/{chunk-zztyxerk.js → chunk-m0n5rn6r.js} +1 -1
- package/dist/chunk-qsty6qvn.js +2 -0
- package/dist/{chunk-0wqkwhtt.js → chunk-qv6cjn0k.js} +1 -1
- package/dist/{chunk-tzjdzsed.js → chunk-rda8tspf.js} +1 -1
- package/dist/{chunk-c1xtbxj3.js → chunk-rsr2m2hq.js} +1 -1
- package/dist/{chunk-05zkyg7x.js → chunk-sj8887k1.js} +2 -2
- package/dist/{chunk-2y22cbx8.js → chunk-t42rq0p7.js} +1 -1
- package/dist/{chunk-eyrspbb3.js → chunk-tdcrah1x.js} +1 -1
- package/dist/{chunk-e4eaw8hx.js → chunk-wanmxrha.js} +1 -1
- package/dist/{chunk-5csxdsgw.js → chunk-yapm6eaz.js} +1 -1
- package/dist/{chunk-11hvcgsk.js → chunk-yn1k391m.js} +1 -1
- package/dist/{chunk-bdp331cr.js → chunk-z7pzgevr.js} +1 -1
- package/dist/{chunk-pqr402py.js → chunk-z7yenntp.js} +1 -1
- package/dist/{chunk-jg0578yr.js → chunk-zmm9fkte.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-dk3bn44r.js +0 -2
- package/dist/chunk-w5c9n99f.js +0 -2
- package/dist/chunk-x9s335jt.js +0 -3
|
@@ -47,12 +47,15 @@ export function clearImageDeliveryCatalog() {
|
|
|
47
47
|
deliveryCatalog = new Map;
|
|
48
48
|
}
|
|
49
49
|
export async function prepareImageDelivery(publicDir, outputDir) {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
if (!publicDir || !fs.existsSync(publicDir)) {
|
|
51
|
+
clearImageDeliveryCatalog();
|
|
52
52
|
return { count: 0, fingerprint: "" };
|
|
53
|
+
}
|
|
53
54
|
const files = await collectRasterImages(publicDir);
|
|
54
|
-
if (files.length === 0)
|
|
55
|
+
if (files.length === 0) {
|
|
56
|
+
clearImageDeliveryCatalog();
|
|
55
57
|
return { count: 0, fingerprint: "" };
|
|
58
|
+
}
|
|
56
59
|
const catalog = await createImageDeliveryCatalog({
|
|
57
60
|
entries: files.map((file) => ({
|
|
58
61
|
key: publicUrl(file.relativePath),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{As as S6,Bs as C6,qs as j2}from"./chunk-1bwwtctk.js";import{Hs as t5}from"./chunk-q9zsjgpf.js";import{Ps as c0}from"./chunk-txys90mf.js";import{Qs as p1,Rs as m1,Ss as _2,Ts as G5,Vs as b1,Ws as v2,Xs as f2,lt as V2}from"./chunk-
|
|
2
|
+
import{As as S6,Bs as C6,qs as j2}from"./chunk-1bwwtctk.js";import{Hs as t5}from"./chunk-q9zsjgpf.js";import{Ps as c0}from"./chunk-txys90mf.js";import{Qs as p1,Rs as m1,Ss as _2,Ts as G5,Vs as b1,Ws as v2,Xs as f2,lt as V2}from"./chunk-eaqh53ea.js";import{mt as P6,ot as v6,pt as f6,rt as L5}from"./chunk-1spzqjve.js";import{st as v8}from"./chunk-h45js0cg.js";import{Bt as k2,vt as O2,zt as G$}from"./chunk-t7b39wwk.js";import{Mt as F2}from"./chunk-w18t3nmy.js";import{$t as $2,Nt as w7,Ot as d2,Pt as P2,Qt as c1,Ut as m2,Vt as t4,Wt as D8,Yt as P9}from"./chunk-yvpagchj.js";import{Ku as B2,Mu as dG,Nu as X3,Pu as j5,ju as K4,mu as K8,tu as $4}from"./chunk-rhbq1var.js";import{Uu as x6}from"./chunk-2c2z8n54.js";import{Zu as x}from"./chunk-71gwef4q.js";import S1 from"path";import S5 from"fs";var o4=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"]),r4={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"},s2=new Set(["ctrl","alt","shift","meta"]),e4={left:0,middle:1,right:2};function a4($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let X of $){let J=X.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(s2.has(J))Z.systemKeys.push(J);else if(J in e4)Z.mouse=J;else if(J in r4||/^[a-z]$/.test(J))Z.keys.push(r4[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function $7($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,q]=Y,W=Y.index,K=W+Q.length,U=`__stx_evt_${X++}`,z=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(q))!==null){let[,_,L]=j,V=_.split("."),O=V[0];if(!o4.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:L,modifiers:a4(V.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(q))!==null){let[,_,L]=j,V=_.split("."),O=V[0];if(!o4.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:L,modifiers:a4(V.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:Q,elementId:U,events:z,startIndex:W,endIndex:K})}return Z}function o2($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let J of X.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(X.keys.length>0){let J=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(X.mouse!==null){let J=e4[X.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function r2($,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 m$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function a2($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=o2($),Y=r2(m$($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",q=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${X}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -3352,9 +3352,9 @@ ${j9($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3352
3352
|
} finally {
|
|
3353
3353
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3354
3354
|
}
|
|
3355
|
-
})();`}function PY($,Z){if(q1($)){let Y=q1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};return{html:v1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0}}let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};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,stamped:!0}}return{html:$,mergedIntoExisting:null,stamped:!1}}var H9=0,FH=new p1(500),V9=new Set;function LH(){V9.clear()}function vY($){if($.__onceStore instanceof Set)return $.__onceStore;return V9}async function r3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||z0.join(z0.dirname(X),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let q=yY($,"@partial","@include"),W=vY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,L,V)=>{let O=L.trim(),F=`${X}:${O}`;if(W.has(F))return"";return W.add(F),L});{let _=/@includeIf\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")")F--;w++}if(F!==0)break;let R=q.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let A=D[1],k=K(A,G,X),N="";if(k&&await Bun.file(k).exists())Y.add(k),N=`@include(${R})`;q=q.substring(0,V)+N+q.substring(w),_.lastIndex=0}}for(let[_,L]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=V.exec(q))!==null){let F=O.index,w=F+O[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 A=q.substring(w+1,D-1),k=o3(A,0);if(k===-1){V.lastIndex=D;continue}let N=A.substring(0,k).trim(),M=A.substring(k+1).trim(),T=M.match(/^\s*['"]([^'"]+)['"]/);if(!T){V.lastIndex=D;continue}let I=T[1],C=M.substring(T[0].length),E,b=o3(C,0);if(b!==-1)E=C.substring(b+1).trim();try{let y=`Boolean(${N})`,P;if(q0(y)){let g=W0(y,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(e(y,Z));let f=L?!P:P,d="";if(f){let g=K(I,G,X);if(g&&await Bun.file(g).exists())Y.add(g);d=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,F)+d+q.substring(D),V.lastIndex=0}catch(y){let P=y instanceof Error?y.message:String(y),f=j0("Include",`Error evaluating ${_} condition: ${P}`,X,$,F);q=q.substring(0,F)+f+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){_.lastIndex=0,q=q.replace(D,"");continue}let[,k,N,M,T]=A;try{let I,C=N.trim();if(q0(C))I=W0(C,Object.keys(Z))(...Object.values(Z));else I=e(C,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let y={...Z,[M]:b},P=await H(k,y,$,V);E+=P}else if(T)E=await H(T,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(I){let C=I instanceof Error?I.message:String(I);q=q.substring(0,V)+j0("Each",`Error in @each: ${C}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){_.lastIndex=0,q=q.replace(D,"");continue}let k=A[1],N=R.slice(A[0].length),M,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let E=1,b=1;while(b<N.length&&E>0){if(N[b]==="{")E++;else if(N[b]==="}"){if(E--,E===0)break}b++}M=N.substring(0,b+1),N=N.slice(b+1)}let I,C=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(C)I=C[1];try{let E=JSON.parse(k.replace(/'/g,'"')),b={};if(M)try{b=R0(M,Z)}catch(P){let f=P instanceof Error?P.message:String(P);if(J.debug){let d=j0("Include",`Error parsing includeFirst variables: ${f}`,X,$,V,D);q=q.replace(D,()=>d)}else q=q.replace(D,()=>I||"");continue}let y=!1;for(let P of E){let f=K(P,G,X);if(!f)continue;if(await t(f)){let d=await H(P,b,$,V);q=q.replace(D,()=>d),y=!0;break}}if(!y)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let P=j0("Include",`None of the includeFirst paths exist: ${k}`,X,$,V,D);q=q.replace(D,()=>P)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),y=j0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>y)}_.lastIndex=0}}function K(_,L,V){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let F=z0.resolve(L),w=z0.resolve(z0.dirname(V)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=z0.resolve(L,O);else R=z0.resolve(w,O);let D=z0.normalize(R),A=D.startsWith(F+z0.sep)||D===F,k=D.startsWith(w+z0.sep)||D===w,N=!1,M=z0.dirname(w);if(D.startsWith(M+z0.sep)){if(!z0.relative(M,D).split(z0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))N=!0}if(!A&&!k&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${F}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let U=z0.resolve(X);Q.add(U);function z(_,L,V,O){return J.onIncludeError?.({includePath:_,templatePath:X,message:L,partialsDir:G}),j0("Include",L,X,V,O)}async function H(_,L={},V,O){let F=K(_,G,X);if(!F)return z(_,`Could not resolve path for include: ${_}`,V,O);let w=z0.resolve(F);if(Q.has(w)){let R=[...Q,w].map((D)=>z0.basename(D)).join(" -> ");return z(_,`Circular include detected: ${R}`,V,O)}try{Y.add(F);let R;if(!R)try{R=await Bun.file(F).text()}catch(f){let d=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${d}`,V,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-
|
|
3356
|
-
`;continue}if(Q0)try{let{extractVariables:X0}=await import("./chunk-
|
|
3357
|
-
`}}if(b){let f=PY(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting;else if(!f.stamped)console.warn(`[stx] ${z0.relative(process.cwd(),F)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`)}if(D.includes("@include")||D.includes("@partial"))D=await r3(D,T,F,J,Y,Q);let{processLoops:y}=await import("./chunk-
|
|
3355
|
+
})();`}function PY($,Z){if(q1($)){let Y=q1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};return{html:v1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0}}let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};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,stamped:!0}}return{html:$,mergedIntoExisting:null,stamped:!1}}var H9=0,FH=new p1(500),V9=new Set;function LH(){V9.clear()}function vY($){if($.__onceStore instanceof Set)return $.__onceStore;return V9}async function r3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||z0.join(z0.dirname(X),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let q=yY($,"@partial","@include"),W=vY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,L,V)=>{let O=L.trim(),F=`${X}:${O}`;if(W.has(F))return"";return W.add(F),L});{let _=/@includeIf\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")")F--;w++}if(F!==0)break;let R=q.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let A=D[1],k=K(A,G,X),N="";if(k&&await Bun.file(k).exists())Y.add(k),N=`@include(${R})`;q=q.substring(0,V)+N+q.substring(w),_.lastIndex=0}}for(let[_,L]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=V.exec(q))!==null){let F=O.index,w=F+O[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 A=q.substring(w+1,D-1),k=o3(A,0);if(k===-1){V.lastIndex=D;continue}let N=A.substring(0,k).trim(),M=A.substring(k+1).trim(),T=M.match(/^\s*['"]([^'"]+)['"]/);if(!T){V.lastIndex=D;continue}let I=T[1],C=M.substring(T[0].length),E,b=o3(C,0);if(b!==-1)E=C.substring(b+1).trim();try{let y=`Boolean(${N})`,P;if(q0(y)){let g=W0(y,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(e(y,Z));let f=L?!P:P,d="";if(f){let g=K(I,G,X);if(g&&await Bun.file(g).exists())Y.add(g);d=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,F)+d+q.substring(D),V.lastIndex=0}catch(y){let P=y instanceof Error?y.message:String(y),f=j0("Include",`Error evaluating ${_} condition: ${P}`,X,$,F);q=q.substring(0,F)+f+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){_.lastIndex=0,q=q.replace(D,"");continue}let[,k,N,M,T]=A;try{let I,C=N.trim();if(q0(C))I=W0(C,Object.keys(Z))(...Object.values(Z));else I=e(C,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let y={...Z,[M]:b},P=await H(k,y,$,V);E+=P}else if(T)E=await H(T,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(I){let C=I instanceof Error?I.message:String(I);q=q.substring(0,V)+j0("Each",`Error in @each: ${C}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){_.lastIndex=0,q=q.replace(D,"");continue}let k=A[1],N=R.slice(A[0].length),M,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let E=1,b=1;while(b<N.length&&E>0){if(N[b]==="{")E++;else if(N[b]==="}"){if(E--,E===0)break}b++}M=N.substring(0,b+1),N=N.slice(b+1)}let I,C=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(C)I=C[1];try{let E=JSON.parse(k.replace(/'/g,'"')),b={};if(M)try{b=R0(M,Z)}catch(P){let f=P instanceof Error?P.message:String(P);if(J.debug){let d=j0("Include",`Error parsing includeFirst variables: ${f}`,X,$,V,D);q=q.replace(D,()=>d)}else q=q.replace(D,()=>I||"");continue}let y=!1;for(let P of E){let f=K(P,G,X);if(!f)continue;if(await t(f)){let d=await H(P,b,$,V);q=q.replace(D,()=>d),y=!0;break}}if(!y)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let P=j0("Include",`None of the includeFirst paths exist: ${k}`,X,$,V,D);q=q.replace(D,()=>P)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),y=j0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>y)}_.lastIndex=0}}function K(_,L,V){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let F=z0.resolve(L),w=z0.resolve(z0.dirname(V)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=z0.resolve(L,O);else R=z0.resolve(w,O);let D=z0.normalize(R),A=D.startsWith(F+z0.sep)||D===F,k=D.startsWith(w+z0.sep)||D===w,N=!1,M=z0.dirname(w);if(D.startsWith(M+z0.sep)){if(!z0.relative(M,D).split(z0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))N=!0}if(!A&&!k&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${F}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let U=z0.resolve(X);Q.add(U);function z(_,L,V,O){return J.onIncludeError?.({includePath:_,templatePath:X,message:L,partialsDir:G}),j0("Include",L,X,V,O)}async function H(_,L={},V,O){let F=K(_,G,X);if(!F)return z(_,`Could not resolve path for include: ${_}`,V,O);let w=z0.resolve(F);if(Q.has(w)){let R=[...Q,w].map((D)=>z0.basename(D)).join(" -> ");return z(_,`Circular include detected: ${R}`,V,O)}try{Y.add(F);let R;if(!R)try{R=await Bun.file(F).text()}catch(f){let d=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${d}`,V,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-jks6f8f5.js");R=f(R,Z)}if(R&&(J.debug||!O5()&&!Z$()))try{let{warnUnbalancedTags:f}=await import("./chunk-6nar1v2y.js");f(R,F)}catch{}let D=R;try{let{processESImports:f}=await import("./chunk-wanmxrha.js");await f(R,Z,F,J,Y)}catch(f){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,f instanceof Error?f.message:f)}let A=V$(D);if(A)D=A.content.trim();let N=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(N)M=`<style${N[1]}>${N[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=G1(R,F);for(let[f,d]of Object.entries(L))T[f]=d;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...R.matchAll(I)],E="",b=null;for(let f of C){let d=f[1]||"",g=f[2]||"",Q0=d.includes("server"),e0=A1(d);if(!Q0&&g.trim()){let{interpolateScriptExpressions:X0}=await import("./chunk-rsr2m2hq.js");g=X0(g,T)}let k0="";try{let{extractAndStripCssImports:X0,renderVendorStyleTags:H0}=await import("./chunk-jjfet3b4.js"),I0=X0(g,{filePath:F,projectRoot:process.cwd()});g=I0.code,k0=H0(I0.styles)}catch(X0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,X0 instanceof Error?X0.message:X0)}if(e0&&g.trim())g=M1(g);if(!Q0){try{let{injectBrowserCoreAutoImports:H0}=await import("./chunk-jjfet3b4.js");g=H0(g).code;let{hasUserImports:I0,bundleClientScript:E0}=await import("./chunk-rda8tspf.js");if(I0(g))g=await E0(g,F,{projectRoot:process.cwd()})}catch(H0){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,H0 instanceof Error?H0.message:H0)}let{stripStxRuntimeImports:X0}=await import("./chunk-2ymz6nrt.js");g=X0(g)}let C0=SY(g);if(C0&&!Q0){b=`stx_scope_${z0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++H9}`;let X0=$1(g),H0=CY(X0,b);E+=`${k0}<script data-stx-scoped data-stx-run="always">${H0}</script>
|
|
3356
|
+
`;continue}if(Q0)try{let{extractVariables:X0}=await import("./chunk-yapm6eaz.js");await X0(g,T,F)}catch(X0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,X0)}if(!Q0&&!C0){let X0=d.replace(/\bclient\b/i,"").trim();b=`stx_scope_${z0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++H9}`;let H0=$1(g),I0=_9(H0,b),E0=B9(H0,I0);E+=`${k0}<script data-stx-scoped data-stx-run="always"${X0?` ${X0}`:""}>${E0}</script>
|
|
3357
|
+
`}}if(b){let f=PY(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting;else if(!f.stamped)console.warn(`[stx] ${z0.relative(process.cwd(),F)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`)}if(D.includes("@include")||D.includes("@partial"))D=await r3(D,T,F,J,Y,Q);let{processLoops:y}=await import("./chunk-4c6wz64s.js"),P=y(D,T,F);if(P=X1(P,T,F),P=O1(P,T,F),M)P+=`
|
|
3358
3358
|
`+M;if(E)P+=`
|
|
3359
3359
|
`+E;return P}catch(R){let D=R instanceof Error?R.message:String(R);return z(_,`Error processing include ${_}: ${D}`,V,O)}}let j=/@include\s*\(/g,B;while((B=j.exec(q))!==null){let _=B.index,L=_+B[0].length-1,V=1,O=L+1;while(O<q.length&&V>0){if(q[O]==="(")V++;else if(q[O]===")")V--;O++}if(V!==0)break;let F=q.substring(_,O),w=q.substring(L+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=O;continue}let D=R[1],A,k=w.substring(R[0].length),N=o3(k,0);if(N!==-1)A=k.substring(N+1).trim();let M={};if(A)try{M=R0(A,Z)}catch(I){let C=I instanceof Error?I.message:String(I);q=q.replace(F,j0("Include",`Error parsing include variables for ${D}: ${C}`,X,$,_)),j.lastIndex=0;continue}let T=await H(D,M,$,_);q=q.substring(0,_)+T+q.substring(O),j.lastIndex=0}return q}function a3($,Z){let X=$;function J(Y,Q,G,q){let W=Y,K=!0;while(K){K=!1;let U=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=W.match(U);if(!z||z.index===void 0)break;let H=z.index,j=z[1],B=H+z[0].length,_=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),V=1,O=B,F=-1;while(V>0&&O<W.length){let R=W.slice(O),D=R.match(_),A=R.match(L),k=D?O+D.index:1/0,N=A?O+A.index:1/0;if(k<N)V++,O=k+(D[0].length||1);else if(N<1/0){if(V--,V===0){F=N;break}O=N+G.length+1}else break}if(F===-1)break;let w=W.slice(B,F);if(!Z[j])Z[j]=[];if(q)Z[j].unshift(w);else Z[j].push(w);W=W.substring(0,H)+W.substring(F+`@${G}`.length),K=!0}return W}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function t3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
|
|
3360
3360
|
`)})}import*as e3 from"path";async function O9($,Z,X=""){if(e3.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 L9($,Z,X,"@js","@endjs")}async function F9($,Z,X=""){if(e3.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 L9($,Z,X,"@ts","@endts")}async function L9($,Z,X,J,Y){let Q=$,G=m1(`${J}([\\s\\S]*?)${Y}`,"g"),q=[],W;while((W=G.exec($))!==null)q.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:K,content:U,index:z}of q)try{let H={...Z,global:Z},j=Object.keys(H),B=Object.values(H),_=U.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let V=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=V.length>0?`return { ${V.join(", ")} };`:"return {};",F=`
|
|
@@ -3526,14 +3526,14 @@ document.addEventListener("focusout",function(e){
|
|
|
3526
3526
|
${Z}${$.slice(G)}`}if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3527
3527
|
`+$.slice(G)}if(q1($))return v1($,(G)=>`${G}
|
|
3528
3528
|
${Z}`);return`${Z}
|
|
3529
|
-
${$}`}async function M$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return z4($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return z4($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-
|
|
3529
|
+
${$}`}async function M$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return z4($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return z4($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-cdmnfb6q.js"),J=await X(Z.debug);return z4($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function hQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function V8($){if($.includes("data-stx-tooltip-runtime")||!hQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${U4()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
|
|
3530
3530
|
${Z}`;return`${$.slice(0,X)}${Z}
|
|
3531
3531
|
${$.slice(X)}`}var uQ=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function dQ($){return uQ.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function mQ($,Z){if(!$.includes("</body>"))return $;if(dQ($))return $;let X=Z?.router,J="";{let q={};if(X){if(X.container)q.container=X.container;if(X.interceptAllLinks!==void 0)q.interceptAllLinks=X.interceptAllLinks;if(X.progress!==void 0)q.progress=X.progress;if(X.viewTransitions!==void 0)q.viewTransitions=X.viewTransitions;if(X.viewTransitionDuration!==void 0)q.viewTransitionDuration=X.viewTransitionDuration;if(X.viewTransitionEasing!==void 0)q.viewTransitionEasing=X.viewTransitionEasing;if(X.scrollToTop!==void 0)q.scrollToTop=X.scrollToTop;if(X.prefetch!==void 0)q.prefetch=X.prefetch;if(X.cache!==void 0)q.cache=X.cache;if(X.progressColor!==void 0)q.progressColor=X.progressColor;if(X.progressHeight!==void 0)q.progressHeight=X.progressHeight}try{let W=await H8(Z?.pagesDir);if(W.length>0)q.ownedRoutes=W}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${j8(q)};</script>
|
|
3532
|
-
`}let{getCachedRouterScript:Y}=await import("./chunk-
|
|
3532
|
+
`}let{getCachedRouterScript:Y}=await import("./chunk-cdmnfb6q.js"),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Y()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
|
|
3533
3533
|
</body>`+$.slice(G+7)}var O8=Symbol.for("stx.lazy-module-promises");function lQ(){let $=globalThis;return $[O8]??=new Map,$[O8]}function o($,Z){let X=lQ(),J=`${import.meta.url}\x00${$}`,Y=X.get(J);if(Y)return Y;let Q=Z();return X.set(J,Q),Q.catch(()=>{if(X.get(J)===Q)X.delete(J)}),Q}var j4=`(?:"[^"]*"|'[^']*'|[^>"'])*`,N8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function cQ($,Z={}){let X=[];for(let J of n5($,Q1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=Y[0].length,W=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,W),start:J.start,end:J.end})}return X}function A8($){let Z=$.trim(),X=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:q}=F8(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:q}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:q}=F8(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function F8($){let Z=$.trim(),X=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(X)return{itemVar:X[2],indexVar:X[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function _4($,Z){return D8($,Z)}function pQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,X=0,J;while((J=Z.exec($))!==null){let Y=J[1];if(Y.startsWith("if"))X++;else if(Y==="endif")X--;else if(X===0)return!0}return!1}function iQ($){let Z=new Set,X=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=X.exec($))!==null){let Q=Y[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function nQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${j4})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=n5($,(Q,G)=>{Z.lastIndex=G;let q=Z.exec(Q);if(!q||q.index!==G||!X.test(q[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of J){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let q=G[2].match(X),W=A8(q?.[1]??q?.[2]??""),K=[W.itemVar,W.indexVar].filter(Boolean);if(K.length===0)continue;let U=G[1],H=/\/\s*>$/.test(Q.token)||I$.has(U.toLowerCase())?Q.end:k8($,Q.start,U,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(K)})}return Y}var L8=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 sQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function w8($,Z,X,J){if(!$)return!1;let Y=sQ($),Q=!1,G=!1,q=!1,W=/([a-zA-Z_$][\w$]*)/g,K;while((K=W.exec(Y))!==null){let j=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(L8.has(j))continue;if(Z.has(j)||J?.has(j))Q=!0;else if(X&&j in X)G=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=U.exec(Y))!==null){let j=z[1];if(Y.slice(0,z.index).trimEnd().endsWith("."))continue;if(L8.has(j)||X&&j in X)continue;q=!0}return(Q||q)&&!G}function k$($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(N8);if(Q&&oQ(Q[3],Q[1])){let[,G,q,W]=Q;return`<${G}${q}${J}>${W}</${G}>`}return`<template${J}>${Y}</template>`}function oQ($,Z){let X=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Y;while((Y=X.exec($))!==null)if(Y[1]){if(J--,J<0)return!1}else J++;return!0}function M8($,Z){let X=iQ($);function J(Y){let Q=Y,G=nQ(Y),q=(z)=>{let H=new Set;for(let j of G)if(z>j.start&&z<j.end)for(let B of j.vars)H.add(B);return H},W=/@if\s*\(/g,K,U=[];while((K=W.exec(Q))!==null){let z=K.index,H=z+K[0].length,j=1,B=H;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let _=Q.substring(H,B-1).trim(),L=B,V=1,O=L,F=/@(if\s*\(|endif)/g;F.lastIndex=L;let w;while((w=F.exec(Q))!==null)if(w[1].startsWith("if"))V++;else if(w[1]==="endif"){if(V--,V===0){O=w.index+w[0].length;break}}if(V!==0)continue;let R=Q.substring(L,O-6).trim(),D;if(pQ(R)){let A=w5(Q.substring(z,O));if(A.length===0)continue;let k=A[0].branches.filter((I)=>I.type!=="else"),N=q(z);if(!(k.length>0&&k.every((I)=>w8(I.condition,X,Z,N))))continue;D=A[0].branches.map((I)=>{let C=J(I.content);if(I.type==="elseif")return k$(C,"@else-if",I.condition??"");if(I.type==="else")return k$(C,"@else");return k$(C,"@if",I.condition??"")}).join(`
|
|
3534
3534
|
`)}else{if(!w8(_,X,Z,q(z)))continue;D=k$(J(R),"@if",_)}U.push({start:z,end:O,replacement:D}),W.lastIndex=O}for(let z=U.length-1;z>=0;z--){let{start:H,end:j,replacement:B}=U[z];Q=Q.substring(0,H)+B+Q.substring(j)}return Q}return J($)}function rQ($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let X=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(X)return X[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}var I$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k8($,Z,X,J){if(I$.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,W=J;while(W<G){let K=$.indexOf("<",W);if(K===-1)return-1;if(W=K,$.startsWith("<!--",W)){let j=$.indexOf("-->",W+4);if(j===-1)return-1;W=j+3;continue}let U=/^<(script|style)\b/i.exec($.slice(W,W+8));if(U){let j=$.indexOf(">",W);if(j===-1)return-1;if($[j-1]==="/"){W=j+1;continue}let B=Q.indexOf(`</${U[1].toLowerCase()}`,W);if(B===-1)return-1;let _=$.indexOf(">",B);if(_===-1)return-1;W=_+1;continue}if($[W+1]==="/"){let j=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!j){W++;continue}if(j[1].toLowerCase()===Y){if(q--,W+=j[0].length,q===0)return W;continue}W+=j[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!z){W++;continue}let H=$.indexOf(">",W);if(H===-1)return-1;if(z[1].toLowerCase()===Y){let j=$.slice(W,H+1);if(!(/\/\s*>$/.test(j)||I$.has(Y)))q++}W=H+1}return-1}var aQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function tQ($,Z){let X=Z,J=$.length;for(;;){while(X<J&&$[X]!=="<")X++;if(X>=J)return!1;if($.startsWith("<!--",X)){let G=$.indexOf("-->",X+4);if(G===-1)return!1;X=G+3;continue}break}if($[X+1]==="/")return!1;let Y=$.indexOf(">",X);if(Y===-1)return!1;let Q=$.slice(X,Y+1);return aQ.test(Q)}function I8($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=X.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Y=(z)=>Z.some(([H,j])=>z>=H&&z<j),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],q;while((q=Q.exec($))!==null){if(Y(q.index))continue;let[z,H,j,B,_,L,V]=q,O=rQ(_);if(O===void 0)continue;let F=q.index,w=F+z.length,A=!!V||/\/\s*>$/.test(z)||I$.has(H.toLowerCase())?w:k8($,F,H,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&tQ($,A)){Q.lastIndex=w;continue}if(O===!0){let N=`<${H}${j}${L}${V}>`;G.push({start:F,end:w,replacement:N});continue}G.push({start:F,end:A,replacement:""}),Q.lastIndex=A}if(G.length===0)return $;G.sort((z,H)=>z.start-H.start);let W=[],K=-1;for(let z of G){if(z.start<K)continue;W.push(z),K=z.end}let U=$;for(let z=W.length-1;z>=0;z--){let{start:H,end:j,replacement:B}=W[z];U=U.substring(0,H)+B+U.substring(j)}return U}function T8($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let q=Y[1],W=Y.index,K=W+Y[0].length,U=1,z=K;while(z<X.length&&U>0){if(X[z]==="(")U++;else if(X[z]===")")U--;z++}if(U!==0)continue;let H=X.substring(K,z-1).trim(),j=z,B=A8(H),_=q==="for"?"@endfor":"@endforeach",L=1,V=j,O=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");O.lastIndex=j;let F;while((F=O.exec(X))!==null)if(F[1].startsWith(q))L++;else if(L--,L===0){V=F.index+F[0].length;break}if(L!==0)continue;let w=()=>{let k=[B.itemVar,B.indexVar].filter(Boolean);if(k.length)G.push({start:W,end:V,vars:k})};if(B.iterable){let k=B.iterable.trim();if(k.startsWith("[")||k.startsWith("{")||k.startsWith("'")||k.startsWith('"')||k.startsWith("`")||/^-?\d/.test(k)){w();continue}let N=k.split(/[.[(]/)[0].trim(),M=Z?N in Z:!1,T=G.some((I)=>W>I.start&&W<I.end&&I.vars.includes(N));if(N&&(M||T)){w();continue}}if(B.style==="as")H=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=X.substring(j,V-_.length).trim(),D=R.match(N8),A;if(D){let[,k,N,M]=D;A=`<${k}${N} @for="${H}">${M}</${k}>`}else A=`<template @for="${H}">${R}</template>`;Q.push({start:W,end:V,replacement:A})}for(let q=Q.length-1;q>=0;q--){let{start:W,end:K,replacement:U}=Q[q];X=X.substring(0,W)+U+X.substring(K)}return X}function eQ($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(U)=>{let z=J+1;while(z<Q){let H=$[z];if(H==="\\"){z+=2;continue}if(H===U)return z+1;z++}return Q},q=()=>{let U=J+2;while(U<Q&&$[U]!==`
|
|
3535
3535
|
`)U++;return U},W=()=>{let U=J+2;while(U<Q-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return Q},K=(U)=>{let z=U,H=0;while(z<Q){let j=$[z];if(j==="/"&&$[z+1]==="/"){let B=z+2;while(B<Q&&$[B]!==`
|
|
3536
|
-
`)B++;z=B;continue}if(j==="/"&&$[z+1]==="*"){let B=z+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=z+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}z=B;continue}if(j==="("||j==="["||j==="{"){H++,z++;continue}if(j===")"||j==="]"||j==="}"){H--,z++;continue}if(j===";"&&H===0)return z+1;z++}return Q};while(J<Q){let U=$[J];if(U==="/"&&$[J+1]==="/"){let z=q();X.push($.slice(J,z)),J=z;continue}if(U==="/"&&$[J+1]==="*"){let z=W();X.push($.slice(J,z)),J=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);X.push($.slice(J,z)),J=z;continue}if(U==="{"){Y++,X.push(U),J++;continue}if(U==="}"){Y--,X.push(U),J++;continue}if(Y===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let j=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],_=K(J+j[0].length);if(Z.has(B)){X.push(`/* stx: deduped const ${B} */`),J=_;continue}Z.add(B),X.push($.slice(J,_)),J=_;continue}}}X.push(U),J++}return X.join("")}async function $G($,Z,X){let J=cQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:q}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
3536
|
+
`)B++;z=B;continue}if(j==="/"&&$[z+1]==="*"){let B=z+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=z+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}z=B;continue}if(j==="("||j==="["||j==="{"){H++,z++;continue}if(j===")"||j==="]"||j==="}"){H--,z++;continue}if(j===";"&&H===0)return z+1;z++}return Q};while(J<Q){let U=$[J];if(U==="/"&&$[J+1]==="/"){let z=q();X.push($.slice(J,z)),J=z;continue}if(U==="/"&&$[J+1]==="*"){let z=W();X.push($.slice(J,z)),J=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);X.push($.slice(J,z)),J=z;continue}if(U==="{"){Y++,X.push(U),J++;continue}if(U==="}"){Y--,X.push(U),J++;continue}if(Y===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let j=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],_=K(J+j[0].length);if(Z.has(B)){X.push(`/* stx: deduped const ${B} */`),J=_;continue}Z.add(B),X.push($.slice(J,_)),J=_;continue}}}X.push(U),J++}return X.join("")}async function $G($,Z,X){let J=cQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:q}=await o("stx/client-script-bundler",()=>import("./chunk-rda8tspf.js"));for(let V of J){let O=V.body;if(A1(V.attrs))O=M1(O);if(Y.test(O)){Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O});continue}if(!G(O))continue;try{let F=await q(r1(O).code,Z||"",{projectRoot:process.cwd()});if(Y.test(F))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O,bundled:F})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let W=`${Z??""}\x00${Q.map((V)=>V.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(W).toString(36).slice(0,10)}`,U=[];for(let V=0;V<Q.length;V++){let O=Q[V].bundled??r1(Q[V].content).code;if(!Q[V].bundled&&G(O))O=await q(O,Z||"",{projectRoot:process.cwd()});O=YG(O);let F=$1(O);U.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
|
|
3537
3537
|
${F}`)}let z=U.join(`
|
|
3538
3538
|
|
|
3539
3539
|
`);z=eQ(z);let H=ZG(z),j=H.split(",").map((V)=>V.trim()).filter(Boolean),B=B4(z,X),_=`
|
|
@@ -3611,9 +3611,9 @@ ${W.join(`
|
|
|
3611
3611
|
`+Y.slice(Q)}async function h4($,Z,X,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=G1($,X);let Q=!Z.__stxProcessingDepth;if(Q)X7(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!O5()&&!Z$())&&X&&X.endsWith(".stx"))F2($,X);try{return await _2.timeAsync("template-processing",async()=>{let G=await pG($,Z,X,J,Y);if(Q)G=f4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},K=(Z.__stx_runtime_head||null)??O2(),U=(Z.__stx_head_raw||"").trim(),z,H=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)z=H[1].trim(),U=U.replace(H[0],"").trim();let j=Z.__sections?.title,B=K.title||z||j,_=!K.title&&(!!z||!!j),L=K.meta||[],V=new Set(L.map((A)=>s1(A)).filter(Boolean)),O={...q,...B&&{title:B},meta:[...(q.meta||[]).filter((A)=>!V.has(s1(A))),...L],link:[...q.link||[],...K.link||[]],script:[...q.script||[],...K.script||[]],headRaw:[q.headRaw,U].filter(Boolean).join(`
|
|
3612
3612
|
`),...K.htmlAttrs&&{htmlAttrs:Y8(q.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...K.bodyAttrs}}},F=W4(G);if(G=W8(G,O,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),F)G=q8(G,q),G=Q8(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let A=w[1],k=B2(A);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
|
|
3613
3613
|
<meta name="stx-layout" content="${U2(A)}">
|
|
3614
|
-
<meta name="stx-layout-group" content="${U2(k)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?q1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=v1(G,(k,N)=>`<body${N} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Q){G=G8(G);let q=J.app?.colorMode;if(q)G=e9(G,q);G=Z8(G),G=cG(G)}if(Q)try{let{getStoreScript:q}=await o("stx/store-loader",()=>import("./chunk-
|
|
3615
|
-
`+U+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await o("stx/framework-composables",()=>import("./chunk-
|
|
3616
|
-
`+W+G.slice(K.end)}}catch{}if(Q)try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-
|
|
3614
|
+
<meta name="stx-layout-group" content="${U2(k)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?q1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=v1(G,(k,N)=>`<body${N} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Q){G=G8(G);let q=J.app?.colorMode;if(q)G=e9(G,q);G=Z8(G),G=cG(G)}if(Q)try{let{getStoreScript:q}=await o("stx/store-loader",()=>import("./chunk-zmm9fkte.js")),W=J.storesDir,K=await q(W);if(K){let U=`<script data-stx-stores>${K}</script>`,z=q5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
|
|
3615
|
+
`+U+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await o("stx/framework-composables",()=>import("./chunk-z7yenntp.js")),W=await q(G);if(W){let K=q5(G,"data-stx-stores")||q5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
|
|
3616
|
+
`+W+G.slice(K.end)}}catch{}if(Q)try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-6pshqqjt.js")),W=J.composablesDir,K=await q(W,G);if(K){let U=`<script data-stx-composables>${K}</script>`,z=q5(G,"data-stx-stores")||q5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
|
|
3617
3617
|
`+U+G.slice(z.end)}}catch{}if(Q)G=$8(G);if(Q&&Z.__stx_inject_css!==!1)G=await V2(G,void 0,J.buildMode==="serve");if(Q)G=r9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Y$)throw G;let q=G instanceof Error?G.message:String(G),W=new w1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(i0.log(W,{filePath:X,context:Z}),F3.logDetailedError(W,{filePath:X,template:$.substring(0,500)}),J.debug)throw W;return V3.createFallbackContent("Template Processing",W)}}async function pG($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!M0.isAbsolute(J.partialsDir)?M0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!M0.isAbsolute(J.componentsDir)?M0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!M0.isAbsolute(J.layoutsDir)?M0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,W=$;await sG(X,Z),nG(Z,q),W=await h1(()=>b9(W,Z,X,q),W,(F)=>{i0.log(F,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${F.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=o0(W,U5,(F,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);W=K.output;let U=K.tokens,z=(F)=>U.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>U[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,H),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(F,w)=>{return`{{ ${w} }}`}),W=g9(W),W=await Q2(W,X,Y);let j={};W=a3(W,j);let B={...Z.__sections||{}},_="",L=g7(x7($)),V=/@nolayout\b/.test(W)||L===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let O=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof L==="string"){if(_=L,!/@section\s*\(/.test(W))W=`@section('content')
|
|
3618
3618
|
${W.trim()}
|
|
3619
3619
|
@endsection`}if(!_&&!V&&q.defaultLayout){let F=q4(W),w=/@section\s*\(/.test(W);if(!F||w){let R="",D=M0.dirname(X),A=q.layoutsDir?M0.dirname(q.layoutsDir):process.cwd();for(let k=0;k<20;k++){let N=M0.join(D,"_layout.stx");if(await t(N)){R=N;break}let M=M0.dirname(D);if(M===D||M.length<A.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let k=M0.isAbsolute(q.layoutsDir)?q.layoutsDir:M0.resolve(process.cwd(),q.layoutsDir),N=M0.join(k,`${q.defaultLayout}.stx`);if(await t(N))_=N}if(_&&!w)W=`@section('content')
|
|
@@ -3621,7 +3621,7 @@ ${W.trim()}
|
|
|
3621
3621
|
@endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,w,R)=>{return B[w]=R,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return F;try{let D=e(R.trim(),Z);if(D===void 0)return F;return B[w]=String(D??""),""}catch{return F}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",y1);else B[w]=R.trim();return""}),Z.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=t3(W,j),_){let F=[],w=r0(W),R=o0(w.output,C1,(D,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(W=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,A,k)=>{let N=A==="SCRIPT"?w.scripts[Number(k)]:R.tokens[Number(k)];if(N)F.push(N);return""}),F.length>0){let D=F.join(`
|
|
3622
3622
|
`);B.content=B.content?`${B.content}
|
|
3623
3623
|
${D}`:D,Z.__sections=B}}if(_)try{let F;if(M0.isAbsolute(_))F=_,Y.add(_);else F=await h1(()=>q$(_,X,G,Y),null,()=>{throw new w1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!F){let N=(I)=>{if(!I)return[];try{let C=M0.isAbsolute(I)?I:M0.resolve(process.cwd(),I);return mG.readdirSync(C).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((I,C,E)=>E.indexOf(I)===C).sort(),T=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(i0.log(Error(T),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${T}`),G.debug)throw new w1(T,X);return W}let w=await h1(()=>Bun.file(F).text(),"",()=>{throw new w1(`Failed to read layout file: ${F}`,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 ${F}`);let N={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(C,E,b)=>{return N[E]=b.trim(),""});for(let[C,E]of Object.entries(N))if(B[C]&&B[C].includes(y1)){let b=B[C].indexOf(y1);B[C]=B[C].slice(0,b)+E+B[C].slice(b+y1.length)}else if(!B[C])B[C]=E;let T={...Z,__sections:B},I=`@layout('${R[1]}')${M}`;return await h4(I,T,F,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=a3(D,j),k={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,M,T)=>{return k[M]=T.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,M,T)=>{if(B[M]){let I=B[M];if(I.includes(y1)){let C=k[M]||"",E=I.indexOf(y1);I=I.slice(0,E)+C+I.slice(E+y1.length)}return I}return T||""}),A=iG(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=t3(A,j),Z.__originalFilePath=X,W=await H2(A,Z,F,G,Y),W=`<!-- stx-layout: ${_} -->
|
|
3624
|
-
${W}`,z(W)}catch(F){return i0.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await H2(W,Z,X,G,Y))}function iG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function nG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function sG($,Z){await h1(()=>C9($,Z),void 0,(X)=>{i0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function oG($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-
|
|
3624
|
+
${W}`,z(W)}catch(F){return i0.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await H2(W,Z,X,G,Y))}function iG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function nG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function sG($,Z){await h1(()=>C9($,Z),void 0,(X)=>{i0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function oG($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-yapm6eaz.js"));await W(G,Z,X,{preserveExisting:!0})}catch(W){let K=W instanceof Error?W:Error(String(W));i0.log(K,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${K.message}`)}}}async function rG($,Z,X){try{let{interpolateScriptsInTemplate:J}=await o("stx/expressions",()=>import("./chunk-rsr2m2hq.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return i0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function H2($,Z,X,J,Y){let Q=$,G=J;if(await oG(Q,Z,X),Q=await rG(Q,Z,X),Q=await O9(Q,Z,X),Q=await F9(Q,Z,X),Q=await $9(Q,Z,X,G),G1(Q))Q=M8(Q,Z),Q=T8(Q,Z);Q=I8(Q);let{processStreamDirectives:q}=await o("stx/streaming",()=>import("./chunk-jks6f8f5.js"));Q=q(Q,Z),Q=M9(Q,Z,X,G),Q=await m9(Q,Z,X,G,Y),Q=await C4(Q,Z,X,G,Y),Q=f7(Q,Z,X,G);let{processDeferDirectives:W}=await o("stx/defer",()=>import("./chunk-d8np0m39.js"));Q=W(Q,Z,X);let{processTeleportDirectives:K}=await o("stx/teleport",()=>import("./chunk-fk5y786g.js"));Q=K(Q,Z,X);let{processTransitionDirectives:U,processTransitionAttributes:z}=await o("stx/transitions",()=>import("./chunk-s5r7hwsw.js"));Q=U(Q,Z,X),Q=z(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-e5z100yg.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:j}=await o("stx/suspense",()=>import("./chunk-1fgbwc7a.js"));Q=j(Q,Z,X);let{processAsyncDirectives:B}=await o("stx/async-components",()=>import("./chunk-0gpkptex.js"));Q=B(Q,Z,X);let{processKeepAliveDirectives:_}=await o("stx/keep-alive",()=>import("./chunk-5xj9t4wa.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:L,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await o("stx/virtual-scrolling",()=>import("./chunk-a53v7hcy.js"));Q=L(Q,Z,X),Q=V(Q,Z,X),Q=O(Q,Z,X);let{processPartialHydrationDirectives:F,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-nsn7gfew.js"));Q=F(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await o("stx/computed",()=>import("./chunk-t1xzgpdm.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:A}=await o("stx/forms-validation",()=>import("./chunk-qyfh6mf4.js"));Q=A(Q,Z,X);let{processHeadDirective:k,processTitleDirective:N,processMetaDirective:M,resetHead:T}=await o("stx/head",()=>import("./chunk-0ye9aj3r.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)T();let I=k(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
|
|
3625
3625
|
`;if(Q=N(Q,Z),Q=M(Q,Z),Q=S9(Q),Q=y3(Q,Z),Q=e6(Q),Q=T9(Q),Q=await r3(Q,Z,X,G,Y),Q=await C4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=J7(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=f4(Q),Q=X1(Q,Z,X),Q=u7(Q,Z,{filePath:X,buildMode:G.buildMode}),Q=S3(Q,Z),Q=C3(Q,Z),Q=N5(Q,Z),Q=u3(Q,Z),Q=d3(Q,Z),Q=await u6(Q,Z,X,G),Q=await n7(Q,Z,X),Q=await z9(Q,Z,X,G),Q=j2(Q,Z,X,G),Q=M6(Q,Z,X,G),Q=k6(Q,Z,X),Q=I6(Q,Z,X,G),Q=a6(Q,Z,X,G),Q=P4(Q,Z),Q=v4(Q),Q=G2(Q),!G.skipEventDirectives)Q=Z7(Q,Z,X);if(Q=l7(Q,Z,X),G.debug){let p=/\bx-data\s*=/.test(Q),i=_4($);if(p&&i)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3626
3626
|
Both work on the same page, but they manage separate scopes.
|
|
3627
3627
|
Prefer signals (state/derived/effect) for new components.`)}Q=f9(Q,Z),Q=await O1(Q,Z,X),Q=W2(Q),Q=K2(Q),Q=T7(Q);let{processXElementDirectives:C}=await o("stx/x-element",()=>import("./chunk-vesr13aj.js"));Q=C(Q);let E=Z.__originalFilePath||X,b=v$(Z);if(Q=await E8(Q,G,E,b),Q=Y9(Q,Z),Q=await y9(Q,Z,X,G),G.media?.image?.autoSiblings){let p=G.publicDir||"public",{rewriteImagesWithSiblings:i}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-5arv7j0q.js"));Q=await i(Q,{publicDir:p})}if(G.seo?.enabled)Q=T6(Q,Z,G);let y=(p,i,K0=!0)=>{if(!i)return p;let G0=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),N0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(G0&&N0){if(K0)p=p.replace(N0[0],G0[0]);if(i=i.replace(G0[0],"").trim(),!i)return p}if(/<\/head>/i.test(p))return p.replace(/<\/head>/i,`${i}
|
|
@@ -3635,7 +3635,7 @@ ${M7()}
|
|
|
3635
3635
|
`+K5}else Q=Q.replace("</head>",`${i}
|
|
3636
3636
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3637
3637
|
${i}`);else Q=i+`
|
|
3638
|
-
`+Q}{let{scanScriptTags:p}=await o("stx/signal-processing",()=>import("./chunk-
|
|
3638
|
+
`+Q}{let{scanScriptTags:p}=await o("stx/signal-processing",()=>import("./chunk-2ymz6nrt.js")),i=[];for(let K0 of p(Q)){if(!/\bserver\b/i.test(K0.attrs))continue;let G0=K0.start+K0.fullMatch.indexOf(">")+1,N0=lG(Q,G0);if(N0===-1)continue;let P0=N0+9;while(P0<Q.length&&/\s/.test(Q[P0]))P0++;i.push({start:K0.start,end:P0})}for(let K0=i.length-1;K0>=0;K0--){let{start:G0,end:N0}=i[K0];Q=Q.substring(0,G0)+Q.substring(N0)}}let C0=R$(Q,X);if(C0.hasScoped)Q=C0.html;let X0=Z.__stx_event_bindings||[],H0=!1,I0=[],E0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:m0}=await o("stx/signal-processing",()=>import("./chunk-2ymz6nrt.js"));for(let p of m0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))I0.push({match:p.fullMatch,attrs:p.attrs,content:p.body});for(let{match:p,attrs:i,content:K0}of I0){H0=!0;let G0=K0;g4(K0,X,J.strict,Z.__originalFilePath);let N0=await f$(K0,{eventBindings:X0,attrs:i,hasColonDirectives:E0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(p,()=>N0)}if(H0)Z.__stx_event_bindings=[];if(!H0&&Z.__stxProcessingDepth===1){let p=Z.__stx_event_bindings||[];if(p.length>0){let i=l$(p);if(i){let K0=Q.lastIndexOf("</body>");Q=K0===-1?Q+i:Q.slice(0,K0)+i+`
|
|
3639
3639
|
`+Q.slice(K0)}Z.__stx_event_bindings=[]}}if(!B8(Q)&&_8(Q))Q=await M$(Q,G);if(Q=V8(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=r6(Q,Z.cspNonce);return Q}var aG=[{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"}],tG=[{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')"}],eG=[{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 $q($){let Z=[],X=[];return Zq($,Z),Xq($,Z,X),Jq($,X),Yq($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function Zq($,Z){let X=($.match(/\{\{/g)||[]).length,J=($.match(/\}\}/g)||[]).length;if(X!==J)Z.push({type:"expression",message:`Unclosed expression brackets: found ${X} opening '{{' and ${J} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Xq($,Z,X){for(let J of aG){let Y=new RegExp(`${J.open}(?:\\s|\\()`,"g"),Q=new RegExp(J.close,"g"),G=($.match(Y)||[]).length,q=($.match(Q)||[]).length;if(J.altClose){let W=new RegExp(J.altClose,"g");q+=($.match(W)||[]).length}if(G>q)Z.push({type:"directive",message:`Unclosed @${J.name} directive: found ${G} opening and ${q} closing`,suggestion:`Add ${G-q} missing ${J.close} tag(s)`});else if(q>G)X.push({type:"directive",message:`Extra ${J.close} found: ${q-G} more closing than opening`,suggestion:`Check for orphaned ${J.close} tags`})}}function Jq($,Z){for(let X of tG)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function Yq($,Z){for(let X of eG)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function Qq($,Z){let X=$.slice(0,Z).split(`
|
|
3640
3640
|
`);return{line:X.length,column:X[X.length-1].length+1}}function Gq($,Z,X){let J=[];switch($){case"if":case"elseif":case"unless":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(X.length===0||!X[0].includes(" as "))J.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(X.length===0)J.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(X.length===0)J.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(X.length===0)J.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return J}function qq($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function Wq($){let Z=$.matchAll(/@([a-z]+)/gi),X=new Set;for(let J of Z){let Y=J[1].toLowerCase();if(!Y.startsWith("end"))X.add(Y)}return Array.from(X)}import t0 from"path";import W5 from"process";var I2=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],L2=new Set(I2),Kq=new Set(["props","$props","defineProps"]),Uq=new Set(["stx","@stacksjs/stx"]),w2=G5(128);function zq($){let Z=[],X=0,J=$.split(`
|
|
3641
3641
|
`);for(let Y of J){let Q=X,G=null,q=!1;for(let W=0;W<Y.length;W++){let K=Y[W];if(q){q=!1;continue}if(K==="\\"){q=!0;continue}if(G){if(K===G)G=null;continue}if(K==="'"||K==='"'||K==="`"){G=K;continue}if(K==="/"&&W+1<Y.length&&Y[W+1]==="/")break;if(K==="{")X++;else if(K==="}")X--}if(Q===0){let W=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let K=Y.match(/(?:const|let|var)\s+(\w+)/);if(K)Z.push(K[1])}else{let K=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let z=K[1].slice(1,-1).split(",").map((H)=>{let j=H.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...z)}}}}return[...new Set(Z)]}function Hq($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function X(J){if(!J.includes(":"))return J;let Y=[],Q="",G=0,q=0,W=null;for(let K=0;K<J.length;K++){let U=J[K];if(W){if(Q+=U,U===W)W=null;continue}if(U==='"'||U==="'"||U==="`"){W=U,Q+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")q++;else if(U===")")q--;if(U===","&&G===0&&q===0){Y.push(Q),Q="";continue}Q+=U}if(Q)Y.push(Q);return Y.map((K)=>{let U=K.trim(),z=U.startsWith("..."),H=z?U.slice(3):U,j=-1,B=0;for(let R=0;R<H.length;R++)if(H[R]==="<")B++;else if(H[R]===">")B--;else if(H[R]===":"&&B===0){j=R;break}if(j===-1)return K;let L=H.substring(0,j).trim().replace(/\?$/,""),V=H.substring(j+1),O=-1,F=0;for(let R=0;R<V.length;R++)if(V[R]==="<")F++;else if(V[R]===">")F--;else if(V[R]==="="&&F===0){O=R;break}let w=z?"...":"";if(O!==-1)return`${w}${L} = ${V.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,Q)=>{if(!Q.includes(":"))return J;return`${Y}(${X(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,q=1,W=G+1,K=0,U=null;while(W<Z.length&&q>0){let j=Z[W];if(U){if(j===U)U=null;W++;continue}if(j==='"'||j==="'"||j==="`"){U=j,W++;continue}if(j==="<")K++;else if(j===">"&&K>0)K--;else if(K===0){if(j==="(")q++;else if(j===")")q--}if(q>0)W++}if(q!==0)continue;let z=Z.substring(G+1,W);if(!z.includes(":"))continue;let H=X(z);Q.push({start:G+1,end:W,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:q,end:W,replacement:K}=Q[G];Z=Z.substring(0,q)+K+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.split(",").map((G)=>{let[q,...W]=G.split("="),K=q.split(":")[0].trim();if(W.length>0)return`${K} = ${W.join("=").trim()}`;return K}).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,`
|
|
@@ -3657,11 +3657,11 @@ ${$[K]}`,K++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:
|
|
|
3657
3657
|
${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
|
|
3658
3658
|
${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function Dq($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=S2(J);if(Q!==-1){if(B0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
|
|
3659
3659
|
${G}`,Y++}return{functionCode:J,nextIndex:Y}}function M2($,Z){let X=e($,Z)??e(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...W5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function Nq($,Z,X){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,q]=Q;try{let W=q.trim().replace(/;$/,""),K=M2(W,Z);if(K!==void 0)Z[G]=K}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,q]=Q;if(!(G in Z))try{let W=q.trim().replace(/;$/,""),K=M2(W,Z);if(K!==void 0)Z[G]=K}catch{}}}function Aq($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:J}}function Mq($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var y5=new p1(500),g$=new p1(1000),Iq=33554432,l4=new p1(2000,{maxBytes:Iq,sizeOf:($)=>$.output.length});function Tq($){let Z=new WeakSet;try{let X=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(X);let Y={};for(let Q of Object.keys(J).sort())Y[Q]=X(J[Q]);return Y};return JSON.stringify(X($))}catch{return null}}function C2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Eq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!Eq($)}var x$=new Map;function d4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=x$.get(Z);if(X)return X;if(x$.size>=16)x$.clear();let J=new Bun.Transpiler($);return x$.set(Z,J),J}function M1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let X=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`});let Y=d4({loader:"ts",target:"browser",define:Y5()}).transformSync(Z);for(let Q=0;Q<X.length;Q++)Y=Y.replace(`"__STX_EXPR_${Q}__"`,X[Q]),Y=Y.replace(`'__STX_EXPR_${Q}__'`,X[Q]);return Y}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function bq($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(U)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===U){Y++;return}Y++}},q=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let U=1;while(Y<Q&&U>0)if($[Y]==="{")U++,Y++;else if($[Y]==="}")U--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")q();else Y++;continue}Y++}},W=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
|
|
3660
|
-
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(J!==0)return;let U=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let L=_.trim().split(":");return L[L.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!X.has(B))Z.push(B),X.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))Z.push(B),X.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Z.push(B),X.add(B)}};while(Y<Q){if(W())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))K();Y++}return Z}function yq($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function Sq($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function Cq($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let W of yq(q)){let K=W.trim();if(!K||K.startsWith("..."))continue;let U=Sq(K);if(U===-1)continue;let z=K.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let H=K.slice(U+1).trim();if(!H)continue;try{let j=Object.keys(Z),B=Function(...j,`"use strict"; return (${H});`);Z[z]=B(...j.map((_)=>Z[_]))}catch{}}}catch{}}async function C$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=X.__importedComponents;if(W){for(let L of[Q,Q.toLowerCase(),G(Q),q(Q)])if(W.has(L))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],U=typeof Y.root==="string"?h.resolve(Y.root):void 0,z=U??h.dirname(J),H=[],j=(L)=>{if(L&&!H.includes(L))H.push(L)},B=X.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(h.join(h.dirname(J),"components")),j(Y.componentsDir),U)j(h.resolve(U,"resources/views/components")),j(h.resolve(U,"resources/components")),j(h.resolve(U,"src/components")),j(h.resolve(U,"components"));let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let L of _)j(typeof L==="string"?L:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return t(h.resolve(h.dirname(J),`${Q}.stx`));for(let L of H){let V=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of K)if(await t(h.join(V,O)))return!0}return!1}function Pq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function vq($){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 fq($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function I1($,Z,X,J,Y,Q,G,q=new Set,W){let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-
|
|
3660
|
+
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(J!==0)return;let U=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let L=_.trim().split(":");return L[L.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!X.has(B))Z.push(B),X.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))Z.push(B),X.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Z.push(B),X.add(B)}};while(Y<Q){if(W())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))K();Y++}return Z}function yq($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function Sq($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function Cq($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let W of yq(q)){let K=W.trim();if(!K||K.startsWith("..."))continue;let U=Sq(K);if(U===-1)continue;let z=K.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let H=K.slice(U+1).trim();if(!H)continue;try{let j=Object.keys(Z),B=Function(...j,`"use strict"; return (${H});`);Z[z]=B(...j.map((_)=>Z[_]))}catch{}}}catch{}}async function C$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=X.__importedComponents;if(W){for(let L of[Q,Q.toLowerCase(),G(Q),q(Q)])if(W.has(L))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],U=typeof Y.root==="string"?h.resolve(Y.root):void 0,z=U??h.dirname(J),H=[],j=(L)=>{if(L&&!H.includes(L))H.push(L)},B=X.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(h.join(h.dirname(J),"components")),j(Y.componentsDir),U)j(h.resolve(U,"resources/views/components")),j(h.resolve(U,"resources/components")),j(h.resolve(U,"src/components")),j(h.resolve(U,"components"));let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let L of _)j(typeof L==="string"?L:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return t(h.resolve(h.dirname(J),`${Q}.stx`));for(let L of H){let V=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of K)if(await t(h.join(V,O)))return!0}return!1}function Pq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function vq($){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 fq($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function I1($,Z,X,J,Y,Q,G,q=new Set,W){let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-yapm6eaz.js")),U=q??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=H&&H!=="load"&&Pq(H)?H:"";try{let B=(u)=>u.split("-").map((m)=>m.charAt(0).toUpperCase()+m.slice(1)).join(""),_=(u)=>u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=Y.__importedComponents;if(O){let u=[L,L.toLowerCase(),B(L),_(L)];for(let m of u)if(O.has(m)){V=O.get(m);break}}let F=[];if(!V){let u=[`${L}.stx`,`${B(L)}.stx`,`${_(L)}.stx`],m=[...new Set(u)],U0=Y.__originalFilePath,n=[];if(U0){let L0=h.join(h.dirname(U0),"components");n.push(L0)}if(J)n.push(J);let O0=G._rootComponentsDir;if(typeof O0==="string"&&!n.includes(O0))n.push(O0);let F0=h.join(h.dirname(Q),"components");if(!n.includes(F0))n.push(F0);if(G.componentsDir&&G.componentsDir!==J&&!n.includes(G.componentsDir))n.push(G.componentsDir);let v0=typeof G.root==="string"?h.resolve(G.root):void 0,V1=v0??h.dirname(Q),b0=[];if(v0)b0.push(h.resolve(v0,"resources/views/components")),b0.push(h.resolve(v0,"resources/components")),b0.push(h.resolve(v0,"src/components")),b0.push(h.resolve(v0,"components"));b0.push(h.resolve(import.meta.dir,"components"));for(let L0 of b0)if(!n.includes(L0))n.push(L0);let s=G._pluginComponentDirs;if(Array.isArray(s)){for(let L0 of s)if(typeof L0==="string"&&!n.includes(L0))n.push(L0)}if(G.fallbackComponentsDir&&!n.includes(G.fallbackComponentsDir))n.push(G.fallbackComponentsDir);let l0=[...new Set(n.map((L0)=>{if(!L0)return L0;return h.isAbsolute(L0)?L0:h.resolve(V1,L0)}))];n.length=0,n.push(...l0);let v5=`${L}\x00${Q}\x00${l0.join("\x00")}`,h$=g$.get(v5);if(h$)if(await t(h$))V=h$;else g$.delete(v5);if(!V&&(L.startsWith("./")||L.startsWith("../")))V=h.resolve(h.dirname(Q),`${L}.stx`),F.push(V);else if(!V)for(let L0 of n){if(!L0)continue;for(let f5 of m){let x5=h.join(L0,f5);if(F.push(x5),await t(x5)){V=x5;break}}if(V)break;if(!V)try{let f5=await import("fs");if(!f5.statSync(L0,{throwIfNoEntry:!1})?.isDirectory())continue;let i2=8,u$=[{path:L0,depth:0}];while(u$.length>0&&!V){let g5=u$.pop();if(g5.depth>=i2)continue;let n4;try{n4=f5.readdirSync(g5.path,{withFileTypes:!0})}catch{continue}for(let h5 of n4){if(!h5.isDirectory())continue;if(h5.name==="node_modules"||h5.name.startsWith("."))continue;let s4=h.join(g5.path,h5.name);for(let n2 of m){let d$=h.join(s4,n2);if(F.push(d$),await t(d$)){V=d$;break}}if(V)break;u$.push({path:s4,depth:g5.depth+1})}}}catch{}if(V)break}if(V)g$.set(v5,V)}if(!V||!await t(V)){let u=F.length>0?`
|
|
3661
3661
|
Searched paths:
|
|
3662
3662
|
${F.map((m)=>` - ${m}`).join(`
|
|
3663
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${u}`}W.add(V);let w;if(y5.has(V))w=y5.get(V);else try{w=await Bun.file(V).text(),y5.set(V,w)}catch(u){return`[Error loading component: ${u instanceof Error?u.message:String(u)}]`}let R=new Set(["__originalFilePath","__importedComponents",u5,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[u,m]of Object.entries(Y))if(!u.startsWith("__")||R.has(u))D[u]=m;let A=X;if(X.includes("@include")){let{processIncludes:u}=await o("stx/includes",()=>import("./chunk-
|
|
3664
|
-
`)}`}if(X&&G0.includes("{{ text || slot }}"))G0=G0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:N0}=await o("stx/slots",()=>import("./chunk-
|
|
3663
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${u}`}W.add(V);let w;if(y5.has(V))w=y5.get(V);else try{w=await Bun.file(V).text(),y5.set(V,w)}catch(u){return`[Error loading component: ${u instanceof Error?u.message:String(u)}]`}let R=new Set(["__originalFilePath","__importedComponents",u5,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[u,m]of Object.entries(Y))if(!u.startsWith("__")||R.has(u))D[u]=m;let A=X;if(X.includes("@include")){let{processIncludes:u}=await o("stx/includes",()=>import("./chunk-crkxdfsc.js"));A=await u(X,Y,Q,G,W)}let k=r0(A),N=[],M=k.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(u,m)=>{let U0=k.scripts[Number(m)]||"",n=U0.match(/^<script\b([^>]*)>/i)?.[1]||"",O0=n.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),F0=!O0||["module","text/javascript","application/javascript"].includes(O0);if(!/\bserver\b/i.test(n)&&F0)return N.push(U0),"";return U0}),{extractSlotContent:T}=await o("stx/slots",()=>import("./chunk-qv6cjn0k.js")),I=T(M),C={};if(I.defaultSlot?.trim())C.default=I.defaultSlot;for(let[u,m]of I.namedSlots)C[u]=m.content;let E=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,y={...D,$uid:b,...Z,props:Z,slot:M,$slots:C,__processedComponents:z,__sections:{},__stx_signals_gate:G1(w)||vq(X)};Cq(w,y);let P=w,f=V$(P);if(f)P=f.content.trim();let d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g=[...w.matchAll(d)],Q0=[],e0=g.some((u)=>/\bserver\b/.test(u[1]||"")&&/\bcache\b/.test(u[1]||"")),k0=null,C0=null,X0=null,H0=0,I0=null;if(e0){let u=Tq({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,uid:b});if(u!==null){k0=`${V}\x00${b1(w)}\x00${u}`;let m=l4.get(k0);if(m){for(let U0 of m.dependencies)W.add(U0);if(G7(Y,m.clientFactories),E.n+=m.uidsConsumed,m.preservedClientExpressions.length>0){let U0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let n of m.preservedClientExpressions)U0.add(n);Y.__stx_preserved_client_expressions=[...U0]}return m.output}C0=new Set(W),X0=Y7(Y),H0=E.n,I0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let u of g){let m=u[1]||"",U0=u[2]||"",n=m.includes("server");if(A1(m)&&U0.trim())U0=M1(U0);if(n&&U0)try{await K(U0,y,V)}catch(F0){}if(!n){let F0=U0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),v0=F0.includes("{{")&&F0.includes("}}"),V1=F0.includes("{!!")&&F0.includes("!!}");if(v0||V1)F0=n$(F0,y);let b0=m.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Q0.push(`<script${b0}>${F0}</script>`)}}let E0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),m0=E0?E0[1]:"",p=E0?E0[2]:"",i="",K0=m0&&/\bscoped\b/i.test(m0);if(E0)i=`<style${m0}>${p}</style>`;let G0=P;if(G0=G0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E0)G0=G0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let u=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,m=[];if(G0=G0.replace(u,(U0,n)=>{let O0=n.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(O0)m.push(`<style${O0[1]}>${O0[2]}</style>`);return""}),G0=G0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),m.length>0)i=`${i}${m.join(`
|
|
3664
|
+
`)}`}if(X&&G0.includes("{{ text || slot }}"))G0=G0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:N0}=await o("stx/slots",()=>import("./chunk-qv6cjn0k.js")),{defaultSlot:P0,namedSlots:K5}=I;G0=await N0(G0,P0,K5,y);let C5=Q0.some((u)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(u)),P5=fq(Q0),S=Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[];if(P5.length>0||S.length>0)y.__stx_client_signal_names=[...new Set([...S,...P5])];let v={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:C5||Q0.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let r=await h4(G0,y,V,v,W),a=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let u of r.matchAll(/\{\{([\s\S]*?)\}\}/g))a.add(u[1].trim());if(a.size>0)Y.__stx_preserved_client_expressions=[...a];let J0=b,Y0=r;if(C5){let u="";if(Object.keys(Z).length>0)try{u=` data-stx-props="${C2(JSON.stringify(Z))}"`}catch{}let m=j?` stx-hydrate="${C2(j)}"`:"";Y0=`<div data-stx-scope="${J0}"${u}${m}>${r}</div>`;let U0=await Promise.all(Q0.map(async(n)=>{let O0=n.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!O0)return n;let[,F0,v0]=O0,{vendorStyleTags:V1,factoryBody:b0}=await hq(v0,V,G.buildMode==="compile"),s=j?null:c$(Y,b0),l0=s?`window.__stxComponentFactories[${JSON.stringify(s)}](${JSON.stringify(J0)});`:`(${b0})(${JSON.stringify(J0)});`;if(j)return`${V1}<script type="stx/island" data-stx-island="${J0}" data-stx-scoped${F0}>${l0}</script>`;return`${V1}<script data-stx-scoped data-stx-run="always"${F0}>${l0}</script>`}));if(Y0=Y0+`
|
|
3665
3665
|
`+U0.join(`
|
|
3666
3666
|
`),i)Y0+=`
|
|
3667
3667
|
`+i}else{if(i)Y0+=`
|
|
@@ -3684,7 +3684,7 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
|
|
|
3684
3684
|
`,q)U+=`
|
|
3685
3685
|
${Z0.blue}${Z0.bold}Context:${Z0.reset}
|
|
3686
3686
|
${Z0.dim}${q}${Z0.reset}
|
|
3687
|
-
`;return U}function KO(){y5.clear(),g$.clear(),l4.clear()}function UO(){return{size:y5.size,maxSize:500}}var m4=G5(128);async function hq($,Z,X){let J=b1($,Z,X),Y=m4.get(J);if(Y){if(f2(Y.deps))return Y;m4.delete(J)}let Q=p4($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,q=i4(Q.styles);G=r1(G).code;let{hasUserImports:W,bundleClientScript:K}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
3687
|
+
`;return U}function KO(){y5.clear(),g$.clear(),l4.clear()}function UO(){return{size:y5.size,maxSize:500}}var m4=G5(128);async function hq($,Z,X){let J=b1($,Z,X),Y=m4.get(J);if(Y){if(f2(Y.deps))return Y;m4.delete(J)}let Q=p4($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,q=i4(Q.styles);G=r1(G).code;let{hasUserImports:W,bundleClientScript:K}=await o("stx/client-script-bundler",()=>import("./chunk-rda8tspf.js")),U=[],z=!1;if(W(G)){let V=G;G=await K(V,Z,{projectRoot:process.cwd(),minify:X,collectInputs:U}),z=G===V}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-2ymz6nrt.js"));G=H(G);let j=$1(G),B=bq(j),_=`function(__scopeId) {
|
|
3688
3688
|
${c1("const",[...P2,...B],j)}
|
|
3689
3689
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3690
3690
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -3783,7 +3783,7 @@ else {
|
|
|
3783
3783
|
// STX: auto-generated event bindings
|
|
3784
3784
|
${$.map((X,J)=>XW(X,J)).join(`
|
|
3785
3785
|
`)}`}function u2($){let Z=[],X=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=J.length,G=0;while(G<Q){let q=J[G];if(q==="'"||q==='"'||q==="`"){let W=q;if(G++,W==="`"){let K=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&K===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){K++,G+=2;continue}if(J[G]==="}"&&K>0){K--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===W){G++;break}G++}continue}if(q==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
|
|
3786
|
-
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let W=J.slice(G),K=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}let U=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),_=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=U[0].length;continue}let z=W.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 YW=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 QW($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let j;while((j=X.exec(H))!==null){let B=j[0];if(!YW.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);return Z}async function f$($,Z={}){let X=$,J="",Y=!1,Q=[],G=p4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=i4(G.styles),W=r1(X);X=W.code,Q=[...W.imports,...W.models];let{hasUserImports:K,bundleClientScript:U}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
3786
|
+
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let W=J.slice(G),K=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}let U=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),_=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=U[0].length;continue}let z=W.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 YW=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 QW($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let j;while((j=X.exec(H))!==null){let B=j[0];if(!YW.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);return Z}async function f$($,Z={}){let X=$,J="",Y=!1,Q=[],G=p4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=i4(G.styles),W=r1(X);X=W.code,Q=[...W.imports,...W.models];let{hasUserImports:K,bundleClientScript:U}=await o("stx/client-script-bundler",()=>import("./chunk-rda8tspf.js"));if(K(X))X=await U(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let O=c2(X);X=O.code,J=p2(O.stxImports,O.browserImports.filter((F)=>!Q.includes(F)))}if(J=`${B4(X,Z.serverData)}${J}`,X=$1(X),!Y&&A1(Z.attrs||""))X=M1(X);let z=JW(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let O=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${q}<script ${F}>
|
|
3787
3787
|
${o1(`${J}${X}
|
|
3788
3788
|
${z}`)}
|
|
3789
3789
|
</script>`}let B=m2($),_=/function __stx_setup_/.test(X),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(O){let F=O.length>0?`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$g as KH,Ug as v,Vg as i,Wg as t,Zg as e,_g as HH,ah as QH,bh as YH,ch as ZH}from"./chunk-
|
|
2
|
+
import{$g as KH,Ug as v,Vg as i,Wg as t,Zg as e,_g as HH,ah as QH,bh as YH,ch as ZH}from"./chunk-hqpsxzxe.js";import{Xi as s}from"./chunk-5z466wfw.js";import{Ql as a}from"./chunk-0vjgbyf7.js";import{qt as h}from"./chunk-1spzqjve.js";import{Ot as f}from"./chunk-yvpagchj.js";import{existsSync as $H,readFileSync as qH}from"fs";import J from"path";function GH(K,Q="",V=""){let L=K.startLine>1?`
|
|
3
3
|
`.repeat(K.startLine-1):"",N=t(i(K.code)),X=K.kind==="client"||K.kind==="plain"?HH(Q,K.code):"";return QH(`${L+N}
|
|
4
4
|
${X}
|
|
5
5
|
export {}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{jp as a,kp as b,lp as c,mp as d,np as e,op as f,pp as g,qp as h,rp as i,sp as j,tp as k,up as l}from"./chunk-
|
|
2
|
+
import{jp as a,kp as b,lp as c,mp as d,np as e,op as f,pp as g,qp as h,rp as i,sp as j,tp as k,up as l}from"./chunk-0vjgbyf7.js";import"./chunk-1bwwtctk.js";import"./chunk-q9zsjgpf.js";import"./chunk-a6a9djpq.js";import"./chunk-txys90mf.js";import"./chunk-eaqh53ea.js";import"./chunk-1spzqjve.js";import"./chunk-h45js0cg.js";import"./chunk-t7b39wwk.js";import"./chunk-w18t3nmy.js";import"./chunk-yvpagchj.js";import"./chunk-rhbq1var.js";import"./chunk-2c2z8n54.js";import"./chunk-71gwef4q.js";export{l as stripStxRuntimeImports,a as scanScriptTags,k as rewriteStxImportSpecifiers,i as processSignals,g as processScriptSetup,e as preEvalLiteralReactiveIfs,b as parseLoopExpression,c as hasSignalsSyntax,j as findMarkupIndexOutsideScripts,h as extractExports,f as convertSignalLoopsToAttributes,d as convertSignalDirectivesToAttributes};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{hs as E}from"./chunk-
|
|
2
|
+
import{hs as E}from"./chunk-0vjgbyf7.js";import{Zu as D}from"./chunk-71gwef4q.js";import I from"path";async function M(k={}){let G=performance.now(),J=k.root||process.cwd(),j=await E(),q=j.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${q.toUpperCase()}${j.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let A,B;if(q==="ssg"){let{generateStaticSite:z}=await import("./ssg.js");A=await z({pagesDir:I.join(j.root||".",j.pagesDir||j.build?.pagesDir||"pages"),publicDir:j.publicDir||j.build?.publicDir||"public",outputDir:j.build?.outputDir||"dist",generate404:j.build?.generate404??!0,minify:j.build?.minify??!0,cleanOutput:j.build?.cleanOutput??!0,router:j.router,...k.ssg})}else{let{buildForProduction:z}=await import("./chunk-8sg8tspq.js");B=await z({outputDir:".output",debug:k.debug,...k.ssr})}let H=Math.round(performance.now()-G);return{mode:q,ssg:A,ssr:B,duration:H}}
|
|
3
3
|
export{M as Ef};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fp as a,Gp as b}from"./chunk-
|
|
2
|
+
import{Fp as a,Gp as b}from"./chunk-0vjgbyf7.js";import"./chunk-1bwwtctk.js";import"./chunk-q9zsjgpf.js";import"./chunk-a6a9djpq.js";import"./chunk-txys90mf.js";import"./chunk-eaqh53ea.js";import"./chunk-1spzqjve.js";import"./chunk-h45js0cg.js";import"./chunk-t7b39wwk.js";import"./chunk-w18t3nmy.js";import"./chunk-yvpagchj.js";import"./chunk-rhbq1var.js";import"./chunk-2c2z8n54.js";import"./chunk-71gwef4q.js";export{b as processLoops,a as parseLoopBinding};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Dq as P,lm as D,mm as O}from"./chunk-
|
|
2
|
+
import{Dq as P,lm as D,mm as O}from"./chunk-0vjgbyf7.js";import{Mu as c,Ou as h,Pu as i}from"./chunk-rhbq1var.js";import{Wu as p,Zu as d}from"./chunk-71gwef4q.js";var R=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function C(z,Q,F){let J={fullTag:F,content:Q,attrs:z};if(/\bserver\b/.test(z))return{...J,type:"server"};if(/\bdata-stx-scoped\b/.test(z))return{...J,type:"client"};if(R.test(Q))return{...J,type:"signals"};if(/\bclient\b/.test(z)||/\btype\s*=\s*["']module["']/.test(z)||/\bsrc\s*=/.test(z))return{...J,type:"client"};return{...J,type:"server"}}var y=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function b(z){let Q=[],F=[],J=[],$=0;while($<z.length){let X=z.indexOf("<",$);if(X===-1)break;let j=O(z,X);if(j>X){$=j;continue}let Z=D(z,X);if(Z>X){let U=z.slice(X,Z),B=y.exec(U);if(B){let Y=C(B[1],B[2],U);switch(Y.type){case"signals":Q.push(Y);break;case"client":F.push(Y);break;case"server":J.push(Y);break}}$=Z;continue}$=X+(z.startsWith("<!--",X)?4:1)}return{signals:Q,client:F,server:J}}var S=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function f(z){let Q=[],F=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=F.exec(z))!==null)Q.push({start:J.index,end:J.index+J[0].length});return Q}function x(z,Q){return Q.some((F)=>z>=F.start&&z<F.end)}function u(z){let Q=(z||"").trim();if(!Q)return null;if(/[\s>+~,:]/.test(Q))return null;let F={},J=Q,$=J.match(/^[a-z][\w-]*/i);if($)F.tag=$[0].toLowerCase(),J=J.slice($[0].length);while(J.length>0){let X=J.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(X){if(F.attr=X[1],X[3]!==void 0&&X[3]!=="")F.attrValue=X[3];J=J.slice(X[0].length);continue}let j=J.match(/^#([\w-]+)/);if(j){F.id=j[1],J=J.slice(j[0].length);continue}let Z=J.match(/^\.([\w-]+)/);if(Z){F.className=Z[1],J=J.slice(Z[0].length);continue}return null}if(!F.tag&&!F.attr&&!F.id&&!F.className)return null;return F}function g(z,Q){if(Q.attr){if(!(Q.attrValue===void 0?new RegExp(`\\b${Q.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${Q.attr}\\s*=\\s*(["'])\\s*${Q.attrValue}\\s*\\1`,"i")).test(z))return!1}if(Q.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${Q.id}\\s*\\1`,"i").test(z))return!1}if(Q.className){let F=z.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!F)return!1;if(!F[2].split(/\s+/).includes(Q.className))return!1}return!0}function E(z,Q="main"){let F=u(Q);if(!F)return null;let J=/<([a-z][\w-]*)\b([^>]*)>/gi,$=f(z),X;while((X=J.exec(z))!==null){if(x(X.index,$))continue;let j=X[1].toLowerCase(),Z=X[2]||"";if(Z.trimEnd().endsWith("/")||S.has(j))continue;if(F.tag&&F.tag!==j)continue;if(!g(Z,F))continue;let U=X[0],B=X.index+U.length,Y=new RegExp(`<(/?)${j}\\b([^>]*)>`,"gi");Y.lastIndex=B;let W=1,G;while((G=Y.exec(z))!==null){if(x(G.index,$))continue;let w=G[1]==="/";if(!w&&(G[2]||"").trimEnd().endsWith("/"))continue;if(W+=w?-1:1,W===0)return{openTag:U,openIndex:X.index,start:B,end:G.index,tagName:j}}return null}return null}var t="X-STX-Router",zz="private, no-store";function M(z){return z.headers.get("X-STX-Router")==="true"}function m(z,Q){if(!z)return Q;return z.split(",").some((J)=>J.trim().toLowerCase()===Q.toLowerCase())?z:`${z}, ${Q}`}function Fz(z){return{Vary:m(z,"X-STX-Router")}}import _ from"path";c();var o="stx-page-head:",n=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v=null;function l(){if(v!==null)return v;try{let{getRouterScript:z}=(i(),p(h));v=`<script>${z()}</script>`}catch{v=""}return v}async function Bz(z,Q){if(Q===!1)return null;if(Q&&typeof Q==="string"){let J=_.resolve(z,Q);if(await Bun.file(J).exists())return J;return null}let F=_.join(z,"app.stx");if(await Bun.file(F).exists())return F;return null}async function Uz(z,Q){try{let F=await Bun.file(z).text(),J=F,$=F.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if($)J=$[1].trim();let X=b(F),j=[...X.client.map((K)=>K.fullTag),...X.signals.map((K)=>K.fullTag)],Z=[],U=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,B;while((B=U.exec(F))!==null)Z.push(B[0]);let Y=J;for(let K of X.server)Y=Y.replace(K.fullTag,"");for(let K of X.client)Y=Y.replace(K.fullTag,"");Y=Y.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let W="<!--__STX_PAGE_SLOT__-->";if(Y=Y.replace(/<slot\s*\/>/gi,W).replace(/<slot\s*>\s*<\/slot>/gi,W),!Y.includes(W))return console.warn(`[stx] Shell ${z} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:G,extractVariables:w,defaultConfig:q,loadStxConfig:H}=await import("./chunk-yn1k391m.js"),A=await H(),V={__filename:z,__dirname:_.dirname(z)};for(let K of j){let I=K.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(I&&!K.includes("client")&&!K.includes('type="module"'))await w(I[1],V,z)}let k=await G(Y,V,z,{...q,...A,...Q},new Set),N=k.indexOf(W);if(N===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:k.substring(0,N),afterSlot:k.substring(N+W.length),filePath:z,shellScripts:j,shellStyles:Z}}catch(F){return console.error(`[stx] Error processing shell ${z}:`,F),null}}function Wz(z,Q,F){let J,$="",X=Q.match(n);if(X){Q=Q.replace(X[0],"");try{let Y=Buffer.from(X[1],"base64").toString("utf8"),W=Y.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(W)J=W[1].trim();$=Y.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let j=F||J||"stx App",Z=l(),U="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Hl as A,Il as D,Kq as k,Sm as T,Tm as y,Xo as x,_l as B,am as F,fs as w,ip as M,zp as R}from"./chunk-
|
|
2
|
+
import{Hl as A,Il as D,Kq as k,Sm as T,Tm as y,Xo as x,_l as B,am as F,fs as w,ip as M,zp as R}from"./chunk-0vjgbyf7.js";import{Zu as P}from"./chunk-71gwef4q.js";function b(K){return K.endsWith(".md")||K.endsWith(".markdown")}function C(K){let z=[];_(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let G=[...z];_(/<code\b[^>]*>[\s\S]*?<\/code>/gi,G);function _(J,X){let $;while(($=J.exec(K))!==null){let q=$.index,N=q+$[0].length;if(X?.some((Y)=>q>=Y.start&&N<=Y.end))continue;z.push({start:q,end:N})}}if(z.length===0)return K;z.sort((J,X)=>J.start-X.start);let U="",Q=0;for(let J of z){if(J.start<Q)continue;U+=K.slice(Q,J.start),U+=`@raw${K.slice(J.start,J.end)}@endraw`,Q=J.end}return U+=K.slice(Q),U}async function j(K,z={}){let{data:G,content:_}=A(K),Q=await(z.renderer??((J)=>D(J)))(_);return{html:C(Q),frontmatter:G??{}}}import{dirname as v,resolve as H}from"path";function f(K){let z=K,G=x(K);if(G)z=G.content.trim();let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U=[],Q=[],J=[],X=(N)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(N),$;while(($=_.exec(K))!==null){let N=$[1],Y=$[2],E=$[0],Z=N.includes("server");if(X(Y))J.push(E);else if(Z)Q.push(Y);else U.push(E)}let q=z;{let N=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,Y,E=[];while((Y=N.exec(q))!==null){let Z=Y.index+Y[0].length,L=q.indexOf("</script>",Z);if(L===-1)continue;E.push({start:Y.index,end:L+9}),N.lastIndex=L+9}for(let Z=E.length-1;Z>=0;Z--)q=q.substring(0,E[Z].start)+q.substring(E[Z].end)}for(let N of U)q=q.replace(N,"");return{templateContent:q,serverScripts:Q,clientScripts:U,signalsScripts:J}}function g(K,z){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${Q.join(`
|
|
|
14
14
|
`)}`}else{if(G.processClientScripts!==!1&&Q.length>0){let N=X.__stx_event_bindings||[],Y=B(X),Z=(await Promise.all(Q.map(async(V)=>{let W=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!W)return V;return await F(W[1],{eventBindings:N,templateContent:q,serverData:Y,filePath:z})}))).join(`
|
|
15
15
|
`);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${Z}
|
|
16
16
|
$1`);else q+=`
|
|
17
|
-
${Z}`}q=await M(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCrosswindCSS:N}=await import("./chunk-
|
|
17
|
+
${Z}`}q=await M(q)}if(G.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=g(q,G.title)}if(G.injectCSS)try{let{injectCrosswindCSS:N}=await import("./chunk-980vbj13.js");q=await N(q)}catch{}return q}
|
|
18
18
|
export{b as qk,C as rk,j as sk,s as tk,i as uk,I as vk};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$i as v,_i as _,aj as U}from"./chunk-9n0gvfrg.js";import{Ol as C,Pl as N,Rl as E,Sq as T,hs as S}from"./chunk-
|
|
2
|
+
import{$i as v,_i as _,aj as U}from"./chunk-9n0gvfrg.js";import{Ol as C,Pl as N,Rl as E,Sq as T,hs as S}from"./chunk-0vjgbyf7.js";import{Ot as y}from"./chunk-yvpagchj.js";import L from"path";var j=new Map,M=new Map,b=["composables","functions"];function K(V){let J=L.basename(V,".ts");return J==="index"||J==="types"||V.endsWith(".d.ts")}async function F(V){if(V)return L.resolve(V);let J=`<default>:${process.cwd()}`,Q=M.get(J);if(Q!==void 0)return Q;let z=await h();if(z!==null)M.set(J,z);return z}async function h(){let V=await S(),J=V.root||process.cwd(),Q=V.composablesDir;if(Q)return L.resolve(J,Q);for(let z of b){let Z=L.resolve(J,z);try{let W=new Bun.Glob("**/*.ts");for await(let Y of W.scan({cwd:Z,absolute:!0}))if(!K(Y))return Z}catch{}}return null}async function s(V){let J=await F(V);if(!J)return[];let Q=[];try{let W=new Bun.Glob("**/*.ts");for await(let Y of W.scan({cwd:J,absolute:!0}))if(!K(Y))Q.push(Y)}catch{return[]}Q.sort();let z=T({loader:"ts",target:"browser",define:E()}),Z=[];for(let W of Q)try{let Y=await Bun.file(W).text(),G=z.scan(Y).exports.filter(($)=>$!=="default");if(G.length>0)Z.push({file:W,names:G})}catch{}return Z}function u(V,J){return new RegExp(`\\b${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(V)}function f(V,J,Q){let z=new Map;for(let{file:G,names:$}of V)for(let O of $)if(!z.has(O))z.set(O,G);let Z=(G)=>{let $=[];for(let[O,P]of z)if(u(G,O))$.push(P);return $},W=new Set,Y=Z(Q);while(Y.length>0){let G=[];for(let $ of Y){if(W.has($))continue;W.add($);for(let O of Z(J.get($)??""))if(!W.has(O))G.push(O)}Y=G}return W}async function i(V,J){let Q=await F(V);if(!Q)return null;let z=[];try{let q=new Bun.Glob("**/*.ts");for await(let H of q.scan({cwd:Q,absolute:!0})){if(K(H))continue;z.push(H)}}catch{return U(j,Q,"",""),null}let Z=_(z);if(z.length===0)return U(j,Q,Z,""),null;z.sort();let W=T({loader:"ts",target:"browser",define:E()}),Y=new Map,G=[];for(let q of z)try{let H=await Bun.file(q).text();Y.set(q,H);let w=W.scan(H).exports.filter((X)=>X!=="default");if(w.length>0)G.push({file:q,names:w})}catch{Y.set(q,"")}let $=J===void 0?new Set(z):f(G,Y,J);if($.size===0)return null;let O=z.filter((q)=>$.has(q)),P=`${Q}\x00${O.join("\x00")}`,B=v(j,P,Z);if(B!==void 0)return B||null;let A=[],R=new Set,I=new Set;for(let q of O)try{let H=Y.get(q)??await Bun.file(q).text(),w=L.basename(q,".ts");for(let X of H.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(X[1])I.add(X[1]);try{for(let X of W.scan(H).exports)if(X!=="default")R.add(X)}catch{}H=C(H),H=N(H),H=H.replace(/^export\s+(default\s+)?/gm,""),H=W.transformSync(H),A.push(`// Composable: ${w}
|
|
3
3
|
${H.trim()}`)}catch(H){console.warn(`[stx] Failed to load composable ${q}:`,H)}if(A.length===0||R.size===0)return U(j,P,Z,""),null;let D=[...R].map((q)=>` try { __c[${JSON.stringify(q)}] = ${q}; } catch (e) {}`).join(`
|
|
4
4
|
`),g=JSON.stringify([...R]),k=A.join(`
|
|
5
5
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Xi as a,Yi as b,Zi as c}from"./chunk-
|
|
2
|
+
import{Xi as a,Yi as b,Zi as c}from"./chunk-5z466wfw.js";import"./chunk-9n0gvfrg.js";import"./chunk-0vjgbyf7.js";import"./chunk-1bwwtctk.js";import"./chunk-q9zsjgpf.js";import"./chunk-a6a9djpq.js";import"./chunk-txys90mf.js";import"./chunk-eaqh53ea.js";import"./chunk-1spzqjve.js";import"./chunk-h45js0cg.js";import"./chunk-t7b39wwk.js";import"./chunk-w18t3nmy.js";import"./chunk-yvpagchj.js";import"./chunk-rhbq1var.js";import"./chunk-2c2z8n54.js";import"./chunk-71gwef4q.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Yg as p}from"./chunk-
|
|
2
|
+
import{Yg as p}from"./chunk-hqpsxzxe.js";import{ph as a,rh as JF,sh as ZF,th as qF}from"./chunk-51qxyf3s.js";import{sj as C,tj as D}from"./chunk-ph0q97r5.js";import{Ek as QF,Fk as XF,Gk as YF}from"./chunk-58f0mthg.js";import{Gq as FF,Kq as c,Nm as u,fm as l,fp as o,fs as n,hm as d,hs as N,lq as e,zq as t}from"./chunk-0vjgbyf7.js";import{lt as r}from"./chunk-eaqh53ea.js";import{Nu as S,Pu as WF}from"./chunk-rhbq1var.js";import G from"fs";import Z from"path";import{createHash as $F}from"crypto";WF();function g(J){return $F("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 UF(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 GF}from"crypto";function VF(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 i(J,q,z={}){let Q=h.resolve(J),X=await Bun.file(Q).text(),I=GF("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(($)=>p($))),{context:E}=VF({__filename:Q,__dirname:h.dirname(Q),__stx_serverDeclared:W}),L=new Set,_={...n,...K,...z,buildMode:"compile",strict:!1},w=await c(X,E,Q,_,L),U=a(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,status:u(X),streamTemplates:E.__streamTemplates}}var kF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function s(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(kF.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 lF(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 _=o(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 i(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=FF(F.html,k,{bodyScripts:[`<script src="/__stx/${$.filename}"></script>`],...W&&{colorMode:W}}),W)F.html=e(F.html,W);if(k.htmlAttrs)F.html=t(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 r(F.html),F.fragment=JF(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}=s(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=YF(z);if(v){let{copied:Y,bytes:F}=s(v,Z.join(Q,"public",XF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${QF}/`)}let R={runtime:H.filename,router:$.filename},zF=ZF(j,R,Q);qF(zF,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 Og,f as Pg,m as Qg,UF as Rg,i as Sg,lF as Tg};
|