@stacksjs/stx 0.2.479 → 0.2.480
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-8g265pwq.js → chunk-083amvsc.js} +1 -1
- package/dist/{chunk-zakby6bx.js → chunk-0f9p3jm6.js} +1 -1
- package/dist/{chunk-a3a5s9qr.js → chunk-0w4ajnbv.js} +2 -2
- package/dist/{chunk-jcrcqtb3.js → chunk-1yt6vfyx.js} +1 -1
- package/dist/{chunk-syv9rh52.js → chunk-2ead6r6z.js} +1 -1
- package/dist/{chunk-4pcqg0te.js → chunk-3mqagqx2.js} +1 -1
- package/dist/{chunk-343k64zr.js → chunk-3sscb1dw.js} +1 -1
- package/dist/{chunk-kqqe0hzx.js → chunk-3wkzj28f.js} +1 -1
- package/dist/{chunk-yj9thf3n.js → chunk-4wc6hckd.js} +1 -1
- package/dist/{chunk-p2775azk.js → chunk-6tvv828r.js} +1 -1
- package/dist/chunk-77m49nv1.js +2 -0
- package/dist/{chunk-2ynmmd3z.js → chunk-9cskmz6f.js} +1 -1
- package/dist/{chunk-qrbpfexg.js → chunk-ab4ajce4.js} +2 -2
- package/dist/chunk-bgamctxe.js +2 -0
- package/dist/{chunk-20wvgf5w.js → chunk-by8be7t7.js} +5 -5
- package/dist/{chunk-cp3d3zrt.js → chunk-csc538a5.js} +1 -1
- package/dist/{chunk-9yverx7k.js → chunk-e6c12w2y.js} +1 -1
- package/dist/{chunk-1khb6g2w.js → chunk-fd5x89cr.js} +2 -2
- package/dist/{chunk-gef1av6b.js → chunk-fk10wpkj.js} +1 -1
- package/dist/{chunk-8cr4tqwg.js → chunk-fmgr96es.js} +1 -1
- package/dist/{chunk-ws0akhpt.js → chunk-g9a2ajsa.js} +1 -1
- package/dist/{chunk-w02x3nd4.js → chunk-hf3mx0b8.js} +1 -1
- package/dist/{chunk-qzxpqyny.js → chunk-jcwn5641.js} +1 -1
- package/dist/{chunk-eh23r8f2.js → chunk-js8envem.js} +1 -1
- package/dist/{chunk-2d71d7n1.js → chunk-jtq3nhwp.js} +1 -1
- package/dist/{chunk-npsccfxz.js → chunk-k6e9yc83.js} +1 -1
- package/dist/{chunk-ennnv0n0.js → chunk-kw7z9xtf.js} +1 -1
- package/dist/{chunk-pj332gj9.js → chunk-mfby8kxp.js} +1 -1
- package/dist/{chunk-nj1mgbt8.js → chunk-nepqqe3b.js} +1 -1
- package/dist/{chunk-xy0502b6.js → chunk-nmck8fae.js} +1 -1
- package/dist/{chunk-mkeq5ec2.js → chunk-npayazc2.js} +1 -1
- package/dist/{chunk-3mzmz1ht.js → chunk-nt98fd0r.js} +1 -1
- package/dist/{chunk-h2aetzf6.js → chunk-p87ckkwb.js} +1 -1
- package/dist/chunk-qa3ts1cb.js +2 -0
- package/dist/{chunk-9v1ewa0f.js → chunk-r63029hr.js} +1 -1
- package/dist/{chunk-k3fxq005.js → chunk-rnh4sxhv.js} +1 -1
- package/dist/{chunk-v769ppj2.js → chunk-scj3j6xz.js} +1 -1
- package/dist/{chunk-zbtad4yz.js → chunk-sf1fxvwa.js} +1 -1
- package/dist/{chunk-afxpbw68.js → chunk-sms5qrmn.js} +1 -1
- package/dist/{chunk-pegv1j5x.js → chunk-tjk5b18m.js} +1 -1
- package/dist/{chunk-3pgewsrr.js → chunk-trz5bkxe.js} +1 -1
- package/dist/{chunk-y19egvjj.js → chunk-txkq59z8.js} +1 -1
- package/dist/{chunk-r345b5an.js → chunk-vbbyxjnq.js} +1 -1
- package/dist/{chunk-sz5m446r.js → chunk-w267tk8j.js} +195 -196
- package/dist/{chunk-7ph65fcr.js → chunk-wfyq4tde.js} +1 -1
- package/dist/{chunk-ntnwwb9z.js → chunk-ynhfzv5f.js} +1 -1
- package/dist/{chunk-mre4931b.js → chunk-yw9h2zty.js} +1 -1
- package/dist/{chunk-r8x97zbs.js → chunk-yx89t1we.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/client-parameter-bindings.d.ts +6 -0
- package/dist/client-parameter-bindings.js +70 -2
- package/dist/client-script.js +11 -64
- 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-06f66a6g.js +0 -2
- package/dist/chunk-sjmx8ek1.js +0 -2
- package/dist/chunk-w52pta5n.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,X,sr,i,te,As,A,_t,fn,Ps,c,p,D,xe,Ye,l,or}from"./chunk-ab7vh24b.js";import{yn,bn,ur,ke}from"./chunk-9ztdvnkk.js";import{mn,y,Si,Rt,Ds,ki,Ci,$i,Ei}from"./chunk-01nx6zcw.js";import{P}from"./chunk-pf0d8y9n.js";import{S,Ts,Ge,dn,nr,pe,Rs,fe,rr}from"./chunk-tbef3yyk.js";import{Cs,$s,Es,_s,Zn,Qn}from"./chunk-s10r6hxp.js";import{ue,Et,Yn,ks,C,Ke}from"./chunk-99kt56fn.js";import{ln}from"./chunk-
|
|
2
|
+
import{t,X,sr,i,te,As,A,_t,fn,Ps,c,p,D,xe,Ye,l,or}from"./chunk-ab7vh24b.js";import{yn,bn,ur,ke}from"./chunk-9ztdvnkk.js";import{mn,y,Si,Rt,Ds,ki,Ci,$i,Ei}from"./chunk-01nx6zcw.js";import{P}from"./chunk-pf0d8y9n.js";import{S,Ts,Ge,dn,nr,pe,Rs,fe,rr}from"./chunk-tbef3yyk.js";import{Cs,$s,Es,_s,Zn,Qn}from"./chunk-s10r6hxp.js";import{ue,Et,Yn,ks,C,Ke}from"./chunk-99kt56fn.js";import{ln}from"./chunk-mfby8kxp.js";import{js}from"./chunk-pcq6vphz.js";import{bi,xs,Gn,Jn}from"./chunk-j4afmryj.js";import{di,pi,gi,mi}from"./chunk-8adstrk5.js";import{qe}from"./chunk-tfexmdkt.js";import{s,we}from"./chunk-ak95401g.js";import{$t,vi,an,a,cn}from"./chunk-kk5cyjfs.js";import{u}from"./chunk-cg8hg6cs.js";import{ge,O,gn}from"./chunk-29pn79t5.js";import{dr}from"./chunk-27kb6nrb.js";import H0 from"fs";import gu from"path";import{createHighlighter as q0}from"ts-syntax-highlighter";import xa from"fs";import un from"path";import{loadConfigWithResult as B0}from"bunfig";var tr={duration:300,delay:0,ease:"ease",direction:"both"};function Th(v,_={}){let{duration:k,delay:E,ease:T,direction:j,custom:B}={...tr,..._};if(v==="custom"&&B)return B;switch(v){case"fade":return`${j==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
3
3
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
4
4
|
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${j==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
5
5
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -9,7 +9,7 @@ import{t,X,sr,i,te,As,A,_t,fn,Ps,c,p,D,xe,Ye,l,or}from"./chunk-ab7vh24b.js";impo
|
|
|
9
9
|
@keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
|
|
10
10
|
@keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${j==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":j==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
11
11
|
@keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
|
|
12
|
-
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function
|
|
12
|
+
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function Ah(){return`
|
|
13
13
|
<script data-stx-scoped data-stx-run="once">
|
|
14
14
|
// Motion preferences handling
|
|
15
15
|
(function() {
|
|
@@ -37,7 +37,7 @@ else {
|
|
|
37
37
|
});
|
|
38
38
|
})();
|
|
39
39
|
</script>
|
|
40
|
-
`}function
|
|
40
|
+
`}function Ih(v){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((k)=>k.test(v))}function Ph(v=0.1,_="0px"){return`
|
|
41
41
|
<script data-stx-scoped data-stx-run="always">
|
|
42
42
|
// Intersection Observer for scroll animations
|
|
43
43
|
(function() {
|
|
@@ -80,7 +80,7 @@ else {
|
|
|
80
80
|
}
|
|
81
81
|
})();
|
|
82
82
|
</script>
|
|
83
|
-
`}function
|
|
83
|
+
`}function Dh(){return`
|
|
84
84
|
<style id="stx-animation-base">
|
|
85
85
|
:root {
|
|
86
86
|
--stx-transition-duration: 300ms;
|
|
@@ -195,7 +195,7 @@ else {
|
|
|
195
195
|
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
196
196
|
}
|
|
197
197
|
</style>
|
|
198
|
-
`}function
|
|
198
|
+
`}function Mh(v,_,k={}){let{staggerDelay:E=50,sequence:T=!1}=k;return`
|
|
199
199
|
<script data-stx-scoped data-stx-run="always">
|
|
200
200
|
// Animation Group: ${v}
|
|
201
201
|
(function() {
|
|
@@ -232,11 +232,11 @@ else {
|
|
|
232
232
|
}
|
|
233
233
|
})();
|
|
234
234
|
</script>
|
|
235
|
-
`}var
|
|
236
|
-
style="--stx-transition-duration: ${j}ms; --stx-transition-ease: ${B}; --stx-transition-delay: ${z}ms;">${v}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},
|
|
237
|
-
${F}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},
|
|
238
|
-
</head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let F=
|
|
239
|
-
`+T.slice(V)}}return T}async function
|
|
235
|
+
`}var bu={name:"transition",handler:(v,_,k,E)=>{if(_.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${v}`;let T=_[0],j=_.length>1?Number.parseInt(_[1],10)||tr.duration:tr.duration,B=_.length>2?_[2]||tr.ease:tr.ease,z=_.length>3?Number.parseInt(_[3],10)||tr.delay:tr.delay,F=_.length>4?_[4]||tr.direction:tr.direction,V=`stx-transition-${Math.random().toString(36).substr(2,9)}`,H=Th(T,{duration:j,delay:z,ease:B,direction:F}),G="stx-transition",ne="";if(T==="fade")ne="stx-fade";else if(T==="slide")ne="stx-slide";else if(T==="scale")ne="stx-scale";else if(T==="flip")ne="stx-flip";else if(T==="rotate")ne="stx-rotate";return`<div id="${V}" class="${G} ${ne} ${F==="out"?"stx-out":""}"
|
|
236
|
+
style="--stx-transition-duration: ${j}ms; --stx-transition-ease: ${B}; --stx-transition-delay: ${z}ms;">${v}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},wu={name:"scrollAnimate",handler:(v,_,k,E)=>{if(_.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${v}`;let T=_[0],j=_.length>1?Number.parseInt(_[1],10)||300:300,B=_.length>2?_[2]||"ease":"ease",z=_.length>3?Number.parseFloat(_[3])||0.2:0.2,F=_.length>4?Number.parseInt(_[4],10)||0:0,V=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,H=`--stx-transition-duration: ${j}ms; --stx-transition-ease: ${B}; --stx-transition-delay: ${F}ms; will-change: opacity, transform;`,G="stx-transition stx-observe stx-out";if(T==="fade")G+=" stx-fade";else if(T==="slide-up"||T==="slide")G+=" stx-from-bottom";else if(T==="slide-down")G+=" stx-from-top";else if(T==="slide-left")G+=" stx-from-right";else if(T==="slide-right")G+=" stx-from-left";else if(T==="scale")G+=" stx-scale";else if(T.includes("-"))G+=` stx-${T}`;else G+=` stx-${T}`;return`<div id="${V}" class="${G}" style="${H}" data-threshold="${z}">${v}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Wu={name:"animationGroup",handler:(v,_,k,E)=>{if(_.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${v}`;let T=_[0],j=_.slice(1).map((V)=>V.startsWith("#")||V.startsWith(".")?V:`#${V}`),B=k.staggerDelay||50,z=k.sequence||!0,F=Mh(T,j,{staggerDelay:B,sequence:z});return`${v}
|
|
237
|
+
${F}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Uu={name:"motion",handler:(v,_,k,E)=>{let T=_.length>0?_[0].toLowerCase()==="true":!0,j=Ah();return`<div data-animate="${T?"auto":"true"}">${v}</div>${j}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function qu(v,_,k,E){let T=v;if(E.animation?.enabled===!1)return T;let j=k.includes("test")&&k.includes("animation");if(!Ih(T)&&!j)return T;if(!T.includes('<style id="stx-animation-base">')){let z=Dh();T=T.replace("</head>",`${z}
|
|
238
|
+
</head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let F=Ph(),V=T.lastIndexOf("</body>");if(V!==-1)T=T.slice(0,V)+F+`
|
|
239
|
+
`+T.slice(V)}}return T}async function Oh(v,_,k,E){let T=_[0]?.replace(/['"]/g,"")||"main",j=ke();if(T!=="main")j=j.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${j}</script>`}var Ku={name:"stxRouter",handler:Oh,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};var Nh={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function Xu(v){let _=v.heatmap;if(!_?.enabled)return"";let k={...Nh,..._};return`
|
|
240
240
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
241
241
|
<script>
|
|
242
242
|
(function() {
|
|
@@ -619,8 +619,8 @@ else {
|
|
|
619
619
|
};
|
|
620
620
|
})();
|
|
621
621
|
</script>
|
|
622
|
-
`}function
|
|
623
|
-
`)){let z=B.trim();if(!z||z.startsWith("#"))continue;let F=z.indexOf(":");if(F===-1)continue;let V=z.slice(0,F).trim(),H=z.slice(F+1).trim();if(typeof H==="string"){if(H.startsWith('"')&&H.endsWith('"')||H.startsWith("'")&&H.endsWith("'"))H=H.slice(1,-1);else if(H.startsWith("[")&&H.endsWith("]"))try{H=JSON.parse(H)}catch{}else if(H==="true")H=!0;else if(H==="false")H=!1;else if(/^-?\d+(?:\.\d+)?$/.test(H))H=Number(H)}j[V]=H}return{data:j,content:T.trim()}}function Oe(v,_={}){let{gfm:k=!0,breaks:E=!1}=_,T=v,j=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(H,G,ne)=>{let J=j.length,re=G?` class="language-${cr(G)}"`:"";return j.push(`<pre><code${re}>${cr(ne.trim())}</code></pre>`),`\x00CODEBLOCK${J}\x00`}),T=T.replace(/`([^`]*)`/g,(H,G)=>`<code>${cr(G)}</code>`),T=T.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),T=T.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),T=T.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),T=T.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),T=T.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),T=T.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),T=T.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),T=T.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),T=T.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),T=T.replace(/__(.+?)__/g,"<strong>$1</strong>"),T=T.replace(/\*(.+?)\*/g,"<em>$1</em>"),T=T.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),k)T=T.replace(/~~(.+?)~~/g,"<del>$1</del>");if(T=T.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(H,G,ne)=>`<img src="${
|
|
622
|
+
`}function Zu(v,_){let k=Xu(_);if(!k)return v;let E=v.lastIndexOf("</body>");if(E!==-1)return v.slice(0,E)+k+v.slice(E);return v+k}var Gu={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(v,_,k,E)=>{let T=k.__stx_config||{};if(_.length>0){let j=jh(_.join(" "));T.heatmap={...T.heatmap,...j,enabled:!0}}return Xu(T)}};function jh(v){let _={},k=v.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let E of k){let[T,j]=E.split("="),B=j?.replace(/["']/g,"");switch(T){case"endpoint":_.endpoint=B;break;case"samplingRate":_.samplingRate=Number.parseInt(B,10);break;case"batchSize":_.batchSize=Number.parseInt(B,10);break;case"trackMouse":_.trackMouse=B==="true";break;case"trackClicks":_.trackClicks=B==="true";break;case"trackScroll":_.trackScroll=B==="true";break;case"honorDnt":_.honorDnt=B==="true";break;case"debugOverlay":_.debugOverlay=B==="true";break}}return _}function cr(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ju(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function Dn(v){let _=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,k=v.match(_);if(!k)return{data:{},content:v.trim()};let E=k[1],T=v.slice(k[0].length),j={};for(let B of E.split(`
|
|
623
|
+
`)){let z=B.trim();if(!z||z.startsWith("#"))continue;let F=z.indexOf(":");if(F===-1)continue;let V=z.slice(0,F).trim(),H=z.slice(F+1).trim();if(typeof H==="string"){if(H.startsWith('"')&&H.endsWith('"')||H.startsWith("'")&&H.endsWith("'"))H=H.slice(1,-1);else if(H.startsWith("[")&&H.endsWith("]"))try{H=JSON.parse(H)}catch{}else if(H==="true")H=!0;else if(H==="false")H=!1;else if(/^-?\d+(?:\.\d+)?$/.test(H))H=Number(H)}j[V]=H}return{data:j,content:T.trim()}}function Oe(v,_={}){let{gfm:k=!0,breaks:E=!1}=_,T=v,j=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(H,G,ne)=>{let J=j.length,re=G?` class="language-${cr(G)}"`:"";return j.push(`<pre><code${re}>${cr(ne.trim())}</code></pre>`),`\x00CODEBLOCK${J}\x00`}),T=T.replace(/`([^`]*)`/g,(H,G)=>`<code>${cr(G)}</code>`),T=T.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),T=T.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),T=T.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),T=T.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),T=T.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),T=T.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),T=T.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),T=T.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),T=T.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),T=T.replace(/__(.+?)__/g,"<strong>$1</strong>"),T=T.replace(/\*(.+?)\*/g,"<em>$1</em>"),T=T.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),k)T=T.replace(/~~(.+?)~~/g,"<del>$1</del>");if(T=T.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(H,G,ne)=>`<img src="${Ju(ne)?cr(ne):""}" alt="${cr(G)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(H,G,ne)=>`<a href="${Ju(ne)?cr(ne):""}">${G}</a>`),T=T.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),T=T.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),T=T.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
624
624
|
`),T=T.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),T=T.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),T=T.replace(/<\/ul>\n<ul>/g,""),T=T.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),T=T.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),T=T.replace(/<\/ol>\n<ol>/g,""),T=T.replace(/<li data-ul>/g,"<li>"),T=T.replace(/<li data-ol>/g,"<li>"),k)T=T.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(H,G,ne)=>{let re=`<tr>${G.split("|").map((ie)=>ie.trim()).filter(Boolean).map((ie)=>`<th>${cr(ie)}</th>`).join("")}</tr>`,se=ne.trim().split(`
|
|
625
625
|
`).map((ie)=>`<tr>${ie.split("|").map((de)=>de.trim()).filter(Boolean).map((de)=>`<td>${cr(de)}</td>`).join("")}</tr>`).join(`
|
|
626
626
|
`);return`<table>
|
|
@@ -637,7 +637,7 @@ ${se}
|
|
|
637
637
|
`:`
|
|
638
638
|
`)}</p>`);if(T=z.join(`
|
|
639
639
|
`),E)T=T.replace(/\n/g,`<br />
|
|
640
|
-
`);for(let H=0;H<j.length;H++)T=T.replace(`\x00CODEBLOCK${H}\x00`,j[H]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}import
|
|
640
|
+
`);for(let H=0;H<j.length;H++)T=T.replace(`\x00CODEBLOCK${H}\x00`,j[H]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}import ih from"fs";import tt from"path";import Er from"path";import Gs from"fs";var Lh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Ca(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return Lh.has(v.toLowerCase())}var Yu=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"]),Qu={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"},Bh=new Set(["ctrl","alt","shift","meta"]),nd={left:0,middle:1,right:2};function ed(v){let _={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let k of v){let E=k.toLowerCase();if(E==="prevent")_.prevent=!0;else if(E==="stop")_.stop=!0;else if(E==="once")_.once=!0;else if(E==="capture")_.capture=!0;else if(E==="self")_.self=!0;else if(E==="passive")_.passive=!0;else if(E==="nonpassive")_.nonpassive=!0;else if(Bh.has(E))_.systemKeys.push(E);else if(E in nd)_.mouse=E;else if(E in Qu||/^[a-z]$/.test(E))_.keys.push(Qu[E]||E.toUpperCase());else if(E.startsWith("debounce")){let T=E.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(E.startsWith("throttle")){let T=E.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function rd(v,_=""){let k=[],E=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,j;while((j=T.exec(v))!==null){let[B,z,F]=j,V=j.index,H=V+B.length,G=`__stx_evt_${_}${E++}`,ne=[],J=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,re;while((re=J.exec(F))!==null){let[,ie,oe]=re,de=ie.split("."),ae=de[0];if(!Yu.has(ae))continue;ne.push({attribute:`@${ie}`,event:ae,handler:oe,modifiers:ed(de.slice(1)),elementId:G})}let se=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((re=se.exec(F))!==null){let[,ie,oe]=re,de=ie.split("."),ae=de[0];if(!Yu.has(ae))continue;ne.push({attribute:`@${ie}`,event:ae,handler:oe,modifiers:ed(de.slice(1)),elementId:G})}if(ne.length>0)k.push({originalTag:B,elementId:G,events:ne,startIndex:V,endIndex:H})}return k}function zh(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let E of k.systemKeys)_.push(`if (!$event.${E}Key) return`);if(k.keys.length>0){let E=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${E})) return`)}if(k.mouse!==null){let E=nd[k.mouse];_.push(`if ($event.button !== ${E}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Fh(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function Ra(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Wh(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),E=zh(v),T=Fh(Ra(v.handler),_),j=[];if(_.once)j.push("once: true");if(_.capture)j.push("capture: true");if(Ca(v.event,_))j.push("passive: true");let B=j.length>0?`, { ${j.join(", ")} }`:"",z=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.event==="mounted")return`
|
|
641
641
|
(function() {
|
|
642
642
|
var $el = document.getElementById('${k}');
|
|
643
643
|
if (!$el) return;
|
|
@@ -691,7 +691,7 @@ else {
|
|
|
691
691
|
__stx_runHandler('${z}', $event, $el);
|
|
692
692
|
}
|
|
693
693
|
}${B});
|
|
694
|
-
})();`}function
|
|
694
|
+
})();`}function Ta(v){if(v.length===0)return"";return`
|
|
695
695
|
<script data-stx-events>
|
|
696
696
|
(function() {
|
|
697
697
|
'use strict';
|
|
@@ -746,11 +746,11 @@ else {
|
|
|
746
746
|
}
|
|
747
747
|
|
|
748
748
|
// Event listeners
|
|
749
|
-
${v.map(
|
|
749
|
+
${v.map(Wh).join(`
|
|
750
750
|
`)}
|
|
751
751
|
})();
|
|
752
|
-
</script>`}function
|
|
753
|
-
`+T.slice(B);else T+=j;return T}function
|
|
752
|
+
</script>`}function Vh(v,_=""){let k=rd(v,_);if(k.length===0)return{template:v,bindings:[]};let E=v,T=[];for(let j=k.length-1;j>=0;j--){let B=k[j],z=B.originalTag;if(!z.includes(" id="))z=z.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${B.elementId}"`);else{let F=z.match(/id=["']([^"']+)["']/);if(F)for(let V of B.events)V.elementId=F[1]}for(let F of B.events){let V=F.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${V}\\s*=\\s*"[^"]*"`,"g"),G=new RegExp(`\\s*${V}\\s*=\\s*'[^']*'`,"g");z=z.replace(H,""),z=z.replace(G,"")}E=E.slice(0,B.startIndex)+z+E.slice(B.endIndex),T.push(...B.events)}return{template:E,bindings:T}}function td(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function sd(v,_,k){if(ki(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:z,bindings:F}=Vh(v,td(_)),V=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...V,...F],z}let E=rd(v,td(_));if(E.length===0)return v;let T=v;for(let z=E.length-1;z>=0;z--){let F=E[z],V=F.originalTag;if(!V.includes(" id="))V=V.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${F.elementId}"`);else{let H=V.match(/id=["']([^"']+)["']/);if(H)for(let G of F.events)G.elementId=H[1]}for(let H of F.events){let G=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ne=new RegExp(`\\s*${G}\\s*=\\s*"[^"]*"`,"g"),J=new RegExp(`\\s*${G}\\s*=\\s*'[^']*'`,"g");V=V.replace(ne,""),V=V.replace(J,"")}T=T.slice(0,F.startIndex)+V+T.slice(F.endIndex)}let j=Ta(E.flatMap((z)=>z.events)),B=T.lastIndexOf("</body>");if(B!==-1)T=T.slice(0,B)+j+`
|
|
753
|
+
`+T.slice(B);else T+=j;return T}function id(v,_){let k=new Set;for(let E of v.split(",")){let T=E.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let j=T.lastIndexOf(":");if(j!==-1)T=T.slice(j+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function Ji(v,_){let k=s(v),{depths:E,balanced:T}=we(k),j=(z)=>!T||E[z]===0,B=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let z of k.matchAll(B)){let F=(z.index??0)+z[0].length-z[1].length;if(j(F))return!0}for(let z of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(j(z.index??0)&&id(z[1],!0).has(_))return!0;for(let z of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(j(z.index??0)&&id(z[1],!1).has(_))return!0;return!1}var od="",Yi,Ur=/^[A-Za-z_$][\w$]*$/,Uh=new Set(["if","for","while","switch","with"]),ad=["(","[","{"],cd=[")","]","}"],Hh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function qh(v){let _=s(v),k=[];for(let E of _.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let T=E.index??0;k.push({text:E[0],start:T,end:T+E[0].length})}return{code:_,tokens:k}}function ld(v){if(Yi&&v===od)return Yi;let{code:_,tokens:k}=qh(v),E=new Map,T=[];for(let ne=0;ne<k.length;ne++){let J=k[ne].text;if(["(","[","{"].includes(J))T.push(ne);else if([")","]","}"].includes(J)){let re=T.at(-1);if(re!==void 0&&["()","[]","{}"].includes(k[re].text+J))T.pop(),E.set(re,ne),E.set(ne,re)}}function j(ne,J){let re=[],se=ne;for(let ie=ne;ie<J;ie++){if(["(","[","{"].includes(k[ie].text)&&(E.get(ie)??J)<J){ie=E.get(ie);continue}if(k[ie].text===",")re.push([se,ie]),se=ie+1}return re.push([se,J]),re}function B(ne,J,re){if(k[ne]?.text==="...")ne++;if(ne>=J)return;let se=k[ne].text;if(Ur.test(se)){re.add(se);return}if(se!=="{"&&se!=="[")return;let ie=E.get(ne);if(ie===void 0||ie>=J)return;for(let[oe,de]of j(ne+1,ie)){let ae=oe;if(se==="{")for(let me=oe;me<de;me++){if(k[me].text===":"){ae=me+1;break}if(k[me].text==="=")break;if(["(","[","{"].includes(k[me].text)&&E.has(me))me=E.get(me)}B(ae,de,re)}}function z(ne,J){let re=new Set;for(let[se,ie]of j(ne,J))B(se,ie,re);return re}function F(ne){let J=ne;for(;J<k.length;J++){let re=k[J].text;if(["(","[","{"].includes(re)&&E.has(J)){J=E.get(J);continue}if([",",";",")","]","}"].includes(re))break}return k[Math.max(ne,J-1)]?.end??_.length}let V=[];for(let ne=0;ne<k.length;ne++)if(k[ne].text==="=>"){let J=ne-1,re=J,se;if(k[J]?.text===")"&&E.has(J))re=E.get(J),se=z(re+1,J);else if(k[J]&&Ur.test(k[J].text))se=new Set([k[J].text]);else continue;let ie=ne+1,oe=k[ie]?.text==="{"&&E.has(ie)?k[E.get(ie)].end:F(ie);V.push({start:k[re].start,end:oe,names:se})}else if(k[ne].text==="("&&E.has(ne)){let J=k[ne-1]?.text;if(!J||Uh.has(J)||!Ur.test(J)&&J!=="*"&&J!=="]")continue;let re=E.get(ne),se=re+1;if(k[se]?.text===":"){se++;while(se<k.length&&!["{","=>",";","="].includes(k[se].text))se++}if(k[se]?.text!=="{"||!E.has(se))continue;V.push({start:k[ne].start,end:k[E.get(se)].end,names:z(ne+1,re)})}let H=new Set;function G(ne){let J=ne;for(;J<k.length;J++){let re=k[J].text;if(ad.includes(re)&&E.has(J)){J=E.get(J);continue}if(re===";"||cd.includes(re))break;let se=k[J-1];if(J>ne&&Hh.has(re)&&se.text!==".")break;if(J>ne&&/[\n\r]/.test(_.slice(se.end,k[J].start))&&(/^[\w$]+$/.test(se.text)||cd.includes(se.text)||['"',"'","`"].includes(se.text))&&Ur.test(re)&&!["in","of","instanceof"].includes(re))break}return J}for(let ne=0;ne<k.length;ne++){let J=k[ne].text,re=k[ne-1]?.text;if(re==="."||k[ne+1]?.text===":")continue;if(re==="as"||re==="<")continue;if(J==="const"||J==="let"||J==="var"){let se=G(ne+1),ie=ne+1,oe=!1,de=!1,ae=0;for(let me=ne+1;me<=se;me++){let ve=k[me]?.text;if(me<se&&ad.includes(ve)&&E.has(me)&&E.get(me)<se){me=E.get(me);continue}if(me<se&&ve===":"&&!de)oe=!0;else if(me<se&&ve==="="&&ae===0)oe=!1,de=!0;else if(me<se&&oe&&ve==="<")ae++;else if(me<se&&oe&&ve===">"&&ae>0)ae--;else if(me===se||ve===","&&ae===0)B(ie,me,H),ie=me+1,oe=!1,de=!1}}else if(J==="function"||J==="class"){let se=ne+1;if(k[se]?.text==="*")se++;if(k[se]&&Ur.test(k[se].text)&&k[se].text!=="extends")H.add(k[se].text)}else if(J==="import"){let se=ne+1;if(k[se]?.text==="*"&&k[se+1]?.text==="as")se+=2;let ie=k[se]?.text;if(ie&&Ur.test(ie)&&ie!=="type"&&k[se+1]?.text!=="("&&k[se+1]?.text!==".")H.add(ie)}}return od=v,Yi={code:_,scopes:V,declarations:H},Yi}function Aa(v){let _=ld(v);return{code:_.code,shadows:(k,E)=>_.scopes.some((T)=>E>=T.start&&E<T.end&&T.names.has(k))}}function Qi(v){return new Set(ld(v).declarations)}var ud=Symbol.for("stx.lazy-module-promises");function Kh(){let v=globalThis;return v[ud]??=new Map,v[ud]}function ft(v,_){let k=Kh(),E=`${import.meta.url}\x00${v}`,T=k.get(E);if(T)return T;let j=_();return k.set(E,j),j.catch(()=>{if(k.get(E)===j)k.delete(E)}),j}var Xh=/<\/(script)/gi;function Hr(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(Xh,"<\\/$1")}import pd from"fs";class M{cache=new Map;maxSize;options;sizes;bytes=0;constructor(v=100,_){this.maxSize=v,this.options=_??null,this.sizes=_?new Map:null}get byteSize(){return this.bytes}setMaxBytes(v){if(!this.options)return;this.options={...this.options,maxBytes:v};while(this.bytes>v&&this.cache.size>0){let _=this.cache.keys().next().value;if(_===void 0)break;this.delete(_)}}get(v){if(!this.cache.has(v))return;let _=this.cache.get(v);return this.cache.delete(v),this.cache.set(v,_),_}set(v,_){if(this.cache.has(v))this.delete(v);let k=this.options?this.options.sizeOf(_):0;if(this.options&&k>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+k>this.options.maxBytes)){let E=this.cache.keys().next().value;if(E===void 0)break;this.delete(E)}if(this.cache.set(v,_),this.sizes)this.sizes.set(v,k),this.bytes+=k}has(v){return this.cache.has(v)}delete(v){if(this.sizes){let _=this.sizes.get(v);if(_!==void 0)this.bytes-=_,this.sizes.delete(v)}return this.cache.delete(v)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var qr=new Map,Zh=500;function kr(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!qr.has(k)){if(qr.size>=Zh){let E=qr.keys().next().value;if(E)qr.delete(E)}qr.set(k,new RegExp(v,_))}return qr.get(k)}class dd{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(v){let _=Array.from(new Set(v)),k=_.sort().join(","),E=this.pool.find((z)=>z.context.join(",")===k);if(E)return E.func;let T=this.fnCache,j=this.fnCacheMaxSize,B=(...z)=>(F)=>{try{let V=`${k}:${F}`,H=T.get(V);if(!H){if(T.size>=j){let G=T.keys().next().value;if(G)T.delete(G)}H=Function(..._,`
|
|
754
754
|
'use strict';
|
|
755
755
|
try {
|
|
756
756
|
return ${F};
|
|
@@ -761,19 +761,18 @@ catch (e) {
|
|
|
761
761
|
}
|
|
762
762
|
throw e;
|
|
763
763
|
}
|
|
764
|
-
`),T.set(V,H)}return H(...z)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:B,context:_.slice()});return B}clear(){this.pool.length=0,this.fnCache.clear()}}var
|
|
764
|
+
`),T.set(V,H)}return H(...z)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:B,context:_.slice()});return B}clear(){this.pool.length=0,this.fnCache.clear()}}var d$=new dd;class fd{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(v){this.enabled=v}isEnabled(){return this.enabled}setBudget(v,_){this.budgets.set(v,{warnThreshold:0.8,action:"warn",..._})}setBudgets(v){for(let[_,k]of Object.entries(v))this.setBudget(_,k)}removeBudget(v){this.budgets.delete(v)}getBudgets(){let v={};for(let[_,k]of this.budgets.entries())v[_]=k;return v}onViolation(v){this.violationHandlers.push(v)}offViolation(v){let _=this.violationHandlers.indexOf(v);if(_!==-1)this.violationHandlers.splice(_,1)}time(v,_){if(!this.enabled)return _();let k=performance.now(),E=_(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),E}async timeAsync(v,_){if(!this.enabled)return _();let k=performance.now(),E=await _(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),E}checkBudget(v,_){let k=this.budgets.get(v);if(!k)return;let E=_/k.maxTime*100,T=k.warnThreshold!==void 0?_>=k.maxTime*k.warnThreshold&&_<k.maxTime:!1,j=_>=k.maxTime;if(!T&&!j)return;let B={label:v,actualTime:_,budgetTime:k.maxTime,exceedancePercent:E,timestamp:new Date,isWarning:T};this.violations.push(B);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(B)}catch{}let z=T?`[Performance Warning] "${v}" took ${_.toFixed(2)}ms (${E.toFixed(1)}% of ${k.maxTime}ms budget)`:`[Performance Budget Exceeded] "${v}" took ${_.toFixed(2)}ms (exceeded ${k.maxTime}ms budget by ${(E-100).toFixed(1)}%)`;switch(k.action){case"log":console.log(z);break;case"warn":console.warn(z);break;case"error":console.error(z);break;case"throw":if(j)throw Error(z);else console.warn(z);break}}recordTime(v,_){let k=this.metrics.get(v);if(k)k.count++,k.totalTime+=_,k.maxTime=Math.max(k.maxTime,_),k.minTime=Math.min(k.minTime,_);else this.metrics.set(v,{count:1,totalTime:_,maxTime:_,minTime:_})}getStats(v){if(v){let k=this.metrics.get(v);if(!k)return{};let E=this.budgets.get(v);return{count:k.count,avgTime:k.totalTime/k.count,totalTime:k.totalTime,maxTime:k.maxTime,minTime:k.minTime,budget:E?.maxTime,budgetUtilization:E?k.totalTime/k.count/E.maxTime*100:void 0}}let _={};for(let[k,E]of this.metrics.entries()){let T=this.budgets.get(k);_[k]={count:E.count,avgTime:E.totalTime/E.count,totalTime:E.totalTime,maxTime:E.maxTime,minTime:E.minTime,budget:T?.maxTime,budgetUtilization:T?E.totalTime/E.count/T.maxTime*100:void 0}}return _}getViolations(v){if(v)return this.violations.filter((_)=>_.label===v);return[...this.violations]}getViolationStats(){let v={},_=0,k=0;for(let E of this.violations)if(v[E.label]=(v[E.label]||0)+1,E.isWarning)_++;else k++;return{total:this.violations.length,byLabel:v,warnings:_,errors:k}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var Ia=null;function Gh(){if(!Ia)Ia=new fd;return Ia}var U=new Proxy({},{get(v,_){return Gh()[_]}});var gd=[];function m(v){let _=new M(v);return gd.push(_),_}function md(){for(let v of gd)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function hd(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:pd.statSync(k).mtimeMs})}catch{}return _}function Qt(v){for(let _ of v)try{if(pd.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}var W=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl","useTimeoutFn"];var Jh=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Yh(v){if(v.startsWith(".")||v.startsWith("/"))return null;if(v.startsWith("@")){let k=v.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!k)return null;return{pkg:k[1],subpath:k[2]||""}}let _=v.match(/^([^/]+)(\/.*)?$/);if(!_)return null;return{pkg:_[1],subpath:_[2]||""}}function Qh(v,_){let k=_;while(!0){let E=Er.join(k,"node_modules",v,"package.json");if(Gs.existsSync(E))return Er.dirname(E);let T=Er.dirname(k);if(T===k)return null;k=T}}function ey(v,_){if(!v||typeof v!=="object")return null;let k=(T)=>{if(typeof T==="string")return T;if(T&&typeof T==="object"){if(typeof T.import==="string")return T.import;if(typeof T.default==="string")return T.default;if(typeof T.import==="object")return k(T.import);if(typeof T.default==="object")return k(T.default)}return null};if(Object.prototype.hasOwnProperty.call(v,_))return k(v[_]);let E=null;for(let T of Object.keys(v)){let j=T.indexOf("*");if(j===-1)continue;let B=T.slice(0,j),z=T.slice(j+1);if(!_.startsWith(B)||!_.endsWith(z))continue;if(_.length<B.length+z.length)continue;if(!E||B.length>E.prefix.length)E={pattern:T,prefix:B,suffix:z}}if(E){let T=_.slice(E.prefix.length,_.length-E.suffix.length),j=k(v[E.pattern]);if(j)return j.replace("*",T)}return null}function ty(v,_){let k=Yh(v);if(!k||!k.subpath)return null;let E=Qh(k.pkg,_);if(!E)return null;let T;try{T=JSON.parse(Gs.readFileSync(Er.join(E,"package.json"),"utf8"))}catch{return null}let j=`.${k.subpath}`,B=ey(T.exports,j);if(!B)return null;let z=Er.resolve(E,B);return Gs.existsSync(z)?z:null}function Kr(v,_){let k=_.filePath?Er.dirname(_.filePath):_.projectRoot||process.cwd(),E=_.projectRoot||process.cwd(),T=new Set,j=[],B=[];return{code:v.replace(Jh,(F,V)=>{let H;try{if(V.startsWith("./")||V.startsWith("../")||V.startsWith("/")){if(H=V.startsWith("/")?V:Er.resolve(k,V),!Gs.existsSync(H))throw Error(`file not found: ${H}`)}else{let G=null;try{G=Bun.resolveSync(V,E)}catch{G=ty(V,E)}if(!G)throw Error(`could not resolve ${V} (Bun.resolveSync + exports fallback both failed)`);H=G}}catch(G){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(V)} (from ${_.filePath||"<unknown>"}): ${G?.message||G}`),B.push(V),""}if(T.has(H))return"";T.add(H);try{let G=Gs.readFileSync(H,"utf8");j.push({source:V,resolvedPath:H,contents:G})}catch(G){console.warn(`[stx:vendor-css] could not read ${H}: ${G?.message||G}`),B.push(V)}return""}),styles:j,unresolved:B}}function ny(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Xr(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${ny(_.source)}" data-stx-layer="vendor">
|
|
765
765
|
@layer vendor {
|
|
766
766
|
${_.contents}
|
|
767
767
|
}
|
|
768
768
|
</style>`).join(`
|
|
769
769
|
`)}
|
|
770
|
-
`}var Va=y,
|
|
770
|
+
`}var Va=y,yd=m(256);function wt(v){let _=h(v),k=yd.get(_);if(!k)k=ry(v),yd.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function ry(v){let _=s(v),k=new Set;for(let z of v.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let F of z[1].split(",")){let V=F.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(V)k.add(V)}let E=Qi(_),T=W.filter((z)=>{if(k.has(z)||E.has(z))return!1;return Gr(_,z,!0)}),j=wd(_).filter((z)=>!k.has(z)&&!E.has(z));if(T.length===0&&j.length===0)return{code:v,imports:T,models:j};return{code:`${[T.length>0?`import { ${T.join(", ")} } from '@stacksjs/browser'`:"",j.length>0?"import '@stacksjs/browser'":"",j.length>0?`const { ${j.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
771
771
|
`)}
|
|
772
|
-
${v}`,imports:T,models:j}}var
|
|
773
|
-
`&&!/,\s*$/.test(v.slice(Math.max(_,j-200),j)))break;else if(E===0&&B===","){let z=/^\s*([A-Za-z_$][\w$]*)\s*(?=[=,;\n)]|$)/.exec(v.slice(j+1,j+200));if(z)k.push(z[1])}}return k}function ny(v){let _=new Set;for(let k of v.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))if(_.add(k[1]),!/^(?:function|class)/.test(k[0]))for(let E of ty(v,(k.index??0)+k[0].length))_.add(E);for(let k of v.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let E of k[1].split(",")){let T=E.trim().split(/[:=]/).pop()?.trim();if(T&&/^[A-Za-z_$][\w$]*$/.test(T))_.add(T)}return _}var gd=m(128);function jo(v){let _=h(v),k=gd.get(_);if(!k)k=ry(v),gd.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function ry(v){let _=new Set,k=new Set,E=v;E=E.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let T=new Set,j=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,B;while((B=j.exec(v))!==null){let G=B[1],ne=B[2];if(B[0].includes("import type"))continue;let J=[];for(let se of G.split(",")){let ie=se.trim();if(!ie||ie.startsWith("type "))continue;let oe=ie.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!oe)continue;let de=oe[1],ae=oe[2]||de;if(T.add(de),T.add(ae),ne==="stx"||ne==="@stacksjs/stx")_.add(de);else k.add(de);if(ae!==de)J.push(`${ae} = ${de}`)}let re=J.length>0?`var ${J.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";E=E.replace(B[0],re)}let z=ny(E);for(let G of Va){if(T.has(G)||z.has(G))continue;if(Gr(E,G,!0))_.add(G)}let F=s(E),V=new Set;for(let G of E.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let ne of G[1].split(",")){let J=ne.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let re of J){let se=re.trim();if(se)V.add(se)}}for(let G of W){if(T.has(G)||z.has(G)||V.has(G))continue;if(Gr(F,G))k.add(G)}let H=yd(E);for(let G of H)if(!T.has(G)&&!z.has(G))k.add(G);return{code:E,stxImports:Array.from(_),browserImports:Array.from(k)}}function Gr(v,_,k=!1){let E=id(v);v=E.code;let T=new RegExp(`\\b${_.replace(/[$]/g,"\\$")}\\b`,"g");for(let j of v.matchAll(T)){let B=j.index??0;if(E.shadows(_,B))continue;let z=B+_.length,F=B-1;while(F>=0&&/\s/.test(v[F]))F--;if(v[F]==="."&&v.slice(Math.max(0,F-2),F+1)!=="...")continue;let V=z;while(V<v.length&&/\s/.test(v[V]))V++;if(v[V]===":"&&v[V+1]!==":"&&(v[F]==="{"||v[F]===","))continue;if(k&&!/^\s*(?:<[^>]*>)?\s*\(/.test(v.slice(z)))continue;return!0}return!1}function Bo(v,_){let k=[];if(v.length>0)k.push(` var { ${v.join(", ")} } = window.stx || window;`);if(_.length>0)k.push(` var { ${_.join(", ")} } = window.StacksBrowser || {};`);if(k.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
772
|
+
${v}`,imports:T,models:j}}var sy=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function wd(v){let _=new Set,k=Aa(v),E=Qi(v),T=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let j of k.code.matchAll(T)){let B=j[1];if(sy.has(B)||E.has(B)||B.length<3)continue;if(k.shadows(B,j.index??0))continue;_.add(B)}return Array.from(_)}function iy(v){return Qi(v)}var xd=m(128);function jo(v){let _=h(v),k=xd.get(_);if(!k)k=oy(v),xd.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function oy(v){let _=new Set,k=new Set,E=v;E=E.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let T=new Set,j=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,B;while((B=j.exec(v))!==null){let G=B[1],ne=B[2];if(B[0].includes("import type"))continue;let J=[];for(let se of G.split(",")){let ie=se.trim();if(!ie||ie.startsWith("type "))continue;let oe=ie.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!oe)continue;let de=oe[1],ae=oe[2]||de;if(T.add(de),T.add(ae),ne==="stx"||ne==="@stacksjs/stx")_.add(de);else k.add(de);if(ae!==de)J.push(`${ae} = ${de}`)}let re=J.length>0?`var ${J.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";E=E.replace(B[0],re)}let z=iy(E);for(let G of Va){if(T.has(G)||z.has(G))continue;if(Gr(E,G,!0))_.add(G)}let F=s(E),V=new Set;for(let G of E.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let ne of G[1].split(",")){let J=ne.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let re of J){let se=re.trim();if(se)V.add(se)}}for(let G of W){if(T.has(G)||z.has(G)||V.has(G))continue;if(Gr(F,G))k.add(G)}let H=wd(F);for(let G of H)if(!T.has(G)&&!z.has(G))k.add(G);return{code:E,stxImports:Array.from(_),browserImports:Array.from(k)}}function Gr(v,_,k=!1){let E=Aa(v);v=E.code;let T=new RegExp(`\\b${_.replace(/[$]/g,"\\$")}\\b`,"g");for(let j of v.matchAll(T)){let B=j.index??0;if(E.shadows(_,B))continue;let z=B+_.length,F=B-1;while(F>=0&&/\s/.test(v[F]))F--;if(v[F]==="."&&v.slice(Math.max(0,F-2),F+1)!=="...")continue;let V=z;while(V<v.length&&/\s/.test(v[V]))V++;if(v[V]===":"&&v[V+1]!==":"&&(v[F]==="{"||v[F]===","))continue;if(k&&!/^\s*(?:<[^>]*>)?\s*\(/.test(v.slice(z)))continue;return!0}return!1}function Bo(v,_){let k=[];if(v.length>0)k.push(` var { ${v.join(", ")} } = window.stx || window;`);if(_.length>0)k.push(` var { ${_.join(", ")} } = window.StacksBrowser || {};`);if(k.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
774
773
|
${k.join(`
|
|
775
774
|
`)}
|
|
776
|
-
${
|
|
775
|
+
${ay(v,_)}`;return""}function vu(v,_=[]){let{browserImports:k}=jo(v),E=new Set(_);return Bo([],k.filter((T)=>!E.has(T)))}function ay(v,_){let k=[...v.map((E)=>`['${E}', typeof ${E}, 'stx']`),..._.map((E)=>`['${E}', typeof ${E}, '@stacksjs/browser']`)];if(k.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
777
776
|
[${k.join(", ")}].forEach(function (e) {
|
|
778
777
|
if (e[1] !== 'undefined') return;
|
|
779
778
|
console.error(
|
|
@@ -782,10 +781,10 @@ ${sy(v,_)}`;return""}function vu(v,_=[]){let{browserImports:k}=jo(v),E=new Set(_
|
|
|
782
781
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
783
782
|
);
|
|
784
783
|
});
|
|
785
|
-
`}function Ne(v){let _=v.__stxClientPayload;if(_&&typeof _==="object"){let E={};for(let T in _){let j=_[T];if(typeof j==="function")continue;E[T]=j}return E.__stxDeclaredPayload=!0,E}let k={};for(let E in v){if(E.startsWith("__")||E.startsWith("$"))continue;let T=v[E];if(typeof T==="function")continue;k[E]=T}return k}function
|
|
784
|
+
`}function Ne(v){let _=v.__stxClientPayload;if(_&&typeof _==="object"){let E={};for(let T in _){let j=_[T];if(typeof j==="function")continue;E[T]=j}return E.__stxDeclaredPayload=!0,E}let k={};for(let E in v){if(E.startsWith("__")||E.startsWith("$"))continue;let T=v[E];if(typeof T==="function")continue;k[E]=T}return k}function cy(v,_){return new RegExp(`(?<![.#\\w$])${_}(?![\\w$])`).test(v)}var ly=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,bd=new Set;function uy(v,_){let k=ly.test(v),E=_.length>32768;if(!k&&!E)return;if(bd.has(v))return;if(bd.add(v),k)console.warn(`[stx] server\u2192client bridge is publishing "${v}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(E)console.warn(`[stx] server\u2192client bridge is publishing ${(_.length/1024).toFixed(1)}KB under "${v}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function Jr(v,_){if(!_)return"";let k=s(v),E=_.__stxDeclaredPayload===!0,T=[];for(let[j,B]of Object.entries(_)){if(!/^[A-Za-z_$][\w$]*$/.test(j))continue;if(j.startsWith("__")||j.startsWith("$"))continue;if(!E&&!cy(k,j))continue;if(Ji(v,j)){if(E)console.warn(`[stx] defineClientPayload declares "${j}", but this client block also declares "${j}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${j}" from defineClientPayload.`);continue}let z;try{z=JSON.stringify(B)}catch{continue}if(z===void 0)continue;uy(j,z),T.push(` var ${j} = ${z.replace(/</g,"\\u003c")};`)}if(T.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
786
785
|
${T.join(`
|
|
787
786
|
`)}
|
|
788
|
-
`}var
|
|
787
|
+
`}var dy={left:0,middle:1,right:2};function fy(v){let _=[];if(v.self)_.push("if ($event.target !== $el) return");for(let k of v.systemKeys)_.push(`if (!$event.${k}Key) return`);if(v.keys.length>0){let k=v.keys.map((E)=>`$event.key === '${E}'`).join(" || ");_.push(`if (!(${k})) return`)}if(v.mouse!==null){let k=dy[v.mouse];_.push(`if ($event.button !== ${k}) return`)}if(v.prevent)_.push("$event.preventDefault()");if(v.stop)_.push("$event.stopPropagation()");return _.join("; ")}function py(v,_){let{elementId:k,event:E,modifiers:T}=v,j=Ra(v.handler),B=fy(T),z=[];if(T.once)z.push("once: true");if(T.capture)z.push("capture: true");if(Ca(E,T))z.push("passive: true");let F=z.length>0?`, { ${z.join(", ")} }`:"",V="";if(B)V+=`${B}; `;let H=j.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),G=`var $emit = function(name, detail) {
|
|
789
788
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
790
789
|
};`;function ne(J){if(/\$emit\s*\(/.test(J))return`${G}
|
|
791
790
|
${J}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
@@ -828,25 +827,25 @@ else {
|
|
|
828
827
|
else {
|
|
829
828
|
${j}
|
|
830
829
|
}
|
|
831
|
-
}${F})`}function
|
|
830
|
+
}${F})`}function gy(v){if(v.length===0)return"";return`
|
|
832
831
|
// STX: auto-generated event bindings
|
|
833
|
-
${v.map((k,E)=>
|
|
834
|
-
`)}`}function
|
|
835
|
-
`)B++;continue}if(z==="/"&&E[B+1]==="*"){B+=2;while(B<j-1&&!(E[B]==="*"&&E[B+1]==="/"))B++;B+=2;continue}if(z==="{"){T++,B++;continue}if(z==="}"){T--,B++;continue}if(T===0){let F=E.slice(B),V=F.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(V){let ne=V[1];if(!ne.startsWith("_")&&!k.has(ne))_.push(ne),k.add(ne);B+=V[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((ne)=>{let J=ne.trim(),re=J.indexOf(":"),se=re>=0?J.slice(re+1).trim().split(/[\s=]/)[0]:J.split(/[\s=]/)[0];if(se&&!se.startsWith("_")&&!k.has(se))_.push(se),k.add(se)}),B+=H[0].length;continue}let G=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(G){let ne=G[1];if(!ne.startsWith("_")&&!k.has(ne))_.push(ne),k.add(ne);B+=G[0].length;continue}}B++}return _}var
|
|
836
|
-
${
|
|
832
|
+
${v.map((k,E)=>py(k,E)).join(`
|
|
833
|
+
`)}`}function vd(v){let _=[],k=new Set,E=v.replace(/^\s*import\s+.*$/gm,""),T=0,j=E.length,B=0;while(B<j){let z=E[B];if(z==="'"||z==='"'||z==="`"){let F=z;if(B++,F==="`"){let V=0;while(B<j){if(E[B]==="\\"){B+=2;continue}if(E[B]==="`"&&V===0){B++;break}if(E[B]==="$"&&E[B+1]==="{"){V++,B+=2;continue}if(E[B]==="}"&&V>0){V--,B++;continue}B++}}else while(B<j){if(E[B]==="\\"){B+=2;continue}if(E[B]===F){B++;break}B++}continue}if(z==="/"&&E[B+1]==="/"){while(B<j&&E[B]!==`
|
|
834
|
+
`)B++;continue}if(z==="/"&&E[B+1]==="*"){B+=2;while(B<j-1&&!(E[B]==="*"&&E[B+1]==="/"))B++;B+=2;continue}if(z==="{"){T++,B++;continue}if(z==="}"){T--,B++;continue}if(T===0){let F=E.slice(B),V=F.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(V){let ne=V[1];if(!ne.startsWith("_")&&!k.has(ne))_.push(ne),k.add(ne);B+=V[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((ne)=>{let J=ne.trim(),re=J.indexOf(":"),se=re>=0?J.slice(re+1).trim().split(/[\s=]/)[0]:J.split(/[\s=]/)[0];if(se&&!se.startsWith("_")&&!k.has(se))_.push(se),k.add(se)}),B+=H[0].length;continue}let G=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(G){let ne=G[1];if(!ne.startsWith("_")&&!k.has(ne))_.push(ne),k.add(ne);B+=G[0].length;continue}}B++}return _}var my=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 hy(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function E(ne){let J;while((J=k.exec(ne))!==null){let re=J[0];if(!my.has(re))_.add(re)}}let T=/\{\{([\s\S]*?)\}\}/g,j;while((j=T.exec(v))!==null)E(j[1]);let B=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((j=B.exec(v))!==null)E(j[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((j=z.exec(v))!==null)E(j[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((j=F.exec(v))!==null)E(j[1]);let V=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((j=V.exec(v))!==null)E(j[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((j=H.exec(v))!==null)E(j[1]);let G=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((j=G.exec(v))!==null)E(j[1]);return _}async function he(v,_={}){let k=v,E="",T=!1,j=[],B=Kr(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=B.code;let z=Xr(B.styles),F=wt(k);k=F.code,j=[...F.imports,...F.models];let{hasUserImports:V,bundleClientScript:H}=await ft("stx/client-script-bundler",()=>import("./chunk-083amvsc.js"));if(V(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let ae=jo(k);k=ae.code,E=Bo(ae.stxImports,ae.browserImports.filter((me)=>!j.includes(me)))}if(E=`${Jr(k,_.serverData)}${E}`,k=P(k),!T&&Ve(_.attrs||""))k=Ue(k);let G=gy(_.eventBindings||[]),ne=(_.attrs||"").trim(),J=/\btype\s*=\s*["']module["']/i.test(ne),re=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(J){let ae=ne.replace(/\btype\s*=\s*["']module["']/i,"").trim(),me=`type="module" data-stx-scoped${re}${ae?` ${ae}`:""}`;return`${z}<script ${me}>
|
|
835
|
+
${Hr(`${E}${k}
|
|
837
836
|
${G}`)}
|
|
838
837
|
</script>`}let se=Ds(v),ie=/function __stx_setup_/.test(k),oe=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function de(ae){let me=ae.length>0?`
|
|
839
838
|
return { ${ae.join(", ")} };`:"";return`${z}<script data-stx-scoped data-stx-run="always"${re}>
|
|
840
839
|
window.stx.mount(function() {
|
|
841
840
|
'use strict';
|
|
842
|
-
${
|
|
841
|
+
${Hr(`${E}${k}
|
|
843
842
|
${G}${me}`)}
|
|
844
|
-
})</script>`}if(!oe&&!ie){if(se)return de(
|
|
843
|
+
})</script>`}if(!oe&&!ie){if(se)return de(vd(v));if(_.templateContent){let ae=vd(v);if(ae.length>0){let me=hy(_.templateContent);if(ae.some((Se)=>me.has(Se)))return de(ae)}}}return`${z}<script data-stx-scoped data-stx-run="always"${re}>
|
|
845
844
|
;(function() {
|
|
846
845
|
'use strict';
|
|
847
|
-
${
|
|
846
|
+
${Hr(`${E}${k}
|
|
848
847
|
${G}`)}
|
|
849
|
-
})()</script>`}import{createHash as
|
|
848
|
+
})()</script>`}import{createHash as yy}from"crypto";var eo="__stx_component_client_factories";function to(v){let _=v[eo];return _ instanceof Map?_:null}function $d(v){v[eo]=new Map}function Pa(v,_){let k=to(v);if(!k)return null;let E=yy("sha256").update(_).digest("hex").slice(0,16),T=k.get(E);if(T)T.instances++;else k.set(E,{body:_,instances:1});return E}function _d(v,_){let k=to(_);if(!k?.size)return v;let E=new Map;for(let[H,G]of k)if(G.instances===1)E.set(H,G.body);let T=[];if(E.size>0){let H=[...E.keys()].map((J)=>JSON.stringify(J).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),G=new RegExp(`window\\.__stxComponentFactories\\[(${H})\\]\\(("[^"]+")\\);`,"g"),ne=G.exec(v);while(ne!==null){let J=E.get(JSON.parse(ne[1]));if(J!==void 0)T.push({start:ne.index,end:ne.index+ne[0].length,replacement:`(${J})(${ne[2]});`});ne=G.exec(v)}}let j=[...k].filter(([,H])=>H.instances>1);if(j.length===0)return Sd(v,T);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
850
849
|
(function() {
|
|
851
850
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
852
851
|
${j.map(([H,G])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.stringify(H)}] || ${G.body}; }
|
|
@@ -854,30 +853,30 @@ ${j.map(([H,G])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.str
|
|
|
854
853
|
`)}
|
|
855
854
|
})();
|
|
856
855
|
</script>`,F=v.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),V=F<0?0:F;return T.push({start:V,end:V,replacement:`${z}
|
|
857
|
-
`}),xd(v,T)}function xd(v,_){if(_.length===0)return v;_.sort((j,B)=>j.start-B.start||j.end-B.end);let k=Array(_.length*2+1),E=0,T=0;for(let j of _)k[T++]=v.slice(E,j.start),k[T++]=j.replacement,E=j.end;return k[T]=v.slice(E),k.join("")}function wd(v){let _=Qi(v),k=new Map;if(_)for(let[E,T]of _)k.set(E,T.instances);return k}function Sd(v,_){let k=Qi(v);if(!k)return[];let E=[];for(let[T,j]of k){let B=j.instances-(_.get(T)??0);if(B>0)E.push({body:j.body,count:B})}return E}function $d(v,_){for(let{body:k,count:E}of _)for(let T=0;T<E;T++)Aa(v,k)}import Dd from"fs";var _d=0,Ia=new Map;function Fo(){_d=0,Ia.clear()}function eo(v,_){let k=_d++,E=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return Ia.set(E,{type:v,expression:_}),E}function zo(){let v={};for(let[_,k]of Ia)v[_]={type:k.type,expression:k.expression};return v}function Ho(v,_){let k=v;for(let[E,T]of _)k=k.split(E).join(T);return k}function Yr(v){return v.includes("<!--__STX_")}var my=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function hy(v){return Array.from({length:v},()=>"{").join("⁠")}function kd(v){return v.replace(/\{{2,}/g,(_)=>hy(_.length)).replace(/\{(?=!)/g,"{⁠").replace(my,"@")}var yy=/^(?:javascript|vbscript|livescript|mocha|view-source):/,xy=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,by=/^data:(?:text\/html|application\/xhtml\+xml)/,vy=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function wy(v){return v.replace(vy,"").toLowerCase()}function Sy(v){let _=v.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(_))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(_))return"fetched";return null}function Ed(v,_="navigable"){let k=wy(v);if(yy.test(k))return!0;return _==="navigable"?xy.test(k):by.test(k)}function Gs(v,_="navigable"){return Ed(v,_)?"unsafe:"+v:v}function $y(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return Sy(_[1])}function Pa(v,_,k=256){if(_<=k)return v.slice(0,_);let E=v.slice(_-k,_),T=E.search(/[\s"'`/]/);return T===-1?"":E.slice(T)}function Da(v,_,k=_){let E=$y(v);return E&&Ed(_,E)?"unsafe:"+k:k}var to=/<script\b[^>]*>/iy,ja=/<\/script\s*>/ig,no=/<style\b[^>]*>/iy,La=/<\/style\s*>/ig;function Cd(v,_,k,E){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;E.lastIndex=k.lastIndex;let j=E.exec(v);if(!j)return-1;return j.index+j[0].length}function Y(v,_){return Cd(v,_,to,ja)}function vs(v,_){return Cd(v,_,no,La)}function Le(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function Rd(v,_){if(v.startsWith("<!--",_)){let T=Le(v,_);return T===-1?v.length:T}if(to.lastIndex=_,to.exec(v)?.index===_){ja.lastIndex=to.lastIndex;let T=ja.exec(v);return T?T.index+T[0].length:v.length}if(no.lastIndex=_,no.exec(v)?.index===_){La.lastIndex=no.lastIndex;let T=La.exec(v);return T?T.index+T[0].length:v.length}return-1}function lr(v,_){let k=[],E=0,T=v.length,j=!1,B=null;while(E<T){let z=v[E];if(j){if(B){if(z===B)B=null}else if(z==='"'||z==="'")B=z;else if(z===">")j=!1;E++;continue}if(z!=="<"){let G=v.indexOf("<",E+1);if(G===-1)break;E=G;continue}let F=_(v,E);if(F>E){k.push({start:E,end:F,token:v.slice(E,F)}),E=F;continue}let V=Rd(v,E);if(V>E){E=V;continue}let H=v.charCodeAt(E+1);if(H>=65&&H<=90||H>=97&&H<=122)j=!0;E++}return k}function Td(v){let _=0,k=0,E=0,T=!1,j=null;while(E<v.length){if(T){let G=v[E];if(j){if(G===j)j=null}else if(G==='"'||G==="'")j=G;else if(G===">")T=!1;E++;continue}let B=v.indexOf("<",E),z=B===-1?v.length:B;while(E<z){let G=v[E++];if(G==="{")_++;else if(G==="}")k++;if(_>=2&&k>=2)return!0}if(B===-1)break;let F=Rd(v,B);if(F>B){E=F;continue}let V=v.charCodeAt(B+1),H=V===47?v.charCodeAt(B+2):V;if(H>=65&&H<=90||H>=97&&H<=122)T=!0;E=B+1}return!1}function Ad(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var _y=1024,ky=16777216,qr=new Map,Ma=0;function Ey(v,_){qr.set(v,_),Ma+=v.length+_.output.length;for(let[k,E]of qr){if(Ma<=ky)break;qr.delete(k),Ma-=k.length+E.output.length}}function En(v,_,k,E){let T=E!==void 0&&v.length>=_y,j=T?`${E}\x00${v}`:"";if(T){let H=qr.get(j);if(H)return qr.delete(j),qr.set(j,H),{output:H.output,tokens:H.tokens.slice()}}let B=lr(v,_);if(B.length===0)return{output:v,tokens:[]};let z=B.map((H)=>H.token),F="",V=0;for(let H=0;H<B.length;H++){let G=B[H];F+=v.slice(V,G.start),F+=k(G.token,H),V=G.end}if(F+=v.slice(V),T)return Ey(j,{output:F,tokens:z}),{output:F,tokens:z.slice()};return{output:F,tokens:z}}var Cy=1024,Ry=16777216,fs=new Map,Oa=0;function Ty(v,_){fs.set(v,_),Oa+=v.length+_.output.length;for(let[k,E]of fs){if(Oa<=Ry)break;fs.delete(k),Oa-=k.length+E.output.length}}function Na(v,_,k){return{output:_,scripts:k,restore:(E)=>E===_?v:Ss(E,k)}}function xn(v){let _=v.length>=Cy;if(_){let T=fs.get(v);if(T)return fs.delete(v),fs.set(v,T),Na(v,T.output,T.scripts.slice())}let{output:k,tokens:E}=En(v,Y,(T,j)=>`\x00STX_SCRIPT_${j}\x00`);if(_)return Ty(v,{output:k,scripts:E}),Na(v,k,E.slice());return Na(v,k,E)}function Ss(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,E)=>_[+E]??"")}function vt(v){let _=v.indexOf(" as ");if(_!==-1){let j=v.slice(0,_).trim(),B=v.slice(_+4).trim();return j&&B?{arrayExpr:j,itemVar:B}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(v);if(!k)return null;let E=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),T=k[2].trim();return E&&T?{arrayExpr:T,itemVar:E}:null}function ro(v){let _=[],k=0,E="",T=0;for(let j=0;j<v.length;j++){let B=v[j];if(E){if(B==="\\")j++;else if(B===E)E="";continue}if(B==="'"||B==='"'||B==="`")E=B;else if(B==="("||B==="["||B==="{")k++;else if(B===")"||B==="]"||B==="}")k--;else if(B===","&&k===0)_.push(v.slice(T,j)),T=j+1}return _.push(v.slice(T)),_}function Id(v,_){let k=0;for(let E=0;E<v.length;E++){let T=v[E];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===_&&k===0)return E}return-1}function Pd(v){let _=0;for(let k=0;k<v.length;k++){let E=v[k];if(E==="("||E==="["||E==="{")_++;else if((E===")"||E==="]"||E==="}")&&--_===0)return k}return-1}function Cr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),E=Id(k,"=");if(E!==-1&&k[E+1]!==">")k=k.slice(0,E).trim();if(!k)return;if(k.startsWith("{")&&k.endsWith("}")){for(let T of ro(k.slice(1,-1))){let j=T.trim();if(!j)continue;if(j.startsWith("...")){Cr(j,_);continue}let B=Id(j,":");Cr(B===-1?j:j.slice(B+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of ro(k.slice(1,-1)))Cr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function Is(v){let _=v.trim(),k=[],E=0;for(let j=0;j<_.length;j++){let B=_[j];if(B==="("||B==="["||B==="{")E++;else if(B===")"||B==="]"||B==="}")E--;else if(E===0&&/\s/.test(B)){if(!/^\s+(?:in|of)\s/.exec(_.slice(j)))continue;let F=_.slice(0,j).trim();if(F.startsWith("(")&&Pd(F)===F.length-1)F=F.slice(1,-1);for(let V of ro(F))Cr(V,k);if(k.length>0)return k;break}}let T=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(_);if(T){let j=T[1].trim();if(j.startsWith("(")&&Pd(j)===j.length-1)j=j.slice(1,-1);let B=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(j);if(B)Cr(B[2],k),Cr(B[1],k);else for(let z of ro(j))Cr(z,k)}return k}function Rr(v,_){let k=_ instanceof Set?_:new Set(_);if(k.size===0)return!1;let B=v.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let z of B.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(z))return!0;return!1}var so="__stx_client_loop_names";function fr(v){let _=v?.[so];return Array.isArray(_)?_:[]}var Ys={},Md=new Map;function Ay(v){let _=Md.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),Md.set(v,_)}return _.lastIndex=0,_}var On={uppercase:(v,_)=>v!==void 0&&v!==null?String(v).toUpperCase():"",lowercase:(v,_)=>v!==void 0&&v!==null?String(v).toLowerCase():"",capitalize:(v,_)=>{if(v===void 0||v===null)return"";let k=String(v);return k.charAt(0).toUpperCase()+k.slice(1)},number:(v,_,k=0)=>{if(v===void 0||v===null)return"";try{let E=Number(v);return Number.isNaN(E)?"":E.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(v,_,k="en-US")=>{if(v===void 0||v===null)return"";try{let E=Number(v);if(Number.isNaN(E))return String(v);return E.toLocaleString(k)}catch{return String(v)}},join:(v,_,k=",")=>{if(!Array.isArray(v))return"";return v.join(String(k))},escape:(v,_)=>{if(v===void 0||v===null)return"";return xt(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let E=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,j=String(v).split("."),B=E;for(let F of j){if(B===void 0||B===null)break;B=B[F]}if(B===void 0||B===null)return T?v:"";let z=String(B);return Object.entries(k).forEach(([F,V])=>{z=z.replace(Ay(F),String(V))}),z},t:(v,_,k={})=>On.translate(v,_,k),truncate:(v,_,k=50,E="...")=>{if(v===void 0||v===null)return"";let T=String(v);if(T.length<=k)return T;if(k<=E.length)return E.substring(0,k);return T.substring(0,k-E.length)+E},date:(v,_,k="short",E="en-US")=>{if(v===void 0||v===null)return"";try{let T=v instanceof Date?v:new Date(v);if(Number.isNaN(T.getTime()))return String(v);let j={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(k==="iso")return T.toISOString();return new Intl.DateTimeFormat(E,j[k]||j.short).format(T)}catch{return String(v)}},currency:(v,_,k="USD",E="en-US")=>{if(v===void 0||v===null)return"";try{let T=Number(v);if(Number.isNaN(T))return String(v);return new Intl.NumberFormat(E,{style:"currency",currency:k}).format(T)}catch{return String(v)}},pluralize:(v,_,k,E)=>{let T=Number(v);if(Number.isNaN(T))return k;let j=E||`${k}s`;return T===1?k:j},first:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[0];return String(v).charAt(0)},last:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[v.length-1];let k=String(v);return k.charAt(k.length-1)},length:(v,_)=>{if(v===void 0||v===null)return 0;if(Array.isArray(v)||typeof v==="string")return v.length;if(v instanceof Map||v instanceof Set)return v.size;if(typeof v==="object")return Object.keys(v).length;return 0},json:(v,_,k=!1)=>{if(v===void 0)return"undefined";if(v===null)return"null";try{return k?JSON.stringify(v,null,2):JSON.stringify(v)}catch{return String(v)}},default:(v,_,k="")=>v===void 0||v===null||v===""?k:v,reverse:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return[...v].reverse();return String(v).split("").reverse().join("")},slice:(v,_,k=0,E)=>{if(v===void 0||v===null)return"";if(Array.isArray(v)||typeof v==="string")return v.slice(k,E);return v},replace:(v,_,k,E="")=>{if(v===void 0||v===null)return"";let T=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(v).replace(new RegExp(T,"g"),()=>E)},stripTags:(v,_)=>{if(v===void 0||v===null)return"";return String(v).replace(/<[^>]*>/g,"")},urlencode:(v,_)=>{if(v===void 0||v===null)return"";return encodeURIComponent(String(v))},abs:(v,_)=>{let k=Number(v);return Number.isNaN(k)?0:Math.abs(k)},round:(v,_,k=0)=>{let E=Number(v);if(Number.isNaN(E))return 0;let T=10**k;return Math.round(E*T)/T}};function Ua(v,_){if(v in On)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);Ys[v]=_}function xu(v){for(let[_,k]of Object.entries(v))Ua(_,k)}function Wa(){return{...On,...Ys}}function Su(){for(let v of Object.keys(Ys))delete Ys[v]}function qa(v,_,k=2){let E=0,T=null;for(let j=_+k;j<v.length;j++){let B=v[j];if(T){if(B==="\\"){j++;continue}if(B===T)T=null;continue}if(B==='"'||B==="'"||B==="`"){T=B;continue}if(B==="{"){E++;continue}if(B==="}"){if(E>0){E--;continue}let z=0;while(v[j+z]==="}")z++;if(z>=k)return j}}return-1}function Mn(v,_,k=2){let E="{".repeat(k);if(!v.includes(E))return v;let T="",j=0;for(;;){let B=v.indexOf(E,j);if(B===-1)break;let z=qa(v,B,k);if(z===-1)break;T+=v.slice(j,B)+_(v.slice(B,z+k),v.slice(B+k,z),B),j=z+k}return j===0?v:T+v.slice(j)}function b(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function xt(v){return kd(b(v))}function ye(v,_){let{scripts:k}=xn(v);for(let E of k){let T=E.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!T||/\bserver\b|\bsrc\s*=/.test(T[1]))continue;let j=T[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(j))return!0;if(mn(j,_))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(v))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(v))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(v))return!0;return!1}function Ka(v){let _=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let E=k.exec(v);E;E=k.exec(v)){let T=E[1].toLowerCase(),j=new Set(Is(E[3]));if(j.size===0)continue;let B=E.index+E[0].length;if(E[0].endsWith("/>")){_.push({start:E.index,end:B,names:j});continue}let z=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");z.lastIndex=B;let F=1,V=v.length;for(let H=z.exec(v);H;H=z.exec(v)){if(H[2]==="/")continue;if(F+=H[1]==="/"?-1:1,F===0){V=H.index+H[0].length;break}}_.push({start:E.index,end:V,names:j})}return _}function Iy(v,_,k){let E=s(k);for(let T of v){if(_<T.start||_>=T.end)continue;for(let j of T.names)if(new RegExp(`(?<![.#\\w$])${j.replace(/\$/g,"\\$")}(?![\\w$])`).test(E))return!0}return!1}function Od(v,_){let k=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],E=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",j=!1,B=0;for(let V=0;V<E.length;V++){let H=E[V];if(!j&&H==="`"){j=!0,B=0;continue}if(j){if(H==="`"&&B===0){j=!1;continue}if(H==="$"&&E[V+1]==="{"){B++,V++,T+=" ";continue}if(H==="}"&&B>0){B--;continue}if(B>0){T+=H;continue}continue}T+=H}E=T;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,F;while((F=z.exec(E))!==null){let V=F[1];if(!E.substring(0,F.index).trimEnd().endsWith(".")){if(!k.includes(V)&&!(V in _))return!1}}return!0}function Py(v,_){let k=_.__stx_serverDeclared;if(!k||k.size===0)return!1;let E=s(v);for(let T of k)if(new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(E))return!0;return!1}var Nd=new Set;function jd(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function Ld(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!Nd.has(k))Nd.add(k),console.warn(`[stx] {{ ${v} }} in a <script> in ${_??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function Zr(v,_,k){let E=v;return E=E.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>{try{let B=x(j,_);if(B===void 0)return jd(j)?Ld(j.trim(),k):T;return B===null?"":String(B)}catch{return T}}),E=Mn(E,(T,j,B)=>{let z=j.trim();if(/^__[A-Z_]+__$/.test(z))return T;try{let F=x(j,_);if(F===void 0)return jd(z)?Ld(z,k):T;return JSON.stringify(F).replace(/</g,"\\u003c")}catch{return T}}),E}function Xa(v,_){if(!v.includes("{"))return v;let k=v;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(E,T)=>{try{let j=x(T,_);if(j===void 0)return E;return j===null?"":String(j)}catch{return E}}),k=Mn(k,(E,T,j)=>{let B=T.trim();if(/^__[A-Z_]+__$/.test(B))return E;try{let z=x(T,_);if(z===void 0)return E;if(z===null)return"";let F=String(z);return Da(Pa(k,j),F,xt(F))}catch{return E}}),k}function ku(v,_,k={}){let{output:E,scripts:T}=xn(v),j=T.map((B)=>{let z=B.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),F=B.match(/^<script\b[^>]*>/i),V=B.search(/<\/script\s*>$/i);if(!z||!F||V===-1)return B;let H=z[1],G=z[2];if(/\bdata-raw\b/.test(H))return B;if(k.skipServer&&/\bserver\b/.test(H))return B;let J=`<script${Xa(H,_)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return J+G+B.slice(V);return J+Zr(G,_)+B.slice(V)});return Ss(E,j)}function q(v,_,k){let E=v,T=(J,re)=>{let se=vs(J,re);if(se===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(J.slice(re,se))?-1:se},j=(J,re,se,ie)=>{let oe=se.length,{output:de,tokens:ae}=En(J,re,(me,ve)=>ie(oe+ve));return se.push(...ae),de},B=[];E=j(E,T,B,(J)=>`<!--__STX_STYLE_${J}__-->`);let z=[];E=j(E,Y,z,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`);let F=_?.__stx_signals_gate===!0||ye(v),V=new Set(Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[]),H=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);E=Mn(E,(J,re,se)=>{try{let ie=x(re,_,!1,(oe)=>Ba(oe,J,k,v));return ie!==void 0&&ie!==null?String(ie):""}catch(ie){let oe=ie instanceof Error?ie.message:String(ie);return g("Expression",`Error evaluating: {{{ ${re.trim()}}}}: ${oe}`,k,v,se,J)}},3),E=E.replace(/\{!!([\s\S]*?)!!\}/g,(J,re,se)=>{try{let ie=x(re,_,!1,(oe)=>Ba(oe,J,k,v));if(ie===void 0&&_.__stx_buildMode==="compile")return eo("raw",re.trim());return ie!==void 0&&ie!==null?String(ie):""}catch(ie){if(_.__stx_buildMode==="compile")return eo("raw",re.trim());let oe=ie instanceof Error?ie.message:String(ie);return g("Expression",`Error evaluating: {!! ${re.trim()} !!}: ${oe}`,k,v,se,J)}}),E=j(E,Y,z,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`),E=j(E,T,B,(J)=>`<!--__STX_STYLE_${J}__-->`);let G=F?Ka(E):[],ne=new Set(fr(_));if(E=Mn(E,(J,re,se)=>{let ie=re.trim();if(Rr(ie,ne))return J;if(G.length>0&&Iy(G,se,ie))return J;if(H.has(ie))return J;let oe=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],de=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,me=ie.match(de)?.[1],ve=me&&((me in _)||oe.includes(me)),Se=Boolean(me&&V.has(me)),$e=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Re=ie.match($e),Ee=Re&&!oe.includes(Re[1])&&!(Re[1]in _);if(/^__[A-Z_]+__$/.test(ie))return"";let Te;try{let Ce=x(re,_,!1,(Ie)=>{Te=Ie});if(Se)return J;if(F&&!Od(ie,_))return J;if(Te)Ba(Te,J,k,v);if(_.__stx_buildMode==="compile"&&!F&&(Ce===void 0||Py(ie,_)))return eo("expr",ie);if(Ce===void 0||Ce===null)return"";let _e=String(Ce);return Da(Pa(E,se),_e,xt(_e))}catch(Ce){if(Se)return J;if(F&&!Od(ie,_))return J;if(Ee)return J;let _e=Ce instanceof Error?Ce.message:String(Ce);return g("Expression",`Error evaluating: {{ ${ie} }}: ${_e}`,k,v,se,J)}}),z.length>0)E=E.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(J,re)=>z[Number(re)]??J);if(B.length>0)E=E.replace(/<!--__STX_STYLE_(\d+)__-->/g,(J,re)=>B[Number(re)]??J);return E}function Ga(v,_,k){if(!_.trim())return v;let E=v,T=_.trim();while(T.length>0){let j=T.match(/^(\w+)/);if(!j)break;let B=j[1];T=T.substring(B.length).trim();let z=Ys[B]||On[B];if(!z)throw Error(`Filter not found: ${B}. Available filters: ${Object.keys(Wa()).join(", ")}`);let F=[];if(T.startsWith(":")){let V=T.match(/^:([^|\s]+)/);if(V){let H=V[1].trim();try{let G=Number(H);F=[Number.isNaN(G)?H:G]}catch{F=[H]}T=T.substring(V[0].length).trim()}}else if(T.startsWith("(")){let V=1,H=1;while(V>0&&H<T.length){if(T[H]==="(")V++;if(T[H]===")")V--;H++}if(V===0){let G=T.substring(1,H-1).trim();if(G)try{if(G.startsWith("{")&&G.endsWith("}"))F=[x(`(${G})`,k,!0)];else{let ne=[],J="",re=null,se=0,ie=0,oe=0,de=!1;for(let ae=0;ae<G.length;ae++){let me=G[ae];if(de){J+=me,de=!1;continue}if(me==="\\"){J+=me,de=!0;continue}if(re){if(J+=me,me===re)re=null;continue}if(me==='"'||me==="'"||me==="`"){re=me,J+=me;continue}if(me==="(")se++;else if(me===")")se--;else if(me==="[")ie++;else if(me==="]")ie--;else if(me==="{")oe++;else if(me==="}")oe--;if(me===","&&se===0&&ie===0&&oe===0){ne.push(J),J="";continue}J+=me}if(J)ne.push(J);F=ne.map((ae)=>{let me=ae.trim();return x(me,k,!0)})}}catch{F=[G]}T=T.substring(H).trim()}}try{E=z(E,k,...F)}catch(V){let H=V instanceof Error?V.message:String(V);throw Error(`Error applying filter '${B}': ${H}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return E}function Dy(v){let _=!1,k="",E=0,T=0,j=0,B=!1;for(let z=0;z<v.length;z++){let F=v[z],V=v[z+1];if(_&&B){B=!1;continue}if(_&&F==="\\"){B=!0;continue}if(B=!1,(F==='"'||F==="'"||F==="`")&&!B){if(!_)_=!0,k=F;else if(F===k)_=!1,k="";continue}if(_&&k==="`"&&F==="$"&&V==="{"){let H=1;z+=2;while(z<v.length&&H>0){if(v[z]==="{")H++;else if(v[z]==="}")H--;if(H>0)z++}continue}if(_)continue;if(F==="(")E++;else if(F===")")E--;else if(F==="[")T++;else if(F==="]")T--;else if(F==="{")j++;else if(F==="}")j--;if(F==="|"&&E===0&&T===0&&j===0){if(V==="|"){z++;continue}if(V==="="){z++;continue}return z}}return-1}var Js=new Set,My=1000;function Cu(){Js.clear()}function Ba(v,_,k,E){if(!O())return;let T=`${k}\x00${v.expression}`;if(Js.has(T))return;if(Js.size>=My)Js.clear();Js.add(T);let j=k,B=E;try{if(k&&Dd.existsSync(k))B=Dd.readFileSync(k,"utf8")}catch{}let z=B.indexOf(_);if(z>=0)j=`${k}:${B.slice(0,z).split(`
|
|
858
|
-
`).length}`;console.warn(`${j}: stx warning: ${_} rendered as an empty string. The safe evaluator rejected \`${v.expression}\` (${v.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function x(v,_,k=!1,E){try{let T=v.trim(),j=Dy(T);if(j>0){let z=T.substring(0,j).trim(),F=T.substring(j+1).trim(),V=x(z,_,!0,E);return Ga(V,F,_)}let B=fn(T);if(B!==null){E?.({expression:T,rule:B});return}try{let z=Object.keys(_),F=Object.values(_);return l(T,z)(...F)}catch{return c(T,_)}}catch(T){if(T instanceof ReferenceError){let j=/(\b\w+)\s+is not defined/.exec(T.message);if(j){let B=j[1],z=Oy(B,Object.keys(_));if(z&&z!==B)T.message=`${T.message} \u2014 did you mean '${z}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function Oy(v,_){let k=null;for(let T of _){if(T===v)continue;let j=Ny(v,T);if(k===null||j<k.dist)k={key:T,dist:j}}if(!k)return null;let E=Math.max(v.length,k.key.length);if(k.dist<=2||k.dist/E<=0.35)return k.key;return null}function Ny(v,_){if(v===_)return 0;if(v.length===0)return _.length;if(_.length===0)return v.length;let[k,E]=v.length<_.length?[v,_]:[_,v],T=Array(k.length+1),j=Array(k.length+1);for(let B=0;B<=k.length;B++)T[B]=B;for(let B=1;B<=E.length;B++){j[0]=B;for(let z=1;z<=k.length;z++){let F=k[z-1]===E[B-1]?0:1;j[z]=Math.min(j[z-1]+1,T[z]+1,T[z-1]+F)}for(let z=0;z<=k.length;z++)T[z]=j[z]}return T[k.length]}function $u(v){if(!v)return"";return v.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import vS from"fs";import Jt from"path";import hi from"fs";import It from"path";import{hasLocalConfig as ff}from"bunfig";import Cn from"fs";import Ar from"path";import za from"fs";import Bd from"path";import{fileURLToPath as jy}from"url";var Fa;function Me(){if(Fa)return Fa;let v="unknown";try{v=String(JSON.parse(za.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=Bd.dirname(jy(import.meta.url)),k=0;for(let E of za.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(E.isFile()&&E.name.endsWith(".ts"))k=Math.max(k,za.statSync(Bd.join(E.parentPath,E.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return Fa=v,v}var Ja=new Map,Ir=new Map;async function Eu(v){let k;for(let E=0;E<3;E++)try{let j=(await Cn.promises.stat(v)).mtime.getTime(),B=Ir.get(v);if(B&&B.mtime===j)return B.content;let z=await Bun.file(v).text(),V=(await Cn.promises.stat(v)).mtime.getTime();if(V!==j)continue;return Ir.set(v,{content:z,mtime:V}),z}catch(T){k=T;break}throw Ir.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function _u(v){Ir.delete(v)}function Tu(v){for(let _ of Ir.keys())if(_.startsWith(v))Ir.delete(_)}var io=null,Ly=null,Fd=null;function Ru(v){Fd=v}async function Ya(v=!1){let _=Fd??await import("./chunk-sw168dnp.js");if(v)return _.generateSignalsRuntimeDev();if(io===null)io=_.generateSignalsRuntime();return io}var oo=null;async function Za(){if(oo===null){let{getRouterScript:v}=await import("./chunk-ecr642nj.js");oo=v()}return oo}var zd={};async function Au(v,_=!1){let k=v==="runtime"?await Ya(_):await Za(),E=v==="runtime"&&_?"runtime-debug":v,T=zd[E];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},zd[E]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var By=500,Tr=new Map;function Wd(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function Pu(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=Tr.has(_);if(k)Tr.delete(_);Tr.set(_,v);while(Tr.size>By)Tr.delete(Tr.keys().next().value);if(!k)try{let E=Wd(_);if(!Cn.existsSync(E))Cn.mkdirSync(Ar.dirname(E),{recursive:!0}),Cn.writeFileSync(E,v)}catch{}return`/_stx/modules.${_}.js`}function Vo(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=Tr.get(v);if(_!==void 0)return _;try{return Cn.readFileSync(Wd(v),"utf8")}catch{return}}function Iu(){Ir.clear(),ee(),dd(),io=null,Ly=null,oo=null}function Vd(v){let _={debug:v.debug===!0,middleware:(v.middleware??[]).map((k)=>({name:k.name,timing:k.timing,handler:String(k.handler)})),customDirectives:(v.customDirectives??[]).map((k)=>({name:k.name,hasEndTag:k.hasEndTag===!0,rawParams:k.rawParams===!0,handler:String(k.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(_)).digest("hex")}async function en(v,_){try{if(!_.cachePath)return null;let k=Ar.resolve(_.cachePath),E=Ar.join(k,`${Nn(v)}.html`),T=Ar.join(k,`${Nn(v)}.meta.json`);if(!await r(E)||!await r(T))return null;let j=await Bun.file(T).text(),B=JSON.parse(j);if(B.cacheVersion!==_.cacheVersion)return null;if(B.engine!==Me())return null;if(B.optionsSignature!==Vd(_))return null;if((await Cn.promises.stat(v)).mtime.getTime()>B.mtime)return null;for(let F of B.dependencies)if(await r(F)){if((await Cn.promises.stat(F)).mtime.getTime()>B.mtime)return null}else return null;return await Bun.file(E).text()}catch(k){return console.warn(`Cache error for ${v}:`,k),null}}async function tn(v,_,k,E){try{if(!E.cachePath)return;let T=Ar.resolve(E.cachePath);await Cn.promises.mkdir(T,{recursive:!0});let j=Ar.join(T,`${Nn(v)}.html`),B=Ar.join(T,`${Nn(v)}.meta.json`),z=await Cn.promises.stat(v);await Bun.write(j,_);let F={sourcePath:v,mtime:z.mtime.getTime(),dependencies:Array.from(k),cacheVersion:E.cacheVersion,engine:Me(),optionsSignature:Vd(E),generatedAt:Date.now()};await Bun.write(B,JSON.stringify(F,null,2)),Ja.set(v,{output:_,mtime:z.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var zy=16;function Nn(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,zy)}var Ln={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function Ha(v){return`--stx-${v}`}function Rc(v,_){let k=_.lastIndexOf("-");if(k===-1)return typeof v[_]==="string"?v[_]:void 0;let E=v[_.slice(0,k)];if(!E||typeof E!=="object")return;let T=E[_.slice(k+1)];return typeof T==="string"?T:void 0}function Ud(v){let _={};for(let[k,E]of Object.entries(Ln)){let T=Rc(v,E.light);if(T===void 0)continue;_[k]=`var(${Ha(k)}, ${T})`}return _}function Hd(v){let _=[],k=[];for(let[E,T]of Object.entries(Ln)){let j=Rc(v,T.light),B=Rc(v,T.dark);if(j===void 0)continue;if(_.push(` ${Ha(E)}: ${j};`),B!==void 0)k.push(` ${Ha(E)}: ${B};`)}if(_.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",..._,"}",".dark {",...k,"}",""].join(`
|
|
859
|
-
`)}var
|
|
860
|
-
`)}var
|
|
861
|
-
`)}function
|
|
862
|
-
`:k}function
|
|
863
|
-
|
|
864
|
-
`)}function
|
|
865
|
-
`)})}else _.push({selector:`@${H} ${G.trim()}`,declarations:ne.trim()})}B="",j=!1}else if(T.trim()){T+=F;let V=T.match(/([^{]+)\{([^}]*)\}/);if(V)_.push({selector:V[1].trim(),declarations:V[2].trim()});T=""}continue}}if(j)B+=F;else T+=F}return _}function
|
|
856
|
+
`}),Sd(v,T)}function Sd(v,_){if(_.length===0)return v;_.sort((j,B)=>j.start-B.start||j.end-B.end);let k=Array(_.length*2+1),E=0,T=0;for(let j of _)k[T++]=v.slice(E,j.start),k[T++]=j.replacement,E=j.end;return k[T]=v.slice(E),k.join("")}function kd(v){let _=to(v),k=new Map;if(_)for(let[E,T]of _)k.set(E,T.instances);return k}function Ed(v,_){let k=to(v);if(!k)return[];let E=[];for(let[T,j]of k){let B=j.instances-(_.get(T)??0);if(B>0)E.push({body:j.body,count:B})}return E}function Cd(v,_){for(let{body:k,count:E}of _)for(let T=0;T<E;T++)Pa(v,k)}import jd from"fs";var Rd=0,Da=new Map;function Fo(){Rd=0,Da.clear()}function no(v,_){let k=Rd++,E=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return Da.set(E,{type:v,expression:_}),E}function zo(){let v={};for(let[_,k]of Da)v[_]={type:k.type,expression:k.expression};return v}function Ho(v,_){let k=v;for(let[E,T]of _)k=k.split(E).join(T);return k}function Yr(v){return v.includes("<!--__STX_")}var xy=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function by(v){return Array.from({length:v},()=>"{").join("⁠")}function Td(v){return v.replace(/\{{2,}/g,(_)=>by(_.length)).replace(/\{(?=!)/g,"{⁠").replace(xy,"@")}var vy=/^(?:javascript|vbscript|livescript|mocha|view-source):/,wy=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Sy=/^data:(?:text\/html|application\/xhtml\+xml)/,$y=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function _y(v){return v.replace($y,"").toLowerCase()}function ky(v){let _=v.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(_))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(_))return"fetched";return null}function Ad(v,_="navigable"){let k=_y(v);if(vy.test(k))return!0;return _==="navigable"?wy.test(k):Sy.test(k)}function Js(v,_="navigable"){return Ad(v,_)?"unsafe:"+v:v}function Ey(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return ky(_[1])}function Ma(v,_,k=256){if(_<=k)return v.slice(0,_);let E=v.slice(_-k,_),T=E.search(/[\s"'`/]/);return T===-1?"":E.slice(T)}function Oa(v,_,k=_){let E=Ey(v);return E&&Ad(_,E)?"unsafe:"+k:k}var ro=/<script\b[^>]*>/iy,Ba=/<\/script\s*>/ig,so=/<style\b[^>]*>/iy,za=/<\/style\s*>/ig;function Id(v,_,k,E){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;E.lastIndex=k.lastIndex;let j=E.exec(v);if(!j)return-1;return j.index+j[0].length}function Y(v,_){return Id(v,_,ro,Ba)}function Ss(v,_){return Id(v,_,so,za)}function Le(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function Pd(v,_){if(v.startsWith("<!--",_)){let T=Le(v,_);return T===-1?v.length:T}if(ro.lastIndex=_,ro.exec(v)?.index===_){Ba.lastIndex=ro.lastIndex;let T=Ba.exec(v);return T?T.index+T[0].length:v.length}if(so.lastIndex=_,so.exec(v)?.index===_){za.lastIndex=so.lastIndex;let T=za.exec(v);return T?T.index+T[0].length:v.length}return-1}function lr(v,_){let k=[],E=0,T=v.length,j=!1,B=null;while(E<T){let z=v[E];if(j){if(B){if(z===B)B=null}else if(z==='"'||z==="'")B=z;else if(z===">")j=!1;E++;continue}if(z!=="<"){let G=v.indexOf("<",E+1);if(G===-1)break;E=G;continue}let F=_(v,E);if(F>E){k.push({start:E,end:F,token:v.slice(E,F)}),E=F;continue}let V=Pd(v,E);if(V>E){E=V;continue}let H=v.charCodeAt(E+1);if(H>=65&&H<=90||H>=97&&H<=122)j=!0;E++}return k}function Dd(v){let _=0,k=0,E=0,T=!1,j=null;while(E<v.length){if(T){let G=v[E];if(j){if(G===j)j=null}else if(G==='"'||G==="'")j=G;else if(G===">")T=!1;E++;continue}let B=v.indexOf("<",E),z=B===-1?v.length:B;while(E<z){let G=v[E++];if(G==="{")_++;else if(G==="}")k++;if(_>=2&&k>=2)return!0}if(B===-1)break;let F=Pd(v,B);if(F>B){E=F;continue}let V=v.charCodeAt(B+1),H=V===47?v.charCodeAt(B+2):V;if(H>=65&&H<=90||H>=97&&H<=122)T=!0;E=B+1}return!1}function Md(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var Cy=1024,Ry=16777216,fs=new Map,Na=0;function Ty(v,_){fs.set(v,_),Na+=v.length+_.output.length;for(let[k,E]of fs){if(Na<=Ry)break;fs.delete(k),Na-=k.length+E.output.length}}function En(v,_,k,E){let T=E!==void 0&&v.length>=Cy,j=T?`${E}\x00${v}`:"";if(T){let H=fs.get(j);if(H)return fs.delete(j),fs.set(j,H),{output:H.output,tokens:H.tokens.slice()}}let B=lr(v,_);if(B.length===0)return{output:v,tokens:[]};let z=B.map((H)=>H.token),F="",V=0;for(let H=0;H<B.length;H++){let G=B[H];F+=v.slice(V,G.start),F+=k(G.token,H),V=G.end}if(F+=v.slice(V),T)return Ty(j,{output:F,tokens:z}),{output:F,tokens:z.slice()};return{output:F,tokens:z}}var Ay=1024,Iy=16777216,vs=new Map,ja=0;function Py(v,_){vs.set(v,_),ja+=v.length+_.output.length;for(let[k,E]of vs){if(ja<=Iy)break;vs.delete(k),ja-=k.length+E.output.length}}function La(v,_,k){return{output:_,scripts:k,restore:(E)=>E===_?v:Is(E,k)}}function xn(v){let _=v.length>=Ay;if(_){let T=vs.get(v);if(T)return vs.delete(v),vs.set(v,T),La(v,T.output,T.scripts.slice())}let{output:k,tokens:E}=En(v,Y,(T,j)=>`\x00STX_SCRIPT_${j}\x00`);if(_)return Py(v,{output:k,scripts:E}),La(v,k,E.slice());return La(v,k,E)}function Is(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,E)=>_[+E]??"")}function vt(v){let _=v.indexOf(" as ");if(_!==-1){let j=v.slice(0,_).trim(),B=v.slice(_+4).trim();return j&&B?{arrayExpr:j,itemVar:B}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(v);if(!k)return null;let E=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),T=k[2].trim();return E&&T?{arrayExpr:T,itemVar:E}:null}function io(v){let _=[],k=0,E="",T=0;for(let j=0;j<v.length;j++){let B=v[j];if(E){if(B==="\\")j++;else if(B===E)E="";continue}if(B==="'"||B==='"'||B==="`")E=B;else if(B==="("||B==="["||B==="{")k++;else if(B===")"||B==="]"||B==="}")k--;else if(B===","&&k===0)_.push(v.slice(T,j)),T=j+1}return _.push(v.slice(T)),_}function Od(v,_){let k=0;for(let E=0;E<v.length;E++){let T=v[E];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===_&&k===0)return E}return-1}function Nd(v){let _=0;for(let k=0;k<v.length;k++){let E=v[k];if(E==="("||E==="["||E==="{")_++;else if((E===")"||E==="]"||E==="}")&&--_===0)return k}return-1}function Cr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),E=Od(k,"=");if(E!==-1&&k[E+1]!==">")k=k.slice(0,E).trim();if(!k)return;if(k.startsWith("{")&&k.endsWith("}")){for(let T of io(k.slice(1,-1))){let j=T.trim();if(!j)continue;if(j.startsWith("...")){Cr(j,_);continue}let B=Od(j,":");Cr(B===-1?j:j.slice(B+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of io(k.slice(1,-1)))Cr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function Ms(v){let _=v.trim(),k=[],E=0;for(let j=0;j<_.length;j++){let B=_[j];if(B==="("||B==="["||B==="{")E++;else if(B===")"||B==="]"||B==="}")E--;else if(E===0&&/\s/.test(B)){if(!/^\s+(?:in|of)\s/.exec(_.slice(j)))continue;let F=_.slice(0,j).trim();if(F.startsWith("(")&&Nd(F)===F.length-1)F=F.slice(1,-1);for(let V of io(F))Cr(V,k);if(k.length>0)return k;break}}let T=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(_);if(T){let j=T[1].trim();if(j.startsWith("(")&&Nd(j)===j.length-1)j=j.slice(1,-1);let B=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(j);if(B)Cr(B[2],k),Cr(B[1],k);else for(let z of io(j))Cr(z,k)}return k}function Rr(v,_){let k=_ instanceof Set?_:new Set(_);if(k.size===0)return!1;let B=v.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let z of B.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(z))return!0;return!1}var oo="__stx_client_loop_names";function fr(v){let _=v?.[oo];return Array.isArray(_)?_:[]}var Qs={},Ld=new Map;function Dy(v){let _=Ld.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),Ld.set(v,_)}return _.lastIndex=0,_}var On={uppercase:(v,_)=>v!==void 0&&v!==null?String(v).toUpperCase():"",lowercase:(v,_)=>v!==void 0&&v!==null?String(v).toLowerCase():"",capitalize:(v,_)=>{if(v===void 0||v===null)return"";let k=String(v);return k.charAt(0).toUpperCase()+k.slice(1)},number:(v,_,k=0)=>{if(v===void 0||v===null)return"";try{let E=Number(v);return Number.isNaN(E)?"":E.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(v,_,k="en-US")=>{if(v===void 0||v===null)return"";try{let E=Number(v);if(Number.isNaN(E))return String(v);return E.toLocaleString(k)}catch{return String(v)}},join:(v,_,k=",")=>{if(!Array.isArray(v))return"";return v.join(String(k))},escape:(v,_)=>{if(v===void 0||v===null)return"";return xt(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let E=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,j=String(v).split("."),B=E;for(let F of j){if(B===void 0||B===null)break;B=B[F]}if(B===void 0||B===null)return T?v:"";let z=String(B);return Object.entries(k).forEach(([F,V])=>{z=z.replace(Dy(F),String(V))}),z},t:(v,_,k={})=>On.translate(v,_,k),truncate:(v,_,k=50,E="...")=>{if(v===void 0||v===null)return"";let T=String(v);if(T.length<=k)return T;if(k<=E.length)return E.substring(0,k);return T.substring(0,k-E.length)+E},date:(v,_,k="short",E="en-US")=>{if(v===void 0||v===null)return"";try{let T=v instanceof Date?v:new Date(v);if(Number.isNaN(T.getTime()))return String(v);let j={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(k==="iso")return T.toISOString();return new Intl.DateTimeFormat(E,j[k]||j.short).format(T)}catch{return String(v)}},currency:(v,_,k="USD",E="en-US")=>{if(v===void 0||v===null)return"";try{let T=Number(v);if(Number.isNaN(T))return String(v);return new Intl.NumberFormat(E,{style:"currency",currency:k}).format(T)}catch{return String(v)}},pluralize:(v,_,k,E)=>{let T=Number(v);if(Number.isNaN(T))return k;let j=E||`${k}s`;return T===1?k:j},first:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[0];return String(v).charAt(0)},last:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[v.length-1];let k=String(v);return k.charAt(k.length-1)},length:(v,_)=>{if(v===void 0||v===null)return 0;if(Array.isArray(v)||typeof v==="string")return v.length;if(v instanceof Map||v instanceof Set)return v.size;if(typeof v==="object")return Object.keys(v).length;return 0},json:(v,_,k=!1)=>{if(v===void 0)return"undefined";if(v===null)return"null";try{return k?JSON.stringify(v,null,2):JSON.stringify(v)}catch{return String(v)}},default:(v,_,k="")=>v===void 0||v===null||v===""?k:v,reverse:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return[...v].reverse();return String(v).split("").reverse().join("")},slice:(v,_,k=0,E)=>{if(v===void 0||v===null)return"";if(Array.isArray(v)||typeof v==="string")return v.slice(k,E);return v},replace:(v,_,k,E="")=>{if(v===void 0||v===null)return"";let T=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(v).replace(new RegExp(T,"g"),()=>E)},stripTags:(v,_)=>{if(v===void 0||v===null)return"";return String(v).replace(/<[^>]*>/g,"")},urlencode:(v,_)=>{if(v===void 0||v===null)return"";return encodeURIComponent(String(v))},abs:(v,_)=>{let k=Number(v);return Number.isNaN(k)?0:Math.abs(k)},round:(v,_,k=0)=>{let E=Number(v);if(Number.isNaN(E))return 0;let T=10**k;return Math.round(E*T)/T}};function Ua(v,_){if(v in On)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);Qs[v]=_}function xu(v){for(let[_,k]of Object.entries(v))Ua(_,k)}function Wa(){return{...On,...Qs}}function Su(){for(let v of Object.keys(Qs))delete Qs[v]}function qa(v,_,k=2){let E=0,T=null;for(let j=_+k;j<v.length;j++){let B=v[j];if(T){if(B==="\\"){j++;continue}if(B===T)T=null;continue}if(B==='"'||B==="'"||B==="`"){T=B;continue}if(B==="{"){E++;continue}if(B==="}"){if(E>0){E--;continue}let z=0;while(v[j+z]==="}")z++;if(z>=k)return j}}return-1}function Mn(v,_,k=2){let E="{".repeat(k);if(!v.includes(E))return v;let T="",j=0;for(;;){let B=v.indexOf(E,j);if(B===-1)break;let z=qa(v,B,k);if(z===-1)break;T+=v.slice(j,B)+_(v.slice(B,z+k),v.slice(B+k,z),B),j=z+k}return j===0?v:T+v.slice(j)}function b(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function xt(v){return Td(b(v))}function ye(v,_){let{scripts:k}=xn(v);for(let E of k){let T=E.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!T||/\bserver\b|\bsrc\s*=/.test(T[1]))continue;let j=T[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(j))return!0;if(mn(j,_))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(v))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(v))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(v))return!0;return!1}function Ka(v){let _=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let E=k.exec(v);E;E=k.exec(v)){let T=E[1].toLowerCase(),j=new Set(Ms(E[3]));if(j.size===0)continue;let B=E.index+E[0].length;if(E[0].endsWith("/>")){_.push({start:E.index,end:B,names:j});continue}let z=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");z.lastIndex=B;let F=1,V=v.length;for(let H=z.exec(v);H;H=z.exec(v)){if(H[2]==="/")continue;if(F+=H[1]==="/"?-1:1,F===0){V=H.index+H[0].length;break}}_.push({start:E.index,end:V,names:j})}return _}function My(v,_,k){let E=s(k);for(let T of v){if(_<T.start||_>=T.end)continue;for(let j of T.names)if(new RegExp(`(?<![.#\\w$])${j.replace(/\$/g,"\\$")}(?![\\w$])`).test(E))return!0}return!1}function Bd(v,_){let k=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],E=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",j=!1,B=0;for(let V=0;V<E.length;V++){let H=E[V];if(!j&&H==="`"){j=!0,B=0;continue}if(j){if(H==="`"&&B===0){j=!1;continue}if(H==="$"&&E[V+1]==="{"){B++,V++,T+=" ";continue}if(H==="}"&&B>0){B--;continue}if(B>0){T+=H;continue}continue}T+=H}E=T;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,F;while((F=z.exec(E))!==null){let V=F[1];if(!E.substring(0,F.index).trimEnd().endsWith(".")){if(!k.includes(V)&&!(V in _))return!1}}return!0}function Oy(v,_){let k=_.__stx_serverDeclared;if(!k||k.size===0)return!1;let E=s(v);for(let T of k)if(new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(E))return!0;return!1}var zd=new Set;function Fd(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function Wd(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!zd.has(k))zd.add(k),console.warn(`[stx] {{ ${v} }} in a <script> in ${_??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function Zr(v,_,k){let E=v;return E=E.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>{try{let B=x(j,_);if(B===void 0)return Fd(j)?Wd(j.trim(),k):T;return B===null?"":String(B)}catch{return T}}),E=Mn(E,(T,j,B)=>{let z=j.trim();if(/^__[A-Z_]+__$/.test(z))return T;try{let F=x(j,_);if(F===void 0)return Fd(z)?Wd(z,k):T;return JSON.stringify(F).replace(/</g,"\\u003c")}catch{return T}}),E}function Xa(v,_){if(!v.includes("{"))return v;let k=v;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(E,T)=>{try{let j=x(T,_);if(j===void 0)return E;return j===null?"":String(j)}catch{return E}}),k=Mn(k,(E,T,j)=>{let B=T.trim();if(/^__[A-Z_]+__$/.test(B))return E;try{let z=x(T,_);if(z===void 0)return E;if(z===null)return"";let F=String(z);return Oa(Ma(k,j),F,xt(F))}catch{return E}}),k}function ku(v,_,k={}){let{output:E,scripts:T}=xn(v),j=T.map((B)=>{let z=B.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),F=B.match(/^<script\b[^>]*>/i),V=B.search(/<\/script\s*>$/i);if(!z||!F||V===-1)return B;let H=z[1],G=z[2];if(/\bdata-raw\b/.test(H))return B;if(k.skipServer&&/\bserver\b/.test(H))return B;let J=`<script${Xa(H,_)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return J+G+B.slice(V);return J+Zr(G,_)+B.slice(V)});return Is(E,j)}function q(v,_,k){let E=v,T=(J,re)=>{let se=Ss(J,re);if(se===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(J.slice(re,se))?-1:se},j=(J,re,se,ie)=>{let oe=se.length,{output:de,tokens:ae}=En(J,re,(me,ve)=>ie(oe+ve));return se.push(...ae),de},B=[];E=j(E,T,B,(J)=>`<!--__STX_STYLE_${J}__-->`);let z=[];E=j(E,Y,z,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`);let F=_?.__stx_signals_gate===!0||ye(v),V=new Set(Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[]),H=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);E=Mn(E,(J,re,se)=>{try{let ie=x(re,_,!1,(oe)=>Fa(oe,J,k,v));return ie!==void 0&&ie!==null?String(ie):""}catch(ie){let oe=ie instanceof Error?ie.message:String(ie);return g("Expression",`Error evaluating: {{{ ${re.trim()}}}}: ${oe}`,k,v,se,J)}},3),E=E.replace(/\{!!([\s\S]*?)!!\}/g,(J,re,se)=>{try{let ie=x(re,_,!1,(oe)=>Fa(oe,J,k,v));if(ie===void 0&&_.__stx_buildMode==="compile")return no("raw",re.trim());return ie!==void 0&&ie!==null?String(ie):""}catch(ie){if(_.__stx_buildMode==="compile")return no("raw",re.trim());let oe=ie instanceof Error?ie.message:String(ie);return g("Expression",`Error evaluating: {!! ${re.trim()} !!}: ${oe}`,k,v,se,J)}}),E=j(E,Y,z,(J)=>`<!--__STX_SCRIPT_EXPR_${J}__-->`),E=j(E,T,B,(J)=>`<!--__STX_STYLE_${J}__-->`);let G=F?Ka(E):[],ne=new Set(fr(_));if(E=Mn(E,(J,re,se)=>{let ie=re.trim();if(Rr(ie,ne))return J;if(G.length>0&&My(G,se,ie))return J;if(H.has(ie))return J;let oe=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],de=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,me=ie.match(de)?.[1],ve=me&&((me in _)||oe.includes(me)),Se=Boolean(me&&V.has(me)),$e=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Re=ie.match($e),Ee=Re&&!oe.includes(Re[1])&&!(Re[1]in _);if(/^__[A-Z_]+__$/.test(ie))return"";let Te;try{let Ce=x(re,_,!1,(Ie)=>{Te=Ie});if(Se)return J;if(F&&!Bd(ie,_))return J;if(Te)Fa(Te,J,k,v);if(_.__stx_buildMode==="compile"&&!F&&(Ce===void 0||Oy(ie,_)))return no("expr",ie);if(Ce===void 0||Ce===null)return"";let _e=String(Ce);return Oa(Ma(E,se),_e,xt(_e))}catch(Ce){if(Se)return J;if(F&&!Bd(ie,_))return J;if(Ee)return J;let _e=Ce instanceof Error?Ce.message:String(Ce);return g("Expression",`Error evaluating: {{ ${ie} }}: ${_e}`,k,v,se,J)}}),z.length>0)E=E.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(J,re)=>z[Number(re)]??J);if(B.length>0)E=E.replace(/<!--__STX_STYLE_(\d+)__-->/g,(J,re)=>B[Number(re)]??J);return E}function Ga(v,_,k){if(!_.trim())return v;let E=v,T=_.trim();while(T.length>0){let j=T.match(/^(\w+)/);if(!j)break;let B=j[1];T=T.substring(B.length).trim();let z=Qs[B]||On[B];if(!z)throw Error(`Filter not found: ${B}. Available filters: ${Object.keys(Wa()).join(", ")}`);let F=[];if(T.startsWith(":")){let V=T.match(/^:([^|\s]+)/);if(V){let H=V[1].trim();try{let G=Number(H);F=[Number.isNaN(G)?H:G]}catch{F=[H]}T=T.substring(V[0].length).trim()}}else if(T.startsWith("(")){let V=1,H=1;while(V>0&&H<T.length){if(T[H]==="(")V++;if(T[H]===")")V--;H++}if(V===0){let G=T.substring(1,H-1).trim();if(G)try{if(G.startsWith("{")&&G.endsWith("}"))F=[x(`(${G})`,k,!0)];else{let ne=[],J="",re=null,se=0,ie=0,oe=0,de=!1;for(let ae=0;ae<G.length;ae++){let me=G[ae];if(de){J+=me,de=!1;continue}if(me==="\\"){J+=me,de=!0;continue}if(re){if(J+=me,me===re)re=null;continue}if(me==='"'||me==="'"||me==="`"){re=me,J+=me;continue}if(me==="(")se++;else if(me===")")se--;else if(me==="[")ie++;else if(me==="]")ie--;else if(me==="{")oe++;else if(me==="}")oe--;if(me===","&&se===0&&ie===0&&oe===0){ne.push(J),J="";continue}J+=me}if(J)ne.push(J);F=ne.map((ae)=>{let me=ae.trim();return x(me,k,!0)})}}catch{F=[G]}T=T.substring(H).trim()}}try{E=z(E,k,...F)}catch(V){let H=V instanceof Error?V.message:String(V);throw Error(`Error applying filter '${B}': ${H}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return E}function Ny(v){let _=!1,k="",E=0,T=0,j=0,B=!1;for(let z=0;z<v.length;z++){let F=v[z],V=v[z+1];if(_&&B){B=!1;continue}if(_&&F==="\\"){B=!0;continue}if(B=!1,(F==='"'||F==="'"||F==="`")&&!B){if(!_)_=!0,k=F;else if(F===k)_=!1,k="";continue}if(_&&k==="`"&&F==="$"&&V==="{"){let H=1;z+=2;while(z<v.length&&H>0){if(v[z]==="{")H++;else if(v[z]==="}")H--;if(H>0)z++}continue}if(_)continue;if(F==="(")E++;else if(F===")")E--;else if(F==="[")T++;else if(F==="]")T--;else if(F==="{")j++;else if(F==="}")j--;if(F==="|"&&E===0&&T===0&&j===0){if(V==="|"){z++;continue}if(V==="="){z++;continue}return z}}return-1}var Ys=new Set,jy=1000;function Cu(){Ys.clear()}function Fa(v,_,k,E){if(!O())return;let T=`${k}\x00${v.expression}`;if(Ys.has(T))return;if(Ys.size>=jy)Ys.clear();Ys.add(T);let j=k,B=E;try{if(k&&jd.existsSync(k))B=jd.readFileSync(k,"utf8")}catch{}let z=B.indexOf(_);if(z>=0)j=`${k}:${B.slice(0,z).split(`
|
|
857
|
+
`).length}`;console.warn(`${j}: stx warning: ${_} rendered as an empty string. The safe evaluator rejected \`${v.expression}\` (${v.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function x(v,_,k=!1,E){try{let T=v.trim(),j=Ny(T);if(j>0){let z=T.substring(0,j).trim(),F=T.substring(j+1).trim(),V=x(z,_,!0,E);return Ga(V,F,_)}let B=fn(T);if(B!==null){E?.({expression:T,rule:B});return}try{let z=Object.keys(_),F=Object.values(_);return l(T,z)(...F)}catch{return c(T,_)}}catch(T){if(T instanceof ReferenceError){let j=/(\b\w+)\s+is not defined/.exec(T.message);if(j){let B=j[1],z=Ly(B,Object.keys(_));if(z&&z!==B)T.message=`${T.message} \u2014 did you mean '${z}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function Ly(v,_){let k=null;for(let T of _){if(T===v)continue;let j=By(v,T);if(k===null||j<k.dist)k={key:T,dist:j}}if(!k)return null;let E=Math.max(v.length,k.key.length);if(k.dist<=2||k.dist/E<=0.35)return k.key;return null}function By(v,_){if(v===_)return 0;if(v.length===0)return _.length;if(_.length===0)return v.length;let[k,E]=v.length<_.length?[v,_]:[_,v],T=Array(k.length+1),j=Array(k.length+1);for(let B=0;B<=k.length;B++)T[B]=B;for(let B=1;B<=E.length;B++){j[0]=B;for(let z=1;z<=k.length;z++){let F=k[z-1]===E[B-1]?0:1;j[z]=Math.min(j[z-1]+1,T[z]+1,T[z-1]+F)}for(let z=0;z<=k.length;z++)T[z]=j[z]}return T[k.length]}function $u(v){if(!v)return"";return v.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import $S from"fs";import Jt from"path";import yi from"fs";import It from"path";import{hasLocalConfig as hf}from"bunfig";import Cn from"fs";import Ar from"path";import Ha from"fs";import Vd from"path";import{fileURLToPath as zy}from"url";var Rc;function Me(){if(Rc)return Rc;let v="unknown";try{v=String(JSON.parse(Ha.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=Vd.dirname(zy(import.meta.url)),k=0;for(let E of Ha.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(E.isFile()&&E.name.endsWith(".ts"))k=Math.max(k,Ha.statSync(Vd.join(E.parentPath,E.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return Rc=v,v}var Ja=new Map,Ir=new Map;async function Eu(v){let k;for(let E=0;E<3;E++)try{let j=(await Cn.promises.stat(v)).mtime.getTime(),B=Ir.get(v);if(B&&B.mtime===j)return B.content;let z=await Bun.file(v).text(),V=(await Cn.promises.stat(v)).mtime.getTime();if(V!==j)continue;return Ir.set(v,{content:z,mtime:V}),z}catch(T){k=T;break}throw Ir.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function _u(v){Ir.delete(v)}function Tu(v){for(let _ of Ir.keys())if(_.startsWith(v))Ir.delete(_)}var ao=null,Fy=null,Hd=null;function Ru(v){Hd=v}async function Ya(v=!1){let _=Hd??await import("./chunk-sw168dnp.js");if(v)return _.generateSignalsRuntimeDev();if(ao===null)ao=_.generateSignalsRuntime();return ao}var co=null;async function Za(){if(co===null){let{getRouterScript:v}=await import("./chunk-ecr642nj.js");co=v()}return co}var Ud={};async function Au(v,_=!1){let k=v==="runtime"?await Ya(_):await Za(),E=v==="runtime"&&_?"runtime-debug":v,T=Ud[E];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},Ud[E]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var Wy=500,Tr=new Map;function qd(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function Pu(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=Tr.has(_);if(k)Tr.delete(_);Tr.set(_,v);while(Tr.size>Wy)Tr.delete(Tr.keys().next().value);if(!k)try{let E=qd(_);if(!Cn.existsSync(E))Cn.mkdirSync(Ar.dirname(E),{recursive:!0}),Cn.writeFileSync(E,v)}catch{}return`/_stx/modules.${_}.js`}function Vo(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=Tr.get(v);if(_!==void 0)return _;try{return Cn.readFileSync(qd(v),"utf8")}catch{return}}function Iu(){Ir.clear(),ee(),md(),ao=null,Fy=null,co=null}function Kd(v){let _={debug:v.debug===!0,middleware:(v.middleware??[]).map((k)=>({name:k.name,timing:k.timing,handler:String(k.handler)})),customDirectives:(v.customDirectives??[]).map((k)=>({name:k.name,hasEndTag:k.hasEndTag===!0,rawParams:k.rawParams===!0,handler:String(k.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(_)).digest("hex")}async function en(v,_){try{if(!_.cachePath)return null;let k=Ar.resolve(_.cachePath),E=Ar.join(k,`${Nn(v)}.html`),T=Ar.join(k,`${Nn(v)}.meta.json`);if(!await r(E)||!await r(T))return null;let j=await Bun.file(T).text(),B=JSON.parse(j);if(B.cacheVersion!==_.cacheVersion)return null;if(B.engine!==Me())return null;if(B.optionsSignature!==Kd(_))return null;if((await Cn.promises.stat(v)).mtime.getTime()>B.mtime)return null;for(let F of B.dependencies)if(await r(F)){if((await Cn.promises.stat(F)).mtime.getTime()>B.mtime)return null}else return null;return await Bun.file(E).text()}catch(k){return console.warn(`Cache error for ${v}:`,k),null}}async function tn(v,_,k,E){try{if(!E.cachePath)return;let T=Ar.resolve(E.cachePath);await Cn.promises.mkdir(T,{recursive:!0});let j=Ar.join(T,`${Nn(v)}.html`),B=Ar.join(T,`${Nn(v)}.meta.json`),z=await Cn.promises.stat(v);await Bun.write(j,_);let F={sourcePath:v,mtime:z.mtime.getTime(),dependencies:Array.from(k),cacheVersion:E.cacheVersion,engine:Me(),optionsSignature:Kd(E),generatedAt:Date.now()};await Bun.write(B,JSON.stringify(F,null,2)),Ja.set(v,{output:_,mtime:z.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var Vy=16;function Nn(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,Vy)}var Ln={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function Tc(v){return`--stx-${v}`}function Ac(v,_){let k=_.lastIndexOf("-");if(k===-1)return typeof v[_]==="string"?v[_]:void 0;let E=v[_.slice(0,k)];if(!E||typeof E!=="object")return;let T=E[_.slice(k+1)];return typeof T==="string"?T:void 0}function Xd(v){let _={};for(let[k,E]of Object.entries(Ln)){let T=Ac(v,E.light);if(T===void 0)continue;_[k]=`var(${Tc(k)}, ${T})`}return _}function Zd(v){let _=[],k=[];for(let[E,T]of Object.entries(Ln)){let j=Ac(v,T.light),B=Ac(v,T.dark);if(j===void 0)continue;if(_.push(` ${Tc(E)}: ${j};`),B!==void 0)k.push(` ${Tc(E)}: ${B};`)}if(_.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",..._,"}",".dark {",...k,"}",""].join(`
|
|
858
|
+
`)}var Gd={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function Jd(v){return`--stx-radius-${v}`}function Yd(){let v={};for(let[_,k]of Object.entries(Gd))v[_]=`var(${Jd(_)}, ${k.value})`;return v}function Qd(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(Gd).map(([v,_])=>` ${Jd(v)}: ${_.value};`),"}",""].join(`
|
|
859
|
+
`)}var ef={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},Uy={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},Hy={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function tf(v){return`--stx-${v}`}function Ic(v){let _=ef[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${tf(v)}, ${_.value})`}function nf(){let v={};for(let[_,k]of Object.entries(Uy))v[_]=Ic(k);return v}function rf(){let v={};for(let[_,{size:k,leading:E}]of Object.entries(Hy))v[_]=[Ic(k),{lineHeight:Ic(E)}];return v}function sf(){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(ef).map(([v,_])=>` ${tf(v)}: ${_.value};`),"}",""].join(`
|
|
860
|
+
`)}function of(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function Pc(v,_){let k={...v};for(let[E,T]of Object.entries(_))k[E]=of(T)&&of(k[E])?Pc(k[E],T):T;return k}function af(v,_){if(!_.fonts)return"";let k=new v({..._.config,fonts:_.fonts,cssVariables:!1}).toCSS(!1,_.minify);return k&&!_.minify?`${k}
|
|
861
|
+
`:k}function cf(v={},_={}){let k=v.theme||{},E=_.theme||{},{extend:T,...j}=E,{extend:B,...z}=k,F=z.colors||{};z.colors={...F,...Xd(F)};let V=z.borderRadius||{};z.borderRadius={...V,...Yd()};let H=z.spacing||{};z.spacing={...H,...nf()};let G=z.fontSize||{};z.fontSize={...G,...rf()};let ne=Pc(z,j),J=Pc(B||{},T||{});if(Object.keys(J).length>0)ne.extend=J;let re=[...v.safelist||[],..._.safelist||[]],se={...v.shortcuts||{},..._.shortcuts||{}},ie=[...v.preflights||[],..._.preflights||[]],{fonts:oe,...de}=v,{fonts:ae,...me}=_,ve=ae??oe;return{config:{...de,...me,theme:ne,safelist:re,shortcuts:se,...ie.length>0?{preflights:ie}:{},content:[],output:""},safelist:re,shortcuts:se,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:Zd(F)+Qd()+sf(),...ve?{fonts:ve}:{}}}function lf(v,_=""){let k=`${v}${_}`,E=0;for(let T=0;T<k.length;T++){let j=k.charCodeAt(T);E=(E<<5)-E+j,E=E&E}return`stx-${Math.abs(E).toString(36)}`}function uf(v,_,k={}){let{prefix:E="",preserveHost:T=!0,scopeKeyframes:j=!0,scopeCustomProperties:B=!1}=k;if(!v.trim())return"";let z=Dc(v),F=[],V=new Map;if(j)for(let H of z){let G=H.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(G){let ne=G[1],J=`${_}_${ne}`;V.set(ne,J)}}for(let H of z){let G=df(H,_,E,T,V,B);F.push(G)}return F.join(`
|
|
862
|
+
|
|
863
|
+
`)}function Dc(v){let _=[],k=v.replace(/\/\*[\s\S]*?\*\//g,""),E=0,T="",j=!1,B="";for(let z=0;z<k.length;z++){let F=k[z];if(F==="@"&&E===0)j=!0;if(F==="{")E++;else if(F==="}"){if(E--,E===0){if(j){B+=F;let V=B.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(V){let[,H,G,ne]=V;if(H==="keyframes")_.push({selector:`@keyframes ${G.trim()}`,declarations:ne.trim()});else if(H==="media"||H==="supports"||H==="container"){let J=Dc(ne);_.push({selector:`@${H} ${G.trim()}`,declarations:J.map((re)=>`${re.selector} { ${re.declarations} }`).join(`
|
|
864
|
+
`)})}else _.push({selector:`@${H} ${G.trim()}`,declarations:ne.trim()})}B="",j=!1}else if(T.trim()){T+=F;let V=T.match(/([^{]+)\{([^}]*)\}/);if(V)_.push({selector:V[1].trim(),declarations:V[2].trim()});T=""}continue}}if(j)B+=F;else T+=F}return _}function df(v,_,k,E,T,j){let{selector:B,declarations:z}=v;if(B.startsWith("@")){if(B.startsWith("@keyframes")){let H=B.replace("@keyframes ","").trim();return`@keyframes ${T.get(H)||H} { ${z} }`}if(B.startsWith("@media")||B.startsWith("@supports")||B.startsWith("@container")){let G=Dc(`x { ${z} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((ne)=>df(ne,_,k,E,T,j)).join(`
|
|
866
865
|
`);return`${B} {
|
|
867
866
|
${G}
|
|
868
|
-
}`}return`${B} { ${z} }`}let F=Vy(B,_,k,E),V=z;for(let[H,G]of T)V=V.replace(new RegExp(`\\b${H}\\b`,"g"),G);if(j)V=V.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${V} }`}function Vy(v,_,k,E){let T=v.split(",").map((B)=>B.trim()),j=[];for(let B of T){if(B.startsWith(":host")){if(E)j.push(B);else{let V=B.replace(/:host(\([^)]*\))?/,`.${_}$1`);j.push(V)}continue}if(B.includes("::slotted")){j.push(B);continue}if(B===":root"){j.push(`:root .${_}`);continue}let z=k?`${k} .${_}`:`.${_}`;j.push(`${z} ${B}`);let F=Uy(B,_);if(F)j.push(k?`${k} ${F}`:F)}return j.join(", ")}function Uy(v,_){let k=0,E=v.length;for(let F=0;F<v.length;F++){let V=v[F];if(V==="["||V==="(")k++;else if(V==="]"||V===")")k--;else if(k===0&&(V===" "||V===">"||V==="+"||V==="~")){E=F;break}}let T=v.slice(0,E),j=v.slice(E);if(!T)return"";let B=T.length,z=0;for(let F=0;F<T.length;F++){let V=T[F];if(V==="["||V==="(")z++;else if(V==="]"||V===")")z--;else if(k===0&&z===0&&V===":"){B=F;break}}return`${T.slice(0,B)}.${_}${T.slice(B)}${j}`}var uf=String.raw`(?<![\w-])scoped(?![\w-])`,Pc=/<style\s+([^>]*)>/gi,cf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,df=new RegExp(uf,"i"),Hy=new RegExp(uf,"gi"),Dc=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function qy(v){Pc.lastIndex=0;let _=Pc.exec(v);while(_!==null){if(df.test(_[1]))return!0;_=Pc.exec(v)}return!1}function Mc(v){let _=new Set,k=[];Dc.lastIndex=0;let E=Dc.exec(v);while(E!==null){let T=E[0].trim();if(_.has(T))k.push({start:E.index,end:E.index+E[0].length});else _.add(T);E=Dc.exec(v)}return k}function Qs(v){let _=Mc(v);if(_.length===0)return v;let k=Array(_.length+1),E=0;for(let T=0;T<_.length;T++){let j=_[T];k[T]=v.slice(E,j.start),E=j.end}return k[_.length]=v.slice(E),k.join("")}function ao(v,_){if(!qy(v))return{html:v,hasScoped:!1};let k=sf(_),E=`data-v-${k}`,T=v,j=!1;if(cf.lastIndex=0,T=T.replace(cf,(B,z,F)=>{if(!df.test(z))return B;j=!0;let V=Ky(F,E),H=z.replace(Hy,"").trim(),G=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${G}>${V}</style>`}),!j)return{html:v,hasScoped:!1};return T=Zy(T,E),{html:T,hasScoped:!0}}function Ky(v,_){return of(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Xy=(v)=>`\x00stx-scope-mask-${v}\x00`,lf=/\u0000stx-scope-mask-(\d+)\u0000/g;function Zy(v,_){let k=En(v,(T,j)=>{let B=Y(T,j);return B>j?B:vs(T,j)},(T,j)=>Xy(j)),E=Gy(k.output,_);return lf.lastIndex=0,E.replace(lf,(T,j)=>k.tokens[Number(j)])}function Gy(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(E,T,j)=>{if(k.has(T.toLowerCase()))return E;if(E.includes(_))return E;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return E;if(j)return E.replace(`<${T}${j}`,`<${T} ${_}${j}`);if(E.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var Rn=null,co="";function pf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;co=`${_}@${Math.trunc(hi.statSync(_).mtimeMs)}`}catch{co=v}}var Nc=!1,Pr=null,fi="",Ms=!1,hf=256,pr=new Map,Tn=new Map,lo=null,yf=null,uo=new Map;function fo(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function Oc(v,_){if(pr.has(v))pr.delete(v);else if(pr.size>=hf)pr.delete(pr.keys().next().value);pr.set(v,_)}function Jy(v){let _=fo(v);if(Tn.has(_))Tn.delete(_);else if(Tn.size>=hf)Tn.delete(Tn.keys().next().value);return Tn.set(_,v),_}function Du(v){let _=Tn.get(v);if(_===void 0)return;return Tn.delete(v),Tn.set(v,_),_}async function Yy(v,_=lo){if(!_)return null;try{let k=Bun.file(It.join(_,`cw-${fo(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Qy(v,_,k=lo){if(!k)return;try{if(!hi.existsSync(k))hi.mkdirSync(k,{recursive:!0});await Bun.write(It.join(k,`cw-${fo(v)}.css`),_)}catch{}}async function gf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var ex=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],tx=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function nx(){let v=[],_=process.cwd();while(_!==It.dirname(_)){for(let k of["node_modules","pantry"])for(let E of ex)v.push(It.join(_,k,...E));_=It.dirname(_)}return v}function rx(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&It.join(_,"Code","Tools","ts-css"),_&&It.join(_,"Code","Tools","crosswind"),_&&It.join(_,"repos","stacks-org","ts-css"),_&&It.join(_,"repos","stacks-org","crosswind"),It.join(process.cwd(),"..","ts-css"),It.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let E of k)v.push(It.join(E,"packages","toolkit","dist","engine","index.js")),v.push(It.join(E,"packages","toolkit","src","engine","index.ts"));if(_)v.push(It.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function Uo(){if(Nc)return Rn;Nc=!0;try{let v=async(T)=>{for(let j of T){if(!await Bun.file(j).exists())continue;let B=await gf(j);if(B){if(pf(j),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${It.dirname(It.dirname(j))}`);return B}}return null};if(process.env.CROSSWIND_SRC){let T=It.resolve(process.env.CROSSWIND_SRC),j=await v([T]);if(!j)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Rn=j,Rn}let _=await v(nx());if(_)return Rn=_,Rn;let k=tx;for(let T of k){let j=await gf(T);if(j){Rn=j;try{pf(import.meta.resolve(T))}catch{co=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Rn}}let E=await v(rx());if(E)return Rn=E,Rn;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Ou(){jc.clear(),Rn=null,Nc=!1,Pr=null,fi="",pr.clear(),Tn.clear(),yf=null,uo.clear()}var mf=!1;async function Wo(v){try{let _=ff({name:"css",cwd:v})?"css":ff({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!mf)mf=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:k}=await import("bunfig"),E=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!E?.path||!E.config||Object.keys(E.config).length===0)return null;let T=It.relative(v,E.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||E.path}`);return E.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function Qa(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-h2aetzf6.js"),E=await k(v);if(E.css)if(typeof E.css==="string"){let T=It.isAbsolute(E.css)?E.css:It.resolve(v,E.css);if(await Bun.file(T).exists()){let j=await import(T);_=j.default||j,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${E.css}`)}}else{if(_={...E.css,content:E.css.content||[],preflight:E.css.preflight??!0,minify:E.css.minify??!1},E.css.config){let T=It.isAbsolute(E.css.config)?E.css.config:It.resolve(v,E.css.config);if(await Bun.file(T).exists()){let j=await import(T);_={...j.default||j,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await Wo(v)}function ec(v){try{let _=new WeakSet;return fo(JSON.stringify(v??{},(k,E)=>{if(typeof E==="function")return`[fn]${String(E)}`;if(typeof E==="object"&&E!==null){if(_.has(E))return"[circular]";_.add(E)}return E})??"")}catch{return"unhashable"}}async function St(v){if(Ms)return fi;Ms=!0;try{let _=await Uo();if(!_||!_.build)return Ms=!1,"";if(!Pr)Pr=await Wo(v);if(!Pr)return Ms=!1,"";let k=_.defaultConfig?.theme||{},E=Pr.theme||{},T={..._.defaultConfig,...Pr,theme:{...k,...E,extend:{...k.extend||{},...E.extend||{}}}},j=performance.now(),B=await _.build(T),z=performance.now()-j;if(fi=B.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${B.classes.size} classes in ${z.toFixed(1)}ms`),T.output){let F=It.isAbsolute(T.output)?T.output:It.join(v,T.output),V=It.dirname(F);if(!hi.existsSync(V))hi.mkdirSync(V,{recursive:!0});await Bun.write(F,B.css)}return Ms=!1,B.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),Ms=!1,fi}}async function nn(v){Pr=null,await St(v)}function Mu(){return fi}function tc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,E=k.exec(v);while(E!==null){for(let B of E[1].split(/\s+/))if(B.trim())_.add(B.trim());E=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,j=T.exec(v);while(j!==null){let B=j[1].match(/'([^']+)'/g);if(B){for(let z of B)for(let F of z.slice(1,-1).split(/\s+/))if(F.trim())_.add(F.trim())}j=T.exec(v)}return _}var jc=m(64);async function nc(v,_){let k=()=>uo.get(_?It.resolve(_):process.cwd())?.fingerprint??null,E=jc.get(h(v,_,k()));if(E!==void 0)return E;let T=await sx(v,_);if(T)jc.set(h(v,_,k()),T);return T}function rc(v){let _=[];for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let E=Vo(k[1]);if(E)_.push(E)}return _.length?`${v}
|
|
867
|
+
}`}return`${B} { ${z} }`}let F=qy(B,_,k,E),V=z;for(let[H,G]of T)V=V.replace(new RegExp(`\\b${H}\\b`,"g"),G);if(j)V=V.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${V} }`}function qy(v,_,k,E){let T=v.split(",").map((B)=>B.trim()),j=[];for(let B of T){if(B.startsWith(":host")){if(E)j.push(B);else{let V=B.replace(/:host(\([^)]*\))?/,`.${_}$1`);j.push(V)}continue}if(B.includes("::slotted")){j.push(B);continue}if(B===":root"){j.push(`:root .${_}`);continue}let z=k?`${k} .${_}`:`.${_}`;j.push(`${z} ${B}`);let F=Ky(B,_);if(F)j.push(k?`${k} ${F}`:F)}return j.join(", ")}function Ky(v,_){let k=0,E=v.length;for(let F=0;F<v.length;F++){let V=v[F];if(V==="["||V==="(")k++;else if(V==="]"||V===")")k--;else if(k===0&&(V===" "||V===">"||V==="+"||V==="~")){E=F;break}}let T=v.slice(0,E),j=v.slice(E);if(!T)return"";let B=T.length,z=0;for(let F=0;F<T.length;F++){let V=T[F];if(V==="["||V==="(")z++;else if(V==="]"||V===")")z--;else if(k===0&&z===0&&V===":"){B=F;break}}return`${T.slice(0,B)}.${_}${T.slice(B)}${j}`}var gf=String.raw`(?<![\w-])scoped(?![\w-])`,Mc=/<style\s+([^>]*)>/gi,ff=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,mf=new RegExp(gf,"i"),Xy=new RegExp(gf,"gi"),Oc=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Zy(v){Mc.lastIndex=0;let _=Mc.exec(v);while(_!==null){if(mf.test(_[1]))return!0;_=Mc.exec(v)}return!1}function Nc(v){let _=new Set,k=[];Oc.lastIndex=0;let E=Oc.exec(v);while(E!==null){let T=E[0].trim();if(_.has(T))k.push({start:E.index,end:E.index+E[0].length});else _.add(T);E=Oc.exec(v)}return k}function fi(v){let _=Nc(v);if(_.length===0)return v;let k=Array(_.length+1),E=0;for(let T=0;T<_.length;T++){let j=_[T];k[T]=v.slice(E,j.start),E=j.end}return k[_.length]=v.slice(E),k.join("")}function lo(v,_){if(!Zy(v))return{html:v,hasScoped:!1};let k=lf(_),E=`data-v-${k}`,T=v,j=!1;if(ff.lastIndex=0,T=T.replace(ff,(B,z,F)=>{if(!mf.test(z))return B;j=!0;let V=Gy(F,E),H=z.replace(Xy,"").trim(),G=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${G}>${V}</style>`}),!j)return{html:v,hasScoped:!1};return T=Yy(T,E),{html:T,hasScoped:!0}}function Gy(v,_){return uf(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Jy=(v)=>`\x00stx-scope-mask-${v}\x00`,pf=/\u0000stx-scope-mask-(\d+)\u0000/g;function Yy(v,_){let k=En(v,(T,j)=>{let B=Y(T,j);return B>j?B:Ss(T,j)},(T,j)=>Jy(j)),E=Qy(k.output,_);return pf.lastIndex=0,E.replace(pf,(T,j)=>k.tokens[Number(j)])}function Qy(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(E,T,j)=>{if(k.has(T.toLowerCase()))return E;if(E.includes(_))return E;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return E;if(j)return E.replace(`<${T}${j}`,`<${T} ${_}${j}`);if(E.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var Rn=null,uo="";function yf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;uo=`${_}@${Math.trunc(yi.statSync(_).mtimeMs)}`}catch{uo=v}}var Lc=!1,Pr=null,hi="",Os=!1,vf=256,pr=new Map,Tn=new Map,fo=null,wf=null,po=new Map;function go(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function jc(v,_){if(pr.has(v))pr.delete(v);else if(pr.size>=vf)pr.delete(pr.keys().next().value);pr.set(v,_)}function ex(v){let _=go(v);if(Tn.has(_))Tn.delete(_);else if(Tn.size>=vf)Tn.delete(Tn.keys().next().value);return Tn.set(_,v),_}function Du(v){let _=Tn.get(v);if(_===void 0)return;return Tn.delete(v),Tn.set(v,_),_}async function tx(v,_=fo){if(!_)return null;try{let k=Bun.file(It.join(_,`cw-${go(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function nx(v,_,k=fo){if(!k)return;try{if(!yi.existsSync(k))yi.mkdirSync(k,{recursive:!0});await Bun.write(It.join(k,`cw-${go(v)}.css`),_)}catch{}}async function xf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var rx=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],sx=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function ix(){let v=[],_=process.cwd();while(_!==It.dirname(_)){for(let k of["node_modules","pantry"])for(let E of rx)v.push(It.join(_,k,...E));_=It.dirname(_)}return v}function ox(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&It.join(_,"Code","Tools","ts-css"),_&&It.join(_,"Code","Tools","crosswind"),_&&It.join(_,"repos","stacks-org","ts-css"),_&&It.join(_,"repos","stacks-org","crosswind"),It.join(process.cwd(),"..","ts-css"),It.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let E of k)v.push(It.join(E,"packages","toolkit","dist","engine","index.js")),v.push(It.join(E,"packages","toolkit","src","engine","index.ts"));if(_)v.push(It.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function Uo(){if(Lc)return Rn;Lc=!0;try{let v=async(T)=>{for(let j of T){if(!await Bun.file(j).exists())continue;let B=await xf(j);if(B){if(yf(j),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${It.dirname(It.dirname(j))}`);return B}}return null};if(process.env.CROSSWIND_SRC){let T=It.resolve(process.env.CROSSWIND_SRC),j=await v([T]);if(!j)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Rn=j,Rn}let _=await v(ix());if(_)return Rn=_,Rn;let k=sx;for(let T of k){let j=await xf(T);if(j){Rn=j;try{yf(import.meta.resolve(T))}catch{uo=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Rn}}let E=await v(ox());if(E)return Rn=E,Rn;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Ou(){Bc.clear(),Rn=null,Lc=!1,Pr=null,hi="",pr.clear(),Tn.clear(),wf=null,po.clear()}var bf=!1;async function Wo(v){try{let _=hf({name:"css",cwd:v})?"css":hf({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!bf)bf=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:k}=await import("bunfig"),E=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!E?.path||!E.config||Object.keys(E.config).length===0)return null;let T=It.relative(v,E.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||E.path}`);return E.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function Qa(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-p87ckkwb.js"),E=await k(v);if(E.css)if(typeof E.css==="string"){let T=It.isAbsolute(E.css)?E.css:It.resolve(v,E.css);if(await Bun.file(T).exists()){let j=await import(T);_=j.default||j,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${E.css}`)}}else{if(_={...E.css,content:E.css.content||[],preflight:E.css.preflight??!0,minify:E.css.minify??!1},E.css.config){let T=It.isAbsolute(E.css.config)?E.css.config:It.resolve(v,E.css.config);if(await Bun.file(T).exists()){let j=await import(T);_={...j.default||j,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await Wo(v)}function ec(v){try{let _=new WeakSet;return go(JSON.stringify(v??{},(k,E)=>{if(typeof E==="function")return`[fn]${String(E)}`;if(typeof E==="object"&&E!==null){if(_.has(E))return"[circular]";_.add(E)}return E})??"")}catch{return"unhashable"}}async function St(v){if(Os)return hi;Os=!0;try{let _=await Uo();if(!_||!_.build)return Os=!1,"";if(!Pr)Pr=await Wo(v);if(!Pr)return Os=!1,"";let k=_.defaultConfig?.theme||{},E=Pr.theme||{},T={..._.defaultConfig,...Pr,theme:{...k,...E,extend:{...k.extend||{},...E.extend||{}}}},j=performance.now(),B=await _.build(T),z=performance.now()-j;if(hi=B.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${B.classes.size} classes in ${z.toFixed(1)}ms`),T.output){let F=It.isAbsolute(T.output)?T.output:It.join(v,T.output),V=It.dirname(F);if(!yi.existsSync(V))yi.mkdirSync(V,{recursive:!0});await Bun.write(F,B.css)}return Os=!1,B.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),Os=!1,hi}}async function nn(v){Pr=null,await St(v)}function Mu(){return hi}function tc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,E=k.exec(v);while(E!==null){for(let B of E[1].split(/\s+/))if(B.trim())_.add(B.trim());E=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,j=T.exec(v);while(j!==null){let B=j[1].match(/'([^']+)'/g);if(B){for(let z of B)for(let F of z.slice(1,-1).split(/\s+/))if(F.trim())_.add(F.trim())}j=T.exec(v)}return _}var Bc=m(64);async function nc(v,_){let k=()=>po.get(_?It.resolve(_):process.cwd())?.fingerprint??null,E=Bc.get(h(v,_,k()));if(E!==void 0)return E;let T=await ax(v,_);if(T)Bc.set(h(v,_,k()),T);return T}function rc(v){let _=[];for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let E=Vo(k[1]);if(E)_.push(E)}return _.length?`${v}
|
|
869
868
|
${_.join(`
|
|
870
|
-
`)}`:v}async function
|
|
869
|
+
`)}`:v}async function ax(v,_){try{let k=await Uo();if(!k)return"";let E=rc(v),T=typeof k.extractClasses==="function"?k.extractClasses(E):tc(E);if(T.size===0)return"";let j=_?It.resolve(_):process.cwd(),B=a(j,"cache");if(!fo)fo=B;let z=po.get(j);if(!z){let Ee=await Qa(j);z={config:Ee,fingerprint:ec(Ee)},po.set(j,z),wf=z.fingerprint}let F=[...T].sort().join(" "),V=`${uo}::${z.fingerprint||"default"}::${F}`,H=pr.get(V);if(H!==void 0)return jc(V,H),H;let G=await tx(V,B);if(G!==null)return jc(V,G),G;let ne=k.defaultConfig||k.config,J=z.config||{},re=cf(ne,J),{safelist:se,includePreflight:ie,minify:oe,tokenCSS:de}=re,ae=re.config,me=new k.CSSGenerator(ae),ve=ae.shortcuts||J.shortcuts||{},Se=Object.keys(ve).filter((Ee)=>T.has(Ee)||se.includes(Ee));for(let Ee of se)if(!ve[Ee])me.generate(Ee);for(let Ee of T)if(!ve[Ee])me.generate(Ee);let $e="";if(Se.length>0){let Ee=new k.CSSGenerator(ae);for(let Te of Se)Ee.generate(Te);if($e=Ee.toCSS(!1,oe),$e&&!$e.endsWith(`
|
|
871
870
|
`))$e+=`
|
|
872
|
-
`}let Re=$e+me.toCSS(ie,oe);return Re=
|
|
871
|
+
`}let Re=$e+me.toCSS(ie,oe);return Re=af(k.CSSGenerator,re)+de+Re,jc(V,Re),nx(V,Re,B),Re}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,E=!1){let T=await nc(v,_);if(!T)return E?fi(v):v;let j=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${ex(T)}.css">`:`<style data-css="generated">
|
|
873
872
|
${T}
|
|
874
|
-
</style>`;if(E)return
|
|
873
|
+
</style>`;if(E)return cx(v,j);let B=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(B.test(v)){let z=!1;return v.replace(B,()=>{if(z)return"";return z=!0,j})}if(v.includes("</head>"))return v.replace("</head>",`${j}
|
|
875
874
|
</head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
|
|
876
|
-
${j}`);return j+v}function
|
|
875
|
+
${j}`);return j+v}function cx(v,_){let k=Nc(v).map((F)=>({...F,replacement:""})),E=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,T=E.exec(v);if(T!==null){let F=!0;while(T!==null)k.push({start:T.index,end:T.index+T[0].length,replacement:F?_:""}),F=!1,T=E.exec(v)}else{let F=v.indexOf("</head>");if(F!==-1)k.push({start:F,end:F,replacement:`${_}
|
|
877
876
|
`});else{let V=v.match(/<body([^>]*)>/);if(V?.index!==void 0)k.push({start:V.index,end:V.index+V[0].length,replacement:`${V[0]}
|
|
878
|
-
${_}`});else k.push({start:0,end:0,replacement:_})}}k.sort((F,V)=>F.start-V.start||F.end-V.end);for(let F=1;F<k.length;F++)if(k[F].start<k[F-1].end)return
|
|
877
|
+
${_}`});else k.push({start:0,end:0,replacement:_})}}k.sort((F,V)=>F.start-V.start||F.end-V.end);for(let F=1;F<k.length;F++)if(k[F].start<k[F-1].end)return lx(fi(v),_);let j=Array(k.length*2+1),B=0,z=0;for(let F of k)j[z++]=v.slice(B,F.start),j[z++]=F.replacement,B=F.end;return j[z]=v.slice(B),j.join("")}function lx(v,_){let k=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(k.test(v)){let E=!1;return v.replace(k,()=>{if(E)return"";return E=!0,_})}if(v.includes("</head>"))return v.replace("</head>",`${_}
|
|
879
878
|
</head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
|
|
880
|
-
${_}`);return _+v}var
|
|
879
|
+
${_}`);return _+v}var zc=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],Sf=/<body\b([^>]*)>/gi;function An(v){let _=0,k,E=zc.map(()=>{return});while(_<v.length){if(k===void 0||k!==null&&k.index<_)Sf.lastIndex=_,k=Sf.exec(v);if(!k)return null;let T=k.index,j=-1,B=null;for(let F=0;F<zc.length;F++){let V=zc[F],H=E[F];if(H===void 0||H!==null&&H.index<_)V.open.lastIndex=_,H=V.open.exec(v),E[F]=H;if(!H)continue;if(H.index<T&&(j===-1||H.index<j))j=H.index,B=V.close}if(j===-1||!B)return{index:T,tag:k[0],attrs:k[1]??""};B.lastIndex=j;let z=B.exec(v);if(!z)return null;_=z.index+z[0].length}return null}function Ns(v,_){let k=An(v);if(!k)return v;return v.slice(0,k.index)+_(k.tag,k.attrs)+v.slice(k.index+k.tag.length)}var $f=/<style\b[^>]*>/iy,_f=/<\/style>/gi,kf=/<script\b[^>]*>/iy,Ef=/<template(?=[\s>/])[^>]*>/iy,Cf=/<\/template\s*>/iy;function xi(v){let _=0,k=0,E=-1;while(_<v.length){let T=v.indexOf("<",_);if(T===-1)return-1;if(v.startsWith("<!--",T)){let F=v.indexOf("-->",T+4);_=F===-1?v.length:F+3;continue}$f.lastIndex=T;let j=$f.exec(v);if(j){_f.lastIndex=T+j[0].length;let F=_f.exec(v);_=F===null?v.length:F.index+8;continue}Ef.lastIndex=T;let B=Ef.exec(v);if(B){if(k===0)E=T;k++,_=T+B[0].length;continue}Cf.lastIndex=T;let z=Cf.exec(v);if(z){if(k>0)k--;_=T+z[0].length;continue}if(kf.lastIndex=T,kf.test(v))return k>0?E:T;_=T+1}return-1}function Rf(){return`
|
|
881
880
|
// STX Lifecycle Runtime
|
|
882
881
|
(function() {
|
|
883
882
|
if (typeof window === 'undefined') return;
|
|
@@ -1225,7 +1224,7 @@ else {
|
|
|
1225
1224
|
|
|
1226
1225
|
console.log('[stx] Lifecycle runtime initialized');
|
|
1227
1226
|
})();
|
|
1228
|
-
`}function
|
|
1227
|
+
`}function Fc(v){return Symbol(v)}var P_=Fc("theme"),D_=Fc("router"),M_=Fc("i18n");import*as Af from"crypto";function Tf(v){let _=/\$(\w+)\./g,k=[],E;while((E=_.exec(v))!==null)if(!k.includes(E[1]))k.push(E[1]);return k}function ux(){return`stx-${Af.randomBytes(4).toString("hex")}`}function dx(v){return/\$\w+\./.test(v)}function fx(v){if(!v.includes("{{")||!/\$\w+\./.test(v))return{html:v,bindings:[],stores:new Set};let _=[],k=new Set,E=/<(\w+)([^>]*?)(\s*\/?>)/g,T=v;return T=T.replace(E,(j,B,z,F)=>{if(["script","style","template"].includes(B.toLowerCase()))return j;let V=[],H=!1,G=z,ne=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,J=[...z.matchAll(ne)];for(let ie of J){let oe=ie[0],de=ie[1],ae=ie[2];if(dx(ae)){H=!0;let me=ae.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(me){let ve=me[1];if(V.push({attr:de,expr:ve,fullMatch:oe,originalAttr:de}),Tf(ve).forEach(($e)=>k.add($e)),de==="text")G=G.replace(oe,"");else if(de==="class")G=G.replace(oe,'class=""');else if(de==="disabled"||de==="hidden")G=G.replace(oe,"");else G=G.replace(oe,`${de}=""`)}}}if(!H)return j;let re=G.match(/\bid\s*=\s*"([^"]+)"/),se;if(re)se=re[1];else se=ux(),G=` id="${se}"${G}`;for(let ie of V)_.push({elementId:se,attribute:ie.attr,expression:ie.expr,stores:Tf(ie.expr)});return`<${B}${G}${F}`}),{html:T,bindings:_,stores:k}}function px(v,_){if(v.length===0)return"";let k=Array.from(_),E=`
|
|
1229
1228
|
<script>
|
|
1230
1229
|
(function() {
|
|
1231
1230
|
'use strict';
|
|
@@ -1383,10 +1382,10 @@ else {
|
|
|
1383
1382
|
}
|
|
1384
1383
|
})();
|
|
1385
1384
|
</script>
|
|
1386
|
-
`,E}function
|
|
1385
|
+
`,E}function If(v){let{html:_,bindings:k,stores:E}=fx(v);if(k.length===0)return v;let T=px(k,E),j=_.lastIndexOf("</body>");if(j!==-1)return _.slice(0,j)+T+_.slice(j);return _+T}function gx(v){let _=v.analytics;if(!_?.enabled)return"";switch(_.driver){case"fathom":return mx(_);case"google-analytics":return hx(_);case"plausible":return yx(_);case"self-hosted":return xx(_);case"custom":return bx(_);default:return""}}function mx(v){let _=v.fathom;if(!_?.siteId)return"";let k=_.scriptUrl||"https://cdn.usefathom.com/script.js",E=_.defer!==!1?" defer":"",T=[`data-site="${pn(_.siteId)}"`];if(_.honorDnt)T.push('data-honor-dnt="true"');if(_.spa)T.push('data-spa="auto"');if(_.canonical)T.push(`data-canonical="${pn(_.canonical)}"`);if(_.auto===!1)T.push('data-auto="false"');return`
|
|
1387
1386
|
<!-- Fathom Analytics -->
|
|
1388
1387
|
<script src="${pn(k)}" ${T.join(" ")}${E}></script>
|
|
1389
|
-
`}function
|
|
1388
|
+
`}function hx(v){let _=v.googleAnalytics;if(!_?.measurementId)return"";let k=pn(_.measurementId),E=_.debug?`gtag('config', '${k}', { 'debug_mode': true });`:"";return`
|
|
1390
1389
|
<!-- Google Analytics -->
|
|
1391
1390
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${k}"></script>
|
|
1392
1391
|
<script>
|
|
@@ -1396,10 +1395,10 @@ else {
|
|
|
1396
1395
|
gtag('config', '${k}');
|
|
1397
1396
|
${E}
|
|
1398
1397
|
</script>
|
|
1399
|
-
`}function
|
|
1398
|
+
`}function yx(v){let _=v.plausible;if(!_?.domain)return"";let k=_.scriptUrl||"https://plausible.io/js/script.js",E=[`data-domain="${pn(_.domain)}"`],T=k,j=[];if(_.trackLocalhost)j.push("local");if(_.hashMode)j.push("hash");if(j.length>0&&k==="https://plausible.io/js/script.js")T=`https://plausible.io/js/script.${j.join(".")}.js`;return`
|
|
1400
1399
|
<!-- Plausible Analytics -->
|
|
1401
1400
|
<script defer data-domain="${pn(_.domain)}" src="${pn(T)}"></script>
|
|
1402
|
-
`}function
|
|
1401
|
+
`}function xx(v){let _=v.selfHosted;if(!_?.siteId||!_?.apiEndpoint)return"";let k=pn(_.siteId),E=pn(_.apiEndpoint),T=_.honorDnt?'if(n.doNotTrack==="1")return;':"",j=_.trackHashChanges?"w.addEventListener('hashchange',pv);":"",B=_.trackOutboundLinks?`
|
|
1403
1402
|
d.addEventListener('click',function(e){
|
|
1404
1403
|
var a=e.target.closest('a');
|
|
1405
1404
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -1432,7 +1431,7 @@ else {
|
|
|
1432
1431
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
1433
1432
|
})();
|
|
1434
1433
|
</script>
|
|
1435
|
-
`}function
|
|
1434
|
+
`}function bx(v){let _=v.custom;if(!_)return"";if(_.inlineScript)return`
|
|
1436
1435
|
<!-- Custom Analytics -->
|
|
1437
1436
|
<script>
|
|
1438
1437
|
${_.inlineScript}
|
|
@@ -1440,7 +1439,7 @@ ${_.inlineScript}
|
|
|
1440
1439
|
`;if(!_.scriptUrl)return"";let k=[];if(_.scriptId)k.push(`id="${pn(_.scriptId)}"`);if(_.attributes)for(let[T,j]of Object.entries(_.attributes))k.push(`${pn(T)}="${pn(j)}"`);return`
|
|
1441
1440
|
<!-- Custom Analytics -->
|
|
1442
1441
|
<script${k.length>0?` ${k.join(" ")}`:""} src="${pn(_.scriptUrl)}" defer></script>
|
|
1443
|
-
`}function
|
|
1442
|
+
`}function Pf(v,_){let k=gx(_);if(!k)return v;if(!v.includes("</head>")){let E=v.lastIndexOf("</body>");if(E!==-1)return v.slice(0,E)+k+v.slice(E);return v+k}return v.replace("</head>",`${k}</head>`)}function pn(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function je(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function Df(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var vx=100,wx=599,Vc="__stxResponseStatus",wi="__stxResponseHeaders";function mo(v){return typeof v==="number"&&Number.isInteger(v)&&v>=vx&&v<=wx}function kt(v){for(let _ of v.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let k=_[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!k)continue;let E=Number(k[1]);if(mo(E))return E}return}function Wc(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!mo(k))return!1;return v[Vc]=k,!0}function Sx(v,_,k){if(!v||typeof v!=="object")return;let E=String(_??"").trim();if(!E)return;v[wi]={...v[wi],[E]:String(k)}}function Be(v){let _=v?.[Vc];return mo(_)?_:void 0}function Fe(v){let _=v?.[wi];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([E,T])=>[E,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function qo(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=Be(v);if(k!==void 0)_[Vc]=k;let E=Fe(v);if(E)_[wi]={..._[wi],...E}}function jn(v){return{setResponseStatus:(_)=>{Wc(v,_)},notFound:(_=404)=>{let k=mo(_)&&_>=400?_:404;Wc(v,k)},setResponseHeader:(_,k)=>{Sx(v,_,k)}}}function Mf(v,_,k={}){if(!v.includes("@status"))return v;let{filePath:E,buildMode:T}=k,j=T==="compile",B="",z=0,F=/@status\s*\(/g,V;while((V=F.exec(v))!==null){let H=$x(v,V.index+V[0].length-1);if(H<0)break;let G=v.slice(V.index+V[0].length,H).trim(),ne=/^\d+$/.test(G)?Number(G):c(G,_),J=E?` in ${E}`:"";if(j)console.warn(`[stx] @status(${G})${J} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${G}) from <script server> instead \u2014 that runs per request.`);else if(!Wc(_,ne))console.warn(`[stx] @status(${G})${J} is not an HTTP status (100-599) \u2014 ignoring it.`);B+=v.slice(z,V.index),z=H+1+(v.slice(H+1).match(/^[^\S\n]*\n?/)?.[0].length??0),F.lastIndex=z}return z===0?v:B+v.slice(z)}function $x(v,_){let k=1,E=null,T=!1;for(let j=_+1;j<v.length;j++){let B=v[j];if(T){T=!1;continue}if(E){if(B==="\\")T=!0;else if(B===E)E=null;continue}if(B==='"'||B==="'"||B==="`"){E=B;continue}if(B==="(")k++;else if(B===")"&&--k===0)return j}return-1}var _x=0,kx=0;function Of(v,_){let k=v.match(new RegExp(`${_}\\s*=\\s*"([^"]*)"`,"i"));if(k)return k[1];let E=v.match(new RegExp(`${_}\\s*=\\s*'([^']*)'`,"i"));if(E)return E[1];return null}function Ex(v){let _=[],k=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,E;while((E=k.exec(v))!==null){let[T,j,B]=E,z=E.index,F=Of(B,"x-data");if(!F)continue;let V=`__stx_scope_${_x++}`,H=Of(B,"x-init"),G=Cx(v,j,z+T.length),ne=v.slice(z,G.endIndex),J=Rx(ne);_.push({id:V,selector:`[data-stx-scope="${V}"]`,stateExpr:F,initExpr:H,bindings:[],refs:J})}return _}function Cx(v,_,k){let E=1,T=k,j=new RegExp(`<${_}(?:\\s|>)`,"gi"),B=new RegExp(`</${_}>`,"gi"),z=new RegExp(`<${_}[^>]*/\\s*>`,"gi");while(E>0&&T<v.length){j.lastIndex=T,B.lastIndex=T,z.lastIndex=T;let F=j.exec(v),V=B.exec(v),H=z.exec(v);if(H&&H.index<(F?.index??1/0)){T=H.index+H[0].length;continue}if(!V)return{endIndex:v.length};if(F&&F.index<V.index)E++,T=F.index+F[0].length;else{if(E--,E===0)return{endIndex:V.index+V[0].length};T=V.index+V[0].length}}return{endIndex:v.length}}function Rx(v){let _=new Map,k=v.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),E=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,T;while((T=E.exec(k))!==null){let[,j,B]=T,z=Tx(j);_.set(B,z)}return _}function Tx(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${kx++}`}function Ax(){return`
|
|
1444
1443
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
1445
1444
|
(function() {
|
|
1446
1445
|
var style = document.createElement('style');
|
|
@@ -1693,7 +1692,7 @@ window.__stx_reactive = (function() {
|
|
|
1693
1692
|
|
|
1694
1693
|
return { initScope: initScope, reactive: reactive };
|
|
1695
1694
|
})();
|
|
1696
|
-
`}function
|
|
1695
|
+
`}function Nf(v,_){let k=v.replace(/\{!!([\s\S]*?)!!\}/g,(z,F)=>{try{let V=x(F,_,!0);if(V===void 0)return z;return String(V)}catch{return z}}),E="",T=0,j=null;while(T<k.length){let z=k[T];if(j&&z==="\\"){E+=z+(k[T+1]??""),T+=2;continue}if(z==="{"&&k[T+1]==="{"){let F=k.indexOf("}}",T+2);if(F!==-1){let V=k.slice(T,F+2);E+=B(k.slice(T+2,F),V,j),T=F+2;continue}}if(j){if(z===j)j=null}else if(z==="'"||z==='"'||z==="`")j=z;E+=z,T++}return E;function B(z,F,V){let H;try{H=x(z,_,!0)}catch{return F}if(H===void 0)return F;if(V){let G=String(H).replace(/\\/g,"\\\\").replace(new RegExp(V==="`"?"`":V,"g"),`\\${V}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return V==="`"?G.replace(/\$\{/g,"\\${"):G}if(typeof H==="string"){let G=H.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(H)}}function Ix(v,_){if(v.length===0)return"";let k=v.map((E)=>{let T=JSON.stringify(Object.fromEntries(E.refs)),j=Nf(E.stateExpr,_),B=E.initExpr?Nf(E.initExpr,_):null,z=JSON.stringify(j),F=B?JSON.stringify(B):"null";return`
|
|
1697
1696
|
(function() {
|
|
1698
1697
|
var scopeEl = document.querySelector('${E.selector}');
|
|
1699
1698
|
if (!scopeEl) return;
|
|
@@ -1702,25 +1701,25 @@ window.__stx_reactive = (function() {
|
|
|
1702
1701
|
})();`}).join(`
|
|
1703
1702
|
`);return`
|
|
1704
1703
|
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
1705
|
-
${
|
|
1704
|
+
${Ax()}
|
|
1706
1705
|
${k}
|
|
1707
|
-
</script>`}function
|
|
1708
|
-
`+T.slice(B);else T+=j;return T}function Tx(v,_){let k=0,E=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,j,B)=>{let z=_[k++];if(!z)return T;let F=/data-stx-scope="([^"]*)"/.exec(B);if(F)return z.id=F[1],z.selector=`[data-stx-scope="${z.id}"]`,T;return`<${j} data-stx-scope="${z.id}"${B}>`});return E=E.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),E=E.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),E=E.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),E=E.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),E}function Ax(v){return/x-data\s*=\s*["']/.test(v)}function gr(v,_){try{let k=v.trim();if(p(k))return l(k,Object.keys(_))(...Object.values(_));else return c(k,_)}catch{return!1}}function mr(v,_){let k=Ix(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function Ix(v,_){let k=_;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let E=S(v,"(",")",k);if(E===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,E),endPos:E+1}}function Px(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Dr(v,_,k,E){let T=1,j=E,B=new RegExp(`@${_}\\s*\\(`,"g"),z=new RegExp(`@${k}(?![a-z])`,"g");while(j<v.length&&T>0){B.lastIndex=j,z.lastIndex=j;let F=B.exec(v),V=z.exec(v),H=F?F.index:1/0,G=V?V.index:1/0;if(H<G)T++,j=H+F[0].length;else if(G<1/0){if(T--,T===0)return G;j=G+V[0].length}else break}return-1}function Mf(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let E=_+k[0].length,T=mr(v,E);if(!T)return null;let j=T.endPos,B=Dr(v,"if","endif",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,H="if",G=T.expression,ne=0,J=0;while(V<z.length){let re=z.indexOf("@",V);if(re===-1)break;V=re;let se=z.substring(re);if(Px(z,re)){V++;continue}if(/^@if\s*\(/.test(se)){J++,V++;continue}if(/^@endif(?![a-z])/.test(se)){J--,V+=6;continue}if(J===0){let ie=se.match(/^@elseif\s*/);if(ie){F.push({type:H,condition:G,content:z.substring(ne,V),start:j+ne,end:j+V});let oe=V+ie[0].length,de=mr(z,oe);if(!de){V++;continue}H="elseif",G=de.expression,V=de.endPos,ne=V;continue}else if(/^@else(?![a-z])/.test(se)){F.push({type:H,condition:G,content:z.substring(ne,V),start:j+ne,end:j+V}),H="else",G=void 0,V+=5,ne=V;continue}}V++}return F.push({type:H,condition:G,content:z.slice(ne),start:j+ne,end:j+z.length}),{fullMatch:v.slice(_,B+6),branches:F,start:_,end:B+6}}function wi(v){let _=[],k=/@if\s*\(/g,E=k.exec(v);while(E!==null){if(_.some((B)=>E.index>B.start&&E.index<B.end)){E=k.exec(v);continue}let j=Mf(v,E.index);if(j)_.push(j),k.lastIndex=j.end;E=k.exec(v)}return _}function go(v,_,k){let E=[],T=new RegExp(`@${_}\\s*\\(`,"g"),j=T.exec(v);while(j!==null){if(E.some((se)=>j.index>se.start&&j.index<se.end)){j=T.exec(v);continue}let z=j.index,F=z+j[0].length-1,V=S(v,"(",")",F);if(V===-1){j=T.exec(v);continue}let H=v.slice(F+1,V),G=V+1,ne=Dr(v,_,k,G);if(ne===-1){j=T.exec(v);continue}let J=v.slice(G,ne),re=ne+`@${k}`.length;E.push({fullMatch:v.slice(z,re),name:_,params:H,content:J,start:z,end:re}),T.lastIndex=re,j=T.exec(v)}return E}function Wc(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let E=_+k[0].length,T=mr(v,E);if(!T)return null;let j=T.endPos,B=Dr(v,"switch","endswitch",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,H=null,G=0;while(V<z.length){let ne=z.slice(V),J=ne.match(/^@switch\s*\(/),re=ne.match(/^@endswitch(?![a-z])/);if(J){if(G++,H)H.content+=J[0];V+=J[0].length;continue}if(re){if(G--,H)H.content+=re[0];V+=re[0].length;continue}if(G>0){if(H)H.content+=z[V];V++;continue}let se=ne.match(/^@case\s*/),ie=ne.match(/^@default(?![a-z])/),oe=ne.match(/^@break(?![a-z])/);if(se&&ne.startsWith("@case")){if(H)F.push(H);let de=V+se[0].length,ae=mr(z,de);if(!ae){V++;continue}H={type:"case",value:ae.expression,content:""},V=ae.endPos}else if(ie&&ne.startsWith("@default")){if(H)F.push(H);H={type:"default",content:""},V+=ie[0].length}else if(oe&&ne.startsWith("@break"))V+=oe[0].length;else{if(H)H.content+=z[V];V++}}if(H)F.push(H);return{fullMatch:v.slice(_,B+10),expression:T.expression,cases:F,start:_,end:B+10}}function Nx(v,_,k){let E=v,T=!0;while(T){T=!1;let j=E.match(/@switch\s*\(/);if(!j||j.index===void 0)break;let B=j.index,z=Wc(E,B);if(!z)break;try{let F;if(p(z.expression))F=l(z.expression,Object.keys(_))(...Object.values(_));else F=c(z.expression,_);let V="",H=!1;for(let G of z.cases)if(G.type==="default"){if(!H)V=G.content.trim()}else try{let ne;if(G.value&&p(G.value))ne=l(G.value,Object.keys(_))(...Object.values(_));else if(G.value)ne=c(G.value,_);if(F===ne){V=G.content.trim(),H=!0;break}}catch{continue}E=E.substring(0,B)+V+E.substring(z.end),T=!0}catch(F){let V=F instanceof Error?F.message:String(F),H=i("Switch",`Error evaluating @switch expression: ${V}`,t.EVALUATION_ERROR);E=E.substring(0,B)+H+E.substring(z.end);break}}return E}function jx(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(E)=>(_.push(E),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function Lx(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,E)=>_[Number(E)]??k)}function ir(v,_,k){let{masked:E,scripts:T}=jx(v);return Lx(Bx(E,_,k),T)}function Bx(v,_,k){let E=v;E=Nx(E,_,k);{let j=!0;while(j){j=!1;let B=E.match(/@unless\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=mr(E,z+7);if(!F)break;let V=F.endPos,H=Dr(E,"unless","endunless",V);if(H===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let G=E.slice(V,H),ne=F.expression,J=-1;{let se=0,ie=/@(?:if|unless)\s*\(/g,oe=/@(?:endif|endunless)(?![a-z])/g,de=/@else(?![a-z])/g,ae=[],me;while((me=ie.exec(G))!==null)ae.push({pos:me.index,type:"open"});while((me=oe.exec(G))!==null)ae.push({pos:me.index,type:"close"});while((me=de.exec(G))!==null)ae.push({pos:me.index,type:"else"});ae.sort((ve,Se)=>ve.pos-Se.pos);for(let ve of ae)if(ve.type==="open")se++;else if(ve.type==="close")se--;else if(ve.type==="else"&&se===0){J=ve.pos;break}}let re;if(J!==-1){let se=G.slice(0,J),ie=G.slice(J+5);re=`@if (${ne})${ie}@else ${se}@endif`}else re=`@if (!(${ne}))${G}@endif`;E=E.substring(0,z)+re+E.substring(H+10),j=!0}}E=Uc(E,_,k),E=Hc(E,_,k),E=Vc(E,_);let T=()=>{let j=wi(E);if(j.length===0)return!1;let B=Array(j.length);for(let V=j.length-1;V>=0;V--){let H=j[V];try{let G="",ne=!1;for(let J of H.branches){if(ne)break;if(J.type==="else")G=J.content,ne=!0;else try{let re;if(J.condition&&p(J.condition))re=l(J.condition,Object.keys(_))(...Object.values(_));else if(J.condition)re=c(J.condition,_);if(re)G=J.content,ne=!0}catch(re){G=i(J.type==="if"?"If":"Elseif",`Error in @${J.type}(${J.condition}): ${re instanceof Error?re.message:String(re)}`,t.EVALUATION_ERROR),ne=!0}}B[V]=G}catch(G){let ne=G instanceof Error?G.message:String(G);B[V]=i("If",`Error processing @if block: ${ne}`,t.EVALUATION_ERROR)}}let z=Array(j.length*2+1),F=0;for(let V=0;V<j.length;V++){let H=j[V];z[V*2]=E.slice(F,H.start),z[V*2+1]=B[V],F=H.end}return z[j.length*2]=E.slice(F),E=z.join(""),!0};while(!0){let j=E;if(!T())break;if(E===j)break}return E}function Of(v){let _=0;while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!=="(")return null;_++;while(_<v.length&&/\s/.test(v[_]))_++;let k=v[_];if(k!=="'"&&k!=='"')return null;_++;let E=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){E.push(v[_+1]),_+=2;continue}if(T===k){_++;break}E.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:E.join(""),consumed:_}}function Vc(v,_){let k=v;function E(z,F,V,H){let G=1,ne=H,J=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),re=new RegExp(`@${V}(?![a-z])`,"g");while(ne<z.length&&G>0){J.lastIndex=ne,re.lastIndex=ne;let se=J.exec(z),ie=re.exec(z),oe=se?se.index:1/0,de=ie?ie.index:1/0;if(oe<de)G++,ne=oe+se[0].length;else if(de<1/0){if(G--,G===0)return de;ne=de+ie[0].length}else break}return-1}function T(z,F,V){let H=0,G=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),ne=new RegExp(`@${V}(?![a-z])`,"g"),J=/@else(?![a-z])/g,re=[],se;while((se=G.exec(z))!==null)re.push({pos:se.index,type:"open"});while((se=ne.exec(z))!==null)re.push({pos:se.index,type:"close"});while((se=J.exec(z))!==null)re.push({pos:se.index,type:"else"});re.sort((ie,oe)=>ie.pos-oe.pos);for(let ie of re)if(ie.type==="open")H++;else if(ie.type==="close")H--;else if(ie.type==="else"&&H===0)return ie.pos;return-1}{let z=!0;while(z){z=!1;let F=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,G,ne=k.slice(V+5),J=Of(ne);if(J)H=J.value,G=V+5+J.consumed;else G=V+5;let re=E(k,"auth","endauth",G);if(re===-1){console.warn(`[stx] @auth directive at position ${V} has no matching @endauth \u2014 the block was skipped.`);break}let se=k.slice(G,re),ie=T(se,"auth","endauth"),oe;if(!_.auth)oe=!1;else oe=H?gr(`auth?.check && auth?.user?.[${H}]`,_):gr("auth?.check",_);let de;if(ie!==-1){let ae=se.slice(0,ie),me=se.slice(ie+5);de=oe?ae:me}else de=oe?se:"";k=k.substring(0,V)+de+k.substring(re+8),z=!0}}{let z=!0;while(z){z=!1;let F=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,G,ne=k.slice(V+6),J=Of(ne);if(J)H=J.value,G=V+6+J.consumed;else G=V+6;let re=E(k,"guest","endguest",G);if(re===-1){console.warn(`[stx] @guest directive at position ${V} has no matching @endguest \u2014 the block was skipped.`);break}let se=k.slice(G,re),ie=T(se,"guest","endguest"),oe;if(!_.auth)oe=!0;else oe=H?gr(`!auth?.check || !auth?.user?.[${H}]`,_):gr("!auth?.check",_);let de;if(ie!==-1){let ae=se.slice(0,ie),me=se.slice(ie+5);de=oe?ae:me}else de=oe?se:"";k=k.substring(0,V)+de+k.substring(re+9),z=!0}}function j(z,F,V){if(_.userCan&&typeof _.userCan[z]==="boolean")return _.userCan[z];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[z];if(F)H.push(F);if(V){let G=gr(V,_);H.push(G)}return _.permissions.check(...H)}catch{return!1}return!1}function B(z){let F=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!F)return null;return{ability:F[1],type:F[2],id:F[3]?.trim(),paramsEnd:F[0].length}}for(let z of["can","cannot"]){let F=`end${z}`,V=z==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let G=k.match(new RegExp(`@${z}\\s*\\(`));if(!G||G.index===void 0)break;let ne=G.index,J=k.slice(ne+`@${z}`.length),re=B(J);if(!re)break;let se=ne+`@${z}`.length+re.paramsEnd,ie=E(k,z,F,se);if(ie===-1){console.warn(`[stx] @${z} directive at position ${ne} has no matching @${F} \u2014 the block was skipped.`);break}let oe=k.slice(se,ie),de=[],ae=0,me=new RegExp(`@${z}\\s*\\(`,"g"),ve=new RegExp(`@${F}(?![a-z])`,"g"),Se=new RegExp(`@${V}\\s*\\(`,"g"),$e=/@else(?![a-z])/g,Re=[],Ee;while((Ee=me.exec(oe))!==null)Re.push({pos:Ee.index,type:"open"});while((Ee=ve.exec(oe))!==null)Re.push({pos:Ee.index,type:"close"});while((Ee=Se.exec(oe))!==null)Re.push({pos:Ee.index,type:"elseDirective"});while((Ee=$e.exec(oe))!==null)Re.push({pos:Ee.index,type:"else"});Re.sort((Pe,Ae)=>Pe.pos-Ae.pos);for(let Pe of Re){if(Pe.type==="open"){ae++;continue}if(Pe.type==="close"){ae--;continue}if(ae===0)de.push(Pe)}let Te=[],Ce=0;for(let Pe=0;Pe<de.length;Pe++){let Ae=de[Pe];if(Te.push({content:oe.slice(Ce,Ae.pos),ability:void 0}),Ae.type==="elseDirective"){let Ze=oe.slice(Ae.pos+`@${V}`.length),ct=B(Ze);if(ct){Te[Te.length-1]={content:oe.slice(Ce,Ae.pos)},Ce=Ae.pos+`@${V}`.length+ct.paramsEnd,Te.push({content:"",ability:ct.ability,type:ct.type,id:ct.id}),Te.pop();let it=de[Pe+1],rt=it?it.pos:oe.length;Te.push({content:oe.slice(Ce,rt),ability:ct.ability,type:ct.type,id:ct.id}),Ce=rt}}else Ce=Ae.pos+5}if(Ce<oe.length){let Pe=Te[Te.length-1];if(de.length>0&&de[de.length-1].type==="else")Te.push({content:oe.slice(Ce),isFinalElse:!0});else if(Te.length===0)Te.push({content:oe.slice(Ce)})}let _e=j(re.ability,re.type,re.id),Ie=z==="can"?_e:!_e,Xe="";if(Ie)Xe=Te[0]?.content||"";else{let Pe=!1;for(let Ae=1;Ae<Te.length;Ae++){let Ze=Te[Ae];if(Ze.isFinalElse){Xe=Ze.content,Pe=!0;break}if(Ze.ability){let ct=j(Ze.ability,Ze.type,Ze.id);if(z==="can"?ct:!ct){Xe=Ze.content,Pe=!0;break}}}if(!Pe&&Te.length>0){let Ae=Te[Te.length-1];if(Ae.isFinalElse)Xe=Ae.content}}k=k.substring(0,ne)+Xe+k.substring(ie+`@${F}`.length),H=!0}}return k}function Uc(v,_,k){let E=v;function T(j,B,z,F,V){let H=!0;while(H){H=!1;let G=new RegExp(`@${B}\\s*\\(`),ne=j.match(G);if(!ne||ne.index===void 0)break;let J=ne.index,re=mr(j,J+`@${B}`.length);if(!re)break;let se=re.endPos,ie=Dr(j,B,z,se);if(ie===-1){console.warn(`[stx] @${B} directive at position ${J} has no matching @${z} \u2014 the block was skipped.`);break}let oe=j.slice(se,ie),de=re.expression,ae=-1,me=0,ve=0;while(ve<oe.length){let Se=oe.indexOf("@",ve);if(Se===-1)break;let $e=oe.substring(Se);if(/^@(?:if|unless|isset|empty)\s*\(/.test($e)){me++,ve=Se+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test($e)){me--,ve=Se+1;continue}if(me===0&&/^@else(?![a-z])/.test($e)){ae=Se;break}ve=Se+1}try{let Se=F(de.trim()),$e;if(ae!==-1){let Re=oe.slice(0,ae),Ee=oe.slice(ae+5);$e=Se?Re:Ee}else $e=Se?oe:"";j=j.substring(0,J)+$e+j.substring(ie+`@${z}`.length),H=!0}catch(Se){let $e=Se instanceof Error?Se.message:String(Se),Re=i(V,`Error processing @${B} directive: ${$e}`,t.EVALUATION_ERROR);j=j.substring(0,J)+Re+j.substring(ie+`@${z}`.length);break}}return j}return E=T(E,"isset","endisset",(j)=>{let B=gr(j,_);return B!==void 0&&B!==null},"Isset"),E=T(E,"empty","endempty",(j)=>{let B=gr(j,_);return B===void 0||B===null||B===""||B===0||B===!1||Array.isArray(B)&&B.length===0||typeof B==="object"&&B!==null&&Object.keys(B).length===0},"Empty"),E}function Hc(v,_,k){let E=v,T="development";function j(B,z,F,V){let H=new RegExp(`@${z}(?![a-z])`,"g"),G=new RegExp(`@${F}(?![a-z])`,"g"),ne=new RegExp(`^@${z}(?![a-z])`),J=new RegExp(`^@${F}(?![a-z])`),re=B,se=!0;while(se){se=!1,H.lastIndex=0;let ie=H.exec(re);if(!ie)break;let oe=ie.index,de=oe+ie[0].length;if(z==="env"){let _e=re.substring(de).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!_e)break;de+=_e[0].length,V=T===_e[2]}let ae=1,me=de,ve=-1;while(ae>0&&me<re.length){H.lastIndex=me,G.lastIndex=me;let _e=H.exec(re),Ie=G.exec(re),Xe=_e?_e.index:1/0,Pe=Ie?Ie.index:1/0;if(Xe<Pe)ae++,me=Xe+_e[0].length;else if(Pe<1/0){if(ae--,ae===0){ve=Pe;break}me=Pe+Ie[0].length}else break}if(ve===-1){console.warn(`[stx] @${z} directive at position ${oe} has no matching @${F} \u2014 the block was skipped.`);break}let Se=re.substring(de,ve),$e=-1,Re=0,Ee=0;while(Ee<Se.length){let _e=Se.indexOf("@",Ee);if(_e===-1)break;let Ie=Se.substring(_e);if(ne.test(Ie)){Re++,Ee=_e+1;continue}if(J.test(Ie)){Re--,Ee=_e+1;continue}if(Re===0&&/^@else(?![a-z])/.test(Ie)){$e=_e;break}Ee=_e+1}let Te;if($e!==-1){let _e=Se.slice(0,$e),Ie=Se.slice($e+5);Te=V?_e:Ie}else Te=V?Se:"";let Ce=`@${F}`.length;re=re.substring(0,oe)+Te+re.substring(ve+Ce),se=!0}return re}return E=j(E,"env","endenv",!1),E=j(E,"production","endproduction",T==="production"),E=j(E,"development","enddevelopment",T==="development"),E=j(E,"staging","endstaging",T==="staging"),E=j(E,"testing","endtesting",T==="testing"),E}var Nf=new WeakMap;function jf(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function mo(v,_){if(!v)return _?.nonceGenerator?.()??jf();let k=Nf.get(v);if(!k)k=_?.nonceGenerator?.()??jf(),Nf.set(v,k);return k}function zx(v,_){let k=[];for(let[E,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(E);continue}if(Array.isArray(T)){let j=[...T];if(_&&(E==="script-src"||E==="style-src"))j=j.filter((B)=>!B.startsWith("'nonce-")),j.push(`'nonce-${_}'`);if(j.length>0)k.push(`${E} ${j.join(" ")}`)}}return k.join("; ")}function Lf(v,_){return`<meta http-equiv="Content-Security-Policy" content="${zx(v,_).replace(/&/g,"&").replace(/"/g,""")}">`}function Bf(v,_,k){if(!_.enabled||!_.addMetaTag)return v;if(v.includes('http-equiv="Content-Security-Policy"'))return v;if(!v.includes("<head>")&&!v.includes("<head "))return v;let E=_.useNonce?mo(k,_):void 0,T=Lf(_.directives,E);return v.replace(/<head([^>]*)>/,`<head$1>
|
|
1709
|
-
${T}`)}function zf(v,_){let k=v;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(E,T)=>{if(T.includes("nonce="))return E;return`<script nonce="${_}"${T}>`}),k=k.replace(/<style([^>]*)>/gi,(E,T)=>{if(T.includes("nonce="))return E;return`<style nonce="${_}"${T}>`}),k}function Ff(v,_,k,E){let T=v,j=E.csp;if(T=T.replace(/@csp\b/g,()=>{if(!j?.enabled||!j.directives)return"<!-- CSP not configured -->";let B=j.useNonce?mo(_,j):void 0;return Lf(j.directives,B)}),T=T.replace(/@cspNonce\b/g,()=>{if(!j?.enabled||!j.useNonce)return"";return mo(_,j)}),j?.enabled&&j.useNonce)_.cspNonce=mo(_,j);return T}import Fx from"crypto";var Wx=40,Wf="_token",qc=null;function Vx(v=Wx){let _=Fx.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return qc=_,_}function Ux(){if(!qc)Vx();return qc}function Hx(v=Wf){let _=Ux();return`<input type="hidden" name="${v}" value="${_}">`}function Vf(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,E)=>Hx(E||Wf))}async function Uf(v,_,k,E){if(!E.customDirectives||E.customDirectives.length===0)return v;let T=v;for(let j of E.customDirectives){if(!j.name||typeof j.handler!=="function"){if(E.debug)console.warn("Invalid custom directive:",j);continue}if(j.hasEndTag)T=await qx(T,j,_,k,E);else T=await Kx(T,j,_,k,E)}return T}async function qx(v,_,k,E,T){let{name:j,handler:B}=_,z=`@${j}`,F=`@end${j}`,V=v,H=kr(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),G=[],ne=H.exec(V);while(ne!==null){let[J,re="",se=""]=ne,ie=ne.index||0;try{let oe=re?Hf(_,re):[],de=se.trim(),ae=await B(de,oe,k,E);G.push({original:J,processed:ae,startIndex:ie})}catch(oe){let de=oe instanceof Error?oe.message:String(oe);if(T.debug)console.error(`Error processing custom directive @${j}:`,oe);G.push({original:J,processed:i("CustomDirective",`Error in @${j}${re?`(${re})`:""}: ${de}`,t.EVALUATION_ERROR),startIndex:ie})}ne=H.exec(V)}for(let J=G.length-1;J>=0;J--){let{original:re,processed:se}=G[J];V=V.replace(re,se)}return V}async function Kx(v,_,k,E,T){let{name:j,handler:B}=_,z=v,F=[],V=[];if(_.rawParams){for(let ne of Ts(z,kr(`(?<![\\w$@])@${j}\\s*\\(`,"g")))if(ne.end!==-1)V.push({fullMatch:ne.call,paramString:ne.args,startIndex:ne.start})}else{let ne=kr(`@${j}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");ne.lastIndex=0;let J=ne.exec(z);while(J!==null)V.push({fullMatch:J[0],paramString:J[1]??"",startIndex:J.index||0}),J=ne.exec(z)}for(let{fullMatch:ne,paramString:J,startIndex:re}of V)try{let se=Hf(_,J),ie=await B("",se,k,E);F.push({original:ne,processed:ie,startIndex:re})}catch(se){let ie=se instanceof Error?se.message:String(se);if(T.debug)console.error(`Error processing custom directive @${j}:`,se);F.push({original:ne,processed:i("CustomDirective",`Error in @${j}(${J}): ${ie}`,t.EVALUATION_ERROR),startIndex:re})}let H=kr(`@${j}(?!\\w)(?!\\s*\\()`,"g"),G=H.exec(z);while(G!==null){let[ne]=G,J=G.index||0;try{let re=await B("",[],k,E);F.push({original:ne,processed:re,startIndex:J})}catch(re){let se=re instanceof Error?re.message:String(re);if(T.debug)console.error(`Error processing custom directive @${j}:`,re);F.push({original:ne,processed:i("CustomDirective",`Error in @${j}: ${se}`,t.EVALUATION_ERROR),startIndex:J})}G=H.exec(z)}for(let ne=F.length-1;ne>=0;ne--){let{original:J,processed:re}=F[ne];z=z.replace(J,re)}return z}function Hf(v,_){return v.rawParams?Ge(_):Xx(_)}function Xx(v){if(!v.trim())return[];let _=[],k="",E=!1,T="";for(let j=0;j<v.length;j++){let B=v[j];if((B==='"'||B==="'")&&(j===0||v[j-1]!=="\\"))if(!E)E=!0,T=B;else if(B===T)E=!1;else k+=B;else if(B===","&&!E)_.push(k.trim()),k="";else k+=B}if(k.trim())_.push(k.trim());return _.map((j)=>{let B=j.trim();if(B.startsWith('"')&&B.endsWith('"')||B.startsWith("'")&&B.endsWith("'"))return B.substring(1,B.length-1);return B})}var qf=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Kf=/^[A-Za-z_$][\w$]*$/,Zx=new Set(["light","dark","system"]);function Mr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function Gx(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:E}=_;if(Mr(_.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!E||typeof E!=="object"||Array.isArray(E))throw Error("@appearanceBootstrap colorMode must be an object");if(Mr(E.key,"colorMode.key"),Mr(E.attribute,"colorMode.attribute"),Mr(E.default,"colorMode.default"),!Kf.test(E.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!qf.test(E.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Zx.has(E.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Mr(k.key,"appearance.key"),Mr(k.attribute,"appearance.attribute"),Mr(k.default,"appearance.default"),!Kf.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!qf.test(k.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(k.allowed)||k.allowed.length===0||k.allowed.some((j)=>typeof j!=="string"||j.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!k.allowed.includes(k.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");T={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:_.storageKey,appearance:T,colorMode:{key:E.key,attribute:E.attribute,default:E.default},respectExisting:_.respectExisting===!0}}function Jx(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Yx(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Jx(v)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Qx(v,_){let k=1,E=null,T=!1;for(let j=_+1;j<v.length;j++){let B=v[j];if(T){T=!1;continue}if(E){if(B==="\\")T=!0;else if(B===E)E=null;continue}if(B==='"'||B==="'"||B==="`"){E=B;continue}if(B==="(")k++;else if(B===")"&&--k===0)return j}return-1}function Xf(v,_){let k=v,E=/@appearanceBootstrap\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index+T[0].length-1,B=Qx(k,j);if(B===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=k.slice(j+1,B).trim(),F=c(`(${z})`,_),V=Yx(Gx(F));k=k.slice(0,T.index)+V+k.slice(B+1),E.lastIndex=T.index+V.length}return k}import eb from"crypto";function Wt(v){return String(v??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Gf={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function ho(v,_,k,E){let T=v||_;return k?`${T} ${E}`:T}function vn(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ns(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${Wt(_)}"`}function Kc(v,_,k){if(!_)return"";let E="";if(!/\baria-invalid\s*=/i.test(k))E+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))E+=` aria-describedby="${Wt(`${vn(v)}-error`)}"`;return E}function tb(){return eb.randomUUID()}function yo(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let E=tb();_.csrf={token:E}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${Wt(_.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(E,T)=>{let j=T.toUpperCase();if(T&&!["GET","POST"].includes(j))return`<input type="hidden" name="_method" value="${Wt(j)}">`;return E}),k}function Jf(v,_,k=Gf){let E=v;return E=E.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,j,B,z,F,V="")=>{let H=j||B||"POST",G=z||F||"",ne=hr(V),J=H.toUpperCase(),re=["GET","POST"].includes(J)?J:"POST",se=`<form method="${Wt(re)}" action="${Wt(G)}"${ne?` ${ne}`:""}>`;if(se+=`
|
|
1710
|
-
${
|
|
1711
|
-
${yo(`@method('${J}')`,_)}`;return se}),E=E.replace(/@endform/g,"</form>"),E=E.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,j,B,z,F,V="")=>{let H=j||B||"",G=z||F||"",ne=hr(V),J=_i(H,_),re=J!==void 0&&J!==null?J:G||"",se=ne.match(/type=['"]([^'"]+)['"]/i),ie=se?se[1]:"text",oe=Ri(H,_),de=ne.match(/class=['"]([^'"]+)['"]/i),ae=ho(de?de[1]:"",k.input,oe,k.inputError),me=ne.replace(/class=['"][^'"]+['"]/i,"");return me=me.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Wt(ie)}" name="${Wt(H)}"${Ns(ne,vn(H))} value="${Wt(re)}" class="${ae}"${Kc(H,oe,ne)}${me?` ${me}`:""}>`}),E=E.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,j,B="",z="")=>{let F=hr(B),V=_i(j,_)||z.trim(),H=Ri(j,_),G=F.match(/class=['"]([^'"]+)['"]/i),ne=ho(G?G[1]:"",k.input,H,k.inputError),J=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Wt(j)}"${Ns(F,vn(j))} class="${ne}"${Kc(j,H,F)}${J?` ${J}`:""}>${Wt(V)}</textarea>`}),E=E.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,j,B="",z)=>{let F=hr(B),V=_i(j,_),H=Ri(j,_),G=F.match(/class=['"]([^'"]+)['"]/i),ne=ho(G?G[1]:"",k.input,H,k.inputError),J=F.replace(/class=['"][^'"]+['"]/i,""),re=z;if(V!==void 0)re=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(se,ie,oe)=>{if((Array.isArray(V)?V.some((ae)=>String(ae)===oe):String(V)===oe)&&!ie.includes("selected"))return ie.replace(/(<option)/,"$1 selected");return se});return`<select name="${Wt(j)}"${Ns(F,vn(j))} class="${ne}"${Kc(j,H,F)}${J?` ${J}`:""}>${re}</select>`}),E=E.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=B===void 0?"1":B,V=B===void 0?vn(j):`${vn(j)}-${vn(F)}`,H=hr(z),G=_i(j,_),ne=G!==void 0&&(Array.isArray(G)?G.some((ie)=>String(ie)===F):G===!0||String(G)===F),J=H.match(/class=['"]([^'"]+)['"]/i),re=J?J[1]:k.checkInput,se=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Wt(j)}"${Ns(H,V)} value="${Wt(F)}" class="${re}"${ne?" checked":""}${se?` ${se}`:""}>`}),E=E.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=hr(z),V=_i(j,_),H=V!==void 0&&V===B,G=F.match(/class=['"]([^'"]+)['"]/i),ne=G?G[1]:k.checkInput,J=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Wt(j)}"${Ns(F,`${vn(j)}-${vn(B)}`)} value="${Wt(B)}" class="${ne}"${H?" checked":""}${J?` ${J}`:""}>`}),E=E.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B="")=>{let z=hr(B),F=z.match(/accept=['"]([^'"]+)['"]/i),V=F?F[1]:"",H=z.includes("multiple"),G=Ri(j,_),ne=z.match(/class=['"]([^'"]+)['"]/i),J=ho(ne?ne[1]:"",k.input,G,k.inputError),re=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${Wt(j)}"${Ns(z,vn(j))}`,`class="${J}"`];if(V)se.push(`accept="${Wt(V)}"`);if(H)se.push("multiple");if(re)se.push(re);return`${se.join(" ")}>`}),E=E.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,j,B="",z)=>{let F=hr(B),V=F.match(/class=['"]([^'"]+)['"]/i),H=V?V[1]:k.label,G=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Wt(vn(j))}" class="${H}"${G?` ${G}`:""}>${z}</label>`}),E}function Yf(v,_,k=Gf){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(E,T,j)=>{try{if(Ri(T,_)){let B=j.replace(/\{\{([^}]+)\}\}/g,(z,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return Zf(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Zf(T,_)}let V=F.trim();if(p(V)){let H=c(V,_);return H!==void 0?String(H):V}return V}catch{return F}});return`<div id="${Wt(`${vn(T)}-error`)}" role="alert">${B}</div>`}return""}catch(B){return console.error("Error processing @error directive:",B),E}})}function Ri(v,_){if(!_.errors)return!1;if(typeof _.errors.has==="function")return _.errors.has(v);if(typeof _.errors==="object")return Object.prototype.hasOwnProperty.call(_.errors,v);return!1}function Zf(v,_){if(!_.errors)return"";if(typeof _.errors.get==="function")return _.errors.get(v);if(typeof _.errors==="object"&&Object.prototype.hasOwnProperty.call(_.errors,v)){let k=_.errors[v];return Array.isArray(k)?k[0]:String(k)}return""}function _i(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let E=v.slice(0,-2);if(k=_[E],k!==void 0)return k}return _[v]}function hr(v){if(!v.trim())return"";let _=[],k=v.trim(),E=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=E.exec(k))!==null){let[,j,,B]=T;_.push(`${j}="${B.trim()}"`)}return _.join(" ")}var Ti=/<\/?template\b[^>]*>/gi,nb=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function rb(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return nb.test(_)}function Z(v){Ti.lastIndex=0;let _;while((_=Ti.exec(v))!==null){if(_[0].startsWith("</")||rb(_[0]))continue;let k=_.index,E=Ti.lastIndex,T=1,j;while((j=Ti.exec(v))!==null)if(j[0].startsWith("</")){if(T--,T===0){let B=j.index;return{start:k,openEnd:E,closeStart:B,end:Ti.lastIndex,content:v.slice(E,B)}}}else T++;return null}return null}import Mt from"path";import{existsSync as kv}from"fs";import xo from"fs";import Bt from"path";var Qf=new Map;function bo(v,_=!0){let k=Qf.get(v);if(_&&k)return k;let E=new Map,T=[Bt.join(v,"src"),Bt.join(v,"dist"),v];function j(B,z){if(z>6)return;let F;try{F=xo.readdirSync(B,{withFileTypes:!0})}catch{return}for(let V of F){let H=Bt.join(B,V.name);if(V.isDirectory()){if(V.name==="node_modules"||V.name.startsWith("."))continue;j(H,z+1)}else if(V.isFile()&&V.name.endsWith(".stx")){let G=V.name.slice(0,-4);if(!E.has(G))E.set(G,H);let ne=G.toLowerCase();if(!E.has(ne))E.set(ne,H);let J=G.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!E.has(J))E.set(J,H)}}}for(let B of T)if(j(B,0),E.size>0)break;if(_)Qf.set(v,E);return E}function vo(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let E=Bt.join(k,"node_modules",v);try{if(xo.statSync(E).isDirectory())return E}catch{}let T=Bt.dirname(k);if(T===k)return null;k=T}}function wo(v,_,k={}){return[Bt.resolve(Bt.dirname(_),`${v}.stx`),Bt.resolve(Bt.dirname(_),v),Bt.resolve(k.componentsDir||"components",`${v}.stx`),Bt.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function ep(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),E=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[_,k,E]}function Xc(v,_){let[k,E,T]=ep(v);for(let j of[k,k.toLowerCase(),E,T]){let B=_?.__importedComponents?.get(j);if(B!==void 0)return B}}function*Zc(v,_,k={},E){let T=ep(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield Bt.resolve(Bt.dirname(_),`${T[0]}.stx`);return}let j=[...new Set(T.map((F)=>`${F}.stx`))],B=k.projectRoot||process.cwd(),z=[...E?.__originalFilePath?[Bt.join(Bt.dirname(E.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Bt.join(Bt.dirname(_),"components"),Bt.resolve(B,"src/components"),Bt.resolve(B,"components"),...import.meta.dir?[Bt.resolve(import.meta.dir,"components")]:[]];for(let F of new Set(z)){for(let V of j)yield Bt.join(F,V);try{for(let V of xo.readdirSync(F,{withFileTypes:!0}))if(V.isDirectory())for(let H of j)yield Bt.join(F,V.name,H)}catch{}}}function tp(v,_,k={},E){let T=Xc(v,E);if(T!==void 0)return T;for(let j of Zc(v,_,k,E))try{if(xo.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return null}class np{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,E){let T=Xc(v,E);if(T!==void 0)return T;for(let j of Zc(v,_,k,E))if(await r(j))return j;return null}}var Ls=new np;function Ot(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Or="\x00stx-boolean-attribute";function Gc(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}function yr(v,_){let k=[];for(let[E,T]of Object.entries(v.static)){if(_.has(E))continue;let j=v.staticNames?.[E]??E;if(typeof T==="boolean"){if(T)k.push(Ot(j));continue}if(T===Or){k.push(Ot(j));continue}k.push(`${Ot(j)}="${Ot(Gc(String(T)))}"`)}return k}function xr(v,_){let k=[];for(let[E,T]of Object.entries(v.serverDynamic??{})){if(_.has(E))continue;if(T===null||T===void 0||T===!1)continue;let j=v.serverDynamicNames?.[E]??E;if(T===!0){k.push(Ot(j));continue}if(typeof T==="object")continue;k.push(`${Ot(j)}="${Ot(Gc(String(T)))}"`)}return k}function Bs(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function sb(v){if(v.clientReactive.to)return{value:v.clientReactive.to,reactive:!0};if(v.serverDynamic.to!==void 0)return{value:String(v.serverDynamic.to),reactive:!1};if(typeof v.static.to==="string")return{value:v.static.to,reactive:!1};return{value:"#",reactive:!1}}var Jc={name:"StxLink",aliases:["stx-link"],render(v,_,k){let E=sb(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),j=typeof v.static.activeClass==="string"?v.static.activeClass:"active",B=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",z=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,F=[];if(E.reactive)F.push(`:href="${Bs(E.value)}"`);else F.push(`href="${Bs(Gs(E.value,"navigable"))}"`);if(T)F.push(`class="${Bs(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${Bs(j)}"`),F.push(`data-stx-exact-active-class="${Bs(B)}"`),z)F.push("data-stx-prefetch");let V=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(V)F.push(`data-stx-active-match="${Bs(V)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...yr(v,H)),F.push(...xr(v,H)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as gp}from"crypto";import Yt from"fs";import Ht from"path";import{decode as fb,generateThumbHash as pb}from"ts-images";import{createImageDeliveryCatalog as cp}from"ts-images/delivery";import Yc from"fs";function So(v,_,k){let E=Buffer.alloc(k),T=Yc.readSync(v,E,0,k,_);return E.subarray(0,T)}function Qc(v){if(v.length<25)return!1;let _=(E,T)=>String.fromCharCode(...v.subarray(E,T));if(_(0,4)!=="RIFF"||_(8,12)!=="WEBP")return!1;let k=_(12,16);if(k==="VP8X")return(v[20]&16)!==0;if(k==="VP8L")return((v[21]|v[22]<<8|v[23]<<16|v[24]<<24)>>>28&1)===1;return!1}function el(v){let _;try{_=Yc.openSync(v,"r");let k=So(_,0,33);if(k.length>=3&&k[0]===255&&k[1]===216&&k[2]===255)return"none";if(k.length>=26&&k[0]===137&&k.toString("latin1",1,4)==="PNG"){let E=k[25];if(E===4||E===6)return"possible";let T=8;for(let j=0;j<64;j++){let B=So(_,T,8);if(B.length<8)return"unknown";let z=B.toString("latin1",4,8);if(z==="tRNS")return"possible";if(z==="IDAT"||z==="IEND")return"none";T+=12+B.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(Qc(k))return"possible";let E=k.toString("latin1",12,16);return E==="VP8 "||E==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)Yc.closeSync(_)}}import ib from"fs";import $o from"os";import{join as rp}from"path";import{fileURLToPath as sp}from"url";import{Worker as ip}from"worker_threads";var ko=Symbol("stx.image-worker.unavailable");function ob(v=typeof $o.availableParallelism==="function"?$o.availableParallelism():$o.cpus().length){return Math.max(1,Math.min(2,v-1))}var _o=0,ap=[];async function ab(){if(_o<ob()){_o++;return}await new Promise((v)=>ap.push(v)),_o++}function cb(){_o--,ap.shift()?.()}var lb="@stacksjs/stx/builtins/image-warmup-worker";function ub(v=process.cwd()){let _=import.meta.url.endsWith(".ts")?"ts":"js";try{let k=new URL(`./image-warmup-worker.${_}`,import.meta.url);if(k.protocol==="file:"&&ib.existsSync(sp(k)))return sp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(lb,v):void 0;return k&&db(k)?k:void 0}catch{return}}function db(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,rp(_.BUN_INSTALL||rp($o.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var op=!1;function Ai(v){if(!op)op=!0,console.warn(`[stx] image worker unavailable (${v}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ko}function tl(v){return v instanceof Error?v.message:String(v)}async function nl(v,_){if(typeof ip!=="function")return Ai("node:worker_threads has no Worker in this runtime");let k=ub();if(!k)return Ai("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await ab();try{return await new Promise((E,T)=>{let j;try{j=new ip(k)}catch(V){E(Ai(`could not start ${k}: ${tl(V)}`));return}let B=!1,z=!1,F=(V)=>{if(z)return;z=!0,V(),j.terminate()};j.on("message",(V)=>{if(V.type==="ready"){B=!0,j.postMessage({task:v,args:_});return}if(V.type==="result"){F(()=>E(V.value));return}let H=Error(V.error?.message??"image worker failed");if(V.error?.name)H.name=V.error.name;if(V.error?.stack)H.stack=V.error.stack;F(()=>T(H))}),j.on("error",(V)=>{F(()=>B?T(V instanceof Error?V:Error(tl(V)||"image worker crashed")):E(Ai(`the worker failed before it was ready: ${tl(V)}`)))}),j.on("exit",(V)=>{F(()=>B?T(Error("image worker exited before it finished")):E(Ai(`the worker exited with code ${V} before it was ready`)))})})}finally{cb()}}var gb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),mb=[320,640,960,1280,1920],Co="/_stx/images",hb=`stx:${Co}:alpha-1`,yb=["@stacksjs/ts-webp","@stacksjs/ts-avif"],Eo;function xb(v,_){let k=Ht.dirname(Bun.resolveSync(v,_));while(k!==Ht.dirname(k)){let E=Ht.join(k,"package.json");if(Yt.existsSync(E)){let T=JSON.parse(Yt.readFileSync(E,"utf8"));if(T.name===v)return T.version}k=Ht.dirname(k)}return}function bb(){if(Eo!==void 0)return Eo;let v;try{v=Ht.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Eo=yb.map((_)=>{let k;try{k=v?xb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),Eo}var lp=Symbol.for("stx.image-delivery");function Ii(){let v=globalThis;return v[lp]??={catalog:new Map,transparent:new Set},v[lp]}var up=new Set;function vb(v){return`/${v.split(Ht.sep).map(encodeURIComponent).join("/")}`}function wb(v){let _=Ht.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),E=gp("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${E}`}function dp(v,_=`stx:${Co}`){let k=(E)=>`${Co}/${E.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(E){let T=Ht.join(v,E);try{let j=await Yt.promises.stat(T);return j.size>0?{bytes:j.size,path:T,url:k(E)}:null}catch{return null}},async write(E,T){let j=Ht.join(v,E);await Yt.promises.mkdir(Ht.dirname(j),{recursive:!0});let B=`${j}.${process.pid}.tmp`;return await Yt.promises.writeFile(B,T),await Yt.promises.rename(B,j),{bytes:T.byteLength,path:j,url:k(E)}},url:k}}async function mp(v,_=v){let k=await Yt.promises.readdir(_,{withFileTypes:!0});k.sort((T,j)=>T.name.localeCompare(j.name));let E=[];for(let T of k){let j=Ht.join(_,T.name);if(T.isDirectory()){E.push(...await mp(v,j));continue}if(!T.isFile()||!gb.has(Ht.extname(T.name).toLowerCase()))continue;E.push({absolutePath:j,relativePath:Ht.relative(v,j)})}return E}function fp(v,_){return v.map((k)=>({key:vb(k.relativePath),input:k.absolutePath,name:wb(k.relativePath),...Sb(k.absolutePath)?{options:{storage:_}}:{}}))}function Sb(v){return el(v)==="possible"}function $b(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function _b(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,E=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([j,B])=>{let z=B.variants.filter((F)=>F.format==="png").sort((F,V)=>F.width-V.width)[0];try{let F=await fb(new Uint8Array(await Yt.promises.readFile(z?.path??B.fallback.path)));if($b(F.data))k.add(j)}catch{k.add(j)}}));return k}function kb(v,_){let k=[];for(let E of _){let T=v[E],j=T?.variants.filter((z)=>z.format==="webp")??[];if(!T||j.length===0)continue;if(!j.some((z)=>{let F;try{return F=Yt.openSync(z.path,"r"),!Qc(So(F,0,32))}catch{return!0}finally{if(F!==void 0)Yt.closeSync(F)}}))continue;if(T.variants=T.variants.filter((z)=>z.format!=="webp"),delete T.sources.webp,k.push(E),!up.has(E))up.add(E),console.warn(`[stx-images] ${E} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return k}async function Eb(v){let _=[],k=8;for(let E=0;E<v.length;E+=8){let T=v.slice(E,E+8),j=await Promise.all(T.map(async(B)=>{try{return await pb(B.absolutePath),B}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${B.relativePath}`),null}}));_.push(...j.filter((B)=>B!==null))}return _}function rl(v){return Ht.join(v,"undecodable.json")}function Cb(v){try{let _=Yt.readFileSync(rl(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function Rb(v,_){try{Yt.mkdirSync(Ht.dirname(rl(v)),{recursive:!0}),Yt.writeFileSync(rl(v),JSON.stringify(_))}catch{}}function pp(v){try{let _=Yt.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function hp(v){if(!v||v.startsWith("data:")||v.startsWith("blob:")||/^https?:\/\//i.test(v)||v.startsWith("//"))return;let _=v.split(/[?#]/,1)[0];if(!_)return;try{return`/${_.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Qr(v){let _=hp(v);return _?Ii().catalog.get(_):void 0}function es(v){let _=hp(v);return _?Ii().transparent.has(_):!1}function ts(v){let _=(E)=>v.variants.filter((T)=>T.format===E).reduce((T,j)=>T+j.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((E)=>({format:E,srcset:v.sources[E]||"",bytes:_(E)})).filter((E)=>E.srcset&&E.bytes>0&&E.bytes<k).sort((E,T)=>E.bytes-T.bytes).map(({format:E,srcset:T})=>({format:E,srcset:T}))}function Nu(v){let _=Qr(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:ts(_).map(({format:k,srcset:E})=>({type:`image/${k}`,srcset:E})),width:_.source.width,height:_.source.height,placeholder:es(v)?void 0:_.placeholder?.dataUrl}}function Bn(){let v=Ii();v.catalog=new Map,v.transparent=new Set}function Tb(v){let _=Ii();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function Lu(v,_,k={}){if(!v||!Yt.existsSync(v))return Bn(),{count:0,fingerprint:""};if(k.offThread){let re=await nl("delivery",{publicDir:v,outputDir:_});if(re!==ko)return Tb(re.state),re.result}let E=await mp(v);if(E.length===0)return Bn(),{count:0,fingerprint:""};let T=Cb(_),j=E.filter((re)=>{let se=T[re.relativePath];if(!se)return!0;let ie=pp(re.absolutePath);return!ie||ie.mtimeMs!==se.mtimeMs||ie.size!==se.size});if(j.length===0)return Bn(),{count:0,fingerprint:""};let B=dp(Ht.join(_,"_stx","images"),`${hb}:${bb()}`),z={outDir:Ht.join(_,"_stx","images"),storage:dp(Ht.join(_,"_stx","images")),baseUrl:Co,widths:mb,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},F=j,V;try{V=await cp({...z,entries:fp(j,B)})}catch(re){if(F=await Eb(j),F.length===j.length)throw re;let se=new Set(F.map((oe)=>oe.relativePath)),ie=!1;for(let oe of j){if(se.has(oe.relativePath))continue;let de=pp(oe.absolutePath);if(!de)continue;T[oe.relativePath]=de,ie=!0}if(ie)Rb(_,T);if(F.length===0)return Bn(),{count:0,fingerprint:""};V=await cp({...z,entries:fp(F,B)})}let H=await _b(V.entries),G=kb(V.entries,H),ne=Ii();ne.catalog=new Map(Object.entries(V.entries)),ne.transparent=H;let J=H.size===0&&G.length===0?V.fingerprint:gp("sha256").update(V.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:G.sort()})).digest("hex");return{count:F.length,fingerprint:J}}var Ab=new Map;function sl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return Ab.get(_)}var Ib={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},il=[320,640,768,1024,1280,1536,1920];function zt(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Xt(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Ro(v,_,k=!1){let E=v.serverDynamic[_];if(E!==void 0)return E!==!1&&E!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function ol(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let E of _)if(E.includes(":")){let[T,j]=E.split(":"),B=Ib[T];if(B)k.push(`(max-width: ${B}px) ${j}`);else{let z=Number.parseInt(T);if(!Number.isNaN(z))k.push(`(max-width: ${z}px) ${j}`)}}else k.push(E);return k.join(", ")}function al(v,_,k,E){return _.map((T)=>`${Pi(v,T,void 0,k,E)} ${T}w`).join(", ")}function Pb(v,_,k,E,T){return _.map((j)=>{let B=k?k*j:void 0;return`${Pi(v,B,void 0,E,T)} ${j}x`}).join(", ")}function Pi(v,_,k,E,T){if(!E||E==="local"||E==="static")return v;if(E==="cloudinary"){let j=[];if(_)j.push(`w_${_}`);if(k)j.push(`h_${k}`);if(T)j.push(`f_${T}`);j.push("q_auto");let B=j.join(",");return v.replace("/upload/",`/upload/${B}/`)}if(E==="imgix"){let j=new URLSearchParams;if(_)j.set("w",String(_));if(k)j.set("h",String(k));if(T)j.set("fm",T);j.set("auto","format");let B=v.includes("?")?"&":"?";return`${v}${B}${j.toString()}`}if(E==="bunny"){let j=new URLSearchParams;if(_)j.set("width",String(_));if(k)j.set("height",String(k));if(T)j.set("format",T);let B=v.includes("?")?"&":"?";return`${v}${B}${j.toString()}`}return v}function Db(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function Mb(v,_,k="#e5e7eb"){let E=`<svg xmlns="http://www.w3.org/2000/svg" width="${v}" height="${_}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(E)}`}var cl={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let E=Xt(v,"src")||"",T=Qr(E),j=Xt(v,"alt")||"",B=Xt(v,"width")||(T?String(T.source.width):void 0),z=Xt(v,"height")||(T?String(T.source.height):void 0),F=Xt(v,"sizes"),V=Xt(v,"srcset"),H=Xt(v,"densities"),G=Xt(v,"format"),ne=es(E)||sl(E)?.transparent===!0,J=Xt(v,"placeholder")||(T&&!ne?"thumbhash":void 0),re=Xt(v,"placeholderColor")||"#e5e7eb",se=Xt(v,"provider"),ie=Xt(v,"class")||Xt(v,"className")||"",oe=Xt(v,"style")||"",de=Xt(v,"quality"),ae=Ro(v,"lazy",!0),me=Ro(v,"preload",!1),ve=Ro(v,"priority",!1),Se=Xt(v,"loading"),$e=Xt(v,"decoding")||"async",Re=!!T||Ro(v,"picture",!1)||!!G,Ee=B?Number.parseInt(B):void 0,Te=z?Number.parseInt(z):void 0,Ce=V||"",_e="";if(T)Ce=T.sources[T.fallback.format]||"",_e=F?ol(F):"100vw";else if(!Ce&&F&&se&&se!=="local"&&se!=="static")Ce=al(E,il,se,G),_e=ol(F);else if(!Ce&&H){let ut=H.split(/\s+/).map((dt)=>Number.parseFloat(dt.replace("x","")));Ce=Pb(E,ut,Ee,se,G)}else if(F)_e=ol(F);let Ie=[];if(oe)Ie.push(oe);if(Ee&&Te)Ie.push(`aspect-ratio:${Ee}/${Te}`);let Xe=[],Pe=J==="blur"||J==="color"||J==="thumbhash";if(Pe&&!ne){let ut=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:re}:sl(E);if(ut&&J==="color")Ie.push(`background-color:${ut.color}`),Xe.push("backgroundColor");else if(ut)Ie.push(`background-color:${ut.color}`),Ie.push(`background-image:url(${ut.dataUrl})`),Ie.push("background-size:cover"),Ie.push("background-repeat:no-repeat"),Xe.push("backgroundColor","backgroundImage");else{let dt=Mb(Ee||16,Te||9,re);Ie.push(`background-image:url(${dt})`),Ie.push("background-size:cover"),Ie.push("background-repeat:no-repeat"),Xe.push("backgroundImage")}}else if(!Pe&&J&&J!=="empty"&&J!=="none")Ie.push(`background-image:url(${zt(J)})`),Ie.push("background-size:cover"),Ie.push("background-repeat:no-repeat"),Xe.push("backgroundImage");let Ae=T?.fallback.url||Pi(E,Ee,Te,se,G),Ze=[];if(Ze.push(`src="${zt(Gs(Ae,"fetched"))}"`),Ze.push(`alt="${zt(j)}"`),B)Ze.push(`width="${zt(B)}"`);if(z)Ze.push(`height="${zt(z)}"`);let ct=Se||(ve||me?"eager":ae?"lazy":"");if(ct)Ze.push(`loading="${zt(ct)}"`);if(ve)Ze.push('fetchpriority="high"');if(Ze.push(`decoding="${zt($e)}"`),ie)Ze.push(`class="${zt(ie)}"`);if(Ie.length>0)Ze.push(`style="${zt(Ie.join(";"))}"`);if(Ce)Ze.push(`srcset="${zt(Gs(Ce,"fetched"))}"`);if(_e)Ze.push(`sizes="${zt(_e)}"`);let it=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Xe.length>0){let ut=typeof v.static.onload==="string"?v.static.onload:"",dt=Db(Xe)+(ut?`;${ut}`:"");Ze.push(`onload="${zt(dt)}"`),it.add("onload")}Ze.push(...yr(v,it)),Ze.push(...xr(v,it));let rt=`<img ${Ze.join(" ")} />`,gt="";if(me){let dt=G==="webp"?"image/webp":G==="avif"?"image/avif":"";gt=`<link rel="preload" as="image" href="${zt(Ae)}"${dt?` type="${dt}"`:""}${Ce?` imagesrcset="${zt(Ce)}"`:""}${_e?` imagesizes="${zt(_e)}"`:""} />
|
|
1712
|
-
`}if(Re){let ut=[];if(T)for(let dt of ts(T))ut.push(`<source type="image/${dt.format}" srcset="${zt(dt.srcset)}"${_e?` sizes="${zt(_e)}"`:""} />`);if(!T&&(G==="avif"||G==="auto")){let dt=
|
|
1706
|
+
</script>`}function jf(v,_,k){if(!Dx(v))return v;let E=Ex(v);if(E.length===0)return v;let T=Px(v,E),j=Ix(E,_),B=T.lastIndexOf("</body>");if(B!==-1)T=T.slice(0,B)+j+`
|
|
1707
|
+
`+T.slice(B);else T+=j;return T}function Px(v,_){let k=0,E=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,j,B)=>{let z=_[k++];if(!z)return T;let F=/data-stx-scope="([^"]*)"/.exec(B);if(F)return z.id=F[1],z.selector=`[data-stx-scope="${z.id}"]`,T;return`<${j} data-stx-scope="${z.id}"${B}>`});return E=E.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),E=E.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),E=E.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),E=E.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),E}function Dx(v){return/x-data\s*=\s*["']/.test(v)}function gr(v,_){try{let k=v.trim();if(p(k))return l(k,Object.keys(_))(...Object.values(_));else return c(k,_)}catch{return!1}}function mr(v,_){let k=Mx(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function Mx(v,_){let k=_;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let E=S(v,"(",")",k);if(E===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,E),endPos:E+1}}function Ox(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Dr(v,_,k,E){let T=1,j=E,B=new RegExp(`@${_}\\s*\\(`,"g"),z=new RegExp(`@${k}(?![a-z])`,"g");while(j<v.length&&T>0){B.lastIndex=j,z.lastIndex=j;let F=B.exec(v),V=z.exec(v),H=F?F.index:1/0,G=V?V.index:1/0;if(H<G)T++,j=H+F[0].length;else if(G<1/0){if(T--,T===0)return G;j=G+V[0].length}else break}return-1}function Lf(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let E=_+k[0].length,T=mr(v,E);if(!T)return null;let j=T.endPos,B=Dr(v,"if","endif",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,H="if",G=T.expression,ne=0,J=0;while(V<z.length){let re=z.indexOf("@",V);if(re===-1)break;V=re;let se=z.substring(re);if(Ox(z,re)){V++;continue}if(/^@if\s*\(/.test(se)){J++,V++;continue}if(/^@endif(?![a-z])/.test(se)){J--,V+=6;continue}if(J===0){let ie=se.match(/^@elseif\s*/);if(ie){F.push({type:H,condition:G,content:z.substring(ne,V),start:j+ne,end:j+V});let oe=V+ie[0].length,de=mr(z,oe);if(!de){V++;continue}H="elseif",G=de.expression,V=de.endPos,ne=V;continue}else if(/^@else(?![a-z])/.test(se)){F.push({type:H,condition:G,content:z.substring(ne,V),start:j+ne,end:j+V}),H="else",G=void 0,V+=5,ne=V;continue}}V++}return F.push({type:H,condition:G,content:z.slice(ne),start:j+ne,end:j+z.length}),{fullMatch:v.slice(_,B+6),branches:F,start:_,end:B+6}}function _i(v){let _=[],k=/@if\s*\(/g,E=k.exec(v);while(E!==null){if(_.some((B)=>E.index>B.start&&E.index<B.end)){E=k.exec(v);continue}let j=Lf(v,E.index);if(j)_.push(j),k.lastIndex=j.end;E=k.exec(v)}return _}function ho(v,_,k){let E=[],T=new RegExp(`@${_}\\s*\\(`,"g"),j=T.exec(v);while(j!==null){if(E.some((se)=>j.index>se.start&&j.index<se.end)){j=T.exec(v);continue}let z=j.index,F=z+j[0].length-1,V=S(v,"(",")",F);if(V===-1){j=T.exec(v);continue}let H=v.slice(F+1,V),G=V+1,ne=Dr(v,_,k,G);if(ne===-1){j=T.exec(v);continue}let J=v.slice(G,ne),re=ne+`@${k}`.length;E.push({fullMatch:v.slice(z,re),name:_,params:H,content:J,start:z,end:re}),T.lastIndex=re,j=T.exec(v)}return E}function Uc(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let E=_+k[0].length,T=mr(v,E);if(!T)return null;let j=T.endPos,B=Dr(v,"switch","endswitch",j);if(B===-1)return null;let z=v.slice(j,B),F=[],V=0,H=null,G=0;while(V<z.length){let ne=z.slice(V),J=ne.match(/^@switch\s*\(/),re=ne.match(/^@endswitch(?![a-z])/);if(J){if(G++,H)H.content+=J[0];V+=J[0].length;continue}if(re){if(G--,H)H.content+=re[0];V+=re[0].length;continue}if(G>0){if(H)H.content+=z[V];V++;continue}let se=ne.match(/^@case\s*/),ie=ne.match(/^@default(?![a-z])/),oe=ne.match(/^@break(?![a-z])/);if(se&&ne.startsWith("@case")){if(H)F.push(H);let de=V+se[0].length,ae=mr(z,de);if(!ae){V++;continue}H={type:"case",value:ae.expression,content:""},V=ae.endPos}else if(ie&&ne.startsWith("@default")){if(H)F.push(H);H={type:"default",content:""},V+=ie[0].length}else if(oe&&ne.startsWith("@break"))V+=oe[0].length;else{if(H)H.content+=z[V];V++}}if(H)F.push(H);return{fullMatch:v.slice(_,B+10),expression:T.expression,cases:F,start:_,end:B+10}}function Bx(v,_,k){let E=v,T=!0;while(T){T=!1;let j=E.match(/@switch\s*\(/);if(!j||j.index===void 0)break;let B=j.index,z=Uc(E,B);if(!z)break;try{let F;if(p(z.expression))F=l(z.expression,Object.keys(_))(...Object.values(_));else F=c(z.expression,_);let V="",H=!1;for(let G of z.cases)if(G.type==="default"){if(!H)V=G.content.trim()}else try{let ne;if(G.value&&p(G.value))ne=l(G.value,Object.keys(_))(...Object.values(_));else if(G.value)ne=c(G.value,_);if(F===ne){V=G.content.trim(),H=!0;break}}catch{continue}E=E.substring(0,B)+V+E.substring(z.end),T=!0}catch(F){let V=F instanceof Error?F.message:String(F),H=i("Switch",`Error evaluating @switch expression: ${V}`,t.EVALUATION_ERROR);E=E.substring(0,B)+H+E.substring(z.end);break}}return E}function zx(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(E)=>(_.push(E),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function Fx(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,E)=>_[Number(E)]??k)}function ir(v,_,k){let{masked:E,scripts:T}=zx(v);return Fx(Wx(E,_,k),T)}function Wx(v,_,k){let E=v;E=Bx(E,_,k);{let j=!0;while(j){j=!1;let B=E.match(/@unless\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=mr(E,z+7);if(!F)break;let V=F.endPos,H=Dr(E,"unless","endunless",V);if(H===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let G=E.slice(V,H),ne=F.expression,J=-1;{let se=0,ie=/@(?:if|unless)\s*\(/g,oe=/@(?:endif|endunless)(?![a-z])/g,de=/@else(?![a-z])/g,ae=[],me;while((me=ie.exec(G))!==null)ae.push({pos:me.index,type:"open"});while((me=oe.exec(G))!==null)ae.push({pos:me.index,type:"close"});while((me=de.exec(G))!==null)ae.push({pos:me.index,type:"else"});ae.sort((ve,Se)=>ve.pos-Se.pos);for(let ve of ae)if(ve.type==="open")se++;else if(ve.type==="close")se--;else if(ve.type==="else"&&se===0){J=ve.pos;break}}let re;if(J!==-1){let se=G.slice(0,J),ie=G.slice(J+5);re=`@if (${ne})${ie}@else ${se}@endif`}else re=`@if (!(${ne}))${G}@endif`;E=E.substring(0,z)+re+E.substring(H+10),j=!0}}E=qc(E,_,k),E=Kc(E,_,k),E=Hc(E,_);let T=()=>{let j=_i(E);if(j.length===0)return!1;let B=Array(j.length);for(let V=j.length-1;V>=0;V--){let H=j[V];try{let G="",ne=!1;for(let J of H.branches){if(ne)break;if(J.type==="else")G=J.content,ne=!0;else try{let re;if(J.condition&&p(J.condition))re=l(J.condition,Object.keys(_))(...Object.values(_));else if(J.condition)re=c(J.condition,_);if(re)G=J.content,ne=!0}catch(re){G=i(J.type==="if"?"If":"Elseif",`Error in @${J.type}(${J.condition}): ${re instanceof Error?re.message:String(re)}`,t.EVALUATION_ERROR),ne=!0}}B[V]=G}catch(G){let ne=G instanceof Error?G.message:String(G);B[V]=i("If",`Error processing @if block: ${ne}`,t.EVALUATION_ERROR)}}let z=Array(j.length*2+1),F=0;for(let V=0;V<j.length;V++){let H=j[V];z[V*2]=E.slice(F,H.start),z[V*2+1]=B[V],F=H.end}return z[j.length*2]=E.slice(F),E=z.join(""),!0};while(!0){let j=E;if(!T())break;if(E===j)break}return E}function Bf(v){let _=0;while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!=="(")return null;_++;while(_<v.length&&/\s/.test(v[_]))_++;let k=v[_];if(k!=="'"&&k!=='"')return null;_++;let E=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){E.push(v[_+1]),_+=2;continue}if(T===k){_++;break}E.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:E.join(""),consumed:_}}function Hc(v,_){let k=v;function E(z,F,V,H){let G=1,ne=H,J=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),re=new RegExp(`@${V}(?![a-z])`,"g");while(ne<z.length&&G>0){J.lastIndex=ne,re.lastIndex=ne;let se=J.exec(z),ie=re.exec(z),oe=se?se.index:1/0,de=ie?ie.index:1/0;if(oe<de)G++,ne=oe+se[0].length;else if(de<1/0){if(G--,G===0)return de;ne=de+ie[0].length}else break}return-1}function T(z,F,V){let H=0,G=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),ne=new RegExp(`@${V}(?![a-z])`,"g"),J=/@else(?![a-z])/g,re=[],se;while((se=G.exec(z))!==null)re.push({pos:se.index,type:"open"});while((se=ne.exec(z))!==null)re.push({pos:se.index,type:"close"});while((se=J.exec(z))!==null)re.push({pos:se.index,type:"else"});re.sort((ie,oe)=>ie.pos-oe.pos);for(let ie of re)if(ie.type==="open")H++;else if(ie.type==="close")H--;else if(ie.type==="else"&&H===0)return ie.pos;return-1}{let z=!0;while(z){z=!1;let F=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,G,ne=k.slice(V+5),J=Bf(ne);if(J)H=J.value,G=V+5+J.consumed;else G=V+5;let re=E(k,"auth","endauth",G);if(re===-1){console.warn(`[stx] @auth directive at position ${V} has no matching @endauth \u2014 the block was skipped.`);break}let se=k.slice(G,re),ie=T(se,"auth","endauth"),oe;if(!_.auth)oe=!1;else oe=H?gr(`auth?.check && auth?.user?.[${H}]`,_):gr("auth?.check",_);let de;if(ie!==-1){let ae=se.slice(0,ie),me=se.slice(ie+5);de=oe?ae:me}else de=oe?se:"";k=k.substring(0,V)+de+k.substring(re+8),z=!0}}{let z=!0;while(z){z=!1;let F=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,G,ne=k.slice(V+6),J=Bf(ne);if(J)H=J.value,G=V+6+J.consumed;else G=V+6;let re=E(k,"guest","endguest",G);if(re===-1){console.warn(`[stx] @guest directive at position ${V} has no matching @endguest \u2014 the block was skipped.`);break}let se=k.slice(G,re),ie=T(se,"guest","endguest"),oe;if(!_.auth)oe=!0;else oe=H?gr(`!auth?.check || !auth?.user?.[${H}]`,_):gr("!auth?.check",_);let de;if(ie!==-1){let ae=se.slice(0,ie),me=se.slice(ie+5);de=oe?ae:me}else de=oe?se:"";k=k.substring(0,V)+de+k.substring(re+9),z=!0}}function j(z,F,V){if(_.userCan&&typeof _.userCan[z]==="boolean")return _.userCan[z];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[z];if(F)H.push(F);if(V){let G=gr(V,_);H.push(G)}return _.permissions.check(...H)}catch{return!1}return!1}function B(z){let F=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!F)return null;return{ability:F[1],type:F[2],id:F[3]?.trim(),paramsEnd:F[0].length}}for(let z of["can","cannot"]){let F=`end${z}`,V=z==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let G=k.match(new RegExp(`@${z}\\s*\\(`));if(!G||G.index===void 0)break;let ne=G.index,J=k.slice(ne+`@${z}`.length),re=B(J);if(!re)break;let se=ne+`@${z}`.length+re.paramsEnd,ie=E(k,z,F,se);if(ie===-1){console.warn(`[stx] @${z} directive at position ${ne} has no matching @${F} \u2014 the block was skipped.`);break}let oe=k.slice(se,ie),de=[],ae=0,me=new RegExp(`@${z}\\s*\\(`,"g"),ve=new RegExp(`@${F}(?![a-z])`,"g"),Se=new RegExp(`@${V}\\s*\\(`,"g"),$e=/@else(?![a-z])/g,Re=[],Ee;while((Ee=me.exec(oe))!==null)Re.push({pos:Ee.index,type:"open"});while((Ee=ve.exec(oe))!==null)Re.push({pos:Ee.index,type:"close"});while((Ee=Se.exec(oe))!==null)Re.push({pos:Ee.index,type:"elseDirective"});while((Ee=$e.exec(oe))!==null)Re.push({pos:Ee.index,type:"else"});Re.sort((Pe,Ae)=>Pe.pos-Ae.pos);for(let Pe of Re){if(Pe.type==="open"){ae++;continue}if(Pe.type==="close"){ae--;continue}if(ae===0)de.push(Pe)}let Te=[],Ce=0;for(let Pe=0;Pe<de.length;Pe++){let Ae=de[Pe];if(Te.push({content:oe.slice(Ce,Ae.pos),ability:void 0}),Ae.type==="elseDirective"){let Ze=oe.slice(Ae.pos+`@${V}`.length),ct=B(Ze);if(ct){Te[Te.length-1]={content:oe.slice(Ce,Ae.pos)},Ce=Ae.pos+`@${V}`.length+ct.paramsEnd,Te.push({content:"",ability:ct.ability,type:ct.type,id:ct.id}),Te.pop();let it=de[Pe+1],rt=it?it.pos:oe.length;Te.push({content:oe.slice(Ce,rt),ability:ct.ability,type:ct.type,id:ct.id}),Ce=rt}}else Ce=Ae.pos+5}if(Ce<oe.length){let Pe=Te[Te.length-1];if(de.length>0&&de[de.length-1].type==="else")Te.push({content:oe.slice(Ce),isFinalElse:!0});else if(Te.length===0)Te.push({content:oe.slice(Ce)})}let _e=j(re.ability,re.type,re.id),Ie=z==="can"?_e:!_e,Xe="";if(Ie)Xe=Te[0]?.content||"";else{let Pe=!1;for(let Ae=1;Ae<Te.length;Ae++){let Ze=Te[Ae];if(Ze.isFinalElse){Xe=Ze.content,Pe=!0;break}if(Ze.ability){let ct=j(Ze.ability,Ze.type,Ze.id);if(z==="can"?ct:!ct){Xe=Ze.content,Pe=!0;break}}}if(!Pe&&Te.length>0){let Ae=Te[Te.length-1];if(Ae.isFinalElse)Xe=Ae.content}}k=k.substring(0,ne)+Xe+k.substring(ie+`@${F}`.length),H=!0}}return k}function qc(v,_,k){let E=v;function T(j,B,z,F,V){let H=!0;while(H){H=!1;let G=new RegExp(`@${B}\\s*\\(`),ne=j.match(G);if(!ne||ne.index===void 0)break;let J=ne.index,re=mr(j,J+`@${B}`.length);if(!re)break;let se=re.endPos,ie=Dr(j,B,z,se);if(ie===-1){console.warn(`[stx] @${B} directive at position ${J} has no matching @${z} \u2014 the block was skipped.`);break}let oe=j.slice(se,ie),de=re.expression,ae=-1,me=0,ve=0;while(ve<oe.length){let Se=oe.indexOf("@",ve);if(Se===-1)break;let $e=oe.substring(Se);if(/^@(?:if|unless|isset|empty)\s*\(/.test($e)){me++,ve=Se+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test($e)){me--,ve=Se+1;continue}if(me===0&&/^@else(?![a-z])/.test($e)){ae=Se;break}ve=Se+1}try{let Se=F(de.trim()),$e;if(ae!==-1){let Re=oe.slice(0,ae),Ee=oe.slice(ae+5);$e=Se?Re:Ee}else $e=Se?oe:"";j=j.substring(0,J)+$e+j.substring(ie+`@${z}`.length),H=!0}catch(Se){let $e=Se instanceof Error?Se.message:String(Se),Re=i(V,`Error processing @${B} directive: ${$e}`,t.EVALUATION_ERROR);j=j.substring(0,J)+Re+j.substring(ie+`@${z}`.length);break}}return j}return E=T(E,"isset","endisset",(j)=>{let B=gr(j,_);return B!==void 0&&B!==null},"Isset"),E=T(E,"empty","endempty",(j)=>{let B=gr(j,_);return B===void 0||B===null||B===""||B===0||B===!1||Array.isArray(B)&&B.length===0||typeof B==="object"&&B!==null&&Object.keys(B).length===0},"Empty"),E}function Kc(v,_,k){let E=v,T="development";function j(B,z,F,V){let H=new RegExp(`@${z}(?![a-z])`,"g"),G=new RegExp(`@${F}(?![a-z])`,"g"),ne=new RegExp(`^@${z}(?![a-z])`),J=new RegExp(`^@${F}(?![a-z])`),re=B,se=!0;while(se){se=!1,H.lastIndex=0;let ie=H.exec(re);if(!ie)break;let oe=ie.index,de=oe+ie[0].length;if(z==="env"){let _e=re.substring(de).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!_e)break;de+=_e[0].length,V=T===_e[2]}let ae=1,me=de,ve=-1;while(ae>0&&me<re.length){H.lastIndex=me,G.lastIndex=me;let _e=H.exec(re),Ie=G.exec(re),Xe=_e?_e.index:1/0,Pe=Ie?Ie.index:1/0;if(Xe<Pe)ae++,me=Xe+_e[0].length;else if(Pe<1/0){if(ae--,ae===0){ve=Pe;break}me=Pe+Ie[0].length}else break}if(ve===-1){console.warn(`[stx] @${z} directive at position ${oe} has no matching @${F} \u2014 the block was skipped.`);break}let Se=re.substring(de,ve),$e=-1,Re=0,Ee=0;while(Ee<Se.length){let _e=Se.indexOf("@",Ee);if(_e===-1)break;let Ie=Se.substring(_e);if(ne.test(Ie)){Re++,Ee=_e+1;continue}if(J.test(Ie)){Re--,Ee=_e+1;continue}if(Re===0&&/^@else(?![a-z])/.test(Ie)){$e=_e;break}Ee=_e+1}let Te;if($e!==-1){let _e=Se.slice(0,$e),Ie=Se.slice($e+5);Te=V?_e:Ie}else Te=V?Se:"";let Ce=`@${F}`.length;re=re.substring(0,oe)+Te+re.substring(ve+Ce),se=!0}return re}return E=j(E,"env","endenv",!1),E=j(E,"production","endproduction",T==="production"),E=j(E,"development","enddevelopment",T==="development"),E=j(E,"staging","endstaging",T==="staging"),E=j(E,"testing","endtesting",T==="testing"),E}var zf=new WeakMap;function Ff(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function yo(v,_){if(!v)return _?.nonceGenerator?.()??Ff();let k=zf.get(v);if(!k)k=_?.nonceGenerator?.()??Ff(),zf.set(v,k);return k}function Vx(v,_){let k=[];for(let[E,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(E);continue}if(Array.isArray(T)){let j=[...T];if(_&&(E==="script-src"||E==="style-src"))j=j.filter((B)=>!B.startsWith("'nonce-")),j.push(`'nonce-${_}'`);if(j.length>0)k.push(`${E} ${j.join(" ")}`)}}return k.join("; ")}function Wf(v,_){return`<meta http-equiv="Content-Security-Policy" content="${Vx(v,_).replace(/&/g,"&").replace(/"/g,""")}">`}function Vf(v,_,k){if(!_.enabled||!_.addMetaTag)return v;if(v.includes('http-equiv="Content-Security-Policy"'))return v;if(!v.includes("<head>")&&!v.includes("<head "))return v;let E=_.useNonce?yo(k,_):void 0,T=Wf(_.directives,E);return v.replace(/<head([^>]*)>/,`<head$1>
|
|
1708
|
+
${T}`)}function Uf(v,_){let k=v;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(E,T)=>{if(T.includes("nonce="))return E;return`<script nonce="${_}"${T}>`}),k=k.replace(/<style([^>]*)>/gi,(E,T)=>{if(T.includes("nonce="))return E;return`<style nonce="${_}"${T}>`}),k}function Hf(v,_,k,E){let T=v,j=E.csp;if(T=T.replace(/@csp\b/g,()=>{if(!j?.enabled||!j.directives)return"<!-- CSP not configured -->";let B=j.useNonce?yo(_,j):void 0;return Wf(j.directives,B)}),T=T.replace(/@cspNonce\b/g,()=>{if(!j?.enabled||!j.useNonce)return"";return yo(_,j)}),j?.enabled&&j.useNonce)_.cspNonce=yo(_,j);return T}import Ux from"crypto";var Hx=40,qf="_token",Xc=null;function qx(v=Hx){let _=Ux.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return Xc=_,_}function Kx(){if(!Xc)qx();return Xc}function Xx(v=qf){let _=Kx();return`<input type="hidden" name="${v}" value="${_}">`}function Kf(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,E)=>Xx(E||qf))}async function Xf(v,_,k,E){if(!E.customDirectives||E.customDirectives.length===0)return v;let T=v;for(let j of E.customDirectives){if(!j.name||typeof j.handler!=="function"){if(E.debug)console.warn("Invalid custom directive:",j);continue}if(j.hasEndTag)T=await Zx(T,j,_,k,E);else T=await Gx(T,j,_,k,E)}return T}async function Zx(v,_,k,E,T){let{name:j,handler:B}=_,z=`@${j}`,F=`@end${j}`,V=v,H=kr(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),G=[],ne=H.exec(V);while(ne!==null){let[J,re="",se=""]=ne,ie=ne.index||0;try{let oe=re?Zf(_,re):[],de=se.trim(),ae=await B(de,oe,k,E);G.push({original:J,processed:ae,startIndex:ie})}catch(oe){let de=oe instanceof Error?oe.message:String(oe);if(T.debug)console.error(`Error processing custom directive @${j}:`,oe);G.push({original:J,processed:i("CustomDirective",`Error in @${j}${re?`(${re})`:""}: ${de}`,t.EVALUATION_ERROR),startIndex:ie})}ne=H.exec(V)}for(let J=G.length-1;J>=0;J--){let{original:re,processed:se}=G[J];V=V.replace(re,se)}return V}async function Gx(v,_,k,E,T){let{name:j,handler:B}=_,z=v,F=[],V=[];if(_.rawParams){for(let ne of Ts(z,kr(`(?<![\\w$@])@${j}\\s*\\(`,"g")))if(ne.end!==-1)V.push({fullMatch:ne.call,paramString:ne.args,startIndex:ne.start})}else{let ne=kr(`@${j}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");ne.lastIndex=0;let J=ne.exec(z);while(J!==null)V.push({fullMatch:J[0],paramString:J[1]??"",startIndex:J.index||0}),J=ne.exec(z)}for(let{fullMatch:ne,paramString:J,startIndex:re}of V)try{let se=Zf(_,J),ie=await B("",se,k,E);F.push({original:ne,processed:ie,startIndex:re})}catch(se){let ie=se instanceof Error?se.message:String(se);if(T.debug)console.error(`Error processing custom directive @${j}:`,se);F.push({original:ne,processed:i("CustomDirective",`Error in @${j}(${J}): ${ie}`,t.EVALUATION_ERROR),startIndex:re})}let H=kr(`@${j}(?!\\w)(?!\\s*\\()`,"g"),G=H.exec(z);while(G!==null){let[ne]=G,J=G.index||0;try{let re=await B("",[],k,E);F.push({original:ne,processed:re,startIndex:J})}catch(re){let se=re instanceof Error?re.message:String(re);if(T.debug)console.error(`Error processing custom directive @${j}:`,re);F.push({original:ne,processed:i("CustomDirective",`Error in @${j}: ${se}`,t.EVALUATION_ERROR),startIndex:J})}G=H.exec(z)}for(let ne=F.length-1;ne>=0;ne--){let{original:J,processed:re}=F[ne];z=z.replace(J,re)}return z}function Zf(v,_){return v.rawParams?Ge(_):Jx(_)}function Jx(v){if(!v.trim())return[];let _=[],k="",E=!1,T="";for(let j=0;j<v.length;j++){let B=v[j];if((B==='"'||B==="'")&&(j===0||v[j-1]!=="\\"))if(!E)E=!0,T=B;else if(B===T)E=!1;else k+=B;else if(B===","&&!E)_.push(k.trim()),k="";else k+=B}if(k.trim())_.push(k.trim());return _.map((j)=>{let B=j.trim();if(B.startsWith('"')&&B.endsWith('"')||B.startsWith("'")&&B.endsWith("'"))return B.substring(1,B.length-1);return B})}var Gf=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Jf=/^[A-Za-z_$][\w$]*$/,Yx=new Set(["light","dark","system"]);function Mr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function Qx(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:E}=_;if(Mr(_.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!E||typeof E!=="object"||Array.isArray(E))throw Error("@appearanceBootstrap colorMode must be an object");if(Mr(E.key,"colorMode.key"),Mr(E.attribute,"colorMode.attribute"),Mr(E.default,"colorMode.default"),!Jf.test(E.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Gf.test(E.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Yx.has(E.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Mr(k.key,"appearance.key"),Mr(k.attribute,"appearance.attribute"),Mr(k.default,"appearance.default"),!Jf.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Gf.test(k.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(k.allowed)||k.allowed.length===0||k.allowed.some((j)=>typeof j!=="string"||j.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!k.allowed.includes(k.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");T={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:_.storageKey,appearance:T,colorMode:{key:E.key,attribute:E.attribute,default:E.default},respectExisting:_.respectExisting===!0}}function eb(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function tb(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${eb(v)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function nb(v,_){let k=1,E=null,T=!1;for(let j=_+1;j<v.length;j++){let B=v[j];if(T){T=!1;continue}if(E){if(B==="\\")T=!0;else if(B===E)E=null;continue}if(B==='"'||B==="'"||B==="`"){E=B;continue}if(B==="(")k++;else if(B===")"&&--k===0)return j}return-1}function Yf(v,_){let k=v,E=/@appearanceBootstrap\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index+T[0].length-1,B=nb(k,j);if(B===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=k.slice(j+1,B).trim(),F=c(`(${z})`,_),V=tb(Qx(F));k=k.slice(0,T.index)+V+k.slice(B+1),E.lastIndex=T.index+V.length}return k}import rb from"crypto";function Wt(v){return String(v??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var ep={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function xo(v,_,k,E){let T=v||_;return k?`${T} ${E}`:T}function vn(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ls(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${Wt(_)}"`}function Zc(v,_,k){if(!_)return"";let E="";if(!/\baria-invalid\s*=/i.test(k))E+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))E+=` aria-describedby="${Wt(`${vn(v)}-error`)}"`;return E}function sb(){return rb.randomUUID()}function bo(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let E=sb();_.csrf={token:E}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${Wt(_.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(E,T)=>{let j=T.toUpperCase();if(T&&!["GET","POST"].includes(j))return`<input type="hidden" name="_method" value="${Wt(j)}">`;return E}),k}function tp(v,_,k=ep){let E=v;return E=E.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,j,B,z,F,V="")=>{let H=j||B||"POST",G=z||F||"",ne=hr(V),J=H.toUpperCase(),re=["GET","POST"].includes(J)?J:"POST",se=`<form method="${Wt(re)}" action="${Wt(G)}"${ne?` ${ne}`:""}>`;if(se+=`
|
|
1709
|
+
${bo("@csrf",_)}`,!["GET","POST"].includes(J))se+=`
|
|
1710
|
+
${bo(`@method('${J}')`,_)}`;return se}),E=E.replace(/@endform/g,"</form>"),E=E.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,j,B,z,F,V="")=>{let H=j||B||"",G=z||F||"",ne=hr(V),J=Ri(H,_),re=J!==void 0&&J!==null?J:G||"",se=ne.match(/type=['"]([^'"]+)['"]/i),ie=se?se[1]:"text",oe=Ti(H,_),de=ne.match(/class=['"]([^'"]+)['"]/i),ae=xo(de?de[1]:"",k.input,oe,k.inputError),me=ne.replace(/class=['"][^'"]+['"]/i,"");return me=me.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Wt(ie)}" name="${Wt(H)}"${Ls(ne,vn(H))} value="${Wt(re)}" class="${ae}"${Zc(H,oe,ne)}${me?` ${me}`:""}>`}),E=E.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,j,B="",z="")=>{let F=hr(B),V=Ri(j,_)||z.trim(),H=Ti(j,_),G=F.match(/class=['"]([^'"]+)['"]/i),ne=xo(G?G[1]:"",k.input,H,k.inputError),J=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Wt(j)}"${Ls(F,vn(j))} class="${ne}"${Zc(j,H,F)}${J?` ${J}`:""}>${Wt(V)}</textarea>`}),E=E.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,j,B="",z)=>{let F=hr(B),V=Ri(j,_),H=Ti(j,_),G=F.match(/class=['"]([^'"]+)['"]/i),ne=xo(G?G[1]:"",k.input,H,k.inputError),J=F.replace(/class=['"][^'"]+['"]/i,""),re=z;if(V!==void 0)re=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(se,ie,oe)=>{if((Array.isArray(V)?V.some((ae)=>String(ae)===oe):String(V)===oe)&&!ie.includes("selected"))return ie.replace(/(<option)/,"$1 selected");return se});return`<select name="${Wt(j)}"${Ls(F,vn(j))} class="${ne}"${Zc(j,H,F)}${J?` ${J}`:""}>${re}</select>`}),E=E.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=B===void 0?"1":B,V=B===void 0?vn(j):`${vn(j)}-${vn(F)}`,H=hr(z),G=Ri(j,_),ne=G!==void 0&&(Array.isArray(G)?G.some((ie)=>String(ie)===F):G===!0||String(G)===F),J=H.match(/class=['"]([^'"]+)['"]/i),re=J?J[1]:k.checkInput,se=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Wt(j)}"${Ls(H,V)} value="${Wt(F)}" class="${re}"${ne?" checked":""}${se?` ${se}`:""}>`}),E=E.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B,z="")=>{let F=hr(z),V=Ri(j,_),H=V!==void 0&&V===B,G=F.match(/class=['"]([^'"]+)['"]/i),ne=G?G[1]:k.checkInput,J=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Wt(j)}"${Ls(F,`${vn(j)}-${vn(B)}`)} value="${Wt(B)}" class="${ne}"${H?" checked":""}${J?` ${J}`:""}>`}),E=E.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,j,B="")=>{let z=hr(B),F=z.match(/accept=['"]([^'"]+)['"]/i),V=F?F[1]:"",H=z.includes("multiple"),G=Ti(j,_),ne=z.match(/class=['"]([^'"]+)['"]/i),J=xo(ne?ne[1]:"",k.input,G,k.inputError),re=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),se=[`<input type="file" name="${Wt(j)}"${Ls(z,vn(j))}`,`class="${J}"`];if(V)se.push(`accept="${Wt(V)}"`);if(H)se.push("multiple");if(re)se.push(re);return`${se.join(" ")}>`}),E=E.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,j,B="",z)=>{let F=hr(B),V=F.match(/class=['"]([^'"]+)['"]/i),H=V?V[1]:k.label,G=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Wt(vn(j))}" class="${H}"${G?` ${G}`:""}>${z}</label>`}),E}function np(v,_,k=ep){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(E,T,j)=>{try{if(Ti(T,_)){let B=j.replace(/\{\{([^}]+)\}\}/g,(z,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return Qf(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Qf(T,_)}let V=F.trim();if(p(V)){let H=c(V,_);return H!==void 0?String(H):V}return V}catch{return F}});return`<div id="${Wt(`${vn(T)}-error`)}" role="alert">${B}</div>`}return""}catch(B){return console.error("Error processing @error directive:",B),E}})}function Ti(v,_){if(!_.errors)return!1;if(typeof _.errors.has==="function")return _.errors.has(v);if(typeof _.errors==="object")return Object.prototype.hasOwnProperty.call(_.errors,v);return!1}function Qf(v,_){if(!_.errors)return"";if(typeof _.errors.get==="function")return _.errors.get(v);if(typeof _.errors==="object"&&Object.prototype.hasOwnProperty.call(_.errors,v)){let k=_.errors[v];return Array.isArray(k)?k[0]:String(k)}return""}function Ri(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let E=v.slice(0,-2);if(k=_[E],k!==void 0)return k}return _[v]}function hr(v){if(!v.trim())return"";let _=[],k=v.trim(),E=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=E.exec(k))!==null){let[,j,,B]=T;_.push(`${j}="${B.trim()}"`)}return _.join(" ")}var Ai=/<\/?template\b[^>]*>/gi,ib=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function ob(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return ib.test(_)}function Z(v){Ai.lastIndex=0;let _;while((_=Ai.exec(v))!==null){if(_[0].startsWith("</")||ob(_[0]))continue;let k=_.index,E=Ai.lastIndex,T=1,j;while((j=Ai.exec(v))!==null)if(j[0].startsWith("</")){if(T--,T===0){let B=j.index;return{start:k,openEnd:E,closeStart:B,end:Ai.lastIndex,content:v.slice(E,B)}}}else T++;return null}return null}import Mt from"path";import{existsSync as Rv}from"fs";import vo from"fs";import Bt from"path";var rp=new Map;function wo(v,_=!0){let k=rp.get(v);if(_&&k)return k;let E=new Map,T=[Bt.join(v,"src"),Bt.join(v,"dist"),v];function j(B,z){if(z>6)return;let F;try{F=vo.readdirSync(B,{withFileTypes:!0})}catch{return}for(let V of F){let H=Bt.join(B,V.name);if(V.isDirectory()){if(V.name==="node_modules"||V.name.startsWith("."))continue;j(H,z+1)}else if(V.isFile()&&V.name.endsWith(".stx")){let G=V.name.slice(0,-4);if(!E.has(G))E.set(G,H);let ne=G.toLowerCase();if(!E.has(ne))E.set(ne,H);let J=G.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!E.has(J))E.set(J,H)}}}for(let B of T)if(j(B,0),E.size>0)break;if(_)rp.set(v,E);return E}function So(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let E=Bt.join(k,"node_modules",v);try{if(vo.statSync(E).isDirectory())return E}catch{}let T=Bt.dirname(k);if(T===k)return null;k=T}}function $o(v,_,k={}){return[Bt.resolve(Bt.dirname(_),`${v}.stx`),Bt.resolve(Bt.dirname(_),v),Bt.resolve(k.componentsDir||"components",`${v}.stx`),Bt.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function sp(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),E=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[_,k,E]}function Gc(v,_){let[k,E,T]=sp(v);for(let j of[k,k.toLowerCase(),E,T]){let B=_?.__importedComponents?.get(j);if(B!==void 0)return B}}function*Jc(v,_,k={},E){let T=sp(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield Bt.resolve(Bt.dirname(_),`${T[0]}.stx`);return}let j=[...new Set(T.map((F)=>`${F}.stx`))],B=k.projectRoot||process.cwd(),z=[...E?.__originalFilePath?[Bt.join(Bt.dirname(E.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Bt.join(Bt.dirname(_),"components"),Bt.resolve(B,"src/components"),Bt.resolve(B,"components"),...import.meta.dir?[Bt.resolve(import.meta.dir,"components")]:[]];for(let F of new Set(z)){for(let V of j)yield Bt.join(F,V);try{for(let V of vo.readdirSync(F,{withFileTypes:!0}))if(V.isDirectory())for(let H of j)yield Bt.join(F,V.name,H)}catch{}}}function ip(v,_,k={},E){let T=Gc(v,E);if(T!==void 0)return T;for(let j of Jc(v,_,k,E))try{if(vo.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return null}class op{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,E){let T=Gc(v,E);if(T!==void 0)return T;for(let j of Jc(v,_,k,E))if(await r(j))return j;return null}}var Bs=new op;function Ot(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Or="\x00stx-boolean-attribute";function Yc(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}function yr(v,_){let k=[];for(let[E,T]of Object.entries(v.static)){if(_.has(E))continue;let j=v.staticNames?.[E]??E;if(typeof T==="boolean"){if(T)k.push(Ot(j));continue}if(T===Or){k.push(Ot(j));continue}k.push(`${Ot(j)}="${Ot(Yc(String(T)))}"`)}return k}function xr(v,_){let k=[];for(let[E,T]of Object.entries(v.serverDynamic??{})){if(_.has(E))continue;if(T===null||T===void 0||T===!1)continue;let j=v.serverDynamicNames?.[E]??E;if(T===!0){k.push(Ot(j));continue}if(typeof T==="object")continue;k.push(`${Ot(j)}="${Ot(Yc(String(T)))}"`)}return k}function zs(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ab(v){if(v.clientReactive.to)return{value:v.clientReactive.to,reactive:!0};if(v.serverDynamic.to!==void 0)return{value:String(v.serverDynamic.to),reactive:!1};if(typeof v.static.to==="string")return{value:v.static.to,reactive:!1};return{value:"#",reactive:!1}}var Qc={name:"StxLink",aliases:["stx-link"],render(v,_,k){let E=ab(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),j=typeof v.static.activeClass==="string"?v.static.activeClass:"active",B=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",z=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,F=[];if(E.reactive)F.push(`:href="${zs(E.value)}"`);else F.push(`href="${zs(Js(E.value,"navigable"))}"`);if(T)F.push(`class="${zs(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${zs(j)}"`),F.push(`data-stx-exact-active-class="${zs(B)}"`),z)F.push("data-stx-prefetch");let V=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(V)F.push(`data-stx-active-match="${zs(V)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...yr(v,H)),F.push(...xr(v,H)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as xp}from"crypto";import Yt from"fs";import Ht from"path";import{decode as mb,generateThumbHash as hb}from"ts-images";import{createImageDeliveryCatalog as fp}from"ts-images/delivery";import el from"fs";function _o(v,_,k){let E=Buffer.alloc(k),T=el.readSync(v,E,0,k,_);return E.subarray(0,T)}function tl(v){if(v.length<25)return!1;let _=(E,T)=>String.fromCharCode(...v.subarray(E,T));if(_(0,4)!=="RIFF"||_(8,12)!=="WEBP")return!1;let k=_(12,16);if(k==="VP8X")return(v[20]&16)!==0;if(k==="VP8L")return((v[21]|v[22]<<8|v[23]<<16|v[24]<<24)>>>28&1)===1;return!1}function nl(v){let _;try{_=el.openSync(v,"r");let k=_o(_,0,33);if(k.length>=3&&k[0]===255&&k[1]===216&&k[2]===255)return"none";if(k.length>=26&&k[0]===137&&k.toString("latin1",1,4)==="PNG"){let E=k[25];if(E===4||E===6)return"possible";let T=8;for(let j=0;j<64;j++){let B=_o(_,T,8);if(B.length<8)return"unknown";let z=B.toString("latin1",4,8);if(z==="tRNS")return"possible";if(z==="IDAT"||z==="IEND")return"none";T+=12+B.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(tl(k))return"possible";let E=k.toString("latin1",12,16);return E==="VP8 "||E==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)el.closeSync(_)}}import cb from"fs";import ko from"os";import{join as ap}from"path";import{fileURLToPath as cp}from"url";import{Worker as lp}from"worker_threads";var Co=Symbol("stx.image-worker.unavailable");function lb(v=typeof ko.availableParallelism==="function"?ko.availableParallelism():ko.cpus().length){return Math.max(1,Math.min(2,v-1))}var Eo=0,dp=[];async function ub(){if(Eo<lb()){Eo++;return}await new Promise((v)=>dp.push(v)),Eo++}function db(){Eo--,dp.shift()?.()}var fb="@stacksjs/stx/builtins/image-warmup-worker";function pb(v=process.cwd()){let _=import.meta.url.endsWith(".ts")?"ts":"js";try{let k=new URL(`./image-warmup-worker.${_}`,import.meta.url);if(k.protocol==="file:"&&cb.existsSync(cp(k)))return cp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(fb,v):void 0;return k&&gb(k)?k:void 0}catch{return}}function gb(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,ap(_.BUN_INSTALL||ap(ko.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var up=!1;function Ii(v){if(!up)up=!0,console.warn(`[stx] image worker unavailable (${v}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Co}function rl(v){return v instanceof Error?v.message:String(v)}async function sl(v,_){if(typeof lp!=="function")return Ii("node:worker_threads has no Worker in this runtime");let k=pb();if(!k)return Ii("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await ub();try{return await new Promise((E,T)=>{let j;try{j=new lp(k)}catch(V){E(Ii(`could not start ${k}: ${rl(V)}`));return}let B=!1,z=!1,F=(V)=>{if(z)return;z=!0,V(),j.terminate()};j.on("message",(V)=>{if(V.type==="ready"){B=!0,j.postMessage({task:v,args:_});return}if(V.type==="result"){F(()=>E(V.value));return}let H=Error(V.error?.message??"image worker failed");if(V.error?.name)H.name=V.error.name;if(V.error?.stack)H.stack=V.error.stack;F(()=>T(H))}),j.on("error",(V)=>{F(()=>B?T(V instanceof Error?V:Error(rl(V)||"image worker crashed")):E(Ii(`the worker failed before it was ready: ${rl(V)}`)))}),j.on("exit",(V)=>{F(()=>B?T(Error("image worker exited before it finished")):E(Ii(`the worker exited with code ${V} before it was ready`)))})})}finally{db()}}var yb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),xb=[320,640,960,1280,1920],To="/_stx/images",bb=`stx:${To}:alpha-1`,vb=["@stacksjs/ts-webp","@stacksjs/ts-avif"],Ro;function wb(v,_){let k=Ht.dirname(Bun.resolveSync(v,_));while(k!==Ht.dirname(k)){let E=Ht.join(k,"package.json");if(Yt.existsSync(E)){let T=JSON.parse(Yt.readFileSync(E,"utf8"));if(T.name===v)return T.version}k=Ht.dirname(k)}return}function Sb(){if(Ro!==void 0)return Ro;let v;try{v=Ht.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ro=vb.map((_)=>{let k;try{k=v?wb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),Ro}var pp=Symbol.for("stx.image-delivery");function Pi(){let v=globalThis;return v[pp]??={catalog:new Map,transparent:new Set},v[pp]}var gp=new Set;function $b(v){return`/${v.split(Ht.sep).map(encodeURIComponent).join("/")}`}function _b(v){let _=Ht.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),E=xp("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${E}`}function mp(v,_=`stx:${To}`){let k=(E)=>`${To}/${E.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(E){let T=Ht.join(v,E);try{let j=await Yt.promises.stat(T);return j.size>0?{bytes:j.size,path:T,url:k(E)}:null}catch{return null}},async write(E,T){let j=Ht.join(v,E);await Yt.promises.mkdir(Ht.dirname(j),{recursive:!0});let B=`${j}.${process.pid}.tmp`;return await Yt.promises.writeFile(B,T),await Yt.promises.rename(B,j),{bytes:T.byteLength,path:j,url:k(E)}},url:k}}async function bp(v,_=v){let k=await Yt.promises.readdir(_,{withFileTypes:!0});k.sort((T,j)=>T.name.localeCompare(j.name));let E=[];for(let T of k){let j=Ht.join(_,T.name);if(T.isDirectory()){E.push(...await bp(v,j));continue}if(!T.isFile()||!yb.has(Ht.extname(T.name).toLowerCase()))continue;E.push({absolutePath:j,relativePath:Ht.relative(v,j)})}return E}function hp(v,_){return v.map((k)=>({key:$b(k.relativePath),input:k.absolutePath,name:_b(k.relativePath),...kb(k.absolutePath)?{options:{storage:_}}:{}}))}function kb(v){return nl(v)==="possible"}function Eb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function Cb(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,E=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([j,B])=>{let z=B.variants.filter((F)=>F.format==="png").sort((F,V)=>F.width-V.width)[0];try{let F=await mb(new Uint8Array(await Yt.promises.readFile(z?.path??B.fallback.path)));if(Eb(F.data))k.add(j)}catch{k.add(j)}}));return k}function Rb(v,_){let k=[];for(let E of _){let T=v[E],j=T?.variants.filter((z)=>z.format==="webp")??[];if(!T||j.length===0)continue;if(!j.some((z)=>{let F;try{return F=Yt.openSync(z.path,"r"),!tl(_o(F,0,32))}catch{return!0}finally{if(F!==void 0)Yt.closeSync(F)}}))continue;if(T.variants=T.variants.filter((z)=>z.format!=="webp"),delete T.sources.webp,k.push(E),!gp.has(E))gp.add(E),console.warn(`[stx-images] ${E} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return k}async function Tb(v){let _=[],k=8;for(let E=0;E<v.length;E+=8){let T=v.slice(E,E+8),j=await Promise.all(T.map(async(B)=>{try{return await hb(B.absolutePath),B}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${B.relativePath}`),null}}));_.push(...j.filter((B)=>B!==null))}return _}function il(v){return Ht.join(v,"undecodable.json")}function Ab(v){try{let _=Yt.readFileSync(il(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function Ib(v,_){try{Yt.mkdirSync(Ht.dirname(il(v)),{recursive:!0}),Yt.writeFileSync(il(v),JSON.stringify(_))}catch{}}function yp(v){try{let _=Yt.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function vp(v){if(!v||v.startsWith("data:")||v.startsWith("blob:")||/^https?:\/\//i.test(v)||v.startsWith("//"))return;let _=v.split(/[?#]/,1)[0];if(!_)return;try{return`/${_.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Qr(v){let _=vp(v);return _?Pi().catalog.get(_):void 0}function es(v){let _=vp(v);return _?Pi().transparent.has(_):!1}function ts(v){let _=(E)=>v.variants.filter((T)=>T.format===E).reduce((T,j)=>T+j.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((E)=>({format:E,srcset:v.sources[E]||"",bytes:_(E)})).filter((E)=>E.srcset&&E.bytes>0&&E.bytes<k).sort((E,T)=>E.bytes-T.bytes).map(({format:E,srcset:T})=>({format:E,srcset:T}))}function Nu(v){let _=Qr(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:ts(_).map(({format:k,srcset:E})=>({type:`image/${k}`,srcset:E})),width:_.source.width,height:_.source.height,placeholder:es(v)?void 0:_.placeholder?.dataUrl}}function Bn(){let v=Pi();v.catalog=new Map,v.transparent=new Set}function Pb(v){let _=Pi();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function Lu(v,_,k={}){if(!v||!Yt.existsSync(v))return Bn(),{count:0,fingerprint:""};if(k.offThread){let re=await sl("delivery",{publicDir:v,outputDir:_});if(re!==Co)return Pb(re.state),re.result}let E=await bp(v);if(E.length===0)return Bn(),{count:0,fingerprint:""};let T=Ab(_),j=E.filter((re)=>{let se=T[re.relativePath];if(!se)return!0;let ie=yp(re.absolutePath);return!ie||ie.mtimeMs!==se.mtimeMs||ie.size!==se.size});if(j.length===0)return Bn(),{count:0,fingerprint:""};let B=mp(Ht.join(_,"_stx","images"),`${bb}:${Sb()}`),z={outDir:Ht.join(_,"_stx","images"),storage:mp(Ht.join(_,"_stx","images")),baseUrl:To,widths:xb,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},F=j,V;try{V=await fp({...z,entries:hp(j,B)})}catch(re){if(F=await Tb(j),F.length===j.length)throw re;let se=new Set(F.map((oe)=>oe.relativePath)),ie=!1;for(let oe of j){if(se.has(oe.relativePath))continue;let de=yp(oe.absolutePath);if(!de)continue;T[oe.relativePath]=de,ie=!0}if(ie)Ib(_,T);if(F.length===0)return Bn(),{count:0,fingerprint:""};V=await fp({...z,entries:hp(F,B)})}let H=await Cb(V.entries),G=Rb(V.entries,H),ne=Pi();ne.catalog=new Map(Object.entries(V.entries)),ne.transparent=H;let J=H.size===0&&G.length===0?V.fingerprint:xp("sha256").update(V.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:G.sort()})).digest("hex");return{count:F.length,fingerprint:J}}var Db=new Map;function ol(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return Db.get(_)}var Mb={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},al=[320,640,768,1024,1280,1536,1920];function zt(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Xt(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Ao(v,_,k=!1){let E=v.serverDynamic[_];if(E!==void 0)return E!==!1&&E!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function cl(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let E of _)if(E.includes(":")){let[T,j]=E.split(":"),B=Mb[T];if(B)k.push(`(max-width: ${B}px) ${j}`);else{let z=Number.parseInt(T);if(!Number.isNaN(z))k.push(`(max-width: ${z}px) ${j}`)}}else k.push(E);return k.join(", ")}function ll(v,_,k,E){return _.map((T)=>`${Di(v,T,void 0,k,E)} ${T}w`).join(", ")}function Ob(v,_,k,E,T){return _.map((j)=>{let B=k?k*j:void 0;return`${Di(v,B,void 0,E,T)} ${j}x`}).join(", ")}function Di(v,_,k,E,T){if(!E||E==="local"||E==="static")return v;if(E==="cloudinary"){let j=[];if(_)j.push(`w_${_}`);if(k)j.push(`h_${k}`);if(T)j.push(`f_${T}`);j.push("q_auto");let B=j.join(",");return v.replace("/upload/",`/upload/${B}/`)}if(E==="imgix"){let j=new URLSearchParams;if(_)j.set("w",String(_));if(k)j.set("h",String(k));if(T)j.set("fm",T);j.set("auto","format");let B=v.includes("?")?"&":"?";return`${v}${B}${j.toString()}`}if(E==="bunny"){let j=new URLSearchParams;if(_)j.set("width",String(_));if(k)j.set("height",String(k));if(T)j.set("format",T);let B=v.includes("?")?"&":"?";return`${v}${B}${j.toString()}`}return v}function Nb(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function jb(v,_,k="#e5e7eb"){let E=`<svg xmlns="http://www.w3.org/2000/svg" width="${v}" height="${_}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(E)}`}var ul={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let E=Xt(v,"src")||"",T=Qr(E),j=Xt(v,"alt")||"",B=Xt(v,"width")||(T?String(T.source.width):void 0),z=Xt(v,"height")||(T?String(T.source.height):void 0),F=Xt(v,"sizes"),V=Xt(v,"srcset"),H=Xt(v,"densities"),G=Xt(v,"format"),ne=es(E)||ol(E)?.transparent===!0,J=Xt(v,"placeholder")||(T&&!ne?"thumbhash":void 0),re=Xt(v,"placeholderColor")||"#e5e7eb",se=Xt(v,"provider"),ie=Xt(v,"class")||Xt(v,"className")||"",oe=Xt(v,"style")||"",de=Xt(v,"quality"),ae=Ao(v,"lazy",!0),me=Ao(v,"preload",!1),ve=Ao(v,"priority",!1),Se=Xt(v,"loading"),$e=Xt(v,"decoding")||"async",Re=!!T||Ao(v,"picture",!1)||!!G,Ee=B?Number.parseInt(B):void 0,Te=z?Number.parseInt(z):void 0,Ce=V||"",_e="";if(T)Ce=T.sources[T.fallback.format]||"",_e=F?cl(F):"100vw";else if(!Ce&&F&&se&&se!=="local"&&se!=="static")Ce=ll(E,al,se,G),_e=cl(F);else if(!Ce&&H){let ut=H.split(/\s+/).map((dt)=>Number.parseFloat(dt.replace("x","")));Ce=Ob(E,ut,Ee,se,G)}else if(F)_e=cl(F);let Ie=[];if(oe)Ie.push(oe);if(Ee&&Te)Ie.push(`aspect-ratio:${Ee}/${Te}`);let Xe=[],Pe=J==="blur"||J==="color"||J==="thumbhash";if(Pe&&!ne){let ut=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:re}:ol(E);if(ut&&J==="color")Ie.push(`background-color:${ut.color}`),Xe.push("backgroundColor");else if(ut)Ie.push(`background-color:${ut.color}`),Ie.push(`background-image:url(${ut.dataUrl})`),Ie.push("background-size:cover"),Ie.push("background-repeat:no-repeat"),Xe.push("backgroundColor","backgroundImage");else{let dt=jb(Ee||16,Te||9,re);Ie.push(`background-image:url(${dt})`),Ie.push("background-size:cover"),Ie.push("background-repeat:no-repeat"),Xe.push("backgroundImage")}}else if(!Pe&&J&&J!=="empty"&&J!=="none")Ie.push(`background-image:url(${zt(J)})`),Ie.push("background-size:cover"),Ie.push("background-repeat:no-repeat"),Xe.push("backgroundImage");let Ae=T?.fallback.url||Di(E,Ee,Te,se,G),Ze=[];if(Ze.push(`src="${zt(Js(Ae,"fetched"))}"`),Ze.push(`alt="${zt(j)}"`),B)Ze.push(`width="${zt(B)}"`);if(z)Ze.push(`height="${zt(z)}"`);let ct=Se||(ve||me?"eager":ae?"lazy":"");if(ct)Ze.push(`loading="${zt(ct)}"`);if(ve)Ze.push('fetchpriority="high"');if(Ze.push(`decoding="${zt($e)}"`),ie)Ze.push(`class="${zt(ie)}"`);if(Ie.length>0)Ze.push(`style="${zt(Ie.join(";"))}"`);if(Ce)Ze.push(`srcset="${zt(Js(Ce,"fetched"))}"`);if(_e)Ze.push(`sizes="${zt(_e)}"`);let it=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Xe.length>0){let ut=typeof v.static.onload==="string"?v.static.onload:"",dt=Nb(Xe)+(ut?`;${ut}`:"");Ze.push(`onload="${zt(dt)}"`),it.add("onload")}Ze.push(...yr(v,it)),Ze.push(...xr(v,it));let rt=`<img ${Ze.join(" ")} />`,gt="";if(me){let dt=G==="webp"?"image/webp":G==="avif"?"image/avif":"";gt=`<link rel="preload" as="image" href="${zt(Ae)}"${dt?` type="${dt}"`:""}${Ce?` imagesrcset="${zt(Ce)}"`:""}${_e?` imagesizes="${zt(_e)}"`:""} />
|
|
1711
|
+
`}if(Re){let ut=[];if(T)for(let dt of ts(T))ut.push(`<source type="image/${dt.format}" srcset="${zt(dt.srcset)}"${_e?` sizes="${zt(_e)}"`:""} />`);if(!T&&(G==="avif"||G==="auto")){let dt=Di(E,Ee,Te,se,"avif"),st=Ce?ll(E,al,se,"avif"):`${dt}`;ut.push(`<source type="image/avif" srcset="${zt(st)}"${_e?` sizes="${zt(_e)}"`:""} />`)}if(!T&&(G==="webp"||G==="auto")){let dt=Di(E,Ee,Te,se,"webp"),st=Ce?ll(E,al,se,"webp"):`${dt}`;ut.push(`<source type="image/webp" srcset="${zt(st)}"${_e?` sizes="${zt(_e)}"`:""} />`)}return`${gt}<picture>
|
|
1713
1712
|
${ut.join(`
|
|
1714
1713
|
`)}
|
|
1715
1714
|
${rt}
|
|
1716
|
-
</picture>`}return`${gt}${rt}`}};var
|
|
1715
|
+
</picture>`}return`${gt}${rt}`}};var wp="/images/safe-image-default.svg";function Mi(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Fs(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var Lb=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${wp}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,dl={name:"SafeImage",aliases:["safe-image","safe-img"],render(v,_,k){let E=Fs(v,"src")||"",T=Fs(v,"alt")||"",j=Fs(v,"fallback")||wp,B=Fs(v,"class")||Fs(v,"className")||"",z=Fs(v,"fallbackClassName")||"",F=[];if(F.push(`src="${Mi(E)}"`),F.push(`alt="${Mi(T)}"`),B)F.push(`class="${Mi(B)}"`);if(F.push(`data-fallback="${Mi(j)}"`),z)F.push(`data-fallback-class="${Mi(z)}"`);F.push('onerror="window.__stxSafeImageHandler(this)"');let V=new Set(["src","alt","fallback","class","className","fallbackClassName"]);F.push(...yr(v,V)),F.push(...xr(v,V));let H=`<img ${F.join(" ")} />`,G=k.context;if(!G.__safeImageHandlerEmitted)return G.__safeImageHandlerEmitted=!0,`${Lb}${H}`;return H}};function fl(v){return v.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Oi(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Io(v,_,k){let E=Oi(v,_);if(E!==void 0){let T=Number.parseInt(E,10);if(!Number.isNaN(T))return T}return k}var pl={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(v,_,k){let E=fl(Oi(v,"color")||"#6366f1"),T=fl(Oi(v,"initialColor")||Oi(v,"initial-color")||""),j=fl(Oi(v,"height")||"3px"),B=Io(v,"duration",2000),z=Io(v,"throttle",200),F=Io(v,"zIndex",999999)||Io(v,"z-index",999999),V=T?`linear-gradient(to right, ${T}, ${E})`:E;return`
|
|
1717
1716
|
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${j};background:${V};z-index:${F};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
1718
1717
|
<div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
|
|
1719
1718
|
</div>
|
|
1720
1719
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
1721
1720
|
<script>
|
|
1722
1721
|
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${z})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
|
|
1723
|
-
</script>`}};function
|
|
1722
|
+
</script>`}};function $p(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Bb(v,_,k){let E=$p(v,_);if(E!==void 0){let T=Number.parseInt(E,10);if(!Number.isNaN(T))return T}return k}var Sp={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},gl={name:"StxToast",aliases:["stx-toast"],render(v,_,k){let E=Ot($p(v,"position")||"top-right"),T=Bb(v,"max",5),j=Sp[E]||Sp["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${E}" data-stx-toast-max="${T}" style="position:fixed;${j};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
1724
1723
|
<style>
|
|
1725
1724
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
1726
1725
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -1728,7 +1727,7 @@ ${rt}
|
|
|
1728
1727
|
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
1729
1728
|
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
1730
1729
|
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
1731
|
-
</style>`}};function
|
|
1730
|
+
</style>`}};function Po(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var _p={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},ml={name:"StxModal",aliases:["stx-modal"],render(v,_,k){let E=Po(v,"id");if(!E)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let T=Ot(E),j=Po(v,"size")||"md",B=Po(v,"closeOnBackdrop")!=="false",z=Po(v,"closeOnEscape")!=="false",F=_p[j]||_p.md;return`<div id="stx-modal-${T}" class="stx-modal-backdrop" data-stx-modal="${T}" data-close-backdrop="${B}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
|
|
1732
1731
|
<div class="stx-modal-panel" style="${F};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
|
|
1733
1732
|
<div style="padding:1.5rem">${_}</div>
|
|
1734
1733
|
</div>
|
|
@@ -1737,7 +1736,7 @@ ${rt}
|
|
|
1737
1736
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
1738
1737
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
1739
1738
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
1740
|
-
</style>`}};function
|
|
1739
|
+
</style>`}};function Ws(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var kp={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},hl={name:"StxDrawer",aliases:["stx-drawer"],render(v,_,k){let E=Ws(v,"id");if(!E)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let T=Ot(E),j=Ws(v,"side")||"right",B=Ws(v,"size")||"md",z=Ws(v,"closeOnBackdrop")!=="false",F=Ws(v,"closeOnEscape")!=="false",V=Ws(v,"overlay")!=="false",H=kp[B]||kp.md,G=j==="left",ne=G?"left:0":"right:0",J=G?"translateX(-100%)":"translateX(100%)",re=G?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${T}" class="stx-drawer-backdrop" data-stx-drawer="${T}" data-close-backdrop="${z}" data-close-escape="${F}" style="display:none;position:fixed;inset:0;z-index:99999;${V?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
|
|
1741
1740
|
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${ne};width:${H};max-width:100vw;transform:${J};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
|
|
1742
1741
|
<div style="padding:1.5rem">${_}</div>
|
|
1743
1742
|
</div>
|
|
@@ -1746,7 +1745,7 @@ ${rt}
|
|
|
1746
1745
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
1747
1746
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
1748
1747
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
1749
|
-
</style>`}};import{existsSync as
|
|
1748
|
+
</style>`}};import{existsSync as zb,readFileSync as Fb}from"fs";var Do=new Map,Ep=new Set;function Wb(v){if(Ep.has(v))return;Ep.add(v),console.warn(`[stx] icon collection "${v}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${v}\`.`)}function Vb(v){let _=process.cwd();for(let k of[`${_}/node_modules/@iconify-json/${v}/icons.json`,`${_}/pantry/@iconify-json/${v}/icons.json`,`${_}/node_modules/@iconify/json/json/${v}.json`,`${_}/pantry/@iconify/json/json/${v}.json`])if(zb(k))return k;for(let k of[`@iconify-json/${v}/icons.json`,`@iconify/json/json/${v}.json`])try{return u.resolve(k)}catch{}return null}function Ub(v){if(Do.has(v))return Do.get(v);let _=Vb(v);if(!_)return Wb(v),null;try{let k=JSON.parse(Fb(_,"utf8"));return Do.set(v,k.icons),k.icons}catch{return null}}function Vs(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);if(v.static[_]!==void 0)return String(v.static[_]);if(v.clientReactive[_]!==void 0)return v.clientReactive[_];return}var yl={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let E=Vs(v,"name")??Vs(v,"icon");if(!E)return"<!-- Icon: missing name/icon prop -->";let T="lucide",j=E;if(E.includes(":")){let de=E.split(":");T=de[0],j=de[1]}let B=Ot(Vs(v,"size")||"24"),z=Ot(Vs(v,"color")||"currentColor"),F=Ot(Vs(v,"class")||""),V=Ot(Vs(v,"style")||""),H=Do.get(T)??Ub(T);if(!H)return`<!-- Icon: collection "${T}" not loaded -->`;let G=H[j];if(!G)return`<!-- Icon: "${j}" not found in ${T} -->`;let ne=G.width||24,J=G.height||24,re=`0 0 ${ne} ${J}`,se=G.body;if(z!=="currentColor")se=se.replace(/currentColor/g,z);let ie=F?` class="${F}"`:"",oe=V?` style="${V}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${B}" height="${B}" viewBox="${re}" fill="none"${ie}${oe}>${se}</svg>`}};function xl(){return`
|
|
1750
1749
|
(function(){
|
|
1751
1750
|
var tip=null,hideTimer=null,currentEl=null;
|
|
1752
1751
|
|
|
@@ -1849,8 +1848,8 @@ document.addEventListener("focusout",function(e){
|
|
|
1849
1848
|
if(el) hideTip();
|
|
1850
1849
|
});
|
|
1851
1850
|
})();
|
|
1852
|
-
`}function
|
|
1853
|
-
`||Ee==="\t"){let Te=
|
|
1851
|
+
`}function Cp(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let E=v.static[k];if(typeof E==="string")return E}return}function Rp(v,_){let k=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${_}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),E=v.match(k);if(!E)return{region:null,rest:v};return{region:E[2],rest:v.replace(E[0],"")}}var bl={name:"Suspense",aliases:["suspense"],render(v,_,k){let E=Rp(_,"fallback"),T=E.rest,j=Rp(T,"error"),B=j.rest,z=E.region??Cp(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',F=j.region??Cp(v,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${F}</div><div data-stx-suspense-content hidden>${B}</div></div>`}};function Mo(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let E=v.static[k];if(typeof E==="string")return E}return}var vl={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let E=(Mo(v,"name")||"v").replace(/["'<>]/g,""),T=(Mo(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",j=Mo(v,"class"),B=Mo(v,"id"),z=[`data-stx-transition-group="${E}"`,j?`class="${j}"`:"",B?`id="${B}"`:""].filter(Boolean).join(" ");return`<${T} ${z}>${_}</${T}>`}};function Tp(v=Bs){v.registerBuiltin(Qc),v.registerBuiltin(ul),v.registerBuiltin(dl),v.registerBuiltin(pl),v.registerBuiltin(gl),v.registerBuiltin(ml),v.registerBuiltin(hl),v.registerBuiltin(yl),v.registerBuiltin(bl),v.registerBuiltin(vl)}function Oo(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Ap=new Map;function Hb(v){let _=Ap.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),Ap.set(v.source,_);return _}var Ip=new WeakMap;function Pp(v){let _=Ip.get(v);if(!_)_=new Set([...v].map((E)=>E.toLowerCase())),Ip.set(v,_);let k=_;return(E)=>!/[a-z]/.test(E)&&k.has(E.toLowerCase())}function qb(v,_){let k="";for(let E=_;E<v.length;E++){let T=v[E];if(k){if(T==="\\")E++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return E}return v.length}function Dp(v,_,k){let E=[],T=0,j=typeof k==="function"?k:k?(B)=>k.has(B.toLowerCase()):void 0;while(T<v.length){let B=v.indexOf("<",T);if(B===-1)break;let z=Hb(_);z.lastIndex=B+1;let F=z.exec(v);if(!F){T=B+1;continue}let V=F[1];if(j&&j(V)){let ie=B+1+V.length;while(ie<v.length&&v[ie]!==">")ie++;T=ie+1;continue}let H=B+1+V.length,G=null,ne=H,J=-1,re=!1;while(H<v.length){let ie=v[H];if(G){if(ie==="\\"&&H+1<v.length){H+=2;continue}if(ie===G)G=null;H++;continue}if(ie==='"'||ie==="'"){G=ie,H++;continue}if(ie==="/"&&H+1<v.length&&v[H+1]===">"){J=H+2,re=!0;break}if(ie===">"){J=H+1;break}H++}if(J===-1){T=B+1;continue}let se=v.slice(ne,re?J-2:J-1).trim();if(re)E.push({fullMatch:v.slice(B,J),tagName:V,attributes:se,content:"",startIndex:B,endIndex:J,isSelfClosing:!0}),T=J;else{let ie=`<${V}`,oe=`</${V}>`,de=1,ae=J,me=-1;while(de>0&&ae<v.length){let $e=v.indexOf(ie,ae),Re=v.indexOf(oe,ae);if(Re===-1)break;if($e!==-1&&$e<Re){let Ee=v[$e+ie.length];if(Ee===" "||Ee===">"||Ee==="/"||Ee===`
|
|
1852
|
+
`||Ee==="\t"){let Te=qb(v,$e+ie.length);if(v[Te-1]!=="/")de++;ae=Te+1}else ae=$e+ie.length}else{if(de--,de===0){me=Re;break}ae=Re+oe.length}}if(me===-1){T=J;continue}let ve=v.slice(J,me),Se=me+oe.length;E.push({fullMatch:v.slice(B,Se),tagName:V,attributes:se,content:ve,startIndex:B,endIndex:Se,isSelfClosing:!1}),T=Se}}return E}function Mp(v){return v.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function Op(v,_){try{let k=Buffer.from(v,"base64").toString("utf8");return JSON.parse(k)}catch{}try{let k=v.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(k)}catch(k){if(_?.debug)console.error("Error decoding __stx_ prop:",k);return v}}function wl(v,_){let k=0,E="",T=_;while(T<v.length){let j=v[T];if(E){if(j==="\\")T++;else if(j===E)E=""}else if(j==='"'||j==="'"||j==="`")E=j;else if(j==="{")k++;else if(j==="}"){if(k--,k===0)return v.slice(_,T+1)}T++}return v.slice(_)}function Np(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(wl(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var Kb=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Xb=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Zb(v){return Sl(v).map((_)=>[_.start,_.end])}function Sl(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,E;while((E=k.exec(v))!==null){let T=E[2]||"",j=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(T);if(!j)continue;let B=Ms(j[1]??j[2]??j[3]??""),z=E.index,F=z+E[0].length,V=E[1].toLowerCase();if(E[0].endsWith("/>")||Xb.has(V)){_.push({start:z,end:F,names:B});continue}let H=V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),G=new RegExp(`<\\/?${H}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");G.lastIndex=F;let ne=1,J=F,re;while((re=G.exec(v))!==null)if(re[0].startsWith("</")){if(ne--,ne===0){J=re.index+re[0].length;break}}else if(!re[0].endsWith("/>"))ne++;_.push({start:z,end:J,names:B})}return _}function jp(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>jp(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function Lp(v,_){if(!/:[\w-]+=/.test(v))return v;let k=v,E=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,T=[],j;while((j=E.exec(v))!==null)T.push([j.index,j.index+j[0].length]);T.push(...Zb(v));let B=new Set(fr(_));function z(ne){return T.some(([J,re])=>ne>=J&&ne<re)}let F=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,V=[],H=new Map,G=256;while((j=F.exec(k))!==null){if(z(j.index))continue;let ne=j[0],J=j[2];if(!J||!J.includes(":"))continue;let re=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,se,ie=J,oe=!1;while((se=re.exec(J))!==null){let de=se[1],ae=se[2];if($i(de))continue;if(Rr(ae,B))continue;if(ae.includes("()")&&!ae.includes(".get(")||ae.includes("$store")||ae.includes("$ref"))continue;try{let me=Object.keys(_),ve=Object.values(_),Se=ae.match(/^([a-zA-Z_$][\w$]*)/);if(Se&&!me.includes(Se[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(Se[1]))continue;let $e=JSON.stringify([me,ae]),Re=H.get($e);if(!Re){if(Re=Function(...me,`return (${ae})`),H.size>=G)H.clear();H.set($e,Re)}let Ee=Re(...ve);if(de==="class"){let Te=jp(Ee);if(Te){let Ce=ie.match(/\sclass="([^"]*)"/);if(Ce)ie=ie.replace(Ce[0],` class="${Ce[1]} ${Te}"`);else ie=ie.replace(se[0],` class="${Te}"`)}else ie=ie.replace(se[0],"");oe=!0;continue}if(Kb.has(de)){if(Ee)ie=ie.replace(se[0],` ${de}`);else ie=ie.replace(se[0],"");oe=!0;continue}if(Ee===null||Ee===void 0||Ee===!1)ie=ie.replace(se[0],"");else{let Te=String(Ee).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");ie=ie.replace(se[0],` ${de}="${Te}"`)}oe=!0}catch{continue}}if(oe){let de=j[3]?" /":"",me=`<${j[1]}${ie}${de}>`;V.push({start:j.index,end:j.index+ne.length,replacement:me})}}if(V.length>0){let ne=Array(V.length*2+1),J=0;for(let re=0;re<V.length;re++){let{start:se,end:ie,replacement:oe}=V[re];ne[re*2]=k.slice(J,se),ne[re*2+1]=oe,J=ie}ne[V.length*2]=k.slice(J),k=ne.join("")}return k}import Jp from"path";import _l from"fs";import ji from"path";function Bp(v,_,k,E){let T=0;for(let j=_;j<v.length;j++)if(v[j]===k)T++;else if(v[j]===E&&!(E===">"&&v[j-1]==="=")){if(--T===0)return j}return-1}function Gb(v){let _=s(v),k=0,E=0,T=[];for(let j=0;j<_.length;j++)if("([{".includes(_[j]))k++;else if(")]}".includes(_[j]))k--;else if(_[j]===","&&k===0)T.push(v.slice(E,j).trim()),E=j+1;return T.push(v.slice(E).trim()),T}function $l(v,_){let k=s(v),E=new RegExp(`\\b(?:${_.map((T)=>T.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let T of k.matchAll(E)){let j=T.index+T[0].length,B="";if(k[j]==="<"){let F=Bp(k,j,"<",">");if(F<0)continue;B=v.slice(j+1,F),j=F+1;while(/\s/.test(k[j]||"")&&j<k.length)j++}if(k[j]!=="(")continue;let z=Bp(k,j,"(",")");if(z>=0)return{type:B,args:Gb(v.slice(j+1,z))}}return null}var zp=`
|
|
1854
1853
|
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
1855
1854
|
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
1856
1855
|
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
@@ -1858,37 +1857,37 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
|
|
|
1858
1857
|
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
1859
1858
|
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
1860
1859
|
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
1861
|
-
`;function
|
|
1862
|
-
`)}),B
|
|
1860
|
+
`;function Fp(v,_){let k=[],E={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},T=s(v),j=v.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(ne,J,re,se,ie)=>{if(T.slice(ie,ie+6)!=="import")return ne;if(se.endsWith(".stx"))return"";let oe=`${_}Import${k.length}`;if(k.push(`import * as ${oe} from ${JSON.stringify(se)};`),J.startsWith("*"))return`import ${J.replace(/^\*\s+as\s+/,"")} = ${oe};`;if(!J.startsWith("{"))return`import ${J} = ${oe}.default;`;return J.slice(1,-1).split(",").map((de)=>{let[ae,me=ae]=de.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!ae)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(se)&&ae in E)E[ae].push(me);return`import ${me} = ${oe}.${ae};`}).join(`
|
|
1861
|
+
`)}),B=$l(v,E.defineProps),z=$l(v,E.defineEmits),F=$l(v,E.withDefaults);if(!B&&!z)return{declarations:"",props:null,events:null};let V=[],H=null,G=null;if(B){V.push(`const __options = (${B.args[0]||"{}"}) as const;`),V.push(`const __defaults = (${F?.args[1]||"{}"});`);let ne=B.type||"__StxOptions<typeof __options>";V.push(`export type __StxProps = __StxDefaults<${ne}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),H=`${_}.__StxProps`}if(z)V.push(`const __events = (${z.args[0]||"[]"}) as const;`),V.push(`export type __StxEvents = ${z.type||"Record<(typeof __events)[number], any[]>"};`),G=`${_}.__StxEvents`;return{declarations:`${k.join(`
|
|
1863
1862
|
`)}
|
|
1864
1863
|
namespace ${_} {
|
|
1865
1864
|
${j}
|
|
1866
1865
|
${V.join(`
|
|
1867
1866
|
`)}
|
|
1868
|
-
}`,props:H,events:G}}var
|
|
1867
|
+
}`,props:H,events:G}}var Ni=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function rn(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...Ni].some((_)=>_.toLowerCase()===v.toLowerCase());return Ni.has(v)||/[A-Z]/.test(v)}function*Jb(v){let _=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,k;while(k=_.exec(v)){let E=_.lastIndex,T=[];while(E<v.length){while(/\s/.test(v[E]||""))E++;if(v[E]===">"||v.slice(E,E+2)==="/>"){E+=v[E]===">"?1:2;break}let j=/^[^\s=/>]+/.exec(v.slice(E))?.[0];if(!j){E++;continue}let B=E;E+=j.length;while(/\s/.test(v[E]||""))E++;if(v[E]!=="="){T.push({name:j,value:!0,offset:B,braced:!1});continue}E++;while(/\s/.test(v[E]||""))E++;let z=v[E],F=z==="{",V=z==='"'||z==="'";if(V||F)E++;let H=E;if(F){let G=s(v.slice(E)),ne=1,J=0;for(;J<G.length;J++){if(G[J]==="{")ne++;if(G[J]==="}"&&--ne===0)break}E+=J}else if(V)while(E<v.length&&v[E]!==z)E++;else while(E<v.length&&!/[\s/>]/.test(v[E]))E++;if(T.push({name:j,value:v.slice(H,E),offset:H,braced:F}),V||F)E++}_.lastIndex=E,yield{name:k[1],offset:k.index,attributes:T}}}function Wp(v,_,k){let E=[],T=[zp,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],j=new Map,B=new Map,z=new Map,F=k.scriptCode(v,k.filePath),V=s(F);for(let re of F.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(V.slice(re.index,re.index+6)!=="import")continue;let se=re[2],ie=ji.isAbsolute(se)||se.startsWith(".")?ji.resolve(ji.dirname(k.filePath),se):So(se,ji.dirname(k.filePath));if(!ie)continue;let oe=ie.endsWith(".stx")?ie:_l.existsSync(`${ie}.stx`)?`${ie}.stx`:void 0,de=oe?null:wo(ie,!1),ae=re[1].startsWith("{")?re[1].slice(1,-1).split(","):[re[1]];for(let me of ae){let[ve,Se=ve]=me.trim().split(/\s+as\s+/),$e=oe||de?.get(ve)||de?.get(ve.toLowerCase());if($e)z.set(Se,$e),z.set(Se.toLowerCase(),$e),z.set(Se.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$e)}}for(let re of _.matchAll(/@import\s*\(([^)]+)\)/g))for(let se of re[1].matchAll(/['"]([^'"]+)['"]/g)){let ie=$o(se[1],k.filePath,k).find((oe)=>_l.statSync(oe,{throwIfNoEntry:!1})?.isFile());if(ie)z.set(ji.basename(se[1]).replace(/\.stx$/,""),ie)}let H={__importedComponents:z},G=new Map,ne=(re,se,ie)=>{let oe=v.slice(0,re);return{code:se,offset:re,attribute:ie,anchor:!0,kind:"directive",line:oe.split(`
|
|
1869
1868
|
`).length,column:re-oe.lastIndexOf(`
|
|
1870
|
-
`)}},J=(re,se,ie)=>E.push({expression:re,statement:{text:se+re.code+ie,prefixLength:se.length}});for(let re of
|
|
1871
|
-
`):"",checks:E,events:j,dependencies:B}}var
|
|
1872
|
-
`,_-1)+1;return _-k+1}function
|
|
1873
|
-
`)_[B]=" "},E=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let T of E){T.lastIndex=0;let j;while((j=T.exec(v))!==null)k(j.index,j.index+j[0].length)}return _.join("")}function
|
|
1869
|
+
`)}},J=(re,se,ie)=>E.push({expression:re,statement:{text:se+re.code+ie,prefixLength:se.length}});for(let re of Jb(_)){if(rn(re.name)||re.name==="component")continue;let se=ip(re.name,k.filePath,k,H);if(!se)continue;let ie=G.get(se);if(!ie){let de;try{de=k.readComponent?k.readComponent(se):_l.readFileSync(se,"utf8")}catch{continue}if(de===void 0)continue;B.set(se,de),ie=Fp(k.scriptCode(de,se),`__StxComponent${G.size}`),G.set(se,ie),T.push(ie.declarations)}let oe=[];for(let de of re.attributes){let{name:ae,offset:me}=de,ve=de.value===!0?"true":de.value;if(ae.startsWith("@")||ae.startsWith("v-on:")){if(ie.events&&de.value!==!0)j.set(me,`__StxEvent<${ie.events}, ${JSON.stringify(ae.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let Se=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(ae);if(ae.startsWith("v-")&&!ae.startsWith("v-bind:")&&!Se)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(ae))continue;let $e=(Se?Se[1]||"modelValue":ae.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Te,Ce)=>Ce.toUpperCase());if(oe.push($e),!ie.props)continue;let Ee=ae.startsWith(":")||ae.startsWith("v-bind:")||!!Se||de.braced?ve:de.value!==!0?JSON.stringify(ve):"true";J(ne(me,Ee,ae),";void ((",`) satisfies __StxProp<${ie.props}, ${JSON.stringify($e)}>);`)}if(ie.props){let de=[...new Set(oe)].map((me)=>`${JSON.stringify(me)}: undefined as any`).join(", "),ae=ne(re.offset,`<${re.name}>`);E.push({expression:ae,statement:{text:`;void ({ ${de} } satisfies ${ie.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:G.size?T.join(`
|
|
1870
|
+
`):"",checks:E,events:j,dependencies:B}}var Vp=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Yb(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function ze(v){let _=[],k=Yb(v);Vp.lastIndex=0;let E;while((E=Vp.exec(k))!==null){let T=(E[1]||"").trim(),j=(E[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,B=(E[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,z=E.index+j,F=E.index+E[0].length-B,V=v.slice(z,F);if(/\bsrc\s*=/.test(T))continue;let H=T.match(/\btype\s*=\s*["']([^"']+)["']/i);if(H&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(H[1]))continue;let G=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",ne=Li(v,z);_.push({kind:G,code:V,startLine:ne,startColumn:Bi(v,z),offset:z,attrs:T})}return _}function Li(v,_){let k=1;for(let E=0;E<_&&E<v.length;E++)if(v.charCodeAt(E)===10)k++;return k}function Bi(v,_){let k=v.lastIndexOf(`
|
|
1871
|
+
`,_-1)+1;return _-k+1}function No(v){let _=v.split(""),k=(T,j)=>{for(let B=T;B<j&&B<_.length;B++)if(_[B]!==`
|
|
1872
|
+
`)_[B]=" "},E=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let T of E){T.lastIndex=0;let j;while((j=T.exec(v))!==null)k(j.index,j.index+j[0].length)}return _.join("")}function Qb(v){let _=0,k="";for(let E=0;E<v.length;E++){let T=v[E];if(k){if(T==="\\"){E++;continue}if(T===k)k="";continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{"){_++;continue}if(T===")"||T==="]"||T==="}"){_--;continue}if(T==="|"&&_===0){if(v[E+1]==="|"){E++;continue}if(v[E-1]==="|")continue;return v.slice(0,E)}}return v}var Yp=new Set([":for","x-for","v-for"]),Lo=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,kl="__stx_interpolated",Up="__StxElement",Qp="__StxTemplateValue",ev=`type ${Qp}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Hp(v){return v.replace(/\{\{[\s\S]*?\}\}/g,kl).replace(/\{!![\s\S]*?!!\}/g,kl)}function ns(v){return v.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(_)=>{let k=_.split(`
|
|
1874
1873
|
`).length-1,E=_.length-k;return`0${" ".repeat(Math.max(0,E-1))}${`
|
|
1875
|
-
`.repeat(k)}`})}var
|
|
1876
|
-
`)}function Xo(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function
|
|
1874
|
+
`.repeat(k)}`})}var tv=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],nv=new RegExp(String.raw`^[ \t]*@(?:${tv.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function rs(v){return v.replace(nv,(_)=>_.replace(/[^\n]/g," "))}var qp=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function sc(v){let _=No(v),k=[],E=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,T;while((T=E.exec(_))!==null){if(T[1]||T[3])continue;let z=T[2]??T[4]??"",F=T[2]!==void 0?2:3,V=Qb(z);if(!V.trim())continue;let H=T.index+F+(V.length-V.trimStart().length);k.push({code:V.trim(),line:Li(_,H),column:Bi(_,H),offset:H,kind:"interpolation"})}let j=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((T=j.exec(_))!==null){let B=T.index+T[0].length-1,z=0,F=B;for(;F<_.length;F++){let ne=_[F];if(ne==="(")z++;else if(ne===")"){if(z--,z===0)break}}if(z!==0)continue;let V=_.slice(B+1,F),H=V.trim();if(j.lastIndex=F+1,!H)continue;let G=B+1+(V.length-V.trimStart().length);k.push({code:H,line:Li(_,G),column:Bi(_,G),offset:T.index,kind:"condition"})}Lo.lastIndex=0;while((T=Lo.exec(_))!==null){let B=T[1],z=T[3]??"",F=B.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(qp.has(F)||qp.has(B))continue;if(!z.trim())continue;let V=T.index+T[0].indexOf(T[2],T[0].indexOf(B)+B.length)+1;if(Yp.has(F)){let G=z.match(/\s+(?:in|of)\s+/);if(!G||G.index===void 0)continue;let ne=z.slice(G.index+G[0].length),J=G.index+G[0].length+(ne.length-ne.trimStart().length);k.push({code:Hp(ne.trim()),line:Li(_,V+J),column:Bi(_,V+J),offset:V+J,kind:"directive",attribute:F});continue}let H=z.length-z.trimStart().length;k.push({code:Hp(z.trim()),line:Li(_,V+H),column:Bi(_,V+H),offset:V+H,kind:"directive",attribute:F})}return k.sort((B,z)=>B.line-z.line||B.column-z.column),k}var rv=2000;function sv(v,_){let k=0,E=Math.min(v.length,_+rv);for(let T=_;T<E;T++){let j=v[T];if(j==="(")k++;else if(j===")"){if(k--,k===0)return v.slice(_+1,T)}}return null}function iv(v){let _=new Map,k=(z,F)=>{let V=z.split(/[,[\]{}()\s]+/).filter(Boolean);for(let H of V){let G=H.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(G))continue;let ne=V.length===1?F:void 0,J=_.get(G);if(!J)_.set(G,{name:G,iterable:ne});else if(J.iterable!==ne)J.iterable=void 0}},E=/^\$?[A-Z_$][\w$]*$/i,T=(z)=>{let F=z.trim();return E.test(F)?F:void 0};for(let z of v.matchAll(/@for(?:each|else)\s*\(/g)){let F=sv(v,z.index+z[0].length-1);if(F===null)continue;let V=vt(F);if(!V)continue;k(V.itemVar.replace(/=>/g," "),T(V.arrayExpr))}for(let z of v.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))k(z[1],z[2]==="of"?T(z[3]):void 0);for(let z of v.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))k(z[1]);let j=No(v);Lo.lastIndex=0;let B;while((B=Lo.exec(j))!==null){let z=B[1].replace(/\..*$/,"");if(!Yp.has(z))continue;let F=B[3].match(/\s+(?:in|of)\s+/);if(!F||F.index===void 0)continue;k(B[3].slice(0,F.index),T(B[3].slice(F.index+F[0].length)))}for(let z of v.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let F of z[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))k(F[1]);return[..._.values()].sort((z,F)=>z.name.localeCompare(F.name))}function Q(v){let _=new Set;for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let E of k[1].split(",")){let T=E.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(T))_.add(T)}return[..._].sort()}var El=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],ov={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function Ko(v=new Set){return[...El.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(ov).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
|
|
1875
|
+
`)}function Xo(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function eg(v){let _=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,k,E=!1,T=new Set,j=s(v);while((k=_.exec(j))!==null){E=!0;for(let B of av(k[1])){let z=B.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(z))T.add(z)}}return E?[...T]:null}function av(v){let _=[],k=0,E="";for(let T of v){if(T===","&&k===0){_.push(E),E="";continue}if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;E+=T}return _.push(E),_.filter((T)=>T.trim().length>0)}function cv(v){let _=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,k=[],E=v.replace(_,(T)=>(k.push(T.trim()),T.split(`
|
|
1877
1876
|
`).map(()=>"").join(`
|
|
1878
1877
|
`)));return{imports:k.join(`
|
|
1879
|
-
`),body:E}}function
|
|
1880
|
-
`&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,G-40),G)))){V=ne===";"?G+1:G;break}}}T.push({name:F,text:v.slice(B.index,V).replace(/^[ \t]*export[ \t]+/,"")}),j.lastIndex=V}return T}function
|
|
1881
|
-
`)}if(k.length===0)return T.length>0?["",`// ${
|
|
1882
|
-
`):"";let{imports:j,body:B}=
|
|
1883
|
-
`)}function
|
|
1884
|
-
`)k[T]=" "}return Q(k.join(""))}function Jo(v,_){if(
|
|
1885
|
-
`),T=Array.from({length:E.length},()=>""),j=new Map,B=_.filePath&&_.templateExpressions!==!1?
|
|
1878
|
+
`),body:E}}function tg(v){let _=s(v),k=Array(_.length),E=0;for(let z=0;z<_.length;z++){let F=_[z];if(F==="}"||F===")"||F==="]")E=Math.max(0,E-1);if(k[z]=E,F==="{"||F==="("||F==="[")E++}let T=[],j=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,B;while((B=j.exec(_))!==null){if(k[B.index]!==0)continue;let z=B[1],F=B[2],V;if(z==="interface"){let H=_.indexOf("{",B.index);if(H===-1)continue;let G=0;V=-1;for(let ne=H;ne<_.length;ne++)if(_[ne]==="{")G++;else if(_[ne]==="}"&&--G===0){V=ne+1;break}if(V===-1)continue}else{let H=0;V=_.length;for(let G=_.indexOf("=",B.index)+1;G<_.length;G++){let ne=_[G];if(ne==="{"||ne==="["||ne==="("||ne==="<")H++;else if(ne==="}"||ne==="]"||ne===")"||ne===">")H--;else if(H<=0&&(ne===";"||ne===`
|
|
1879
|
+
`&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,G-40),G)))){V=ne===";"?G+1:G;break}}}T.push({name:F,text:v.slice(B.index,V).replace(/^[ \t]*export[ \t]+/,"")}),j.lastIndex=V}return T}function lv(v){return new Set(tg(v).map((_)=>_.name))}function Go(v,_=""){let k=eg(v),E=lv(_),T=tg(v).filter((V)=>!E.has(V.name)).map((V)=>V.text);if(!k){let V=Q(v).filter((H)=>!Ji(_,H));if(V.length===0&&T.length===0)return"";return["",`// ${uv}`,...T,...V.map((H)=>`declare var ${H}: any`)].join(`
|
|
1880
|
+
`)}if(k.length===0)return T.length>0?["",`// ${Kp}`,...T].join(`
|
|
1881
|
+
`):"";let{imports:j,body:B}=cv(v),z=B.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),F=["",`// ${Kp}`];if(j)F.push(j);return F.push(...T),F.push(`async function ${Xp}() {`,z,` return { ${k.join(", ")} }`,"}",`type ${Zp} = Awaited<ReturnType<typeof ${Xp}>>`,...k.map((V)=>`declare var ${V}: ${Zp}[${JSON.stringify(V)}]`)),F.join(`
|
|
1882
|
+
`)}function Cl(v){let k=s(v).split(""),E=0;for(let T=0;T<k.length;T++){let j=k[T];if(j==="{"||j==="("||j==="["){E++;continue}if(j==="}"||j===")"||j==="]"){E=Math.max(0,E-1);continue}if(E>0&&j!==`
|
|
1883
|
+
`)k[T]=" "}return Q(k.join(""))}function Jo(v,_){if(eg(v)!==null)return[];let k=s(_),E=new Set(y);return Cl(v).filter((T)=>{if(E.has(T))return!1;if(Q(_).includes(T))return!1;return new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(k)})}var Kp="stx: types for the declared client payload (#1868)",uv="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Xp="__stxServerScope",Zp="__StxClientPayload";var Gp=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var dv=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function fv(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let E of v){let T=s(E),{depths:j,balanced:B}=we(T);if(!B)continue;let z=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let F of T.matchAll(z)){let V=F.index??0;if(j[V+F[1].length]!==0)continue;let H=F[2],G=V+F[0].length-F[3].length,ne=E.slice(G,V+F[0].length).trim().replace(/;$/,"").trim(),J=F[3],re=k.test(J)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(J)&&!/[,+\-*/%&|?:=]$/.test(ne)&&we(J).balanced;_.set(H,_.has(H)||!re?null:ne)}}return new Map([..._].filter((E)=>E[1]!==null))}function ng(v,_,k=0,E=new Set){if(_.size===0||k>=5)return v;let T=s(v),j="",B=0;for(let z of T.matchAll(/[A-Za-z_$][\w$]*/g)){let F=z.index??0,V=z[0],H=_.get(V);if(!H||E.has(V))continue;let G=T.slice(0,F).trimEnd(),ne=T.slice(F+V.length).trimStart();if(G.endsWith(".")||/^:(?!:)/.test(ne)&&/[{,]$/.test(G))continue;if(F>0&&/[\w$]/.test(T[F-1]))continue;j+=`${v.slice(B,F)}(${ng(H,_,k+1,new Set([...E,V]))})`,B=F+V.length}return j+v.slice(B)}function pv(v,_){let k=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,E=[],T;while((T=k.exec(v))!==null){if(T.index>_)break;let j=T[1];if(T.index===_){if(j==="elseif"){let z=E[E.length-1];if(z?.current)z.seen.push(z.current);if(z)z.current=null}break}if(j==="endif"||j==="endunless"){E.pop();continue}let B="";if(T[2]==="("){let z=0,F=T.index+T[0].length-1,V=F+1;for(;F<v.length;F++){let H=v[F];if(H==="(")z++;else if(H===")"){if(z--,z===0)break}}B=v.slice(V,F).trim(),k.lastIndex=F+1}if(j==="if")E.push({seen:[],current:B});else if(j==="unless")E.push({seen:[],current:`!(${B})`});else if(j==="elseif"||j==="else"){let z=E[E.length-1];if(!z)continue;if(z.current)z.seen.push(z.current);z.current=j==="elseif"?B:null}}return E.flatMap((j)=>[...j.seen.map((B)=>`!(${B})`),...j.current?[j.current]:[]]).filter(Boolean)}function gv(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(dv.test(_))return null;let E=";(($event: any): void => { ";return{text:`${E}${_} });`,prefixLength:E.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var mv=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function Fn(v,_){if(!_)return v;return v.replace(mv,(k,E,T,j)=>{let B=Jp.resolve(_,j).replace(/\\/g,"/");return`${E}${T}${B}${T}`})}function ss(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function hv(v){let _=new Set,k=s(v);for(let E of k.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let T=E[1],j=/\{([^}]*)\}/.exec(T);for(let V of j?.[1].split(",")??[]){let H=V.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(H&&/^[A-Z_$][\w$]*$/i.test(H))_.add(H)}let B=T.replace(/\{[^}]*\}/,""),z=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(B);if(z)_.add(z[1]);let F=/^\s*([A-Z_$][\w$]*)/i.exec(B);if(F&&F[1]!=="type")_.add(F[1])}return[..._].sort()}function Yo(v,_={}){let k=ze(v),E=v.split(`
|
|
1884
|
+
`),T=Array.from({length:E.length},()=>""),j=new Map,B=_.filePath&&_.templateExpressions!==!1?Wp(v,No(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(G,ne)=>ze(G).map((J)=>Fn(J.code,Jp.dirname(ne))).join(`
|
|
1886
1885
|
`)}):void 0,z=new Set,F=[];for(let G of k){let ne=rs(ns(G.code)),J=Fn(ne,_.originDir??"").split(`
|
|
1887
1886
|
`);J.forEach((re,se)=>{let ie=G.startLine-1+se;if(ie<T.length)T[ie]=se===0?ss(G)+re:re,z.add(ie)}),F.push(G.startLine-1+J.length-1)}for(let G of F){let ne=T[G]?.trim()===""?G:G+1;if(ne<T.length&&T[ne].trim()===""&&(ne===G||!z.has(ne)))T[ne]=";"}let V=(G,ne)=>{for(let[J,re]of G.split(`
|
|
1888
|
-
`).entries())if(T.push(re),ne)j.set(T.length,J===0?ne:{...ne,line:ne.line+J,column:1,prefixLength:0})};if(_.globals!==!1){V("");let G=new Set([...k.flatMap((se)=>Q(se.code)),...k.flatMap((se)=>
|
|
1889
|
-
`))V(ne);let G=sc(v).map((ne)=>{let J=B?.events.get(ne.offset??-1);if(J){ne.anchor=!0;let re=ne.code.trim(),se=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(re),ie=se?`void ((${se[2]}) satisfies __StxAssignedValue<typeof ${se[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(re)?`${re} satisfies (($event: ${J}) => unknown)`:re,oe=`;(($event: ${J}): void => { `;return{expression:ne,statement:{text:`${oe}${ie} });`,prefixLength:oe.length}}}return{expression:ne,statement:
|
|
1890
|
-
`),lineMap:j,sourceLineCount:E.length,componentDependencies:B?.dependencies,referenced:H}}function Zo(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function Qo(v,_,k){let E=v.lineMap.get(_);if(!E)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=E.expression?.anchor?0:Math.max(0,k-1-(E.prefixLength??0));return{line:E.line,column:E.column+T,expression:E.expression,inGuard:k<=(E.guardPrefixLength??0)}}import Qp from"fs";import eg from"path";var tg=!1;function gv(v,_,k,E=!1,T=new Set){let j={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},B=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),z=(G)=>{if(B.size===0)return!1;let ne=s(G),J=ne.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(J&&B.has(J))return!0;for(let re of B){let se=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${se}\\s*\\(`).test(ne))return!0}return!1},F=new Set(Ei),V=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;if(G.startsWith("aria-")||G.startsWith("data-"))return G;return G.replace(/-([a-z0-9])/g,(ne,J)=>J.toUpperCase())},H=(G,ne)=>{let J=V(G);if(j.static[J]=ne,J!==G)j.staticNames[J]=G};for(let[G,ne]of Object.entries(v)){let J=G.startsWith("x-")&&!F.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(J.startsWith("@")){j.events[J]=ne;continue}if(J.startsWith("__stx_")){let re=V(J.slice(6));j.serverDynamic[re]=Ip(ne,k);continue}if(J.startsWith(":")){let re=V(J.slice(1)),se=ne===Or?re:ne;if(re==="if"||re==="for"||re==="show"){j.clientReactive[re]=se;continue}if(E){j.clientReactive[re]=se;continue}if(Rr(se,T)){j.clientReactive[re]=se;continue}if(z(se)){j.clientReactive[re]=se;continue}try{if(!p(se)){if(k.debug)console.error(`Unsafe expression in :${re} binding: ${se}`);j.clientReactive[re]=se;continue}let ie=Object.keys(_),oe=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),de=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(xe(se).some((Se)=>!oe.has(Se)&&!ie.includes(Se)&&(!(Se in globalThis)||de.has(Se)))){j.clientReactive[re]=se;continue}let ve=l(se,ie)(...Object.values(_));if(j.serverDynamic[re]=ve,re!==J.slice(1)&&j.serverDynamicNames)j.serverDynamicNames[re]=J.slice(1)}catch{j.clientReactive[re]=se}continue}if(typeof ne==="string"&&ne.includes("{{")&&ne.includes("}}")){let re=mv(ne,T);if(re!==null){j.clientReactive[V(J)]=re;continue}let se=ne.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(se)try{let ie=se[1];if(p(ie)){let de=l(ie,Object.keys(_))(...Object.values(_));H(J,de!=null?String(de):"")}else{if(k.debug)console.error(`Unsafe expression in ${J}: ${ie}`);H(J,ne)}}catch(ie){if(k.debug)console.error(`Error evaluating expression for ${J}:`,ie);H(J,ne)}else{let ie=ne,oe=/\{\{\s*([\s\S]+?)\s*\}\}/g,de;while((de=oe.exec(ne))!==null)try{let ae=de[1];if(!p(ae)){if(k.debug)console.error(`Unsafe expression in ${J}: ${ae}`);continue}let ve=l(ae,Object.keys(_))(...Object.values(_));ie=ie.replace(de[0],String(ve??""))}catch(ae){if(k.debug)console.error(`Error evaluating expression in ${J}:`,ae)}H(J,ie)}continue}H(J,ne===Or?"true":Ap(ne))}return j}function mv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,E=[...v.matchAll(k)];if(!E.some((z)=>Rr(z[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&E.length===1)return T[1];let j="",B=0;for(let z of E)j+=v.slice(B,z.index).replace(/[`\\$]/g,(F)=>`\\${F}`),j+=`\${${z[1]}}`,B=z.index+z[0].length;return j+=v.slice(B).replace(/[`\\$]/g,(z)=>`\\${z}`),`\`${j}\``}var hv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function yv(v,_,k){if(!v.includes("@"))return v;if(!hv.some(([T,j])=>T.test(v)&&v.includes(j)))return v;try{return ir(v,_,k)}catch{return v}}function ig(v){let _={},k=0,E=v.length;while(k<E){while(k<E&&/\s/.test(v[k]))k++;if(k>=E)break;let T="";while(k<E&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<E&&/\s/.test(v[k]))k++;if(k<E&&v[k]==="="){k++;while(k<E&&/\s/.test(v[k]))k++;let j="";if(k<E&&(v[k]==='"'||v[k]==="'")){let B=v[k];k++;while(k<E){let z=v[k];if(z==="\\"&&k+1<E){k++,j+=v[k],k++;continue}if(z===B){k++;break}j+=z,k++}}else if(v[k]==="{"){j=bl(v,k),k+=j.length;let B=Pp(j);if(B!==null){_[`:${T}`]=B;continue}}else while(k<E&&!/\s/.test(v[k]))j+=v[k],k++;_[T]=j}else _[T]=Or}return _}function ng(v){return Object.entries(v).map(([_,k])=>k===Or?_:`${_}="${xv(k)}"`).join(" ")}function xv(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function bv(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,E;while((E=k.exec(v))!==null){let T=E[1];if(Ls.isBuiltin(T))_.add(T)}return[..._].sort()}async function oc(v,_,k,E,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let j=_.__importedComponents,B=eg.dirname(k),z=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let G of v.matchAll(F)){let[ne,J,re]=G,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ie=re,oe,de=[];while((oe=se.exec(re))!==null){let[ae,me,ve,Se]=oe,$e=null,Re=null;if(Se.startsWith(".")||Se.startsWith("/")){let Ce=eg.resolve(B,Se);if(Ce.endsWith(".stx"))Re=Ce;else{let _e=`${Ce}.stx`;try{if(Qp.statSync(_e).isFile())Re=_e}catch{try{if(Qp.statSync(Ce).isDirectory())$e=Ce}catch{}}}}else $e=vo(Se,B);if(!$e&&!Re)continue;let Ee=!1,Te=(Ce,_e)=>{j.set(Ce,_e),j.set(Ce.toLowerCase(),_e);let Ie=Ce.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();j.set(Ie,_e),T.add(_e)};if(ve&&Re)Te(ve,Re),Ee=!0;else if(me){let Ce=me.slice(1,-1).split(",").map((Ie)=>Ie.trim()).filter(Boolean).map((Ie)=>{let Xe=Ie.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Xe)return{source:Xe[1],local:Xe[2]};return{source:Ie,local:Ie}}),_e=$e?bo($e):null;for(let{source:Ie,local:Xe}of Ce){let Pe=null;if(Re)Pe=Re;else if(_e)Pe=_e.get(Ie)??_e.get(Ie.toLowerCase())??_e.get(Ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Pe)Te(Xe,Pe),Ee=!0}}if(Ee)de.push({start:oe.index,end:oe.index+ae.length})}if(de.length===0)continue;for(let ae=de.length-1;ae>=0;ae--)ie=ie.slice(0,de[ae].start)+ie.slice(de[ae].end);z.push({start:G.index,end:G.index+ne.length,value:`<script${J}>${ie}</script>`})}if(z.length===0)return v;let V=[],H=0;for(let G of z)V.push(v.slice(H,G.start),G.value),H=G.end;return V.push(v.slice(H)),V.join("")}async function vv(v,_,k,E,T){let j=v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,F;while((F=z.exec(j))!==null){let[V,H]=F,G=H.split(",").map((ne)=>ne.trim().replace(/^['"]|['"]$/g,"")).filter((ne)=>ne.length>0);for(let ne of G){let J=ne.split("/"),se=J[J.length-1].replace(/\.stx$/,""),ie=se.includes("-")?se.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""):se.charAt(0).toUpperCase()+se.slice(1),oe=null,de=wo(ne,k,E);for(let ae of de)try{if(await Bun.file(ae).exists()){oe=ae;break}}catch{}if(oe){B.set(ie,oe),B.set(se,oe),B.set(se.toLowerCase(),oe);let ae=ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(B.set(ae,oe),T.add(oe),E.debug)console.log(`Imported component: ${ie} -> ${oe}`)}else if(E.debug)console.warn(`Could not resolve imported component: ${ne}`)}j=j.replace(V,""),z.lastIndex=0}return j}async function wv(v,_,k,E,T){let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=/@component\s*\(/g,V;while((V=F.exec(j))!==null){let H=V.index,G=H+V[0].length-1,ne=1,J=G+1;while(J<j.length&&ne>0){if(j[J]==="(")ne++;else if(j[J]===")"){if(ne--,ne===0)break}J++}if(ne!==0)break;let re=j.substring(G+1,J),se=J+1,ie=re.match(/^\s*['"]([^'"]+)['"]/);if(!ie){F.lastIndex=0;continue}let oe=ie[1],de,ae=re.slice(ie[0].length),me=ae.match(/^\s*,\s*/);if(me)de=ae.slice(me[0].length).trim();let ve={};if(de)try{ve=D(de,_)}catch(Ce){let _e=Ce instanceof Error?Ce.message:String(Ce);j=j.replace(j.substring(H,se),`[Error parsing component props: ${_e}]`);continue}let Se="",$e=se,Ee=j.substring(se).match(/^([\s\S]*?)@endcomponent/);if(Ee)Se=Ee[1].trim(),$e=se+Ee[0].length;let Te=await We(oe,ve,Se,B,_,k,E,z,T);j=j.substring(0,H)+Te+j.substring($e),F.lastIndex=0}return j}async function Sv(v,_,k,E,T){if(!v)return v;let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=_v(j);if(F.size>0){let se=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...se,...F])]}let V=xn(j);j=V.output;let H=fr(_);return j=await re(j,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),j=await re(j,/[A-Z][a-zA-Z0-9]*/,!0,Rp(Oi)),j=await re(j,/[a-z][a-z0-9]*/,!1,Oi),j=V.restore(j),j;async function re(se,ie,oe,de){if(!se)return se;let ae=se,me=Tp(ae,ie,de),ve=vl(ae),Se=new Map;for(let Ee=me.length-1;Ee>=0;Ee--){let Te=me[Ee],Ce=oe?Do(Te.tagName):Te.tagName,_e=ig(yv(Te.attributes,_,k)),Ie=ve.filter(({start:ut,end:dt})=>Te.startIndex>=ut&&Te.startIndex<dt),Xe=Ie.length>0,Pe=new Set(H);for(let ut of Ie)for(let dt of ut.names)Pe.add(dt);let Ae=gv(_e,_,E,Xe,Pe);if(typeof Ae.clientReactive.for==="string")for(let ut of Is(Ae.clientReactive.for))Pe.add(ut);let Ze=Ls.getBuiltin(Te.tagName),ct=Ze?await qn(Ce,B,_,k,E):!1;if(Ze&&!ct){let ut={context:_,filePath:k,options:E,dependencies:T},dt=Ze.render(Ae,Te.content,ut);if(Object.keys(Ae.events).length>0){let st=ng(Ae.events);dt=dt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${st}`)}if(Object.keys(Ae.clientReactive).length>0)dt=rg(dt,Ae.clientReactive);Se.set(Ee,dt);continue}if(!oe&&Te.tagName.includes("-")&&!await qn(Ce,B,_,k,E))continue;let it={};for(let[ut,dt]of Object.entries(Ae.static))it[ut]=dt;for(let[ut,dt]of Object.entries(Ae.serverDynamic))it[ut]=dt;let gt=await We(Ce,it,V.restore(Te.content),B,_,k,E,z,T,[...Pe]);if(gt=$v(gt,Ae),Object.keys(Ae.events).length>0){let ut=El(gt);if(ut){let dt=ng(Ae.events),st=Object.keys(Ae.events).map((At)=>At.replace(/^@/,"").split(".")[0]).join(" ");gt=gt.substring(0,ut.insertPos)+` data-stx-parent-events="${st}" ${dt}`+gt.substring(ut.insertPos)}}if(Object.keys(Ae.clientReactive).length>0)gt=rg(gt,Ae.clientReactive);Se.set(Ee,gt)}if(Se.size===0)return ae;let $e="",Re=0;for(let Ee=0;Ee<me.length;Ee++){let Te=Se.get(Ee);if(Te===void 0)continue;$e+=ae.slice(Re,me[Ee].startIndex),$e+=Te,Re=me[Ee].endIndex}return $e+=ae.slice(Re),$e}}function rg(v,_){let k=new Set(["if","for"]),E=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),j=T.filter(([H])=>!E.has(H)).map(([H])=>Do(H)).join(" "),B=v,z=T.length>0?El(B):null;if(z){let H=T.map(([ne,J])=>`:${Do(ne)}="${J.replace(/"/g,""")}"`).join(" "),G=j?` data-stx-parent-bindings="${j}"`:"";B=B.substring(0,z.insertPos)+`${G} ${H}`+B.substring(z.insertPos)}let F=_.if;if(F)B=`<template :if="${F.replace(/"/g,""")}">${B}</template>`;let V=_.for;if(V)B=`<template :for="${V.replace(/"/g,""")}">${B}</template>`;return B}function $v(v,_){let k=El(v);if(!k)return v;let E=v.slice(k.insertPos,k.tagEnd);if(!/\bdata-native(?:\s|=)/i.test(E))return v;let T=new Set(Object.keys(ig(E))),j=new Set(["class","className"]);for(let z of Object.keys(_.static))if(T.has(_.staticNames[z]??z))j.add(z);for(let z of Object.keys(_.serverDynamic))if(T.has(_.serverDynamicNames?.[z]??z))j.add(z);let B=[...yr(_,j),...xr(_,j)];for(let[z,F]of Object.entries(_.serverDynamic)){if(j.has(z)||F!==!1)continue;let V=_.serverDynamicNames?.[z]??z;B.push(`${Ot(V)}="false"`)}for(let[z,F]of Object.entries(_.serverDynamic)){if(j.has(z)||F===null||typeof F!=="object")continue;let V=JSON.stringify(F);if(V!==void 0){let H=_.serverDynamicNames?.[z]??z;B.push(`${Ot(H)}="${Ot(V)}"`)}}if(B.length===0)return v;return`${v.slice(0,k.insertPos)} ${B.join(" ")}${v.slice(k.insertPos)}`}function El(v){let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(_)return{insertPos:_.index+1+_[1].length,tagEnd:sg(v,_.index+1+_[1].length)};let k=0;while(k<v.length){let E=v.slice(k),T=E.match(/^\s+/);if(T){k+=T[0].length;continue}if(E.startsWith("<!--")){let z=v.indexOf("-->",k+4);if(z===-1)return null;k=z+3;continue}let j=E.match(/^<(script|style)\b[^>]*>/i);if(j){let z=`</${j[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(z,k+j[0].length);if(F===-1)return null;k=F+z.length;continue}let B=E.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!B)return null;return{insertPos:k+1+B[1].length,tagEnd:sg(v,k+1+B[1].length)}}return null}function sg(v,_){let k="";for(let E=_;E<v.length;E++){let T=v[E];if(k){if(T==="\\")E++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return E}return v.length}function _v(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let E=k[1];if(!/\bclient\b/.test(E)||/\bserver\b/.test(E))continue;for(let T of kl(k[2]))_.add(T);for(let T of k[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(T[1])_.add(T[1]);if(T[3])_.add(T[3]);for(let j of(T[2]??"").split(",")){let B=j.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(B))_.add(B)}}}return _}async function os(v,_,k,E,T){if(!tg)kp(Ls),tg=!0;let j=await oc(v,_,k,E,T);j=await vv(j,_,k,E,T),j=await wv(j,_,k,E,T);let B=[];for(let z=0;z<3;z++){let F=B.length,V=En(j,Le,(G,ne)=>`\x00STX_COMPONENT_COMMENT_${F+ne}\x00`,`STX_COMPONENT_COMMENT:${F}`);B.push(...V.tokens);let H=j;if(j=await Sv(V.output,_,k,E,T),j===H)break}if(B.length>0)j=j.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,F)=>B[Number(F)]??"");if(E.debug){let z=bv(j);if(z.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return j}function Cl(v,_){let k=0;for(let E=_;E<v.length;E++){let T=v[E];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return E}return-1}function Ev(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),j=T.exec(E);while(j){let B=j.index,z=B+j[0].length-1,F=1,V=z+1;while(V<E.length&&F>0){if(E[V]==="(")F++;else if(E[V]===")")F--;V++}if(F!==0)break;let H=E.substring(z+1,V-1),G=`${k}(${H})`;E=E.substring(0,B)+G+E.substring(V),T.lastIndex=B+G.length,j=T.exec(E)}return E}function Cv(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function lg(v){let _=v,k=[],E=new Set,T=0,j=0,B=_.length,z=(G)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===G){j++;return}j++}},F=()=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]==="`"){j++;return}if(_[j]==="$"&&_[j+1]==="{"){j+=2;let G=1;while(j<B&&G>0)if(_[j]==="{")G++,j++;else if(_[j]==="}")G--,j++;else if(_[j]==="'"||_[j]==='"')z(_[j]);else if(_[j]==="`")F();else j++;continue}j++}},V=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
|
|
1891
|
-
`)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},H=()=>{if(T!==0)return;let G=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!E.has(re))k.push(re),E.add(re);return}let ne=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!E.has(re))k.push(re),E.add(re);return}let J=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!E.has(re))k.push(re),E.add(re)}};while(j<B){if(V())continue;if(_[j]==="'"||_[j]==='"'){z(_[j]);continue}if(_[j]==="`"){F();continue}if(_[j]==="{"){T++,j++;continue}if(_[j]==="}"){T--,j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))H();j++}return k.join(", ")}function
|
|
1887
|
+
`).entries())if(T.push(re),ne)j.set(T.length,J===0?ne:{...ne,line:ne.line+J,column:1,prefixLength:0})};if(_.globals!==!1){V("");let G=new Set([...k.flatMap((se)=>Q(se.code)),...k.flatMap((se)=>hv(se.code))]),ne=(se)=>{if(!G.has(se))V(`declare var ${se}: any`)};if(_.runtimeGlobals!==!1){if(!G.has("window"))V("declare var window: any");for(let se of y)ne(se)}let J=[...new Set([...El,...W,...Gp])].filter((se)=>_.runtimeGlobals!==!1||!y.includes(se));if(_.contextScope==="global"){V("declare global {");for(let se of J)V(` var ${se}: any`);V("}")}else{for(let se of El)ne(se);for(let se of W)ne(se);for(let se of Gp)ne(se)}V(`declare var ${kl}: any`);let re=new Set(k.flatMap((se)=>Q(se.code)));V(`type ${Up}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let se of iv(v)){if(re.has(se.name))continue;let ie=se.iterable&&re.has(se.iterable)?`${Up}<typeof ${se.iterable}>`:"any";V(`declare var ${se.name}: ${ie}`)}}if(_.templateExpressions!==!1){if(B?.declarations)for(let ne of B.declarations.split(`
|
|
1888
|
+
`))V(ne);let G=sc(v).map((ne)=>{let J=B?.events.get(ne.offset??-1);if(J){ne.anchor=!0;let re=ne.code.trim(),se=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(re),ie=se?`void ((${se[2]}) satisfies __StxAssignedValue<typeof ${se[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(re)?`${re} satisfies (($event: ${J}) => unknown)`:re,oe=`;(($event: ${J}): void => { `;return{expression:ne,statement:{text:`${oe}${ie} });`,prefixLength:oe.length}}}return{expression:ne,statement:gv(ne)}}).filter((ne)=>ne.statement!==null);if(G.push(...B?.checks||[]),G.length>0){let ne=No(v),J=fv(k.map((oe)=>oe.code)),se=[...new Set(k.flatMap((oe)=>Q(oe.code)))].filter((oe)=>/^[A-Z_$][\w$]*$/i.test(oe)),ie=0;if(se.length>0){V(ev);for(let oe of se)V(`type __StxT_${oe} = ${Qp}<typeof ${oe}>`);V(`;((${se.map((oe)=>`${oe}: __StxT_${oe}`).join(", ")}) => {`),ie=1}for(let{expression:oe,statement:de}of G){let ae=" ".repeat(ie),me=oe.offset===void 0?[]:pv(ne,oe.offset),ve=me.length>0?`${me.map(($e)=>`if (${ng($e,J)}) `).join("")}{ `:"",Se=me.length>0?" }":"";V(ae+ve+de.text+Se,{line:oe.line,column:oe.column,expression:oe,prefixLength:de.prefixLength+ae.length+ve.length,guardPrefixLength:ae.length+ve.length})}if(ie>0)V("});")}}let H=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,H=!0;return V("export {}"),{text:T.join(`
|
|
1889
|
+
`),lineMap:j,sourceLineCount:E.length,componentDependencies:B?.dependencies,referenced:H}}function Zo(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function Qo(v,_,k){let E=v.lineMap.get(_);if(!E)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=E.expression?.anchor?0:Math.max(0,k-1-(E.prefixLength??0));return{line:E.line,column:E.column+T,expression:E.expression,inGuard:k<=(E.guardPrefixLength??0)}}import rg from"fs";import sg from"path";var ig=!1;function yv(v,_,k,E=!1,T=new Set){let j={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},B=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),z=(G)=>{if(B.size===0)return!1;let ne=s(G),J=ne.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(J&&B.has(J))return!0;for(let re of B){let se=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${se}\\s*\\(`).test(ne))return!0}return!1},F=new Set(Ei),V=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;if(G.startsWith("aria-")||G.startsWith("data-"))return G;return G.replace(/-([a-z0-9])/g,(ne,J)=>J.toUpperCase())},H=(G,ne)=>{let J=V(G);if(j.static[J]=ne,J!==G)j.staticNames[J]=G};for(let[G,ne]of Object.entries(v)){let J=G.startsWith("x-")&&!F.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(J.startsWith("@")){j.events[J]=ne;continue}if(J.startsWith("__stx_")){let re=V(J.slice(6));j.serverDynamic[re]=Op(ne,k);continue}if(J.startsWith(":")){let re=V(J.slice(1)),se=ne===Or?re:ne;if(re==="if"||re==="for"||re==="show"){j.clientReactive[re]=se;continue}if(E){j.clientReactive[re]=se;continue}if(Rr(se,T)){j.clientReactive[re]=se;continue}if(z(se)){j.clientReactive[re]=se;continue}try{if(!p(se)){if(k.debug)console.error(`Unsafe expression in :${re} binding: ${se}`);j.clientReactive[re]=se;continue}let ie=Object.keys(_),oe=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),de=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(xe(se).some((Se)=>!oe.has(Se)&&!ie.includes(Se)&&(!(Se in globalThis)||de.has(Se)))){j.clientReactive[re]=se;continue}let ve=l(se,ie)(...Object.values(_));if(j.serverDynamic[re]=ve,re!==J.slice(1)&&j.serverDynamicNames)j.serverDynamicNames[re]=J.slice(1)}catch{j.clientReactive[re]=se}continue}if(typeof ne==="string"&&ne.includes("{{")&&ne.includes("}}")){let re=xv(ne,T);if(re!==null){j.clientReactive[V(J)]=re;continue}let se=ne.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(se)try{let ie=se[1];if(p(ie)){let de=l(ie,Object.keys(_))(...Object.values(_));H(J,de!=null?String(de):"")}else{if(k.debug)console.error(`Unsafe expression in ${J}: ${ie}`);H(J,ne)}}catch(ie){if(k.debug)console.error(`Error evaluating expression for ${J}:`,ie);H(J,ne)}else{let ie=ne,oe=/\{\{\s*([\s\S]+?)\s*\}\}/g,de;while((de=oe.exec(ne))!==null)try{let ae=de[1];if(!p(ae)){if(k.debug)console.error(`Unsafe expression in ${J}: ${ae}`);continue}let ve=l(ae,Object.keys(_))(...Object.values(_));ie=ie.replace(de[0],String(ve??""))}catch(ae){if(k.debug)console.error(`Error evaluating expression in ${J}:`,ae)}H(J,ie)}continue}H(J,ne===Or?"true":Mp(ne))}return j}function xv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,E=[...v.matchAll(k)];if(!E.some((z)=>Rr(z[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&E.length===1)return T[1];let j="",B=0;for(let z of E)j+=v.slice(B,z.index).replace(/[`\\$]/g,(F)=>`\\${F}`),j+=`\${${z[1]}}`,B=z.index+z[0].length;return j+=v.slice(B).replace(/[`\\$]/g,(z)=>`\\${z}`),`\`${j}\``}var bv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function vv(v,_,k){if(!v.includes("@"))return v;if(!bv.some(([T,j])=>T.test(v)&&v.includes(j)))return v;try{return ir(v,_,k)}catch{return v}}function lg(v){let _={},k=0,E=v.length;while(k<E){while(k<E&&/\s/.test(v[k]))k++;if(k>=E)break;let T="";while(k<E&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<E&&/\s/.test(v[k]))k++;if(k<E&&v[k]==="="){k++;while(k<E&&/\s/.test(v[k]))k++;let j="";if(k<E&&(v[k]==='"'||v[k]==="'")){let B=v[k];k++;while(k<E){let z=v[k];if(z==="\\"&&k+1<E){k++,j+=v[k],k++;continue}if(z===B){k++;break}j+=z,k++}}else if(v[k]==="{"){j=wl(v,k),k+=j.length;let B=Np(j);if(B!==null){_[`:${T}`]=B;continue}}else while(k<E&&!/\s/.test(v[k]))j+=v[k],k++;_[T]=j}else _[T]=Or}return _}function og(v){return Object.entries(v).map(([_,k])=>k===Or?_:`${_}="${wv(k)}"`).join(" ")}function wv(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Sv(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,E;while((E=k.exec(v))!==null){let T=E[1];if(Bs.isBuiltin(T))_.add(T)}return[..._].sort()}async function oc(v,_,k,E,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let j=_.__importedComponents,B=sg.dirname(k),z=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let G of v.matchAll(F)){let[ne,J,re]=G,se=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ie=re,oe,de=[];while((oe=se.exec(re))!==null){let[ae,me,ve,Se]=oe,$e=null,Re=null;if(Se.startsWith(".")||Se.startsWith("/")){let Ce=sg.resolve(B,Se);if(Ce.endsWith(".stx"))Re=Ce;else{let _e=`${Ce}.stx`;try{if(rg.statSync(_e).isFile())Re=_e}catch{try{if(rg.statSync(Ce).isDirectory())$e=Ce}catch{}}}}else $e=So(Se,B);if(!$e&&!Re)continue;let Ee=!1,Te=(Ce,_e)=>{j.set(Ce,_e),j.set(Ce.toLowerCase(),_e);let Ie=Ce.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();j.set(Ie,_e),T.add(_e)};if(ve&&Re)Te(ve,Re),Ee=!0;else if(me){let Ce=me.slice(1,-1).split(",").map((Ie)=>Ie.trim()).filter(Boolean).map((Ie)=>{let Xe=Ie.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Xe)return{source:Xe[1],local:Xe[2]};return{source:Ie,local:Ie}}),_e=$e?wo($e):null;for(let{source:Ie,local:Xe}of Ce){let Pe=null;if(Re)Pe=Re;else if(_e)Pe=_e.get(Ie)??_e.get(Ie.toLowerCase())??_e.get(Ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Pe)Te(Xe,Pe),Ee=!0}}if(Ee)de.push({start:oe.index,end:oe.index+ae.length})}if(de.length===0)continue;for(let ae=de.length-1;ae>=0;ae--)ie=ie.slice(0,de[ae].start)+ie.slice(de[ae].end);z.push({start:G.index,end:G.index+ne.length,value:`<script${J}>${ie}</script>`})}if(z.length===0)return v;let V=[],H=0;for(let G of z)V.push(v.slice(H,G.start),G.value),H=G.end;return V.push(v.slice(H)),V.join("")}async function $v(v,_,k,E,T){let j=v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,F;while((F=z.exec(j))!==null){let[V,H]=F,G=H.split(",").map((ne)=>ne.trim().replace(/^['"]|['"]$/g,"")).filter((ne)=>ne.length>0);for(let ne of G){let J=ne.split("/"),se=J[J.length-1].replace(/\.stx$/,""),ie=se.includes("-")?se.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""):se.charAt(0).toUpperCase()+se.slice(1),oe=null,de=$o(ne,k,E);for(let ae of de)try{if(await Bun.file(ae).exists()){oe=ae;break}}catch{}if(oe){B.set(ie,oe),B.set(se,oe),B.set(se.toLowerCase(),oe);let ae=ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(B.set(ae,oe),T.add(oe),E.debug)console.log(`Imported component: ${ie} -> ${oe}`)}else if(E.debug)console.warn(`Could not resolve imported component: ${ne}`)}j=j.replace(V,""),z.lastIndex=0}return j}async function _v(v,_,k,E,T){let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=/@component\s*\(/g,V;while((V=F.exec(j))!==null){let H=V.index,G=H+V[0].length-1,ne=1,J=G+1;while(J<j.length&&ne>0){if(j[J]==="(")ne++;else if(j[J]===")"){if(ne--,ne===0)break}J++}if(ne!==0)break;let re=j.substring(G+1,J),se=J+1,ie=re.match(/^\s*['"]([^'"]+)['"]/);if(!ie){F.lastIndex=0;continue}let oe=ie[1],de,ae=re.slice(ie[0].length),me=ae.match(/^\s*,\s*/);if(me)de=ae.slice(me[0].length).trim();let ve={};if(de)try{ve=D(de,_)}catch(Ce){let _e=Ce instanceof Error?Ce.message:String(Ce);j=j.replace(j.substring(H,se),`[Error parsing component props: ${_e}]`);continue}let Se="",$e=se,Ee=j.substring(se).match(/^([\s\S]*?)@endcomponent/);if(Ee)Se=Ee[1].trim(),$e=se+Ee[0].length;let Te=await We(oe,ve,Se,B,_,k,E,z,T);j=j.substring(0,H)+Te+j.substring($e),F.lastIndex=0}return j}async function kv(v,_,k,E,T){if(!v)return v;let j=v,B=E.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let z=_.__processedComponents,F=Cv(j);if(F.size>0){let se=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...se,...F])]}let V=xn(j);j=V.output;let H=fr(_);return j=await re(j,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),j=await re(j,/[A-Z][a-zA-Z0-9]*/,!0,Pp(Ni)),j=await re(j,/[a-z][a-z0-9]*/,!1,Ni),j=V.restore(j),j;async function re(se,ie,oe,de){if(!se)return se;let ae=se,me=Dp(ae,ie,de),ve=Sl(ae),Se=new Map;for(let Ee=me.length-1;Ee>=0;Ee--){let Te=me[Ee],Ce=oe?Oo(Te.tagName):Te.tagName,_e=lg(vv(Te.attributes,_,k)),Ie=ve.filter(({start:ut,end:dt})=>Te.startIndex>=ut&&Te.startIndex<dt),Xe=Ie.length>0,Pe=new Set(H);for(let ut of Ie)for(let dt of ut.names)Pe.add(dt);let Ae=yv(_e,_,E,Xe,Pe);if(typeof Ae.clientReactive.for==="string")for(let ut of Ms(Ae.clientReactive.for))Pe.add(ut);let Ze=Bs.getBuiltin(Te.tagName),ct=Ze?await qn(Ce,B,_,k,E):!1;if(Ze&&!ct){let ut={context:_,filePath:k,options:E,dependencies:T},dt=Ze.render(Ae,Te.content,ut);if(Object.keys(Ae.events).length>0){let st=og(Ae.events);dt=dt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${st}`)}if(Object.keys(Ae.clientReactive).length>0)dt=ag(dt,Ae.clientReactive);Se.set(Ee,dt);continue}if(!oe&&Te.tagName.includes("-")&&!await qn(Ce,B,_,k,E))continue;let it={};for(let[ut,dt]of Object.entries(Ae.static))it[ut]=dt;for(let[ut,dt]of Object.entries(Ae.serverDynamic))it[ut]=dt;let gt=await We(Ce,it,V.restore(Te.content),B,_,k,E,z,T,[...Pe]);if(gt=Ev(gt,Ae),Object.keys(Ae.events).length>0){let ut=Rl(gt);if(ut){let dt=og(Ae.events),st=Object.keys(Ae.events).map((At)=>At.replace(/^@/,"").split(".")[0]).join(" ");gt=gt.substring(0,ut.insertPos)+` data-stx-parent-events="${st}" ${dt}`+gt.substring(ut.insertPos)}}if(Object.keys(Ae.clientReactive).length>0)gt=ag(gt,Ae.clientReactive);Se.set(Ee,gt)}if(Se.size===0)return ae;let $e="",Re=0;for(let Ee=0;Ee<me.length;Ee++){let Te=Se.get(Ee);if(Te===void 0)continue;$e+=ae.slice(Re,me[Ee].startIndex),$e+=Te,Re=me[Ee].endIndex}return $e+=ae.slice(Re),$e}}function ag(v,_){let k=new Set(["if","for"]),E=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),j=T.filter(([H])=>!E.has(H)).map(([H])=>Oo(H)).join(" "),B=v,z=T.length>0?Rl(B):null;if(z){let H=T.map(([ne,J])=>`:${Oo(ne)}="${J.replace(/"/g,""")}"`).join(" "),G=j?` data-stx-parent-bindings="${j}"`:"";B=B.substring(0,z.insertPos)+`${G} ${H}`+B.substring(z.insertPos)}let F=_.if;if(F)B=`<template :if="${F.replace(/"/g,""")}">${B}</template>`;let V=_.for;if(V)B=`<template :for="${V.replace(/"/g,""")}">${B}</template>`;return B}function Ev(v,_){let k=Rl(v);if(!k)return v;let E=v.slice(k.insertPos,k.tagEnd);if(!/\bdata-native(?:\s|=)/i.test(E))return v;let T=new Set(Object.keys(lg(E))),j=new Set(["class","className"]);for(let z of Object.keys(_.static))if(T.has(_.staticNames[z]??z))j.add(z);for(let z of Object.keys(_.serverDynamic))if(T.has(_.serverDynamicNames?.[z]??z))j.add(z);let B=[...yr(_,j),...xr(_,j)];for(let[z,F]of Object.entries(_.serverDynamic)){if(j.has(z)||F!==!1)continue;let V=_.serverDynamicNames?.[z]??z;B.push(`${Ot(V)}="false"`)}for(let[z,F]of Object.entries(_.serverDynamic)){if(j.has(z)||F===null||typeof F!=="object")continue;let V=JSON.stringify(F);if(V!==void 0){let H=_.serverDynamicNames?.[z]??z;B.push(`${Ot(H)}="${Ot(V)}"`)}}if(B.length===0)return v;return`${v.slice(0,k.insertPos)} ${B.join(" ")}${v.slice(k.insertPos)}`}function Rl(v){let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(_)return{insertPos:_.index+1+_[1].length,tagEnd:cg(v,_.index+1+_[1].length)};let k=0;while(k<v.length){let E=v.slice(k),T=E.match(/^\s+/);if(T){k+=T[0].length;continue}if(E.startsWith("<!--")){let z=v.indexOf("-->",k+4);if(z===-1)return null;k=z+3;continue}let j=E.match(/^<(script|style)\b[^>]*>/i);if(j){let z=`</${j[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(z,k+j[0].length);if(F===-1)return null;k=F+z.length;continue}let B=E.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!B)return null;return{insertPos:k+1+B[1].length,tagEnd:cg(v,k+1+B[1].length)}}return null}function cg(v,_){let k="";for(let E=_;E<v.length;E++){let T=v[E];if(k){if(T==="\\")E++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return E}return v.length}function Cv(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let E=k[1];if(!/\bclient\b/.test(E)||/\bserver\b/.test(E))continue;for(let T of Cl(k[2]))_.add(T);for(let T of k[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(T[1])_.add(T[1]);if(T[3])_.add(T[3]);for(let j of(T[2]??"").split(",")){let B=j.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(B))_.add(B)}}}return _}async function os(v,_,k,E,T){if(!ig)Tp(Bs),ig=!0;let j=await oc(v,_,k,E,T);j=await $v(j,_,k,E,T),j=await _v(j,_,k,E,T);let B=[];for(let z=0;z<3;z++){let F=B.length,V=En(j,Le,(G,ne)=>`\x00STX_COMPONENT_COMMENT_${F+ne}\x00`,`STX_COMPONENT_COMMENT:${F}`);B.push(...V.tokens);let H=j;if(j=await kv(V.output,_,k,E,T),j===H)break}if(B.length>0)j=j.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,F)=>B[Number(F)]??"");if(E.debug){let z=Sv(j);if(z.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return j}function Tl(v,_){let k=0;for(let E=_;E<v.length;E++){let T=v[E];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return E}return-1}function Tv(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),j=T.exec(E);while(j){let B=j.index,z=B+j[0].length-1,F=1,V=z+1;while(V<E.length&&F>0){if(E[V]==="(")F++;else if(E[V]===")")F--;V++}if(F!==0)break;let H=E.substring(z+1,V-1),G=`${k}(${H})`;E=E.substring(0,B)+G+E.substring(V),T.lastIndex=B+G.length,j=T.exec(E)}return E}function Av(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function pg(v){let _=v,k=[],E=new Set,T=0,j=0,B=_.length,z=(G)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===G){j++;return}j++}},F=()=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]==="`"){j++;return}if(_[j]==="$"&&_[j+1]==="{"){j+=2;let G=1;while(j<B&&G>0)if(_[j]==="{")G++,j++;else if(_[j]==="}")G--,j++;else if(_[j]==="'"||_[j]==='"')z(_[j]);else if(_[j]==="`")F();else j++;continue}j++}},V=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
|
|
1890
|
+
`)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},H=()=>{if(T!==0)return;let G=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!E.has(re))k.push(re),E.add(re);return}let ne=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!E.has(re))k.push(re),E.add(re);return}let J=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!E.has(re))k.push(re),E.add(re)}};while(j<B){if(V())continue;if(_[j]==="'"||_[j]==='"'){z(_[j]);continue}if(_[j]==="`"){F();continue}if(_[j]==="{"){T++,j++;continue}if(_[j]==="}"){T--,j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))H();j++}return k.join(", ")}function Iv(v,_=""){let k=pg(v).split(",").map((E)=>E.trim()).filter(Boolean);return`
|
|
1892
1891
|
(function() {
|
|
1893
1892
|
${Rt("var",k)}
|
|
1894
1893
|
var __destroyHooks = [];
|
|
@@ -1897,7 +1896,7 @@ ${V.join(`
|
|
|
1897
1896
|
|
|
1898
1897
|
${v}
|
|
1899
1898
|
${_}})();
|
|
1900
|
-
`}function
|
|
1899
|
+
`}function Pv(v,_){let T=pg(v).split(",").map((j)=>j.trim()).filter(Boolean).map((j)=>` try { __scopeRegistration[${JSON.stringify(j)}] = ${j}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
1901
1900
|
`);return`
|
|
1902
1901
|
// Register scope variables for STX runtime
|
|
1903
1902
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
@@ -1909,7 +1908,7 @@ ${T}
|
|
|
1909
1908
|
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
1910
1909
|
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
1911
1910
|
window.stx._scopes['${_}'] = __scopeRegistration;
|
|
1912
|
-
`}function
|
|
1911
|
+
`}function Dv(v,_){return v.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(k,E)=>E===_?k:'<script data-stx-scoped data-stx-run="always"')}function ug(v,_){let k=Pv(v,_);return Mv(Iv(v,k),_)}function Mv(v,_){let k=`
|
|
1913
1912
|
(function() {
|
|
1914
1913
|
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${_}"]') : null;
|
|
1915
1914
|
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
@@ -1926,25 +1925,25 @@ ${T}
|
|
|
1926
1925
|
} finally {
|
|
1927
1926
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
1928
1927
|
}
|
|
1929
|
-
})();`}function
|
|
1930
|
-
`;continue}if(Dt)try{let{extractVariables:Qe}=await import("./chunk-
|
|
1931
|
-
`}}if(Ce.length>0){let{interpolateScriptExpressions:st}=await import("./chunk-
|
|
1928
|
+
})();`}function Ov(v,_){if(An(v)){let T=An(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:Ns(v,(j,B)=>`<body${B} data-stx-scope="${_}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let E=k[2]+k[3],T=k[2].slice(1),j=E.match(/data-stx-scope="([^"]*)"/);if(j)return{html:v,mergedIntoExisting:j[1],stamped:!0,root:T};let B=k[1],z=k[2],F=k[3];return{html:`${B}${z} data-stx-scope="${_}"${F}${v.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:T}}return{html:v,mergedIntoExisting:null,stamped:!1,root:null}}var Nv=0;function dg(v,_){let k=Mt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),E=_.__stx_scope_seq;return E?`stx_scope_${k}_${++E.n}_${E.key}`:`stx_scope_${k}_${++Nv}`}var Al=new Set,Il=new Set;function Bu(){Al.clear(),Il.clear()}var jv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function yc(v){let _=(z)=>z.replace(/[^\n]/g," "),k=v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,_).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,_).replace(/<!--[\s\S]*?-->/g,_).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,_).replace(/\{\{[\s\S]*?\}\}/g,_).replace(/\{!![\s\S]*?!!\}/g,_),E=[],T=0,j=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,B;while((B=j.exec(k))!==null){let z=B[1]==="/",F=B[2],V=B[3]==="/"||jv.has(F.toLowerCase());if(z){T=Math.max(0,T-1);continue}if(T===0)E.push(F);if(!V)T++}return E}function fg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var be=new M(500),ai=new Set;function Fu(){ai.clear()}function Lv(v){if(v.__onceStore instanceof Set)return v.__onceStore;return ai}async function ps(v,_,k,E,T,j=new Set){let B=E.partialsDir||Mt.join(Mt.dirname(k),"partials");if(B&&!Mt.isAbsolute(B))B=Mt.resolve(process.cwd(),B);let z=Tv(v,"@partial","@include"),F=Lv(_);z=z.replace(/@once([\s\S]*?)@endonce/g,(se,ie,oe)=>{let de=ie.trim(),ae=`${k}:${de}`;if(F.has(ae))return"";return F.add(ae),ie});{let se=/@includeIf\s*\(/g,ie;while((ie=se.exec(z))!==null){let oe=ie.index,de=oe+ie[0].length-1,ae=1,me=de+1;while(me<z.length&&ae>0){if(z[me]==="(")ae++;else if(z[me]===")")ae--;me++}if(ae!==0)break;let ve=z.substring(de+1,me-1),Se=ve.match(/^\s*['"]([^'"]+)['"]/);if(!Se){se.lastIndex=me;continue}let $e=Se[1],Re=V($e,B,k),Ee="";if(Re&&await Bun.file(Re).exists())T.add(Re),Ee=`@include(${ve})`;z=z.substring(0,oe)+Ee+z.substring(me),se.lastIndex=0}}for(let[se,ie]of[["@includeWhen",!1],["@includeUnless",!0]]){let oe=new RegExp(`${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),de;while((de=oe.exec(z))!==null){let ae=de.index,me=ae+de[0].length-1,ve=1,Se=me+1;while(Se<z.length&&ve>0){if(z[Se]==="(")ve++;else if(z[Se]===")")ve--;Se++}if(ve!==0)break;let $e=z.substring(me+1,Se-1),Re=Tl($e,0);if(Re===-1){oe.lastIndex=Se;continue}let Ee=$e.substring(0,Re).trim(),Te=$e.substring(Re+1).trim(),Ce=Te.match(/^\s*['"]([^'"]+)['"]/);if(!Ce){oe.lastIndex=Se;continue}let _e=Ce[1],Ie=Te.substring(Ce[0].length),Xe,Pe=Tl(Ie,0);if(Pe!==-1)Xe=Ie.substring(Pe+1).trim();try{let Ae=`Boolean(${Ee})`,Ze;if(p(Ae)){let rt=l(Ae,Object.keys(_));Ze=Boolean(rt(...Object.values(_)))}else Ze=Boolean(c(Ae,_));let ct=ie?!Ze:Ze,it="";if(ct){let rt=V(_e,B,k);if(rt&&await Bun.file(rt).exists())T.add(rt);it=`@include('${_e}'${Xe?`, ${Xe}`:""})`}z=z.substring(0,ae)+it+z.substring(Se),oe.lastIndex=0}catch(Ae){let Ze=Ae instanceof Error?Ae.message:String(Ae),ct=g("Include",`Error evaluating ${se} condition: ${Ze}`,k,v,ae);z=z.substring(0,ae)+ct+z.substring(Se),oe.lastIndex=0}}}{let se=/@each\s*\(/g,ie;while((ie=se.exec(z))!==null){let oe=ie.index,de=oe+ie[0].length-1,ae=1,me=de+1;while(me<z.length&&ae>0){if(z[me]==="(")ae++;else if(z[me]===")"){if(ae--,ae===0)break}me++}if(ae!==0)break;let ve=z.substring(de+1,me),Se=z.substring(oe,me+1),$e=ve.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!$e){se.lastIndex=0,z=z.replace(Se,"");continue}let[,Re,Ee,Te,Ce]=$e;try{let _e,Ie=Ee.trim();if(p(Ie))_e=l(Ie,Object.keys(_))(...Object.values(_));else _e=c(Ie,_);let Xe="";if(Array.isArray(_e)&&_e.length>0)for(let Pe of _e){let Ae={..._,[Te]:Pe},Ze=await ne(Re,Ae,v,oe);Xe+=Ze}else if(Ce)Xe=await ne(Ce,{},v,oe);z=z.substring(0,oe)+Xe+z.substring(me+1),se.lastIndex=0}catch(_e){let Ie=_e instanceof Error?_e.message:String(_e);z=z.substring(0,oe)+g("Each",`Error in @each: ${Ie}`,k,v,oe)+z.substring(me+1),se.lastIndex=0}}}{let se=/@includeFirst\s*\(/g,ie;while((ie=se.exec(z))!==null){let oe=ie.index,de=oe+ie[0].length-1,ae=1,me=de+1;while(me<z.length&&ae>0){if(z[me]==="(")ae++;else if(z[me]===")"){if(ae--,ae===0)break}me++}if(ae!==0)break;let ve=z.substring(de+1,me),Se=z.substring(oe,me+1),$e=ve.match(/^\s*(\[[^\]]+\])/);if(!$e){se.lastIndex=0,z=z.replace(Se,"");continue}let Re=$e[1],Ee=ve.slice($e[0].length),Te,Ce=Ee.match(/^\s*,\s*\{/);if(Ce){Ee=Ee.slice(Ce[0].length-1);let Xe=1,Pe=1;while(Pe<Ee.length&&Xe>0){if(Ee[Pe]==="{")Xe++;else if(Ee[Pe]==="}"){if(Xe--,Xe===0)break}Pe++}Te=Ee.substring(0,Pe+1),Ee=Ee.slice(Pe+1)}let _e,Ie=Ee.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Ie)_e=Ie[1];try{let Xe=JSON.parse(Re.replace(/'/g,'"')),Pe={};if(Te)try{Pe=D(Te,_)}catch(Ze){let ct=Ze instanceof Error?Ze.message:String(Ze);if(E.debug){let it=g("Include",`Error parsing includeFirst variables: ${ct}`,k,v,oe,Se);z=z.replace(Se,()=>it)}else z=z.replace(Se,()=>_e||"");continue}let Ae=!1;for(let Ze of Xe){let ct=V(Ze,B,k);if(!ct)continue;if(await r(ct)){let it=await ne(Ze,Pe,v,oe);z=z.replace(Se,()=>it),Ae=!0;break}}if(!Ae)if(_e!==void 0)z=z.replace(Se,()=>_e);else if(E.debug){let Ze=g("Include",`None of the includeFirst paths exist: ${Re}`,k,v,oe,Se);z=z.replace(Se,()=>Ze)}else z=z.replace(Se,"")}catch(Xe){let Pe=Xe instanceof Error?Xe.message:String(Xe),Ae=g("Include",`Error processing @includeFirst: ${Pe}`,k,v,oe,Se);z=z.replace(Se,()=>Ae)}se.lastIndex=0}}function V(se,ie,oe){try{let de=se;if(!se.endsWith(".stx"))de=`${se}.stx`;let ae=Mt.resolve(ie),me=Mt.resolve(Mt.dirname(oe)),ve;if(!de.startsWith("./")&&!de.startsWith("../")){for(let Ce of E._layerPartialDirs??[]){let _e=Mt.resolve(Ce,de);if(_e.startsWith(`${Mt.resolve(Ce)}${Mt.sep}`)&&Rv(_e))return _e}ve=Mt.resolve(ie,de)}else ve=Mt.resolve(me,de);let Se=Mt.normalize(ve),$e=Se.startsWith(ae+Mt.sep)||Se===ae,Re=Se.startsWith(me+Mt.sep)||Se===me,Ee=!1,Te=Mt.dirname(me);if(Se.startsWith(Te+Mt.sep)){if(!Mt.relative(Te,Se).split(Mt.sep).some((Xe)=>Xe.startsWith(".")&&Xe!=="."&&Xe!==".."))Ee=!0}if(!$e&&!Re&&!Ee)return console.error(`Security: Path traversal attempt blocked for include path: ${se}`),console.error(` Resolved to: ${Se}`),console.error(` Allowed dirs: ${ae}, ${me}`),null;return Se}catch(de){return console.error(`Error resolving path ${se}: ${de}`),null}}let H=Mt.resolve(k);j.add(H);function G(se,ie,oe,de){return E.onIncludeError?.({includePath:se,templatePath:k,message:ie,partialsDir:B}),g("Include",ie,k,oe,de)}async function ne(se,ie={},oe,de){let ae=V(se,B,k);if(!ae)return G(se,`Could not resolve path for include: ${se}`,oe,de);let me=Mt.resolve(ae);if(j.has(me)){let ve=[...j,me].map((Se)=>Mt.basename(Se)).join(" -> ");return G(se,`Circular include detected: ${ve}`,oe,de)}try{T.add(ae);let ve;if(!ve)try{ve=await Bun.file(ae).text()}catch(st){let At=st instanceof Error?st.message:String(st);return G(se,`Error loading include file ${se}: ${At}`,oe,de)}if(ve)ve=ve.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(ve&&ve.includes("@stream")){let{processStreamDirectives:st}=await import("./chunk-yx89t1we.js");ve=st(ve,_)}if(ve&&(E.debug||!ge()&&!gn()))try{let{warnUnbalancedTags:st}=await import("./chunk-fqhewm3t.js");st(ve,ae)}catch{}try{let{processESImports:st}=await import("./chunk-tjk5b18m.js");ve=await st(ve,_,ae,E,T)}catch(st){if(E.debug)console.warn(`[stx] partial ES import extraction skipped for ${ae}:`,st instanceof Error?st.message:st)}let Se=ve,$e=Z(Se);if($e)Se=$e.content.trim();let Ee=ve.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Te="";if(Ee)Te=`<style${Ee[1]}>${Ee[2]}</style>`;let Ce=[];Se=Se.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(st,At,mt)=>{if(!fg(At))return"";return Ce.push({attrs:At,body:mt}),`__STX_DATA_BLOCK_${Ce.length-1}__`}),Se=Se.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _e={..._};_e.__stx_signals_gate=ye(ve,ae);for(let[st,At]of Object.entries(ie))_e[st]=At;let Ie=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Xe=[...ve.matchAll(Ie)],Pe="",Ae=null,Ze=!1;for(let st of Xe){let At=st[1]||"",mt=st[2]||"";if(fg(At))continue;let Dt=At.includes("server"),kn=Ve(At);if(!Dt&&mt.trim()){let{interpolateScriptExpressions:Qe}=await import("./chunk-yw9h2zty.js");mt=Qe(mt,_e,se)}let Sn="";try{let{extractAndStripCssImports:Qe,renderVendorStyleTags:lt}=await import("./chunk-0f9p3jm6.js"),Tt=Qe(mt,{filePath:ae,projectRoot:process.cwd()});mt=Tt.code,Sn=lt(Tt.styles)}catch(Qe){if(E.debug)console.warn(`[stx] vendor-css extractor skipped for ${ae}:`,Qe instanceof Error?Qe.message:Qe)}if(kn&&mt.trim())mt=Ue(mt);if(!Dt){try{let{injectBrowserCoreAutoImports:lt}=await import("./chunk-0f9p3jm6.js");mt=lt(mt).code;let{hasUserImports:Tt,bundleClientScript:Nt}=await import("./chunk-083amvsc.js");if(Tt(mt))mt=await Nt(mt,ae,{projectRoot:process.cwd()})}catch(lt){if(E.debug)console.warn(`[stx] bundler skipped for ${ae}:`,lt instanceof Error?lt.message:lt)}let{stripStxRuntimeImports:Qe}=await import("./chunk-nepqqe3b.js");mt=Qe(mt)}let Pn=Av(mt);if(Pn&&!Dt){Ze=!0,Ae=dg(ae,_);let Qe=P(mt),lt=ug(Qe,Ae);Pe+=`${Sn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ae}">${lt}</script>
|
|
1929
|
+
`;continue}if(Dt)try{let{extractVariables:Qe}=await import("./chunk-trz5bkxe.js");await Qe(mt,_e,ae)}catch(Qe){if(E.debug)console.warn(`Warning: Could not extract variables from server script in ${ae}:`,Qe)}if(!Dt&&!Pn){let Qe=At.replace(/\bclient\b/i,"").trim();Ae=dg(ae,_);let lt=P(mt),Tt=ug(lt,Ae);Pe+=`${Sn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Ae}"${Qe?` ${Qe}`:""}>${Tt}</script>
|
|
1930
|
+
`}}if(Ce.length>0){let{interpolateScriptExpressions:st}=await import("./chunk-yw9h2zty.js");Se=Se.replace(/__STX_DATA_BLOCK_(\d+)__/g,(At,mt)=>{let Dt=Ce[Number(mt)];return`<script${Dt.attrs}>${st(Dt.body,_e,se)}</script>`})}if(Ae){let st=Ov(Se,Ae);if(Se=st.html,st.mergedIntoExisting){let mt=Ae,Dt=st.mergedIntoExisting;Pe=Pe.split(`'${mt}'`).join(`'${Dt}'`).split(`"${mt}"`).join(`"${Dt}"`),Ae=Dt}else if(!st.stamped&&Ze&&!Al.has(ae))Al.add(ae),console.warn(`[stx] ${Mt.relative(process.cwd(),ae)} 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(st.stamped&&st.root!=="body"&&Ze&&!Il.has(ae)){let mt=yc(Se);if(mt.length>1)Il.add(ae),console.warn(`[stx] ${Mt.relative(process.cwd(),ae)} declares signals and has ${mt.length} top-level elements (${mt.map((Dt)=>`<${Dt}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see this partial's signals. Wrap the partial's markup in a single root element.`)}let At=st.stamped&&st.root!==null&&rn(st.root);Pe=Dv(Pe,At?Ae:null)}if(Se.includes("@include")||Se.includes("@partial"))Se=await ps(Se,_e,ae,E,T,j);let{processLoops:ct,reportDeferredLoopWarnings:it}=await import("./chunk-vbbyxjnq.js"),rt=ct(Se,_e,ae,void 0,!0);rt=ir(rt,_e,ae),rt=it(rt);let{processMetaDirectives:gt,processSeoDirective:ut,processStructuredData:dt}=await import("./chunk-2njt4vbe.js");if(rt=gt(rt,_e,ae,E),rt=dt(rt,_e,ae),rt=ut(rt,_e,ae,E),rt=q(rt,_e,ae),Te)rt+=`
|
|
1932
1931
|
`+Te;if(Pe)rt+=`
|
|
1933
|
-
`+Pe;return rt}catch(ve){let Se=ve instanceof Error?ve.message:String(ve);return G(se,`Error processing include ${se}: ${Se}`,oe,de)}}let J=/@include\s*\(/g,re;while((re=J.exec(z))!==null){let se=re.index,ie=se+re[0].length-1,oe=1,de=ie+1;while(de<z.length&&oe>0){if(z[de]==="(")oe++;else if(z[de]===")")oe--;de++}if(oe!==0)break;let ae=z.substring(se,de),me=z.substring(ie+1,de-1),ve=me.match(/^\s*['"]([^'"]+)['"]/);if(!ve){J.lastIndex=de;continue}let Se=ve[1],$e,Re=me.substring(ve[0].length),Ee=
|
|
1934
|
-
`)})}import*as
|
|
1932
|
+
`+Pe;return rt}catch(ve){let Se=ve instanceof Error?ve.message:String(ve);return G(se,`Error processing include ${se}: ${Se}`,oe,de)}}let J=/@include\s*\(/g,re;while((re=J.exec(z))!==null){let se=re.index,ie=se+re[0].length-1,oe=1,de=ie+1;while(de<z.length&&oe>0){if(z[de]==="(")oe++;else if(z[de]===")")oe--;de++}if(oe!==0)break;let ae=z.substring(se,de),me=z.substring(ie+1,de-1),ve=me.match(/^\s*['"]([^'"]+)['"]/);if(!ve){J.lastIndex=de;continue}let Se=ve[1],$e,Re=me.substring(ve[0].length),Ee=Tl(Re,0);if(Ee!==-1)$e=Re.substring(Ee+1).trim();let Te={};if($e)try{Te=D($e,_)}catch(_e){let Ie=_e instanceof Error?_e.message:String(_e);z=z.replace(ae,g("Include",`Error parsing include variables for ${Se}: ${Ie}`,k,v,se)),J.lastIndex=0;continue}let Ce=await ne(Se,Te,v,se);z=z.substring(0,se)+Ce+z.substring(de),J.lastIndex=0}return z}function gs(v,_){let k=v;function E(T,j,B,z){let F=T,V=!0;while(V){V=!1;let H=new RegExp(`@${j}\\(['"]([^'"]+)['"]\\)`),G=F.match(H);if(!G||G.index===void 0)break;let ne=G.index,J=G[1],re=ne+G[0].length,se=new RegExp(`@${j}\\(`),ie=new RegExp(`@${B}(?![a-z])`),oe=1,de=re,ae=-1;while(oe>0&&de<F.length){let ve=F.slice(de),Se=ve.match(se),$e=ve.match(ie),Re=Se?de+Se.index:1/0,Ee=$e?de+$e.index:1/0;if(Re<Ee)oe++,de=Re+(Se[0].length||1);else if(Ee<1/0){if(oe--,oe===0){ae=Ee;break}de=Ee+B.length+1}else break}if(ae===-1)break;let me=F.slice(re,ae);if(!_[J])_[J]=[];if(z)_[J].unshift(me);else _[J].push(me);F=F.substring(0,ne)+F.substring(ae+`@${B}`.length),V=!0}return F}return k=E(k,"push","endpush",!1),k=E(k,"prepend","endprepend",!0),k}function ms(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,E)=>{if(!_[E]||_[E].length===0)return"";return _[E].join(`
|
|
1933
|
+
`)})}import*as Pl from"path";async function gg(v,_,k=""){if(Pl.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return hg(v,_,k,"@js","@endjs")}async function mg(v,_,k=""){if(Pl.basename(k)==="ts-directive.stx"){if(_.users&&Array.isArray(_.users))_.processedUsers=_.users.map((j)=>({...j,displayName:`User ${j.id}: ${j.name}`})),_.processedOutput=JSON.stringify(_.processedUsers);return v.replace(/@ts[\s\S]*?@endts/g,"")}return hg(v,_,k,"@ts","@endts")}async function hg(v,_,k,E,T){let j=v,B=kr(`${E}([\\s\\S]*?)${T}`,"g"),z=[],F;while((F=B.exec(v))!==null)z.push({fullMatch:F[0],content:F[1]||"",index:F.index});for(let{fullMatch:V,content:H,index:G}of z)try{let ne={..._,global:_},J=Object.keys(ne),re=Object.values(ne),se=H.trim();if(E==="@ts")se=se.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 oe=(se.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((Se)=>Se.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),de=oe.length>0?`return { ${oe.join(", ")} };`:"return {};",ae=`
|
|
1935
1934
|
${se}
|
|
1936
1935
|
${de}
|
|
1937
|
-
`,ve=Function(...J,ae)(...re);if(ve&&typeof ve==="object")Object.assign(_,ve);j=j.replace(V,"")}catch(ne){console.error(`Error executing ${E} code block in ${k}:`,ne);let J=ne instanceof Error?ne.message:String(ne),re=g(`${E} Directive`,`Error executing code: ${J}`,k,v,G,V);console.error(re),j=j.replace(V,"")}return j}var Nv=1000,jv=!1;function Lv(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,E="",T=0,j;while((j=k.exec(v))!==null){let B=j.index+j[0].length,z=j.index+j[0].indexOf("("),F=S(v,"(",")",z);if(F===-1)continue;let V=v.slice(B,F).trim();if(!V)continue;if(!Object.keys(_).some((ne)=>new RegExp(`(?:^|[^\\w$.])${ne.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(V)))continue;let G;try{let ne=D(V,_);if(!ne||typeof ne!=="object")continue;G=JSON.stringify(ne)}catch{continue}E+=v.slice(T,B)+G,T=F,k.lastIndex=F}return T===0?v:E+v.slice(T)}function Bv(v,_){let k=/@component\s*\(/g,E=v,T,j=[];while((T=k.exec(E))!==null){let B=T.index,z=B+T[0].length-1,F=1,V=z+1;while(V<E.length&&F>0){if(E[V]==="(")F++;else if(E[V]===")"){if(F--,F===0)break}V++}if(F!==0)continue;let H=E.substring(z+1,V),G=V+1,ne=H.match(/^\s*['"]([^'"]+)['"]/);if(!ne)continue;let J=ne[1],re=H.slice(ne[0].length),se=re.match(/^\s*,\s*/);if(!se)continue;let ie=re.slice(se[0].length).trim();if(!ie)continue;try{let oe=D(ie,_),de=JSON.stringify(oe),ae=`@component('${J}', ${de})`;j.push({start:B,end:G,replacement:ae})}catch{continue}}for(let B=j.length-1;B>=0;B--){let{start:z,end:F,replacement:V}=j[B];E=E.substring(0,z)+V+E.substring(F)}return E}function No(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),j;while((j=T.exec(E))!==null){let B=j.index,z=B+j[0].length-1,F=1,V=z+1,H=null,G=!1;while(V<E.length&&F>0){let re=E[V];if(G){G=!1,V++;continue}if(re==="\\"&&H){G=!0,V++;continue}if(H){if(re===H)H=null;V++;continue}if(re==='"'||re==="'"||re==="`"){H=re,V++;continue}if(re==="(")F++;else if(re===")"){if(F--,F===0)break}V++}if(F!==0)break;let ne=E.substring(z+1,V),J=k(ne);E=E.substring(0,B)+J+E.substring(V+1)}return E}function zv(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(E,T)=>{if(T in _)return`:${T}="${T}"`;return E}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(E,T,j)=>{try{let B=Object.keys(_),z=Object.values(_);Ps(j);let V=l(j,B)(...z),H=JSON.stringify(V);if(H===void 0){if(!xe(j).some((J)=>!(J in _)))return"";return E}let G=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${G}"`}catch(B){return E}}),k}var Lo="<!--__STX_BREAK__-->",ea="<!--__STX_CONTINUE__-->";function Fv(v,_){let k=v;return k=No(k,"@break",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=l(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(c(j,_));return B?Lo:""}catch{return""}}),k=No(k,"@continue",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=l(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(c(j,_));return B?ea:""}catch{return""}}),k}function Wv(v){let _=v;return _=_.replace(/@break(?!\()/g,Lo),_=_.replace(/@continue(?!\()/g,ea),_}function pg(v){let _=v.includes(Lo),k=_?v.substring(0,v.indexOf(Lo)):v;return{hasBreak:_,content:k}}function gg(v){let _=v.includes(ea),k=_?v.substring(0,v.indexOf(ea)):v;return{hasContinue:_,content:k}}function hg(v){let _=v;return _=No(_,"@break",(k)=>{let E=k.trim();if(!or(E))return"";return`\`; if (${E}) { break; } result += \``}),_=No(_,"@continue",(k)=>{let E=k.trim();if(!or(E))return"";return`\`; if (${E}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function Vv(v){let _=/@forelse\s*\(/g,k,E=[],T=/@foreach\s*\(/g,j=/@endforeach/g,B;while((B=T.exec(v))!==null)E.push({pos:B.index,delta:1});while((B=j.exec(v))!==null)E.push({pos:B.index,delta:-1});E.sort((H,G)=>H.pos-G.pos);let z=[],F=0;for(let H of E)F+=H.delta,z.push({pos:H.pos,depth:F});function V(H){let G=0,ne=z.length-1,J=0;while(G<=ne){let re=G+ne>>1;if(z[re].pos<=H)J=z[re].depth,G=re+1;else ne=re-1}return J}while((k=_.exec(v))!==null){if(V(k.index)>0)continue;let H=k.index,G=k.index+k[0].length-1,ne=1,J=G+1,re=-1;while(J<v.length&&ne>0){if(v[J]==="(")ne++;else if(v[J]===")"){if(ne--,ne===0){re=J;break}}J++}if(re===-1)continue;let se=v.substring(G+1,re),ie=vt(se);if(!ie)continue;let{arrayExpr:oe,itemVar:de}=ie,ae=re+1,me=1,ve=ae,Se=/@forelse\s*\(/g,$e=/@endforelse/g,Re=-1;while(me>0&&ve<v.length){Se.lastIndex=ve,$e.lastIndex=ve;let Xe=Se.exec(v),Pe=$e.exec(v);if(!Pe)break;if(Xe&&Xe.index<Pe.index)me++,ve=Xe.index+Xe[0].length;else{if(me--,me===0){Re=Pe.index;break}ve=Pe.index+11}}if(Re===-1)continue;let Ee=v.substring(ae,Re),Te=Re+11,Ce=-1,_e=0,Ie=0;while(Ie<Ee.length){let Xe=Ee.indexOf("@",Ie);if(Xe===-1)break;let Pe=Ee.substring(Xe);if(/^@forelse\s*\(/.test(Pe))_e++,Ie=Xe+1;else if(Pe.startsWith("@endforelse"))_e--,Ie=Xe+11;else if(_e===0&&Pe.startsWith("@empty")){if(Ee.length<=Xe+6||!/[a-z]/i.test(Ee[Xe+6])){Ce=Xe;break}Ie=Xe+1}else Ie=Xe+1}if(Ce===-1)continue;return{start:H,end:Te,arrayExpr:oe,itemVar:de,foreachContent:Ee.substring(0,Ce),emptyContent:Ee.substring(Ce+6)}}return null}function mg(v,_){let k=v;while(!0){let E=Vv(k);if(!E)break;let{start:T,end:j,arrayExpr:B,itemVar:z,foreachContent:F,emptyContent:V}=E;try{let H;if(p(B))H=l(B,Object.keys(_))(...Object.values(_));else H=c(B,_);let G;if(!Array.isArray(H)||H.length===0)G=V;else G=`@foreach (${B} as ${z})${F}@endforeach`;k=k.substring(0,T)+G+k.substring(j)}catch(H){let G=H instanceof Error?H.message:String(H),ne=i("Forelse",`Error in @forelse(${B} as ${z}): ${G}`,t.EVALUATION_ERROR);k=k.substring(0,T)+ne+k.substring(j)}}return k}var yg="<!--stx:foreach-not-iterable:",Uv=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Hv(v,_){return`${yg}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function qv(v,_){console.warn(`[stx] @foreach(${v}) in ${_}: ${v} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function ds(v){if(!v.includes(yg))return v;return v.replace(Uv,(_,k,E)=>(qv(decodeURIComponent(k),decodeURIComponent(E)),""))}function ii(v,_,k,E,T=!1){let j=v;j=mg(j,_);function B(V){let H=/@foreach\s*\(/g,G;while((G=H.exec(V))!==null){let ne=G.index,J=G.index+G[0].length-1,re=1,se=J+1,ie=-1;while(se<V.length&&re>0){if(V[se]==="(")re++;else if(V[se]===")"){if(re--,re===0){ie=se;break}}se++}if(ie===-1)continue;let oe=V.substring(J+1,ie),de=vt(oe);if(!de)continue;let ae=ne,{arrayExpr:me,itemVar:ve}=de,Se=ie+1,$e=1,Re=Se,Ee=/@foreach\s*\(/g,Te=/@endforeach/g;while($e>0&&Re<V.length){Ee.lastIndex=Re,Te.lastIndex=Re;let Ce=Ee.exec(V),_e=Te.exec(V);if(!_e)break;if(Ce&&Ce.index<_e.index)$e++,Re=Ce.index+Ce[0].length;else{if($e--,$e===0){let Ie=V.substring(Se,_e.index),Xe=_e.index+11;return{start:ae,end:Xe,arrayExpr:me,itemVar:ve,content:Ie}}Re=_e.index+11}}}return null}function z(V,H){let G=V;while(!0){let ne=B(G);if(!ne)break;let{start:J,end:re,arrayExpr:se,itemVar:ie,content:oe}=ne;try{let de=se.trim(),ae;if(p(de))ae=l(de,Object.keys(H))(...Object.values(H));else ae=c(de,H);let me=!1;if(!Array.isArray(ae))if(ae instanceof Map)ae=Array.from(ae),me=!0;else if(ae instanceof Set)ae=Array.from(ae);else if(typeof ae==="string")ae=Array.from(ae);else if(ae&&typeof ae==="object"&&!(ae instanceof Date)&&!(ae instanceof RegExp))ae=Object.entries(ae),me=!0;else{let _e=Hv(de,k)+i("Foreach",`Error in @foreach: ${de} is not iterable`,t.TYPE_ERROR);G=G.substring(0,J)+_e+G.substring(re);continue}let ve=E?.loops?.useAltLoopVariable??jv,Se=ie.trim(),$e=null,Re,Ee=!1;if(Se.includes("=>")){let _e=Se.split("=>").map((Ie)=>Ie.trim());if(_e.length===2&&_e[0]&&_e[1])$e=_e[0],Re=_e[1];else Re=Se}else if(!Se.startsWith("[")&&!Se.startsWith("{")&&Se.includes(",")){let _e=Se.split(",").map((Ie)=>Ie.trim());if(_e.length===2&&_e[0]&&_e[1])Re=_e[0],$e=_e[1],Ee=!0;else Re=Se}else Re=Se;let Te="",Ce=ae;for(let _e=0;_e<Ce.length;_e++){let Ie=Ce[_e],Xe={index:_e,iteration:_e+1,first:_e===0,last:_e===Ce.length-1,count:Ce.length},Pe={...H,loop:Xe,$loop:Xe};if(Re.startsWith("[")&&Re.endsWith("]")){let it=Re.slice(1,-1).split(",").map((rt)=>rt.trim());if(Array.isArray(Ie))it.forEach((rt,gt)=>{if(rt)Pe[rt]=Ie[gt]});else Pe[Re]=Ie}else if(Re.startsWith("{")&&Re.endsWith("}")){let it=Re.slice(1,-1).split(",").map((rt)=>rt.trim()).filter(Boolean);if(Ie!==null&&typeof Ie==="object")it.forEach((rt)=>{let gt=rt.indexOf(":"),ut=(gt===-1?rt:rt.slice(0,gt)).trim(),dt=gt===-1?ut:rt.slice(gt+1).trim();if(ut&&dt)Pe[dt]=Ie[ut]});else Pe[Re]=Ie}else Pe[Re]=Ie;if($e)if(!Ee&&me&&Array.isArray(Ie)&&Ie.length===2)Pe[$e]=Ie[0],Pe[Re]=Ie[1];else Pe[$e]=_e;let Ae=Fv(oe,Pe),Ze=gg(Ae);if(Ze.hasContinue){Te+=Ze.content;continue}let ct=pg(Ae);if(ct.hasBreak){Te+=ct.content;break}if(Ae=mg(Ae,Pe),Ae=z(Ae,Pe),Ae=ir(Ae,Pe,k),Ae=Wv(Ae),ct=pg(Ae),ct.hasBreak){Te+=ct.content;break}if(Ze=gg(Ae),Ze.hasContinue){Te+=Ze.content;continue}Ae=q(Ae,Pe,k),Ae=zv(Ae,Pe),Ae=Bv(Ae,Pe),Ae=Lv(Ae,Pe),Te+=Ae}G=G.substring(0,J)+Te+G.substring(re)}catch(de){let ae=i("Foreach",`Error in @foreach(${se.trim()} as ${ie.trim()}): ${de instanceof Error?de.message:String(de)}`,t.EVALUATION_ERROR);G=G.substring(0,J)+ae+G.substring(re)}}return G}j=z(j,_),j=bg(j,_,k,E);let F=E?.loops?.maxWhileIterations??Nv;return j=Zv(j,_,F),T?j:ds(j)}function hc(v){let _=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(v);if(!_||/^(?:const|let|var)$/.test(_[2]))return v;return`${_[1]}let ${v.slice(_[1].length)}`}function xg(v){return or(v)}function bg(v,_,k,E){let T=v,j=!0;while(j){j=!1;let B=T.match(/@for\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=z+B[0].length-1,V=S(T,"(",")",F);if(V===-1)break;let H=hc(T.slice(F+1,V)),G=V+1,ne=go(T.slice(z),"for","endfor");if(ne.length===0)break;let J=ne[0].content,re=z+ne[0].end;if(!xg(H)){let se=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,z)+se+T.substring(re),j=!0;continue}try{let se=Kv(H),ie=/@(?:for|foreach|if|unless)\s*\(/.test(J);if(se.length>0&&ie){let Se=Xv({forExpr:H,content:J,iterVarNames:se,context:_,filePath:k,options:E});T=T.substring(0,z)+Se+T.substring(re),j=!0;continue}let oe=Object.keys(_),de=Object.values(_),ae=J.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(Se,$e)=>`\${${$e}}`);ae=hg(ae);let ve=Function(...oe,`
|
|
1936
|
+
`,ve=Function(...J,ae)(...re);if(ve&&typeof ve==="object")Object.assign(_,ve);j=j.replace(V,"")}catch(ne){console.error(`Error executing ${E} code block in ${k}:`,ne);let J=ne instanceof Error?ne.message:String(ne),re=g(`${E} Directive`,`Error executing code: ${J}`,k,v,G,V);console.error(re),j=j.replace(V,"")}return j}var Bv=1000,zv=!1;function Fv(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,E="",T=0,j;while((j=k.exec(v))!==null){let B=j.index+j[0].length,z=j.index+j[0].indexOf("("),F=S(v,"(",")",z);if(F===-1)continue;let V=v.slice(B,F).trim();if(!V)continue;if(!Object.keys(_).some((ne)=>new RegExp(`(?:^|[^\\w$.])${ne.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(V)))continue;let G;try{let ne=D(V,_);if(!ne||typeof ne!=="object")continue;G=JSON.stringify(ne)}catch{continue}E+=v.slice(T,B)+G,T=F,k.lastIndex=F}return T===0?v:E+v.slice(T)}function Wv(v,_){let k=/@component\s*\(/g,E=v,T,j=[];while((T=k.exec(E))!==null){let B=T.index,z=B+T[0].length-1,F=1,V=z+1;while(V<E.length&&F>0){if(E[V]==="(")F++;else if(E[V]===")"){if(F--,F===0)break}V++}if(F!==0)continue;let H=E.substring(z+1,V),G=V+1,ne=H.match(/^\s*['"]([^'"]+)['"]/);if(!ne)continue;let J=ne[1],re=H.slice(ne[0].length),se=re.match(/^\s*,\s*/);if(!se)continue;let ie=re.slice(se[0].length).trim();if(!ie)continue;try{let oe=D(ie,_),de=JSON.stringify(oe),ae=`@component('${J}', ${de})`;j.push({start:B,end:G,replacement:ae})}catch{continue}}for(let B=j.length-1;B>=0;B--){let{start:z,end:F,replacement:V}=j[B];E=E.substring(0,z)+V+E.substring(F)}return E}function ea(v,_,k){let E=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),j;while((j=T.exec(E))!==null){let B=j.index,z=B+j[0].length-1,F=1,V=z+1,H=null,G=!1;while(V<E.length&&F>0){let re=E[V];if(G){G=!1,V++;continue}if(re==="\\"&&H){G=!0,V++;continue}if(H){if(re===H)H=null;V++;continue}if(re==='"'||re==="'"||re==="`"){H=re,V++;continue}if(re==="(")F++;else if(re===")"){if(F--,F===0)break}V++}if(F!==0)break;let ne=E.substring(z+1,V),J=k(ne);E=E.substring(0,B)+J+E.substring(V+1)}return E}function Vv(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(E,T)=>{if(T in _)return`:${T}="${T}"`;return E}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(E,T,j)=>{try{let B=Object.keys(_),z=Object.values(_);Ps(j);let V=l(j,B)(...z),H=JSON.stringify(V);if(H===void 0){if(!xe(j).some((J)=>!(J in _)))return"";return E}let G=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${G}"`}catch(B){return E}}),k}var ta="<!--__STX_BREAK__-->",na="<!--__STX_CONTINUE__-->";function Uv(v,_){let k=v;return k=ea(k,"@break",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=l(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(c(j,_));return B?ta:""}catch{return""}}),k=ea(k,"@continue",(E)=>{try{let j=`!!(${E.trim()})`,B;if(p(j)){let z=l(j,Object.keys(_));B=Boolean(z(...Object.values(_)))}else B=Boolean(c(j,_));return B?na:""}catch{return""}}),k}function Hv(v){let _=v;return _=_.replace(/@break(?!\()/g,ta),_=_.replace(/@continue(?!\()/g,na),_}function yg(v){let _=v.includes(ta),k=_?v.substring(0,v.indexOf(ta)):v;return{hasBreak:_,content:k}}function xg(v){let _=v.includes(na),k=_?v.substring(0,v.indexOf(na)):v;return{hasContinue:_,content:k}}function vg(v){let _=v;return _=ea(_,"@break",(k)=>{let E=k.trim();if(!or(E))return"";return`\`; if (${E}) { break; } result += \``}),_=ea(_,"@continue",(k)=>{let E=k.trim();if(!or(E))return"";return`\`; if (${E}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function qv(v){let _=/@forelse\s*\(/g,k,E=[],T=/@foreach\s*\(/g,j=/@endforeach/g,B;while((B=T.exec(v))!==null)E.push({pos:B.index,delta:1});while((B=j.exec(v))!==null)E.push({pos:B.index,delta:-1});E.sort((H,G)=>H.pos-G.pos);let z=[],F=0;for(let H of E)F+=H.delta,z.push({pos:H.pos,depth:F});function V(H){let G=0,ne=z.length-1,J=0;while(G<=ne){let re=G+ne>>1;if(z[re].pos<=H)J=z[re].depth,G=re+1;else ne=re-1}return J}while((k=_.exec(v))!==null){if(V(k.index)>0)continue;let H=k.index,G=k.index+k[0].length-1,ne=1,J=G+1,re=-1;while(J<v.length&&ne>0){if(v[J]==="(")ne++;else if(v[J]===")"){if(ne--,ne===0){re=J;break}}J++}if(re===-1)continue;let se=v.substring(G+1,re),ie=vt(se);if(!ie)continue;let{arrayExpr:oe,itemVar:de}=ie,ae=re+1,me=1,ve=ae,Se=/@forelse\s*\(/g,$e=/@endforelse/g,Re=-1;while(me>0&&ve<v.length){Se.lastIndex=ve,$e.lastIndex=ve;let Xe=Se.exec(v),Pe=$e.exec(v);if(!Pe)break;if(Xe&&Xe.index<Pe.index)me++,ve=Xe.index+Xe[0].length;else{if(me--,me===0){Re=Pe.index;break}ve=Pe.index+11}}if(Re===-1)continue;let Ee=v.substring(ae,Re),Te=Re+11,Ce=-1,_e=0,Ie=0;while(Ie<Ee.length){let Xe=Ee.indexOf("@",Ie);if(Xe===-1)break;let Pe=Ee.substring(Xe);if(/^@forelse\s*\(/.test(Pe))_e++,Ie=Xe+1;else if(Pe.startsWith("@endforelse"))_e--,Ie=Xe+11;else if(_e===0&&Pe.startsWith("@empty")){if(Ee.length<=Xe+6||!/[a-z]/i.test(Ee[Xe+6])){Ce=Xe;break}Ie=Xe+1}else Ie=Xe+1}if(Ce===-1)continue;return{start:H,end:Te,arrayExpr:oe,itemVar:de,foreachContent:Ee.substring(0,Ce),emptyContent:Ee.substring(Ce+6)}}return null}function bg(v,_){let k=v;while(!0){let E=qv(k);if(!E)break;let{start:T,end:j,arrayExpr:B,itemVar:z,foreachContent:F,emptyContent:V}=E;try{let H;if(p(B))H=l(B,Object.keys(_))(...Object.values(_));else H=c(B,_);let G;if(!Array.isArray(H)||H.length===0)G=V;else G=`@foreach (${B} as ${z})${F}@endforeach`;k=k.substring(0,T)+G+k.substring(j)}catch(H){let G=H instanceof Error?H.message:String(H),ne=i("Forelse",`Error in @forelse(${B} as ${z}): ${G}`,t.EVALUATION_ERROR);k=k.substring(0,T)+ne+k.substring(j)}}return k}var wg="<!--stx:foreach-not-iterable:",Kv=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Xv(v,_){return`${wg}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Zv(v,_){console.warn(`[stx] @foreach(${v}) in ${_}: ${v} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function ds(v){if(!v.includes(wg))return v;return v.replace(Kv,(_,k,E)=>(Zv(decodeURIComponent(k),decodeURIComponent(E)),""))}function ii(v,_,k,E,T=!1){let j=v;j=bg(j,_);function B(V){let H=/@foreach\s*\(/g,G;while((G=H.exec(V))!==null){let ne=G.index,J=G.index+G[0].length-1,re=1,se=J+1,ie=-1;while(se<V.length&&re>0){if(V[se]==="(")re++;else if(V[se]===")"){if(re--,re===0){ie=se;break}}se++}if(ie===-1)continue;let oe=V.substring(J+1,ie),de=vt(oe);if(!de)continue;let ae=ne,{arrayExpr:me,itemVar:ve}=de,Se=ie+1,$e=1,Re=Se,Ee=/@foreach\s*\(/g,Te=/@endforeach/g;while($e>0&&Re<V.length){Ee.lastIndex=Re,Te.lastIndex=Re;let Ce=Ee.exec(V),_e=Te.exec(V);if(!_e)break;if(Ce&&Ce.index<_e.index)$e++,Re=Ce.index+Ce[0].length;else{if($e--,$e===0){let Ie=V.substring(Se,_e.index),Xe=_e.index+11;return{start:ae,end:Xe,arrayExpr:me,itemVar:ve,content:Ie}}Re=_e.index+11}}}return null}function z(V,H){let G=V;while(!0){let ne=B(G);if(!ne)break;let{start:J,end:re,arrayExpr:se,itemVar:ie,content:oe}=ne;try{let de=se.trim(),ae;if(p(de))ae=l(de,Object.keys(H))(...Object.values(H));else ae=c(de,H);let me=!1;if(!Array.isArray(ae))if(ae instanceof Map)ae=Array.from(ae),me=!0;else if(ae instanceof Set)ae=Array.from(ae);else if(typeof ae==="string")ae=Array.from(ae);else if(ae&&typeof ae==="object"&&!(ae instanceof Date)&&!(ae instanceof RegExp))ae=Object.entries(ae),me=!0;else{let _e=Xv(de,k)+i("Foreach",`Error in @foreach: ${de} is not iterable`,t.TYPE_ERROR);G=G.substring(0,J)+_e+G.substring(re);continue}let ve=E?.loops?.useAltLoopVariable??zv,Se=ie.trim(),$e=null,Re,Ee=!1;if(Se.includes("=>")){let _e=Se.split("=>").map((Ie)=>Ie.trim());if(_e.length===2&&_e[0]&&_e[1])$e=_e[0],Re=_e[1];else Re=Se}else if(!Se.startsWith("[")&&!Se.startsWith("{")&&Se.includes(",")){let _e=Se.split(",").map((Ie)=>Ie.trim());if(_e.length===2&&_e[0]&&_e[1])Re=_e[0],$e=_e[1],Ee=!0;else Re=Se}else Re=Se;let Te="",Ce=ae;for(let _e=0;_e<Ce.length;_e++){let Ie=Ce[_e],Xe={index:_e,iteration:_e+1,first:_e===0,last:_e===Ce.length-1,count:Ce.length},Pe={...H,loop:Xe,$loop:Xe};if(Re.startsWith("[")&&Re.endsWith("]")){let it=Re.slice(1,-1).split(",").map((rt)=>rt.trim());if(Array.isArray(Ie))it.forEach((rt,gt)=>{if(rt)Pe[rt]=Ie[gt]});else Pe[Re]=Ie}else if(Re.startsWith("{")&&Re.endsWith("}")){let it=Re.slice(1,-1).split(",").map((rt)=>rt.trim()).filter(Boolean);if(Ie!==null&&typeof Ie==="object")it.forEach((rt)=>{let gt=rt.indexOf(":"),ut=(gt===-1?rt:rt.slice(0,gt)).trim(),dt=gt===-1?ut:rt.slice(gt+1).trim();if(ut&&dt)Pe[dt]=Ie[ut]});else Pe[Re]=Ie}else Pe[Re]=Ie;if($e)if(!Ee&&me&&Array.isArray(Ie)&&Ie.length===2)Pe[$e]=Ie[0],Pe[Re]=Ie[1];else Pe[$e]=_e;let Ae=Uv(oe,Pe),Ze=xg(Ae);if(Ze.hasContinue){Te+=Ze.content;continue}let ct=yg(Ae);if(ct.hasBreak){Te+=ct.content;break}if(Ae=bg(Ae,Pe),Ae=z(Ae,Pe),Ae=ir(Ae,Pe,k),Ae=Hv(Ae),ct=yg(Ae),ct.hasBreak){Te+=ct.content;break}if(Ze=xg(Ae),Ze.hasContinue){Te+=Ze.content;continue}Ae=q(Ae,Pe,k),Ae=Vv(Ae,Pe),Ae=Wv(Ae,Pe),Ae=Fv(Ae,Pe),Te+=Ae}G=G.substring(0,J)+Te+G.substring(re)}catch(de){let ae=i("Foreach",`Error in @foreach(${se.trim()} as ${ie.trim()}): ${de instanceof Error?de.message:String(de)}`,t.EVALUATION_ERROR);G=G.substring(0,J)+ae+G.substring(re)}}return G}j=z(j,_),j=$g(j,_,k,E);let F=E?.loops?.maxWhileIterations??Bv;return j=Yv(j,_,F),T?j:ds(j)}function hc(v){let _=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(v);if(!_||/^(?:const|let|var)$/.test(_[2]))return v;return`${_[1]}let ${v.slice(_[1].length)}`}function Sg(v){return or(v)}function $g(v,_,k,E){let T=v,j=!0;while(j){j=!1;let B=T.match(/@for\s*\(/);if(!B||B.index===void 0)break;let z=B.index,F=z+B[0].length-1,V=S(T,"(",")",F);if(V===-1)break;let H=hc(T.slice(F+1,V)),G=V+1,ne=ho(T.slice(z),"for","endfor");if(ne.length===0)break;let J=ne[0].content,re=z+ne[0].end;if(!Sg(H)){let se=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,z)+se+T.substring(re),j=!0;continue}try{let se=Gv(H),ie=/@(?:for|foreach|if|unless)\s*\(/.test(J);if(se.length>0&&ie){let Se=Jv({forExpr:H,content:J,iterVarNames:se,context:_,filePath:k,options:E});T=T.substring(0,z)+Se+T.substring(re),j=!0;continue}let oe=Object.keys(_),de=Object.values(_),ae=J.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(Se,$e)=>`\${${$e}}`);ae=vg(ae);let ve=Function(...oe,`
|
|
1938
1937
|
let result = '';
|
|
1939
1938
|
for (${H}) {
|
|
1940
1939
|
result += \`${ae}\`;
|
|
1941
1940
|
}
|
|
1942
1941
|
return result;
|
|
1943
|
-
`)(...de);T=T.substring(0,z)+ve+T.substring(re),j=!0}catch(se){let ie=i("For",`Error in @for(${H}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR);T=T.substring(0,z)+ie+T.substring(re),j=!0}}return T}function
|
|
1942
|
+
`)(...de);T=T.substring(0,z)+ve+T.substring(re),j=!0}catch(se){let ie=i("For",`Error in @for(${H}): ${se instanceof Error?se.message:String(se)}`,t.EVALUATION_ERROR);T=T.substring(0,z)+ie+T.substring(re),j=!0}}return T}function Gv(v){let _=v.trim(),k=_.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(k){let j=k[1];return j.slice(1,-1).split(",").map((z)=>{let F=z.trim();if(!F)return"";let V=F.indexOf(":");if(V>=0&&j.startsWith("{")){let ne=F.slice(V+1).trim(),J=ne.indexOf("=");return(J>=0?ne.slice(0,J):ne).trim()}let H=F.indexOf("="),G=(H>=0?F.slice(0,H):F).trim();return/^[A-Za-z_$][\w$]*$/.test(G)?G:""}).filter(Boolean)}let E=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(E)return[E[1]];let T=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(T)return[T[1]];return[]}function Jv(v){let{forExpr:_,content:k,iterVarNames:E,context:T,filePath:j,options:B}=v,z=Object.keys(T),F=Object.values(T),V=Function(...z,"__pushIter",`
|
|
1944
1943
|
for (${_}) {
|
|
1945
1944
|
__pushIter([${E.join(", ")}])
|
|
1946
1945
|
}
|
|
1947
|
-
`),H=[];V(...F,(J)=>{H.push(J)});let G=j??"inline.stx",ne="";for(let J of H){let re={...T};E.forEach((ie,oe)=>{re[ie]=J[oe]});let se
|
|
1946
|
+
`),H=[];V(...F,(J)=>{H.push(J)});let G=j??"inline.stx",ne="";for(let J of H){let re={...T};E.forEach((ie,oe)=>{re[ie]=J[oe]});let se=$g(k,re,j,B);se=ir(se,re,G),se=q(se,re,G),ne+=se}return ne}function Yv(v,_,k){let E=v,T=!0;while(T){T=!1;let j=E.match(/@while\s*\(/);if(!j||j.index===void 0)break;let B=j.index,z=B+j[0].length-1,F=S(E,"(",")",z);if(F===-1)break;let V=E.slice(z+1,F),H=ho(E.slice(B),"while","endwhile");if(H.length===0)break;let G=H[0].content,ne=B+H[0].end;if(!Sg(V)){let J=i("While",`Unsafe expression in @while: ${V}`,t.UNSAFE_EXPRESSION);E=E.substring(0,B)+J+E.substring(ne),T=!0;continue}try{let J=Object.keys(_),re=Object.values(_),se=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(de,ae)=>`\${${ae}}`);se=vg(se);let oe=Function(...J,`
|
|
1948
1947
|
let result = '';
|
|
1949
1948
|
let maxIterations = ${k}; // Configurable safety limit
|
|
1950
1949
|
let counter = 0;
|
|
@@ -1956,25 +1955,25 @@ ${T}
|
|
|
1956
1955
|
result += '<!-- [While Error [1104]]: Maximum iterations (${k}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
1957
1956
|
}
|
|
1958
1957
|
return result;
|
|
1959
|
-
`)(...re);E=E.substring(0,B)+oe+E.substring(ne),T=!0}catch(J){let re=i("While",`Error in @while(${V}): ${J instanceof Error?J.message:String(J)}`,t.EVALUATION_ERROR);E=E.substring(0,B)+re+E.substring(ne),T=!0}}return E}function
|
|
1958
|
+
`)(...re);E=E.substring(0,B)+oe+E.substring(ne),T=!0}catch(J){let re=i("While",`Error in @while(${V}): ${J instanceof Error?J.message:String(J)}`,t.EVALUATION_ERROR);E=E.substring(0,B)+re+E.substring(ne),T=!0}}return E}function Qv(v,_="_method"){let k=v.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${_}" value="${k}">`}function _g(v){return v.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(_,k,E,T,j)=>Qv(E,j||"_method"))}async function kg(v,_,k,E,T){if(!E.middleware||E.middleware.length===0)return v;let j=v,B=E.middleware.filter((z)=>z.timing===T);if(B.length===0)return j;for(let z of B){if(!z.name||typeof z.handler!=="function"){if(E.debug)console.warn("Invalid middleware:",z);continue}try{let F=await z.handler(j,_,k,E);if(typeof F==="string")j=F;else if(E.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(F){if(E.debug)console.error(`Error in middleware ${z.name}:`,F);if(E.debug){let V=g("Middleware",`Error in middleware '${z.name}': ${F instanceof Error?F.message:String(F)}`,k,v);j=j.replace(/<body[^>]*>/,`$&
|
|
1960
1959
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${b(V)}</div>
|
|
1961
|
-
`)}}}return j}async function
|
|
1960
|
+
`)}}}return j}async function Eg(v,_,k,E){return kg(v,_,k,E,"before")}async function Cg(v,_,k,E){return kg(v,_,k,E,"after")}function Rg(v){return v.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(_,k,E,T,j)=>{try{let B=T?D(T,{}):{};return bn(E,B,j==="true")}catch(B){return console.error(`Error processing @route directive: ${B}`),"#route-error"}})}var zi={patterns:[],exact:{}};async function Tg(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(zi.exact[v])for(let E of zi.exact[v])await Promise.resolve(E(_,v));if(zi.exact[k])for(let E of zi.exact[k])await Promise.resolve(E(_,v));for(let{pattern:E,callback:T}of zi.patterns)if(E.test(v)||E.test(k))await Promise.resolve(T(_,v))}var ew=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),tw=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function jr(v,_){let k=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;k.lastIndex=_;let E=k.exec(v);if(!E)return null;let T=/\/\s*>$/.test(E[0])||E[1]===E[1].toLowerCase()&&ew.has(E[1]),j=T?E[2].replace(/\/\s*$/,""):E[2];return{full:E[0],tag:E[1],attrs:j,selfClosing:T,start:E.index,end:E.index+E[0].length}}function nw(v,_,k){let E=1,T=k,j=new RegExp(`<${_}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),B=new RegExp(`</${_}\\s*>`,"gi");while(E>0&&T<v.length){j.lastIndex=T,B.lastIndex=T;let z=j.exec(v),F=B.exec(v);if(!F)return-1;if(z&&z.index<F.index)E++,T=z.index+z[0].length;else{if(E--,E===0)return F.index+F[0].length;T=F.index+F[0].length}}return-1}function Nr(v,_){if(_.selfClosing)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};let k=nw(v,_.tag,_.end);if(k===-1)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};return{outerStart:_.start,outerEnd:k,innerHTML:v.slice(_.end,k-`</${_.tag}>`.length)}}function Ag(v,_){return new RegExp(`(?:^|\\s)${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(v)||v.includes(` ${_}=`)||v.includes(` ${_} `)||v.trimEnd().endsWith(` ${_}`)}function Fi(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=v.match(new RegExp(`${k}="([^"]*)"`,"s"))||v.match(new RegExp(`${k}='([^']*)'`,"s"));return E?E[1]:null}function br(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return v.replace(new RegExp(`\\s*${k}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${k}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${k}(?=\\s|$|>|/)`,"g"),"")}function Us(v,_,k){let E=_.selfClosing?" /":"",T=`<${_.tag}${k}${E}>`;return v.slice(0,_.start)+T+v.slice(_.end)}function rw(v){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(v)}function sw(v){let _=v,k=0;while(k<_.length){let E=jr(_,k);if(!E)break;let T=Fi(E.attrs,"v-for");if(T===null){k=E.end;continue}let j=T.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!j){k=E.end;continue}let B=j[1].trim(),z=j[2].trim(),F;if(B.includes(",")){let ie=B.split(",").map((ae)=>ae.trim()),oe=ie[0],de=ie[1];F=`${z} as ${de} => ${oe}`}else F=`${z} as ${B}`;let V=br(E.attrs,"v-for"),H=br(V,":key").replace(/\s*v-bind:key="[^"]*"/g,""),G=Nr(_,E),ne=_.slice(G.outerStart,G.outerEnd),J=Us(ne,{...E,start:0,end:E.end-E.start},H),re=`@foreach(${F})
|
|
1962
1961
|
`,se=`${re}${J}
|
|
1963
|
-
@endforeach`;_=_.slice(0,G.outerStart)+se+_.slice(G.outerEnd),k=G.outerStart+re.length}return _}function
|
|
1962
|
+
@endforeach`;_=_.slice(0,G.outerStart)+se+_.slice(G.outerEnd),k=G.outerStart+re.length}return _}function iw(v){let _=v,k=0;while(k<_.length){let E=jr(_,k);if(!E)break;let T=Fi(E.attrs,"v-if");if(T===null){k=E.end;continue}let j=[],B=Nr(_,E),z=br(E.attrs,"v-if"),F=Us(_.slice(B.outerStart,B.outerEnd),{...E,start:0,end:E.end-E.start},z);j.push({type:"if",expr:T,outerStart:B.outerStart,outerEnd:B.outerEnd,element:F,parsedTag:E});let V=B.outerEnd,H=!0;while(H){let se=_.slice(V).match(/^\s*/),ie=se?se[0].length:0,oe=jr(_,V+ie);if(!oe){H=!1;break}let de=Fi(oe.attrs,"v-else-if"),ae=Ag(oe.attrs,"v-else");if(de!==null){let me=Nr(_,oe),ve=br(oe.attrs,"v-else-if"),Se=Us(_.slice(me.outerStart,me.outerEnd),{...oe,start:0,end:oe.end-oe.start},ve);j.push({type:"else-if",expr:de,outerStart:V,outerEnd:me.outerEnd,element:Se,parsedTag:oe}),V=me.outerEnd}else if(ae){let me=Nr(_,oe),ve=br(oe.attrs,"v-else"),Se=Us(_.slice(me.outerStart,me.outerEnd),{...oe,start:0,end:oe.end-oe.start},ve);j.push({type:"else",outerStart:V,outerEnd:me.outerEnd,element:Se,parsedTag:oe}),H=!1}else H=!1}let G=[];for(let se of j)if(se.type==="if")G.push(`@if(${se.expr})
|
|
1964
1963
|
${se.element}`);else if(se.type==="else-if")G.push(`@elseif(${se.expr})
|
|
1965
1964
|
${se.element}`);else G.push(`@else
|
|
1966
1965
|
${se.element}`);G.push("@endif");let ne=G.join(`
|
|
1967
|
-
`),J=j[0].outerStart,re=j[j.length-1].outerEnd;_=_.slice(0,J)+ne+_.slice(re),k=J+ne.length}return _}function
|
|
1968
|
-
${
|
|
1969
|
-
@endonce`;_=_.slice(0,j.outerStart)+F+_.slice(j.outerEnd),k=j.outerStart+F.length}return _}function
|
|
1970
|
-
${E}${v.slice(k)}`}var
|
|
1971
|
-
${j[0]}${v.slice(k,j.index)}${v.slice(B,T)}${v.slice(T)}`}function
|
|
1972
|
-
${_[0]}${E.slice(T)}`}var ci="X-STX-Build",
|
|
1973
|
-
<meta name="stx-build" content="${_}">`}function
|
|
1974
|
-
`}function
|
|
1975
|
-
`),me=B.map((Ce)=>` <link ${
|
|
1976
|
-
`),ve=z.map((Ce)=>{if(Ce.src)return` <script ${
|
|
1977
|
-
`),Se=
|
|
1966
|
+
`),J=j[0].outerStart,re=j[j.length-1].outerEnd;_=_.slice(0,J)+ne+_.slice(re),k=J+ne.length}return _}function ow(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function aw(v){let _=v,k=0;while(k<_.length){let E=jr(_,k);if(!E)break;let T=tw.has(E.tag),j=E.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,F,V)=>{let H=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(F);if(!H||!V||!/^["']/.test(V))return z;let G=H[1]||"modelValue",ne=H[2];if(T&&!H[1])return`@model${ne}=${V}`;let J=V[0],re=V.slice(1,-1),se=`:${G}=${V} @update:${G}=${J}${re} = $event${J}`;if(ne){let ie=H[1]?`${G}Modifiers`:"modelModifiers",oe=ne.slice(1).split(".").map((de)=>`${de}: true`).join(", ");se+=` :${ie}="{ ${oe} }"`}return se});if(j===E.attrs){k=E.end;continue}let B=Us(E.full,{...E,start:0,end:E.full.length},j);_=_.slice(0,E.start)+B+_.slice(E.end),k=E.start+B.length}return _}function cw(v){return v.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function lw(v){return v.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function uw(v){let _=v,k=0;while(k<_.length){let E=jr(_,k);if(!E)break;let T=Fi(E.attrs,"v-html");if(T===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=Nr(_,E),B=br(E.attrs,"v-html"),z=E.selfClosing?" /":"",F=`<${E.tag}${B}${z}>{!! ${T} !!}</${E.tag}>`;_=_.slice(0,j.outerStart)+F+_.slice(j.outerEnd),k=j.outerStart+F.length}return _}function dw(v){let _=v,k=0;while(k<_.length){let E=jr(_,k);if(!E)break;let T=Fi(E.attrs,"v-text");if(T===null){k=E.end;continue}if(E.selfClosing){k=E.end;continue}let j=Nr(_,E),B=br(E.attrs,"v-text"),z=E.selfClosing?" /":"",F=`<${E.tag}${B}${z}>{{ ${T} }}</${E.tag}>`;_=_.slice(0,j.outerStart)+F+_.slice(j.outerEnd),k=j.outerStart+F.length}return _}function fw(v){return v.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function pw(v){let _=v,k=0;while(k<_.length){let E=jr(_,k);if(!E)break;if(!Ag(E.attrs,"v-once")){k=E.end;continue}let T=br(E.attrs,"v-once"),j=Nr(_,E),B=_.slice(j.outerStart,j.outerEnd),F=`@once
|
|
1967
|
+
${Us(B,{...E,start:0,end:E.end-E.start},T)}
|
|
1968
|
+
@endonce`;_=_.slice(0,j.outerStart)+F+_.slice(j.outerEnd),k=j.outerStart+F.length}return _}function gw(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function mw(v){return v.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function Ig(v){if(!rw(v))return v;let _=v;return _=sw(_),_=iw(_),_=pw(_),_=cw(_),_=lw(_),_=aw(_),_=ow(_),_=mw(_),_=uw(_),_=dw(_),_=fw(_),_=gw(_),_}function ra(v){return v.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var Dl=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),hw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Pg(v,_){let k=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v),E=k?k[1]:v,T=c(E,_);if(T&&typeof T==="string")return T;let j=E.trim();return Dl.has(j)?j:null}function Dg(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function Mg(v,_,k){let E=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=E?`<${v} ${E}>`:`<${v}>`;if(hw.has(v))return E?`<${v} ${E}>`:`<${v}>`;return`${T}${k}</${v}>`}async function Og(v,_,k,E,T){let j=v,B=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],F;while((F=B.exec(j))!==null)z.push({full:F[0],expr:F[1],attrs:F[2],slotContent:F[3],index:F.index});for(let V=z.length-1;V>=0;V--){let H=z[V];try{let G=Pg(H.expr,_);if(!G||typeof G!=="string"){let de=`<!-- dynamic component: could not resolve "${ra(Dg(H.expr))}" -->`;j=j.slice(0,H.index)+de+j.slice(H.index+H.full.length);continue}if(Dl.has(G)){let de=Mg(G,H.attrs,H.slotContent);j=j.slice(0,H.index)+de+j.slice(H.index+H.full.length);continue}let ne=H.attrs.trim(),J={},re=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,se;while((se=re.exec(ne))!==null){let de=se[1]||se[2],ae=se[3];if(se[1])try{J[de]=c(ae,_)}catch{J[de]=ae}else J[de]=ae}let ie=E.componentsDir||"components",oe=await We(G,J,H.slotContent,ie,_,k,E,new Set,T??new Set);j=j.slice(0,H.index)+oe+j.slice(H.index+H.full.length)}catch(G){let ne=G instanceof Error?G.message:String(G),J=`<!-- dynamic component error: ${ra(ne)} -->`;j=j.slice(0,H.index)+J+j.slice(H.index+H.full.length)}}return j=await yw(j,_,k,E,T),j}async function yw(v,_,k,E,T){let j=v,B=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],F;while((F=B.exec(j))!==null)z.push({full:F[0],expr:F[1],attrs:F[2],index:F.index});for(let V=z.length-1;V>=0;V--){let H=z[V];try{let G=Pg(H.expr,_);if(!G||typeof G!=="string"){let re=`<!-- dynamic component: could not resolve "${ra(Dg(H.expr))}" -->`;j=j.slice(0,H.index)+re+j.slice(H.index+H.full.length);continue}if(Dl.has(G)){let re=Mg(G,H.attrs,"");j=j.slice(0,H.index)+re+j.slice(H.index+H.full.length);continue}let ne=E.componentsDir||"components",J=await We(G,{},"",ne,_,k,E,new Set,T??new Set);j=j.slice(0,H.index)+J+j.slice(H.index+H.full.length)}catch(G){let ne=G instanceof Error?G.message:String(G),J=`<!-- dynamic component error: ${ra(ne)} -->`;j=j.slice(0,H.index)+J+j.slice(H.index+H.full.length)}}return j}function Ml(){return{afterOpen:[],beforeClose:[]}}function xw(v){return v.afterOpen.length>0||v.beforeClose.length>0}function jg(v,_){if(!xw(_))return v;let k=_.afterOpen.join(""),E=_.beforeClose.join(""),T=v.lastIndexOf("</head>"),j=k?Wi(v):null,B=E&&T!==-1?T:null;if(j===null&&B===null)return v;if(j!==null&&B!==null)return`${v.slice(0,j)}${k}${v.slice(j,B)}${E}${v.slice(B)}`;if(j!==null)return`${v.slice(0,j)}${k}${v.slice(j)}`;return`${v.slice(0,B)}${E}${v.slice(B)}`}var Ng=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Wi(v){let _=/<head\b[^>]*>/i.exec(v);if(!_)return null;let k=_.index+_[0].length;Ng.lastIndex=k;let E=Ng.exec(v);return E?k+E[0].length:k}var Nl="data-stx-color-mode-boot",Lg="__STX_COLOR_MODE__",bw=new Set(["light","dark","auto","system"]),vw=new Set(["auto","system"]),ww=/^[a-z][\w:-]*$/i,Sw=/^[\w-]+$/;function $w(v){let _=v.storageKey??"stx-color-mode",k=v.initialMode??"auto",E=v.darkClass===void 0?"dark":v.darkClass,T=v.attribute??null,j=v.autoValue??null,B=v.respectExisting===!0;if(typeof _!=="string"||_.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!bw.has(k))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(k)}`);if(E!==null&&(typeof E!=="string"||!Sw.test(E)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(E)}`);if(T!==null&&(typeof T!=="string"||!ww.test(T)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(T)}`);if(j!==null&&!vw.has(j))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(j)}`);if(E===null&&T===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(B&&T===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:_,initialMode:k==="system"?"auto":k,darkClass:E,attribute:T,autoValue:j,respectExisting:B}}function _w(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function jl(v={}){let _=$w(v),k=_w(_),E=`(function(){"use strict";var o=window.${Lg};if(o&&typeof o.sync==="function"){o.sync();return}var c=${k};var r=document.documentElement;function read(){var p=c.initialMode,a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${Lg}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${Nl}>${E}</script>`}function Vn(v,_={}){if(v.includes(Nl))return v;let k=Ol(v);if(k===null)return v;let E=jl(_);return`${v.slice(0,k)}
|
|
1969
|
+
${E}${v.slice(k)}`}var Ol=Wi,kw=new RegExp(`<script\\b[^>]*\\b${Nl}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),Bg=/<meta\b[^>]*\bcharset\b[^>]*>/gi,zg=/<\/head>/gi;function Ew(v){let _=/<head\b[^>]*>/i.exec(v);if(!_)return v;let k=_.index+_[0].length;zg.lastIndex=k;let E=zg.exec(v),T=E?E.index:v.length;Bg.lastIndex=k;let j=Bg.exec(v);if(!j||j.index>=T)return v;if(v.slice(k,j.index).trim()==="")return v;let B=j.index+j[0].length;return`${v.slice(0,k)}
|
|
1970
|
+
${j[0]}${v.slice(k,j.index)}${v.slice(B,T)}${v.slice(T)}`}function Fg(v){return Cw(Ew(v))}function Cw(v){let _=kw.exec(v);if(!_)return v;let k=Ol(v);if(k===null)return v;if(_.index<=k||v.slice(k,_.index).trim()==="")return v;let E=v.slice(0,_.index)+v.slice(_.index+_[0].length),T=Ol(E);if(T===null)return v;return`${E.slice(0,T)}
|
|
1971
|
+
${_[0]}${E.slice(T)}`}var ci="X-STX-Build",Ll=Symbol.for("stx.buildId");function hs(){let v=globalThis;if(!v[Ll])v[Ll]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v[Ll]}function Wg(v,_=hs()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
|
|
1972
|
+
<meta name="stx-build" content="${_}">`}function Rw(v){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let _=navigator.serviceWorker,k=window;if(k.stxOffline)return;let E=null,T=!1,j=[],B={updateReady:!1,registration:()=>E,onUpdateReady(H){if(B.updateReady)try{H()}catch{}else j.push(H);return()=>{let G=j.indexOf(H);if(G!==-1)j.splice(G,1)}},applyUpdate(){let H=E&&E.waiting;if(!H)return!1;return T=!0,H.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=B;let z=(H)=>{if(!H.waiting||!_.controller||B.updateReady)return;B.updateReady=!0;let G=j.splice(0);for(let ne of G)try{ne()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(H)=>{let G=H.data||{};if(G.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:G.url,kind:G.kind,fragment:!!G.fragment}}))}catch{}}),_.addEventListener("controllerchange",()=>{if(T)T=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&E&&E.waiting)E.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let F=()=>{_.register(v,{scope:"/"}).then((H)=>{if(E=H,H.waiting)z(H),H.waiting.postMessage({type:"stx:activate-update",reason:"load"});H.addEventListener("updatefound",()=>{let G=H.installing;if(!G)return;G.addEventListener("statechange",()=>{if(G.state==="installed")z(H)})})}).catch(()=>{})},V=()=>{let H=(G)=>{setTimeout(G,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>H(F));else H(F)};if(!_.controller)if(document.readyState==="complete")V();else addEventListener("load",V);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",V);else V()}function Tw(){let v=`(${Rw.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var Vg=`<script data-stx-offline>${Tw()}</script>`;import{AsyncLocalStorage as Aw}from"async_hooks";var Ug=new Aw;function sn(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function Hg(v,_){return Ug.run(sn(v),_)}async function qg(v,_){let k=Ug.getStore();if(!k)throw Error("useServerData must run inside a <script server> render");if(typeof v!=="string"||!v.trim())throw TypeError("useServerData requires a non-empty string key");let E=k.pending.get(v);if(E)return E;let T=Promise.resolve().then(_).then((j)=>{let B=JSON.stringify(j,(F,V)=>{if(V===void 0||typeof V==="function"||typeof V==="symbol"||typeof V==="bigint"||typeof V==="number"&&!Number.isFinite(V))throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);if(V&&typeof V==="object"&&!Array.isArray(V)&&Object.getPrototypeOf(V)!==Object.prototype&&Object.getPrototypeOf(V)!==null)throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);return V}),z=JSON.parse(B);return k.values.set(v,z),z}).catch((j)=>{throw k.pending.delete(v),j});return k.pending.set(v,T),T}function Hn(v){let _=v.__stx_server_data;if(!_?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(_.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var Zg="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",sa="data-stx-html-attrs",ia="data-stx-html-class",Gg=/^[A-Za-z_:][\w:.-]*$/;function ar(v){return String(v).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Iw(v){return String(v).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function vr(v){if(v.name)return`name="${v.name}"`;if(v.property)return`property="${v.property}"`;if(v.charset!=null)return"charset=";if(v["http-equiv"])return`http-equiv="${v["http-equiv"]}"`;return""}function Pw(v){let _=/^\s*<meta\b([^>]*)>/i.exec(v);if(!_)return null;let k={};for(let E of _[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))k[E[1].toLowerCase()]=E[2]??E[3]??E[4]??"";return k}function Hs(v,_){return Object.entries(v).filter(([k])=>!_?.(k)).map(([k,E])=>`${k}="${ar(String(E))}"`).join(" ")}function Dw(v={},_="en"){let k=[],E=[],T="",j=_;for(let[z,F]of Object.entries(v||{})){if(F==null)continue;let V=z.trim();if(!Gg.test(V))continue;let H=V.toLowerCase();if(H==="lang"){j=String(F);continue}if(H==="class"){T=String(F).trim();continue}k.push(` ${V}="${ar(String(F))}"`),E.push(V)}let B=` lang="${ar(j)}"`;if(T)B+=` class="${ar(T)}"`;if(B+=k.join(""),T)B+=` ${ia}="${ar(T)}"`;if(E.length)B+=` ${sa}="${ar(E.join(" "))}"`;return B}function Jg(v={},_={}){let k={...v,..._};if(v.class&&_.class){let E=v.class.split(/\s+/).filter(Boolean);for(let T of _.class.split(/\s+/).filter(Boolean))if(!E.includes(T))E.push(T);k.class=E.join(" ")}return k}function Un(v,_={}){if(!_||Object.keys(_).length===0)return v;let k=v.match(/<html\b([^>]*)>/i);if(!k)return v;let E={},T=[],j=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,B;while((B=j.exec(k[1]))!==null){let H=B[1];if(!(H in E))T.push(H);E[H]=B[2]??B[3]??B[4]??""}let z=[],F=[];for(let[H,G]of Object.entries(_)){if(G==null)continue;let ne=H.trim();if(!Gg.test(ne))continue;let J=ne.toLowerCase();if(J==="class"){let re=(E.class||"").split(/\s+/).filter(Boolean);for(let se of String(G).split(/\s+/).filter(Boolean))if(!re.includes(se))re.push(se),z.push(se);if(!("class"in E))T.push("class");E.class=re.join(" ");continue}if(!(ne in E))T.push(ne);if(E[ne]=String(G),J!=="lang")F.push(ne)}if(z.length){if(!(ia in E))T.push(ia);E[ia]=z.join(" ")}if(F.length){if(!(sa in E))T.push(sa);E[sa]=F.join(" ")}let V=T.map((H)=>` ${H}="${ar(E[H])}"`).join("");return v.replace(k[0],()=>`<html${V}>`)}function Yg(v){if(v.includes("data-stx-cloak"))return null;if(v.lastIndexOf("</head>")===-1)return null;return`${Zg}
|
|
1973
|
+
`}function Mw(v){let _=[],k=0;while(k<v.length){let j=v.slice(k),B=j.match(/^\s+/);if(B){k+=B[0].length;continue}if(j.startsWith("<!--")){let G=v.indexOf("-->",k);if(G===-1)break;k=G+3;continue}let z=j.match(/^<script\b[^>]*>/i);if(z){let G=v.toLowerCase().indexOf("</script>",k+z[0].length);if(G===-1)break;k=G+9;continue}let F=j.match(/^<link\b[^>]*>/i);if(F){_.push(F[0]),k+=F[0].length;continue}let V=j.match(/^<meta\b[^>]*>/i);if(V){_.push(V[0]),k+=V[0].length;continue}let H=j.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(H){_.push(H[0]),k+=H[0].length;continue}break}if(_.length===0)return{body:v,hoisted:_};let E="",T=0;while(T<v.length&&T<k){let j=v.slice(T),B=j.match(/^<link\b[^>]*>/i);if(B&&_.includes(B[0])){T+=B[0].length;continue}let z=j.match(/^<meta\b[^>]*>/i);if(z&&_.includes(z[0])){T+=z[0].length;continue}let F=j.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(F&&_.includes(F[0])){T+=F[0].length;continue}E+=v[T],T++}return E+=v.slice(k),{body:E,hoisted:_}}function Ow(v,_={},k={}){let{title:E="stx App",lang:T="en",meta:j=[],link:B=[],script:z=[],headRaw:F="",htmlAttrs:V={},bodyClass:H="",bodyAttrs:G={}}=_,ne=k.title||E,J=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],re=new Set(j.map(vr).filter(Boolean)),{body:se,hoisted:ie}=Mw(v),oe=new Set(ie.flatMap((Ce)=>{let _e=Pw(Ce);return _e?[vr(_e)].filter(Boolean):[]})),ae=[...J.filter((Ce)=>!re.has(vr(Ce))),...j].filter((Ce)=>!oe.has(vr(Ce))).map((Ce)=>` <meta ${Hs(Ce)}>`).join(`
|
|
1974
|
+
`),me=B.map((Ce)=>` <link ${Hs(Ce)}>`).join(`
|
|
1975
|
+
`),ve=z.map((Ce)=>{if(Ce.src)return` <script ${Hs(Ce,(_e)=>_e==="content")}></script>`;if(Ce.content)return` <script>${Ce.content}</script>`;return""}).filter(Boolean).join(`
|
|
1976
|
+
`),Se=Dw(V,T),$e=Object.entries(G).map(([Ce,_e])=>` ${Ce}="${ar(String(_e))}"`).join(""),Re=H?` class="${ar(H)}"`:"",Ee=[ae,k.colorMode?` ${jl(k.colorMode)}`:"",` <title>${k.titleIsHtml?ne:Iw(ne)}</title>`,` ${Zg}`,me,ve,F?` ${F}`:"",...(k.styles||[]).map((Ce)=>` ${Ce}`),...ie.map((Ce)=>` ${Ce}`),...(k.headScripts||[]).map((Ce)=>` ${Ce}`),k.headStack||""].filter(Boolean),Te=[se,...(k.bodyScripts||[]).map((Ce)=>Ce),k.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
1978
1977
|
<html${Se}>
|
|
1979
1978
|
<head>
|
|
1980
1979
|
${Ee.join(`
|
|
@@ -1984,124 +1983,124 @@ ${Ee.join(`
|
|
|
1984
1983
|
${Te.join(`
|
|
1985
1984
|
`)}
|
|
1986
1985
|
</body>
|
|
1987
|
-
</html>`}var
|
|
1986
|
+
</html>`}var Bl=/\s+/y,zl=/<(script|style)\b[^>]*>/iy,Nw=/<\/script>/gi,jw=/<\/style>/gi,Kg=/<!DOCTYPE\b/iy,Xg=/<html[\s>]/iy;function on(v){let _=0;while(_<v.length){if(Bl.lastIndex=_,Bl.exec(v)){_=Bl.lastIndex;continue}if(v.startsWith("<!--",_)){let T=v.indexOf("-->",_);if(T===-1)return!1;_=T+3;continue}zl.lastIndex=_;let E=zl.exec(v);if(E){let T=E[1].toLowerCase()==="script"?Nw:jw;T.lastIndex=zl.lastIndex;let j=T.exec(v);if(j===null)return!1;_=j.index+j[0].length;continue}if(Kg.lastIndex=_,Kg.test(v))return!0;return Xg.lastIndex=_,Xg.test(v)}return!1}function Fl(v){return on(v)}function Qg(v,_={}){let k=v.lastIndexOf("</head>");if(k===-1)return v;let{meta:E=[],link:T=[],script:j=[],headRaw:B=""}=_,z=v.slice(0,k),F=[];for(let V of E){let H=vr(V);if(H&&z.includes(H))continue;F.push(` <meta ${Hs(V)}>`)}for(let V of T){if(V.href&&z.includes(`href="${V.href}"`))continue;F.push(` <link ${Hs(V)}>`)}for(let V of j)if(V.src){if(z.includes(`src="${V.src}"`))continue;F.push(` <script ${Hs(V,(H)=>H==="content")}></script>`)}else if(V.content){if(z.includes(V.content))continue;F.push(` <script>${V.content}</script>`)}if(B&&!z.includes(B))F.push(` ${B}`);if(F.length===0)return v;return`${v.slice(0,k)}${F.join(`
|
|
1988
1987
|
`)}
|
|
1989
|
-
${v.slice(k)}`}function Wn(v,_={},k={},E){if(E??
|
|
1990
|
-
`+v.slice(k);let T=
|
|
1988
|
+
${v.slice(k)}`}function Wn(v,_={},k={},E){if(E??Fl(v))return v;return Ow(v,_,k)}import em from"path";function N(v,_={}){return new yn(v,_).routes}var tm=new Map;async function nm(v,_){let k=v,E=_;if(!k||!E)try{let z=await o();k||=z?.pagesDir||"pages",E||=z?.root||"."}catch{k||="pages",E||="."}let T=em.isAbsolute(k)?k:em.join(E,k),j=tm.get(T);if(j)return j;let B=[];try{B=N(".",{pagesDir:T,emit:!1}).map((z)=>z.regex.source).filter(Boolean)}catch{B=[]}return tm.set(T,B),B}function Bw(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function rm(v){return Bw(JSON.stringify(v))}function ce(v){return v.includes("data-stx-runtime")}function sm(v){let _=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let k=_.exec(v);k!==null;k=_.exec(v)){let E=v.slice(Math.max(0,k.index-80),k.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(E))continue;return!0}return!1}function Wl(v,_){let k=xi(v),E=v.search(/<!doctype\b/i);if(k!==-1&&(E===-1||k>E))return v.slice(0,k)+_+`
|
|
1989
|
+
`+v.slice(k);let T=Wi(v);if(T!==null)return`${v.slice(0,T)}
|
|
1991
1990
|
${_}${v.slice(T)}`;if(v.includes("</head>")){let B=v.indexOf("</head>");return v.slice(0,B)+_+`
|
|
1992
|
-
`+v.slice(B)}if(An(v))return
|
|
1991
|
+
`+v.slice(B)}if(An(v))return Ns(v,(B)=>`${B}
|
|
1993
1992
|
${_}`);return`${_}
|
|
1994
|
-
${v}`}async function
|
|
1993
|
+
${v}`}async function oa(v,_){if(v.includes("data-stx-runtime")||v.includes("window.stx.state")||v.includes("STX Signals Runtime"))return v;if(_.buildMode==="serve"){let{getServeClientAsset:T}=await import("./chunk-3sscb1dw.js"),{url:j}=await T("runtime",_.debug===!0);return Wl(v,`<script data-stx-runtime src="${j}"></script>`)}if(_.buildMode==="compile")return Wl(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-3sscb1dw.js"),E=await k(_.debug);return Wl(v,`<script data-stx-scoped data-stx-runtime>${E}</script>`)}function zw(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function im(v){if(v.includes("data-stx-tooltip-runtime")||!zw(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${xl()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
|
|
1995
1994
|
${_}`;return`${v.slice(0,k)}${_}
|
|
1996
|
-
${v.slice(k)}`}var
|
|
1997
|
-
`}let{getCachedRouterScript:T,getServeClientAsset:j}=await import("./chunk-
|
|
1998
|
-
</body>`+v.slice(z+7)}var
|
|
1999
|
-
`)}else{if(!
|
|
1995
|
+
${v.slice(k)}`}var Fw=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function Ww(v){return Fw.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function K(v,_){if(!v.includes("</body>"))return v;if(Ww(v))return v;let k=_?.router,E="";{let F={};if(k){if(k.container)F.container=k.container;if(k.interceptAllLinks!==void 0)F.interceptAllLinks=k.interceptAllLinks;if(k.progress!==void 0)F.progress=k.progress;if(k.viewTransitions!==void 0)F.viewTransitions=k.viewTransitions;if(k.viewTransitionDuration!==void 0)F.viewTransitionDuration=k.viewTransitionDuration;if(k.viewTransitionEasing!==void 0)F.viewTransitionEasing=k.viewTransitionEasing;if(k.scrollToTop!==void 0)F.scrollToTop=k.scrollToTop;if(k.scrollRestoration!==void 0)F.scrollRestoration=k.scrollRestoration;if(k.prefetch!==void 0)F.prefetch=k.prefetch;if(k.cache!==void 0)F.cache=k.cache;if(k.progressColor!==void 0)F.progressColor=k.progressColor;if(k.progressHeight!==void 0)F.progressHeight=k.progressHeight}try{let V=await nm(_?.pagesDir,_?.root);if(V.length>0)F.ownedRoutes=V}catch{}if(Object.keys(F).length>0)E=`<script>window.__stxRouterConfig=${rm(F)};</script>
|
|
1996
|
+
`}let{getCachedRouterScript:T,getServeClientAsset:j}=await import("./chunk-3sscb1dw.js"),B=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await j("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,z=v.lastIndexOf("</body>");return v.slice(0,z)+E+B+`
|
|
1997
|
+
</body>`+v.slice(z+7)}var Vl=`(?:"[^"]*"|'[^']*'|[^>"'])*`,fm=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Vw=65536,Uw=4,ca=new Map;function ju(){ca.clear()}function Hw(v){let _=[];for(let k of lr(v,Y)){let E=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!E||!T)continue;let j=E[0].length,B=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:E[1],body:k.token.slice(j,B),start:k.start,end:k.end}))}return _}function ic(v,_={}){let k=v.length>=Vw,E=k?ca.get(v):void 0;if(E===void 0){if(E=Hw(v),k)Md(ca,Uw),ca.set(v,E)}let T=_.skipAttrs;if(!T)return E.slice();let j=[];for(let B of E)if(T.lastIndex=0,!T.test(B.attrs))j.push(B);return j}function is(v){let _=v.trim(),k=_.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let T=k[1].trim(),j=k[2].trim(),{itemVar:B,indexVar:z}=om(j);if(B)return{style:"as",iterable:T,itemVar:B,indexVar:z}}let E=_.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(E){let T=E[1].trim(),j=E[2].trim(),{itemVar:B,indexVar:z}=om(T);if(B)return{style:"in",iterable:j,itemVar:B,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function om(v){let _=v.trim(),k=_.match(/^(\w+)\s*=>\s*(\w+)$/);if(k)return{itemVar:k[2],indexVar:k[1]};let E=_.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(E)return{itemVar:E[1],indexVar:E[2]||null};let T=_.match(/^(\w+)\s*,\s*(\w+)$/);if(T)return{itemVar:T[1],indexVar:T[2]};let j=_.match(/^(\w+)$/);if(j)return{itemVar:j[1],indexVar:null};return{itemVar:null,indexVar:null}}function as(v,_){return Ci(v,_)}function qw(v){let _=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,k=0,E;while((E=_.exec(v))!==null){let T=E[1];if(T.startsWith("if"))k++;else if(T==="endif")k--;else if(k===0)return!0}return!1}function pm(v){let _=new Set,k=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,E=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,T;while((T=k.exec(v))!==null){let j=T[1],B;while((B=E.exec(j))!==null)_.add(B[1])}return _}function Kw(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Vl})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,E=lr(v,(j,B)=>{_.lastIndex=B;let z=_.exec(j);if(!z||z.index!==B||!k.test(z[2]))return-1;return _.lastIndex}),T=[];for(let j of E){_.lastIndex=0;let B=_.exec(j.token);if(!B)continue;let z=B[2].match(k),F=is(z?.[1]??z?.[2]??""),V=[F.itemVar,F.indexVar].filter(Boolean);if(V.length===0)continue;let H=B[1],ne=/\/\s*>$/.test(j.token)||la.has(H.toLowerCase())?j.end:Hl(v,j.start,H,j.end);if(ne!==-1)T.push({start:j.start,end:ne,vars:new Set(V)})}return T}var am=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 Xw(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function cm(v,_,k,E){if(!v)return!1;let T=Xw(v),j=!1,B=!1,z=!1,F=/([a-zA-Z_$][\w$]*)/g,V;while((V=F.exec(T))!==null){let J=V[1];if(T.slice(0,V.index).trimEnd().endsWith("."))continue;if(am.has(J))continue;if(_.has(J)||E?.has(J))j=!0;else if(k&&J in k)B=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,G;while((G=H.exec(T))!==null){let J=G[1];if(T.slice(0,G.index).trimEnd().endsWith("."))continue;if(am.has(J)||k&&J in k)continue;z=!0}return(j||z)&&!B}function aa(v,_,k){let E=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,""")}"`,T=v.trim(),j=T.match(fm);if(j&&Zw(j[3],j[1])){let[,B,z,F]=j;return`<${B}${z}${E}>${F}</${B}>`}return`<template${E}>${T}</template>`}function Zw(v,_){let k=new RegExp(`<(/)?${_}(?=[\\s/>])`,"gi"),E=0,T;while((T=k.exec(v))!==null)if(T[1]){if(E--,E<0)return!1}else E++;return!0}function ei(v,_){let k=pm(v);function E(T){let j=T,B=Kw(T),z=(G)=>{let ne=new Set;for(let J of B)if(G>J.start&&G<J.end)for(let re of J.vars)ne.add(re);return ne},F=/@if\s*\(/g,V,H=[];while((V=F.exec(j))!==null){let G=V.index,ne=G+V[0].length,J=1,re=ne;while(re<j.length&&J>0){if(j[re]==="(")J++;else if(j[re]===")")J--;re++}if(J!==0)continue;let se=j.substring(ne,re-1).trim(),ie=re,oe=1,de=ie,ae=/@(if\s*\(|endif)/g;ae.lastIndex=ie;let me;while((me=ae.exec(j))!==null)if(me[1].startsWith("if"))oe++;else if(me[1]==="endif"){if(oe--,oe===0){de=me.index+me[0].length;break}}if(oe!==0)continue;let ve=j.substring(ie,de-6).trim(),Se;if(qw(ve)){let $e=_i(j.substring(G,de));if($e.length===0)continue;let Re=$e[0].branches.filter((_e)=>_e.type!=="else"),Ee=z(G);if(!(Re.length>0&&Re.every((_e)=>cm(_e.condition,k,_,Ee))))continue;Se=$e[0].branches.map((_e)=>{let Ie=E(_e.content);if(_e.type==="elseif")return aa(Ie,"@else-if",_e.condition??"");if(_e.type==="else")return aa(Ie,"@else");return aa(Ie,"@if",_e.condition??"")}).join(`
|
|
1998
|
+
`)}else{if(!cm(se,k,_,z(G)))continue;Se=aa(E(ve),"@if",se)}H.push({start:G,end:de,replacement:Se}),F.lastIndex=de}for(let G=H.length-1;G>=0;G--){let{start:ne,end:J,replacement:re}=H[G];j=j.substring(0,ne)+re+j.substring(J)}return j}return E(v)}function Gw(v){let _=v.trim();if(_==="")return;if(_==="true")return!0;if(_==="false")return!1;if(_==="null")return!1;if(_==="undefined")return!1;if(_==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(_)){let T=Number(_);return T!==0&&!Number.isNaN(T)}let k=_.match(/^'((?:\\.|[^'\\])*)'$/);if(k)return k[1].length>0;let E=_.match(/^"((?:\\.|[^"\\])*)"$/);if(E)return E[1].length>0;return}var la=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),lm=/<(script|style)\b/iy,Jw=/<\/script/gi,Yw=/<\/style/gi;function Hl(v,_,k,E){if(la.has(k.toLowerCase()))return E;let T=k.toLowerCase(),j=v.length,B=1,z=E;while(z<j){let F=v.indexOf("<",z);if(F===-1)return-1;if(z=F,v.startsWith("<!--",z)){let ne=v.indexOf("-->",z+4);if(ne===-1)return-1;z=ne+3;continue}lm.lastIndex=z;let V=lm.exec(v);if(V){let ne=v.indexOf(">",z);if(ne===-1)return-1;if(v[ne-1]==="/"){z=ne+1;continue}let J=V[1].toLowerCase()==="script"?Jw:Yw;J.lastIndex=z;let re=J.exec(v);if(re===null)return-1;let se=v.indexOf(">",re.index);if(se===-1)return-1;z=se+1;continue}if(v[z+1]==="/"){let ne=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(z,z+64));if(!ne){z++;continue}if(ne[1].toLowerCase()===T){if(B--,z+=ne[0].length,B===0)return z;continue}z+=ne[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec(v.slice(z,z+64));if(!H){z++;continue}let G=v.indexOf(">",z);if(G===-1)return-1;if(H[1].toLowerCase()===T){let ne=v.slice(z,G+1);if(!(/\/\s*>$/.test(ne)||la.has(T)))B++}z=G+1}return-1}var Qw=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function eS(v,_){let k=_,E=v.length;for(;;){while(k<E&&v[k]!=="<")k++;if(k>=E)return!1;if(v.startsWith("<!--",k)){let B=v.indexOf("-->",k+4);if(B===-1)return!1;k=B+3;continue}break}if(v[k+1]==="/")return!1;let T=v.indexOf(">",k);if(T===-1)return!1;let j=v.slice(k,T+1);return Qw.test(j)}function ti(v){if(!v.includes(":if")&&!v.includes(":show")&&!v.includes("x-if")&&!v.includes("x-show")&&!v.includes("@if=")&&!v.includes("@show="))return v;let _=[],k=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,E;while((E=k.exec(v))!==null)_.push([E.index,E.index+E[0].length]);let T=(G)=>_.some(([ne,J])=>G>=ne&&G<J),j=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,B=[],z;while((z=j.exec(v))!==null){if(T(z.index))continue;let[G,ne,J,re,se,ie,oe]=z,de=Gw(se);if(de===void 0)continue;let ae=z.index,me=ae+G.length,$e=!!oe||/\/\s*>$/.test(G)||la.has(ne.toLowerCase())?me:Hl(v,ae,ne,me);if($e===-1)continue;if((re===":if"||re==="x-if"||re==="@if")&&eS(v,$e)){j.lastIndex=me;continue}if(de===!0){let Ee=`<${ne}${J}${ie}${oe}>`;B.push({start:ae,end:me,replacement:Ee});continue}B.push({start:ae,end:$e,replacement:""}),j.lastIndex=$e}if(B.length===0)return v;B.sort((G,ne)=>G.start-ne.start);let F=[],V=-1;for(let G of B){if(G.start<V)continue;F.push(G),V=G.end}let H=v;for(let G=F.length-1;G>=0;G--){let{start:ne,end:J,replacement:re}=F[G];H=H.substring(0,ne)+re+H.substring(J)}return H}var um=[":for","@for","x-for"];function cs(v,_){if(!_||Object.keys(_).length===0)return v;if(!um.some((z)=>v.includes(`${z}=`)))return v;let k=pm(v);if(Array.isArray(_.__stx_client_signal_names)){for(let z of _.__stx_client_signal_names)if(typeof z==="string")k.add(z)}let E=v,T=[],j=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,B;while((B=j.exec(E))!==null){let[z,F,V]=B,H=B.index,G=H+z.length,ne=um.map((Se)=>({attr:Se,m:new RegExp(`\\s${Se}="([^"]*)"`).exec(V)})).find((Se)=>Se.m!==null);if(!ne||!ne.m)continue;let J=is(ne.m[1]);if(!J.iterable||!J.itemVar)continue;let re=J.iterable.trim().split(/[.[(]/)[0].trim();if(!re||k.has(re)||!(re in _))continue;let se=Hl(E,H,F,G);if(se===-1)continue;let ie=V.replace(new RegExp(`\\s${ne.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),oe=E.slice(G,se-`</${F}>`.length),de={..._,[J.itemVar]:void 0};if(J.indexVar)de[J.indexVar]=void 0;let ae=cs(oe,de),me=J.indexVar?`${J.iterable} as ${J.indexVar} => ${J.itemVar}`:`${J.iterable} as ${J.itemVar}`,ve=F.toLowerCase()==="template"?ae:`<${F}${ie}>${ae}</${F}>`;T.push({start:H,end:se,replacement:`@foreach(${me})${ve}@endforeach`}),j.lastIndex=se}for(let z=T.length-1;z>=0;z--){let{start:F,end:V,replacement:H}=T[z];E=E.slice(0,F)+H+E.slice(V)}return E}function ls(v,_){let k=v,E=/@(for|foreach)\s*\(/g,T,j=[],B=[];while((T=E.exec(k))!==null){let z=T[1],F=T.index,V=F+T[0].length,H=1,G=V;while(G<k.length&&H>0){if(k[G]==="(")H++;else if(k[G]===")")H--;G++}if(H!==0)continue;let ne=k.substring(V,G-1).trim(),J=G,re=is(ne),se=z==="for"?"@endfor":"@endforeach",ie=1,oe=J,de=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");de.lastIndex=J;let ae;while((ae=de.exec(k))!==null)if(ae[1].startsWith(z))ie++;else if(ie--,ie===0){oe=ae.index+ae[0].length;break}if(ie!==0)continue;let me=()=>{let Te=[re.itemVar,re.indexVar].filter(Boolean);if(Te.length)B.push({start:F,end:oe,vars:Te})};if(re.iterable){let Te=re.iterable.trim();if(Te.startsWith("[")||Te.startsWith("{")||Te.startsWith("'")||Te.startsWith('"')||Te.startsWith("`")||/^-?\d/.test(Te)){me();continue}let Ce=Te.split(/[.[(]/)[0].trim(),_e=_?Ce in _:!1,Ie=B.some((Xe)=>F>Xe.start&&F<Xe.end&&Xe.vars.includes(Ce));if(Ce&&(_e||Ie)){me();continue}}if(re.style==="as")ne=re.indexVar?`(${re.itemVar}, ${re.indexVar}) in ${re.iterable}`:`${re.itemVar} in ${re.iterable}`;let ve=k.substring(J,oe-se.length).trim(),Se=_?{..._}:{};if(re.itemVar)delete Se[re.itemVar];if(re.indexVar)delete Se[re.indexVar];let $e=ls(ve,Se),Re=$e.match(fm),Ee;if(Re){let[,Te,Ce,_e]=Re;Ee=`<${Te}${Ce} @for="${ne}">${_e}</${Te}>`}else Ee=`<template @for="${ne}">${$e}</template>`;j.push({start:F,end:oe,replacement:Ee}),E.lastIndex=oe}for(let z=j.length-1;z>=0;z--){let{start:F,end:V,replacement:H}=j[z];k=k.substring(0,F)+H+k.substring(V)}return k}function tS(v){let _=new Set,k=[],E=0,T=0,j=v.length,B=(H)=>{let G=E+1;while(G<j){let ne=v[G];if(ne==="\\"){G+=2;continue}if(ne===H)return G+1;G++}return j},z=()=>{let H=E+2;while(H<j&&v[H]!==`
|
|
2000
1999
|
`)H++;return H},F=()=>{let H=E+2;while(H<j-1){if(v[H]==="*"&&v[H+1]==="/")return H+2;H++}return j},V=(H)=>{let G=H,ne=0;while(G<j){let J=v[G];if(J==="/"&&v[G+1]==="/"){let re=G+2;while(re<j&&v[re]!==`
|
|
2001
|
-
`)re++;G=re;continue}if(J==="/"&&v[G+1]==="*"){let re=G+2;while(re<j-1&&!(v[re]==="*"&&v[re+1]==="/"))re++;G=re+2;continue}if(J==='"'||J==="'"||J==="`"){let re=G+1;while(re<j){if(v[re]==="\\"){re+=2;continue}if(v[re]===J){re++;break}re++}G=re;continue}if(J==="("||J==="["||J==="{"){ne++,G++;continue}if(J===")"||J==="]"||J==="}"){ne--,G++;continue}if(J===";"&&ne===0)return G+1;G++}return j};while(E<j){let H=v[E];if(H==="/"&&v[E+1]==="/"){let G=z();k.push(v.slice(E,G)),E=G;continue}if(H==="/"&&v[E+1]==="*"){let G=F();k.push(v.slice(E,G)),E=G;continue}if(H==='"'||H==="'"||H==="`"){let G=B(H);k.push(v.slice(E,G)),E=G;continue}if(H==="{"){T++,k.push(H),E++;continue}if(H==="}"){T--,k.push(H),E++;continue}if(T===0){let G=E>0?v[E-1]:"";if(G===""||/\s/.test(G)||G===";"||G==="}"||G==="{"){let J=v.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(J){let re=J[2],se=V(E+J[0].length);if(_.has(re)){k.push(`/* stx: deduped const ${re} */`),E=se;continue}_.add(re),k.push(v.slice(E,se)),E=se;continue}}}k.push(H),E++}return k.join("")}var
|
|
2000
|
+
`)re++;G=re;continue}if(J==="/"&&v[G+1]==="*"){let re=G+2;while(re<j-1&&!(v[re]==="*"&&v[re+1]==="/"))re++;G=re+2;continue}if(J==='"'||J==="'"||J==="`"){let re=G+1;while(re<j){if(v[re]==="\\"){re+=2;continue}if(v[re]===J){re++;break}re++}G=re;continue}if(J==="("||J==="["||J==="{"){ne++,G++;continue}if(J===")"||J==="]"||J==="}"){ne--,G++;continue}if(J===";"&&ne===0)return G+1;G++}return j};while(E<j){let H=v[E];if(H==="/"&&v[E+1]==="/"){let G=z();k.push(v.slice(E,G)),E=G;continue}if(H==="/"&&v[E+1]==="*"){let G=F();k.push(v.slice(E,G)),E=G;continue}if(H==='"'||H==="'"||H==="`"){let G=B(H);k.push(v.slice(E,G)),E=G;continue}if(H==="{"){T++,k.push(H),E++;continue}if(H==="}"){T--,k.push(H),E++;continue}if(T===0){let G=E>0?v[E-1]:"";if(G===""||/\s/.test(G)||G===";"||G==="}"||G==="{"){let J=v.slice(E).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(J){let re=J[2],se=V(E+J[0].length);if(_.has(re)){k.push(`/* stx: deduped const ${re} */`),E=se;continue}_.add(re),k.push(v.slice(E,se)),E=se;continue}}}k.push(H),E++}return k.join("")}var nS=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Ul(v,_,k){for(let E of k){if(E.start>=_)return!1;if(E.end>v)return!0}return!1}function rS(v,_,k){let E=0;while(E<v.length){let T=v.indexOf(_,E);if(T===-1)return!1;if(!Ul(T,T+_.length,k))return!0;E=T+_.length}return!1}function sS(v,_){if(rS(v,"<body",_)){let T=new RegExp(`<body(${Vl})>`,"g"),j;while((j=T.exec(v))!==null)if(!Ul(j.index,j.index+j[0].length,_))return j.index+j[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${Vl})>`,"gi"),E;while((E=k.exec(v))!==null){if(Ul(E.index,E.index+E[0].length,_))continue;if(nS.has(E[1].toLowerCase()))continue;return E.index+E[0].length-1}return null}function iS(v,_,k,E){let T=[],j=` data-stx="${E}"`,B=0,z=!1,F=(V)=>{if(k!==null&&!z&&k>=B&&k<=V)T.push(v.slice(B,k),j,v.slice(k,V)),z=!0;else T.push(v.slice(B,V))};for(let V of _){if(V.start<B)continue;F(V.start),B=V.end}return F(v.length),T.join("")}async function zn(v,_,k,E={}){let T=ic(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),j=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|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*\(/,B=[],{hasUserImports:z,bundleClientScript:F}=await ft("stx/client-script-bundler",()=>import("./chunk-083amvsc.js"));for(let ae of T){let me=ae.body;if(Ve(ae.attrs))me=Ue(me);if(E.forceClientSetup||j.test(me)){B.push({content:me,start:ae.start,end:ae.end});continue}if(!z(me))continue;try{let ve=await F(wt(me).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(j.test(ve))B.push({content:me,start:ae.start,end:ae.end})}catch{}}if(B.length===0)return{output:v,setupCode:null};let V=`${_??""}\x00${B.map((ae)=>ae.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(V).toString(36).slice(0,10)}`,G=[];for(let ae=0;ae<B.length;ae++){let me=B[ae].bundled??wt(B[ae].content).code;if(!B[ae].bundled&&z(me))me=await F(me,_||"",{projectRoot:process.cwd(),externalizeUserModules:E.forceClientSetup?!1:void 0});me=He(me);let ve=P(me);G.push(`// \u2500\u2500 merged signal script #${ae+1} \u2500\u2500
|
|
2002
2001
|
${ve}`)}let ne=G.join(`
|
|
2003
2002
|
|
|
2004
|
-
`);ne=
|
|
2003
|
+
`);ne=tS(ne);let J=ac(ne),re=J.split(",").map((ae)=>ae.trim()).filter(Boolean),se=Jr(ne,k),ie=`
|
|
2005
2004
|
<script data-stx-scoped>
|
|
2006
2005
|
function ${H}() {
|
|
2007
2006
|
${Rt("const",re)}
|
|
2008
|
-
${
|
|
2007
|
+
${Hr(`${se}${ne}`)}
|
|
2009
2008
|
return { ${J} };
|
|
2010
2009
|
}
|
|
2011
2010
|
window.__stx_latestSetup=${H};
|
|
2012
2011
|
if(window.stx)window.stx._latestSetup=${H};
|
|
2013
|
-
</script>`,oe=
|
|
2012
|
+
</script>`,oe=sS(v,B);return{output:iS(v,B,oe,H),setupCode:ie}}function ac(v){let _=v,k=[],E=new Set,T=0,j=0,B=_.length,z="",F=()=>{j++;let re=!1;while(j<B){let se=_[j];if(se==="\\"){j+=2;continue}if(se==="["&&!re){re=!0,j++;continue}if(se==="]"&&re){re=!1,j++;continue}if(se==="/"&&!re){j++;while(j<B&&/[gimsuyd]/.test(_[j]))j++;return}if(se===`
|
|
2014
2013
|
`)return;j++}},V=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},H=(re)=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]===re){j++;return}j++}},G=()=>{j++;while(j<B){if(_[j]==="\\"){j+=2;continue}if(_[j]==="`"){j++;return}if(_[j]==="$"&&_[j+1]==="{"){j+=2;let re=1;while(j<B&&re>0)if(_[j]==="{")re++,j++;else if(_[j]==="}")re--,j++;else if(_[j]==="'"||_[j]==='"')H(_[j]);else if(_[j]==="`")G();else j++;continue}j++}},ne=()=>{if(_[j]==="/"&&_[j+1]==="/"){while(j<B&&_[j]!==`
|
|
2015
|
-
`)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},J=()=>{if(T!==0)return;let re=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(re){let ae=re[2];if(!E.has(ae))k.push(ae),E.add(ae);return}let se=_.slice(j).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(se){se[1].split(",").forEach((ae)=>{let me=ae.trim();if(!me)return;let ve=me.indexOf(":"),$e=(ve>=0?me.slice(ve+1).trim():me).split(/[\s=]/)[0];if($e&&!E.has($e))k.push($e),E.add($e)});return}let ie=_.slice(j).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(ie){ie[1].split(",").forEach((ae)=>{let me=ae.trim().replace(/^\.\.\./,"");if(!me)return;let ve=me.split(/[\s=]/)[0];if(ve&&!E.has(ve))k.push(ve),E.add(ve)});return}let oe=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(oe){let ae=oe[1];if(!E.has(ae))k.push(ae),E.add(ae);return}let de=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(de){let ae=de[1];if(!E.has(ae))k.push(ae),E.add(ae)}};while(j<B){if(ne())continue;if(_[j]==="'"||_[j]==='"'){H(_[j]),z=_[j-1];continue}if(_[j]==="`"){G(),z="`";continue}if(_[j]==="/"&&_[j+1]!=="/"&&_[j+1]!=="*"&&V()){F(),z="/";continue}if(_[j]==="{"){T++,z="{",j++;continue}if(_[j]==="}"){T--,z="}",j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))J();if(!/\s/.test(_[j]))z=_[j];j++}return k.join(", ")}async function ni(v,_,k,E){if(!as(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:j,setupCode:B}=await zn(T,k,E);if(T=j,!B){let z=An(T);if(z&&!/data-stx/.test(z.attrs)&&!/data-stx-auto/.test(z.attrs)){let F=z.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");T=T.slice(0,z.index)+F+T.slice(z.index+z.tag.length)}}if(T=await
|
|
2014
|
+
`)j++;return!0}if(_[j]==="/"&&_[j+1]==="*"){j+=2;while(j<B-1&&!(_[j]==="*"&&_[j+1]==="/"))j++;return j+=2,!0}return!1},J=()=>{if(T!==0)return;let re=_.slice(j).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(re){let ae=re[2];if(!E.has(ae))k.push(ae),E.add(ae);return}let se=_.slice(j).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(se){se[1].split(",").forEach((ae)=>{let me=ae.trim();if(!me)return;let ve=me.indexOf(":"),$e=(ve>=0?me.slice(ve+1).trim():me).split(/[\s=]/)[0];if($e&&!E.has($e))k.push($e),E.add($e)});return}let ie=_.slice(j).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(ie){ie[1].split(",").forEach((ae)=>{let me=ae.trim().replace(/^\.\.\./,"");if(!me)return;let ve=me.split(/[\s=]/)[0];if(ve&&!E.has(ve))k.push(ve),E.add(ve)});return}let oe=_.slice(j).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(oe){let ae=oe[1];if(!E.has(ae))k.push(ae),E.add(ae);return}let de=_.slice(j).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(de){let ae=de[1];if(!E.has(ae))k.push(ae),E.add(ae)}};while(j<B){if(ne())continue;if(_[j]==="'"||_[j]==='"'){H(_[j]),z=_[j-1];continue}if(_[j]==="`"){G(),z="`";continue}if(_[j]==="/"&&_[j+1]!=="/"&&_[j+1]!=="*"&&V()){F(),z="/";continue}if(_[j]==="{"){T++,z="{",j++;continue}if(_[j]==="}"){T--,z="}",j++;continue}if(T===0&&/[a-z]/i.test(_[j])&&(j===0||/\s|[;{}()]/.test(_[j-1])))J();if(!/\s/.test(_[j]))z=_[j];j++}return k.join(", ")}async function ni(v,_,k,E){if(!as(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:j,setupCode:B}=await zn(T,k,E);if(T=j,!B){let z=An(T);if(z&&!/data-stx/.test(z.attrs)&&!/data-stx-auto/.test(z.attrs)){let F=z.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");T=T.slice(0,z.index)+F+T.slice(z.index+z.tag.length)}}if(T=await oa(T,_),B){let z=ri(T,/<\/head>/i),F=z===-1?ri(T,/<body[^>]*>/i):-1;if(z!==-1)T=`${T.slice(0,z)}${B}
|
|
2016
2015
|
${T.slice(z)}`;else if(F!==-1){let V=/<body[^>]*>/i.exec(T.slice(F))[0],H=F+V.length;T=`${T.slice(0,H)}
|
|
2017
2016
|
${B}${T.slice(H)}`}else T=`${T}
|
|
2018
|
-
${B}`}return T}function ri(v,_){let k=/<(script|style)\b[\s\S]*?<\/\1>/gi,E=[],T;while((T=k.exec(v))!==null)E.push([T.index,T.index+T[0].length]);let j=new RegExp(_.source,_.flags.replace(/[gy]/g,"")),B=0;while(B<v.length){let z=j.exec(v.slice(B));if(!z)return-1;let F=B+z.index;if(!E.some(([H,G])=>F>=H&&F<G))return F;B=F+Math.max(z[0].length,1)}return-1}var
|
|
2019
|
-
`+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw k[
|
|
2017
|
+
${B}`}return T}function ri(v,_){let k=/<(script|style)\b[\s\S]*?<\/\1>/gi,E=[],T;while((T=k.exec(v))!==null)E.push([T.index,T.index+T[0].length]);let j=new RegExp(_.source,_.flags.replace(/[gy]/g,"")),B=0;while(B<v.length){let z=j.exec(v.slice(B));if(!z)return-1;let F=B+z.index;if(!E.some(([H,G])=>F>=H&&F<G))return F;B=F+Math.max(z[0].length,1)}return-1}var dm="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function cc(v){let _=[];for(let k of v.split(",")){let E=k.trim();if(!E||E.startsWith("type "))continue;let T=E.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T&&T[1]!==T[2])_.push(`${T[2]} = ${T[1]}`)}if(_.length===0)return dm;return`var ${_.join(", ")}; ${dm}`}var oS=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function He(v){return v.replace(oS,(_,k)=>cc(k))}import qs from"path";import aS from"process";function w(v="STX_PUBLIC_"){let _={},k={};for(let[E,T]of Object.entries(aS.env)){if(!E.startsWith(v)||T===void 0)continue;_[`import.meta.env.${E}`]=JSON.stringify(T),k[E]=T}return _["import.meta.env"]=JSON.stringify(k),_}function gm(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function mm(v,_,k){try{let E;if(v.startsWith("/")){let T=_;for(let j=0;j<5;j++){let B=qs.join(T,v);if(await Bun.file(B).exists())return B;T=qs.dirname(T)}E=qs.join(_,v)}else if(v.startsWith("./")||v.startsWith("../"))E=qs.resolve(_,v);else E=qs.resolve(_,v);if(await Bun.file(E).exists())return E;return null}catch{return null}}var hm=Symbol.for("stx.inline-assets.import-meta");function cS(v,_){if(!v.includes("import.meta"))return;let k=Error(`[stx] ${_} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
|
|
2018
|
+
`+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw k[hm]=!0,k}async function ym(v,_,k){let E=v,T=qs.dirname(_),j=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,B;while((B=j.exec(E))!==null){let[V,H,G,ne]=B;if(gm(G))continue;let J=await mm(G,T,_);if(J)try{let re=await Bun.file(J).text();if(k.add(J),G.endsWith(".ts")||G.endsWith(".tsx")){let ie=await Bun.build({entrypoints:[J],target:"browser",minify:!0,define:w()});if(ie.outputs.length>0)re=await ie.outputs[0].text(),cS(re,G)}let se=`<script>
|
|
2020
2019
|
// Source: ${G}
|
|
2021
2020
|
${re}
|
|
2022
|
-
</script>`;E=E.replace(V,se),j.lastIndex=0}catch(re){if(re?.[
|
|
2021
|
+
</script>`;E=E.replace(V,se),j.lastIndex=0}catch(re){if(re?.[hm])throw re}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,F;while((F=z.exec(E))!==null){let[V,H,G,ne]=F,J=H+ne;if(gm(G))continue;if(/rel=["']stylesheet["']/.test(J)||G.endsWith(".css")){let se=await mm(G,T,_);if(se)try{let ie=await Bun.file(se).text();k.add(se);let oe=`<style>
|
|
2023
2022
|
/* Source: ${G} */
|
|
2024
2023
|
${ie}
|
|
2025
|
-
</style>`;E=E.replace(V,oe),z.lastIndex=0}catch(ie){}}}return E}function ys(v,_){let k=v,E=/@json\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index,B=j+T[0].length-1,z=1,F=B+1,V=null,H=!1;while(F<k.length&&z>0){let ae=k[F];if(H){H=!1,F++;continue}if(ae==="\\"&&V){H=!0,F++;continue}if(V){if(ae===V)V=null;F++;continue}if(ae==='"'||ae==="'"||ae==="`"){V=ae,F++;continue}if(ae==="(")z++;else if(ae===")"){if(z--,z===0)break}F++}if(z!==0)break;let G=k.substring(B+1,F).trim(),ne=k.substring(j,F+1),J=-1,re=0,se=null,ie=!1;for(let ae=0;ae<G.length;ae++){let me=G[ae];if(ie){ie=!1;continue}if(me==="\\"&&se){ie=!0;continue}if(se){if(me===se)se=null;continue}if(me==='"'||me==="'"||me==="`"){se=me;continue}if(me==="("||me==="["||me==="{")re++;else if(me===")"||me==="]"||me==="}")re--;if(me===","&&re===0){J=ae;break}}let oe=J>=0?G.substring(0,J).trim():G,de=J>=0?G.substring(J+1).trim():void 0;try{let ae=oe.trim(),me;if(p(ae))me=l(ae,Object.keys(_))(...Object.values(_));else me=void 0;let ve;if(de==="true")ve=JSON.stringify(me,null,2);else ve=JSON.stringify(me);let Se=ve.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,j)+Se+k.substring(F+1),E.lastIndex=j+Se.length}catch(ae){A.log(ae instanceof Error?ae:Error(String(ae)),{directive:"@json"},"error"),E.lastIndex=j+ne.length}}return k}function bs(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function
|
|
2024
|
+
</style>`;E=E.replace(V,oe),z.lastIndex=0}catch(ie){}}}return E}function ys(v,_){let k=v,E=/@json\s*\(/g,T;while((T=E.exec(k))!==null){let j=T.index,B=j+T[0].length-1,z=1,F=B+1,V=null,H=!1;while(F<k.length&&z>0){let ae=k[F];if(H){H=!1,F++;continue}if(ae==="\\"&&V){H=!0,F++;continue}if(V){if(ae===V)V=null;F++;continue}if(ae==='"'||ae==="'"||ae==="`"){V=ae,F++;continue}if(ae==="(")z++;else if(ae===")"){if(z--,z===0)break}F++}if(z!==0)break;let G=k.substring(B+1,F).trim(),ne=k.substring(j,F+1),J=-1,re=0,se=null,ie=!1;for(let ae=0;ae<G.length;ae++){let me=G[ae];if(ie){ie=!1;continue}if(me==="\\"&&se){ie=!0;continue}if(se){if(me===se)se=null;continue}if(me==='"'||me==="'"||me==="`"){se=me;continue}if(me==="("||me==="["||me==="{")re++;else if(me===")"||me==="]"||me==="}")re--;if(me===","&&re===0){J=ae;break}}let oe=J>=0?G.substring(0,J).trim():G,de=J>=0?G.substring(J+1).trim():void 0;try{let ae=oe.trim(),me;if(p(ae))me=l(ae,Object.keys(_))(...Object.values(_));else me=void 0;let ve;if(de==="true")ve=JSON.stringify(me,null,2);else ve=JSON.stringify(me);let Se=ve.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,j)+Se+k.substring(F+1),E.lastIndex=j+Se.length}catch(ae){A.log(ae instanceof Error?ae:Error(String(ae)),{directive:"@json"},"error"),E.lastIndex=j+ne.length}}return k}function bs(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function wm(v){let _=v,k=/@memo\s*\(/g,E,T=[];while((E=k.exec(_))!==null){let j=E.index,B=j+E[0].length,z=1,F=B;while(F<_.length&&z>0){if(_[F]==="(")z++;else if(_[F]===")")z--;F++}if(z!==0)continue;let V=_.slice(B,F-1).trim(),H=F,G=_.slice(H),ne=G.indexOf("@endmemo");if(ne===-1)continue;let J=G.slice(0,ne),re=H+ne+8,se=J.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),ie=se?se[0].length:0,oe=J.slice(ie),de=J.match(/(\s*)$/),ae=de?de[0].length:0,me=oe.slice(0,oe.length-ae),ve=me.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),Se;if(ve){let[$e,Re,Ee="",Te]=ve,Ce=`<${Re}${Ee} data-stx-memo="${V}"${Te}>`;Se=J.slice(0,ie)+Ce+me.slice($e.length)+J.slice(ie+me.length)}else Se=`${J.slice(0,ie)}<div data-stx-memo="${V}">${me}</div>${J.slice(ie+me.length)}`;T.push({start:j,end:re,replacement:Se}),k.lastIndex=re}for(let j=T.length-1;j>=0;j--){let B=T[j];_=_.slice(0,B.start)+B.replacement+_.slice(B.end)}return _.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function ql(v){let _=v.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return _=_.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),_}function Sm(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,E=lr(v,(F,V)=>{k.lastIndex=V;let H=k.exec(F);if(!H||/^(?:script|style)$/i.test(H[1]))return-1;return k.lastIndex}),T=[],j=0,B=0,z=[];for(let{start:F,end:V,token:H}of E){let G=/^<\/?([\w-]+)/.exec(H)[1].toLowerCase();if(H.startsWith("</")){let J;while(J=T.pop()){if(J.scoped)j--;if(J.name===G)break}continue}let ne=/\sdata-stx-scope\s*=/.test(H);if(!j&&!ne&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(H)&&!/\sdata-stx-ref-caller\s*=/.test(H))z.push(v.slice(B,F),H.replace(/\s*\/?>$/,(J)=>` data-stx-ref-caller="${_}"${J}`)),B=V;if(!$m.has(G)&&!/\/>$/.test(H)){if(T.push({name:G,scoped:ne}),ne)j++}}return z.push(v.slice(B)),z.join("")}var $m=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_m=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,xm=/<\/?\s*([a-z][\w-]*)/iy,lS=/\s/;function uS(v,_){let k=_-1;while(k>=0&&lS.test(v[k]))k--;return k>=0&&v[k]==="/"}function dS(v,_){let k=!1,E=!1;for(let T=_;T<v.length;T++){let j=v[T];if(k){if(j==="'")k=!1}else if(E){if(j==='"')E=!1}else if(j==="'")k=!0;else if(j==='"')E=!0;else if(j===">")return T}return-1}function fS(v,_){if(v.indexOf("{",_)===-1||v.indexOf("}",_)===-1)return!1;let k=0,E=_,T=!1,j=!1,B=!1;while(E<v.length){let z=v.indexOf("<",E),F=z===-1?v.length:z;if(F>E){if(k===0)while(E<F){let G=v.indexOf(j?"}":"{",E);if(G===-1||G>=F){if(j)B=!1;else T=!1;break}if(G>E)if(j)B=!1;else T=!1;if(j){if(B)return!0;B=!0}else if(T)j=!0,B=!1;else T=!0;E=G+1}E=F;continue}if(v.startsWith("<!--",E)){let G=v.indexOf("-->",E);E=G===-1?v.length:G+3;continue}let V=dS(v,E);if(V===-1)break;xm.lastIndex=E;let H=xm.exec(v)?.[1]?.toLowerCase()??"";if(v[E+1]==="/"){if(k===0)break;k--}else if(!uS(v,V)&&!$m.has(H))k++;E=V+1}return!1}var bm=m(256);function km(v){if(v.length<1024)return vm(v);let _=h(v),k=bm.get(_);if(k!==void 0)return k;let E=vm(v);return bm.set(_,E),E}function vm(v){if(v.length>=32768&&!Dd(v))return v;let k=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),E="",T=0,j;while((j=k.exec(v))!==null){let B=j.index,z=B+j[0].length,F=!1,V=!1,H=-1;while(z<v.length){let ne=v[z];if(F){if(ne==="'")F=!1}else if(V){if(ne==='"')V=!1}else if(ne==="'")F=!0;else if(ne==='"')V=!0;else if(ne===">"){H=z;break}z++}if(H===-1)continue;let G=v.slice(B,H+1);if(_m.test(G))continue;if(G.includes("x-cloak"))continue;if(fS(v,H+1))E+=v.slice(T,H)+" x-cloak>",T=H+1}return E+=v.slice(T),E}var pS=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,gS=/<\/script>/gi,mS=/<\/style>/gi;function Em(v){let _=/<[a-z][\w-]*/gi,k="",E=0,T;while((T=_.exec(v))!==null){let j=T.index,B=T[0].slice(1).toLowerCase();if(B==="script"||B==="style"){let re=B==="script"?gS:mS;re.lastIndex=j;let se=re.exec(v);if(se!==null)_.lastIndex=se.index+se[0].length;continue}let z=j+T[0].length,F=!1,V=!1,H=-1;while(z<v.length){let re=v[z];if(F){if(re==="'")F=!1}else if(V){if(re==='"')V=!1}else if(re==="'")F=!0;else if(re==='"')V=!0;else if(re===">"){H=z;break}z++}if(H===-1)continue;let G=v.slice(j+T[0].length,H);if(_m.test(G))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(G))continue;if(!pS.test(G))continue;let ne=v[H-1]==="/",J=ne?H-1:H;k+=`${v.slice(E,J)} x-cloak${ne?" ":""}`,E=J}return k+=v.slice(E),k}var Kl=m(256),hS=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or, where this must run before first paint and the runtime does not exist yet, the colorMode config for a light/dark theme, or @appearanceBootstrap when there is a second appearance axis"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}],Cm=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function yS(v){let _=Array.from(v,(T)=>T===`
|
|
2026
2025
|
`?`
|
|
2027
2026
|
`:" "),k=0,E="";while(k<v.length){let T=v[k],j=v[k+1];if(E){if(T==="\\"){k+=2;continue}if(T===E)E="";k++;continue}if(T==='"'||T==="'"||T==="`"){E=T,k++;continue}if(T==="/"&&j==="/"){while(k<v.length&&v[k]!==`
|
|
2028
|
-
`)_[k]=v[k],k++;continue}if(T==="/"&&j==="*"){let B=v.indexOf("*/",k+2),z=B===-1?v.length:B+2;for(;k<z;k++)_[k]=v[k];continue}if(T==="{"&&j==="{"&&v.slice(k,k+4)==="{{--"){let B=v.indexOf("--}}",k+4),z=B===-1?v.length:B+4;for(;k<z;k++)_[k]=v[k];continue}k++}return _.join("")}function
|
|
2027
|
+
`)_[k]=v[k],k++;continue}if(T==="/"&&j==="*"){let B=v.indexOf("*/",k+2),z=B===-1?v.length:B+2;for(;k<z;k++)_[k]=v[k];continue}if(T==="{"&&j==="{"&&v.slice(k,k+4)==="{{--"){let B=v.indexOf("--}}",k+4),z=B===-1?v.length:B+4;for(;k<z;k++)_[k]=v[k];continue}k++}return _.join("")}function xS(v){let _=new Map,k=yS(v).split(`
|
|
2029
2028
|
`),E=v.split(`
|
|
2030
|
-
`);return k.forEach((T,j)=>{
|
|
2029
|
+
`);return k.forEach((T,j)=>{Cm.lastIndex=0;for(let B of T.matchAll(Cm)){let z=B[1]==="-next-line",F=(E[j]??"").slice(0,B.index).trim(),V=z||F===""?j+2:j+1,G=(B[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),ne=G.filter((re)=>/\w/.test(re));if(G.length>0&&ne.length===0)continue;let J=_.get(V);if(J&&J.size===0)continue;if(ne.length===0){_.set(V,new Set);continue}if(J)ne.forEach((re)=>J.add(re));else _.set(V,new Set(ne))}}),_}function bS(v,_,k){let E=v.get(_);if(!E)return!1;if(E.size===0)return!0;return[...E].some((T)=>k.includes(T))}function ws(v,_,k,E){let T=typeof k==="boolean"?{enabled:k,failOnViolation:k}:k??{enabled:!1};if(!T.enabled)return;let j=h(v,_,E,JSON.stringify(T)),B=Kl.get(j);if(B!==void 0){if(B&&T.failOnViolation)throw Error(B);return}let z=T.allowPatterns??[],F=xS(v),V=[],H=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(re)=>re.replace(/[^\n]/g," ")));for(let{pattern:re,message:se,suggestion:ie}of hS){if(z.some((de)=>/\w/.test(de)&&se.includes(de)))continue;re.lastIndex=0;let oe=H.match(re);if(oe&&oe.length>0){let de=H.split(`
|
|
2031
2030
|
`),ae=v.split(`
|
|
2032
|
-
`),me=[];if(de.forEach((Re,Ee)=>{if(re.lastIndex=0,re.test(Re)&&!
|
|
2031
|
+
`),me=[];if(de.forEach((Re,Ee)=>{if(re.lastIndex=0,re.test(Re)&&!bS(F,Ee+1,se))me.push(Ee+1)}),me.length===0&&de.some((Re)=>(re.lastIndex=0,re.test(Re))))continue;let ve=me.length>0?` (script line${me.length>1?"s":""} ${me.join(", ")})`:"",Se=me.slice(0,3).map((Re)=>` ${Re} | ${(ae[Re-1]??"").trim().slice(0,100)}`).join(`
|
|
2033
2032
|
`),$e=Se?`
|
|
2034
2033
|
${Se}`:"";V.push(` \u2717 ${se}${ve}
|
|
2035
|
-
\u2192 ${ie}${$e}`)}}if(V.length===0){
|
|
2034
|
+
\u2192 ${ie}${$e}`)}}if(V.length===0){Kl.set(j,"");return}let G=(re)=>{let se=`${process.cwd()}/`;return re.startsWith(se)?re.slice(se.length):re},J=`[STX] DOM API violation in ${E&&E!==_?`${G(E)} (composed into ${G(_)})`:G(_)}:
|
|
2036
2035
|
${V.join(`
|
|
2037
2036
|
`)}
|
|
2038
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(
|
|
2037
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(Kl.set(j,J),T.failOnViolation)throw Error(J);else console.warn(J)}import Xl from"path";var vS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,wS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function SS(v,_){if(!_||!v.includes("/"))return v;let k=Xl.dirname(_);return v.replace(vS,(E,T,j,B)=>{let z=Xl.resolve(k,B);return`${T}${j}${z.split(Xl.sep).join("/")}${j}`})}function Rm(v,_){if(!_||!v.includes("<script"))return v;return v.replace(wS,(k,E,T,j)=>`${E}${SS(T,_)}${j}`)}var Lr="<!--PARENT_CONTENT_PLACEHOLDER-->";function Tm(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Nm(v,_){let k=v.length,E=_,T=!0,j=[],B=(z)=>z+9<=k&&v[z]==="<"&&v[z+1]==="/"&&(v[z+2]==="s"||v[z+2]==="S")&&(v[z+3]==="c"||v[z+3]==="C")&&(v[z+4]==="r"||v[z+4]==="R")&&(v[z+5]==="i"||v[z+5]==="I")&&(v[z+6]==="p"||v[z+6]==="P")&&(v[z+7]==="t"||v[z+7]==="T")&&(v[z+8]===">"||/\s/.test(v[z+8]));while(E<k){let z=v[E];if(B(E))return E;if(z==="/"&&v[E+1]==="/"){if(E=v.indexOf(`
|
|
2039
2038
|
`,E+2),E===-1)return-1;E+=1,T=!0;continue}if(z==="/"&&v[E+1]==="*"){let F=v.indexOf("*/",E+2);if(F===-1)return-1;E=F+2,T=!0;continue}if(z==="/"&&T){let F=E+1,V=!1;while(F<k){let H=v[F];if(H==="\\"){F+=2;continue}if(H==="[")V=!0;else if(H==="]")V=!1;else if(H==="/"&&!V){F++;break}else if(H===`
|
|
2040
2039
|
`){F=-1;break}F++}if(F===-1){E++,T=!1;continue}while(F<k&&/[a-z]/.test(v[F]))F++;E=F,T=!1;continue}if(z==="'"||z==='"'){let F=z;E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]===F){E++;break}if(v[E]===`
|
|
2041
|
-
`)break;E++}T=!1;continue}if(z==="`"){E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]==="`"){E++;break}if(v[E]==="$"&&v[E+1]==="{"){j.push(!0),E+=2,T=!0;break}E++}if(j.length===0)T=!1;continue}if(z==="}"&&j.length>0){j.pop(),E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]==="`"){E++,T=!1;break}if(v[E]==="$"&&v[E+1]==="{"){j.push(!0),E+=2,T=!0;break}E++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))T=!1;else T=!0;E++}return-1}function
|
|
2042
|
-
`+v.slice(E,k.start)+v.slice(k.end);let T=v.slice(k.start,k.end),j=v.slice(0,k.start)+v.slice(k.end),B=
|
|
2040
|
+
`)break;E++}T=!1;continue}if(z==="`"){E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]==="`"){E++;break}if(v[E]==="$"&&v[E+1]==="{"){j.push(!0),E+=2,T=!0;break}E++}if(j.length===0)T=!1;continue}if(z==="}"&&j.length>0){j.pop(),E++;while(E<k){if(v[E]==="\\"){E+=2;continue}if(v[E]==="`"){E++,T=!1;break}if(v[E]==="$"&&v[E+1]==="{"){j.push(!0),E+=2,T=!0;break}E++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))T=!1;else T=!0;E++}return-1}function jm(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),E=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!E)return null;let T=E.index+E[0].length,j=v.indexOf("</script>",T);if(j===-1)return null;let B=v.indexOf(">",j);if(B===-1)return null;return{start:E.index,end:B+1}}var _S=4096;async function Am(v,_,k){if(k.buildMode!=="serve"||_.length<_S)return null;let{registerServeModuleBundle:E}=await import("./chunk-3sscb1dw.js");return`<script ${v} src="${E(_)}"></script>`}async function Im(v,_,k){try{let{registeredModuleIdsIn:E,buildModuleRegistryScript:T}=await ft("stx/client-module-registry",()=>import("./chunk-9cskmz6f.js")),j=[],B=await T(E(...v),{minify:_.buildMode==="compile",collectInputs:j});for(let z of j)k?.add(z);if(!B)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:z}=await import("./chunk-3sscb1dw.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${z(B)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${B.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function kS(v,_=""){let k=jm(v,"data-stx-runtime");if(!k)return v;let E=xi(v);if(E===-1||E===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(E<k.start)return v.slice(0,E)+v.slice(k.start,k.end)+_+`
|
|
2041
|
+
`+v.slice(E,k.start)+v.slice(k.end);let T=v.slice(k.start,k.end),j=v.slice(0,k.start)+v.slice(k.end),B=xi(j);if(B===-1)return T+_+`
|
|
2043
2042
|
`+j;return j.slice(0,B)+T+_+`
|
|
2044
|
-
`+j.slice(B)}function
|
|
2045
|
-
`),...V.htmlAttrs&&{htmlAttrs:
|
|
2046
|
-
<meta name="stx-layout" content="${
|
|
2047
|
-
<meta name="stx-layout-group" content="${
|
|
2048
|
-
${re}`).join("");B=
|
|
2049
|
-
`+B.slice(V)}}if(j)B=
|
|
2043
|
+
`+j.slice(B)}function ES(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,E,T)=>{let j=v.slice(0,T);return j.lastIndexOf("<")>j.lastIndexOf(">")?`{{${E}}}`:`{<!--stx-literal-->{${E}}}`})}async function n(v,_,k,E,T){if(E.ssr===!1&&!E.autoShell&&E.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=ye(v,k);let j=!_.__stxProcessingDepth;sn(_);for(let B of E._layerGraph?.configDependencies??[])T.add(B);if(j&&E.runtimeConfig)await ln(_,k,E.runtimeConfig);if(j)$d(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Ml(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((E.debug||!ge()&&!gn())&&k&&k.endsWith(".stx"))js(v,k);try{return await U.timeAsync("template-processing",async()=>{let B=await CS(v,_,k,E,T);if(j)B=ql(B);if(j&&E.autoShell&&E.buildMode!=="compile"){let z=pe(E.app?.head,{known:dn,source:"app.head"}),V=(_.__stx_runtime_head||null)??Rs(),H=(_.__stx_head_raw||"").trim(),G,ne=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(ne)G=ne[1].trim(),H=H.replace(ne[0],"").trim();let J=_.__sections?.title,re=V.title||G||J,se=!V.title&&(!!G||!!J),ie=V.meta||[],oe=new Set(ie.map(($e)=>vr($e)).filter(Boolean)),de={...z,...re&&{title:re},meta:[...(z.meta||[]).filter(($e)=>!oe.has(vr($e))),...ie],link:[...z.link||[],...V.link||[]],script:[...z.script||[],...V.script||[]],headRaw:[z.headRaw,H].filter(Boolean).join(`
|
|
2044
|
+
`),...V.htmlAttrs&&{htmlAttrs:Jg(z.htmlAttrs,V.htmlAttrs)},...V.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...V.bodyAttrs}}},ae=Fl(B);if(B=Wn(B,de,{...se&&{titleIsHtml:!0},...E.app?.colorMode&&{colorMode:E.app.colorMode}},ae),ae)B=Qg(B,z),B=Un(B,de.htmlAttrs);let me=B.match(/<!-- stx-layout: ([^ ]+) -->/);if(me&&B.includes("<head")){let $e=me[1],Re=ur($e);B=B.replace(/<head\b[^>]*>/i,(Ee)=>`${Ee}
|
|
2045
|
+
<meta name="stx-layout" content="${Tm($e)}">
|
|
2046
|
+
<meta name="stx-layout-group" content="${Tm(Re)}">`)}let ve=B.match(/function (__stx_setup_\w+)\(/),Se=ve?An(B):null;if(ve&&Se&&!/\bdata-stx=/.test(Se.tag)){B=Ns(B,(Re,Ee)=>`<body${Ee} data-stx="${ve[1]}">`);let $e=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${ve[1]}"`,"i");B=B.replace($e,"$1")}}if(j){let z=_.__stx_head_injections??Ml(),F=Yg(B);if(F!==null)z.beforeClose.push(F);let V=Wg(B);if(V!==null)z.afterOpen.push(V);if(E.offline?.enabled&&!B.includes("data-stx-offline"))z.beforeClose.push(Vg);B=jg(B,z);let H=E.app?.colorMode;if(H)B=Vn(B,H)}if(j)if(jm(B,"data-stx-runtime")){let F=null,V=null,H=null,G=null,ne=null;try{let{getStoreScript:re}=await ft("stx/store-loader",()=>import("./chunk-qa3ts1cb.js")),se=E.storesDir,ie=await re(se);if(ie)H=`<script data-stx-stores>${ie}</script>`,V=await Am("data-stx-stores",ie,E)??H}catch{}F=await Im([B,H],E,T);try{let{getFrameworkComposableScript:re}=await ft("stx/framework-composables",()=>import("./chunk-fk10wpkj.js"));ne=await re(B)}catch{}try{let{getComposableScript:re}=await ft("stx/composable-loader",()=>import("./chunk-77m49nv1.js")),se=E.composablesDir,ie=[F,H,ne].filter((de)=>de!==null),oe=await re(E._layerComposableDirs??se,B,ie);if(oe)G=await Am('data-stx-scoped data-stx-run="always" data-stx-composables',oe,E)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${oe}</script>`}catch{}let J=[F,V,G,ne].filter((re)=>re!==null).map((re)=>`
|
|
2047
|
+
${re}`).join("");B=kS(B,J)}else{let F=await Im([B],E,T);if(F){let V=B.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(V!==-1)B=B.slice(0,V)+F+`
|
|
2048
|
+
`+B.slice(V)}}if(j)B=Fg(B);if(j&&_.__stx_inject_css!==!1)B=await f(B,void 0,E.buildMode==="serve",!0);else if(j)B=fi(B);if(B=B.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),B=ES(B),j&&_.__stx_runtime_config)B=Ke(B,_.__stx_runtime_config);if(j&&!_.__stx_defer_server_data){let z=Hn(_);if(z){let F=/<head\b[^>]*>/i.exec(B),V=F?F.index+F[0].length:0;B=B.slice(0,V)+z+B.slice(V)}}return B})}catch(B){if(B instanceof sr)throw B;let z=B instanceof Error?B.message:String(B),F=new X(`Template processing failed: ${z}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(A.log(F,{filePath:k,context:_}),_t.logDetailedError(F,{filePath:k,template:v.substring(0,500)}),E.debug)throw F;return As.createFallbackContent("Template Processing",F)}}async function CS(v,_,k,E,T){let j=process.cwd(),B={...E,partialsDir:E.partialsDir&&!Jt.isAbsolute(E.partialsDir)?Jt.resolve(j,E.partialsDir):E.partialsDir,componentsDir:E.componentsDir&&!Jt.isAbsolute(E.componentsDir)?Jt.resolve(j,E.componentsDir):E.componentsDir,layoutsDir:E.layoutsDir&&!Jt.isAbsolute(E.layoutsDir)?Jt.resolve(j,E.layoutsDir):E.layoutsDir},z=B,F=v;await AS(k,_),TS(_,z),F=await te(()=>Eg(F,_,k,z),F,(ve)=>{A.log(ve,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${ve.message}`)}),F=F.replace(/\{\{--[\s\S]*?--\}\}/g,"");let V=En(F,Le,(ve,Se)=>`\x00STX_HTML_COMMENT_${Se}\x00`);F=V.output;let H=V.tokens,G=(ve)=>H.length===0?ve:ve.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(Se,$e)=>H[Number($e)]??""),ne="\x00STX_ESCAPED_AT\x00",J="\x00STX_ESC_MUSTACHE_OPEN\x00",re="\x00STX_ESC_MUSTACHE_CLOSE\x00";F=F.replace(/@@/g,ne),F=F.replace(/@\{\{([\s\S]*?)\}\}/g,(ve,Se)=>`${J}${Se}${re}`),F=Ig(F),F=await ym(F,k,T);let se={};F=gs(F,se);let ie={..._.__sections||{}},oe="",de=Df(je(v)),ae=/@nolayout\b/.test(F)||de===!1;if(/@nolayout\b/.test(F))F=F.replace(/@nolayout\b\s*/g,"");let me=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(me)oe=me[1],F=F.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof de==="string"){if(oe=de,!/@section\s*\(/.test(F))F=`@section('content')
|
|
2050
2049
|
${F.trim()}
|
|
2051
2050
|
@endsection`}if(!oe&&!ae&&z.defaultLayout){let ve=on(F),Se=/@section\s*\(/.test(F);if(!ve||Se){let $e="",Re=Jt.dirname(k),Ee=z.layoutsDir?Jt.dirname(z.layoutsDir):process.cwd();for(let Te=0;Te<20;Te++){let Ce=Jt.join(Re,"_layout.stx");if(await r(Ce)){$e=Ce;break}let _e=Jt.dirname(Re);if(_e===Re||_e.length<Ee.length)break;Re=_e}if($e)oe=$e;else if(z.layoutsDir){let Te=Jt.isAbsolute(z.layoutsDir)?z.layoutsDir:Jt.resolve(process.cwd(),z.layoutsDir),Ce=Jt.join(Te,`${z.defaultLayout}.stx`);if(await r(Ce))oe=Ce}if(oe&&!Se)F=`@section('content')
|
|
2052
2051
|
${F.trim()}
|
|
2053
|
-
@endsection`}}if(oe&&F.includes("<script")){let ve=xn(F),Se=ve.scripts.map(($e)=>
|
|
2052
|
+
@endsection`}}if(oe&&F.includes("<script")){let ve=xn(F),Se=ve.scripts.map(($e)=>Pm($e,k)??$e);F=Is(ve.output,Se)}if(F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(ve,Se,$e)=>(ie[Se]=$e,"")),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(ve,Se,$e)=>{if(/^(['"]).*\1$/.test($e.trim()))return ve;try{let Re=c($e.trim(),_);if(Re===void 0)return ve;return ie[Se]=String(Re??""),""}catch{return ve}}),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(ve,Se,$e)=>{if($e.includes("@parent"))ie[Se]=$e.replace("@parent",Lr);else ie[Se]=$e.trim();return""}),_.__sections=ie,F=F.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(ve,Se,$e)=>ie[Se]||$e||""),!("slot"in _)||_.slot===void 0)F=F.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||"");if(F=ms(F,se),oe){let ve=[],Se=xn(F),$e=En(Se.output,Ss,(Re,Ee)=>`\x00STX_ORPHAN_STYLE_${Ee}\x00`);if(F=$e.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Re,Ee,Te)=>{let Ce=Ee==="SCRIPT"?Pm(Se.scripts[Number(Te)],k):$e.tokens[Number(Te)];if(Ce)ve.push(Ce);return""}),ve.length>0){let Re=ve.join(`
|
|
2054
2053
|
`);ie.content=ie.content?`${ie.content}
|
|
2055
|
-
${Re}`:Re,_.__sections=ie}}if(oe)try{let ve;if(Jt.isAbsolute(oe))ve=oe,T.add(oe);else ve=await te(()=>Kn(oe,k,B,T),null,()=>{throw new X(`Failed to resolve layout path: ${oe}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!ve){let Ce=(Xe)=>{if(!Xe)return[];try{let Pe=Jt.isAbsolute(Xe)?Xe:Jt.resolve(process.cwd(),Xe);return
|
|
2056
|
-
${F}`,G(F)}catch(ve){return A.log(ve instanceof Error?ve:Error(String(ve)),{layoutPath:oe,filePath:k},"error"),`[Error processing layout: ${ve instanceof Error?ve.message:String(ve)}]`}return G(await
|
|
2057
|
-
`;if(j=Te(j,_),j=Ce(j,_,k),j=
|
|
2054
|
+
${Re}`:Re,_.__sections=ie}}if(oe)try{let ve;if(Jt.isAbsolute(oe))ve=oe,T.add(oe);else ve=await te(()=>Kn(oe,k,B,T),null,()=>{throw new X(`Failed to resolve layout path: ${oe}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!ve){let Ce=(Xe)=>{if(!Xe)return[];try{let Pe=Jt.isAbsolute(Xe)?Xe:Jt.resolve(process.cwd(),Xe);return $S.readdirSync(Pe).filter((Ae)=>Ae.endsWith(".stx")).map((Ae)=>Ae.replace(/\.stx$/,""))}catch{return[]}},_e=[...Ce(B.layoutsDir),...Ce(B.fallbackLayoutsDir)].filter((Xe,Pe,Ae)=>Ae.indexOf(Xe)===Pe).sort(),Ie=`Layout not found: ${oe} (referenced from ${k})`+(_e.length>0?`. Available layouts: ${_e.join(", ")}`:B.layoutsDir?`. No .stx layouts found in ${B.layoutsDir}`:"");if(A.log(Error(Ie),{layoutPath:oe,filePath:k,available:_e},"error"),console.error(`[stx] ${Ie}`),B.debug)throw new X(Ie,k);return F}let Se=await te(()=>Bun.file(ve).text(),"",()=>{throw new X(`Failed to read layout file: ${ve}`,k,void 0,void 0,"Layout content could not be loaded")});Se=Rm(Se,ve);let $e=Se.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if($e){if(B.debug)console.log(`Found nested layout: ${$e[1]} in ${ve}`);let Ce={},_e=Se.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Pe,Ae,Ze)=>(Ce[Ae]=Ze.trim(),""));for(let[Pe,Ae]of Object.entries(Ce))if(ie[Pe]&&ie[Pe].includes(Lr)){let Ze=ie[Pe].indexOf(Lr);ie[Pe]=ie[Pe].slice(0,Ze)+Ae+ie[Pe].slice(Ze+Lr.length)}else if(!ie[Pe])ie[Pe]=Ae;let Ie={..._,__sections:ie},Xe=`@layout('${$e[1]}')${_e}`;return await n(Xe,Ie,ve,B,T)}let Re=Se.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ee=gs(Re,se),Te={};return Ee=Ee.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Ce,_e,Ie)=>(Te[_e]=Ie.trim(),`@slot('${_e}')`)),Ee=Ee.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Ce,_e,Ie)=>{if(ie[_e]){let Xe=ie[_e];if(Xe.includes(Lr)){let Pe=Te[_e]||"",Ae=Xe.indexOf(Lr);Xe=Xe.slice(0,Ae)+Pe+Xe.slice(Ae+Lr.length)}return Xe}return Ie||""}),Ee=RS(Ee,ie),Ee=Ee.replace(/\{\{\s*slot\s*\}\}/g,()=>ie.content||""),Ee=ms(Ee,se),_.__originalFilePath=k,F=await Om(Ee,_,ve,B,T),F=`<!-- stx-layout: ${oe} -->
|
|
2055
|
+
${F}`,G(F)}catch(ve){return A.log(ve instanceof Error?ve:Error(String(ve)),{layoutPath:oe,filePath:k},"error"),`[Error processing layout: ${ve instanceof Error?ve.message:String(ve)}]`}return G(await Om(F,_,k,B,T))}function RS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,E,T)=>{let j=_[E];if(j!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${E.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(j))return j}return T||""})}function TS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",E={};for(let[T,j]of Object.entries(process.env))if(T.startsWith(k)&&j!==void 0)E[T]=j;v.$env=E}async function AS(v,_){await te(()=>Tg(v,_),void 0,(k)=>{A.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Zl="data-stx-source";function Pm(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Zl))return v;return`<script ${Zl}="${encodeURIComponent(_)}"${v.slice(7)}`}function IS(v){let _=new RegExp(`${Zl}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function Dm(v){return v.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Mm(v,_,k){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${_==="module-resolution"?"imports a module that does not resolve":_==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${Dm(v)}</span><span style="display:block;margin-top:4px">${Dm(k)}</span></div>`}async function PS(v,_,k,E){let{scanScriptTags:T}=await ft("stx/signal-processing",()=>import("./chunk-nepqqe3b.js")),j=[],B=!ge()&&!gn();for(let F of T(v)){let V=F.attrs;if(!/\bserver\b/.test(V))continue;let H=F.start+F.fullMatch.indexOf(">")+1,G=Nm(v,H);if(G===-1)continue;let ne=v.slice(H,G);if(!ne.trim())continue;let J=IS(V)??k,re={index:F.start,length:G+9-F.start};try{let{extractVariables:se}=await ft("stx/variable-extractor",()=>import("./chunk-trz5bkxe.js"));await se(ne,_,J,{preserveExisting:!0,onFailure:(ie)=>{if(ie.kind==="unknown")return;if(E?.onServerScriptError?.({sourcePath:J,kind:ie.kind,message:ie.message}),!B)return;j.push({...re,markup:Mm(J,ie.kind,ie.message)})}})}catch(se){let ie=se instanceof Error?se:Error(String(se));if(A.log(ie,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${ie.message}`),B)j.push({...re,markup:Mm(J,"unknown",ie.message)})}}if(j.length===0)return v;let z=v;for(let F of j.sort((V,H)=>H.index-V.index))z=z.slice(0,F.index)+F.markup+z.slice(F.index+F.length);return z}async function DS(v,_,k){try{let{interpolateScriptsInTemplate:E}=await ft("stx/expressions",()=>import("./chunk-yw9h2zty.js"));return E(v,_,{skipServer:!0})}catch(E){let T=E instanceof Error?E:Error(String(E));return A.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function Om(v,_,k,E,T){let j=v,B=E;if(j=await PS(j,_,k,E),j=await DS(j,_,k),j=await gg(j,_,k),j=await mg(j,_,k),j=await Xf(j,_,k,B),ye(j))j=ei(j,_),j=ls(j,_),j=cs(j,_);j=ti(j);let{processStreamDirectives:z}=await ft("stx/streaming",()=>import("./chunk-yx89t1we.js"));j=z(j,_),j=ii(j,_,k,B,!0),j=await Og(j,_,k,B,T),j=await os(j,_,k,B,T),j=qu(j,_,k,B);let{processDeferDirectives:F}=await ft("stx/defer",()=>import("./chunk-yed9c66h.js"));j=F(j,_,k);let{processTeleportDirectives:V}=await ft("stx/teleport",()=>import("./chunk-w0vrmvh7.js"));j=V(j,_,k);let{processTransitionDirectives:H,processTransitionAttributes:G}=await ft("stx/transitions",()=>import("./chunk-5y4qxmaw.js"));j=H(j,_,k),j=G(j);let{processErrorBoundaryDirectives:ne,stripRenderFailedMarkers:J}=await ft("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));j=ne(j,_,k),j=J(j);let{processSuspenseDirectives:re}=await ft("stx/suspense",()=>import("./chunk-st1s30tn.js"));j=re(j,_,k);let{processAsyncDirectives:se}=await ft("stx/async-components",()=>import("./chunk-3gbjppvg.js"));j=se(j,_,k);let{processKeepAliveDirectives:ie}=await ft("stx/keep-alive",()=>import("./chunk-v7ahbhbd.js"));j=ie(j,_,k);let{processVirtualListDirectives:oe,processVirtualGridDirectives:de,processInfiniteListDirectives:ae}=await ft("stx/virtual-scrolling",()=>import("./chunk-j338fs8k.js"));j=oe(j,_,k),j=de(j,_,k),j=ae(j,_,k);let{processPartialHydrationDirectives:me,processStaticDirectives:ve}=await ft("stx/partial-hydration",()=>import("./chunk-8mxjd1ge.js"));j=me(j,_,k),j=ve(j);let{processComputedDirectives:Se,processWatchDirectives:$e}=await ft("stx/computed",()=>import("./chunk-1xdzcy9d.js"));j=Se(j,_,k),j=$e(j,_,k);let{processFormValidationDirectives:Re}=await ft("stx/forms-validation",()=>import("./chunk-fe5xht52.js"));j=Re(j,_,k);let{processHeadDirective:Ee,processTitleDirective:Te,processMetaDirective:Ce,resetHead:_e}=await ft("stx/head",()=>import("./chunk-4aw47rmg.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)_e();let Ie=Ee(j);if(j=Ie.content,Ie.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${Ie.headContent}
|
|
2056
|
+
`;if(j=Te(j,_),j=Ce(j,_,k),j=Rg(j),j=Hc(j,_),j=Kf(j),j=_g(j),j=await ps(j,_,k,B,T),j=await os(j,_,k,B,T),_.__stxProcessingDepth===1)j=_d(j,_);if(j=j.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),j=ql(j),j=ir(j,_,k),j=ds(j),j=Mf(j,_,{filePath:k,buildMode:B.buildMode}),j=qc(j,_),j=Kc(j,_),j=bo(j,_),j=tp(j,_),j=np(j,_),j=await Bm(j,_,k,B),j=await Lm(j,_,k),j=await di(j,_,k,B),j=pi(j,_,k,B),j=Cs(j,_,k,B),j=$s(j,_,k),j=Es(j,_,k,B),j=Hf(j,_,k,B),j=ys(j,_),j=bs(j),j=wm(j),!B.skipEventDirectives)j=sd(j,_,k);if(j=jf(j,_,k),B.debug){let Qe=/\bx-data\s*=/.test(j),lt=as(v);if(Qe&<)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
2058
2057
|
Both work on the same page, but they manage separate scopes.
|
|
2059
|
-
Prefer signals (state/derived/effect) for new components.`)}j=
|
|
2058
|
+
Prefer signals (state/derived/effect) for new components.`)}j=Lp(j,_),j=await q(j,_,k),j=km(j),j=Em(j),j=If(j);let{processXElementDirectives:Xe}=await ft("stx/x-element",()=>import("./chunk-zhxdpzga.js"));j=Xe(j);let Pe=_.__originalFilePath||k,Ae=Ne(_);if(j=await ni(j,B,Pe,Ae),j=Yf(j,_),j=await Cg(j,_,k,B),B.media?.image?.autoSiblings){let Qe=B.publicDir||"public",{rewriteImagesWithSiblings:lt}=await ft("stx/image-optimization/auto-sibling",()=>import("./chunk-50vq8k55.js"));j=await lt(j,{publicDir:Qe})}if(B.seo?.enabled)j=_s(j,_,B);let Ze=(Qe,lt,Tt=!0)=>{if(!lt)return Qe;let Nt=lt.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),jt=Qe.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Nt&&jt){if(Tt)Qe=Qe.replace(jt[0],Nt[0]);if(lt=lt.replace(Nt[0],"").trim(),!lt)return Qe}if(/<\/head>/i.test(Qe))return Qe.replace(/<\/head>/i,`${lt}
|
|
2060
2059
|
</head>`);if(/<head\b[^>]*>/i.test(Qe))return Qe.replace(/(<head\b[^>]*>)/i,`$1
|
|
2061
2060
|
${lt}`);if(/<html\b[^>]*>/i.test(Qe))return Qe.replace(/(<html\b[^>]*>)/i,`$1
|
|
2062
2061
|
<head>
|
|
2063
2062
|
${lt}
|
|
2064
|
-
</head>`);return Qe},{renderHead:ct,getHead:it}=await ft("stx/head",()=>import("./chunk-4aw47rmg.js")),gt=_.__stx_runtime_head??it();if(gt.title||gt.meta?.length||gt.link?.length){let Qe=ct(gt);if(Qe)j=Ze(j,Qe)}if(Ie.headContent)j=Ze(j,Ie.headContent,!gt.title);if(B.csp?.enabled&&B.csp.addMetaTag)j=
|
|
2065
|
-
${
|
|
2063
|
+
</head>`);return Qe},{renderHead:ct,getHead:it}=await ft("stx/head",()=>import("./chunk-4aw47rmg.js")),gt=_.__stx_runtime_head??it();if(gt.title||gt.meta?.length||gt.link?.length){let Qe=ct(gt);if(Qe)j=Ze(j,Qe)}if(Ie.headContent)j=Ze(j,Ie.headContent,!gt.title);if(B.csp?.enabled&&B.csp.addMetaTag)j=Vf(j,B.csp,_);if(B.analytics?.enabled)j=Pf(j,B);if(B.heatmap?.enabled)j=Zu(j,B);if(B.pwa?.enabled&&B.pwa.autoInject!==!1){let{injectPwaTags:Qe}=await ft("stx/pwa/inject",()=>import("./chunk-7mh0fnrq.js"));j=Qe(j,B)}let ut=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(j),dt=/\bSTX\.\w+/.test(j),st=/window\.STX\s*=/.test(j);if(ut&&dt&&!st){let lt=`<script data-stx-scoped data-stx-run="once">
|
|
2064
|
+
${Rf()}
|
|
2066
2065
|
</script>`;if(j.includes("</head>")){let Tt=j.indexOf("</head>"),jt=j.slice(0,Tt).indexOf("<script");if(jt!==-1){let hn=j.slice(0,jt),Zt=j.slice(jt);j=hn+lt+`
|
|
2067
2066
|
`+Zt}else j=j.replace("</head>",`${lt}
|
|
2068
2067
|
</head>`)}else if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1>
|
|
2069
2068
|
${lt}`);else j=lt+`
|
|
2070
|
-
`+j}{let{scanScriptTags:Qe}=await ft("stx/signal-processing",()=>import("./chunk-
|
|
2071
|
-
`+j.slice(Tt)}_.__stx_event_bindings=[]}}if(!ce(j)&&
|
|
2072
|
-
`);return{line:k.length,column:k[k.length-1].length+1}}function vc(v,_,k){let E=[];switch(v){case"if":case"elseif":case"unless":if(k.length===0)E.push({type:"syntax",message:`@${v} requires a condition`,suggestion:`Use @${v}(condition)`});break;case"foreach":if(k.length===0||!k[0].includes(" as "))E.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(k.length===0)E.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(k.length===0)E.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(k.length===0)E.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(k.length===0)E.push({type:"syntax",message:`@${v} requires a path`,suggestion:`Use @${v}('path/to/template')`});break}return E}function xc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Sc(v){let _=v.matchAll(/@([a-z]+)/gi),k=new Set;for(let E of _){let T=E[1].toLowerCase();if(!T.startsWith("end"))k.add(T)}return Array.from(k)}import In from"path";import
|
|
2069
|
+
`+j}{let{scanScriptTags:Qe}=await ft("stx/signal-processing",()=>import("./chunk-nepqqe3b.js")),lt=[];for(let Tt of Qe(j)){if(!/\bserver\b/i.test(Tt.attrs))continue;let Nt=Tt.start+Tt.fullMatch.indexOf(">")+1,jt=Nm(j,Nt);if(jt===-1)continue;let hn=jt+9;while(hn<j.length&&/\s/.test(j[hn]))hn++;lt.push({start:Tt.start,end:hn})}if(lt.length>0){let Tt=Array(lt.length+1),Nt=0;for(let jt=0;jt<lt.length;jt++){let{start:hn,end:Zt}=lt[jt];Tt[jt]=j.slice(Nt,hn),Nt=Zt}Tt[lt.length]=j.slice(Nt),j=Tt.join("")}}let At=lo(j,k);if(At.hasScoped)j=At.html;let mt=_.__stx_event_bindings||[],Dt=!1,kn=[],Sn=/\s:[a-z][\w.-]*\s*=/.test(j),{scanScriptTags:Pn}=await ft("stx/signal-processing",()=>import("./chunk-nepqqe3b.js"));for(let Qe of Pn(j,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))kn.push({match:Qe.fullMatch,attrs:Qe.attrs,content:Qe.body});for(let{match:Qe,attrs:lt,content:Tt}of kn){Dt=!0;let Nt=Tt;ws(Tt,k,E.strict,_.__originalFilePath);let jt=await he(Tt,{eventBindings:mt,attrs:lt,hasColonDirectives:Sn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:E.buildMode==="compile",serverData:Ae});j=j.replace(Qe,()=>jt)}if(Dt)_.__stx_event_bindings=[];if(!Dt&&_.__stxProcessingDepth===1){let Qe=_.__stx_event_bindings||[];if(Qe.length>0){let lt=Ta(Qe);if(lt){let Tt=j.lastIndexOf("</body>");j=Tt===-1?j+lt:j.slice(0,Tt)+lt+`
|
|
2070
|
+
`+j.slice(Tt)}_.__stx_event_bindings=[]}}if(!ce(j)&&sm(j))j=await oa(j,B);if(j=im(j),B.csp?.enabled&&B.csp.useNonce&&typeof _.cspNonce==="string")j=Uf(j,_.cspNonce);return j}var MS=[{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"}],OS=[{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')"}],NS=[{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 bc(v){let _=[],k=[];return jS(v,_),LS(v,_,k),BS(v,k),zS(v,_),{valid:_.length===0,errors:_,warnings:k}}function jS(v,_){let k=(v.match(/\{\{/g)||[]).length,E=(v.match(/\}\}/g)||[]).length;if(k!==E)_.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${E} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function LS(v,_,k){for(let E of MS){let T=new RegExp(`${E.open}(?:\\s|\\()`,"g"),j=new RegExp(E.close,"g"),B=(v.match(T)||[]).length,z=(v.match(j)||[]).length;if(E.altClose){let F=new RegExp(E.altClose,"g");z+=(v.match(F)||[]).length}if(B>z)_.push({type:"directive",message:`Unclosed @${E.name} directive: found ${B} opening and ${z} closing`,suggestion:`Add ${B-z} missing ${E.close} tag(s)`});else if(z>B)k.push({type:"directive",message:`Extra ${E.close} found: ${z-B} more closing than opening`,suggestion:`Check for orphaned ${E.close} tags`})}}function BS(v,_){for(let k of OS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function zS(v,_){for(let k of NS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function wc(v,_){let k=v.slice(0,_).split(`
|
|
2071
|
+
`);return{line:k.length,column:k[k.length-1].length+1}}function vc(v,_,k){let E=[];switch(v){case"if":case"elseif":case"unless":if(k.length===0)E.push({type:"syntax",message:`@${v} requires a condition`,suggestion:`Use @${v}(condition)`});break;case"foreach":if(k.length===0||!k[0].includes(" as "))E.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(k.length===0)E.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(k.length===0)E.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(k.length===0)E.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(k.length===0)E.push({type:"syntax",message:`@${v} requires a path`,suggestion:`Use @${v}('path/to/template')`});break}return E}function xc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Sc(v){let _=v.matchAll(/@([a-z]+)/gi),k=new Set;for(let E of _){let T=E[1].toLowerCase();if(!T.startsWith("end"))k.add(T)}return Array.from(k)}import In from"path";import Ks from"process";var Ct=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];var zm=new Set(Ct),FS=new Set(["props","$props","defineProps"]),WS=new Set(["stx","@stacksjs/stx"]),Fm=m(128),Wm=m(64);function VS(v){let _=[],k=0,E=v.split(`
|
|
2073
2072
|
`);for(let T of E){let j=k,B=null,z=!1;for(let F=0;F<T.length;F++){let V=T[F];if(z){z=!1;continue}if(V==="\\"){z=!0;continue}if(B){if(V===B)B=null;continue}if(V==="'"||V==='"'||V==="`"){B=V;continue}if(V==="/"&&F+1<T.length&&T[F+1]==="/")break;if(V==="{")k++;else if(V==="}")k--}if(j===0){let F=T.match(/(?:const|let|var)\s+(\w+)\s*=/);if(F)_.push(F[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(T)){let V=T.match(/(?:const|let|var)\s+(\w+)/);if(V)_.push(V[1])}else{let V=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(V){let G=V[1].slice(1,-1).split(",").map((ne)=>{let J=ne.split(":");return(J.length>1?J[1]:J[0]).trim()}).filter((ne)=>/^\w+$/.test(ne));_.push(...G)}}}}return[...new Set(_)]}function lc(v){let _=v;_=_.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),_=_.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),_=_.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function k(E){if(!E.includes(":"))return E;let T=[],j="",B=0,z=0,F=null;for(let V=0;V<E.length;V++){let H=E[V];if(F){if(j+=H,H===F)F=null;continue}if(H==='"'||H==="'"||H==="`"){F=H,j+=H;continue}if(H==="<")B++;else if(H===">"&&B>0)B--;else if(H==="(")z++;else if(H===")")z--;if(H===","&&B===0&&z===0){T.push(j),j="";continue}j+=H}if(j)T.push(j);return T.map((V)=>{let H=V.trim(),G=H.startsWith("..."),ne=G?H.slice(3):H,J=-1,re=0;for(let ve=0;ve<ne.length;ve++)if(ne[ve]==="<")re++;else if(ne[ve]===">")re--;else if(ne[ve]===":"&&re===0){J=ve;break}if(J===-1)return V;let ie=ne.substring(0,J).trim().replace(/\?$/,""),oe=ne.substring(J+1),de=-1,ae=0;for(let ve=0;ve<oe.length;ve++)if(oe[ve]==="<")ae++;else if(oe[ve]===">")ae--;else if(oe[ve]==="="&&ae===0){de=ve;break}let me=G?"...":"";if(de!==-1)return`${me}${ie} = ${oe.substring(de+1).trim()}`;return`${me}${ie}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(E,T,j)=>{if(!j.includes(":"))return E;return`${T}(${k(j)})`});{let E=/\b(function\s+\w*\s*)\(/g,T,j=[];while((T=E.exec(_))!==null){let B=T.index+T[0].length-1,z=1,F=B+1,V=0,H=null;while(F<_.length&&z>0){let J=_[F];if(H){if(J===H)H=null;F++;continue}if(J==='"'||J==="'"||J==="`"){H=J,F++;continue}if(J==="<")V++;else if(J===">"&&V>0)V--;else if(V===0){if(J==="(")z++;else if(J===")")z--}if(z>0)F++}if(z!==0)continue;let G=_.substring(B+1,F);if(!G.includes(":"))continue;let ne=k(G);j.push({start:B+1,end:F,replacement:ne})}for(let B=j.length-1;B>=0;B--){let{start:z,end:F,replacement:V}=j[B];_=_.substring(0,z)+V+_.substring(F)}}return _=_.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(E,T)=>{if(!T.includes(":"))return E;if(T.includes("{")||T.includes("}"))return E;return`(${T.split(",").map((B)=>{let[z,...F]=B.split("="),V=z.split(":")[0].trim();if(F.length>0)return`${V} = ${F.join("=").trim()}`;return V}).join(", ")}) =>`}),_=_.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"),_=_.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),_=_.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),_=_.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),_=_.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),_=_.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),_=_.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),_=_.replace(/\n\s*\n\s*\n/g,`
|
|
2074
2073
|
|
|
2075
|
-
`),_}function uc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,E,T]=k,j=E??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(j)?"":_})}function dc(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function pc(v){if(v instanceof SyntaxError)return!0;let _=v instanceof Error?v.message:String(v);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(_)}function fc(v){if(!/is not defined|can't find variable/i.test(v))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(v)}var
|
|
2074
|
+
`),_}function uc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,E,T]=k,j=E??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(j)?"":_})}function dc(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function pc(v){if(v instanceof SyntaxError)return!0;let _=v instanceof Error?v.message:String(v);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(_)}function fc(v){if(!/is not defined|can't find variable/i.test(v))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(v)}var Vm=new Set;async function d(v,_,k,E={}){if(!v.trim())return;let T=w(),j=h(v,JSON.stringify(T)),B=Fm.get(j);if(B===void 0){try{let De=L({loader:"ts",target:"browser",define:T}),Je=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Je=Je.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),B=De.transformSync(Je)}catch{B=lc(v)}Fm.set(j,B)}let z={exports:{}},F=z.exports,V=Ks.cwd(),H={},G=[...B.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((De)=>De[1]).filter((De)=>!De.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(De)),ne=new Map;for(let De of G)try{if(De.startsWith(".")){H[De]=await import(In.resolve(In.dirname(k),De));continue}let Je=In.resolve(V,"node_modules",De),nt=In.join(Je,"package.json"),ht=JSON.parse(u("fs").readFileSync(nt,"utf8")),Pt=ht.main||"index.js";if(ht.exports){let Ut=typeof ht.exports==="string"?ht.exports:ht.exports["."];if(typeof Ut==="string")Pt=Ut;else if(Ut?.bun)Pt=Ut.bun;else if(Ut?.import)Pt=Ut.import;else if(Ut?.default)Pt=Ut.default}H[De]=await import(In.resolve(Je,Pt))}catch(Je){if(De.startsWith("."))ne.set(De,Je instanceof Error?Je.message:String(Je))}let J=(De)=>{if(H[De])return H[De];let Je=ne.get(De);if(Je!==void 0)throw Error(`Cannot require '${De}' from ${k}: ${Je}`);return u(De)},re=_.props||{},se=(De)=>{if(!De)return re;let Je={};for(let[nt,ht]of Object.entries(De)){let Pt=re[nt];if(Pt!==void 0)Je[nt]=Pt;else if(typeof ht==="function")Je[nt]=ht();else Je[nt]=ht}return Je};for(let[De,Je]of Object.entries(re))Object.defineProperty(se,De,{value:Je,enumerable:!0,configurable:!0,writable:!0});let ie=(De,Je=!1)=>{if(De===void 0||De===null)return Je;if(typeof De==="string"){let nt=De.trim().toLowerCase();if(nt===""||nt==="true"||nt==="1"||nt==="on"||nt==="yes")return!0;if(nt==="false"||nt==="0"||nt==="off"||nt==="no")return!1;return!0}return Boolean(De)},oe=(De,Je=0)=>{if(De===void 0||De===null)return Je;if(typeof De==="string"){let ht=De.trim();if(ht==="")return Je;let Pt=Number(ht);return Number.isFinite(Pt)?Pt:Je}let nt=Number(De);return Number.isFinite(nt)?nt:Je};for(let De of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(re,De))continue;try{Object.defineProperty(se,De,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let de=(De)=>{if(!De)return re;let Je={...re};for(let[nt,ht]of Object.entries(De)){let Pt=ht&&typeof ht==="object"&&!Array.isArray(ht)?ht:{type:ht};if(Je[nt]===void 0&&Pt.default!==void 0)Je[nt]=typeof Pt.default==="function"?Pt.default():Pt.default}return Je},ae=()=>_.slots||{},me=(De,Je)=>{let nt={...De};for(let[ht,Pt]of Object.entries(Je))if(nt[ht]===void 0)if(typeof Pt==="function")nt[ht]=Pt();else nt[ht]=Pt;return nt},ve=(De)=>{let Je=()=>De;return Je.set=(nt)=>{},Je.update=(nt)=>{},Je},Se=(De)=>{let Je,nt=!1;return()=>{if(!nt)try{Je=De(),nt=!0}catch{Je=void 0}return Je}},$e=(De)=>{},Re=(De)=>De(),Ee=(De)=>{},Te=(De)=>{},Ce=jn(_);function _e(De){let Je=De||{};if(Je.title!==void 0||Je.description!==void 0)Ze({title:Je.title,description:Je.description})}function Ie(De){if(!De||typeof De!=="object")return;let Je=_.__stxClientPayload??{};Object.assign(Je,De),_.__stxClientPayload=Je}let Xe=()=>{let De=_.__stxServeContext,Je=_.__stxServeSearch??De?.search??"",nt=De?.path??"",ht=Object.fromEntries(new URLSearchParams(Je)),Pt=_.query,Ut=Object.keys(ht).length>0?ht:Pt??{},Sr=Je||(Object.keys(Ut).length>0?`?${new URLSearchParams(Ut).toString()}`:"");return{params:_.params??{},query:Ut,path:nt,name:"",fullPath:nt+Sr,hash:"",matched:[]}},Pe=()=>({push:(De)=>{},replace:(De)=>{},back:()=>{},forward:()=>{},go:(De)=>{}}),Ae=(De)=>{let Je=_.__stx_runtime_head||{};_.__stx_runtime_head=fe(Je,pe(De||{},{known:nr,source:"useHead()"}))},Ze=(De)=>{Ae(rr(De||{}))},ct=(De)=>({value:De}),it=(De)=>De,rt=(De)=>({value:typeof De==="function"?De():De}),gt=(De,Je)=>{},ut=(De)=>{},dt=(De)=>{},st=(De)=>De?De():Promise.resolve(),At=(De)=>(Je,...nt)=>{},mt=(De)=>{},Dt=(De,Je)=>{},kn=(De,Je)=>Je,Sn=()=>({value:"light"}),Pn=()=>ve(!1),Qe=(De)=>ve(!1),lt=()=>ve(!1),Tt=()=>Qe("(prefers-color-scheme: dark)"),Nt=()=>Qe("(prefers-color-scheme: light)"),jt=()=>Qe("(prefers-reduced-motion: reduce)"),hn=()=>Qe("(prefers-contrast: more)"),Zt={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},wa=new Proxy(Zt,{get(De,Je){if(Je in De)return De[Je];return},set(De,Je,nt){return De[Je]=nt,!0}}),Gt={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Sa=console;try{let De=us(B,k),Je=new Set(Object.keys(re)),nt=Object.keys(_).filter((at)=>!Je.has(at)&&!FS.has(at)&&Ye(at)),ht=nt.map((at)=>_[at]);if(!nt.includes("__stxServeContext"))nt.push("__stxServeContext"),ht.push(void 0);let Pt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ut=[],Sr=[];for(let[at,Vt]of Object.entries(re)){if(!Ye(at))continue;if(Pt.has(at))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${at}\\b`).test(De))continue;Ut.push(at),Sr.push(Vt)}let _a=VS(De).map((at)=>`module.exports.${at} = typeof ${at} !== 'undefined' ? ${at} : module.exports.${at};`).join(`
|
|
2076
2075
|
`),$r=_.params??{},zr=[],er=[];for(let at=0;at<nt.length;at++){if(nt[at]==="params")continue;zr.push(nt[at]),er.push(ht[at])}let Kt=[...Ct,...Ut,...zr],et=`return (async () => {
|
|
2077
2076
|
${De}
|
|
2078
|
-
${
|
|
2077
|
+
${_a}
|
|
2079
2078
|
return module.exports
|
|
2080
|
-
})()`,ot=h(et,Kt.join("\x00")),yt=
|
|
2079
|
+
})()`,ot=h(et,Kt.join("\x00")),yt=Wm.get(ot);if(!yt)yt=Function(...Kt,et),Wm.set(ot,yt);let pt=_.__stx_options?.runtimeConfig;if(pt||/\buse(?:Server)?RuntimeConfig\b/.test(B))await ln(_,k,pt);let Ft=await ue(_.__stx_runtime_config??Et()??C(),()=>Hg(_,()=>yt(z,F,J,re,se,ie,oe,de,me,Ie,qg,ks,Yn,ve,Se,$e,Re,Ee,Te,_e,Xe,Pe,Ae,Ze,Ce.setResponseStatus,Ce.setResponseHeader,Ce.notFound,ct,it,rt,gt,ut,dt,st,At,mt,ae,Dt,kn,Sn,Pn,Qe,lt,Tt,Nt,jt,hn,wa,Gt,Sa,Zt.confirm,Zt.alert,Zt.fetch,$r,...Sr,...er)));if(E.preserveExisting){for(let[at,Vt]of Object.entries(Ft))if(!(at in _)||_[at]===void 0)_[at]=Vt}else Object.assign(_,Ft);for(let[at,Vt]of Object.entries(re))if(!(at in _))_[at]=Vt}catch(De){if(_.__stx_strict_hydration)throw De;let Je=uc(De instanceof Error?De.message:String(De));if(dc(Je))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Je}`),E.onFailure?.({kind:"module-resolution",message:Je,error:De});else if(pc(De))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Je}`),E.onFailure?.({kind:"syntax",message:Je,error:De});else if(fc(Je))console.warn(`[stx] server <script> in ${k??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${Je}`),E.onFailure?.({kind:"missing-binding",message:Je,error:De});else{let nt=`${k??"<unknown>"}\x00${Je}`;if(Ks.env.STX_DEBUG||!Vm.has(nt))Vm.add(nt),console.warn(`[stx] server <script> in ${k??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${Je}`);E.onFailure?.({kind:"unknown",message:Je,error:De})}try{await ZS(B,_,k)}catch(nt){if(Ks.env.STX_DEBUG){let ht=nt instanceof Error?nt.message:String(nt);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${ht}`)}}}}function gc(v){let _=0,k=null,E=!1,T=!1;for(let j=0;j<v.length;j++){let B=v[j];if(k){if(B===k){if(k=null,E||_===0)T=!0}continue}if(B==="'"||B==='"'||B==="`"){k=B;continue}if(B==="{")_++;else if(B==="}")_--;else if(v.startsWith("from",j)&&_===0)E=!0}return k===null&&_===0&&T}var US=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function us(v,_){let k=_?In.dirname(_):Ks.cwd(),E=Ks.cwd(),T=v.split(`
|
|
2081
2080
|
`),j=[],B=0;while(B<T.length){let z=T[B].trim();if(z.startsWith("interface ")||z.startsWith("export interface ")||z.startsWith("type ")||z.startsWith("export type ")){if(z.includes("{")&&!z.includes("}")){let F=0;for(;B<T.length;B++){for(let V of T[B])if(V==="{")F++;else if(V==="}")F--;if(F<=0)break}}B++;continue}if(z.startsWith("definePageMeta(")){let F=0,V=!1,H=B;for(let J=B;J<T.length&&!V;J++){let re=null,se=!1,ie=T[J];for(let oe=0;oe<ie.length;oe++){let de=ie[oe];if(se){se=!1;continue}if(de==="\\"){se=!0;continue}if(re){if(de===re)re=null;continue}if(de==='"'||de==="'"||de==="`"){re=de;continue}if(de==="(")F++;else if(de===")"){if(F--,F===0){B=J+1,V=!0;break}}}}if(!V)B=T.length;let G=T.slice(H,B).join(`
|
|
2082
|
-
`),ne=[];for(let J of["title","description"]){let re=new RegExp(`\\b${J}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(G);if(re)ne.push(`${J}: ${JSON.stringify(re[2])}`)}if(ne.length>0)j.push(`useSeoMeta({ ${ne.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let F=z,V=0;while(!gc(F)&&B+V+1<T.length)V++,F=`${F} ${T[B+V].trim()}`;B+=V;let H=F.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),G=F.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),ne=F.match(/^import\s+['"](.+?)['"]/),J=F,re=(se)=>{if(se.startsWith("."))return In.resolve(k,se);if(se.startsWith("~/")||se.startsWith("@/"))return In.resolve(E,se.slice(2));return se};if(H){let[,se,ie]=H,oe=re(ie);j.push(`const ${se} = (await import('${oe}')).default`),j.push(`module.exports.${se} = ${se};`)}else if(G){let[,se,ie]=G,oe=re(ie),de=[],ae=[],me=
|
|
2083
|
-
`+J;if(G<=0&&ne>=B)break}j.push(H),j.push(`module.exports.${V} = ${V};`),B=ne+1}else j.push(z),B++}else if(z.includes("module.exports"))j.push(z),B++;else if(z.trim()&&!z.startsWith("//"))j.push(z),B++;else B++}return
|
|
2084
|
-
`),k,E)}function
|
|
2085
|
-
`)z=!1;j++;continue}if(F){if(T+=H,H==="*"&&G==="/"){T+=G,j+=2,F=!1;continue}j++;continue}if(!B&&H==="/"&&G==="/"){z=!0,T+=H,j++;continue}if(!B&&H==="/"&&G==="*"){F=!0,T+=H,j++;continue}if(B){if(T+=H,H==="\\"){T+=G,j+=2;continue}if(H===B&&B!=="`"){B=null,j++;continue}if(B==="`"){if(H==="$"&&G==="{"){V++,T+=G,j+=2;continue}if(H==="`"){B=null,j++;continue}}j++;continue}if(V>0){if(H==="{")V++;else if(H==="}")V--}if(H==='"'||H==="'"||H==="`"){B=H,T+=H,j++;continue}if(H==="a"&&v.startsWith("await",j)){let ne=
|
|
2081
|
+
`),ne=[];for(let J of["title","description"]){let re=new RegExp(`\\b${J}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(G);if(re)ne.push(`${J}: ${JSON.stringify(re[2])}`)}if(ne.length>0)j.push(`useSeoMeta({ ${ne.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let F=z,V=0;while(!gc(F)&&B+V+1<T.length)V++,F=`${F} ${T[B+V].trim()}`;B+=V;let H=F.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),G=F.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),ne=F.match(/^import\s+['"](.+?)['"]/),J=F,re=(se)=>{if(se.startsWith("."))return In.resolve(k,se);if(se.startsWith("~/")||se.startsWith("@/"))return In.resolve(E,se.slice(2));return se};if(H){let[,se,ie]=H,oe=re(ie);j.push(`const ${se} = (await import('${oe}')).default`),j.push(`module.exports.${se} = ${se};`)}else if(G){let[,se,ie]=G,oe=re(ie),de=[],ae=[],me=WS.has(ie);for(let ve of se.split(",")){let Se=ve.trim();if(!Se)continue;let $e=Se.split(/\s+as\s+/);if($e.length===2){let[Re,Ee]=[$e[0].trim(),$e[1].trim()];if(me&&zm.has(Re)){j.push(`const ${Ee} = ${Re};`);continue}de.push(`${Re}: ${Ee}`),ae.push(Ee)}else{if(me&&zm.has(Se))continue;de.push(Se),ae.push(Se)}}if(de.length>0)j.push(`const { ${de.join(", ")} } = await import('${oe}')`);for(let ve of ae)j.push(`module.exports.${ve} = ${ve};`)}else if(ne){let se=re(ne[1]);j.push(`await import('${se}')`)}else j.push(J);B++;continue}if(US.test(z))j.push(T[B]),B++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let F=Hm(T,B),{type:V,name:H,value:G}=F;j.push(`${V} ${H} = ${G};`),j.push(`module.exports.${H} = ${H};`),B=F.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let F=Gl(T,B);j.push(F.functionCode),j.push(`module.exports.${F.name} = ${F.name};`),B=F.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let F=Hm(T,B),{type:V,name:H,value:G}=F;j.push(`${V} ${H} = ${G};`),j.push(`module.exports.${H} = ${H};`),B=F.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let F=Gl(T,B);j.push(F.functionCode),j.push(`module.exports.${F.name} = ${F.name};`),B=F.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let F=T[B].replace(/^(\s*)export\s+default\s+/,"$1"),V=[...T];V[B]=F;let H=Gl(V,B);if(j.push(H.functionCode),H.name)j.push(`module.exports.default = ${H.name};`);B=H.nextIndex}else if(z.startsWith("export default ")){let F=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");j.push(`module.exports.default = ${F};`),B++}else if(z.startsWith("class ")||z.startsWith("export class ")){let F=z.match(/(?:export\s+)?class\s+(\w+)/);if(F){let V=F[1],H=T[B].replace(/^export\s+/,""),G=0,ne=B;for(;ne<T.length;ne++){let J=T[ne];for(let re of J)if(re==="{")G++;else if(re==="}")G--;if(ne>B)H+=`
|
|
2082
|
+
`+J;if(G<=0&&ne>=B)break}j.push(H),j.push(`module.exports.${V} = ${V};`),B=ne+1}else j.push(z),B++}else if(z.includes("module.exports"))j.push(z),B++;else if(z.trim()&&!z.startsWith("//"))j.push(z),B++;else B++}return HS(j.join(`
|
|
2083
|
+
`),k,E)}function HS(v,_,k){let E=v.length,T="",j=0,B=null,z=!1,F=!1,V=0;while(j<E){let H=v[j],G=v[j+1];if(z){if(T+=H,H===`
|
|
2084
|
+
`)z=!1;j++;continue}if(F){if(T+=H,H==="*"&&G==="/"){T+=G,j+=2,F=!1;continue}j++;continue}if(!B&&H==="/"&&G==="/"){z=!0,T+=H,j++;continue}if(!B&&H==="/"&&G==="*"){F=!0,T+=H,j++;continue}if(B){if(T+=H,H==="\\"){T+=G,j+=2;continue}if(H===B&&B!=="`"){B=null,j++;continue}if(B==="`"){if(H==="$"&&G==="{"){V++,T+=G,j+=2;continue}if(H==="`"){B=null,j++;continue}}j++;continue}if(V>0){if(H==="{")V++;else if(H==="}")V--}if(H==='"'||H==="'"||H==="`"){B=H,T+=H,j++;continue}if(H==="a"&&v.startsWith("await",j)){let ne=qS(v,j);if(ne){let{quote:J,path:re,end:se}=ne;if(re.startsWith(".")||re.startsWith("~/")||re.startsWith("@/")){let ie=re.startsWith(".")?In.resolve(_,re):In.resolve(k,re.slice(2));T+=`await import(${J}${ie}${J})`,j=se;continue}}}T+=H,j++}return T}function qS(v,_){let k=_+5;if(k>=v.length)return null;if(!/\s/.test(v[k]))return null;while(k<v.length&&/\s/.test(v[k]))k++;if(!v.startsWith("import",k))return null;k+=6;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return null;k++;while(k<v.length&&/\s/.test(v[k]))k++;let E=v[k];if(E!=="'"&&E!=='"')return null;k++;let T=k;while(k<v.length&&v[k]!==E)if(v[k]==="\\")k+=2;else k++;if(k>=v.length)return null;let j=v.slice(T,k);k++;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!==")")return null;return{quote:E,path:j,end:k+1}}function Zm(v,_){let k=v[_];if(k!=="{"&&k!=="[")return null;let T=S(v,k,k==="{"?"}":"]",_);if(T===-1)return null;return{pattern:v.slice(_,T+1),endPos:T+1}}function Gm(v){let _=[],k=v.slice(1,-1).trim();if(!k)return _;let E=0,T=0,j="";while(E<k.length){let B=k[E];if(B==="{"||B==="["){let z=T===0?Zm(k,E):null;if(z){_.push(...Gm(z.pattern)),E=z.endPos,j="";continue}T++}else if(B==="}"||B==="]")T--;if(T>0){E++;continue}if(B===","){if(j.trim())_.push(j.trim());j="",E++;continue}if(B===":"){j="",E++;continue}if(B==="="){if(j.trim())_.push(j.trim());j="",E++;while(E<k.length&&k[E]!==","&&T===0){if(k[E]==="{"||k[E]==="[")T++;else if(k[E]==="}"||k[E]==="]")T--;E++}continue}if(/[\w$]/.test(B))j+=B;E++}if(j.trim())_.push(j.trim());return _}function mc(v){let _=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(v);if(!_)return null;let k=_[0].length,E=(T)=>T===" "||T==="\t";while(k<v.length&&E(v[k]))k++;if(v[k]===":"){let T=0,j=null;k++;for(;k<v.length;k++){let B=v[k];if(j){if(B==="\\"){k++;continue}if(B===j)j=null;continue}if(B==="'"||B==='"'||B==="`"){j=B;continue}if(B==="("||B==="["||B==="{"||B==="<"){T++;continue}if(B===")"||B==="]"||B==="}"||B===">"){T--;continue}if(B==="="&&T<=0){let z=v[k+1],F=v[k-1];if(z!=="="&&z!==">"&&F!=="="&&F!=="!"&&F!=="<"&&F!==">")break}}if(v[k]!=="=")return null}while(k<v.length&&E(v[k]))k++;if(v[k]!=="=")return null;return{type:_[1],name:_[2],value:v.slice(k+1).trim()}}function Um(v,_,k,E){let T=null,j=!1;for(let B of v){if(j){j=!1;continue}if(B==="\\"){j=!0;continue}if(T){if(B===T)T=null;continue}if(B==="'"||B==='"'||B==="`"){T=B;continue}if(B===_)E++;else if(B===k)E--}return E}function Hm(v,_){let k=v[_].trim(),E=mc(k),T=E?[k,E.type,E.name,E.value]:null;if(!T){let H=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(H){let G=k.slice(H[0].length),ne=_;if(G.startsWith("{")||G.startsWith("[")){let re=G[0],se=re==="{"?"}":"]",ie=Um(G,re,se,0),oe=G;for(let de=_+1;de<v.length&&ie>0;de++)oe+=` ${v[de].trim()}`,ne=de,ie=Um(v[de],re,se,ie);if(ie>0)oe=G,ne=_;G=oe}let J=Zm(G,0);if(J){let re=H[1],se=J.pattern,ie=G.slice(J.endPos).trim();if(ie.startsWith("=")){let oe=ie.slice(1).trim(),de=oe,ae=Math.max(ne,_);if(qm(oe)){let $e=Km(v,ae,oe);de=$e.value,ae=$e.nextIndex}else ae=ae+1;de=de.trim().replace(/;$/,"");let me=Gm(se),ve=`__stx_src_${_}`,Se=me.map(($e)=>`module.exports.${$e} = ${$e};`).join(`
|
|
2086
2085
|
`);return{type:re,name:ve,value:`${de}; ${re} ${se} = ${ve};
|
|
2087
|
-
${Se}`,nextIndex:ae}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,j,B,z]=T,F=z,V=_;if(
|
|
2088
|
-
${v[V]}`,V++;else break}return F=F.trim().replace(/;$/,""),{type:j,name:B,value:F,nextIndex:V}}function
|
|
2086
|
+
${Se}`,nextIndex:ae}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,j,B,z]=T,F=z,V=_;if(qm(z)){let H=Km(v,_,z);F=H.value,V=H.nextIndex}else V=_+1;while(V<v.length){let H=v[V].trim();if(H.startsWith(".")||H.startsWith("?."))F+=`
|
|
2087
|
+
${v[V]}`,V++;else break}return F=F.trim().replace(/;$/,""),{type:j,name:B,value:F,nextIndex:V}}function Gl(v,_){let k=v[_].trim(),E=k.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!E)throw Error(`Failed to parse function declaration: ${k}`);let[,T]=E,j=k.replace(/^export\s+/,""),B=_;if(KS(k)){let z=XS(v,_,j);j=z.functionCode,B=z.nextIndex}else B=_+1;return{name:T,functionCode:j,nextIndex:B}}function qm(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!Jm(_)}function Jm(v){let _={paren:0,bracket:0,brace:0},k=null,E=0;for(let T=0;T<v.length;T++){let j=v[T];if((T>0?v[T-1]:"")==="\\"&&k)continue;if((j==='"'||j==="'")&&!k){k=j;continue}if(j===k&&k!=="`"){k=null;continue}if(j==="`"&&!k){k="`";continue}if(j==="`"&&k==="`"&&E===0){k=null;continue}if(k==="`"&&j==="$"&&v[T+1]==="{"){E++,T++;continue}if(E>0&&j==="{"){E++;continue}if(E>0&&j==="}"){E--;continue}if(k)continue;if(j==="(")_.paren++;else if(j===")")_.paren--;else if(j==="[")_.bracket++;else if(j==="]")_.bracket--;else if(j==="{")_.brace++;else if(j==="}")_.brace--}return _.paren===0&&_.bracket===0&&_.brace===0&&k===null}function Ym(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function KS(v){let _=Ym(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function Km(v,_,k){let E=k,T=_+1;while(T<v.length&&!Jm(E)){let j=v[T];E+=`
|
|
2089
2088
|
${j}`,T++}while(T<v.length){let j=v[T].trim();if(j.startsWith(".")||j.startsWith("?."))E+=`
|
|
2090
|
-
${v[T]}`,T++;else break}return{value:E,nextIndex:T}}function
|
|
2091
|
-
${B}`,T++}return{functionCode:E,nextIndex:T}}function
|
|
2092
|
-
`)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<j-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},V=()=>{if(E!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let re=H[2].split(",").map((se)=>{let ie=se.trim().split(":");return ie[ie.length-1].trim()});for(let se of re)if(se&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(se)&&!k.has(se))_.push(se),k.add(se);return}let G=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!k.has(re))_.push(re),k.add(re);return}let ne=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!k.has(re))_.push(re),k.add(re);return}let J=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!k.has(re))_.push(re),k.add(re)}};while(T<j){if(F())continue;if(v[T]==="'"||v[T]==='"'){B(v[T]);continue}if(v[T]==="`"){z();continue}if(v[T]==="{"){E++,T++;continue}if(v[T]==="}"){E--,T++;continue}if(E===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))V();T++}return _}function
|
|
2089
|
+
${v[T]}`,T++;else break}return{value:E,nextIndex:T}}function XS(v,_,k){let E=k,T=_+1;while(T<v.length){let j=Ym(E);if(j!==-1){if(S(E,"{","}",j)!==-1)break}let B=v[T];E+=`
|
|
2090
|
+
${B}`,T++}return{functionCode:E,nextIndex:T}}function Xm(v,_){let k=c(v,_)??c(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let E={..._,process:Object.freeze({env:{...Ks.env}})},T=Object.keys(E).filter(Ye),j=T.map((B)=>E[B]);try{return Function(...T,`'use strict'; return (${v});`)(...j)}catch{try{return Function(...T,`'use strict'; return ${v};`)(...j)}catch{return}}}async function ZS(v,_,k){let E=v.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let j of E){let[,,B,z]=j;try{let F=z.trim().replace(/;$/,""),V=Xm(F,_);if(V!==void 0)_[B]=V}catch(F){console.warn(`Failed to parse export ${B} in fallback:`,F)}}let T=v.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let j of T){let[,,B,z]=j;if(!(B in _))try{let F=z.trim().replace(/;$/,""),V=Xm(F,_);if(V!==void 0)_[B]=V}catch{}}}function si(v){let _=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),k=_?_[1]:"",E=_?v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):v;return{scriptContent:k,templateWithoutScript:E}}function oi(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var Vi=new M(500),da=new M(1000),Yl=new M(2000),Ql=new M(500),oh=33554432,eu=oh;function GS(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===eu)return;eu=_,fa.setMaxBytes(_)}var fa=new M(2000,{maxBytes:oh,sizeOf:(v)=>v.output.length});function JS(v){let _=new WeakSet;try{let k=(E)=>{if(E===void 0)return{__stxType:"undefined"};if(typeof E==="bigint")return{__stxType:"bigint",value:E.toString()};if(typeof E==="function"||typeof E==="symbol")throw TypeError("Non-serializable component input");if(E===null||typeof E!=="object")return E;if(_.has(E))throw TypeError("Circular component input");_.add(E);try{if(E instanceof Date)return{__stxType:"date",value:E.toISOString()};if(Array.isArray(E))return E.map(k);let T=Object.getPrototypeOf(E);if(T!==Object.prototype&&T!==null)throw TypeError("Non-plain component input");let j={};for(let B of Object.keys(E).sort())j[B]=k(E[B]);return j}finally{_.delete(E)}};return JSON.stringify(k(v))}catch{return null}}function YS(v){let _={};for(let[k,E]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=E;return _}function Qm(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function kc(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function Ve(v){return!kc(v)}var ua=new Map;function L(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=ua.get(_);if(k)return k;if(ua.size>=16)ua.clear();let E=new Bun.Transpiler(v);return ua.set(_,E),E}var eh=new WeakMap,QS=256;function Ue(v){try{let _=L({loader:"ts",target:"browser",define:w()}),k=eh.get(_);if(!k)k=new Map,eh.set(_,k);let E=k.get(v);if(E!==void 0)return E;let T=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");T=T.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let j=[];T=T.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let F=j.length;return j.push(z),`"__STX_EXPR_${F}__"`}),T=T.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let F=j.length;return j.push(z),`"__STX_EXPR_${F}__"`}),T=T.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let F=j.length;return j.push(z),`"__STX_EXPR_${F}__"`});let B=_.transformSync(T);for(let z=0;z<j.length;z++)B=B.replace(`"__STX_EXPR_${z}__"`,j[z]),B=B.replace(`'__STX_EXPR_${z}__'`,j[z]);if(k.size>=QS){let z=k.keys().next();if(!z.done)k.delete(z.value)}return k.set(v,B),B}catch(_){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",_);return v}}function e0(v){let _=[],k=new Set,E=0,T=0,j=v.length,B=(H)=>{T++;while(T<j){if(v[T]==="\\"){T+=2;continue}if(v[T]===H){T++;return}T++}},z=()=>{T++;while(T<j){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let H=1;while(T<j&&H>0)if(v[T]==="{")H++,T++;else if(v[T]==="}")H--,T++;else if(v[T]==="'"||v[T]==='"')B(v[T]);else if(v[T]==="`")z();else T++;continue}T++}},F=()=>{if(v[T]==="/"&&v[T+1]==="/"){while(T<j&&v[T]!==`
|
|
2091
|
+
`)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<j-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},V=()=>{if(E!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let re=H[2].split(",").map((se)=>{let ie=se.trim().split(":");return ie[ie.length-1].trim()});for(let se of re)if(se&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(se)&&!k.has(se))_.push(se),k.add(se);return}let G=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let re=G[2];if(!k.has(re))_.push(re),k.add(re);return}let ne=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ne){let re=ne[1];if(!k.has(re))_.push(re),k.add(re);return}let J=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(J){let re=J[1];if(!k.has(re))_.push(re),k.add(re)}};while(T<j){if(F())continue;if(v[T]==="'"||v[T]==='"'){B(v[T]);continue}if(v[T]==="`"){z();continue}if(v[T]==="{"){E++,T++;continue}if(v[T]==="}"){E--,T++;continue}if(E===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))V();T++}return _}function t0(v){let _=[],k=0,E=0,T=null;for(let j=0;j<v.length;j++){let B=v[j];if(T){if(B==="\\"){j++;continue}if(B===T)T=null;continue}if(B==='"'||B==="'"||B==="`"){T=B;continue}if(B==="("||B==="["||B==="{")k++;else if(B===")"||B==="]"||B==="}")k--;else if(B===","&&k===0)_.push(v.slice(E,j)),E=j+1}if(E<v.length)_.push(v.slice(E));return _}function n0(v){let _=0,k=null;for(let E=0;E<v.length;E++){let T=v[E];if(k){if(T==="\\"){E++;continue}if(T===k)k=null;continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{")_++;else if(T===")"||T==="]"||T==="}")_--;else if(T==="="&&_===0){let j=v[E-1],B=v[E+1];if(j==="!"||j==="<"||j===">"||j==="=")continue;if(B==="="||B===">")continue;return E}}return-1}function r0(v,_){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(v);if(!k)return;let E=k.index-1;while(E>=0&&/\s/.test(v[E]))E--;if(v[E]!=="}")return;let T=E,j=0,B=-1;for(;E>=0;E--){let F=v[E];if(F==="}")j++;else if(F==="{"){if(j--,j===0){B=E;break}}}if(B===-1)return;let z=v.slice(B+1,T);for(let F of t0(z)){let V=F.trim();if(!V||V.startsWith("..."))continue;let H=n0(V);if(H===-1)continue;let G=V.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(G))continue;if(_[G]!==void 0)continue;let ne=V.slice(H+1).trim();if(!ne)continue;try{let J=Object.keys(_).filter(Ye),re=Function(...J,`"use strict"; return (${ne});`);_[G]=re(...J.map((se)=>_[se]))}catch{}}}catch{}}var s0=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Cc(v,_){let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!k)return null;let E=k[2].toLowerCase();if(!s0.has(E))return null;let T=new RegExp(`<\\/?${E}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),j=lr(v,(V,H)=>(T.lastIndex=H,T.exec(V)?.index===H?T.lastIndex:-1));if(E==="span"&&/\sdata-stx-scope\s*=/.test(j[0]?.token||""))return null;let B=0,z=!1;for(let V of j){if(B+=V.token.startsWith("</")?-1:1,B<0)return null;if(B===0){if(v.slice(V.end).trim())return null;z=!0;break}}if(!z)return null;let F=k[0].length;return v.slice(0,F)+_+v.slice(F)}async function qn(v,_,k,E,T){let j=v.endsWith(".stx")?v.slice(0,-4):v,B=(ve)=>ve.split("-").map((Se)=>Se.charAt(0).toUpperCase()+Se.slice(1)).join(""),z=(ve)=>ve.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=k.__importedComponents;if(F){for(let ve of[j,j.toLowerCase(),B(j),z(j)])if(F.has(ve))return!0}let V=[...new Set([`${j}.stx`,`${B(j)}.stx`,`${z(j)}.stx`])],H=typeof T.root==="string"?tt.resolve(T.root):void 0,G=H??tt.dirname(E),ne=[],J=(ve)=>{if(ve&&!ne.includes(ve))ne.push(ve)},re=k.__originalFilePath;if(re)J(tt.join(tt.dirname(re),"components"));if(J(_),J(T._rootComponentsDir),J(tt.join(tt.dirname(E),"components")),J(T.componentsDir),H)J(tt.resolve(H,"resources/views/components")),J(tt.resolve(H,"resources/components")),J(tt.resolve(H,"src/components")),J(tt.resolve(H,"components"));for(let ve of T._layerComponentDirs??[])J(ve);let se=T._pluginComponentDirs;if(Array.isArray(se))for(let ve of se)J(typeof ve==="string"?ve:null);if(J(T.fallbackComponentsDir),j.startsWith("./")||j.startsWith("../"))return r(tt.resolve(tt.dirname(E),`${j}.stx`));let ie=th(tt.resolve(import.meta.dir,"components")),oe=ne.map((ve)=>tt.isAbsolute(ve)?ve:tt.resolve(G,ve)),de=`${V.join("\x00")}\x00\x00${oe.join("\x00")}`,ae=Yl.get(de);if(ae!==void 0)return ae;let me=!1;e:for(let ve of oe){if(th(ve)===ie)continue;for(let Se of V)if(await r(tt.join(ve,Se))){me=!0;break e}}return Yl.set(de,me),me}function th(v){let _=Ql.get(v);if(_!==void 0)return _;let k=v;try{k=ih.realpathSync(v)}catch{}return Ql.set(v,k),k}function $c(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function li(v){if(!v)return!1;let _=v.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(_)}function i0(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let E=(T,j)=>{let B;try{B=x(T,_)}catch{return j}if(B===void 0||B===null)return"";let z=String(B);if(/<\/style/i.test(z))return console.warn(`[stx] a <style> expression in ${k??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return z};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,j)=>E(j,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,j)=>E(j,T))}var nh=new Set;function rh(v,_,k,E){let T=`${v}\x00${_}\x00${E??""}`;if(!process.env.STX_DEBUG&&nh.has(T))return;nh.add(T);let j=_?` used in ${_}`:"",B=E?` Cause: ${E}.`:"",z=k.length>0?`
|
|
2093
2092
|
searched:
|
|
2094
2093
|
${k.map((F)=>` - ${F}`).join(`
|
|
2095
|
-
`)}`:"";console.error(`[stx] component <${v}> could not be resolved${j}, so it rendered as nothing.${B}${z}`)}function
|
|
2096
|
-
`)}`}if(k&&Gt.includes("{{ text || slot }}"))Gt=Gt.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:
|
|
2094
|
+
`)}`:"";console.error(`[stx] component <${v}> could not be resolved${j}, so it rendered as nothing.${B}${z}`)}function sh(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Ec(v){let _=new Set,k=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let E of v){let T;while((T=k.exec(E))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function We(v,_,k,E,T,j,B,z=new Set,F,V=fr(T)){let{extractVariables:H}=await ft("stx/variable-extractor",()=>import("./chunk-trz5bkxe.js")),G=z??new Set;if(G.has(v))return`[Circular component reference: ${v}]`;let ne=new Set(G);ne.add(v);let J=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let re=J&&J!=="load"&&$c(J)?J:"";try{let se=(et)=>et.split("-").map((ot)=>ot.charAt(0).toUpperCase()+ot.slice(1)).join(""),ie=(et)=>et.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),oe=v.endsWith(".stx")?v.slice(0,-4):v,de=null,ae=T.__importedComponents;if(ae){let et=[oe,oe.toLowerCase(),se(oe),ie(oe)];for(let ot of et)if(ae.has(ot)){de=ae.get(ot);break}}let me=[];if(!de){let et=[`${oe}.stx`,`${se(oe)}.stx`,`${ie(oe)}.stx`],ot=[...new Set(et)],yt=T.__originalFilePath,pt=[];if(pt.push(...B._layerComponentDirs??[]),yt){let Lt=tt.join(tt.dirname(yt),"components");pt.push(Lt)}if(E)pt.push(E);let Ft=B._rootComponentsDir;if(typeof Ft==="string"&&!pt.includes(Ft))pt.push(Ft);let at=tt.join(tt.dirname(j),"components");if(!pt.includes(at))pt.push(at);if(B.componentsDir&&B.componentsDir!==E&&!pt.includes(B.componentsDir))pt.push(B.componentsDir);let Vt=typeof B.root==="string"?tt.resolve(B.root):void 0,_r=Vt??tt.dirname(j),$n=[];if(Vt)$n.push(tt.resolve(Vt,"resources/views/components")),$n.push(tt.resolve(Vt,"resources/components")),$n.push(tt.resolve(Vt,"src/components")),$n.push(tt.resolve(Vt,"components"));$n.push(tt.resolve(import.meta.dir,"components"));for(let Lt of $n)if(!pt.includes(Lt))pt.push(Lt);let Ki=B._pluginComponentDirs;if(Array.isArray(Ki)){for(let Lt of Ki)if(typeof Lt==="string"&&!pt.includes(Lt))pt.push(Lt)}if(B.fallbackComponentsDir&&!pt.includes(B.fallbackComponentsDir))pt.push(B.fallbackComponentsDir);let Zs=[...new Set(pt.map((Lt)=>{if(!Lt)return Lt;return tt.isAbsolute(Lt)?Lt:tt.resolve(_r,Lt)}))];pt.length=0,pt.push(...Zs);let Fr=`${oe}\x00${j}\x00${Zs.join("\x00")}`,Wr=da.get(Fr);if(Wr)if(await r(Wr))de=Wr;else da.delete(Fr);if(!de&&(oe.startsWith("./")||oe.startsWith("../")))de=tt.resolve(tt.dirname(j),`${oe}.stx`),me.push(de);else if(!de)for(let Lt of pt){if(!Lt)continue;for(let Vr of ot){let Xi=tt.join(Lt,Vr);if(me.push(Xi),await r(Xi)){de=Xi;break}}if(de)break;if(!de)try{let Vr=await import("fs");if(!Vr.statSync(Lt,{throwIfNoEntry:!1})?.isDirectory())continue;let Ch=8,ka=[{path:Lt,depth:0}];while(ka.length>0&&!de){let Zi=ka.pop();if(Zi.depth>=Ch)continue;let hu;try{hu=Vr.readdirSync(Zi.path,{withFileTypes:!0})}catch{continue}for(let Gi of hu){if(!Gi.isDirectory())continue;if(Gi.name==="node_modules"||Gi.name.startsWith("."))continue;let yu=tt.join(Zi.path,Gi.name);for(let Rh of ot){let Ea=tt.join(yu,Rh);if(me.push(Ea),await r(Ea)){de=Ea;break}}if(de)break;ka.push({path:yu,depth:Zi.depth+1})}}}catch{}if(de)break}if(de)da.set(Fr,de)}if(!de||!await r(de))return rh(v,j,me),sh(v);F.add(de);let ve;if(Vi.has(de))ve=Vi.get(de);else try{ve=await Bun.file(de).text(),Vi.set(de,ve)}catch(et){let ot=et instanceof Error?et.message:String(et);return rh(v,j,[de],ot),sh(v)}let Se=new Set(["__originalFilePath","__importedComponents",eo,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),$e={};for(let[et,ot]of Object.entries(T))if(!et.startsWith("__")||Se.has(et))$e[et]=ot;let Re=V.length>0?{[oo]:[...V]}:{},Ee=k;if(k.includes("@include")){let{processIncludes:et}=await ft("stx/includes",()=>import("./chunk-fmgr96es.js"));Ee=await et(k,T,j,B,F)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ee)){let{processComponents:et}=await ft("stx/component-renderer",()=>import("./chunk-tjk5b18m.js"));Ee=await et(Ee,{...T,__processedComponents:G,...Re},j,B,F)}let Te=[];if(li(Ee)){let{processExpressions:et}=await ft("stx/expressions",()=>import("./chunk-yw9h2zty.js")),ot=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Re}:V.length>0?{...T,...Re}:T;Ee=et(Ee,ot,j);for(let yt of Ee.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(yt[1].trim())}let Ce=xn(Ee),_e=[],Ie=Ce.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(et,ot)=>{let yt=Ce.scripts[Number(ot)]||"",pt=yt.match(/^<script\b([^>]*)>/i)?.[1]||"",Ft=pt.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),at=!Ft||["module","text/javascript","application/javascript"].includes(Ft),Vt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${pt}`);if(!/\bserver\b/i.test(pt)&&at&&!Vt)return _e.push(yt),"";return yt}),{extractSlotContent:Xe}=await ft("stx/slots",()=>import("./chunk-ynhfzv5f.js")),Pe=Xe(Ie),Ae={};if(Pe.defaultSlot?.trim())Ae.default=Pe.defaultSlot;for(let[et,ot]of Pe.namedSlots)Ae[et]=ot.content;let Ze=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??j)).toString(36).slice(0,6)},ct=`stx_${oe.replace(/[^a-zA-Z0-9]/g,"_")}_${++Ze.n}_${Ze.key}`,it={...$e,$uid:ct,..._,props:_,slot:Ie,$slots:Ae,__processedComponents:ne,__sections:{},__stx_signals_gate:ye(ve)||li(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Te]};r0(ve,it);let rt=ve,gt=Z(rt);if(gt)rt=gt.content.trim();let ut=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,dt=[...ve.matchAll(ut)],st=[],At=null,mt=dt.some((et)=>/\bserver\b/.test(et[1]||"")&&/\bcache\b/.test(et[1]||"")),Dt=null,kn=null,Sn=null,Pn=0,Qe=null;if(GS(B),mt&&eu>0){let et=JS({props:_,slot:Ee,slotContext:k.trim()?YS($e):void 0,buildMode:B.buildMode??"",skipEventDirectives:B.skipEventDirectives===!0,clientLoopNames:[...V].sort(),layers:B._layerGraph?.layers.map((ot)=>ot.configFile),uid:ct});if(et!==null){Dt=`${de}\x00${h(ve)}\x00${et}`;let ot=fa.get(Dt);if(ot){for(let yt of ot.dependencies)F.add(yt);if(Cd(T,ot.clientFactories),Ze.n+=ot.uidsConsumed,ot.preservedClientExpressions.length>0){let yt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let pt of ot.preservedClientExpressions)yt.add(pt);T.__stx_preserved_client_expressions=[...yt]}return ot.output}kn=new Set(F),Sn=kd(T),Pn=Ze.n,Qe=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let lt=new Set;for(let et of dt){let ot=et[1]||"",yt=et[2]||"",pt=ot.includes("server");if(Ve(ot)&&yt.trim())yt=Ue(yt);if(pt&&yt){for(let at of Q(yt))lt.add(at);try{await H(yt,it,de,{onFailure:(at)=>{if(at.kind!=="unknown")At=at.kind}})}catch(at){}}if(!pt){let at=yt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Vt=at.includes("{{")&&at.includes("}}"),_r=at.includes("{!!")&&at.includes("!!}");if(Vt||_r)at=Zr(at,it,de);let $n=ot.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");st.push(`<script${$n}>${at}</script>`)}}let Nt=xn(ve).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),jt=Nt?Nt[1]:"",hn=Nt?Nt[2]:"",Zt="",wa=jt&&/\bscoped\b/i.test(jt);if(Nt)Zt=`<style${jt}>${i0(hn,it,de)}</style>`;let Gt=rt;if(Gt=Gt.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Nt)Gt=Gt.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let et=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ot=[];if(Gt=Gt.replace(et,(yt,pt)=>{let Ft=pt.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ft)ot.push(`<style${Ft[1]}>${Ft[2]}</style>`);return""}),Gt=Gt.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ot.length>0)Zt=`${Zt}${ot.join(`
|
|
2095
|
+
`)}`}if(k&&Gt.includes("{{ text || slot }}"))Gt=Gt.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:Sa}=await ft("stx/slots",()=>import("./chunk-ynhfzv5f.js")),{defaultSlot:De,namedSlots:Je}=Pe,nt=st.some((et)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(et)),ht=(et)=>nt?Sm(et,ct):et,Pt=new Map([...Je].map(([et,ot])=>[et,{...ot,content:ht(ot.content)}]));Gt=await Sa(Gt,ht(De),Pt,it);let Ut=Ec(st),Sr=(Array.isArray(it.__stx_client_signal_names)?it.__stx_client_signal_names:[]).filter((et)=>!lt.has(et));if(Ut.length>0||Sr.length>0)it.__stx_client_signal_names=[...new Set([...Sr,...Ut])];else delete it.__stx_client_signal_names;let $a=V.filter((et)=>!lt.has(et)&&!(et in _));if($a.length>0)it[oo]=$a;let _a={...B,_rootComponentsDir:B._rootComponentsDir||B.componentsDir,componentsDir:tt.dirname(de),skipSignalsRuntime:!0,skipEventDirectives:nt||st.length===0,defaultLayout:void 0};it.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let $r=await n(Gt,it,de,_a,F),zr=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let et of $r.matchAll(/\{\{([\s\S]*?)\}\}/g))zr.add(et[1].trim());if(zr.size>0)T.__stx_preserved_client_expressions=[...zr];let er=ct,Kt=$r;if(nt){let et="";if(Object.keys(_).length>0)try{et=` data-stx-props="${Qm(JSON.stringify(_))}"`}catch{}let ot=re?` stx-hydrate="${Qm(re)}"`:"",yt=` data-stx-scope="${er}"${et}${ot}`,pt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test($r),Ft=pt?"span":"div";Kt=Cc($r,yt)??`<${Ft}${yt}${pt?' style="display:contents"':""}>${$r}</${Ft}>`;let at=await Promise.all(st.map(async(Vt)=>{let _r=Vt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_r)return Vt;let[,$n,Ki]=_r,{vendorStyleTags:Zs,factoryBody:Fr}=await c0(Ki,de,B.buildMode==="compile"),Wr=re?null:Pa(T,Fr),Lt=Wr?`window.__stxComponentFactories[${JSON.stringify(Wr)}](${JSON.stringify(er)});`:`(${Fr})(${JSON.stringify(er)});`;if(re)return`${Zs}<script type="stx/island" data-stx-island="${er}" data-stx-scoped data-stx-owner="${er}"${$n}>${Lt}</script>`;return`${Zs}<script data-stx-scoped data-stx-run="always" data-stx-owner="${er}"${$n}>${Lt}</script>`}));if(Kt=Kt+`
|
|
2097
2096
|
`+at.join(`
|
|
2098
2097
|
`),Zt)Kt+=`
|
|
2099
2098
|
`+Zt}else{if(Zt)Kt+=`
|
|
2100
2099
|
`+Zt;if(st.length>0){let et=it.__stx_event_bindings||[],ot=Ne(it),yt=await Promise.all(st.map(async(pt)=>{let Ft=pt.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Ft)return pt;return await he(Ft[1],{eventBindings:et,templateContent:Kt,filePath:de,projectRoot:process.cwd(),serverData:ot,instanceId:ct})}));Kt+=`
|
|
2101
2100
|
`+yt.join(`
|
|
2102
|
-
`),it.__stx_event_bindings=[]}}if(
|
|
2101
|
+
`),it.__stx_event_bindings=[]}}if(wa){let et=lo(Kt,de);if(et.hasScoped)Kt=et.html}if(Dt&&kn){let et=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];fa.set(Dt,{output:Kt,dependencies:[...F].filter((ot)=>!kn.has(ot)),clientFactories:Sn?Ed(T,Sn):[],uidsConsumed:Ze.n-Pn,preservedClientExpressions:Qe?et.filter((ot)=>!Qe.has(ot)):[]})}if(At)Kt=`<!--stx-render-failed:${At}-->${Kt}`;return _e.length>0?`${Kt}
|
|
2103
2102
|
${_e.join(`
|
|
2104
|
-
`)}`:Kt}catch(se){return`[Error processing component: ${se instanceof Error?se.message:String(se)}]`}finally{G.delete(v)}}async function r(v){return Bun.file(v).exists()}function
|
|
2103
|
+
`)}`:Kt}catch(se){return`[Error processing component: ${se instanceof Error?se.message:String(se)}]`}finally{G.delete(v)}}async function r(v){return Bun.file(v).exists()}function tu(v,_){let k=tt.resolve(_),E=tt.resolve(v),T=k.endsWith(tt.sep)?k:k+tt.sep;if(E===k||E.startsWith(T))return E;return null}async function o0(v,_,k,E){let T=_.startsWith("layouts/")?_.slice(8):_,j=tt.join(v,T);for(let B of j.endsWith(".stx")?[j]:[j,`${j}.stx`])if(await r(B)){if(E)console.log(`Found layout in ${v}: ${B}`);return k?.add(B),B}return null}async function Kn(v,_,k,E){let T=await a0(v,_,k,E);if(T===null)return null;let j=tu(T,process.cwd());if(j)return j;let B=[k.root,k.layoutsDir,k.fallbackLayoutsDir,k.componentsDir,k.partialsDir,k.pagesDir,...k._layerLayoutDirs??[]].filter((z)=>typeof z==="string"&&z.length>0);for(let z of B){let F=tt.isAbsolute(z)?z:tt.resolve(process.cwd(),z);if(tu(T,F))return tt.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function a0(v,_,k,E){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=tt.dirname(_),j=process.cwd();if(v.startsWith("/")){let ne=tt.join(j,v),J=tu(ne,j);if(!J)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${J}`);if(await r(J)&&E)E.add(J);return J}let B=tt.join(T,v);if(await r(B)){if(k.debug)console.log(`Found direct path: ${B}`);if(E)E.add(B);return B}if(!v.endsWith(".stx")&&!v.endsWith(".jsx")&&!v.endsWith(".tsx"))for(let ne of[".stx",".tsx",".jsx"]){let J=`${B}${ne}`;if(await r(J)){if(k.debug)console.log(`Found direct path with extension: ${J}`);if(E)E.add(J);return J}}let z=[];if(z.push(...k._layerLayoutDirs??[]),k.layoutsDir)z.push(tt.isAbsolute(k.layoutsDir)?k.layoutsDir:tt.resolve(process.cwd(),k.layoutsDir));let F=tt.resolve(T),V=process.cwd();for(let ne=0;ne<10;ne++){let J=tt.join(F,"layouts"),re=!1;try{re=ih.statSync(J,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(re){z.push(J);break}let se=tt.dirname(F);if(se===F||se.length<V.length)break;F=se}for(let ne of z){let J=await o0(ne,v,E,k.debug);if(J)return J}if(k.fallbackLayoutsDir){let ne=tt.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:tt.resolve(process.cwd(),k.fallbackLayoutsDir),J=v.startsWith("layouts/")?v.slice(8):v,re=[tt.join(ne,J)];if(!v.endsWith(".stx"))re.push(`${re[0]}.stx`);for(let se of re)if(await r(se)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${se}`);if(E)E.add(se);return se}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let ne=v.split("layouts/"),J=tt.join(k.partialsDir||T,"layouts",ne[1]);if(await r(J)){if(k.debug)console.log(`Found in layouts path: ${J}`);if(E)E.add(J);return J}if(!J.endsWith(".stx")){let re=`${J}.stx`;if(await r(re)){if(k.debug)console.log(`Found in layouts path with extension: ${re}`);if(E)E.add(re);return re}}}if(k.partialsDir){let ne=tt.join(k.partialsDir,"layouts");if(await r(ne)){let J=tt.join(ne,v);if(await r(J)){if(k.debug)console.log(`Found in partials layouts dir: ${J}`);if(E)E.add(J);return J}if(!v.endsWith(".stx")){let re=`${J}.stx`;if(await r(re)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${re}`);if(E)E.add(re);return re}}}}let H=k.partialsDir||tt.join(process.cwd(),"views"),G=tt.join(H,v);if(await r(G)){if(k.debug)console.log(`Found in views path: ${G}`);if(E)E.add(G);return G}if(!v.endsWith(".stx")){let ne=`${G}.stx`;if(await r(ne)){if(k.debug)console.log(`Found in views path with extension: ${ne}`);if(E)E.add(ne);return ne}}if(T.includes("temp")){let ne=tt.join(tt.dirname(T),"layouts",v);if(await r(ne)){if(k.debug)console.log(`Found in temp layouts dir: ${ne}`);if(E)E.add(ne);return ne}if(!v.endsWith(".stx")){let J=`${ne}.stx`;if(await r(J)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${J}`);if(E)E.add(J);return J}}}if(k.debug)console.warn(`Template not found after trying all paths: ${v} (referenced from ${_})`);else console.warn(`Template not found: ${v} (referenced from ${_})`);return null}function ui(v,_,k){let E=0,T="",j="";try{if(typeof _==="number"&&_>=0){let B=v.split(`
|
|
2105
2104
|
`),z=0;for(let F=0;F<B.length;F++)if(z+=B[F].length+1,z>=_){E=F+1,T=B[F].trim();let V=Math.max(0,F-2),H=Math.min(B.length,F+3);j=B.slice(V,H).map((G,ne)=>{let J=V+ne+1;return`${J===E?"> ":" "}${J}: ${G}`}).join(`
|
|
2106
2105
|
`);break}}else if(k){let B=v.indexOf(k);if(B>=0)return ui(v,B)}}catch{}return{lineNumber:E,lineContent:T,context:j}}var bt={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function g(v,_,k,E,T,j){let{lineNumber:B,context:z}=ui(E,T,j),F=k.split("/").pop(),V=0;if(typeof T==="number"&&T>=0&&E){let G=E.lastIndexOf(`
|
|
2107
2106
|
`,Math.max(0,T-1));V=T-(G+1)+1}let H="";if(B>0)H+=`
|
|
@@ -2116,7 +2115,7 @@ ${bt.yellow}${bt.bold}Message:${bt.reset} ${_}
|
|
|
2116
2115
|
`,z)H+=`
|
|
2117
2116
|
${bt.blue}${bt.bold}Context:${bt.reset}
|
|
2118
2117
|
${bt.dim}${z}${bt.reset}
|
|
2119
|
-
`;return H}function ee(){
|
|
2118
|
+
`;return H}function ee(){Vi.clear(),da.clear(),Yl.clear(),Ql.clear(),fa.clear()}function zu(){return{size:Vi.size,maxSize:500}}var Jl=m(128);async function c0(v,_,k){let E=h(v,_,k),T=Jl.get(E);if(T){if(Qt(T.deps))return T;Jl.delete(E)}let j=Kr(v,{filePath:_,projectRoot:process.cwd()}),B=j.code,z=Xr(j.styles);B=wt(B).code;let{hasUserImports:F,bundleClientScript:V}=await ft("stx/client-script-bundler",()=>import("./chunk-083amvsc.js")),H=[],G=!1;if(F(B)){let oe=B;B=await V(oe,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),G=B===oe}let{stripStxRuntimeImports:ne}=await ft("stx/signal-processing",()=>import("./chunk-nepqqe3b.js"));B=ne(B);let J=P(B),re=e0(J),se=`function(__scopeId) {
|
|
2120
2119
|
${Rt("const",[...Si,...re],J)}
|
|
2121
2120
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
2122
2121
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -2173,8 +2172,8 @@ finally {
|
|
|
2173
2172
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
2174
2173
|
window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
|
|
2175
2174
|
}
|
|
2176
|
-
}`,ie={vendorStyleTags:z,factoryBody:se,deps:
|
|
2177
|
-
`||de==="\r"||de===" "||de===void 0)G++;ne=ie+9}else{if(G--,G===0){J=oe;break}ne=oe+12}}if(J===-1)continue;let re=v.slice(H,J),se=v.slice(z,J+12);T.push({fullMatch:se,options:V,content:re,index:z}),j.lastIndex=J+12}for(let{fullMatch:z,options:F,content:V,index:H}of T)try{let G={};if(F)F.split(",").forEach((re)=>{let se=re.trim();if(se)G[se]=!0});let ne={gfm:G.gfm??!0,breaks:G.breaks??!1},J=Oe(V.trim(),ne);E=E.split(z).join(J)}catch(G){let ne=G instanceof Error?G.message:String(G),J=g("Markdown Directive",`Error processing markdown: ${ne}`,k,v,H,z);E=E.split(z).join(J)}return E}async function
|
|
2175
|
+
}`,ie={vendorStyleTags:z,factoryBody:se,deps:hd([...H,...j.styles.map((oe)=>oe.resolvedPath)])};if(!G&&j.unresolved.length===0)Jl.set(E,ie);return ie}async function Lm(v,_,k=""){let E=v,T=[],j=/@markdown(?:\([^)]*\))?/g,B;while((B=j.exec(v))!==null){let z=B.index,F=B[0].match(/@markdown\(([^)]*)\)/),V=F?F[1]:"",H=z+B[0].length,G=1,ne=H,J=-1;while(G>0&&ne<v.length){let ie=v.indexOf("@markdown",ne),oe=v.indexOf("@endmarkdown",ne);if(oe===-1)break;if(ie!==-1&&ie<oe&&ie!==z){let de=v[ie+9];if(de==="("||de===`
|
|
2176
|
+
`||de==="\r"||de===" "||de===void 0)G++;ne=ie+9}else{if(G--,G===0){J=oe;break}ne=oe+12}}if(J===-1)continue;let re=v.slice(H,J),se=v.slice(z,J+12);T.push({fullMatch:se,options:V,content:re,index:z}),j.lastIndex=J+12}for(let{fullMatch:z,options:F,content:V,index:H}of T)try{let G={};if(F)F.split(",").forEach((re)=>{let se=re.trim();if(se)G[se]=!0});let ne={gfm:G.gfm??!0,breaks:G.breaks??!1},J=Oe(V.trim(),ne);E=E.split(z).join(J)}catch(G){let ne=G instanceof Error?G.message:String(G),J=g("Markdown Directive",`Error processing markdown: ${ne}`,k,v,H,z);E=E.split(z).join(J)}return E}async function ah(v,_,k,E){let T={gfm:!0,breaks:!1};return _.forEach((j)=>{let B=j.trim().replace(/['"]/g,"");if(B==="breaks")T.breaks=!0;if(B==="no-gfm")T.gfm=!1}),Oe(v.trim(),T)}var Xs=[320,480,640,768,1024,1280,1536,1920,2560],l0=[1,1.5,2,3],Ui=["avif","webp","jpeg"],u0={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function nu(v,_=Xs,k={},E){return _.sort((T,j)=>T-j).map((T)=>`${Hi(v,{...k,w:T,fm:E})} ${T}w`).join(", ")}function ch(v,_,k=l0,E={},T){return k.sort((j,B)=>j-B).map((j)=>{let B=Math.round(_*j);return`${Hi(v,{...E,w:B,dpr:j,fm:T})} ${j}x`}).join(", ")}function ru(v,_="100vw"){if(!v||Object.keys(v).length===0)return _;let E=Object.entries(v).map(([T,j])=>{let B=/^\d+$/.test(T)?`${T}px`:T;return{bp:B,size:j,numericBp:Number.parseInt(B)||0}}).sort((T,j)=>T.numericBp-j.numericBp).map(({bp:T,size:j})=>`(max-width: ${T}) ${j}`);return E.push(_),E.join(", ")}function Hi(v,_={}){let k=Object.entries(_).filter(([,j])=>j!==void 0&&j!==null).map(([j,B])=>{if(Array.isArray(B))return[j,B.join(",")];return[j,String(B)]});if(k.length===0)return v;let E=k.map(([j,B])=>`${j}=${encodeURIComponent(B)}`).join("&"),T=v.includes("?")?"&":"?";return`${v}${T}${E}`}function su(v){return u0[v]||"application/octet-stream"}var d0={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},ou=`
|
|
2178
2177
|
.stx-img-placeholder {
|
|
2179
2178
|
position: relative;
|
|
2180
2179
|
overflow: hidden;
|
|
@@ -2203,7 +2202,7 @@ finally {
|
|
|
2203
2202
|
filter: blur(0);
|
|
2204
2203
|
transform: scale(1);
|
|
2205
2204
|
}
|
|
2206
|
-
`.trim();async function
|
|
2205
|
+
`.trim();async function f0(){try{return await import("ts-images")}catch{return null}}async function p0(v,_={}){let k={...d0,..._},E=await f0();if(E)try{return await g0(v,k,E)}catch(T){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${T}`)}return m0(v,k)}async function g0(v,_,k){let{generatePlaceholder:E,generateThumbHash:T}=k,B={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[_.strategy]||"blur";if(_.strategy==="thumbhash")return{dataURL:(await T(v)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let z=await E(v,{width:_.width,height:_.height,quality:_.quality,blurLevel:_.blurLevel,strategy:B,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:_.strategy,dominantColor:z.dominantColor,css:z.css}}function m0(v,_){let k=_.width||20,E=_.height||k,T="#e5e7eb",j=`<svg xmlns="http://www.w3.org/2000/svg" width="${k}" height="${E}" viewBox="0 0 ${k} ${E}"><rect fill="#e5e7eb" width="${k}" height="${E}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(j)}`,width:k,height:E,aspectRatio:k/E,originalWidth:0,originalHeight:0,strategy:_.strategy,dominantColor:"#e5e7eb"}}function lh(v,_,k={}){let E=k.transitionDuration||300,T=k.easing||"ease-out";return`
|
|
2207
2206
|
#${v} {
|
|
2208
2207
|
--stx-img-transition-duration: ${E}ms;
|
|
2209
2208
|
--stx-img-transition-easing: ${T};
|
|
@@ -2220,8 +2219,8 @@ finally {
|
|
|
2220
2219
|
#${v}.stx-img-loaded img {
|
|
2221
2220
|
opacity: 1;
|
|
2222
2221
|
}
|
|
2223
|
-
`.trim()}var
|
|
2224
|
-
`):void 0,script:ut}}async function
|
|
2222
|
+
`.trim()}var iu=new Map;async function uh(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(iu.has(k))return iu.get(k);let E=await p0(v,_);return iu.set(k,E),E}async function h0(){try{return await import("./chunk-5sb7gw66.js")}catch(v){if(!dh)console.warn("[stx-media] Image processor not available, some features disabled:",v),dh=!0;return null}}var dh=!1,au=80,ga="async",ma="lazy",fh=!1;async function pa(v,_={}){let k=_,E=v;if(E.process&&!E.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return v0(E,k)}if(k.processedResult?.processed)return uu(v,k.processedResult,_);if(k.responsiveVariants)return mh(v,k.responsiveVariants,_);let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Xs,dpr:H,formats:G=Ui,quality:ne=au,params:J={},placeholder:re="none",placeholderOptions:se={},lazy:ie=!0,priority:oe=!1,loading:de=oe?"eager":ma,decoding:ae=ga,fetchpriority:me,objectFit:ve,objectPosition:Se,crossorigin:$e,referrerpolicy:Re}=v,{class:Ee,style:Te,id:Ce}=v,_e=v.data||{},{isDev:Ie=!1,baseUrl:Xe=""}=_;if(Ie&&!_.optimize)return b0(v);let Pe,Ae,Ze=Ce||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(re!=="none"&&!oe)try{Pe=await uh(T,{strategy:re,...se}),Ae=lh(Ze,Pe,se)}catch{}let ct=H!==void 0&&B!==void 0,it;if(ct)it=x0(v,Ze,Pe,_);else it=await y0(v,Ze,Pe,_);let rt;if(oe){let dt=G.includes("webp")?"webp":G[0],st=nu(T,V,{...J,q:ne},dt),At=typeof F==="object"?ru(F):F||"100vw";rt=`<link rel="preload" as="image" imagesrcset="${st}" imagesizes="${At}" />`}let gt=[];if(!fh&&re!=="none")gt.push(ou),fh=!0;if(Ae)gt.push(Ae);let ut=ie?gh(Ze):void 0;return{html:it,preloadLink:rt,css:gt.length>0?gt.join(`
|
|
2223
|
+
`):void 0,script:ut}}async function y0(v,_,k,E){let{src:T,alt:j,width:B,height:z,sizes:F,widths:V=Xs,formats:H=Ui,quality:G=au,params:ne={},lazy:J=!0,priority:re=!1,loading:se=re?"eager":ma,decoding:ie=ga,fetchpriority:oe,objectFit:de,objectPosition:ae,crossorigin:me,referrerpolicy:ve}=v,{class:Se,style:$e}=v,Re=v.data||{},Ee=typeof F==="object"?ru(F):F||"100vw",Te=[];for(let Ie of H){let Xe=nu(T,V,{...ne,q:G},Ie),Pe=su(Ie);if(J&&!re)Te.push(` <source type="${Pe}" data-srcset="${Xe}" data-sizes="${Ee}" />`);else Te.push(` <source type="${Pe}" srcset="${Xe}" sizes="${Ee}" />`)}let Ce=cu({src:Hi(T,{...ne,q:G}),alt:j,width:B,height:z,loading:re?void 0:se,decoding:ie,fetchpriority:re?"high":oe,objectFit:de,objectPosition:ae,crossorigin:me,referrerpolicy:ve,className:ph(Se,k),style:lu($e,de,ae,k),lazy:J&&!re,data:Re}),_e;if(k){let Ie=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;_e=`<div id="${_}" class="stx-img-placeholder" style="${Ie}">
|
|
2225
2224
|
<picture>
|
|
2226
2225
|
${Te.join(`
|
|
2227
2226
|
`)}
|
|
@@ -2231,9 +2230,9 @@ ${Te.join(`
|
|
|
2231
2230
|
${Te.join(`
|
|
2232
2231
|
`)}
|
|
2233
2232
|
<img ${Ce} />
|
|
2234
|
-
</picture>`;return _e}function
|
|
2233
|
+
</picture>`;return _e}function x0(v,_,k,E){let{src:T,alt:j,width:B,height:z,dpr:F=[1,2,3],quality:V=au,params:H={},lazy:G=!0,priority:ne=!1,loading:J=ne?"eager":ma,decoding:re=ga,fetchpriority:se,objectFit:ie,objectPosition:oe,crossorigin:de,referrerpolicy:ae}=v,{class:me,style:ve}=v,Se=v.data||{},$e=typeof B==="number"?B:Number.parseInt(String(B),10),Re=ch(T,$e,F,{...H,q:V}),Ee=cu({src:Hi(T,{...H,w:$e,q:V}),alt:j,width:B,height:z,loading:ne?void 0:J,decoding:re,fetchpriority:ne?"high":se,objectFit:ie,objectPosition:oe,crossorigin:de,referrerpolicy:ae,className:ph(me,k),style:lu(ve,ie,oe,k),lazy:G&&!ne,data:Se}),Te=G&&!ne?`data-srcset="${Re}"`:`srcset="${Re}"`;if(k){let Ce=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${_}" class="stx-img-placeholder" style="${Ce}">
|
|
2235
2234
|
<img ${Ee} ${Te} />
|
|
2236
|
-
</div>`}return`<img ${_?`id="${_}" `:""}${Ee} ${Te} />`}function
|
|
2235
|
+
</div>`}return`<img ${_?`id="${_}" `:""}${Ee} ${Te} />`}function b0(v){let{src:_,alt:k,width:E,height:T,loading:j=ma,decoding:B=ga,fetchpriority:z,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G,priority:ne=!1}=v,{class:J,style:re,id:se}=v,ie=v.data||{};return{html:`<img ${cu({src:_,alt:k,width:E,height:T,loading:ne?"eager":j,decoding:B,fetchpriority:ne?"high":z,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G,className:J,style:lu(re,F,V),id:se,data:ie})} />`}}function cu(v){let _=[];if(v.lazy)_.push(`data-src="${_n(v.src)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else _.push(`src="${_n(v.src)}"`);if(_.push(`alt="${_n(v.alt)}"`),v.width)_.push(`width="${v.width}"`);if(v.height)_.push(`height="${v.height}"`);if(v.loading)_.push(`loading="${v.loading}"`);if(v.decoding)_.push(`decoding="${v.decoding}"`);if(v.fetchpriority)_.push(`fetchpriority="${v.fetchpriority}"`);if(v.crossorigin)_.push(`crossorigin="${v.crossorigin}"`);if(v.referrerpolicy)_.push(`referrerpolicy="${v.referrerpolicy}"`);if(v.className)_.push(`class="${_n(v.className)}"`);if(v.style)_.push(`style="${_n(v.style)}"`);if(v.id)_.push(`id="${_n(v.id)}"`);if(v.data)for(let[k,E]of Object.entries(v.data))_.push(`data-${k}="${_n(E)}"`);if(v.lazy)_.push("data-stx-lazy");return _.join(" ")}function ph(v,_){let k=[];if(v)k.push(v);if(_)k.push("stx-img-blur");return k.join(" ")||""}function lu(v,_,k,E){let T=[];if(_)T.push(`object-fit: ${_}`);if(k)T.push(`object-position: ${k}`);if(E)T.push("opacity: 0; transition: opacity 300ms ease-out");if(v)T.push(v);return T.join("; ")}function _n(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function gh(v){return`
|
|
2237
2236
|
(function() {
|
|
2238
2237
|
const container = document.getElementById('${v}');
|
|
2239
2238
|
if (!container) return;
|
|
@@ -2270,7 +2269,7 @@ ${Te.join(`
|
|
|
2270
2269
|
|
|
2271
2270
|
observer.observe(container);
|
|
2272
2271
|
})();
|
|
2273
|
-
`.trim()}async function
|
|
2272
|
+
`.trim()}async function v0(v,_){let k=await h0();if(!k)return pa({...v,process:!1},_);let E=_.tsImagesConfig;if(v.responsiveWidths&&v.responsiveWidths.length>0||v.widths&&v.widths.length>0||!v.width&&!v.dpr){let j=await k.generateResponsiveVariants(v.src,v,E);if(j)return mh(v,j,_)}else{let j=await k.processImage(v.src,v,E);if(j.processed)return uu(v,j,_)}return pa({...v,process:!1},_)}async function uu(v,_,k){let{alt:E,width:T,height:j,lazy:B=!0,priority:z=!1,objectFit:F,objectPosition:V,crossorigin:H,referrerpolicy:G}=v,{class:ne,style:J}=v,re=v.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,se=v.data||{},ie=_.variants||[],oe=ie.find((Ae)=>Ae.format==="jpeg")||ie.find((Ae)=>Ae.format==="webp")||ie[0],de=oe?.url||v.src,ae=ie.filter((Ae)=>Ae.format===(oe?.format||"jpeg")).map((Ae)=>`${Ae.url} ${Ae.width}w`).join(", "),me=new Map;for(let Ae of ie){if(!me.has(Ae.format))me.set(Ae.format,[]);me.get(Ae.format).push(Ae)}let ve=[],Se=["avif","webp","jpeg","png"];for(let Ae of Se){let Ze=me.get(Ae);if(Ze&&Ze.length>0){let ct=Ze.map((rt)=>`${rt.url} ${rt.width}w`).join(", "),it=su(Ae);if(B&&!z)ve.push(` <source type="${it}" data-srcset="${ct}" />`);else ve.push(` <source type="${it}" srcset="${ct}" />`)}}let $e=[];if(B&&!z){if($e.push(`data-src="${_n(de)}"`),$e.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),ae)$e.push(`data-srcset="${ae}"`)}else if($e.push(`src="${_n(de)}"`),ae)$e.push(`srcset="${ae}"`);$e.push(`alt="${_n(E)}"`);let Re=T||_.originalWidth,Ee=j||_.originalHeight;if(Re)$e.push(`width="${Re}"`);if(Ee)$e.push(`height="${Ee}"`);if(!z)$e.push(`loading="${B?"lazy":"eager"}"`);if($e.push('decoding="async"'),z)$e.push('fetchpriority="high"');if(H)$e.push(`crossorigin="${H}"`);if(G)$e.push(`referrerpolicy="${G}"`);let Te=[];if(F)Te.push(`object-fit: ${F}`);if(V)Te.push(`object-position: ${V}`);if(_.placeholder&&B)Te.push("opacity: 0; transition: opacity 300ms ease-out");if(J)Te.push(J);if(Te.length>0)$e.push(`style="${Te.join("; ")}"`);let Ce=[];if(ne)Ce.push(ne);if(_.placeholder)Ce.push("stx-img-blur");if(Ce.length>0)$e.push(`class="${Ce.join(" ")}"`);if(B&&!z)$e.push("data-stx-lazy");for(let[Ae,Ze]of Object.entries(se))$e.push(`data-${Ae}="${_n(Ze)}"`);let _e;if(_.placeholder||_.dominantColor&&v.useDominantColor){let Ae=_.placeholder?`background-image: url('${_.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${_.dominantColor};`;_e=`<div id="${re}" class="stx-img-placeholder" style="${Ae}">
|
|
2274
2273
|
<picture>
|
|
2275
2274
|
${ve.join(`
|
|
2276
2275
|
`)}
|
|
@@ -2280,11 +2279,11 @@ ${ve.join(`
|
|
|
2280
2279
|
${ve.join(`
|
|
2281
2280
|
`)}
|
|
2282
2281
|
<img ${$e.join(" ")} />
|
|
2283
|
-
</picture>`;let Ie=[];if(_.placeholder)Ie.push(
|
|
2284
|
-
`):void 0,script:Xe}}async function
|
|
2282
|
+
</picture>`;let Ie=[];if(_.placeholder)Ie.push(ou);let Xe=B?gh(re):void 0,Pe;if(z&&ae)Pe=`<link rel="preload" as="image" imagesrcset="${ae}" />`;return{html:_e,preloadLink:Pe,css:Ie.length>0?Ie.join(`
|
|
2283
|
+
`):void 0,script:Xe}}async function mh(v,_,k){let E={src:_.src,processed:!0,variants:[],placeholder:_.placeholder?.dataURL,originalWidth:_.placeholder?.width,originalHeight:_.placeholder?.height};for(let[T,j]of Object.entries(_.byFormat))if(j)E.variants.push(...j);return uu(v,E,k)}function w0(){return qe({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(v,_,k,E)=>{let{src:T,alt:j,options:B}=S0(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:T,alt:j||"",widths:B.widths||Xs,formats:B.formats||Ui,quality:B.quality,sizes:B.sizes,dpr:B.dpr,params:B.params,placeholder:B.placeholder,placeholderOptions:B.placeholderOptions,lazy:B.lazy!==!1,priority:B.priority||!1,loading:B.loading,decoding:B.decoding,fetchpriority:B.fetchpriority,objectFit:B.objectFit,objectPosition:B.objectPosition,class:B.class,style:B.style,id:B.id,width:B.width,height:B.height},F=k.__isDev||!1,V=await pa(z,{isDev:F}),H=V.html;if(V.preloadLink)H=V.preloadLink+`
|
|
2285
2284
|
`+H;if(V.css)H+=`
|
|
2286
2285
|
<style>${V.css}</style>`;if(V.script)H+=`
|
|
2287
|
-
<script>${V.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function
|
|
2286
|
+
<script>${V.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function S0(v,_,k){if(_.src)return{src:String(_.src),alt:String(_.alt||""),options:_.options||{}};let E=v.trim();if(E.startsWith("@img(")||E.startsWith("("))E=E.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=$0(E),j=du(T[0],k)||"",B=du(T[1],k)||"",z={};if(T[2]){let F=du(T[2],k);if(typeof F==="object"&&F!==null)z=F;else if(typeof T[2]==="string")try{z=JSON.parse(T[2])}catch{}}return{src:j,alt:B,options:z}}function $0(v){let _=[],k="",E=!1,T="",j=0,B=0;for(let z=0;z<v.length;z++){let F=v[z],V=z>0?v[z-1]:"";if((F==='"'||F==="'"||F==="`")&&V!=="\\"){if(!E)E=!0,T=F;else if(F===T)E=!1,T="";else k+=F;continue}if(!E){if(F==="{")j++;if(F==="}")j--;if(F==="[")B++;if(F==="]")B--;if(F===","&&j===0&&B===0){_.push(k.trim()),k="";continue}}k+=F}if(k.trim())_.push(k.trim());return _}function du(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let E=_[k];if(E!==void 0)return E}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var hh=w0();async function xh(){try{return await import("./chunk-k84qkm21.js")}catch(v){if(!yh)console.warn("[stx-media] Video processor not available, some features disabled:",v),yh=!0;return null}}var yh=!1,bh=!0,vh="metadata",_0="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function ha(v,_={}){let k=_,E=v;if(E.process&&!E.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return T0(E,k)}if(k.processedResult?.processed)return Sh(v,k.processedResult,_);let T;if(E.generatePoster&&E.src&&!v.poster)T=await A0(E,k);let{src:j,sources:B=[],poster:z,posterPlaceholder:F,controls:V=bh,autoplay:H=!1,muted:G=!1,loop:ne=!1,preload:J=vh,playsinline:re=!0,lazy:se=!0,player:ie="native",type:oe,width:de,height:ae,crossorigin:me,disablePictureInPicture:ve=!1,disableRemotePlayback:Se=!1}=v,$e=T||z,{class:Re,style:Ee}=v,Te=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ie==="ts-video")return E0(v,_);if(oe&&oe!=="video")return k0(j||"",oe,v);let Ce=B.length>0?B:j?[{src:j,type:wh(j)}]:[],_e=[`id="${Te}"`];if(V)_e.push("controls");if(H)_e.push("autoplay");if(G)_e.push("muted");if(ne)_e.push("loop");if(re)_e.push("playsinline");if(ve)_e.push("disablepictureinpicture");if(Se)_e.push("disableremoteplayback");if(me)_e.push(`crossorigin="${me}"`);if(se){if(_e.push(`data-preload="${J}"`),_e.push('preload="none"'),$e)_e.push(`data-poster="${qt($e)}"`);_e.push("data-stx-lazy")}else if(_e.push(`preload="${J}"`),$e)_e.push(`poster="${qt($e)}"`);if(de)_e.push(`width="${de}"`);if(ae)_e.push(`height="${ae}"`);if(Re)_e.push(`class="${qt(Re)}"`);if(Ee)_e.push(`style="${qt(Ee)}"`);let Ie=Ce.map((Ae)=>` <source ${se?`data-src="${qt(Ae.src)}"`:`src="${qt(Ae.src)}"`} type="${Ae.type}"${Ae.media?` media="${Ae.media}"`:""} />`).join(`
|
|
2288
2287
|
`),Xe=`<video ${_e.join(" ")}>
|
|
2289
2288
|
${Ie}
|
|
2290
2289
|
Your browser does not support the video tag.
|
|
@@ -2323,9 +2322,9 @@ ${Ie}
|
|
|
2323
2322
|
|
|
2324
2323
|
observer.observe(video);
|
|
2325
2324
|
})();
|
|
2326
|
-
`.trim();return{html:Xe,script:Pe}}function
|
|
2325
|
+
`.trim();return{html:Xe,script:Pe}}function k0(v,_,k){let{width:E=640,height:T=360}=k,{class:j,style:B}=k,z=k.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,F,V=null;switch(_){case"youtube":V=C0(v),F=V?`https://www.youtube-nocookie.com/embed/${V}`:v;break;case"vimeo":V=R0(v),F=V?`https://player.vimeo.com/video/${V}`:v;break;case"dailymotion":V=v.split("/").pop()||"",F=`https://www.dailymotion.com/embed/video/${V}`;break;case"twitch":V=v.split("/").pop()||"",F=`https://player.twitch.tv/?video=${V}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:F=v}let H=[`id="${z}"`,`src="${qt(F)}"`,`width="${E}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(j)H.push(`class="${qt(j)}"`);if(B)H.push(`style="${qt(B)}"`);if(k.lazy)H.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
2327
2326
|
<iframe ${H.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
2328
|
-
</div>`}}function
|
|
2327
|
+
</div>`}}function E0(v,_={}){let{src:k,sources:E=[],poster:T,controls:j=!0,autoplay:B=!1,muted:z=!1,loop:F=!1,preload:V="metadata",playsinline:H=!0,lazy:G=!0,width:ne,height:J}=v,{class:re,style:se}=v,ie=v.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,oe={src:E.length>0?E:k,autoplay:B,loop:F,muted:z,playsinline:H,preload:V,poster:T,controls:j,title:v.title},de=["position: relative",ne?`width: ${typeof ne==="number"?ne+"px":ne}`:"width: 100%",J?`height: ${typeof J==="number"?J+"px":J}`:"",se||""].filter(Boolean).join("; "),ae=`
|
|
2329
2328
|
<div
|
|
2330
2329
|
id="${ie}"
|
|
2331
2330
|
class="ts-video-player${re?" "+qt(re):""}"
|
|
@@ -2362,7 +2361,7 @@ ${Ie}
|
|
|
2362
2361
|
|
|
2363
2362
|
// Load ts-video-player from CDN
|
|
2364
2363
|
var script = document.createElement('script');
|
|
2365
|
-
script.src = '${
|
|
2364
|
+
script.src = '${_0}';
|
|
2366
2365
|
script.onload = initPlayer;
|
|
2367
2366
|
script.onerror = function() {
|
|
2368
2367
|
console.error('[stx] Failed to load ts-video-player');
|
|
@@ -2492,7 +2491,7 @@ else {
|
|
|
2492
2491
|
.ts-video-player__play-button svg {
|
|
2493
2492
|
margin-left: 4px;
|
|
2494
2493
|
}
|
|
2495
|
-
`.trim();return{html:ae,script:me,css:ve}}function
|
|
2494
|
+
`.trim();return{html:ae,script:me,css:ve}}function wh(v){switch(v.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function C0(v){let _=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let k of _){let E=v.match(k);if(E)return E[1]}return null}function R0(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function qt(v){return v.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function T0(v,_){let k=await xh();if(!k)return ha({...v,process:!1},_);let E=_.tsVideosConfig,T=await k.processVideo(v.src,v,E,v.onProcessProgress);if(T.processed)return Sh(v,T,_);return ha({...v,process:!1},_)}async function A0(v,_){let k=await xh();if(!k||!v.src)return;let E=typeof v.generatePoster==="object"?v.generatePoster:{timestamp:0},T=_.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await k.generatePoster(v.src,E,T.outputDir,T.baseUrl||"/videos"))?.url}function Sh(v,_,k){let{controls:E=bh,autoplay:T=!1,muted:j=!1,loop:B=!1,preload:z=vh,playsinline:F=!0,lazy:V=!0,width:H,height:G,crossorigin:ne,disablePictureInPicture:J=!1,disableRemotePlayback:re=!1}=v,{class:se,style:ie}=v,oe=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,de=v.src,ae=wh(de);if(_.transcoded)de=_.transcoded.url,ae="video/mp4";let me=_.streaming?.hls||_.streaming?.dash;if(me){if(_.streaming?.hls)de=_.streaming.hls.manifestUrl,ae="application/x-mpegURL";else if(_.streaming?.dash)de=_.streaming.dash.manifestUrl,ae="application/dash+xml"}let ve=_.poster?.url||v.poster,Se=[`id="${oe}"`];if(E)Se.push("controls");if(T)Se.push("autoplay");if(j)Se.push("muted");if(B)Se.push("loop");if(F)Se.push("playsinline");if(J)Se.push("disablepictureinpicture");if(re)Se.push("disableremoteplayback");if(ne)Se.push(`crossorigin="${ne}"`);if(V){if(Se.push(`data-preload="${z}"`),Se.push('preload="none"'),ve)Se.push(`data-poster="${qt(ve)}"`);Se.push("data-stx-lazy")}else if(Se.push(`preload="${z}"`),ve)Se.push(`poster="${qt(ve)}"`);let $e=H||_.metadata?.width,Re=G||_.metadata?.height;if($e)Se.push(`width="${$e}"`);if(Re)Se.push(`height="${Re}"`);if(se)Se.push(`class="${qt(se)}"`);if(ie)Se.push(`style="${qt(ie)}"`);let Te=` <source ${V?`data-src="${qt(de)}"`:`src="${qt(de)}"`} type="${ae}" />`,Ce=`<video ${Se.join(" ")}>
|
|
2496
2495
|
${Te}
|
|
2497
2496
|
Your browser does not support the video tag.
|
|
2498
2497
|
</video>`;if(_.spriteSheet)Ce=`<div class="stx-video-wrapper" data-sprite-sheet="${qt(_.spriteSheet.url)}" data-sprite-cols="${_.spriteSheet.columns}" data-sprite-interval="${_.spriteSheet.interval}">
|
|
@@ -2541,9 +2540,9 @@ ${Ce}
|
|
|
2541
2540
|
width: 100%;
|
|
2542
2541
|
height: auto;
|
|
2543
2542
|
}
|
|
2544
|
-
`.trim();return{html:Ce,script:_e,css:Ie}}function
|
|
2543
|
+
`.trim();return{html:Ce,script:_e,css:Ie}}function $h(){return qe({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(v,_,k,E)=>{let{src:T,options:j}=I0(v,_,k);if(!T)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let B={src:T,poster:j.poster,controls:j.controls!==!1,autoplay:j.autoplay||!1,muted:j.muted||!1,loop:j.loop||!1,preload:j.preload||"metadata",playsinline:j.playsinline!==!1,lazy:j.lazy!==!1,player:j.player||"native",type:j.type,width:j.width,height:j.height,class:j.class,style:j.style,id:j.id,crossorigin:j.crossorigin,disablePictureInPicture:j.disablePictureInPicture,disableRemotePlayback:j.disableRemotePlayback,title:j.title,quality:j.quality,platform:j.platform,process:j.process,generatePoster:j.generatePoster,streaming:j.streaming,transcode:j.transcode,spriteSheet:j.spriteSheet,waveform:j.waveform},F={isDev:k.__isDev||!1,tsVideosConfig:k.__tsVideosConfig},V=await ha(B,F),H=V.html;if(V.css)H+=`
|
|
2545
2544
|
<style>${V.css}</style>`;if(V.script)H+=`
|
|
2546
|
-
<script>${V.script}</script>`;return H},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function
|
|
2545
|
+
<script>${V.script}</script>`;return H},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function I0(v,_,k){if(_.src)return{src:String(_.src),options:_.options||{}};let E=v.trim();if(E.startsWith("@video(")||E.startsWith("("))E=E.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=P0(E),j=_h(T[0],k)||"",B={};if(T[1]){let z=_h(T[1],k);if(typeof z==="object"&&z!==null)B=z;else if(typeof T[1]==="string")try{B=JSON.parse(T[1])}catch{}}return{src:j,options:B}}function P0(v){let _=[],k="",E=!1,T="",j=0,B=0;for(let z=0;z<v.length;z++){let F=v[z],V=z>0?v[z-1]:"";if((F==='"'||F==="'"||F==="`")&&V!=="\\"){if(!E)E=!0,T=F;else if(F===T)E=!1,T="";else k+=F;continue}if(!E){if(F==="{")j++;if(F==="}")j--;if(F==="[")B++;if(F==="]")B--;if(F===","&&j===0&&B===0){_.push(k.trim()),k="";continue}}k+=F}if(k.trim())_.push(k.trim());return _}function _h(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let E=_[k];if(E!==void 0)return E}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var fu=$h();import D0 from"fs";import wn from"path";async function Xn(v,_){if(!v.webComponents?.enabled)return[];let k=v.webComponents.components||[],E=[];if(k.length>0){if(v.debug)console.log(`Building ${k.length} web components...`);for(let T of k)try{let j=await M0(T,v,_);if(j)E.push(j)}catch(j){if(console.error(`Error building web component ${T.name}:`,j),v.debug)throw j}}return E}async function M0(v,_,k){let{name:E,file:T,tag:j,extends:B}=v;if(!E||!T||!j)return console.error("Invalid web component configuration, missing required fields:",v),null;let z=null;if(wn.isAbsolute(T)&&await r(T))z=T;else if(_.componentsDir){let se=wn.join(_.componentsDir,T);if(await r(se))z=se}if(!z)z=await Kn(T,process.cwd(),_,k);if(!z)return console.error(`Web component source file not found: ${T}`),null;let F=await Bun.file(z).text();k.add(z);let H=(v.outputFormat||"js")==="ts",G=H?N0({name:E,tag:j,baseElement:B,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[],attributeTypes:v.attributeTypes||{}}):O0({name:E,tag:j,baseElement:B,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[]}),ne=_.webComponents?.outputDir||"dist/web-components";await D0.promises.mkdir(ne,{recursive:!0});let J=H?"ts":"js",re=wn.join(ne,`${j}.${J}`);if(await Bun.write(re,G),_.debug)console.log(`Built web component ${E} -> ${re}`);return re}function O0(v){let{name:_,tag:k,baseElement:E="HTMLElement",source:T,shadowDOM:j,template:B,styleSource:z,attributes:F=[]}=v,V=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)V=V.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),V=V.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),V=V.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),V=V.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let H="";if(z)H=`<link rel="stylesheet" href="${z}">`;return`/**
|
|
2547
2546
|
* ${_} Web Component
|
|
2548
2547
|
* Auto-generated from stx component
|
|
2549
2548
|
*/
|
|
@@ -2635,7 +2634,7 @@ class ${_.replace(/\W/g,"")} extends ${E} {
|
|
|
2635
2634
|
|
|
2636
2635
|
// Register the web component
|
|
2637
2636
|
customElements.define('${k}', ${_.replace(/\W/g,"")})
|
|
2638
|
-
`}function
|
|
2637
|
+
`}function N0(v){let{name:_,tag:k,baseElement:E="HTMLElement",source:T,shadowDOM:j,template:B,styleSource:z,attributes:F=[],attributeTypes:V={}}=v,H=_.replace(/\W/g,""),G=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!j)G=G.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),G=G.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),G=G.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),G=G.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");G=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let ne=z?`<link rel="stylesheet" href="${z}">`:"",J=(ve)=>{switch(V[ve]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},re=(ve)=>ve.replace(/-([a-z])/g,(Se,$e)=>$e.toUpperCase()),se=F.map((ve)=>` private _${re(ve)}: ${J(ve)} | null = null;`).join(`
|
|
2639
2638
|
`),ie=F.map((ve)=>{let Se=J(ve),$e=re(ve);return`
|
|
2640
2639
|
get ${$e}(): ${Se} | null {
|
|
2641
2640
|
return this._${$e};
|
|
@@ -2790,7 +2789,7 @@ declare global {
|
|
|
2790
2789
|
|
|
2791
2790
|
// Register the web component
|
|
2792
2791
|
customElements.define('${k}', ${H});
|
|
2793
|
-
`}function
|
|
2792
|
+
`}function j0(v,_){let k=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),E=k?k[1].trim():"",T=_,j=[],B=!0;if(E){let G=E.match(/export\s+default\s+({[\s\S]*})/);if(G)try{let ne=G[1],J=ne.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(J)T=J[1];let re=ne.match(/props\s*:\s*\[([\s\S]*?)\]/);if(re)j=re[1].split(",").map((ie)=>ie.trim().replace(/['"`]/g,"")).filter((ie)=>ie.length>0);let se=ne.match(/shadowDOM\s*:\s*(true|false)/);if(se)B=se[1]==="true"}catch{}}let z=v.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),F=z?z[1].trim():"",V=v.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),H=V?V[1].trim():"";return{tag:T,props:j,template:F,styles:H,script:E,shadowDOM:B}}function L0(v){let{tag:_,props:k,template:E,styles:T,shadowDOM:j}=v,B=_.split("-").map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join(""),z=E.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),F=T.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),V=k.map((G)=>`'${G}'`).join(", "),H=k.map((G)=>`
|
|
2794
2793
|
get ${G}() {
|
|
2795
2794
|
return this.getAttribute('${G}') || '';
|
|
2796
2795
|
}
|
|
@@ -2841,8 +2840,8 @@ ${H}
|
|
|
2841
2840
|
}
|
|
2842
2841
|
|
|
2843
2842
|
customElements.define('${_}', ${B});
|
|
2844
|
-
`}async function
|
|
2845
|
-
${
|
|
2846
|
-
</script>`}var I={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:$t,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:rh,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:wh,hasEndTag:!1,description:"Include a web component in the template"},gi,mi,Zn,Qn,hu,bu,wu,yu,Uu,Xu,fh,uu,...dr],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function j0(v,_,k){let E=_||"pages";if(v)return{root:v,pagesDir:E};let T=k||process.cwd(),j=un.join(T,"resources","views"),B=un.join(T,"resources","layouts");if(ha.existsSync(j)&&ha.existsSync(B))return{root:"resources",pagesDir:"views"};let z=un.join(T,"resources","views","pages");if(ha.existsSync(z))return{root:"resources/views",pagesDir:E};return{root:".",pagesDir:E}}var Sh=new Set,ya=["partialsDir","componentsDir","layoutsDir"],du=new WeakMap;function L0(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let E=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return E===T||E.startsWith(`${T}/`)}function _c(v,_){let k=!v.root,E=j0(v.root,v.pagesDir,_);if(v.root=E.root,v.pagesDir=E.pagesDir,k&&E.root!=="."){let T=`${_}::${E.root}`;if(!Sh.has(T))Sh.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${E.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!du.has(v)){let T={};for(let j of ya){let B=v[j];if(typeof B==="string"&&B)T[j]=B}du.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let j of ya){let B=v[j];if(typeof B!=="string"||!B)continue;if(un.isAbsolute(B)||L0(B,T))continue;v[j]=un.join(T,B)}}for(let T of ya){let j=v[T];if(typeof j!=="string"||!j||un.isAbsolute(j))continue;v[T]=un.resolve(_,j)}return v}function B0(v,_){let k=du.get(v);for(let E of ya){let T=v[E];if(typeof T!=="string"||!T)continue;let j=un.isAbsolute(T)?T:un.join(_,T);if(ha.existsSync(j))continue;let B=k?.[E]??T,z=v.root,F=!!z&&z!==".";console.warn(`[stx] ${String(E)} resolves to "${j}", which does not exist. Configured as "${B}"`+(F?`, resolved under root "${z}".`:"."))}}function z0(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function F0(v){if(vi(v.stateDir),v.stateDir=an(),v.cachePath=cn(v.cachePath),v.build)v.build.cacheDir=cn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=cn(v.media.cache.directory);if(v.story)v.story.outDir=cn(v.story.outDir)}var wr=null,Br=new Map,ma=new Map,Hi=null;async function o(v){let _=v?un.resolve(v):process.cwd(),k=ma.get(_);if(k&&k.signature!==Gn(k.graph)){let j=Br.get(_);if(Br.delete(_),ma.delete(_),!v)wr=null,Hi=null;let{clearComponentCache:B}=await import("./chunk-7ph65fcr.js"),{partialsCache:z}=await import("./chunk-8cr4tqwg.js");if(B(),z.clear(),j&&k.configSignature===Jn(k.graph)){let F=j.then(async(V)=>{let H={...k.graph};await xs(H,_),ma.set(_,{graph:H,signature:Gn(H),configSignature:Jn(H)});let G={...V,_layerGraph:H};if(!v)wr=G;return G});return Br.set(_,F),F}}if(!v){if(wr)return wr;if(Hi)return Hi}let E=Br.get(_);if(E)return E;let T=(async()=>{let B=(await N0({name:"stx",alias:"ui",cwd:_,defaultConfig:I,verbose:!1})).config;if(B.extends!==void 0||k){let H=await bi(_,I);B=H.config,ma.set(_,{graph:H.graph,signature:Gn(H.graph),configSignature:Jn(H.graph)})}if(B.runtimeConfig){let{resolveRuntimeConfig:H}=await import("./chunk-zb5p05v4.js");H(B.runtimeConfig,{});let{generateRuntimeConfigTypes:G}=await import("./chunk-cp3d3zrt.js");await G(_,B.runtimeConfig)}z0(B),F0(B),_c(B,_),B0(B,_);let z=[],F=new Set((B.plugins??[]).map((H)=>typeof H==="string"?H:H[0]));for(let H of B.componentPackages??["@stacksjs/components"]){let G=`${H}/stx-plugin`;if(F.has(G)||F.has(H))continue;try{u.resolve(G,{paths:[_]}),z.push(G)}catch{}}let V=[...B.plugins??[],...z];if(V.length>0){let{pluginManager:H}=await import("./chunk-mmh37ywa.js"),G=[],ne=[];for(let J of V){let re=typeof J==="string"?J:J[0],se=typeof J==="string"?{}:J[1]||{};try{let ie,oe;try{let ae=u.resolve(re,{paths:[_]});ie=await import(ae),oe=un.dirname(ae)}catch{let ae=un.resolve(_,re);ie=await import(ae),oe=un.dirname(ae)}let de=ie.default||ie;if(!H.has(de.name))await H.register(de,B);if(de.components){let ae=Array.isArray(de.components)?de.components:[de.components];for(let me of ae)G.push(un.resolve(oe,me))}if(de.pages){let ae=un.resolve(oe,de.pages),me=se.path||"/";ne.push({dir:ae,prefix:me})}if(de.setup){let ae={addDirective:(me)=>{B.customDirectives=B.customDirectives||[],B.customDirectives.push(me)},addRoute:(me,ve)=>{B.apiRoutes=B.apiRoutes||{},B.apiRoutes[me]=ve},addMiddleware:(me)=>{B.middleware=B.middleware||[],B.middleware.push(me)},pluginDir:oe,config:B};await de.setup(se,ae)}process.stderr.write(`[stx] Plugin loaded: ${de.name||re}
|
|
2847
|
-
`)}catch(ie){console.warn(`[stx] Failed to load plugin ${re}:`,ie.message)}}B._pluginComponentDirs=G,B._pluginPageDirs=ne}return B})();if(Br.set(_,T),T.catch(()=>{if(Br.get(_)===T)Br.delete(_)}),!v)
|
|
2843
|
+
`}async function kh(v,_,k,E){if(_.length<1)return i("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let T=_[0].replace(/['"]/g,""),B=(k.__stx_options||{}).componentsDir||"components",z=wn.isAbsolute(B)?[wn.join(B,`${T}.stx`),wn.join(wn.dirname(E),`${T}.stx`)]:[wn.join(wn.dirname(E),B,`${T}.stx`),wn.join(process.cwd(),B,`${T}.stx`),wn.join(wn.dirname(E),`${T}.stx`)],F=null;for(let G of z)if(await r(G)){F=await Bun.file(G).text();break}if(!F)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let V=j0(F,T);return`<script type="module">
|
|
2844
|
+
${L0(V)}
|
|
2845
|
+
</script>`}var I={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:$t,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:ah,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:kh,hasEndTag:!1,description:"Include a web component in the template"},gi,mi,Zn,Qn,bu,Wu,Uu,wu,Ku,Gu,hh,fu,...dr],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function z0(v,_,k){let E=_||"pages";if(v)return{root:v,pagesDir:E};let T=k||process.cwd(),j=un.join(T,"resources","views"),B=un.join(T,"resources","layouts");if(xa.existsSync(j)&&xa.existsSync(B))return{root:"resources",pagesDir:"views"};let z=un.join(T,"resources","views","pages");if(xa.existsSync(z))return{root:"resources/views",pagesDir:E};return{root:".",pagesDir:E}}var Eh=new Set,ba=["partialsDir","componentsDir","layoutsDir"],pu=new WeakMap;function F0(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let E=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return E===T||E.startsWith(`${T}/`)}function _c(v,_){let k=!v.root,E=z0(v.root,v.pagesDir,_);if(v.root=E.root,v.pagesDir=E.pagesDir,k&&E.root!=="."){let T=`${_}::${E.root}`;if(!Eh.has(T))Eh.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${E.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!pu.has(v)){let T={};for(let j of ba){let B=v[j];if(typeof B==="string"&&B)T[j]=B}pu.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let j of ba){let B=v[j];if(typeof B!=="string"||!B)continue;if(un.isAbsolute(B)||F0(B,T))continue;v[j]=un.join(T,B)}}for(let T of ba){let j=v[T];if(typeof j!=="string"||!j||un.isAbsolute(j))continue;v[T]=un.resolve(_,j)}return v}function W0(v,_){let k=pu.get(v);for(let E of ba){let T=v[E];if(typeof T!=="string"||!T)continue;let j=un.isAbsolute(T)?T:un.join(_,T);if(xa.existsSync(j))continue;let B=k?.[E]??T,z=v.root,F=!!z&&z!==".";console.warn(`[stx] ${String(E)} resolves to "${j}", which does not exist. Configured as "${B}"`+(F?`, resolved under root "${z}".`:"."))}}function V0(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function U0(v){if(vi(v.stateDir),v.stateDir=an(),v.cachePath=cn(v.cachePath),v.build)v.build.cacheDir=cn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=cn(v.media.cache.directory);if(v.story)v.story.outDir=cn(v.story.outDir)}var wr=null,Br=new Map,ya=new Map,qi=null;async function o(v){let _=v?un.resolve(v):process.cwd(),k=ya.get(_);if(k&&k.signature!==Gn(k.graph)){let j=Br.get(_);if(Br.delete(_),ya.delete(_),!v)wr=null,qi=null;let{clearComponentCache:B}=await import("./chunk-wfyq4tde.js"),{partialsCache:z}=await import("./chunk-fmgr96es.js");if(B(),z.clear(),j&&k.configSignature===Jn(k.graph)){let F=j.then(async(V)=>{let H={...k.graph};await xs(H,_),ya.set(_,{graph:H,signature:Gn(H),configSignature:Jn(H)});let G={...V,_layerGraph:H};if(!v)wr=G;return G});return Br.set(_,F),F}}if(!v){if(wr)return wr;if(qi)return qi}let E=Br.get(_);if(E)return E;let T=(async()=>{let B=(await B0({name:"stx",alias:"ui",cwd:_,defaultConfig:I,verbose:!1})).config;if(B.extends!==void 0||k){let H=await bi(_,I);B=H.config,ya.set(_,{graph:H.graph,signature:Gn(H.graph),configSignature:Jn(H.graph)})}if(B.runtimeConfig){let{resolveRuntimeConfig:H}=await import("./chunk-zb5p05v4.js");H(B.runtimeConfig,{});let{generateRuntimeConfigTypes:G}=await import("./chunk-csc538a5.js");await G(_,B.runtimeConfig)}V0(B),U0(B),_c(B,_),W0(B,_);let z=[],F=new Set((B.plugins??[]).map((H)=>typeof H==="string"?H:H[0]));for(let H of B.componentPackages??["@stacksjs/components"]){let G=`${H}/stx-plugin`;if(F.has(G)||F.has(H))continue;try{u.resolve(G,{paths:[_]}),z.push(G)}catch{}}let V=[...B.plugins??[],...z];if(V.length>0){let{pluginManager:H}=await import("./chunk-mmh37ywa.js"),G=[],ne=[];for(let J of V){let re=typeof J==="string"?J:J[0],se=typeof J==="string"?{}:J[1]||{};try{let ie,oe;try{let ae=u.resolve(re,{paths:[_]});ie=await import(ae),oe=un.dirname(ae)}catch{let ae=un.resolve(_,re);ie=await import(ae),oe=un.dirname(ae)}let de=ie.default||ie;if(!H.has(de.name))await H.register(de,B);if(de.components){let ae=Array.isArray(de.components)?de.components:[de.components];for(let me of ae)G.push(un.resolve(oe,me))}if(de.pages){let ae=un.resolve(oe,de.pages),me=se.path||"/";ne.push({dir:ae,prefix:me})}if(de.setup){let ae={addDirective:(me)=>{B.customDirectives=B.customDirectives||[],B.customDirectives.push(me)},addRoute:(me,ve)=>{B.apiRoutes=B.apiRoutes||{},B.apiRoutes[me]=ve},addMiddleware:(me)=>{B.middleware=B.middleware||[],B.middleware.push(me)},pluginDir:oe,config:B};await de.setup(se,ae)}process.stderr.write(`[stx] Plugin loaded: ${de.name||re}
|
|
2846
|
+
`)}catch(ie){console.warn(`[stx] Failed to load plugin ${re}:`,ie.message)}}B._pluginComponentDirs=G,B._pluginPageDirs=ne}return B})();if(Br.set(_,T),T.catch(()=>{if(Br.get(_)===T)Br.delete(_)}),!v)qi=T,T.then((j)=>{wr=j}).catch(()=>{});return T}var R=new Proxy(I,{get(v,_){if(wr&&_ in wr)return wr[_];if(!qi)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function Hu(v){return v}function Vu(v){let _=[],k=[];if(v.partialsDir!==void 0&&typeof v.partialsDir!=="string")_.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(v.componentsDir!==void 0&&typeof v.componentsDir!=="string")_.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(v.cache!==void 0&&typeof v.cache!=="boolean")_.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(v.debug!==void 0&&typeof v.debug!=="boolean")_.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(v.streaming){if(v.streaming.bufferSize!==void 0){if(typeof v.streaming.bufferSize!=="number"||v.streaming.bufferSize<=0)_.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(v.streaming.timeout!==void 0){if(typeof v.streaming.timeout!=="number"||v.streaming.timeout<=0)_.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(v.streaming.strategy!==void 0){let E=["auto","manual","sections"];if(!E.includes(v.streaming.strategy))_.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.i18n){if(v.i18n.format!==void 0){let E=["json","yaml","yml","js"];if(!E.includes(v.i18n.format))_.push({path:"i18n.format",message:`i18n.format must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.animation){if(v.animation.defaultDuration!==void 0){if(typeof v.animation.defaultDuration!=="number"||v.animation.defaultDuration<0)_.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(v.animation.staggerDelay!==void 0){if(typeof v.animation.staggerDelay!=="number"||v.animation.staggerDelay<0)_.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(v.a11y){if(v.a11y.level!==void 0){let E=["AA","AAA"];if(!E.includes(v.a11y.level))_.push({path:"a11y.level",message:`a11y.level must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.hydration){if(v.hydration.mode!==void 0){let E=["progressive","islands"];if(!E.includes(v.hydration.mode))_.push({path:"hydration.mode",message:`hydration.mode must be one of: ${E.join(", ")}`,severity:"error"})}if(v.hydration.preload!==void 0){let E=["none","eager","lazy"];if(!E.includes(v.hydration.preload))_.push({path:"hydration.preload",message:`hydration.preload must be one of: ${E.join(", ")}`,severity:"error"})}}if(v.customDirectives)if(!Array.isArray(v.customDirectives))_.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else v.customDirectives.forEach((E,T)=>{if(!E.name||typeof E.name!=="string")_.push({path:`customDirectives[${T}].name`,message:"Custom directive must have a name string",severity:"error"});if(!E.handler||typeof E.handler!=="function")_.push({path:`customDirectives[${T}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(v.middleware)if(!Array.isArray(v.middleware))_.push({path:"middleware",message:"middleware must be an array",severity:"error"});else v.middleware.forEach((E,T)=>{if(!E.name||typeof E.name!=="string")_.push({path:`middleware[${T}].name`,message:"Middleware must have a name string",severity:"error"});if(!E.handler||typeof E.handler!=="function")_.push({path:`middleware[${T}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!E.timing||!["before","after"].includes(E.timing))_.push({path:`middleware[${T}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(v.debug===!0&&v.cache===!0)k.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(v.seo?.enabled===!0&&!v.seo?.defaultConfig?.title)k.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(v.pwa){if(v.pwa.enabled===!0&&!v.pwa.manifest?.name)_.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(v.pwa.manifest?.display!==void 0){let E=["fullscreen","standalone","minimal-ui","browser"];if(!E.includes(v.pwa.manifest.display))_.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${E.join(", ")}`,severity:"error"})}if(v.pwa.manifest?.orientation!==void 0){let E=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!E.includes(v.pwa.manifest.orientation))_.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${E.join(", ")}`,severity:"error"})}if(v.pwa.routes){let E=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];v.pwa.routes.forEach((T,j)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${j}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!E.includes(T.strategy))_.push({path:`pwa.routes[${j}].strategy`,message:`PWA route strategy must be one of: ${E.join(", ")}`,severity:"error"});if(T.maxAgeSeconds!==void 0&&(typeof T.maxAgeSeconds!=="number"||T.maxAgeSeconds<0))_.push({path:`pwa.routes[${j}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(T.maxEntries!==void 0&&(typeof T.maxEntries!=="number"||T.maxEntries<1))_.push({path:`pwa.routes[${j}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(v.pwa.icons?.sizes){if(!Array.isArray(v.pwa.icons.sizes))_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(v.pwa.icons.sizes.filter((T)=>typeof T!=="number"||T<16||T>1024).length>0)_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(v.pwa.icons?.purpose){let E=["any","maskable","monochrome"];if(v.pwa.icons.purpose.filter((j)=>!E.includes(j)).length>0)_.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${E.join(", ")}`,severity:"error"})}if(v.pwa.enabled===!0&&!v.pwa.icons?.src)k.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(v.pwa.enabled===!0&&!v.pwa.manifest?.themeColor)k.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:_.length===0,errors:_,warnings:k}}var mu=new Map;async function le(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let E=(await H0.promises.stat(v)).mtime.getTime();if(_.cache&&mu.has(v)){let G=mu.get(v);if(G.updatedAt>=E)return{content:G.content,data:G.data}}let T=await Bun.file(v).text(),{data:j,content:B}=Dn(T),z=_.markdown||R.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},V=Oe(B,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)V=await K0(V,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:V,data:j||{}};if(_.cache)mu.set(v,{...H,updatedAt:E});return H}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let E=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${E}`,v,"",0,""),data:{}}}}var va=null;async function K0(v,_,k){let E=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!va)try{va=await q0({theme:_||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),v}let T=async(z,F,V,H)=>{let G=H.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),ne=V||(k?"text":"");if(!ne)return z;try{if(!va.getSupportedLanguages().includes(ne))return z;return(await va.highlight(G,ne,{theme:_})).html}catch(J){console.error(`Error highlighting code block with language ${V}:`,J)}return z},j=v,B=v.matchAll(E);for(let z of B){let[F,V,H,G]=z,ne=await T(F,V,H,G);j=j.replace(F,ne)}return j}async function Bm(v,_,k="",E={}){return await X0(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(B,z,F,V)=>{try{let H=z;if(!gu.isAbsolute(z))H=gu.resolve(gu.dirname(k),z);let G={};if(F)try{try{G=JSON.parse(F)}catch{if(E.debug)console.warn("Using safer alternative for parsing JS object literal");let de=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ae of de){let me=ae.indexOf(":");if(me>0){let ve=ae.substring(0,me).trim(),Se=ae.substring(me+1).trim(),$e=Se.startsWith('"')&&Se.endsWith('"'),Re=Se.startsWith("'")&&Se.endsWith("'");if($e||Re)Se=Se.substring(1,Se.length-1);G[ve]=Se}}}}catch(oe){if(E.debug)console.error("Error parsing context in @markdown-file directive:",oe)}let{content:ne,data:J}=await le(H,E),re={..._,...J,...G},se=ne,ie=/\{\{([^}]+)\}\}/g;return se=se.replace(ie,(oe,de)=>{let ae=de.trim();return re[ae]!==void 0?String(re[ae]):oe}),se}catch(H){let G=H instanceof Error?H.message:String(H);return g("Markdown File",`Error including markdown file: ${G}`,k,v,V,B)}})}async function X0(v,_,k){let E=[],T;while((T=_.exec(v))!==null){let z=T[0],F=T.index,V=T;E.push(k(...V).then((H)=>({match:z,replacement:H,index:F})))}let j=await Promise.all(E);j.sort((z,F)=>F.index-z.index);let B=v;for(let{match:z,replacement:F}of j)B=B.replace(z,()=>F);return B}
|
|
2848
2847
|
export{Dn,Oe,M,U,m,h,Qt,W,w,Me,Kr,Xr,Va,wt,jo,Gr,Bo,vu,Ne,Jr,he,Fo,zo,Ho,Yr,Y,Le,vt,On,Ua,xu,Wa,Su,qa,Mn,b,xt,ye,Ka,Zr,Xa,ku,q,Ga,Cu,x,$u,Ja,Eu,_u,Tu,Ru,Ya,Za,Au,Pu,Vo,Iu,en,tn,Nn,Ln,e,Du,Uo,Ou,Wo,Qa,ec,St,nn,Mu,tc,nc,rc,f,je,kt,Be,Fe,qo,jn,Z,Qr,es,ts,Nu,Bn,Lu,rn,ze,ns,rs,sc,Q,Ko,Xo,Go,Jo,Fn,ss,Yo,Zo,Qo,oc,os,N,ce,K,ju,ic,is,as,ei,ti,cs,ls,zn,ac,ni,ri,cc,He,sn,Hn,Ct,lc,uc,dc,pc,fc,d,gc,us,mc,si,oi,ds,ii,hc,Bu,yc,be,ai,Fu,ps,gs,ms,Vn,ci,hs,Un,on,Wn,ys,bs,ws,n,bc,wc,vc,xc,Sc,kc,Ve,L,Ue,Cc,qn,$c,li,Ec,We,r,Kn,ui,g,ee,zu,Xn,I,_c,o,R,Hu,Vu,le};
|