@stacksjs/stx 0.2.259 → 0.2.260
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-7gdcvhax.js → chunk-0cpze9x0.js} +1 -1
- package/dist/{chunk-5fhw60cg.js → chunk-0eeymffm.js} +1 -1
- package/dist/{chunk-bj699yx9.js → chunk-0jqtsexq.js} +1 -1
- package/dist/{chunk-d4zxzm04.js → chunk-0tcqnfm9.js} +1 -1
- package/dist/{chunk-2dc2n1j4.js → chunk-0ve08c39.js} +1 -1
- package/dist/{chunk-pwf9rza1.js → chunk-149qmkxb.js} +1 -1
- package/dist/{chunk-whcv31fs.js → chunk-2d3gm9fw.js} +8 -8
- package/dist/{chunk-sb56e14e.js → chunk-35dxrg9z.js} +1 -1
- package/dist/{chunk-ynw2adnp.js → chunk-47ectzew.js} +1 -1
- package/dist/{chunk-wnzd8ssb.js → chunk-4h7zdmrz.js} +1 -1
- package/dist/{chunk-z59m82jn.js → chunk-629d0529.js} +1 -1
- package/dist/{chunk-b67z5e9b.js → chunk-75ysdbke.js} +1 -1
- package/dist/{chunk-f5g1ehm8.js → chunk-7b3gn58c.js} +1 -1
- package/dist/{chunk-rtq16tnr.js → chunk-7xhxtep4.js} +1 -1
- package/dist/{chunk-zee6xp0g.js → chunk-8z2w0053.js} +1 -1
- package/dist/{chunk-65wdkpd9.js → chunk-91hdna71.js} +1 -1
- package/dist/{chunk-g4ea560r.js → chunk-akv4sa0c.js} +1 -1
- package/dist/{chunk-nzgh2cry.js → chunk-b6b8rm2e.js} +1 -1
- package/dist/{chunk-31k9t0wf.js → chunk-bgd8qtdf.js} +1 -1
- package/dist/{chunk-xjstjyad.js → chunk-c6vnw997.js} +1 -1
- package/dist/{chunk-frq6qcct.js → chunk-dv8mbh0j.js} +16 -16
- package/dist/{chunk-5xpye64n.js → chunk-en1q9d6s.js} +1 -1
- package/dist/{chunk-2v835apx.js → chunk-fheafw7c.js} +1 -1
- package/dist/{chunk-afx6wmkn.js → chunk-ft1wk1w4.js} +1 -1
- package/dist/{chunk-esf8qq12.js → chunk-hcw4k9cc.js} +2 -2
- package/dist/{chunk-30y76rge.js → chunk-j2v0zyp6.js} +2 -2
- package/dist/{chunk-by6yhcbc.js → chunk-jt2z7t34.js} +1 -1
- package/dist/{chunk-z2dqfw3c.js → chunk-m1x3jmgv.js} +1 -1
- package/dist/{chunk-bp8fmnht.js → chunk-m7de5pqz.js} +1 -1
- package/dist/{chunk-gjxbne6s.js → chunk-m7qbd931.js} +1 -1
- package/dist/chunk-mdw538d5.js +13 -0
- package/dist/{chunk-9jv4svke.js → chunk-mmew9zcf.js} +1 -1
- package/dist/{chunk-v1nfpxp7.js → chunk-p044tfvj.js} +1 -1
- package/dist/{chunk-k32yt1zn.js → chunk-pas7f178.js} +1 -1
- package/dist/{chunk-mv9275dm.js → chunk-phngtpxg.js} +1 -1
- package/dist/{chunk-9gg2k0pp.js → chunk-pyp481nm.js} +1 -1
- package/dist/{chunk-wk0zkhqq.js → chunk-qmtr6msv.js} +1 -1
- package/dist/{chunk-h11je5t6.js → chunk-qym9n5hg.js} +1 -1
- package/dist/{chunk-vwc4d2t0.js → chunk-r1kxctv6.js} +1 -1
- package/dist/{chunk-k7f080bc.js → chunk-s3nn6sph.js} +1 -1
- package/dist/{chunk-3tmp8p4g.js → chunk-spk80ph3.js} +1 -1
- package/dist/{chunk-8sg68a01.js → chunk-te7510sg.js} +1 -1
- package/dist/{chunk-5f7var44.js → chunk-xm40k29a.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/client-script-bundler.d.ts +0 -1
- package/dist/client-script-bundler.js +29 -1
- 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-3wbafnky.js +0 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ns as r8,xs as R6,ys as D6}from"./chunk-25de1sj7.js";import{Es as i5}from"./chunk-38ykv2gd.js";import{Ms as d0}from"./chunk-g8tce9rr.js";import{at as t8}from"./chunk-
|
|
2
|
+
import{ns as r8,xs as R6,ys as D6}from"./chunk-25de1sj7.js";import{Es as i5}from"./chunk-38ykv2gd.js";import{Ms as d0}from"./chunk-g8tce9rr.js";import{at as t8}from"./chunk-0eeymffm.js";import{bt as F8}from"./chunk-a8mnhryz.js";import{it as N6,kt as A6,lt as M6,nt as L5}from"./chunk-dnhckx52.js";import{ot as e8,st as $$,ut as q2}from"./chunk-jt8as8j8.js";import{Ft as $2}from"./chunk-x84g0m0p.js";import{Gt as G7,Ht as w2,It as _2,Jt as s1,Nt as R2,Ot as h4,Pt as G8,Rt as N9,Ut as x8}from"./chunk-5h5ydexj.js";import{Du as a8,Fu as jG,Gu as n$,Iu as B5,cu as e3,fu as n9,mu as p3}from"./chunk-aw651z2y.js";import{Nu as T6}from"./chunk-wj2trgsn.js";import{Su as f}from"./chunk-0y6f4037.js";import C1 from"path";import S5 from"fs";var f4=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"]),x4={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"},T2=new Set(["ctrl","alt","shift","meta"]),u4={left:0,middle:1,right:2};function g4($){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(T2.has(J))Z.systemKeys.push(J);else if(J in u4)Z.mouse=J;else if(J in x4||/^[a-z]$/.test(J))Z.keys.push(x4[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 d4($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,q]=Y,U=Y.index,W=U+Q.length,z=`__stx_evt_${X++}`,K=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=H.exec(q))!==null){let[,_,F]=B,V=_.split("."),O=V[0];if(!f4.has(O))continue;K.push({attribute:`@${_}`,event:O,handler:F,modifiers:g4(V.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,F]=B,V=_.split("."),O=V[0];if(!f4.has(O))continue;K.push({attribute:`@${_}`,event:O,handler:F,modifiers:g4(V.slice(1)),elementId:z})}if(K.length>0)Z.push({originalTag:Q,elementId:z,events:K,startIndex:U,endIndex:W})}return Z}function I2($){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=u4[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 k2($,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 C$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function E2($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=I2($),Y=k2(C$($.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;
|
|
@@ -3363,9 +3363,9 @@ ${X9($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3363
3363
|
} finally {
|
|
3364
3364
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3365
3365
|
}
|
|
3366
|
-
})();`}function jY($,Z){if(G1($)){let Y=G1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};return{html:u1($,(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 Z9=0,pK=new L1(500),Q9=new Set;function iK(){Q9.clear()}function _Y($){if($.__onceStore instanceof Set)return $.__onceStore;return Q9}async function d3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||W0.join(W0.dirname(X),"partials");if(G&&!W0.isAbsolute(G))G=W0.resolve(process.cwd(),G);let q=KY($,"@partial","@include"),U=_Y(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,F,V)=>{let O=F.trim(),L=`${X}:${O}`;if(U.has(L))return"";return U.add(L),F});{let _=/@includeIf\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")")L--;w++}if(L!==0)break;let R=q.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],T=W(N,G,X),A="";if(T&&await Bun.file(T).exists())Y.add(T),A=`@include(${R})`;q=q.substring(0,V)+A+q.substring(w),_.lastIndex=0}}for(let[_,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=V.exec(q))!==null){let L=O.index,w=L+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 N=q.substring(w+1,D-1),T=u3(N,0);if(T===-1){V.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){V.lastIndex=D;continue}let I=k[1],y=M.substring(k[0].length),E,b=u3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${A})`,h;if(G0(C)){let d=q0(C,Object.keys(Z));h=Boolean(d(...Object.values(Z)))}else h=Boolean(t(C,Z));let x=F?!h:h,l="";if(x){let d=W(I,G,X);if(d&&await Bun.file(d).exists())Y.add(d);l=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+l+q.substring(D),V.lastIndex=0}catch(C){let h=C instanceof Error?C.message:String(C),x=K0("Include",`Error evaluating ${_} condition: ${h}`,X,$,L);q=q.substring(0,L)+x+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let[,T,A,M,k]=N;try{let I,y=A.trim();if(G0(y))I=q0(y,Object.keys(Z))(...Object.values(Z));else I=t(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},h=await H(T,C,$,V);E+=h}else if(k)E=await H(k,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,V)+K0("Each",`Error in @each: ${y}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let T=N[1],A=R.slice(N[0].length),M,k=A.match(/^\s*,\s*\{/);if(k){A=A.slice(k[0].length-1);let E=1,b=1;while(b<A.length&&E>0){if(A[b]==="{")E++;else if(A[b]==="}"){if(E--,E===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let I,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=w0(M,Z)}catch(h){let x=h instanceof Error?h.message:String(h);if(J.debug){let l=K0("Include",`Error parsing includeFirst variables: ${x}`,X,$,V,D);q=q.replace(D,()=>l)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let h of E){let x=W(h,G,X);if(!x)continue;if(await a(x)){let l=await H(h,b,$,V);q=q.replace(D,()=>l),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let h=K0("Include",`None of the includeFirst paths exist: ${T}`,X,$,V,D);q=q.replace(D,()=>h)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=K0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,F,V){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let L=W0.resolve(F),w=W0.resolve(W0.dirname(V)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=W0.resolve(F,O);else R=W0.resolve(w,O);let D=W0.normalize(R),N=D.startsWith(L+W0.sep)||D===L,T=D.startsWith(w+W0.sep)||D===w,A=!1,M=W0.dirname(w);if(D.startsWith(M+W0.sep)){if(!W0.relative(M,D).split(W0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))A=!0}if(!N&&!T&&!A)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let z=W0.resolve(X);Q.add(z);function K(_,F,V,O){return J.onIncludeError?.({includePath:_,templatePath:X,message:F,partialsDir:G}),K0("Include",F,X,V,O)}async function H(_,F={},V,O){let L=W(_,G,X);if(!L)return K(_,`Could not resolve path for include: ${_}`,V,O);let w=W0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>W0.basename(D)).join(" -> ");return K(_,`Circular include detected: ${R}`,V,O)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(x){let l=x instanceof Error?x.message:String(x);return K(_,`Error loading include file ${_}: ${l}`,V,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:x}=await import("./chunk-
|
|
3367
|
-
`;continue}if(_0)try{let{extractVariables:X0}=await import("./chunk-
|
|
3368
|
-
`}}if(b){let x=jY(D,b);if(D=x.html,x.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),b=x.mergedIntoExisting;else if(!x.stamped)console.warn(`[stx] ${W0.relative(process.cwd(),L)} 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 d3(D,k,L,J,Y,Q);let{processLoops:C}=await import("./chunk-
|
|
3366
|
+
})();`}function jY($,Z){if(G1($)){let Y=G1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};return{html:u1($,(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 Z9=0,pK=new L1(500),Q9=new Set;function iK(){Q9.clear()}function _Y($){if($.__onceStore instanceof Set)return $.__onceStore;return Q9}async function d3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||W0.join(W0.dirname(X),"partials");if(G&&!W0.isAbsolute(G))G=W0.resolve(process.cwd(),G);let q=KY($,"@partial","@include"),U=_Y(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,F,V)=>{let O=F.trim(),L=`${X}:${O}`;if(U.has(L))return"";return U.add(L),F});{let _=/@includeIf\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")")L--;w++}if(L!==0)break;let R=q.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],T=W(N,G,X),A="";if(T&&await Bun.file(T).exists())Y.add(T),A=`@include(${R})`;q=q.substring(0,V)+A+q.substring(w),_.lastIndex=0}}for(let[_,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=V.exec(q))!==null){let L=O.index,w=L+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 N=q.substring(w+1,D-1),T=u3(N,0);if(T===-1){V.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){V.lastIndex=D;continue}let I=k[1],y=M.substring(k[0].length),E,b=u3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${A})`,h;if(G0(C)){let d=q0(C,Object.keys(Z));h=Boolean(d(...Object.values(Z)))}else h=Boolean(t(C,Z));let x=F?!h:h,l="";if(x){let d=W(I,G,X);if(d&&await Bun.file(d).exists())Y.add(d);l=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+l+q.substring(D),V.lastIndex=0}catch(C){let h=C instanceof Error?C.message:String(C),x=K0("Include",`Error evaluating ${_} condition: ${h}`,X,$,L);q=q.substring(0,L)+x+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let[,T,A,M,k]=N;try{let I,y=A.trim();if(G0(y))I=q0(y,Object.keys(Z))(...Object.values(Z));else I=t(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},h=await H(T,C,$,V);E+=h}else if(k)E=await H(k,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,V)+K0("Each",`Error in @each: ${y}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let T=N[1],A=R.slice(N[0].length),M,k=A.match(/^\s*,\s*\{/);if(k){A=A.slice(k[0].length-1);let E=1,b=1;while(b<A.length&&E>0){if(A[b]==="{")E++;else if(A[b]==="}"){if(E--,E===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let I,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=w0(M,Z)}catch(h){let x=h instanceof Error?h.message:String(h);if(J.debug){let l=K0("Include",`Error parsing includeFirst variables: ${x}`,X,$,V,D);q=q.replace(D,()=>l)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let h of E){let x=W(h,G,X);if(!x)continue;if(await a(x)){let l=await H(h,b,$,V);q=q.replace(D,()=>l),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let h=K0("Include",`None of the includeFirst paths exist: ${T}`,X,$,V,D);q=q.replace(D,()=>h)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=K0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,F,V){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let L=W0.resolve(F),w=W0.resolve(W0.dirname(V)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=W0.resolve(F,O);else R=W0.resolve(w,O);let D=W0.normalize(R),N=D.startsWith(L+W0.sep)||D===L,T=D.startsWith(w+W0.sep)||D===w,A=!1,M=W0.dirname(w);if(D.startsWith(M+W0.sep)){if(!W0.relative(M,D).split(W0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))A=!0}if(!N&&!T&&!A)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let z=W0.resolve(X);Q.add(z);function K(_,F,V,O){return J.onIncludeError?.({includePath:_,templatePath:X,message:F,partialsDir:G}),K0("Include",F,X,V,O)}async function H(_,F={},V,O){let L=W(_,G,X);if(!L)return K(_,`Could not resolve path for include: ${_}`,V,O);let w=W0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>W0.basename(D)).join(" -> ");return K(_,`Circular include detected: ${R}`,V,O)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(x){let l=x instanceof Error?x.message:String(x);return K(_,`Error loading include file ${_}: ${l}`,V,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:x}=await import("./chunk-en1q9d6s.js");R=x(R,Z)}if(R&&(J.debug||!O5()&&!o5()))try{let{warnUnbalancedTags:x}=await import("./chunk-85wgtm01.js");x(R,L)}catch{}let D=R;try{let{processESImports:x}=await import("./chunk-0cpze9x0.js");await x(R,Z,L,J,Y)}catch(x){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let N=z$(D);if(N)D=N.content.trim();let A=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(A)M=`<style${A[1]}>${A[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...Z};k.__stx_signals_gate=Q1(R,L);for(let[x,l]of Object.entries(F))k[x]=l;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(I)],E="",b=null;for(let x of y){let l=x[1]||"",d=x[2]||"",_0=l.includes("server"),h0=T1(l);if(!_0&&d.trim()){let{interpolateScriptExpressions:X0}=await import("./chunk-8z2w0053.js");d=X0(d,k)}let D0="";try{let{extractAndStripCssImports:X0,renderVendorStyleTags:J0}=await import("./chunk-akv4sa0c.js"),N0=X0(d,{filePath:L,projectRoot:process.cwd()});d=N0.code,D0=J0(N0.styles)}catch(X0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,X0 instanceof Error?X0.message:X0)}if(h0&&d.trim())d=I1(d);if(!_0){try{let{injectBrowserCoreAutoImports:J0}=await import("./chunk-akv4sa0c.js");d=J0(d).code;let{hasUserImports:N0,bundleClientScript:z0}=await import("./chunk-629d0529.js");if(N0(d))d=await z0(d,L,{projectRoot:process.cwd()})}catch(J0){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,J0 instanceof Error?J0.message:J0)}let{stripStxRuntimeImports:X0}=await import("./chunk-35dxrg9z.js");d=X0(d)}let y0=HY(d);if(y0&&!_0){b=`stx_scope_${W0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Z9}`;let X0=t0(d),J0=BY(X0,b);E+=`${D0}<script data-stx-scoped data-stx-run="always">${J0}</script>
|
|
3367
|
+
`;continue}if(_0)try{let{extractVariables:X0}=await import("./chunk-75ysdbke.js");await X0(d,k,L)}catch(X0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,X0)}if(!_0&&!y0){let X0=l.replace(/\bclient\b/i,"").trim();b=`stx_scope_${W0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Z9}`;let J0=t0(d),N0=Y9(J0,b),z0=J9(J0,N0);E+=`${D0}<script data-stx-scoped data-stx-run="always"${X0?` ${X0}`:""}>${z0}</script>
|
|
3368
|
+
`}}if(b){let x=jY(D,b);if(D=x.html,x.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),b=x.mergedIntoExisting;else if(!x.stamped)console.warn(`[stx] ${W0.relative(process.cwd(),L)} 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 d3(D,k,L,J,Y,Q);let{processLoops:C}=await import("./chunk-b6b8rm2e.js"),h=C(D,k,L);if(h=$1(h,k,L),h=F1(h,k,L),M)h+=`
|
|
3369
3369
|
`+M;if(E)h+=`
|
|
3370
3370
|
`+E;return h}catch(R){let D=R instanceof Error?R.message:String(R);return K(_,`Error processing include ${_}: ${D}`,V,O)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,F=_+j[0].length-1,V=1,O=F+1;while(O<q.length&&V>0){if(q[O]==="(")V++;else if(q[O]===")")V--;O++}if(V!==0)break;let L=q.substring(_,O),w=q.substring(F+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=O;continue}let D=R[1],N,T=w.substring(R[0].length),A=u3(T,0);if(A!==-1)N=T.substring(A+1).trim();let M={};if(N)try{M=w0(N,Z)}catch(I){let y=I instanceof Error?I.message:String(I);q=q.replace(L,K0("Include",`Error parsing include variables for ${D}: ${y}`,X,$,_)),B.lastIndex=0;continue}let k=await H(D,M,$,_);q=q.substring(0,_)+k+q.substring(O),B.lastIndex=0}return q}function m3($,Z){let X=$;function J(Y,Q,G,q){let U=Y,W=!0;while(W){W=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),K=U.match(z);if(!K||K.index===void 0)break;let H=K.index,B=K[1],j=H+K[0].length,_=new RegExp(`@${Q}\\(`),F=new RegExp(`@${G}(?![a-z])`),V=1,O=j,L=-1;while(V>0&&O<U.length){let R=U.slice(O),D=R.match(_),N=R.match(F),T=D?O+D.index:1/0,A=N?O+N.index:1/0;if(T<A)V++,O=T+(D[0].length||1);else if(A<1/0){if(V--,V===0){L=A;break}O=A+G.length+1}else break}if(L===-1)break;let w=U.slice(j,L);if(!Z[B])Z[B]=[];if(q)Z[B].unshift(w);else Z[B].push(w);U=U.substring(0,H)+U.substring(L+`@${G}`.length),W=!0}return U}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function l3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
|
|
3371
3371
|
`)})}import*as c3 from"path";async function G9($,Z,X=""){if(c3.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 U9($,Z,X,"@js","@endjs")}async function q9($,Z,X=""){if(c3.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 U9($,Z,X,"@ts","@endts")}async function U9($,Z,X,J,Y){let Q=$,G=h1(`${J}([\\s\\S]*?)${Y}`,"g"),q=[],U;while((U=G.exec($))!==null)q.push({fullMatch:U[0],content:U[1]||"",index:U.index});for(let{fullMatch:W,content:z,index:K}of q)try{let H={...Z,global:Z},B=Object.keys(H),j=Object.values(H),_=z.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let V=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=V.length>0?`return { ${V.join(", ")} };`:"return {};",L=`
|
|
@@ -3537,14 +3537,14 @@ document.addEventListener("focusout",function(e){
|
|
|
3537
3537
|
${Z}${$.slice(G)}`}if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3538
3538
|
`+$.slice(G)}if(G1($))return u1($,(G)=>`${G}
|
|
3539
3539
|
${Z}`);return`${Z}
|
|
3540
|
-
${$}`}async function L$($,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-
|
|
3540
|
+
${$}`}async function L$($,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-s3nn6sph.js"),J=await X(Z.debug);return Z4($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function LQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function $8($){if($.includes("data-stx-tooltip-runtime")||!LQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${$4()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
|
|
3541
3541
|
${Z}`;return`${$.slice(0,X)}${Z}
|
|
3542
3542
|
${$.slice(X)}`}var wQ=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function RQ($){return wQ.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function DQ($,Z){if(!$.includes("</body>"))return $;if(RQ($))return $;let X=Z?.router,J="";{let q={};if(X){if(X.container)q.container=X.container;if(X.interceptAllLinks!==void 0)q.interceptAllLinks=X.interceptAllLinks;if(X.progress!==void 0)q.progress=X.progress;if(X.viewTransitions!==void 0)q.viewTransitions=X.viewTransitions;if(X.viewTransitionDuration!==void 0)q.viewTransitionDuration=X.viewTransitionDuration;if(X.viewTransitionEasing!==void 0)q.viewTransitionEasing=X.viewTransitionEasing;if(X.scrollToTop!==void 0)q.scrollToTop=X.scrollToTop;if(X.prefetch!==void 0)q.prefetch=X.prefetch;if(X.cache!==void 0)q.cache=X.cache;if(X.progressColor!==void 0)q.progressColor=X.progressColor;if(X.progressHeight!==void 0)q.progressHeight=X.progressHeight}try{let U=await r9(Z?.pagesDir);if(U.length>0)q.ownedRoutes=U}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${a9(q)};</script>
|
|
3543
|
-
`}let{getCachedRouterScript:Y}=await import("./chunk-
|
|
3543
|
+
`}let{getCachedRouterScript:Y}=await import("./chunk-s3nn6sph.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+`
|
|
3544
3544
|
</body>`+$.slice(G+7)}var Z8=Symbol.for("stx.lazy-module-promises");function NQ(){let $=globalThis;return $[Z8]??=new Map,$[Z8]}function o($,Z){let X=NQ(),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=`(?:"[^"]*"|'[^']*'|[^>"'])*`,q8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function AQ($,Z={}){let X=[];for(let J of d5($,Y1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=Y[0].length,U=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,U),start:J.start,end:J.end})}return X}function U8($){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}=X8(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}=X8(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function X8($){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 Q4($,Z){return G8($,Z)}function MQ($){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 TQ($){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 IQ($){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=d5($,(Q,G)=>{Z.lastIndex=G;let q=Z.exec(Q);if(!q||q.index!==G||!X.test(q[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of J){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let q=G[2].match(X),U=U8(q?.[1]??q?.[2]??""),W=[U.itemVar,U.indexVar].filter(Boolean);if(W.length===0)continue;let z=G[1],H=/\/\s*>$/.test(Q.token)||R$.has(z.toLowerCase())?Q.end:z8($,Q.start,z,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(W)})}return Y}var J8=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 kQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Y8($,Z,X,J){if(!$)return!1;let Y=kQ($),Q=!1,G=!1,q=!1,U=/([a-zA-Z_$][\w$]*)/g,W;while((W=U.exec(Y))!==null){let B=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(J8.has(B))continue;if(Z.has(B)||J?.has(B))Q=!0;else if(X&&B in X)G=!0}let z=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,K;while((K=z.exec(Y))!==null){let B=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(J8.has(B)||X&&B in X)continue;q=!0}return(Q||q)&&!G}function w$($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(q8);if(Q&&EQ(Q[3],Q[1])){let[,G,q,U]=Q;return`<${G}${q}${J}>${U}</${G}>`}return`<template${J}>${Y}</template>`}function EQ($,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 W8($,Z){let X=TQ($);function J(Y){let Q=Y,G=IQ(Y),q=(K)=>{let H=new Set;for(let B of G)if(K>B.start&&K<B.end)for(let j of B.vars)H.add(j);return H},U=/@if\s*\(/g,W,z=[];while((W=U.exec(Q))!==null){let K=W.index,H=K+W[0].length,B=1,j=H;while(j<Q.length&&B>0){if(Q[j]==="(")B++;else if(Q[j]===")")B--;j++}if(B!==0)continue;let _=Q.substring(H,j-1).trim(),F=j,V=1,O=F,L=/@(if\s*\(|endif)/g;L.lastIndex=F;let w;while((w=L.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(F,O-6).trim(),D;if(MQ(R)){let N=w5(Q.substring(K,O));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),A=q(K);if(!(T.length>0&&T.every((I)=>Y8(I.condition,X,Z,A))))continue;D=N[0].branches.map((I)=>{let y=J(I.content);if(I.type==="elseif")return w$(y,"@else-if",I.condition??"");if(I.type==="else")return w$(y,"@else");return w$(y,"@if",I.condition??"")}).join(`
|
|
3545
3545
|
`)}else{if(!Y8(_,X,Z,q(K)))continue;D=w$(J(R),"@if",_)}z.push({start:K,end:O,replacement:D}),U.lastIndex=O}for(let K=z.length-1;K>=0;K--){let{start:H,end:B,replacement:j}=z[K];Q=Q.substring(0,H)+j+Q.substring(B)}return Q}return J($)}function bQ($){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 R$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function z8($,Z,X,J){if(R$.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,U=J;while(U<G){let W=$.indexOf("<",U);if(W===-1)return-1;if(U=W,$.startsWith("<!--",U)){let B=$.indexOf("-->",U+4);if(B===-1)return-1;U=B+3;continue}let z=/^<(script|style)\b/i.exec($.slice(U,U+8));if(z){let B=$.indexOf(">",U);if(B===-1)return-1;if($[B-1]==="/"){U=B+1;continue}let j=Q.indexOf(`</${z[1].toLowerCase()}`,U);if(j===-1)return-1;let _=$.indexOf(">",j);if(_===-1)return-1;U=_+1;continue}if($[U+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(U,U+64));if(!B){U++;continue}if(B[1].toLowerCase()===Y){if(q--,U+=B[0].length,q===0)return U;continue}U+=B[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec($.slice(U,U+64));if(!K){U++;continue}let H=$.indexOf(">",U);if(H===-1)return-1;if(K[1].toLowerCase()===Y){let B=$.slice(U,H+1);if(!(/\/\s*>$/.test(B)||R$.has(Y)))q++}U=H+1}return-1}var yQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function SQ($,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 yQ.test(Q)}function K8($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=X.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Y=(K)=>Z.some(([H,B])=>K>=H&&K<B),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],q;while((q=Q.exec($))!==null){if(Y(q.index))continue;let[K,H,B,j,_,F,V]=q,O=bQ(_);if(O===void 0)continue;let L=q.index,w=L+K.length,N=!!V||/\/\s*>$/.test(K)||R$.has(H.toLowerCase())?w:z8($,L,H,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&SQ($,N)){Q.lastIndex=w;continue}if(O===!0){let A=`<${H}${B}${F}${V}>`;G.push({start:L,end:w,replacement:A});continue}G.push({start:L,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((K,H)=>K.start-H.start);let U=[],W=-1;for(let K of G){if(K.start<W)continue;U.push(K),W=K.end}let z=$;for(let K=U.length-1;K>=0;K--){let{start:H,end:B,replacement:j}=U[K];z=z.substring(0,H)+j+z.substring(B)}return z}function H8($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let q=Y[1],U=Y.index,W=U+Y[0].length,z=1,K=W;while(K<X.length&&z>0){if(X[K]==="(")z++;else if(X[K]===")")z--;K++}if(z!==0)continue;let H=X.substring(W,K-1).trim(),B=K,j=U8(H),_=q==="for"?"@endfor":"@endforeach",F=1,V=B,O=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");O.lastIndex=B;let L;while((L=O.exec(X))!==null)if(L[1].startsWith(q))F++;else if(F--,F===0){V=L.index+L[0].length;break}if(F!==0)continue;let w=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)G.push({start:U,end:V,vars:T})};if(j.iterable){let T=j.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){w();continue}let A=T.split(/[.[(]/)[0].trim(),M=Z?A in Z:!1,k=G.some((I)=>U>I.start&&U<I.end&&I.vars.includes(A));if(A&&(M||k)){w();continue}}if(j.style==="as")H=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let R=X.substring(B,V-_.length).trim(),D=R.match(q8),N;if(D){let[,T,A,M]=D;N=`<${T}${A} @for="${H}">${M}</${T}>`}else N=`<template @for="${H}">${R}</template>`;Q.push({start:U,end:V,replacement:N})}for(let q=Q.length-1;q>=0;q--){let{start:U,end:W,replacement:z}=Q[q];X=X.substring(0,U)+z+X.substring(W)}return X}function CQ($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(z)=>{let K=J+1;while(K<Q){let H=$[K];if(H==="\\"){K+=2;continue}if(H===z)return K+1;K++}return Q},q=()=>{let z=J+2;while(z<Q&&$[z]!==`
|
|
3546
3546
|
`)z++;return z},U=()=>{let z=J+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},W=(z)=>{let K=z,H=0;while(K<Q){let B=$[K];if(B==="/"&&$[K+1]==="/"){let j=K+2;while(j<Q&&$[j]!==`
|
|
3547
|
-
`)j++;K=j;continue}if(B==="/"&&$[K+1]==="*"){let j=K+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;K=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=K+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}K=j;continue}if(B==="("||B==="["||B==="{"){H++,K++;continue}if(B===")"||B==="]"||B==="}"){H--,K++;continue}if(B===";"&&H===0)return K+1;K++}return Q};while(J<Q){let z=$[J];if(z==="/"&&$[J+1]==="/"){let K=q();X.push($.slice(J,K)),J=K;continue}if(z==="/"&&$[J+1]==="*"){let K=U();X.push($.slice(J,K)),J=K;continue}if(z==='"'||z==="'"||z==="`"){let K=G(z);X.push($.slice(J,K)),J=K;continue}if(z==="{"){Y++,X.push(z),J++;continue}if(z==="}"){Y--,X.push(z),J++;continue}if(Y===0){let K=J>0?$[J-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(z),J++}return X.join("")}async function PQ($,Z,X){let J=AQ($,{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-
|
|
3547
|
+
`)j++;K=j;continue}if(B==="/"&&$[K+1]==="*"){let j=K+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;K=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=K+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}K=j;continue}if(B==="("||B==="["||B==="{"){H++,K++;continue}if(B===")"||B==="]"||B==="}"){H--,K++;continue}if(B===";"&&H===0)return K+1;K++}return Q};while(J<Q){let z=$[J];if(z==="/"&&$[J+1]==="/"){let K=q();X.push($.slice(J,K)),J=K;continue}if(z==="/"&&$[J+1]==="*"){let K=U();X.push($.slice(J,K)),J=K;continue}if(z==='"'||z==="'"||z==="`"){let K=G(z);X.push($.slice(J,K)),J=K;continue}if(z==="{"){Y++,X.push(z),J++;continue}if(z==="}"){Y--,X.push(z),J++;continue}if(Y===0){let K=J>0?$[J-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(z),J++}return X.join("")}async function PQ($,Z,X){let J=AQ($,{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-629d0529.js"));for(let V of J){let O=V.body;if(T1(V.attrs))O=I1(O);if(Y.test(O)){Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O});continue}if(!G(O))continue;try{let L=await q(e1(O).code,Z||"",{projectRoot:process.cwd()});if(Y.test(L))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O,bundled:L})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let U=`${Z??""}\x00${Q.map((V)=>V.content).join("\x00")}`,W=`__stx_setup_${Bun.hash(U).toString(36).slice(0,10)}`,z=[];for(let V=0;V<Q.length;V++){let O=Q[V].bundled??e1(Q[V].content).code;if(!Q[V].bundled&&G(O))O=await q(O,Z||"",{projectRoot:process.cwd()});O=gQ(O);let L=t0(O);z.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
|
|
3548
3548
|
${L}`)}let K=z.join(`
|
|
3549
3549
|
|
|
3550
3550
|
`);K=CQ(K);let H=vQ(K),B=H.split(",").map((V)=>V.trim()).filter(Boolean),j=Y4(K,X),_=`
|
|
@@ -3622,9 +3622,9 @@ ${G.join(`
|
|
|
3622
3622
|
`+Y.slice(Q)}async function I4($,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=Q1($,X);let Q=!Z.__stxProcessingDepth;if(Q)c4(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!O5()&&!o5())&&X&&X.endsWith(".stx"))$2($,X);try{return await K7.timeAsync("template-processing",async()=>{let G=await FG($,Z,X,J,Y);if(Q)G=M4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},W=(Z.__stx_runtime_head||null)??e8(),z=(Z.__stx_head_raw||"").trim(),K,H=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)K=H[1].trim(),z=z.replace(H[0],"").trim();let B=Z.__sections?.title,j=W.title||K||B,_=!W.title&&(!!K||!!B),F=W.meta||[],V=new Set(F.map((N)=>a1(N)).filter(Boolean)),O={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!V.has(a1(N))),...F],link:[...q.link||[],...W.link||[]],script:[...q.script||[],...W.script||[]],headRaw:[q.headRaw,z].filter(Boolean).join(`
|
|
3623
3623
|
`),...W.htmlAttrs&&{htmlAttrs:m9(q.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...W.bodyAttrs}}},L=t3(G);if(G=i9(G,O,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)G=p9(G,q),G=l9(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],T=a8(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
|
|
3624
3624
|
<meta name="stx-layout" content="${n8(N)}">
|
|
3625
|
-
<meta name="stx-layout-group" content="${n8(T)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?G1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=u1(G,(T,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=c9(G);let q=J.app?.colorMode;if(q)G=x9(G,q);G=h9(G),G=OG(G)}if(Q)try{let{getStoreScript:q}=await o("stx/store-loader",()=>import("./chunk-
|
|
3626
|
-
`+z+G.slice(K.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await o("stx/framework-composables",()=>import("./chunk-
|
|
3627
|
-
`+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-
|
|
3625
|
+
<meta name="stx-layout-group" content="${n8(T)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?G1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=u1(G,(T,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=c9(G);let q=J.app?.colorMode;if(q)G=x9(G,q);G=h9(G),G=OG(G)}if(Q)try{let{getStoreScript:q}=await o("stx/store-loader",()=>import("./chunk-qmtr6msv.js")),U=J.storesDir,W=await q(U);if(W){let z=`<script data-stx-stores>${W}</script>`,K=q5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
|
|
3626
|
+
`+z+G.slice(K.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await o("stx/framework-composables",()=>import("./chunk-r1kxctv6.js")),U=await q(G);if(U){let W=q5(G,"data-stx-stores")||q5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
|
|
3627
|
+
`+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-0ve08c39.js")),U=J.composablesDir,W=await q(U,G);if(W){let z=`<script data-stx-composables>${W}</script>`,K=q5(G,"data-stx-stores")||q5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
|
|
3628
3628
|
`+z+G.slice(K.end)}}catch{}if(Q)G=g9(G);if(Q&&Z.__stx_inject_css!==!1)G=await t8(G,void 0,J.buildMode==="serve");if(Q)G=f9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof t5)throw G;let q=G instanceof Error?G.message:String(G),U=new D1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(l0.log(U,{filePath:X,context:Z}),W3.logDetailedError(U,{filePath:X,template:$.substring(0,500)}),J.debug)throw U;return q3.createFallbackContent("Template Processing",U)}}async function FG($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!T0.isAbsolute(J.partialsDir)?T0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!T0.isAbsolute(J.componentsDir)?T0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!T0.isAbsolute(J.layoutsDir)?T0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,U=$;await RG(X,Z),wG(Z,q),U=await c1(()=>L9(U,Z,X,q),U,(L)=>{l0.log(L,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${L.message}`)}),U=U.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=n0(U,z5,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);U=W.output;let z=W.tokens,K=(L)=>z.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>z[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";U=U.replace(/@@/g,H),U=U.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),U=I9(U),U=await m8(U,X,Y);let B={};U=m3(U,B);let j={...Z.__sections||{}},_="",F=I7(T7($)),V=/@nolayout\b/.test(U)||F===!1;if(/@nolayout\b/.test(U))U=U.replace(/@nolayout\b\s*/g,"");let O=U.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],U=U.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(_=F,!/@section\s*\(/.test(U))U=`@section('content')
|
|
3629
3629
|
${U.trim()}
|
|
3630
3630
|
@endsection`}if(!_&&!V&&q.defaultLayout){let L=a3(U),w=/@section\s*\(/.test(U);if(!L||w){let R="",D=T0.dirname(X),N=q.layoutsDir?T0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let A=T0.join(D,"_layout.stx");if(await a(A)){R=A;break}let M=T0.dirname(D);if(M===D||M.length<N.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let T=T0.isAbsolute(q.layoutsDir)?q.layoutsDir:T0.resolve(process.cwd(),q.layoutsDir),A=T0.join(T,`${q.defaultLayout}.stx`);if(await a(A))_=A}if(_&&!w)U=`@section('content')
|
|
@@ -3632,7 +3632,7 @@ ${U.trim()}
|
|
|
3632
3632
|
@endsection`}}if(U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return j[w]=R,""}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=t(R.trim(),Z);if(D===void 0)return L;return j[w]=String(D??""),""}catch{return L}}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))j[w]=R.replace("@parent",S1);else j[w]=R.trim();return""}),Z.__sections=j,U=U.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return j[w]||R||""}),!("slot"in Z)||Z.slot===void 0)U=U.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(U=l3(U,B),_){let L=[],w=s0(U),R=n0(w.output,f1,(D,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(U=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,N,T)=>{let A=N==="SCRIPT"?w.scripts[Number(T)]:R.tokens[Number(T)];if(A)L.push(A);return""}),L.length>0){let D=L.join(`
|
|
3633
3633
|
`);j.content=j.content?`${j.content}
|
|
3634
3634
|
${D}`:D,Z.__sections=j}}if(_)try{let L;if(T0.isAbsolute(_))L=_,Y.add(_);else L=await c1(()=>Z$(_,X,G,Y),null,()=>{throw new D1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!L){let A=(I)=>{if(!I)return[];try{let y=T0.isAbsolute(I)?I:T0.resolve(process.cwd(),I);return _G.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...A(G.layoutsDir),...A(G.fallbackLayoutsDir)].filter((I,y,E)=>E.indexOf(I)===y).sort(),k=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(l0.log(Error(k),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${k}`),G.debug)throw new D1(k,X);return U}let w=await c1(()=>Bun.file(L).text(),"",()=>{throw new D1(`Failed to read layout file: ${L}`,X,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${L}`);let A={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return A[E]=b.trim(),""});for(let[y,E]of Object.entries(A))if(j[y]&&j[y].includes(S1)){let b=j[y].indexOf(S1);j[y]=j[y].slice(0,b)+E+j[y].slice(b+S1.length)}else if(!j[y])j[y]=E;let k={...Z,__sections:j},I=`@layout('${R[1]}')${M}`;return await I4(I,k,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=m3(D,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(A,M,k)=>{return T[M]=k.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(A,M,k)=>{if(j[M]){let I=j[M];if(I.includes(S1)){let y=T[M]||"",E=I.indexOf(S1);I=I.slice(0,E)+y+I.slice(E+S1.length)}return I}return k||""}),N=LG(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=l3(N,B),Z.__originalFilePath=X,U=await o8(N,Z,L,G,Y),U=`<!-- stx-layout: ${_} -->
|
|
3635
|
-
${U}`,K(U)}catch(L){return l0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return K(await o8(U,Z,X,G,Y))}function LG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function wG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function RG($,Z){await c1(()=>D9($,Z),void 0,(X)=>{l0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function DG($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await o("stx/variable-extractor",()=>import("./chunk-
|
|
3635
|
+
${U}`,K(U)}catch(L){return l0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return K(await o8(U,Z,X,G,Y))}function LG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function wG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function RG($,Z){await c1(()=>D9($,Z),void 0,(X)=>{l0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function DG($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await o("stx/variable-extractor",()=>import("./chunk-75ysdbke.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));l0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function NG($,Z,X){try{let{interpolateScriptsInTemplate:J}=await o("stx/expressions",()=>import("./chunk-8z2w0053.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return l0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function o8($,Z,X,J,Y){let Q=$,G=J;if(await DG(Q,Z,X),Q=await NG(Q,Z,X),Q=await G9(Q,Z,X),Q=await q9(Q,Z,X),Q=await l6(Q,Z,X,G),Q1(Q))Q=W8(Q,Z),Q=H8(Q,Z);Q=K8(Q);let{processStreamDirectives:q}=await o("stx/streaming",()=>import("./chunk-en1q9d6s.js"));Q=q(Q,Z),Q=j9(Q,Z,X,G),Q=await y9(Q,Z,X,G,Y),Q=await D4(Q,Z,X,G,Y),Q=M7(Q,Z,X,G);let{processDeferDirectives:U}=await o("stx/defer",()=>import("./chunk-m8hggrdc.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await o("stx/teleport",()=>import("./chunk-gyga6sjp.js"));Q=W(Q,Z,X);let{processTransitionDirectives:z,processTransitionAttributes:K}=await o("stx/transitions",()=>import("./chunk-6vqb54c8.js"));Q=z(Q,Z,X),Q=K(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-c59rkxwf.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await o("stx/suspense",()=>import("./chunk-chsfdfqm.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await o("stx/async-components",()=>import("./chunk-xr1758xj.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await o("stx/keep-alive",()=>import("./chunk-b3f5dwzz.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:F,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await o("stx/virtual-scrolling",()=>import("./chunk-gpt6ggxj.js"));Q=F(Q,Z,X),Q=V(Q,Z,X),Q=O(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-jq375v8t.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await o("stx/computed",()=>import("./chunk-gg2en16q.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await o("stx/forms-validation",()=>import("./chunk-95mj2e8x.js"));Q=N(Q,Z,X);let{processHeadDirective:T,processTitleDirective:A,processMetaDirective:M,resetHead:k}=await o("stx/head",()=>import("./chunk-nteg247p.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let I=T(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
|
|
3636
3636
|
`;if(Q=A(Q,Z),Q=M(Q,Z),Q=R9(Q),Q=D3(Q,Z),Q=m6(Q),Q=O9(Q),Q=await d3(Q,Z,X,G,Y),Q=await D4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=i4(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=M4(Q),Q=$1(Q,Z,X),Q=E7(Q,Z,{filePath:X,buildMode:G.buildMode}),Q=N3(Q,Z),Q=A3(Q,Z),Q=N5(Q,Z),Q=y3(Q,Z),Q=S3(Q,Z),Q=await E6(Q,Z,X,G),Q=await f7(Q,Z,X),Q=await $9(Q,Z,X,G),Q=r8(Q,Z,X,G),Q=j6(Q,Z,X,G),Q=_6(Q,Z,X),Q=V6(Q,Z,X,G),Q=u6(Q,Z,X,G),Q=N4(Q,Z),Q=A4(Q),Q=l8(Q),!G.skipEventDirectives)Q=m4(Q,Z,X);if(Q=S7(Q,Z,X),G.debug){let i=/\bx-data\s*=/.test(Q),Z0=Q4($);if(i&&Z0)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3637
3637
|
Both work on the same page, but they manage separate scopes.
|
|
3638
3638
|
Prefer signals (state/derived/effect) for new components.`)}Q=M9(Q,Z),Q=await F1(Q,Z,X),Q=p8(Q),Q=i8(Q),Q=O7(Q);let{processXElementDirectives:y}=await o("stx/x-element",()=>import("./chunk-3fa6t4fw.js"));Q=y(Q);let E=Z.__originalFilePath||X,b=k$(Z);if(Q=await B8(Q,G,E,b),Q=n6(Q,Z),Q=await w9(Q,Z,X,G),G.media?.image?.autoSiblings){let i=G.publicDir||"public",{rewriteImagesWithSiblings:Z0}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-14cps421.js"));Q=await Z0(Q,{publicDir:i})}if(G.seo?.enabled)Q=O6(Q,Z,G);let C=(i,Z0,Y0=!0)=>{if(!Z0)return i;let A0=Z0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),O0=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(A0&&O0){if(Y0)i=i.replace(O0[0],A0[0]);if(Z0=Z0.replace(A0[0],"").trim(),!Z0)return i}if(/<\/head>/i.test(i))return i.replace(/<\/head>/i,`${Z0}
|
|
@@ -3646,7 +3646,7 @@ ${j7()}
|
|
|
3646
3646
|
`+j1}else Q=Q.replace("</head>",`${Z0}
|
|
3647
3647
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3648
3648
|
${Z0}`);else Q=Z0+`
|
|
3649
|
-
`+Q}{let{scanScriptTags:i}=await o("stx/signal-processing",()=>import("./chunk-
|
|
3649
|
+
`+Q}{let{scanScriptTags:i}=await o("stx/signal-processing",()=>import("./chunk-35dxrg9z.js")),Z0=[];for(let Y0 of i(Q)){if(!/\bserver\b/i.test(Y0.attrs))continue;let A0=Y0.start+Y0.fullMatch.indexOf(">")+1,O0=VG(Q,A0);if(O0===-1)continue;let i0=O0+9;while(i0<Q.length&&/\s/.test(Q[i0]))i0++;Z0.push({start:Y0.start,end:i0})}for(let Y0=Z0.length-1;Y0>=0;Y0--){let{start:A0,end:O0}=Z0[Y0];Q=Q.substring(0,A0)+Q.substring(O0)}}let y0=_$(Q,X);if(y0.hasScoped)Q=y0.html;let X0=Z.__stx_event_bindings||[],J0=!1,N0=[],z0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:W5}=await o("stx/signal-processing",()=>import("./chunk-35dxrg9z.js"));for(let i of W5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))N0.push({match:i.fullMatch,attrs:i.attrs,content:i.body});for(let{match:i,attrs:Z0,content:Y0}of N0){J0=!0;let A0=Y0;T4(Y0,X,J.strict,Z.__originalFilePath);let O0=await E$(Y0,{eventBindings:X0,attrs:Z0,hasColonDirectives:z0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(i,()=>O0)}if(J0)Z.__stx_event_bindings=[];if(!J0&&Z.__stxProcessingDepth===1){let i=Z.__stx_event_bindings||[];if(i.length>0){let Z0=P$(i);if(Z0){let Y0=Q.lastIndexOf("</body>");Q=Y0===-1?Q+Z0:Q.slice(0,Y0)+Z0+`
|
|
3650
3650
|
`+Q.slice(Y0)}Z.__stx_event_bindings=[]}}if(!t9(Q)&&e9(Q))Q=await L$(Q,G);if(Q=$8(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=h6(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"}],MG=[{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')"}],TG=[{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 IG($){let Z=[],X=[];return kG($,Z),EG($,Z,X),bG($,X),yG($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function kG($,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 EG($,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 U=new RegExp(J.altClose,"g");q+=($.match(U)||[]).length}if(G>q)Z.push({type:"directive",message:`Unclosed @${J.name} directive: found ${G} opening and ${q} closing`,suggestion:`Add ${G-q} missing ${J.close} tag(s)`});else if(q>G)X.push({type:"directive",message:`Extra ${J.close} found: ${q-G} more closing than opening`,suggestion:`Check for orphaned ${J.close} tags`})}}function bG($,Z){for(let X of MG)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function yG($,Z){for(let X of TG)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function SG($,Z){let X=$.slice(0,Z).split(`
|
|
3651
3651
|
`);return{line:X.length,column:X[X.length-1].length+1}}function CG($,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 PG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function vG($){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 r0 from"path";import U5 from"process";var U2=["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"],Z2=new Set(U2),fG=new Set(["props","$props","defineProps"]),xG=new Set(["stx","@stacksjs/stx"]);function gG($){let Z=[],X=0,J=$.split(`
|
|
3652
3652
|
`);for(let Y of J){let Q=X,G=null,q=!1;for(let U=0;U<Y.length;U++){let W=Y[U];if(q){q=!1;continue}if(W==="\\"){q=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&U+1<Y.length&&Y[U+1]==="/")break;if(W==="{")X++;else if(W==="}")X--}if(Q===0){let U=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(U)Z.push(U[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let W=Y.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let K=W[1].slice(1,-1).split(",").map((H)=>{let B=H.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...K)}}}}return[...new Set(Z)]}function hG($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function X(J){if(!J.includes(":"))return J;let Y=[],Q="",G=0,q=0,U=null;for(let W=0;W<J.length;W++){let z=J[W];if(U){if(Q+=z,z===U)U=null;continue}if(z==='"'||z==="'"||z==="`"){U=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")q++;else if(z===")")q--;if(z===","&&G===0&&q===0){Y.push(Q),Q="";continue}Q+=z}if(Q)Y.push(Q);return Y.map((W)=>{let z=W.trim(),K=z.startsWith("..."),H=K?z.slice(3):z,B=-1,j=0;for(let R=0;R<H.length;R++)if(H[R]==="<")j++;else if(H[R]===">")j--;else if(H[R]===":"&&j===0){B=R;break}if(B===-1)return W;let F=H.substring(0,B).trim().replace(/\?$/,""),V=H.substring(B+1),O=-1,L=0;for(let R=0;R<V.length;R++)if(V[R]==="<")L++;else if(V[R]===">")L--;else if(V[R]==="="&&L===0){O=R;break}let w=K?"...":"";if(O!==-1)return`${w}${F} = ${V.substring(O+1).trim()}`;return`${w}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,Q)=>{if(!Q.includes(":"))return J;return`${Y}(${X(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,q=1,U=G+1,W=0,z=null;while(U<Z.length&&q>0){let B=Z[U];if(z){if(B===z)z=null;U++;continue}if(B==='"'||B==="'"||B==="`"){z=B,U++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")q++;else if(B===")")q--}if(q>0)U++}if(q!==0)continue;let K=Z.substring(G+1,U);if(!K.includes(":"))continue;let H=X(K);Q.push({start:G+1,end:U,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:q,end:U,replacement:W}=Q[G];Z=Z.substring(0,q)+W+Z.substring(U)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.split(",").map((G)=>{let[q,...U]=G.split("="),W=q.split(":")[0].trim();if(U.length>0)return`${W} = ${U.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
@@ -3668,11 +3668,11 @@ ${$[W]}`,W++;else break}return U=U.trim().replace(/;$/,""),{type:Q,name:G,value:
|
|
|
3668
3668
|
${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
|
|
3669
3669
|
${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function oG($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=B2(J);if(Q!==-1){if(B0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
|
|
3670
3670
|
${G}`,Y++}return{functionCode:J,nextIndex:Y}}function G2($,Z){let X=t($,Z)??t(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...U5.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 rG($,Z,X){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,q]=Q;try{let U=q.trim().replace(/;$/,""),W=G2(U,Z);if(W!==void 0)Z[G]=W}catch(U){console.warn(`Failed to parse export ${G} in fallback:`,U)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,q]=Q;if(!(G in Z))try{let U=q.trim().replace(/;$/,""),W=G2(U,Z);if(W!==void 0)Z[G]=W}catch{}}}function aG($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:J}}function tG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var y5=new L1(500),y$=new L1(1000),b4=new L1(2000);function $q($){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 j2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Zq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function T1($){return!Zq($)}var b$=new Map;function E4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=b$.get(Z);if(X)return X;if(b$.size>=16)b$.clear();let J=new Bun.Transpiler($);return b$.set(Z,J),J}function I1($){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=E4({loader:"ts",target:"browser",define:Q5()}).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 Xq($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(z)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===z){Y++;return}Y++}},q=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let z=1;while(Y<Q&&z>0)if($[Y]==="{")z++,Y++;else if($[Y]==="}")z--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")q();else Y++;continue}Y++}},U=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
|
|
3671
|
-
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let z=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((_)=>{let F=_.trim().split(":");return F[F.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let K=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let j=K[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(U())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return Z}function Jq($){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 Yq($){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 Qq($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let U=$[J];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let U of Jq(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let z=Yq(W);if(z===-1)continue;let K=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if(Z[K]!==void 0)continue;let H=W.slice(z+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[K]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function T$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(F)=>F.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(F)=>F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let F of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(F))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],z=typeof Y.root==="string"?g.resolve(Y.root):void 0,K=z??g.dirname(J),H=[],B=(F)=>{if(F&&!H.includes(F))H.push(F)},j=X.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));if(B(Z),B(Y._rootComponentsDir),B(g.join(g.dirname(J),"components")),B(Y.componentsDir),z)B(g.resolve(z,"resources/views/components")),B(g.resolve(z,"resources/components")),B(g.resolve(z,"src/components")),B(g.resolve(z,"components"));let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let F of _)B(typeof F==="string"?F:null);if(B(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return a(g.resolve(g.dirname(J),`${Q}.stx`));for(let F of H){let V=g.isAbsolute(F)?F:g.resolve(K,F);for(let O of W)if(await a(g.join(V,O)))return!0}return!1}function Gq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function qq($){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 Uq($){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 E1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-
|
|
3671
|
+
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let z=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((_)=>{let F=_.trim().split(":");return F[F.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let K=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let j=K[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(U())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return Z}function Jq($){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 Yq($){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 Qq($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let U=$[J];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let U of Jq(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let z=Yq(W);if(z===-1)continue;let K=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if(Z[K]!==void 0)continue;let H=W.slice(z+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[K]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function T$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(F)=>F.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(F)=>F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let F of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(F))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],z=typeof Y.root==="string"?g.resolve(Y.root):void 0,K=z??g.dirname(J),H=[],B=(F)=>{if(F&&!H.includes(F))H.push(F)},j=X.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));if(B(Z),B(Y._rootComponentsDir),B(g.join(g.dirname(J),"components")),B(Y.componentsDir),z)B(g.resolve(z,"resources/views/components")),B(g.resolve(z,"resources/components")),B(g.resolve(z,"src/components")),B(g.resolve(z,"components"));let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let F of _)B(typeof F==="string"?F:null);if(B(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return a(g.resolve(g.dirname(J),`${Q}.stx`));for(let F of H){let V=g.isAbsolute(F)?F:g.resolve(K,F);for(let O of W)if(await a(g.join(V,O)))return!0}return!1}function Gq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function qq($){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 Uq($){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 E1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-75ysdbke.js")),z=q??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let K=new Set(z);K.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=H&&H!=="load"&&Gq(H)?H:"";try{let j=(P)=>P.split("-").map((u)=>u.charAt(0).toUpperCase()+u.slice(1)).join(""),_=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=Y.__importedComponents;if(O){let P=[F,F.toLowerCase(),j(F),_(F)];for(let u of P)if(O.has(u)){V=O.get(u);break}}let L=[];if(!V){let P=[`${F}.stx`,`${j(F)}.stx`,`${_(F)}.stx`],u=[...new Set(P)],Q0=Y.__originalFilePath,r=[];if(Q0){let U0=g.join(g.dirname(Q0),"components");r.push(U0)}if(J)r.push(J);let F0=G._rootComponentsDir;if(typeof F0==="string"&&!r.includes(F0))r.push(F0);let L0=g.join(g.dirname(Q),"components");if(!r.includes(L0))r.push(L0);if(G.componentsDir&&G.componentsDir!==J&&!r.includes(G.componentsDir))r.push(G.componentsDir);let v0=typeof G.root==="string"?g.resolve(G.root):void 0,a0=v0??g.dirname(Q),H0=[];if(v0)H0.push(g.resolve(v0,"resources/views/components")),H0.push(g.resolve(v0,"resources/components")),H0.push(g.resolve(v0,"src/components")),H0.push(g.resolve(v0,"components"));H0.push(g.resolve(import.meta.dir,"components"));for(let U0 of H0)if(!r.includes(U0))r.push(U0);let P1=G._pluginComponentDirs;if(Array.isArray(P1)){for(let U0 of P1)if(typeof U0==="string"&&!r.includes(U0))r.push(U0)}if(G.fallbackComponentsDir&&!r.includes(G.fallbackComponentsDir))r.push(G.fallbackComponentsDir);let _1=[...new Set(r.map((U0)=>{if(!U0)return U0;return g.isAbsolute(U0)?U0:g.resolve(a0,U0)}))];r.length=0,r.push(..._1);let s=`${F}\x00${Q}\x00${_1.join("\x00")}`,u0=y$.get(s);if(u0)if(await a(u0))V=u0;else y$.delete(s);if(!V&&(F.startsWith("./")||F.startsWith("../")))V=g.resolve(g.dirname(Q),`${F}.stx`),L.push(V);else if(!V)for(let U0 of r){if(!U0)continue;for(let V1 of u){let O1=g.join(U0,V1);if(L.push(O1),await a(O1)){V=O1;break}}if(V)break;if(!V)try{let V1=await import("fs");if(!V1.statSync(U0,{throwIfNoEntry:!1})?.isDirectory())continue;let C5=8,v1=[{path:U0,depth:0}];while(v1.length>0&&!V){let J1=v1.pop();if(J1.depth>=C5)continue;let P4;try{P4=V1.readdirSync(J1.path,{withFileTypes:!0})}catch{continue}for(let P5 of P4){if(!P5.isDirectory())continue;if(P5.name==="node_modules"||P5.name.startsWith("."))continue;let v4=g.join(J1.path,P5.name);for(let M2 of u){let S$=g.join(v4,M2);if(L.push(S$),await a(S$)){V=S$;break}}if(V)break;v1.push({path:v4,depth:J1.depth+1})}}}catch{}if(V)break}if(V)y$.set(s,V)}if(!V||!await a(V)){let P=L.length>0?`
|
|
3672
3672
|
Searched paths:
|
|
3673
3673
|
${L.map((u)=>` - ${u}`).join(`
|
|
3674
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.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(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",v5,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[P,u]of Object.entries(Y))if(!P.startsWith("__")||R.has(P))D[P]=u;let N=X;if(X.includes("@include")){let{processIncludes:P}=await o("stx/includes",()=>import("./chunk-
|
|
3675
|
-
`)}`}if(X&&z0.includes("{{ text || slot }}"))z0=z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:W5}=await o("stx/slots",()=>import("./chunk-
|
|
3674
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.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(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",v5,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[P,u]of Object.entries(Y))if(!P.startsWith("__")||R.has(P))D[P]=u;let N=X;if(X.includes("@include")){let{processIncludes:P}=await o("stx/includes",()=>import("./chunk-91hdna71.js"));N=await P(X,Y,Q,G,U)}let T=s0(N),A=[],M=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let Q0=T.scripts[Number(u)]||"",r=Q0.match(/^<script\b([^>]*)>/i)?.[1]||"",F0=r.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),L0=!F0||["module","text/javascript","application/javascript"].includes(F0);if(!/\bserver\b/i.test(r)&&L0)return A.push(Q0),"";return Q0}),{extractSlotContent:k}=await o("stx/slots",()=>import("./chunk-mmew9zcf.js")),I=k(M),y={};if(I.defaultSlot?.trim())y.default=I.defaultSlot;for(let[P,u]of I.namedSlots)y[P]=u.content;let E={...D,...Z,props:Z,slot:M,$slots:y,__processedComponents:K,__sections:{},__stx_signals_gate:Q1(w)||qq(X)};Qq(w,E);let b=w,C=z$(b);if(C)b=C.content.trim();let h=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...w.matchAll(h)],l=[],d=x.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&x.every((P)=>/\bserver\b/.test(P[1]||"")),_0=null,h0=null;if(d){let P=$q({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){_0=`${V}\x00${P}`;let u=b4.get(_0);if(u){for(let Q0 of u.dependencies)U.add(Q0);return u.output}h0=new Set(U)}}for(let P of x){let u=P[1]||"",Q0=P[2]||"",r=u.includes("server");if(T1(u)&&Q0.trim())Q0=I1(Q0);if(r&&Q0)try{await W(Q0,E,V)}catch(L0){}if(!r){let L0=Q0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),v0=L0.includes("{{")&&L0.includes("}}"),a0=L0.includes("{!!")&&L0.includes("!!}");if(v0||a0)L0=x$(L0,E);let H0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");l.push(`<script${H0}>${L0}</script>`)}}let D0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),y0=D0?D0[1]:"",X0=D0?D0[2]:"",J0="",N0=y0&&/\bscoped\b/i.test(y0);if(D0)J0=`<style${y0}>${X0}</style>`;let z0=b;if(z0=z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D0)z0=z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(z0=z0.replace(P,(Q0,r)=>{let F0=r.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(F0)u.push(`<style${F0[1]}>${F0[2]}</style>`);return""}),z0=z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)J0=`${J0}${u.join(`
|
|
3675
|
+
`)}`}if(X&&z0.includes("{{ text || slot }}"))z0=z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:W5}=await o("stx/slots",()=>import("./chunk-mmew9zcf.js")),{defaultSlot:i,namedSlots:Z0}=I;z0=await W5(z0,i,Z0,E);let Y0=l.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),A0=Uq(l),O0=Array.isArray(E.__stx_client_signal_names)?E.__stx_client_signal_names:[];if(A0.length>0||O0.length>0)E.__stx_client_signal_names=[...new Set([...O0,...A0])];let i0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:Y0||l.length===0,defaultLayout:void 0};E.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let j1=await I4(z0,E,V,i0,U),S=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let P of j1.matchAll(/\{\{([\s\S]*?)\}\}/g))S.add(P[1].trim());if(S.size>0)Y.__stx_preserved_client_expressions=[...S];let v=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},n=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++v.n}_${v.key}`,m=j1;if(Y0){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${j2(JSON.stringify(Z))}"`}catch{}let u=B?` stx-hydrate="${j2(B)}"`:"";m=`<div data-stx-scope="${n}"${P}${u}>${j1}</div>`;let Q0=await Promise.all(l.map(async(r)=>{let F0=r.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!F0)return r;let[,L0,v0]=F0,a0=S4(v0,{filePath:V,projectRoot:process.cwd()}),H0=a0.code,P1=C4(a0.styles);H0=e1(H0).code;let{hasUserImports:_1,bundleClientScript:s}=await o("stx/client-script-bundler",()=>import("./chunk-629d0529.js"));if(_1(H0))H0=await s(H0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{stripStxRuntimeImports:u0}=await o("stx/signal-processing",()=>import("./chunk-35dxrg9z.js"));H0=u0(H0);let U0=t0(H0),V1=Xq(U0),O1=`function(__scopeId) {
|
|
3676
3676
|
${s1("const",[..._2,...V1],U0)}
|
|
3677
3677
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3678
3678
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -3794,7 +3794,7 @@ else {
|
|
|
3794
3794
|
// STX: auto-generated event bindings
|
|
3795
3795
|
${$.map((X,J)=>Iq(X,J)).join(`
|
|
3796
3796
|
`)}`}function L2($){let Z=[],X=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=J.length,G=0;while(G<Q){let q=J[G];if(q==="'"||q==='"'||q==="`"){let U=q;if(G++,U==="`"){let W=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&W===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){W++,G+=2;continue}if(J[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===U){G++;break}G++}continue}if(q==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
|
|
3797
|
-
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let z=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=z[0].length;continue}let K=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}}G++}return Z}var Eq=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 bq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!Eq.has(j))Z.add(j)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=K.exec($))!==null)J(Q[1]);return Z}async function E$($,Z={}){let X=$,J="",Y=!1,Q=[],G=S4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=C4(G.styles),U=e1(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:z}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
3797
|
+
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let z=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=z[0].length;continue}let K=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}}G++}return Z}var Eq=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 bq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!Eq.has(j))Z.add(j)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=K.exec($))!==null)J(Q[1]);return Z}async function E$($,Z={}){let X=$,J="",Y=!1,Q=[],G=S4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=C4(G.styles),U=e1(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:z}=await o("stx/client-script-bundler",()=>import("./chunk-629d0529.js"));if(W(X))X=await z(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let O=N2(X);X=O.code,J=A2(O.stxImports,O.browserImports.filter((L)=>!Q.includes(L)))}if(J=`${Y4(X,Z.serverData)}${J}`,X=t0(X),!Y&&T1(Z.attrs||""))X=I1(X);let K=kq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let O=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${q}<script ${L}>
|
|
3798
3798
|
${t1(`${J}${X}
|
|
3799
3799
|
${K}`)}
|
|
3800
3800
|
</script>`}let j=R2($),_=/function __stx_setup_/.test(X),F=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(O){let L=O.length>0?`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ej as a,fj as b,gj as c,hj as d,ij as e,jj as f,kj as g,lj as h,mj as i,nj as j,oj as k,pj as l,qj as m,rj as n}from"./chunk-
|
|
2
|
+
import{ej as a,fj as b,gj as c,hj as d,ij as e,jj as f,kj as g,lj as h,mj as i,nj as j,oj as k,pj as l,qj as m,rj as n}from"./chunk-pas7f178.js";import"./chunk-dv8mbh0j.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import"./chunk-g8tce9rr.js";import"./chunk-0eeymffm.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import"./chunk-0y6f4037.js";export{i as streamingSuspenseDirective,m as streamToResponse,g as streamTemplateSimple,a as streamTemplate,d as renderStreamingPage,k as registerStreamingDirectives,e as processStreamDirectives,l as processSectionDirectives,j as islandDirective,n as generateHydrationRuntime,f as extractStreamBoundaries,h as createStreamRenderer,b as buildSuspenseResolveScript,c as SUSPENSE_RESOLVER_RUNTIME};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Wq as q,_q as y}from"./chunk-
|
|
2
|
+
import{Wq as q,_q as y}from"./chunk-dv8mbh0j.js";import{Su as L}from"./chunk-0y6f4037.js";import M from"fs";import X from"path";var T=new Map,Q=new Map;async function A(j){let z;for(let K=0;K<3;K++)try{let V=(await M.promises.stat(j)).mtime.getTime(),J=Q.get(j);if(J&&J.mtime===V)return J.content;let W=await Bun.file(j).text(),U=(await M.promises.stat(j)).mtime.getTime();if(U!==V)continue;return Q.set(j,{content:W,mtime:U}),W}catch(I){z=I;break}throw Q.delete(j),Error(`File not found: ${j}${z?` (${z.message})`:""}`)}function H(j){Q.delete(j)}function v(j){for(let B of Q.keys())if(B.startsWith(j))Q.delete(B)}var Z=null,b=null,N=null;function E(j){N=j}async function F(j=!1){let B=N??await import("./chunk-x7pp10qb.js");if(j)return B.generateSignalsRuntimeDev();if(Z===null)Z=B.generateSignalsRuntime();return Z}var $=null;async function R(){if($===null){let{getRouterScript:j}=await import("./chunk-10tcqry1.js");$=j()}return $}function S(){Q.clear(),y(),Z=null,b=null,$=null}function k(j){let B={debug:j.debug===!0,middleware:(j.middleware??[]).map((z)=>({name:z.name,timing:z.timing,handler:String(z.handler)})),customDirectives:(j.customDirectives??[]).map((z)=>({name:z.name,hasEndTag:z.hasEndTag===!0,handler:String(z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(B)).digest("hex")}async function _(j,B){try{if(!B.cachePath)return null;let z=X.resolve(B.cachePath),K=X.join(z,`${D(j)}.html`),I=X.join(z,`${D(j)}.meta.json`);if(!await q(K)||!await q(I))return null;let V=await Bun.file(I).text(),J=JSON.parse(V);if(J.cacheVersion!==B.cacheVersion)return null;if(J.optionsSignature!==k(B))return null;if((await M.promises.stat(j)).mtime.getTime()>J.mtime)return null;for(let Y of J.dependencies)if(await q(Y)){if((await M.promises.stat(Y)).mtime.getTime()>J.mtime)return null}else return null;return await Bun.file(K).text()}catch(z){return console.warn(`Cache error for ${j}:`,z),null}}async function g(j,B,z,K){try{if(!K.cachePath)return;let I=X.resolve(K.cachePath);await M.promises.mkdir(I,{recursive:!0});let V=X.join(I,`${D(j)}.html`),J=X.join(I,`${D(j)}.meta.json`),W=await M.promises.stat(j);await Bun.write(V,B);let Y={sourcePath:j,mtime:W.mtime.getTime(),dependencies:Array.from(z),cacheVersion:K.cacheVersion,optionsSignature:k(K),generatedAt:Date.now()};await Bun.write(J,JSON.stringify(Y,null,2)),T.set(j,{output:B,mtime:W.mtime.getTime(),dependencies:z})}catch(I){console.warn(`Failed to cache template ${j}:`,I)}}var G=16;function D(j){return new Bun.CryptoHasher("sha1").update(j).digest("hex").substring(0,G)}
|
|
3
3
|
export{T as Oj,A as Pj,H as Qj,v as Rj,E as Sj,F as Tj,R as Uj,S as Vj,_ as Wj,g as Xj,D as Yj};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Mf as a}from"./chunk-
|
|
2
|
+
import{Mf as a}from"./chunk-m7de5pqz.js";import"./chunk-0jqtsexq.js";import"./chunk-qym9n5hg.js";import"./chunk-ph5f8eev.js";import"./chunk-w95sp0k9.js";import"./chunk-58f0mthg.js";import"./chunk-dv8mbh0j.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import"./chunk-g8tce9rr.js";import"./chunk-0eeymffm.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import"./chunk-0y6f4037.js";export{a as buildForProduction};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a as x,b as u,c as b,d as Az,e as G,f as d,h as y,i as I,j as Uz,k as v}from"./chunk-0y46fbkx.js";import{l as h,m as f,n as g}from"./chunk-q9n5swx7.js";import{vp as V}from"./chunk-
|
|
2
|
+
import{a as x,b as u,c as b,d as Az,e as G,f as d,h as y,i as I,j as Uz,k as v}from"./chunk-0y46fbkx.js";import{l as h,m as f,n as g}from"./chunk-q9n5swx7.js";import{vp as V}from"./chunk-dv8mbh0j.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import"./chunk-g8tce9rr.js";import"./chunk-0eeymffm.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import{Su as F}from"./chunk-0y6f4037.js";import l from"fs";import R from"path";function m(z,J){let Z=[R.join(z.root,"stx.config.ts"),R.join(z.root,"stx.config.js"),R.join(z.root,"stx.config.mjs")],K=J.debounceMs??300,$=null,X=[];for(let B of Z)try{if(!l.existsSync(B))continue;let Y=l.watch(B,(W)=>{if(W==="change"){if($)clearTimeout($);$=setTimeout(async()=>{d("Config file changed, restarting...");try{await J.onChange()}catch(j){G(`Failed to restart: ${j}`)}},K)}});X.push(Y)}catch{}return{stop(){if($)clearTimeout($);for(let B of X)B.close()}}}import E from"fs";import i from"path";var Gz=".stx/story/analytics.json",Nz=1,c=1e4;class M{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(z){this.storagePath=i.join(z,Gz),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let z=E.readFileSync(this.storagePath,"utf-8");return JSON.parse(z)}catch{return{version:Nz,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let z=i.dirname(this.storagePath);if(await E.promises.mkdir(z,{recursive:!0}),this.storage.events.length>c)this.storage.events=this.storage.events.slice(-c);await E.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:Hz(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(z){this.storage.events.push({...z,timestamp:Date.now()}),this.dirty=!0}trackView(z,J){if(this.endViewTiming(z),this.viewStartTimes.set(z,Date.now()),this.track({type:"view",componentId:z,variantId:J}),this.currentSession&&!this.currentSession.componentViews.includes(z))this.currentSession.componentViews.push(z)}endViewTiming(z){let J=this.viewStartTimes.get(z);if(J){let Z=Date.now()-J;this.track({type:"view",componentId:z,metadata:{duration:Z,endView:!0}}),this.viewStartTimes.delete(z)}}trackPropChange(z,J,Z){this.track({type:"prop_change",componentId:z,propName:J,metadata:{value:Z}})}trackVariantSwitch(z,J){this.track({type:"variant_switch",componentId:z,variantId:J})}trackSearch(z,J){this.track({type:"search",query:z,metadata:{resultCount:J}})}getComponentAnalytics(z,J){let Z=this.storage.events.filter((Q)=>Q.componentId===z),K=Z.filter((Q)=>Q.type==="view"&&!Q.metadata?.endView),$=Z.filter((Q)=>Q.type==="prop_change"),X=Z.filter((Q)=>Q.type==="variant_switch"),B={};for(let Q of $)if(Q.propName)B[Q.propName]=(B[Q.propName]||0)+1;let Y={};for(let Q of X)if(Q.variantId)Y[Q.variantId]=(Y[Q.variantId]||0)+1;let W=new Set(this.storage.sessions.filter((Q)=>Q.componentViews.includes(z)).map((Q)=>Q.id)),j=Z.filter((Q)=>Q.metadata?.duration).map((Q)=>Q.metadata.duration),U=j.length>0?j.reduce((Q,D)=>Q+D,0)/j.length:0,_=Object.entries(B).sort((Q,D)=>D[1]-Q[1]).slice(0,5).map(([Q])=>Q);return{componentId:z,componentName:J,viewCount:K.length,uniqueViews:W.size,lastViewed:K[K.length-1]?.timestamp,propChanges:B,topChangedProps:_,variantViews:Y,avgTimeSpent:U}}getMostViewedComponents(z=10){let J=new Map;for(let Z of this.storage.events)if(Z.type==="view"&&Z.componentId&&!Z.metadata?.endView)J.set(Z.componentId,(J.get(Z.componentId)||0)+1);return Array.from(J.entries()).map(([Z,K])=>({componentId:Z,viewCount:K})).sort((Z,K)=>K.viewCount-Z.viewCount).slice(0,z)}getMostChangedProps(z=10){let J=new Map;for(let Z of this.storage.events)if(Z.type==="prop_change"&&Z.propName)J.set(Z.propName,(J.get(Z.propName)||0)+1);return Array.from(J.entries()).map(([Z,K])=>({propName:Z,changeCount:K})).sort((Z,K)=>K.changeCount-Z.changeCount).slice(0,z)}getSearchAnalytics(){let z=this.storage.events.filter(($)=>$.type==="search"),J=new Map,Z=0;for(let $ of z){if($.query)J.set($.query,(J.get($.query)||0)+1);if($.metadata?.resultCount!==void 0)Z+=$.metadata.resultCount}let K=Array.from(J.entries()).map(([$,X])=>({query:$,count:X})).sort(($,X)=>X.count-$.count).slice(0,10);return{totalSearches:z.length,topQueries:K,avgResultCount:z.length>0?Z/z.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function Hz(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import P from"fs";import p from"path";var Fz=".stx/story/bookmarks.json",Vz=1;class T{storage;storagePath;dirty=!1;constructor(z){this.storagePath=p.join(z,Fz),this.storage=this.loadStorage()}loadStorage(){try{let z=P.readFileSync(this.storagePath,"utf-8");return JSON.parse(z)}catch{return{version:Vz,bookmarks:[]}}}async save(){if(!this.dirty)return;let z=p.dirname(this.storagePath);await P.promises.mkdir(z,{recursive:!0}),await P.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(z,J,Z,K={}){let $={id:Rz(),name:K.name||`${z}/${J}`,storyId:z,variantId:J,props:Z,created:Date.now(),notes:K.notes,color:K.color};return this.storage.bookmarks.push($),this.dirty=!0,$}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(z){return this.storage.bookmarks.filter((J)=>J.storyId===z)}getBookmark(z){return this.storage.bookmarks.find((J)=>J.id===z)}isBookmarked(z,J){return this.storage.bookmarks.some((Z)=>Z.storyId===z&&Z.variantId===J)}updateBookmark(z,J){let Z=this.getBookmark(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deleteBookmark(z){let J=this.storage.bookmarks.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.bookmarks.splice(J,1),this.dirty=!0,!0}toggleBookmark(z,J,Z){let K=this.storage.bookmarks.find((X)=>X.storyId===z&&X.variantId===J);if(K)return this.deleteBookmark(K.id),{added:!1};return{added:!0,bookmark:this.addBookmark(z,J,Z)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(z,J=!0){let Z=JSON.parse(z),K=0;for(let $ of Z.bookmarks){if(J){let X=this.storage.bookmarks.find((B)=>B.id===$.id);if(X)Object.assign(X,$);else this.storage.bookmarks.push($)}else this.storage.bookmarks.push($);K++}if(K>0)this.dirty=!0;return K}}function Rz(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var N=new Set;function s(){return{open(z){N.add(z),z.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(z){N.delete(z)},message(z,J){}}}function q(z){let J=JSON.stringify({...z,timestamp:z.timestamp||Date.now()});for(let Z of N)try{Z.send(J)}catch{N.delete(Z)}}function n(z,J){q({type:"story-update",data:{storyId:z,...J}})}function a(z,J){q({type:"story-add",data:{storyId:z,...J}})}function o(z){q({type:"story-remove",data:{storyId:z}})}function r(z){return`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
const ws = new WebSocket('${z}');
|
|
@@ -556,7 +556,7 @@ window.__stxPerformance = {
|
|
|
556
556
|
|
|
557
557
|
window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
|
|
558
558
|
</script>
|
|
559
|
-
`}import w from"fs";import Xz from"path";var Mz=".stx/story/presets.json",C=1,Pz=10;class k{storage;storagePath;dirty=!1;constructor(z){this.storagePath=Xz.join(z,Mz),this.storage=this.loadStorage()}loadStorage(){try{let z=w.readFileSync(this.storagePath,"utf-8"),J=JSON.parse(z);if(J.version!==C)return this.migrateStorage(J);return J}catch{return{version:C,presets:[],recentIds:[]}}}migrateStorage(z){return{version:C,presets:z.presets||[],recentIds:z.recentIds||[]}}async save(){if(!this.dirty)return;let z=Xz.dirname(this.storagePath);await w.promises.mkdir(z,{recursive:!0}),await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(z,J,Z={}){let K={id:Tz(),name:z,description:Z.description,props:J,componentId:Z.componentId,created:Date.now(),usageCount:0,tags:Z.tags};return this.storage.presets.push(K),this.dirty=!0,K}getPreset(z){return this.storage.presets.find((J)=>J.id===z)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(z){return this.storage.presets.filter((J)=>!J.componentId||J.componentId===z)}getRecentPresets(){return this.storage.recentIds.map((z)=>this.getPreset(z)).filter((z)=>z!==void 0)}usePreset(z){let J=this.getPreset(z);if(!J)return;return J.lastUsed=Date.now(),J.usageCount++,this.storage.recentIds=[z,...this.storage.recentIds.filter((Z)=>Z!==z)].slice(0,Pz),this.dirty=!0,J}updatePreset(z,J){let Z=this.getPreset(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deletePreset(z){let J=this.storage.presets.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.presets.splice(J,1),this.storage.recentIds=this.storage.recentIds.filter((Z)=>Z!==z),this.dirty=!0,!0}searchPresets(z){let J=z.toLowerCase();return this.storage.presets.filter((Z)=>{if(Z.name.toLowerCase().includes(J))return!0;if(Z.description?.toLowerCase().includes(J))return!0;if(Z.tags?.some((K)=>K.toLowerCase().includes(J)))return!0;return!1})}getMostUsedPresets(z=5){return[...this.storage.presets].sort((J,Z)=>Z.usageCount-J.usageCount).slice(0,z)}exportPresets(z){let J=z?this.storage.presets.filter((Z)=>z.includes(Z.id)):this.storage.presets;return JSON.stringify({presets:J},null,2)}importPresets(z,J=!1){let Z=JSON.parse(z),K=0;for(let $ of Z.presets){let X=this.storage.presets.find((B)=>B.id===$.id);if(X&&!J)continue;if(X)Object.assign(X,$);else this.storage.presets.push($);K++}if(K>0)this.dirty=!0;return K}}function Tz(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";var Qz=new Map;async function H(z,J,Z={}){let K=performance.now(),$=[];try{let X=await S.promises.stat(J),B=Qz.get(J),Y;if(B&&B.mtime===X.mtimeMs)Y=B.content;else Y=await S.promises.readFile(J,"utf-8"),Qz.set(J,{content:Y,mtime:X.mtimeMs,analyzed:null});let{processDirectives:W}=await import("./chunk-
|
|
559
|
+
`}import w from"fs";import Xz from"path";var Mz=".stx/story/presets.json",C=1,Pz=10;class k{storage;storagePath;dirty=!1;constructor(z){this.storagePath=Xz.join(z,Mz),this.storage=this.loadStorage()}loadStorage(){try{let z=w.readFileSync(this.storagePath,"utf-8"),J=JSON.parse(z);if(J.version!==C)return this.migrateStorage(J);return J}catch{return{version:C,presets:[],recentIds:[]}}}migrateStorage(z){return{version:C,presets:z.presets||[],recentIds:z.recentIds||[]}}async save(){if(!this.dirty)return;let z=Xz.dirname(this.storagePath);await w.promises.mkdir(z,{recursive:!0}),await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(z,J,Z={}){let K={id:Tz(),name:z,description:Z.description,props:J,componentId:Z.componentId,created:Date.now(),usageCount:0,tags:Z.tags};return this.storage.presets.push(K),this.dirty=!0,K}getPreset(z){return this.storage.presets.find((J)=>J.id===z)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(z){return this.storage.presets.filter((J)=>!J.componentId||J.componentId===z)}getRecentPresets(){return this.storage.recentIds.map((z)=>this.getPreset(z)).filter((z)=>z!==void 0)}usePreset(z){let J=this.getPreset(z);if(!J)return;return J.lastUsed=Date.now(),J.usageCount++,this.storage.recentIds=[z,...this.storage.recentIds.filter((Z)=>Z!==z)].slice(0,Pz),this.dirty=!0,J}updatePreset(z,J){let Z=this.getPreset(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deletePreset(z){let J=this.storage.presets.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.presets.splice(J,1),this.storage.recentIds=this.storage.recentIds.filter((Z)=>Z!==z),this.dirty=!0,!0}searchPresets(z){let J=z.toLowerCase();return this.storage.presets.filter((Z)=>{if(Z.name.toLowerCase().includes(J))return!0;if(Z.description?.toLowerCase().includes(J))return!0;if(Z.tags?.some((K)=>K.toLowerCase().includes(J)))return!0;return!1})}getMostUsedPresets(z=5){return[...this.storage.presets].sort((J,Z)=>Z.usageCount-J.usageCount).slice(0,z)}exportPresets(z){let J=z?this.storage.presets.filter((Z)=>z.includes(Z.id)):this.storage.presets;return JSON.stringify({presets:J},null,2)}importPresets(z,J=!1){let Z=JSON.parse(z),K=0;for(let $ of Z.presets){let X=this.storage.presets.find((B)=>B.id===$.id);if(X&&!J)continue;if(X)Object.assign(X,$);else this.storage.presets.push($);K++}if(K>0)this.dirty=!0;return K}}function Tz(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";var Qz=new Map;async function H(z,J,Z={}){let K=performance.now(),$=[];try{let X=await S.promises.stat(J),B=Qz.get(J),Y;if(B&&B.mtime===X.mtimeMs)Y=B.content;else Y=await S.promises.readFile(J,"utf-8"),Qz.set(J,{content:Y,mtime:X.mtimeMs,analyzed:null});let{processDirectives:W}=await import("./chunk-c6vnw997.js"),j={},U=A(Y);if(U)try{await V(U,j,J)}catch(O){$.push(`Warning: Could not extract script variables: ${O instanceof Error?O.message:String(O)}`)}if(Z.props)Object.assign(j,Z.props);let Q=await W(Y,j,J,{},new Set),D=Wz(Y),L=A(Y);return Q=jz(Q),Q=Dz(Q,j),{html:Q,css:D,js:L,errors:$,duration:performance.now()-K}}catch(X){return $.push(X instanceof Error?X.message:String(X)),{html:`<div class="stx-render-error">${Lz($[0])}</div>`,css:"",js:"",errors:$,duration:performance.now()-K}}}async function qz(z){try{let J=await S.promises.readFile(z,"utf-8"),Z=A(J);if(!Z)return null;let K={};if(await V(Z,K,z),Array.isArray(K.variants))return K.variants;return null}catch{return null}}async function Bz(z,J,Z,K){let $=J.story?.variants;if(!$){let Y=await qz(J.path);if(Y)$=Y}if(!$&&Z==="default")return H(z,J.path,{props:K||{}});if(!$)return H(z,J.path,{props:K||{}});let X=$.find((Y)=>Y.id===Z);if(!X&&Z==="default")return H(z,J.path,{props:K||{}});if(!X)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${Z}' not found`],duration:0};let B={...X.state,...K};if(X.source)return wz(z,X.source,B);return H(z,J.path,{props:B})}async function wz(z,J,Z={}){let K=performance.now(),$=[];try{let{processDirectives:X}=await import("./chunk-c6vnw997.js"),B={...Z},Y=A(J);if(Y)try{await V(Y,B,"inline-template.stx")}catch{}let j=await X(J,B,"inline-template.stx",{},new Set);return j=jz(j),j=Dz(j,B),{html:j,css:Wz(J),js:A(J),errors:$,duration:performance.now()-K}}catch(X){return $.push(X instanceof Error?X.message:String(X)),{html:`<div class="stx-render-error">${Lz($[0])}</div>`,css:"",js:"",errors:$,duration:performance.now()-K}}}function Wz(z){let J=[],Z=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,K=Z.exec(z);while(K!==null)J.push(K[1].trim()),K=Z.exec(z);return J.join(`
|
|
560
560
|
`)}function jz(z){return z.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function A(z){let J=[],Z=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,K=Z.exec(z);while(K!==null)J.push(K[1].trim()),K=Z.exec(z);return J.join(`
|
|
561
561
|
`)}function Dz(z,J){let Z=`<script>window.__stxProps = ${JSON.stringify(J)};</script>`;return z+Z}function Lz(z){return z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}async function Oz(z,J){let Z=await I(z);f(z,Z);let K=v(z.config,Z);g(z,K),console.log(` Found ${Z.length} story files`);let $=typeof J.host==="string"?J.host:J.host===!0?"0.0.0.0":"localhost",X=new k(z.root),B=new T(z.root),Y=new M(z.root),W=s(),j=Bun.serve({port:J.port,hostname:$,fetch:async(Q,D)=>{let O=new URL(Q.url).pathname;if(O==="/__hmr"){if(D.upgrade(Q,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(O.startsWith("/api/"))return Cz(z,O,Q,{presetsManager:X,bookmarksManager:B,analyticsTracker:Y});return kz(z,O,J.port)},websocket:{open(Q){W.open(Q)},close(Q){W.close(Q)},message(Q,D){W.message(Q,D)}}}),U=`http://${$}:${J.port}`,_=Uz(z,async(Q,D)=>{console.log(` [${Q}] ${D.relativePath}`);let L=await I(z);f(z,L);let O=v(z.config,L);if(g(z,O),Q==="add")a(D.id,{fileName:D.fileName});else if(Q==="unlink")o(D.id);else n(D.id,{fileName:D.fileName})});if(J.open){let Q=U;try{let{exec:D}=await import("child_process"),L=process.platform;D(`${L==="darwin"?"open":L==="win32"?"start":"xdg-open"} ${Q}`)}catch{}}return{server:j,url:U,close:async()=>{_(),j.stop()}}}async function Cz(z,J,Z,K){let{presetsManager:$,bookmarksManager:X,analyticsTracker:B}=K;if(J==="/api/stories")return Response.json({files:z.storyFiles.map((Y)=>({id:Y.id,fileName:Y.fileName,relativePath:Y.relativePath,treePath:Y.treePath})),tree:z.tree});if(J.startsWith("/api/story/")){let Y=J.slice(11),W=z.storyFiles.find((j)=>j.id===Y);if(!W)return new Response("Story not found",{status:404});try{let j=await Bun.file(W.path).text();return Response.json({id:W.id,fileName:W.fileName,relativePath:W.relativePath,content:j})}catch{return new Response("Error reading story",{status:500})}}if(J==="/api/config")return Response.json({theme:z.config.theme,responsivePresets:z.config.responsivePresets,backgroundPresets:z.config.backgroundPresets});if(J.startsWith("/api/render/")){let Y=new URL(Z.url),W=J.slice(12).split("/"),j=W[0],U=W[1]||"default",_,Q=Y.searchParams.get("props");if(Q)try{_=JSON.parse(Q)}catch{}let D=z.storyFiles.find((L)=>L.id===j);if(!D)return new Response("Story not found",{status:404});try{let L=await Bz(z,D,U,_);return Response.json({html:L.html,css:L.css,js:L.js,errors:L.errors,duration:L.duration})}catch(L){return Response.json({html:"",css:"",js:"",errors:[L instanceof Error?L.message:String(L)],duration:0},{status:500})}}if(J==="/api/presets"&&Z.method==="GET")return Response.json({presets:$.getAllPresets()});if(J==="/api/presets"&&Z.method==="POST")try{let Y=await Z.json(),W=$.createPreset(Y.name,Y.props,{componentId:Y.componentId,description:Y.description});return await $.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J.startsWith("/api/presets/")&&!J.includes("/use")&&Z.method==="GET"){let Y=J.slice(13),W=$.getPreset(Y);if(!W)return new Response("Preset not found",{status:404});return Response.json(W)}if(J.endsWith("/use")&&Z.method==="POST"){let Y=J.slice(13,-4),W=$.usePreset(Y);if(!W)return new Response("Preset not found",{status:404});return await $.save(),Response.json(W)}if(J.startsWith("/api/presets/")&&Z.method==="DELETE"){let Y=J.slice(13);if(!$.deletePreset(Y))return new Response("Preset not found",{status:404});return await $.save(),Response.json({success:!0})}if(J==="/api/bookmarks"&&Z.method==="GET")return Response.json({bookmarks:X.getAllBookmarks()});if(J==="/api/bookmarks"&&Z.method==="POST")try{let Y=await Z.json(),W=X.addBookmark(Y.storyId,Y.variantId,Y.props,{name:Y.name,notes:Y.notes,color:Y.color});return await X.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J==="/api/bookmarks/toggle"&&Z.method==="POST")try{let Y=await Z.json(),W=X.toggleBookmark(Y.storyId,Y.variantId,Y.props);return await X.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J.startsWith("/api/bookmarks/")&&J!=="/api/bookmarks/toggle"&&Z.method==="GET"){let Y=J.slice(15),W=X.getBookmark(Y);if(!W)return new Response("Bookmark not found",{status:404});return Response.json(W)}if(J.startsWith("/api/bookmarks/")&&Z.method==="DELETE"){let Y=J.slice(15);if(!X.deleteBookmark(Y))return new Response("Bookmark not found",{status:404});return await X.save(),Response.json({success:!0})}if(J==="/api/analytics/track"&&Z.method==="POST")try{let Y=await Z.json();if(Y.type==="view"&&Y.componentId)B.trackView(Y.componentId,Y.variantId);else if(Y.type==="prop_change"&&Y.componentId&&Y.propName)B.trackPropChange(Y.componentId,Y.propName,null);else if(Y.type==="variant_switch"&&Y.componentId&&Y.variantId)B.trackVariantSwitch(Y.componentId,Y.variantId);else if(Y.type==="search"&&Y.query)B.trackSearch(Y.query,0);return await B.save(),Response.json({success:!0})}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J==="/api/analytics/summary"&&Z.method==="GET")return Response.json({mostViewed:B.getMostViewedComponents(10),mostChangedProps:B.getMostChangedProps(10),searchAnalytics:B.getSearchAnalytics()});if(J.startsWith("/api/analytics/component/")&&Z.method==="GET"){let Y=J.slice(25),W=z.storyFiles.find((U)=>U.id===Y),j=B.getComponentAnalytics(Y,W?.fileName||Y);return Response.json(j)}return new Response("Not found",{status:404})}function kz(z,J,Z){let K=Sz(z,Z);return new Response(K,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function Sz(z,J){let{theme:Z}=z.config,K=Z.title||"STX Story",$=`ws://localhost:${J}/__hmr`,X=r($);return`<!DOCTYPE html>
|
|
562
562
|
<html lang="en" class="${Z.darkClass||"dark"}">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$l as B,Hq as k,Il as A,Jl as D,Um as T,Vm as y,Zo as x,bm as F,cs as w,ep as M,vp as R}from"./chunk-
|
|
2
|
+
import{$l as B,Hq as k,Il as A,Jl as D,Um as T,Vm as y,Zo as x,bm as F,cs as w,ep as M,vp as R}from"./chunk-dv8mbh0j.js";import{Su as P}from"./chunk-0y6f4037.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-4h7zdmrz.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,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{cs as a,ds as b,es as c,fs as d,gs as e,hs as f}from"./chunk-
|
|
2
|
+
import{cs as a,ds as b,es as c,fs as d,gs as e,hs as f}from"./chunk-dv8mbh0j.js";import"./chunk-25de1sj7.js";import"./chunk-38ykv2gd.js";import"./chunk-4qq5wj04.js";import"./chunk-g8tce9rr.js";import"./chunk-0eeymffm.js";import"./chunk-a8mnhryz.js";import"./chunk-dnhckx52.js";import"./chunk-jt8as8j8.js";import"./chunk-x84g0m0p.js";import"./chunk-5h5ydexj.js";import"./chunk-aw651z2y.js";import"./chunk-wj2trgsn.js";import"./chunk-0y6f4037.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Hq as X,zm as W}from"./chunk-
|
|
2
|
+
import{Hq as X,zm as W}from"./chunk-dv8mbh0j.js";import V from"fs";import M from"path";import*as Y from"readline";var j={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},Q={help:{description:"Show available commands",usage:"help [command]",handler:async(q,z)=>{if(q[0]&&Q[q[0]]){let A=Q[q[0]];console.log(`
|
|
3
3
|
${j.bold}${q[0]}${j.reset} - ${A.description}`),console.log(` Usage: ${j.cyan}${A.usage}${j.reset}
|
|
4
4
|
`)}else{console.log(`
|
|
5
5
|
${j.bold}Available Commands:${j.reset}
|