@stacksjs/stx 0.2.111 → 0.2.112
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/cli.js +663 -590
- package/dist/includes.js +7 -7
- package/dist/pwa.js +441 -368
- package/dist/signals.js +82 -6
- package/dist/ssg.js +422 -349
- package/dist/style-scoping.d.ts +0 -3
- package/dist/style-scoping.js +4 -3
- package/dist/variable-extractor.js +1 -1
- package/dist/web-components/css-scoping.js +33 -0
- package/package.json +5 -5
package/dist/ssg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var QX=Object.defineProperty;var GX=($)=>$;function KX($,Z){this[$]=GX.bind(null,Z)}var r=($,Z)=>{for(var Y in Z)QX($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:KX.bind(Z,Y)})};var S=($,Z)=>()=>($&&(Z=$($=0)),Z);var W0=import.meta.require;import j5 from"path";function L6($){O6=$?.trim()||null}function H5(){return process.env[zX]?.trim()||O6||m1}function G1($=process.cwd(),...Z){let Y=H5();return j5.isAbsolute(Y)?j5.join(Y,...Z):j5.join($,Y,...Z)}function O5($){if(!$||j5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==m1&&!Z.startsWith(`${m1}/`))return $;let Y=Z.slice(m1.length+1);return Y?j5.join(H5(),Y):H5()}var m1=".stx",zX="STX_DIR",O6=null;var L5=()=>{};var j0;var F6=S(()=>{j0={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"}});function V6($,Z,Y,J){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let W={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||W} -->`});let X=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(X,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var w6,A6;var S$=S(()=>{w6={name:"a11y",handler:($,Z,Y,J)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${X||K} -->${$}`},hasEndTag:!1},A6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function WX($,Z={}){let{duration:Y,delay:J,ease:Q,direction:X,custom:G}={...$1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${X==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="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`${X==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="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 @@ var JX=Object.defineProperty;var XX=($)=>$;function QX($,Z){this[$]=XX.bind(null
|
|
|
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`${X==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="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 UX(){return`
|
|
13
13
|
<script data-stx-scoped>
|
|
14
14
|
// Motion preferences handling
|
|
15
15
|
(function() {
|
|
@@ -37,7 +37,7 @@ else {
|
|
|
37
37
|
});
|
|
38
38
|
})();
|
|
39
39
|
</script>
|
|
40
|
-
`}function
|
|
40
|
+
`}function BX($){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((Y)=>Y.test($))}function _X($=0.1,Z="0px"){return`
|
|
41
41
|
<script data-stx-scoped>
|
|
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 jX(){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 HX($,Z,Y={}){let{staggerDelay:J=50,sequence:Q=!1}=Y;return`
|
|
199
199
|
<script data-stx-scoped>
|
|
200
200
|
// Animation Group: ${$}
|
|
201
201
|
(function() {
|
|
@@ -232,11 +232,11 @@ else {
|
|
|
232
232
|
}
|
|
233
233
|
})();
|
|
234
234
|
</script>
|
|
235
|
-
`}function
|
|
236
|
-
</head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=
|
|
237
|
-
`+Q.slice(
|
|
238
|
-
style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},
|
|
239
|
-
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},
|
|
235
|
+
`}function I6($,Z,Y,J){let Q=$;if(J.animation?.enabled===!1)return Q;let X=Y.includes("test")&&Y.includes("animation");if(!BX(Q)&&!X)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=jX();Q=Q.replace("</head>",`${K}
|
|
236
|
+
</head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=_X(),z=Q.lastIndexOf("</body>");if(z!==-1)Q=Q.slice(0,z)+q+`
|
|
237
|
+
`+Q.slice(z)}}return Q}var $1,N6,R6,T6,M6;var y$=S(()=>{$1={duration:300,delay:0,ease:"ease",direction:"both"};N6={name:"transition",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||$1.duration:$1.duration,G=Z.length>2?Z[2]||$1.ease:$1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||$1.delay:$1.delay,q=Z.length>4?Z[4]||$1.direction:$1.direction,z=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=WX(Q,{duration:X,delay:K,ease:G,direction:q}),U="stx-transition",B="";if(Q==="fade")B="stx-fade";else if(Q==="slide")B="stx-slide";else if(Q==="scale")B="stx-scale";else if(Q==="flip")B="stx-flip";else if(Q==="rotate")B="stx-rotate";return`<div id="${z}" class="${U} ${B} ${q==="out"?"stx-out":""}"
|
|
238
|
+
style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},R6={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,z=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(Q==="fade")U+=" stx-fade";else if(Q==="slide-up"||Q==="slide")U+=" stx-from-bottom";else if(Q==="slide-down")U+=" stx-from-top";else if(Q==="slide-left")U+=" stx-from-right";else if(Q==="slide-right")U+=" stx-from-left";else if(Q==="scale")U+=" stx-scale";else if(Q.includes("-"))U+=` stx-${Q}`;else U+=` stx-${Q}`;return`<div id="${z}" class="${U}" style="${W}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},T6={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],X=Z.slice(1).map((z)=>z.startsWith("#")||z.startsWith(".")?z:`#${z}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=HX(Q,X,{staggerDelay:G,sequence:K});return`${$}
|
|
239
|
+
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},M6={name:"motion",handler:($,Z,Y,J)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,X=UX();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as D6}from"stx-router";var E6=S(()=>{C$()});async function OX($,Z,Y,J){let Q=Z[0]?.replace(/['"]/g,"")||"main",X=D6();if(Q!=="main")X=X.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${X}</script>`}var k6;var C$=S(()=>{E6();k6={name:"stxRouter",handler:OX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function b6($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...LX,...Z};return`
|
|
240
240
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
241
241
|
<script>
|
|
242
242
|
(function() {
|
|
@@ -619,10 +619,10 @@ else {
|
|
|
619
619
|
};
|
|
620
620
|
})();
|
|
621
621
|
</script>
|
|
622
|
-
`}function
|
|
623
|
-
`)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let
|
|
624
|
-
`),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(
|
|
625
|
-
`).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${
|
|
622
|
+
`}function S6($,Z){let Y=b6(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function FX($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[Q,X]=J.split("="),G=X?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var LX,y6;var P$=S(()=>{LX={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};y6={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let Q=Y.__stx_config||{};if(Z.length>0){let X=FX(Z.join(" "));Q.heatmap={...Q.heatmap,...X,enabled:!0}}return b6(Q)}}});function K1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function C6($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function P6($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],Q=$.slice(Y[0].length),X={};for(let G of J.split(`
|
|
623
|
+
`)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let z=K.slice(0,q).trim(),W=K.slice(q+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}X[z]=W}return{data:X,content:Q.trim()}}function F5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,Q=$,X=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,B)=>{let _=X.length,j=U?` class="language-${K1(U)}"`:"";return X.push(`<pre><code${j}>${K1(B.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),Q=Q.replace(/`([^`]*)`/g,(W,U)=>`<code>${K1(U)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,U,B)=>{return`<img src="${C6(B)?K1(B):""}" alt="${K1(U)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,U,B)=>{return`<a href="${C6(B)?K1(B):""}">${U}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
624
|
+
`),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,U,B)=>{let j=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${K1(L)}</th>`).join("")}</tr>`,H=B.trim().split(`
|
|
625
|
+
`).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${K1(O)}</td>`).join("")}</tr>`}).join(`
|
|
626
626
|
`);return`<table>
|
|
627
627
|
<thead>
|
|
628
628
|
${j}
|
|
@@ -631,28 +631,28 @@ ${j}
|
|
|
631
631
|
${H}
|
|
632
632
|
</tbody>
|
|
633
633
|
</table>`});if(Y)Q=Q.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Q=Q.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Q.split(`
|
|
634
|
-
`),K=[],q=!1,
|
|
634
|
+
`),K=[],q=!1,z=[];for(let W of G){let U=W.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(U)||/^\0CODEBLOCK\d+\0$/.test(U)||U===""){if(q&&z.length>0)K.push(`<p>${z.join(J?`<br />
|
|
635
635
|
`:`
|
|
636
|
-
`)}</p>`),
|
|
636
|
+
`)}</p>`),z=[],q=!1;K.push(W)}else q=!0,z.push(U)}if(q&&z.length>0)K.push(`<p>${z.join(J?`<br />
|
|
637
637
|
`:`
|
|
638
638
|
`)}</p>`);if(Q=K.join(`
|
|
639
639
|
`),J)Q=Q.replace(/\n/g,`<br />
|
|
640
|
-
`);for(let
|
|
640
|
+
`);for(let W=0;W<X.length;W++)Q=Q.replace(`\x00CODEBLOCK${W}\x00`,X[W]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function Z1($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
641
641
|
`});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(J,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
642
|
-
`}),$}import
|
|
643
|
-
export { ${H.join(", ")} }`:"";await Bun.write(
|
|
644
|
-
var __stxScopeRenames = { ${M} };`}console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),
|
|
642
|
+
`}),$}import VX from"process";function o0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,Q]of Object.entries(VX.env)){if(!J.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(Q),Y[J]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var u1=()=>{};var a5={};r(a5,{hasUserImports:()=>wX,bundleClientScript:()=>NX});import w0 from"path";import g0 from"fs";function wX($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let J=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=J.exec($))!==null){let G=Q[1];if(!v6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let X=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=X.exec($))!==null){let G=Q[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!v6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function AX($,Z,Y,J){let Q=(X,G)=>{let K=X===Y?Z:w0.dirname(X),q=w0.resolve(K,G),z=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,w0.join(q,"index.ts"),w0.join(q,"index.tsx"),w0.join(q,"index.js"),w0.join(q,"index.mjs")];for(let W of z)try{if(g0.existsSync(W)&&g0.statSync(W,{throwIfNoEntry:!1})?.isFile())return W}catch{}return q};return{name:"stx-client-bundle",setup(X){X.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),X.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),X.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return J.add(K),{path:K}}),X.onResolve({filter:/^[@~]\//},(G)=>{let K=w0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,w0.join(K,"index.ts"),w0.join(K,"index.tsx"),w0.join(K,"index.js"),w0.join(K,"index.mjs")];for(let z of q)if(g0.existsSync(z)&&g0.statSync(z,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",z),J.add(z),{path:z};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function NX($,Z,Y={}){let J=Y.projectRoot||process.cwd(),Q=Y.minify??!1,X=Y.cacheDir||G1(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=w0.join(X,`${K}.js`),z=w0.join(X,`${K}.deps.json`),W=Bun.file(q);if(await W.exists()){let A=Bun.file(z),N=!0;if(await A.exists())try{let R=JSON.parse(await A.text());for(let T of R.files)try{if(g0.statSync(T.path).mtimeMs!==T.mtimeMs){N=!1;break}}catch{N=!1;break}}catch{N=!1}if(N)return console.log("[stx:bundler] cache hit:",K),await W.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=G1(J,"bundle-tmp"),B=w0.join(U,`${K}.ts`),_=w0.join(U,"out",K);g0.mkdirSync(U,{recursive:!0}),g0.mkdirSync(_,{recursive:!0});let j=w0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((A)=>{let N=A.split(":")[0].trim();if(N)H.push(N)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
|
|
643
|
+
export { ${H.join(", ")} }`:"";await Bun.write(B,$+V),console.log("[stx:bundler] bundling:",K,"from:",w0.basename(Z));let w=new Set;try{let A=await Bun.build({entrypoints:[B],outdir:_,target:"browser",format:"esm",minify:Q,plugins:[AX(J,j,B,w)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...o0()},root:J});if(!A.success){let M=A.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",M),$}let N="";for(let M of A.outputs){N=await M.text();break}let R=[];for(let M of N.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of M[1].split(",")){let D=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D&&D[1]!==D[2])R.push([D[2],D[1]])}if(N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),R.length>0){let M=R.map(([I,D])=>`${JSON.stringify(I)}: ${D}`).join(", ");N+=`
|
|
644
|
+
var __stxScopeRenames = { ${M} };`}console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),g0.mkdirSync(X,{recursive:!0}),await Bun.write(q,N);let T=Array.from(w).map((M)=>{try{return{path:M,mtimeMs:g0.statSync(M).mtimeMs}}catch{return null}}).filter((M)=>M!==null);return await Bun.write(z,JSON.stringify({files:T})),N}catch(A){let N=A instanceof Error?A.message:String(A),R=A?.errors,T=Array.isArray(R)&&R.length>0?`
|
|
645
645
|
${R.map((M)=>`- ${M?.message??M}`).join(`
|
|
646
|
-
`)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{
|
|
646
|
+
`)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{g0.rmSync(B,{force:!0}),g0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var v6;var t5=S(()=>{u1();L5();v6=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var d6={};r(d6,{renderVendorStyleTags:()=>g6,processClientScript:()=>A5,generateServerDataBridge:()=>e5,generateAutoImportDestructuring:()=>h6,extractBridgeData:()=>w5,extractAndStripCssImports:()=>f6});import w1 from"path";import V5 from"fs";function TX($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function MX($,Z){let Y=Z;while(!0){let J=w1.join(Y,"node_modules",$,"package.json");if(V5.existsSync(J))return w1.dirname(J);let Q=w1.dirname(Y);if(Q===Y)return null;Y=Q}}function IX($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=null;for(let Q of Object.keys($)){let X=Q.indexOf("*");if(X===-1)continue;let G=Q.slice(0,X),K=Q.slice(X+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!J||G.length>J.prefix.length)J={pattern:Q,prefix:G,suffix:K}}if(J){let Q=Z.slice(J.prefix.length,Z.length-J.suffix.length),X=Y($[J.pattern]);if(X)return X.replace("*",Q)}return null}function DX($,Z){let Y=TX($);if(!Y||!Y.subpath)return null;let J=MX(Y.pkg,Z);if(!J)return null;let Q;try{Q=JSON.parse(V5.readFileSync(w1.join(J,"package.json"),"utf8"))}catch{return null}let X=`.${Y.subpath}`,G=IX(Q.exports,X);if(!G)return null;let K=w1.resolve(J,G);return V5.existsSync(K)?K:null}function f6($,Z){let Y=Z.filePath?w1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),Q=new Set,X=[];return{code:$.replace(RX,(K,q)=>{let z;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(z=q.startsWith("/")?q:w1.resolve(Y,q),!V5.existsSync(z))throw Error(`file not found: ${z}`)}else{let W=null;try{W=Bun.resolveSync(q,J)}catch{W=DX(q,J)}if(!W)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);z=W}}catch(W){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${W?.message||W}`),""}if(Q.has(z))return"";Q.add(z);try{let W=V5.readFileSync(z,"utf8");X.push({source:q,resolvedPath:z,contents:W})}catch(W){console.warn(`[stx:vendor-css] could not read ${z}: ${W?.message||W}`)}return""}),styles:X}}function EX($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function g6($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${EX(Z.source)}" data-stx-layer="vendor">
|
|
647
647
|
@layer vendor {
|
|
648
648
|
${Z.contents}
|
|
649
649
|
}
|
|
650
650
|
</style>`}).join(`
|
|
651
651
|
`)}
|
|
652
|
-
`}function
|
|
652
|
+
`}function yX($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=Y.exec($))!==null)if(!SX.has(J[1]))Z.add(J[1]);return Array.from(Z)}function CX($){let Z=new Set,Y=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,X=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=X.exec($))!==null){let q=G[1],z=G[2];if(G[0].includes("import type"))continue;q.split(",").map((U)=>U.trim().split(/\s+as\s+/)[0]).filter((U)=>U.length>0).forEach((U)=>{if(Q.add(U),z==="stx")Z.add(U);else Y.add(U)}),J=J.replace(G[0],"// [auto-import processed]")}for(let q of kX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(J))Z.add(q)}for(let q of bX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let K=yX(J);for(let q of K)if(!Q.has(q))Y.add(q);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function h6($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
653
653
|
${Y.join(`
|
|
654
654
|
`)}
|
|
655
|
-
${
|
|
655
|
+
${PX($,Z)}`;return""}function PX($,Z){let Y=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
656
656
|
[${Y.join(", ")}].forEach(function (e) {
|
|
657
657
|
if (e[1] !== 'undefined') return;
|
|
658
658
|
console.error(
|
|
@@ -661,15 +661,15 @@ ${yX($,Z)}`;return""}function yX($,Z){let Y=[...$.map((J)=>`['${J}', typeof ${J}
|
|
|
661
661
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
662
662
|
);
|
|
663
663
|
});
|
|
664
|
-
`}function
|
|
664
|
+
`}function w5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function e5($,Z){if(!Z)return"";let Y=[];for(let[J,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(J))continue;if(!new RegExp(`\\b${J}\\b`).test($))continue;if(new RegExp(`(?:const|let|var|function|class)\\s+${J}\\b`).test($))continue;let X;try{X=JSON.stringify(Q)}catch{continue}if(X===void 0)continue;Y.push(` var ${J} = ${X.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
665
665
|
${Y.join(`
|
|
666
666
|
`)}
|
|
667
|
-
`}function
|
|
667
|
+
`}function xX($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=vX[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function fX($,Z){let{elementId:Y,event:J,handler:Q,modifiers:X}=$,G=xX(X),K=[];if(X.once)K.push("once: true");if(X.capture)K.push("capture: true");if(X.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",z="";if(G)z+=`${G}; `;let W=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function U(B){return`var scope = $el.closest('[data-stx-scope]');
|
|
668
668
|
if (scope && scope.__stx_execute) {
|
|
669
|
-
scope.__stx_execute('${
|
|
669
|
+
scope.__stx_execute('${W}', $event, $el);
|
|
670
670
|
}
|
|
671
671
|
else {
|
|
672
|
-
${
|
|
672
|
+
${B}
|
|
673
673
|
}`}if(X.debounce!==null)return` ;(function() {
|
|
674
674
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
675
675
|
var $el = document.getElementById('${Y}')
|
|
@@ -693,32 +693,32 @@ else {
|
|
|
693
693
|
}${q})
|
|
694
694
|
})()`;return` var $el = document.getElementById('${Y}')
|
|
695
695
|
if ($el) $el.addEventListener('${J}', function($event) {
|
|
696
|
-
${
|
|
696
|
+
${z}var scope = $el.closest('[data-stx-scope]');
|
|
697
697
|
if (scope && scope.__stx_execute) {
|
|
698
|
-
scope.__stx_execute('${
|
|
698
|
+
scope.__stx_execute('${W}', $event, $el);
|
|
699
699
|
}
|
|
700
700
|
else {
|
|
701
701
|
${Q}
|
|
702
702
|
}
|
|
703
|
-
}${q})`}function
|
|
703
|
+
}${q})`}function gX($){if($.length===0)return"";return`
|
|
704
704
|
// STX: auto-generated event bindings
|
|
705
|
-
${$.map((Y,J)=>
|
|
706
|
-
`)}`}function
|
|
707
|
-
`)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<X-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=J.slice(G),
|
|
705
|
+
${$.map((Y,J)=>fX(Y,J)).join(`
|
|
706
|
+
`)}`}function x6($){let Z=[],Y=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Q=0,X=J.length,G=0;while(G<X){let K=J[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let z=0;while(G<X){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&z===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){z++,G+=2;continue}if(J[G]==="}"&&z>0){z--,G++;continue}G++}}else while(G<X){if(J[G]==="\\"){G+=2;continue}if(J[G]===q){G++;break}G++}continue}if(K==="/"&&J[G+1]==="/"){while(G<X&&J[G]!==`
|
|
707
|
+
`)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<X-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=J.slice(G),z=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(z){let B=z[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=z[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((B)=>{let _=B.trim(),j=_.indexOf(":"),H=j>=0?_.slice(j+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=W[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let B=U[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=U[0].length;continue}}G++}return Z}function dX($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(B){let _;while((_=Y.exec(B))!==null){let j=_[0];if(!hX.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,X;while((X=Q.exec($))!==null)J(X[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((X=G.exec($))!==null)J(X[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((X=K.exec($))!==null)J(X[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((X=q.exec($))!==null)J(X[1]);let z=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((X=z.exec($))!==null)J(X[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((X=W.exec($))!==null)J(X[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((X=U.exec($))!==null)J(X[1]);return Z}async function A5($,Z={}){let Y=$,J="",Q=!1,X=f6(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=X.code;let G=g6(X.styles),{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (t5(),a5));if(K(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let L=CX(Y);Y=L.code,J=h6(L.stxImports,L.browserImports)}if(J=`${e5(Y,Z.serverData)}${J}`,Y=Z1(Y),!Q&&A1(Z.attrs||""))Y=N1(Y);let z=gX(Z.eventBindings||[]),W=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(W)){let L=W.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${G}<script ${F}>
|
|
708
708
|
${J}${Y}
|
|
709
|
-
${
|
|
710
|
-
</script>`}let
|
|
709
|
+
${z}
|
|
710
|
+
</script>`}let B=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),_=/function __stx_setup_/.test(Y),j=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function H(L){let F=L.length>0?`
|
|
711
711
|
return { ${L.join(", ")} };`:"";return`${G}<script data-stx-scoped>
|
|
712
712
|
window.stx.mount(function() {
|
|
713
713
|
'use strict';
|
|
714
714
|
${J}${Y}
|
|
715
|
-
${
|
|
716
|
-
})</script>`}if(!j&&!
|
|
715
|
+
${z}${F}
|
|
716
|
+
})</script>`}if(!j&&!_){if(B)return H(x6($));if(Z.templateContent){let L=x6($);if(L.length>0){let F=dX(Z.templateContent);if(L.some((V)=>F.has(V)))return H(L)}}}return`${G}<script data-stx-scoped>
|
|
717
717
|
;(function() {
|
|
718
718
|
'use strict';
|
|
719
719
|
${J}${Y}
|
|
720
|
-
${
|
|
721
|
-
})()</script>`}var
|
|
720
|
+
${z}
|
|
721
|
+
})()</script>`}var RX,kX,bX,SX,vX,hX;var N5=S(()=>{A0();RX=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;kX=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],bX=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],SX=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"]);vX={left:0,middle:1,right:2};hX=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 cX($){let Z="",Y=null,J=!1;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(J){J=!1;continue}if(X==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&X==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}Z+=X}return Z}function lX($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let Q=J[0],X=$[J.index-1];if(uX.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(X==="."&&c6.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function iX($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!c6.has(J))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],X=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&X===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function $4($){let Z=$.trim(),Y=cX(Z);lX(Y,Z),iX(Z);for(let J of p6)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!u6.allowBracketNotation&&pX.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function nX($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||p6.some((Q)=>Q.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=v$(J);else Z[Y]=J}return Z}function v$($,Z=0){if(Z>=u6.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>v$(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,Q]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(Q&&typeof Q==="object")Y[J]=v$(Q,Z+1);else Y[J]=Q}return Y}function Z0($,Z){try{let Y=nX(Z),J=Object.keys(Y),Q=Object.values(Y);return G0($,J)(...Q)}catch{return}}function Q0($){try{return $4($),!0}catch{return!1}}function N0($,Z){try{let Y=Z0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function G0($,Z){let Y=$4($),J=/^[A-Za-z_$][\w$]*$/,Q=[],X=[];for(let z=0;z<Z.length;z++){let W=Z[z];if(!J.test(W))continue;if(l6.has(W))continue;Q.push(z),X.push(W)}let G=(z)=>Function(...X,...z,`
|
|
722
722
|
'use strict';
|
|
723
723
|
try {
|
|
724
724
|
return ${Y};
|
|
@@ -729,7 +729,7 @@ catch (e) {
|
|
|
729
729
|
}
|
|
730
730
|
throw e;
|
|
731
731
|
}
|
|
732
|
-
`),K=G([]);if(X.length===Z.length)return d6(K,X,G);return d6((...W)=>{let z=Array(Q.length);for(let U=0;U<Q.length;U++)z[U]=W[Q[U]];return K(...z)},X,G,(W)=>{K=G(W)})}function d6($,Z,Y,J){let X=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let z=0;z<=8;z++)try{return G(...W)}catch(U){let _=U instanceof Error?U.message:"",B=X.exec(_);if(!(U instanceof ReferenceError)||!B)return;let j=B[1];if(q.has(j)||c6.has(j))return;q.add(j),K.push(j),G=Y(K),J?.(K)}return}}function Z4($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var hX,m6,u6,dX,p6,mX,c6;var R0=S(()=>{hX={maxSanitizeDepth:10,allowBracketNotation:!1},m6={...hX},u6=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],dX=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),p6=new Set(["__proto__","constructor","prototype"]),mX=/[\w)\]]\s*\[\s*['"]/;c6=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function Y4($,Z){let Y=iX++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return nX.set(J,{type:$,expression:Z}),J}var iX=0,nX;var l6=S(()=>{nX=new Map});function i6($,Z,Y,J){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;J.lastIndex=Y.lastIndex;let X=J.exec($);if(!X)return-1;return X.index+X[0].length}function J4($,Z){return i6($,Z,oX,sX)}function n6($,Z){return i6($,Z,rX,aX)}function o6($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function A5($,Z,Y){let J=[],Q="",X=0,G=$.length,K=!1,q=null;while(X<G){let W=$[X];if(K){if(Q+=W,q){if(W===q)q=null}else if(W==='"'||W==="'")q=W;else if(W===">")K=!1;X++;continue}if(W==="<"){let z=Z($,X);if(z>X){Q+=Y($.slice(X,z),J.length),J.push($.slice(X,z)),X=z;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))K=!0;Q+=W,X++;continue}Q+=W,X++}return{output:Q,tokens:J}}function x$($){let{output:Z,tokens:Y}=A5($,J4,(J,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function f$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var oX,sX,rX,aX;var X4=S(()=>{oX=/<script\b[^>]*>/iy,sX=/<\/script\s*>/ig,rX=/<style\b[^>]*>/iy,aX=/<\/style\s*>/ig});var Z9={};r(Z9,{usesSignalsInScript:()=>p1,unescapeHtml:()=>g$,registerFilters:()=>eX,registerFilter:()=>a6,processExpressions:()=>s0,interpolateScriptsInTemplate:()=>ZQ,interpolateScriptExpressions:()=>e6,getAllFilters:()=>t6,evaluateExpression:()=>d0,escapeHtml:()=>u0,defaultFilters:()=>R5,clearCustomFilters:()=>$Q,applyFilters:()=>$9});function tX($){let Z=s6.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),s6.set($,Z)}return Z.lastIndex=0,Z}function a6($,Z){if($ in R5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);N5[$]=Z}function eX($){for(let[Z,Y]of Object.entries($))a6(Z,Y)}function t6(){return{...R5,...N5}}function $Q(){for(let $ of Object.keys(N5))delete N5[$]}function u0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function p1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function r6($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",X=!1,G=0;for(let W=0;W<J.length;W++){let z=J[W];if(!X&&z==="`"){X=!0,G=0;continue}if(X){if(z==="`"&&G===0){X=!1;continue}if(z==="$"&&J[W+1]==="{"){G++,W++,Q+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){Q+=z;continue}continue}Q+=z}J=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(J))!==null){let W=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function e6($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,Q)=>{try{let X=d0(Q,Z);if(X===void 0)return J;return X===null?"":String(X)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,Q)=>{let X=Q.trim();if(/^__[A-Z_]+__$/.test(X))return J;try{let G=d0(Q,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function ZQ($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(J,Q,X)=>{if(/\bsrc\s*=/.test(Q))return J;if(/\bdata-raw\b/.test(Q))return J;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return J;if(Y.skipServer&&/\bserver\b/.test(Q))return J;let G=e6(X,Z);return`<script${Q}>${G}</script>`})}function s0($,Z,Y,J){let Q=$,X=(z,U)=>{let _=n6(z,U);if(_===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(U,_))?-1:_},G=(z,U,_,B)=>{let j=_.length,{output:H,tokens:L}=A5(z,U,(F,O)=>B(j+O));return _.push(...L),H},K=[];Q=G(Q,X,K,(z)=>`<!--__STX_STYLE_${z}__-->`);let q=[];Q=G(Q,J4,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let W=J?.forceSignals===!0||Z?.__stx_force_signals===!0||p1($);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,U,_)=>{try{let B=d0(U,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let j=B instanceof Error?B.message:String(B);return K0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${j}`,Y,$,_,z)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,_)=>{try{let B=d0(U,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return Y4("raw",U.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return Y4("raw",U.trim());let j=B instanceof Error?B.message:String(B);return K0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${j}`,Y,$,_,z)}}),Q=G(Q,J4,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),Q=G(Q,X,K,(z)=>`<!--__STX_STYLE_${z}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(z,U,_)=>{let B=U.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=B.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,w=B.match(V),A=w&&!j.includes(w[1])&&!(w[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let N=d0(U,Z);if(W&&!r6(B,Z))return z;if(N===void 0&&Z.__stx_buildMode==="compile"&&!W)return Y4("expr",B);return N!==void 0&&N!==null?u0(String(N)):""}catch(N){if(W&&!r6(B,Z))return z;if(A)return z;let R=N instanceof Error?N.message:String(N);return K0("Expression",`Error evaluating: {{ ${B} }}: ${R}`,Y,$,_,z)}});for(let z=0;z<q.length;z++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>q[z]);for(let z=0;z<K.length;z++)Q=Q.replace(`<!--__STX_STYLE_${z}__-->`,()=>K[z]);return Q}function $9($,Z,Y){if(!Z.trim())return $;let J=$,Q=Z.trim();while(Q.length>0){let X=Q.match(/^(\w+)/);if(!X)break;let G=X[1];Q=Q.substring(G.length).trim();let K=N5[G]||R5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(t6()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let z=W[1].trim();try{let U=Number(z);q=[Number.isNaN(U)?z:U]}catch{q=[z]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,z=1;while(W>0&&z<Q.length){if(Q[z]==="(")W++;if(Q[z]===")")W--;z++}if(W===0){let U=Q.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[d0(`(${U})`,Y,!0)];else{let _=[],B="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){B+=w,O=!1;continue}if(w==="\\"){B+=w,O=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){_.push(B),B="";continue}B+=w}if(B)_.push(B);q=_.map((V)=>{let w=V.trim();return d0(w,Y,!0)})}}catch{q=[U]}Q=Q.substring(z).trim()}}try{J=K(J,Y,...q)}catch(W){let z=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${z}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return J}function YQ($){let Z=!1,Y="",J=0,Q=0,X=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>0)K++}continue}if(Z)continue;if(q==="(")J++;else if(q===")")J--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")X++;else if(q==="}")X--;if(q==="|"&&J===0&&Q===0&&X===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function d0($,Z,Y=!1){try{let J=$.trim(),Q=YQ(J);if(Q>0){let X=J.substring(0,Q).trim(),G=J.substring(Q+1).trim(),K=d0(X,Z,!0);return $9(K,G,Z)}if(!Q0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return Z0(J,Z)}try{let X=Object.keys(Z),G=Object.values(Z);return G0(J,X)(...G)}catch{return Z0(J,Z)}}catch(J){if(J instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(J.message);if(Q){let X=Q[1],G=JQ(X,Object.keys(Z));if(G&&G!==X)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function JQ($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let X=XQ($,Q);if(Y===null||X<Y.dist)Y={key:Q,dist:X}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function XQ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),X=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=J.length;G++){X[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===J[G-1]?0:1;X[K]=Math.min(X[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=X[K]}return Q[Y.length]}function g$($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var N5,s6,R5;var r0=S(()=>{R0();A0();l6();X4();N5={},s6=new Map;R5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return u0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,X=String($).split("."),G=J;for(let q of X){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(tX(q),String(W))}),K},t:($,Z,Y={})=>{return R5.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=J.length)return J.substring(0,Y);return Q.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let X={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(J,X[Y]||X.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let X=J||`${Y}s`;return Q===1?Y:X},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Q=10**Y;return Math.round(J*Q)/Q}}});class T5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function l1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!c1.has(Y)){if(c1.size>=QQ){let J=c1.keys().next().value;if(J)c1.delete(J)}c1.set(Y,new RegExp($,Z))}return c1.get(Y)}class Y9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let Q=this.fnCache,X=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,z=Q.get(W);if(!z){if(Q.size>=X){let U=Q.keys().next().value;if(U)Q.delete(U)}z=Function(...Z,`
|
|
732
|
+
`),K=G([]);if(X.length===Z.length)return m6(K,X,G);return m6((...z)=>{let W=Array(Q.length);for(let U=0;U<Q.length;U++)W[U]=z[Q[U]];return K(...W)},X,G,(z)=>{K=G(z)})}function m6($,Z,Y,J){let X=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...z)=>{for(let W=0;W<=8;W++)try{return G(...z)}catch(U){let B=U instanceof Error?U.message:"",_=X.exec(B);if(!(U instanceof ReferenceError)||!_)return;let j=_[1];if(q.has(j)||l6.has(j))return;q.add(j),K.push(j),G=Y(K),J?.(K)}return}}function Z4($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var mX,u6,p6,uX,c6,pX,l6;var R0=S(()=>{mX={maxSanitizeDepth:10,allowBracketNotation:!1},u6={...mX},p6=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],uX=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),c6=new Set(["__proto__","constructor","prototype"]),pX=/[\w)\]]\s*\[\s*['"]/;l6=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function Y4($,Z){let Y=oX++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return sX.set(J,{type:$,expression:Z}),J}var oX=0,sX;var i6=S(()=>{sX=new Map});function n6($,Z,Y,J){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;J.lastIndex=Y.lastIndex;let X=J.exec($);if(!X)return-1;return X.index+X[0].length}function J4($,Z){return n6($,Z,rX,aX)}function o6($,Z){return n6($,Z,tX,eX)}function s6($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function R5($,Z,Y){let J=[],Q="",X=0,G=$.length,K=!1,q=null;while(X<G){let z=$[X];if(K){if(Q+=z,q){if(z===q)q=null}else if(z==='"'||z==="'")q=z;else if(z===">")K=!1;X++;continue}if(z==="<"){let W=Z($,X);if(W>X){Q+=Y($.slice(X,W),J.length),J.push($.slice(X,W)),X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))K=!0;Q+=z,X++;continue}Q+=z,X++}return{output:Q,tokens:J}}function x$($){let{output:Z,tokens:Y}=R5($,J4,(J,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function f$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var rX,aX,tX,eX;var X4=S(()=>{rX=/<script\b[^>]*>/iy,aX=/<\/script\s*>/ig,tX=/<style\b[^>]*>/iy,eX=/<\/style\s*>/ig});var Y9={};r(Y9,{usesSignalsInScript:()=>p1,unescapeHtml:()=>g$,registerFilters:()=>ZQ,registerFilter:()=>t6,processExpressions:()=>s0,interpolateScriptsInTemplate:()=>JQ,interpolateScriptExpressions:()=>$9,getAllFilters:()=>e6,evaluateExpression:()=>h0,escapeHtml:()=>u0,defaultFilters:()=>M5,clearCustomFilters:()=>YQ,applyFilters:()=>Z9});function $Q($){let Z=r6.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),r6.set($,Z)}return Z.lastIndex=0,Z}function t6($,Z){if($ in M5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);T5[$]=Z}function ZQ($){for(let[Z,Y]of Object.entries($))t6(Z,Y)}function e6(){return{...M5,...T5}}function YQ(){for(let $ of Object.keys(T5))delete T5[$]}function u0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function p1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function a6($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",X=!1,G=0;for(let z=0;z<J.length;z++){let W=J[z];if(!X&&W==="`"){X=!0,G=0;continue}if(X){if(W==="`"&&G===0){X=!1;continue}if(W==="$"&&J[z+1]==="{"){G++,z++,Q+=" ";continue}if(W==="}"&&G>0){G--;continue}if(G>0){Q+=W;continue}continue}Q+=W}J=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(J))!==null){let z=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(z)&&!(z in Z))return!1}}return!0}function $9($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,Q)=>{try{let X=h0(Q,Z);if(X===void 0)return J;return X===null?"":String(X)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,Q)=>{let X=Q.trim();if(/^__[A-Z_]+__$/.test(X))return J;try{let G=h0(Q,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function JQ($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(J,Q,X)=>{if(/\bsrc\s*=/.test(Q))return J;if(/\bdata-raw\b/.test(Q))return J;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return J;if(Y.skipServer&&/\bserver\b/.test(Q))return J;let G=$9(X,Z);return`<script${Q}>${G}</script>`})}function s0($,Z,Y,J){let Q=$,X=(W,U)=>{let B=o6(W,U);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(U,B))?-1:B},G=(W,U,B,_)=>{let j=B.length,{output:H,tokens:L}=R5(W,U,(F,O)=>_(j+O));return B.push(...L),H},K=[];Q=G(Q,X,K,(W)=>`<!--__STX_STYLE_${W}__-->`);let q=[];Q=G(Q,J4,q,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);let z=J?.forceSignals===!0||Z?.__stx_force_signals===!0||p1($);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(W,U,B)=>{try{let _=h0(U,Z);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return K0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${j}`,Y,$,B,W)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(W,U,B)=>{try{let _=h0(U,Z);if(_===void 0&&Z.__stx_buildMode==="compile")return Y4("raw",U.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if(Z.__stx_buildMode==="compile")return Y4("raw",U.trim());let j=_ instanceof Error?_.message:String(_);return K0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${j}`,Y,$,B,W)}}),Q=G(Q,J4,q,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),Q=G(Q,X,K,(W)=>`<!--__STX_STYLE_${W}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(W,U,B)=>{let _=U.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=_.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,w=_.match(V),A=w&&!j.includes(w[1])&&!(w[1]in Z);if(/^__[A-Z_]+__$/.test(_))return"";try{let N=h0(U,Z);if(z&&!a6(_,Z))return W;if(N===void 0&&Z.__stx_buildMode==="compile"&&!z)return Y4("expr",_);return N!==void 0&&N!==null?u0(String(N)):""}catch(N){if(z&&!a6(_,Z))return W;if(A)return W;let R=N instanceof Error?N.message:String(N);return K0("Expression",`Error evaluating: {{ ${_} }}: ${R}`,Y,$,B,W)}});for(let W=0;W<q.length;W++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${W}__-->`,()=>q[W]);for(let W=0;W<K.length;W++)Q=Q.replace(`<!--__STX_STYLE_${W}__-->`,()=>K[W]);return Q}function Z9($,Z,Y){if(!Z.trim())return $;let J=$,Q=Z.trim();while(Q.length>0){let X=Q.match(/^(\w+)/);if(!X)break;let G=X[1];Q=Q.substring(G.length).trim();let K=T5[G]||M5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(e6()).join(", ")}`);let q=[];if(Q.startsWith(":")){let z=Q.match(/^:([^|\s]+)/);if(z){let W=z[1].trim();try{let U=Number(W);q=[Number.isNaN(U)?W:U]}catch{q=[W]}Q=Q.substring(z[0].length).trim()}}else if(Q.startsWith("(")){let z=1,W=1;while(z>0&&W<Q.length){if(Q[W]==="(")z++;if(Q[W]===")")z--;W++}if(z===0){let U=Q.substring(1,W-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[h0(`(${U})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(j){if(_+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=w}if(_)B.push(_);q=B.map((V)=>{let w=V.trim();return h0(w,Y,!0)})}}catch{q=[U]}Q=Q.substring(W).trim()}}try{J=K(J,Y,...q)}catch(z){let W=z instanceof Error?z.message:String(z);throw Error(`Error applying filter '${G}': ${W}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return J}function XQ($){let Z=!1,Y="",J=0,Q=0,X=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],z=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&z==="{"){let W=1;K+=2;while(K<$.length&&W>0){if($[K]==="{")W++;else if($[K]==="}")W--;if(W>0)K++}continue}if(Z)continue;if(q==="(")J++;else if(q===")")J--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")X++;else if(q==="}")X--;if(q==="|"&&J===0&&Q===0&&X===0){if(z==="|"){K++;continue}if(z==="="){K++;continue}return K}}return-1}function h0($,Z,Y=!1){try{let J=$.trim(),Q=XQ(J);if(Q>0){let X=J.substring(0,Q).trim(),G=J.substring(Q+1).trim(),K=h0(X,Z,!0);return Z9(K,G,Z)}if(!Q0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return Z0(J,Z)}try{let X=Object.keys(Z),G=Object.values(Z);return G0(J,X)(...G)}catch{return Z0(J,Z)}}catch(J){if(J instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(J.message);if(Q){let X=Q[1],G=QQ(X,Object.keys(Z));if(G&&G!==X)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function QQ($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let X=GQ($,Q);if(Y===null||X<Y.dist)Y={key:Q,dist:X}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function GQ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),X=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=J.length;G++){X[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===J[G-1]?0:1;X[K]=Math.min(X[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=X[K]}return Q[Y.length]}function g$($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var T5,r6,M5;var r0=S(()=>{R0();A0();i6();X4();T5={},r6=new Map;M5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return u0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,X=String($).split("."),G=J;for(let q of X){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,z])=>{K=K.replace($Q(q),String(z))}),K},t:($,Z,Y={})=>{return M5.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=J.length)return J.substring(0,Y);return Q.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let X={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(J,X[Y]||X.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let X=J||`${Y}s`;return Q===1?Y:X},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Q=10**Y;return Math.round(J*Q)/Q}}});class I5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function l1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!c1.has(Y)){if(c1.size>=KQ){let J=c1.keys().next().value;if(J)c1.delete(J)}c1.set(Y,new RegExp($,Z))}return c1.get(Y)}class J9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let Q=this.fnCache,X=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let z=`${Y}:${q}`,W=Q.get(z);if(!W){if(Q.size>=X){let U=Q.keys().next().value;if(U)Q.delete(U)}W=Function(...Z,`
|
|
733
733
|
'use strict';
|
|
734
734
|
try {
|
|
735
735
|
return ${q};
|
|
@@ -740,38 +740,38 @@ catch (e) {
|
|
|
740
740
|
}
|
|
741
741
|
throw e;
|
|
742
742
|
}
|
|
743
|
-
`),Q.set(W
|
|
743
|
+
`),Q.set(z,W)}return W(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class X9{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,X=Z>=Y.maxTime;if(!Q&&!X)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(X)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let Z={};for(let[Y,J]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Q?.maxTime,budgetUtilization:Q?J.totalTime/J.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function qQ(){if(!h$)h$=new X9;return h$}var c1,KQ=500,S_,h$=null,Q9;var i1=S(()=>{c1=new Map;S_=new J9;Q9=new Proxy({},{get($,Z){return qQ()[Z]}})});function G9($,Z=""){let Y=`${$}${Z}`,J=0;for(let Q=0;Q<Y.length;Q++){let X=Y.charCodeAt(Q);J=(J<<5)-J+X,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function K9($,Z,Y={}){let{prefix:J="",preserveHost:Q=!0,scopeKeyframes:X=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=d$($),q=[],z=new Map;if(X)for(let W of K){let U=W.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let B=U[1],_=`${Z}_${B}`;z.set(B,_)}}for(let W of K){let U=q9(W,Z,J,Q,z,G);q.push(U)}return q.join(`
|
|
744
744
|
|
|
745
|
-
`)}function d$($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Q="",X=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&J===0)X=!0;if(q==="{")J++;else if(q==="}"){if(J--,J===0){if(X){G+=q;let
|
|
746
|
-
`)})}else Z.push({selector:`@${
|
|
745
|
+
`)}function d$($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Q="",X=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&J===0)X=!0;if(q==="{")J++;else if(q==="}"){if(J--,J===0){if(X){G+=q;let z=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(z){let[,W,U,B]=z;if(W==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:B.trim()});else if(W==="media"||W==="supports"||W==="container"){let _=d$(B);Z.push({selector:`@${W} ${U.trim()}`,declarations:_.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
|
|
746
|
+
`)})}else Z.push({selector:`@${W} ${U.trim()}`,declarations:B.trim()})}G="",X=!1}else if(Q.trim()){Q+=q;let z=Q.match(/([^{]+)\{([^}]*)\}/);if(z)Z.push({selector:z[1].trim(),declarations:z[2].trim()});Q=""}continue}}if(X)G+=q;else Q+=q}return Z}function q9($,Z,Y,J,Q,X){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let W=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(W)||W} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=d$(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>q9(B,Z,Y,J,Q,X)).join(`
|
|
747
747
|
`);return`${G} {
|
|
748
748
|
${U}
|
|
749
|
-
}`}return`${G} { ${K} }`}let q=
|
|
750
|
-
`)}function
|
|
751
|
-
`,""}),headContent:Z.trim()}}function
|
|
752
|
-
`);for(let Q of J){let X=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let
|
|
749
|
+
}`}return`${G} { ${K} }`}let q=zQ(G,Z,Y,J),z=K;for(let[W,U]of Q)z=z.replace(new RegExp(`\\b${W}\\b`,"g"),U);if(X)z=z.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${z} }`}function zQ($,Z,Y,J){let Q=$.split(",").map((G)=>G.trim()),X=[];for(let G of Q){if(G.startsWith(":host")){if(J)X.push(G);else{let z=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);X.push(z)}continue}if(G.includes("::slotted")){X.push(G);continue}if(G===":root"){X.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;X.push(`${K} ${G}`);let q=WQ(G,Z);if(q)X.push(Y?`${Y} ${q}`:q)}return X.join(", ")}function WQ($,Z){let Y=0,J=$.length;for(let q=0;q<$.length;q++){let z=$[q];if(z==="["||z==="(")Y++;else if(z==="]"||z===")")Y--;else if(Y===0&&(z===" "||z===">"||z==="+"||z==="~")){J=q;break}}let Q=$.slice(0,J),X=$.slice(J);if(!Q)return"";let G=Q.length,K=0;for(let q=0;q<Q.length;q++){let z=Q[q];if(z==="["||z==="(")K++;else if(z==="]"||z===")")K--;else if(Y===0&&K===0&&z===":"){G=q;break}}return`${Q.slice(0,G)}.${Z}${Q.slice(G)}${X}`}function Q4($,Z){if(!UQ.test($))return{html:$,hasScoped:!1};let Y=G9(Z),J=`data-v-${Y}`,Q=$,X=new RegExp(`<style\\s+([^>]*${m$}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(X,(K,q,z)=>{G=!0;let W=BQ(z,J),U=q.replace(new RegExp(m$,"gi"),"").trim(),B=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${B}>${W}</style>`}),!G)return{html:$,hasScoped:!1};return Q=_Q(Q,J),{html:Q,hasScoped:!0}}function BQ($,Z){return K9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function _Q($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Q,X)=>{if(Y.has(Q.toLowerCase()))return J;if(J.includes(Z))return J;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return J;if(X)return J.replace(`<${Q}${X}`,`<${Q} ${Z}${X}`);if(J.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var m$,UQ;var u$=S(()=>{m$=String.raw`(?<![\w-])scoped(?![\w-])`,UQ=new RegExp(`<style\\s+[^>]*${m$}`,"i")});var z9=()=>{};function b0($,Z,Y,J=0){let Q=0,X=J,G=null,K=0,q=!1;while(X<$.length){let z=$[X];if(G&&q){q=!1,X++;continue}if(G&&z==="\\"){q=!0,X++;continue}if(q=!1,(z==='"'||z==="'"||z==="`")&&!G){G=z,X++;continue}if(z===G&&G!=="`"){G=null,X++;continue}if(G==="`"&&z==="$"&&$[X+1]==="{"){K++,X+=2;continue}if(K>0&&z==="}"){K--,X++;continue}if(z==="`"&&G==="`"&&K===0){G=null,X++;continue}if(G){X++;continue}if(z===Z)Q++;else if(z===Y){if(Q--,Q===0)return X}X++}return-1}var p$={};r(p$,{useTitle:()=>VQ,useSeoMeta:()=>K4,usePageTitle:()=>VQ,useHead:()=>T1,resetHead:()=>OQ,renderHtmlAttrs:()=>AQ,renderHead:()=>wQ,renderBodyAttrs:()=>NQ,processTitleDirective:()=>MQ,processMetaDirective:()=>IQ,processHeadDirective:()=>TQ,getPageMeta:()=>HQ,getHead:()=>D5,definePageMeta:()=>FQ,applyHead:()=>RQ});function D5(){return q1}function HQ(){return G4}function OQ(){q1={},jQ.length=0,G4={}}function T1($){q1=LQ(q1,$)}function LQ($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function K4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(J)Z.push({property:"og:description",content:J});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,X=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(X)Z.push({name:"twitter:description",content:X});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});T1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function FQ($){if(G4={...G4,...$},$.title||$.description)K4({title:$.title,description:$.description})}function VQ($){let Z=typeof $==="function"?$():$;T1({title:Z})}function wQ($=q1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${R1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,Q])=>`${J}="${R1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([Q,X])=>X!==void 0).map(([Q,X])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${R1(String(X))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([Q,X])=>X!==void 0).map(([Q,X])=>`${Q}="${R1(String(X))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...Q}=Y,X=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${R1(String(K))}"`}).filter(Boolean).join(" ");if(J)Z.push(`<script ${X}>${J}</script>`);else Z.push(`<script ${X}></script>`)}for(let Y of $.style||[]){let J=Y.type?` type="${Y.type}"`:"";Z.push(`<style${J}>${Y.content}</style>`)}return Z.join(`
|
|
750
|
+
`)}function AQ($=q1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${R1(Y)}"`).join(" ")}function NQ($=q1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${R1(Y)}"`).join(" ")}function R1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function RQ($=q1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),Z.name)J.setAttribute("name",Z.name);if(Z.property)J.setAttribute("property",Z.property);document.head.appendChild(J)}J.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[Q,X]of Object.entries(Z))if(X!==void 0)J.setAttribute(Q,String(X))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function TQ($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,Q)=>{return Z+=Q.trim()+`
|
|
751
|
+
`,""}),headContent:Z.trim()}}function MQ($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,Q,X)=>{let G=J?Q:Z[(X||"").trim()]??X;return T1({title:G}),""})}function IQ($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,Q,X,G,K)=>{let q=X?G:K,z=X?q:Z[(q||"").trim()]??q,U=Q.includes(":")?{property:Q,content:z}:{name:Q,content:z};return T1({meta:[U]}),""})}var q1,jQ,G4;var E5=S(()=>{q1={},jQ=[],G4={}});var q4={};r(q4,{stripTypeScript:()=>j9,hasVariables:()=>V9,extractVariables:()=>M1,extractScriptFromTemplate:()=>F9,convertToCommonJS:()=>l$});import n1 from"path";import k5 from"process";function DQ($){let Z=[],Y=0,J=$.split(`
|
|
752
|
+
`);for(let Q of J){let X=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let z=Q[q];if(K){K=!1;continue}if(z==="\\"){K=!0;continue}if(G){if(z===G)G=null;continue}if(z==="'"||z==='"'||z==="`"){G=z;continue}if(z==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(z==="{")Y++;else if(z==="}")Y--}if(X===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let z=Q.match(/(?:const|let|var)\s+(\w+)/);if(z)Z.push(z[1])}else{let z=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(z){let U=z[1].slice(1,-1).split(",").map((B)=>{let _=B.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(...U)}}}}return[...new Set(Z)]}function j9($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(J){if(!J.includes(":"))return J;let Q=[],X="",G=0,K=0,q=null;for(let z=0;z<J.length;z++){let W=J[z];if(q){if(X+=W,W===q)q=null;continue}if(W==='"'||W==="'"||W==="`"){q=W,X+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")K++;else if(W===")")K--;if(W===","&&G===0&&K===0){Q.push(X),X="";continue}X+=W}if(X)Q.push(X);return Q.map((z)=>{let W=z.trim(),U=W.startsWith("..."),B=U?W.slice(3):W,_=-1,j=0;for(let A=0;A<B.length;A++)if(B[A]==="<")j++;else if(B[A]===">")j--;else if(B[A]===":"&&j===0){_=A;break}if(_===-1)return z;let L=B.substring(0,_).trim().replace(/\?$/,""),F=B.substring(_+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Q,X)=>{if(!X.includes(":"))return J;return`${Q}(${Y(X)})`});{let J=/\b(function\s+\w*\s*)\(/g,Q,X=[];while((Q=J.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,z=0,W=null;while(q<Z.length&&K>0){let _=Z[q];if(W){if(_===W)W=null;q++;continue}if(_==='"'||_==="'"||_==="`"){W=_,q++;continue}if(_==="<")z++;else if(_===">"&&z>0)z--;else if(z===0){if(_==="(")K++;else if(_===")")K--}if(K>0)q++}if(K!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let B=Y(U);X.push({start:G+1,end:q,replacement:B})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:z}=X[G];Z=Z.substring(0,K)+z+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Q)=>{if(!Q.includes(":"))return J;if(Q.includes("{")||Q.includes("}"))return J;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),z=K.split(":")[0].trim();if(q.length>0)return`${z} = ${q.join("=").trim()}`;return z}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
753
753
|
|
|
754
|
-
`),Z}async function M1($,Z,Y,J={}){if(!$.trim())return;let Q;try{let v=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}),f=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");f=f.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=v.transformSync(f)}catch{Q=
|
|
755
|
-
`),
|
|
754
|
+
`),Z}async function M1($,Z,Y,J={}){if(!$.trim())return;let Q;try{let v=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}),f=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");f=f.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=v.transformSync(f)}catch{Q=j9($)}let X={exports:{}},G=X.exports,K=k5.cwd(),q={},z=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((v)=>v[1]).filter((v)=>!v.startsWith("node:")&&!v.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(v));for(let v of z)try{let f=n1.resolve(K,"node_modules",v),C=n1.join(f,"package.json"),x=JSON.parse(W0("fs").readFileSync(C,"utf8")),u=x.main||"index.js";if(x.exports){let p=typeof x.exports==="string"?x.exports:x.exports["."];if(typeof p==="string")u=p;else if(p?.bun)u=p.bun;else if(p?.import)u=p.import;else if(p?.default)u=p.default}q[v]=await import(n1.resolve(f,u))}catch{}let W=(v)=>{if(q[v])return q[v];return W0(v)},U=Z.props||{},B=(v)=>{if(!v)return U;let f={};for(let[C,x]of Object.entries(v)){let u=U[C];if(u!==void 0)f[C]=u;else if(typeof x==="function")f[C]=x();else f[C]=x}return f};for(let[v,f]of Object.entries(U))Object.defineProperty(B,v,{value:f,enumerable:!0,configurable:!0,writable:!0});let _=(v)=>{if(!v)return U;let f={...U};for(let[C,x]of Object.entries(v)){let u=x&&typeof x==="object"&&!Array.isArray(x)?x:{type:x};if(f[C]===void 0&&u.default!==void 0)f[C]=typeof u.default==="function"?u.default():u.default}return f},j=()=>Z.slots||{},H=(v,f)=>{let C={...v};for(let[x,u]of Object.entries(f))if(C[x]===void 0)if(typeof u==="function")C[x]=u();else C[x]=u;return C},L=(v)=>{let f=()=>v;return f.set=(C)=>{},f.update=(C)=>{},f},F=(v)=>{let f,C=!1;return()=>{if(!C)try{f=v(),C=!0}catch{f=void 0}return f}},O=(v)=>{},V=(v)=>v(),w=(v)=>{},A=(v)=>{},N=(v)=>{},R=()=>{let v=Z.__stxServeContext,f=Z.__stxServeSearch??v?.search??"",C=v?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(f)),path:C,name:"",fullPath:C+f,hash:"",matched:[]}},T=()=>({push:(v)=>{},replace:(v)=>{},back:()=>{},forward:()=>{},go:(v)=>{}}),M=(v)=>{T1(v);let f=Z.__stx_runtime_head||{},C=v||{};Z.__stx_runtime_head={...f,...C.title&&{title:C.title},meta:[...f.meta||[],...C.meta||[]],link:[...f.link||[],...C.link||[]],script:[...f.script||[],...C.script||[]],htmlAttrs:{...f.htmlAttrs||{},...C.htmlAttrs||{}},bodyAttrs:{...f.bodyAttrs||{},...C.bodyAttrs||{}}}},I=(v)=>{K4(v);let f=D5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...f.title&&{title:f.title},meta:f.meta?[...f.meta]:[]}},D=(v)=>({value:v}),E=(v)=>v,P=(v)=>({value:typeof v==="function"?v():v}),b=(v,f)=>{},k=(v)=>{},y=(v)=>{},g=(v)=>v?v():Promise.resolve(),h=(v)=>(f,...C)=>{},m=(v)=>{},i=(v,f)=>{},c=(v,f)=>f,z0=()=>({value:"light"}),F0=()=>({value:!1}),_0={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:{}},$0=new Proxy(_0,{get(v,f){if(f in v)return v[f];return},set(v,f,C){return v[f]=C,!0}}),I0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},f0=console;try{let v=l$(Q,Y),f=new Set(Object.keys(U)),C=(a)=>/^[a-z_$][\w$]*$/i.test(a),x=Object.keys(Z).filter((a)=>!f.has(a)&&a!=="props"&&C(a)),u=x.map((a)=>Z[a]),p=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),X0=[],q0=[];for(let[a,e0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(p.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(v))continue;X0.push(a),q0.push(e0)}let d1=DQ(v).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
|
|
755
|
+
`),m0=Z.params??{},Q1=[],B0=[];for(let a=0;a<x.length;a++){if(x[a]==="params")continue;Q1.push(x[a]),B0.push(u[a])}let V1=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...X0,...Q1,`return (async () => {
|
|
756
756
|
${v}
|
|
757
|
-
${
|
|
757
|
+
${d1}
|
|
758
758
|
return module.exports
|
|
759
|
-
})()`)(X,G,
|
|
760
|
-
`),Q=[],X=0;while(X<J.length){let G=J[X].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;X<J.length;X++){for(let q of J[X])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}X++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let
|
|
761
|
-
`+
|
|
762
|
-
`),Y)}function
|
|
763
|
-
`)G=!1;Q++;continue}if(K){if(J+=
|
|
764
|
-
`);return{type:
|
|
765
|
-
${A}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,X,G]=J,K=G,q=Z;if(
|
|
766
|
-
${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:X,value:K,nextIndex:q}}function
|
|
759
|
+
})()`)(X,G,W,U,B,_,H,L,F,O,V,w,A,N,R,T,M,I,D,E,P,b,k,y,g,h,m,j,i,c,z0,F0,$0,I0,f0,_0.confirm,_0.alert,_0.fetch,m0,...q0,...B0);if(J.preserveExisting){for(let[a,e0]of Object.entries(V1))if(!(a in Z)||Z[a]===void 0)Z[a]=e0}else Object.assign(Z,V1);for(let[a,e0]of Object.entries(U))if(!(a in Z))Z[a]=e0}catch(v){if(k5.env.STX_DEBUG){let f=v instanceof Error?v.message:String(v);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${f}`)}try{await yQ(Q,Z,Y)}catch(f){if(k5.env.STX_DEBUG){let C=f instanceof Error?f.message:String(f);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${C}`)}}}}function l$($,Z){let Y=Z?n1.dirname(Z):k5.cwd(),J=$.split(`
|
|
760
|
+
`),Q=[],X=0;while(X<J.length){let G=J[X].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;X<J.length;X++){for(let q of J[X])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}X++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let z=X;z<J.length&&!q;z++){let W=null,U=!1,B=J[z];for(let _=0;_<B.length;_++){let j=B[_];if(U){U=!1;continue}if(j==="\\"){U=!0;continue}if(W){if(j===W)W=null;continue}if(j==='"'||j==="'"||j==="`"){W=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){X=z+1,q=!0;break}}}}if(!q)X=J.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),z=G.match(/^import\s+['"](.+)['"]/),W=(U)=>{if(U.startsWith("."))return n1.resolve(Y,U);return U};if(K){let[,U,B]=K,_=W(B);Q.push(`const ${U} = await import('${_}')`),Q.push(`module.exports.${U} = ${U};`)}else if(q){let[,U,B]=q,_=U.trim(),j=W(B);Q.push(`const { ${_} } = await import('${j}')`);for(let H of _.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(z){let U=W(z[1]);Q.push(`await import('${U}')`)}else Q.push(G);X++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(J[X]),X++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=W9(J,X),{type:q,name:z,value:W}=K;Q.push(`${q} ${z} = ${W};`),Q.push(`module.exports.${z} = ${z};`),X=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=c$(J,X);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),X=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=W9(J,X),{type:q,name:z,value:W}=K;Q.push(`${q} ${z} = ${W};`),Q.push(`module.exports.${z} = ${z};`),X=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=c$(J,X);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),X=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=J[X].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...J];q[X]=K;let z=c$(q,X);if(Q.push(z.functionCode),z.name)Q.push(`module.exports.default = ${z.name};`);X=z.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),X++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],z=J[X].replace(/^export\s+/,""),W=0,U=X;for(;U<J.length;U++){let B=J[U];for(let _ of B)if(_==="{")W++;else if(_==="}")W--;if(U>X)z+=`
|
|
761
|
+
`+B;if(W<=0&&U>=X)break}Q.push(z),Q.push(`module.exports.${q} = ${q};`),X=U+1}else Q.push(G),X++}else if(G.includes("module.exports"))Q.push(G),X++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),X++;else X++}return EQ(Q.join(`
|
|
762
|
+
`),Y)}function EQ($,Z){let Y=$.length,J="",Q=0,X=null,G=!1,K=!1,q=0;while(Q<Y){let z=$[Q],W=$[Q+1];if(G){if(J+=z,z===`
|
|
763
|
+
`)G=!1;Q++;continue}if(K){if(J+=z,z==="*"&&W==="/"){J+=W,Q+=2,K=!1;continue}Q++;continue}if(!X&&z==="/"&&W==="/"){G=!0,J+=z,Q++;continue}if(!X&&z==="/"&&W==="*"){K=!0,J+=z,Q++;continue}if(X){if(J+=z,z==="\\"){J+=W,Q+=2;continue}if(z===X&&X!=="`"){X=null,Q++;continue}if(X==="`"){if(z==="$"&&W==="{"){q++,J+=W,Q+=2;continue}if(z==="`"){X=null,Q++;continue}}Q++;continue}if(q>0){if(z==="{")q++;else if(z==="}")q--}if(z==='"'||z==="'"||z==="`"){X=z,J+=z,Q++;continue}if(z==="a"&&$.startsWith("await",Q)){let U=kQ($,Q);if(U){let{quote:B,path:_,end:j}=U;if(_.startsWith(".")){let H=n1.resolve(Z,_);J+=`await import(${B}${H}${B})`,Q=j;continue}}}J+=z,Q++}return J}function kQ($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let J=$[Y];if(J!=="'"&&J!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==J)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let X=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:J,path:X,end:Y+1}}function H9($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=b0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function O9($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,Q=0,X="";while(J<Y.length){let G=Y[J];if(G==="{"||G==="["){if(Q++,Q===1){let K=H9(Y,J);if(K){let q=O9(K.pattern);Z.push(...q),J=K.endPos,X="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){J++;continue}if(G===","){if(X.trim())Z.push(X.trim());X="",J++;continue}if(G===":"){X="",J++;continue}if(G==="="){if(X.trim())Z.push(X.trim());X="",J++;while(J<Y.length&&Y[J]!==","&&Q===0){if(Y[J]==="{"||Y[J]==="[")Q++;else if(Y[J]==="}"||Y[J]==="]")Q--;J++}continue}if(/[\w$]/.test(G))X+=G;J++}if(X.trim())Z.push(X.trim());return Z}function W9($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!J){let z=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(z){let W=Y.slice(z[0].length),U=Z;if((W.startsWith("{")||W.startsWith("["))&&!W.includes(W.startsWith("{")?"}":"]")){let _=W.startsWith("{")?"}":"]",j=W;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),U=H,$[H].includes(_))break;W=j}let B=H9(W,0);if(B){let _=z[1],j=B.pattern,H=W.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(U,Z);if(U9(L)){let N=B9($,O,L);F=N.value,O=N.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=O9(j),w=`__stx_src_${Z}`,A=V.map((N)=>`module.exports.${N} = ${N};`).join(`
|
|
764
|
+
`);return{type:_,name:w,value:`${F}; ${_} ${j} = ${w};
|
|
765
|
+
${A}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,X,G]=J,K=G,q=Z;if(U9(G)){let z=B9($,Z,G);K=z.value,q=z.nextIndex}else q=Z+1;while(q<$.length){let z=$[q].trim();if(z.startsWith(".")||z.startsWith("?."))K+=`
|
|
766
|
+
${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:X,value:K,nextIndex:q}}function c$($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,Q]=J,X=Y.replace(/^export\s+/,""),G=Z;if(bQ(Y)){let K=SQ($,Z,X);X=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:X,nextIndex:G}}function U9($){let Z=$.trim();if(Z.startsWith("{"))return b0(Z,"{","}",0)===-1;if(Z.startsWith("["))return b0(Z,"[","]",0)===-1;return!L9(Z)}function L9($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((X==='"'||X==="'")&&!Y){Y=X;continue}if(X===Y&&Y!=="`"){Y=null;continue}if(X==="`"&&!Y){Y="`";continue}if(X==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&X==="$"&&$[Q+1]==="{"){J++,Q++;continue}if(J>0&&X==="{"){J++;continue}if(J>0&&X==="}"){J--;continue}if(Y)continue;if(X==="(")Z.paren++;else if(X===")")Z.paren--;else if(X==="[")Z.bracket++;else if(X==="]")Z.bracket--;else if(X==="{")Z.brace++;else if(X==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function bQ($){let Z=$.indexOf("{");if(Z===-1)return!0;return b0($,"{","}",Z)===-1}function B9($,Z,Y){let J=Y,Q=Z+1;while(Q<$.length&&!L9(J)){let X=$[Q];J+=`
|
|
767
767
|
${X}`,Q++}while(Q<$.length){let X=$[Q].trim();if(X.startsWith(".")||X.startsWith("?."))J+=`
|
|
768
|
-
${$[Q]}`,Q++;else break}return{value:J,nextIndex:Q}}function
|
|
769
|
-
${G}`,Q++}return{functionCode:J,nextIndex:Q}}function _9($,Z){let Y=Z0($,Z)??Z0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...
|
|
770
|
-
`)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<X-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},
|
|
768
|
+
${$[Q]}`,Q++;else break}return{value:J,nextIndex:Q}}function SQ($,Z,Y){let J=Y,Q=Z+1;while(Q<$.length){let X=J.indexOf("{");if(X!==-1){if(b0(J,"{","}",X)!==-1)break}let G=$[Q];J+=`
|
|
769
|
+
${G}`,Q++}return{functionCode:J,nextIndex:Q}}function _9($,Z){let Y=Z0($,Z)??Z0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...k5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function yQ($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let X of J){let[,,G,K]=X;try{let q=K.trim().replace(/;$/,""),z=_9(q,Z);if(z!==void 0)Z[G]=z}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let X of Q){let[,,G,K]=X;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),z=_9(q,Z);if(z!==void 0)Z[G]=z}catch{}}}function F9($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function V9($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var b5=S(()=>{E5();u1();R0()});var i$={};r(i$,{renderSlot:()=>A9,processSlots:()=>R9,parseSlots:()=>w9,parseSlotElement:()=>PQ,extractSlotContent:()=>fQ,applySlots:()=>gQ});function CQ($,Z){let Y=1,J=Z,Q="<template",X="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(Q,J)&&(J+Q.length>=$.length||/[\s>\/]/.test($[J+Q.length]))){Y++,J+=Q.length;continue}if($.startsWith(X,J)){let K=$.indexOf(">",J+X.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function w9($){let Z={default:"",named:new Map},Y=$,J=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,Q=[],X;while((X=J.exec($))!==null){let[W,U,B,_,j]=X,H=U||B||_,L=X.index+W.length,F=CQ($,L);if(F!==-1){let O=$.slice(L,F-11).trim();Q.push({start:X.index,end:F,slotName:H,content:O,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:O,propsBinding:j||void 0})}}Q.sort((W,U)=>U.start-W.start);for(let W of Q)Y=Y.slice(0,W.start)+Y.slice(W.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Y))!==null){let[W,U,B,_,j,H]=q,L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(L+F).trim(),V=`<${U}${O?" "+O:""}>${H}</${U}>`;G.push({start:q.index,end:q.index+W.length,slotName:_,element:V})}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=z.exec(Y))!==null){let[W,U,B,_,j]=q,H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+L).trim(),O=`<${U}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+W.length,slotName:_,element:O})}G.sort((W,U)=>U.start-W.start);for(let W of G){let U=Z.named.get(W.slotName);if(U)U.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function PQ($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=Q.exec($))!==null)J[X[1]]=X[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function A9($,Z,Y,J){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let X=$.propsBinding.trim(),G={...J};if(X.startsWith("{")&&X.endsWith("}")){let K=X.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[z,W]=q.split(":").map((B)=>B.trim()),U=W||z;if(Z[z]!==void 0)G[U]=Z[z]}}else G[X]=Z;Q=vQ(Q,G)}return Q}function vQ($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let Q=J.trim(),X=N9(Q,Z);return u0(String(X??""))}catch{return`{{ ${J} }}`}})}function N9($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),Q=Z;for(let X of J)if(Q&&typeof Q==="object"&&X in Q)Q=Q[X];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,Q,X]=Y,G=Z[J],K=parseInt(X,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!Q0($))return;return G0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function R9($,Z,Y){let J=$;J=await xQ(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,z)=>{let W=Z.named.get(K),U=z?.trim()||"",B=q||"",_={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(B))!==null){let L=H[1],F=H[2];_[L]=N9(F,Y)}return await A9(W,_,U,Y)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(X,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),J}async function xQ($,Z,Y){let J=[],Q=[];$.replace(Z,(K,...q)=>{let z=q[q.length-2];return Q.push({match:K,index:z}),J.push(Y(K,...q.slice(0,-2))),K});let X=await Promise.all(J),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:z}=Q[K];G=G.slice(0,z)+X[K]+G.slice(z+q.length)}return G}function fQ($){let Z=w9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function gQ($,Z,Y,J){return await R9($,{default:Z,named:Y},J)}var n$=S(()=>{r0();R0()});import hQ from"fs";import d from"path";function T9($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function mQ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!mQ($)}function N1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(X)=>{let G=Y.length;return Y.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(X)=>{let G=Y.length;return Y.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(X)=>{let G=Y.length;return Y.push(X),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}).transformSync(Z);for(let X=0;X<Y.length;X++)Q=Q.replace(`"__STX_EXPR_${X}__"`,Y[X]),Q=Q.replace(`'__STX_EXPR_${X}__'`,Y[X]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function uQ($){let Z=[],Y=new Set,J=0,Q=0,X=$.length,G=(W)=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]===W){Q++;return}Q++}},K=()=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let W=1;while(Q<X&&W>0)if($[Q]==="{")W++,Q++;else if($[Q]==="}")W--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<X&&$[Q]!==`
|
|
770
|
+
`)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<X-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(J!==0)return;let W=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let j=W[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(Q<X){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){J++,Q++;continue}if($[Q]==="}"){J--,Q++;continue}if(J===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))z();Q++}return Z}function pQ($){let Z=[],Y=0,J=0,Q=null;for(let X=0;X<$.length;X++){let G=$[X];if(Q){if(G==="\\"){X++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,X)),J=X+1}if(J<$.length)Z.push($.slice(J));return Z}function cQ($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let Q=$[J];if(Y){if(Q==="\\"){J++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let X=$[J-1],G=$[J+1];if(X==="!"||X==="<"||X===">"||X==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function lQ($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Q=J,X=0,G=-1;for(;J>=0;J--){let q=$[J];if(q==="}")X++;else if(q==="{"){if(X--,X===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of pQ(K)){let z=q.trim();if(!z||z.startsWith("..."))continue;let W=cQ(z);if(W===-1)continue;let U=z.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let B=z.slice(W+1).trim();if(!B)continue;try{let _=Object.keys(Z),j=Function(..._,`"use strict"; return (${B});`);Z[U]=j(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function z4($,Z,Y,J,Q){let X=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[X,X.toLowerCase(),G(X),K(X)])if(q.has(L))return!0}let z=[...new Set([`${X}.stx`,`${G(X)}.stx`,`${K(X)}.stx`])],W=typeof Q.root==="string"?d.resolve(Q.root):void 0,U=W??d.dirname(J),B=[],_=(L)=>{if(L&&!B.includes(L))B.push(L)},j=Y.__originalFilePath;if(j)_(d.join(d.dirname(j),"components"));_(Z),_(d.join(d.dirname(J),"components")),_(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(W)_(d.resolve(W,"resources/views/components")),_(d.resolve(W,"resources/components")),_(d.resolve(W,"src/components")),_(d.resolve(W,"components"));if(X.startsWith("./")||X.startsWith("../"))return n(d.resolve(d.dirname(J),`${X}.stx`));for(let L of B){let F=d.isAbsolute(L)?L:d.resolve(U,L);for(let O of z)if(await n(d.join(F,O)))return!0}return!1}function iQ($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function nQ($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}async function I1($,Z,Y,J,Q,X,G,K=new Set,q){let{extractVariables:z}=await Promise.resolve().then(() => (b5(),q4)),W=K??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let U=new Set(W);U.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=B&&B!=="load"&&iQ(B)?B:"";try{let j=(C)=>C.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let C=[L,L.toLowerCase(),j(L),H(L)];for(let x of C)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let C=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],x=[...new Set(C)],u=Q.__originalFilePath,p=[];if(u){let B0=d.join(d.dirname(u),"components");p.push(B0)}if(J)p.push(J);let X0=d.join(d.dirname(X),"components");if(!p.includes(X0))p.push(X0);if(G.componentsDir&&G.componentsDir!==J&&!p.includes(G.componentsDir))p.push(G.componentsDir);let q0=G._pluginComponentDirs;if(Array.isArray(q0)){for(let B0 of q0)if(typeof B0==="string"&&!p.includes(B0))p.push(B0)}let C0=typeof G.root==="string"?d.resolve(G.root):void 0,d1=C0??d.dirname(X),m0=[];if(C0)m0.push(d.resolve(C0,"resources/views/components")),m0.push(d.resolve(C0,"resources/components")),m0.push(d.resolve(C0,"src/components")),m0.push(d.resolve(C0,"components"));m0.push(d.resolve(import.meta.dir,"components"));for(let B0 of m0)if(!p.includes(B0))p.push(B0);let Q1=[...new Set(p.map((B0)=>{if(!B0)return B0;return d.isAbsolute(B0)?B0:d.resolve(d1,B0)}))];if(p.length=0,p.push(...Q1),L.startsWith("./")||L.startsWith("../"))F=d.resolve(d.dirname(X),`${L}.stx`),V.push(F);else for(let B0 of p){if(!B0)continue;for(let B5 of x){let V1=d.join(B0,B5);if(V.push(V1),await n(V1)){F=V1;break}}if(F)break;if(!F)try{let B5=await import("fs");if(!B5.statSync(B0,{throwIfNoEntry:!1})?.isDirectory())continue;let a=8,e0=[{path:B0,depth:0}];while(e0.length>0&&!F){let _5=e0.pop();if(_5.depth>=a)continue;let j6;try{j6=B5.readdirSync(_5.path,{withFileTypes:!0})}catch{continue}for(let r5 of j6){if(!r5.isDirectory())continue;if(r5.name==="node_modules"||r5.name.startsWith("."))continue;let H6=d.join(_5.path,r5.name);for(let XX of x){let k$=d.join(H6,XX);if(V.push(k$),await n(k$)){F=k$;break}}if(F)break;e0.push({path:H6,depth:_5.depth+1})}}}catch{}if(F)break}}if(!F||!await n(F)){let C=V.length>0?`
|
|
771
771
|
Searched paths:
|
|
772
772
|
${V.map((x)=>` - ${x}`).join(`
|
|
773
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(F);let w;if(
|
|
774
|
-
`)}`}if(Y&&c.includes("{{ text || slot }}"))c=c.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:
|
|
773
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(F);let w;if(o$.has(F))w=o$.get(F);else try{w=await Bun.file(F).text(),o$.set(F,w)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[C,x]of Object.entries(Q))if(!C.startsWith("__")||A.has(C))N[C]=x;let{extractSlotContent:R}=await Promise.resolve().then(() => (n$(),i$)),T=R(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[C,x]of T.namedSlots)M[C]=x.content;let I={...N,...Z,props:Z,slot:Y,$slots:M,__processedComponents:U,__sections:{},...nQ(Y)&&{__stx_force_signals:!0}};lQ(w,I);let D=w,E=D.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(E)D=E[1].trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...w.matchAll(P)],k=[];for(let C of b){let x=C[1]||"",u=C[2]||"",p=x.includes("server");if(A1(x)&&u.trim())u=N1(u);if(p&&u)try{await z(u,I,F)}catch(q0){}if(!p){let q0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,"");if(q0.includes("{{")&&q0.includes("}}"))q0=s0(q0,I,F);let C0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${C0}>${q0}</script>`)}}let y=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),g=y?y[1]:"",h=y?y[2]:"",m="",i=g&&/\bscoped\b/i.test(g);if(y)m=`<style${g}>${h}</style>`;let c=D;if(c=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y)c=c.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let C=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(c=c.replace(C,(u,p)=>{let X0=p.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(X0)x.push(`<style${X0[1]}>${X0[2]}</style>`);return""}),c=c.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)m=`${m}${x.join(`
|
|
774
|
+
`)}`}if(Y&&c.includes("{{ text || slot }}"))c=c.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:z0}=await Promise.resolve().then(() => (n$(),i$)),{defaultSlot:F0,namedSlots:_0}=T;c=await z0(c,F0||Y,_0,I);for(let[C,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("<")||x.includes(""")){let u=g$(x);I[C]=u}}let $0=k.some((C)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(C)),I0={...G,componentsDir:d.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:$0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let f0=await H0(c,I,F,I0,q),v=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++dQ}_${Math.random().toString(36).slice(2,8)}`,f=f0;if($0){let C="";if(Object.keys(Z).length>0)try{C=` data-stx-props="${T9(JSON.stringify(Z))}"`}catch{}let x=_?` stx-hydrate="${T9(_)}"`:"";if(f=`<div data-stx-scope="${v}"${C}${x}>${f0}</div>`,f=k.map((p)=>{let X0=p.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!X0)return p;let[,q0,C0]=X0,d1=Z1(C0),m0=`
|
|
775
775
|
(function() {
|
|
776
776
|
const { state, derived, effect, batch, defineEmits, defineExpose, defineSlots, defineProps, withDefaults, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, inject, ref, reactive, computed, watch, watchEffect, nextTick } = window.stx;
|
|
777
777
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
@@ -788,34 +788,34 @@ ${d1}
|
|
|
788
788
|
// Register all defined signals and functions in this scope
|
|
789
789
|
const __localVars = {};
|
|
790
790
|
try {
|
|
791
|
-
${
|
|
791
|
+
${uQ(d1).map((Q1)=>`if (typeof ${Q1} !== 'undefined') __localVars['${Q1}'] = ${Q1};`).join(`
|
|
792
792
|
`)}
|
|
793
793
|
}
|
|
794
794
|
catch (e) {}
|
|
795
795
|
Object.assign(__scopeVars, __localVars);
|
|
796
|
-
})();`;if(
|
|
796
|
+
})();`;if(_)return`<script type="stx/island" data-stx-island="${v}" data-stx-scoped${q0}>${m0}</script>`;return`<script data-stx-scoped${q0}>${m0}</script>`}).join(`
|
|
797
797
|
`)+`
|
|
798
798
|
`+f,m)f+=`
|
|
799
799
|
`+m}else{if(m)f+=`
|
|
800
|
-
`+m;if(k.length>0){let C=I.__stx_event_bindings||[],x=
|
|
800
|
+
`+m;if(k.length>0){let C=I.__stx_event_bindings||[],x=w5(I),u=await Promise.all(k.map(async(p)=>{let X0=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!X0)return p;return await A5(X0[1],{eventBindings:C,templateContent:f,filePath:F,projectRoot:process.cwd(),serverData:x})}));f+=`
|
|
801
801
|
`+u.join(`
|
|
802
|
-
`),I.__stx_event_bindings=[]}}if(i){let C=Q4(f,F);if(C.hasScoped)f=C.html}return f}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{
|
|
803
|
-
`),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){J=q+1,Q=G[q].trim();let
|
|
804
|
-
`);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return
|
|
805
|
-
`,Math.max(0,Q-1));
|
|
806
|
-
${Y}:${G}${
|
|
807
|
-
`;if(
|
|
802
|
+
`),I.__stx_event_bindings=[]}}if(i){let C=Q4(f,F);if(C.hasScoped)f=C.html}return f}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{W.delete($)}}async function n($){return Bun.file($).exists()}function s$($,Z){let Y=d.resolve(Z),J=d.resolve($),Q=Y.endsWith(d.sep)?Y:Y+d.sep;if(J===Y||J.startsWith(Q))return J;return null}async function r$($,Z,Y,J){let Q=await oQ($,Z,Y,J);if(Q===null)return null;let X=s$(Q,process.cwd());if(X)return X;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=d.isAbsolute(K)?K:d.resolve(process.cwd(),K);if(s$(Q,q))return d.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function oQ($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=d.dirname(Z),X=process.cwd();if($.startsWith("/")){let B=d.join(X,$),_=s$(B,X);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await n(_)&&J)J.add(_);return _}let G=d.join(Q,$);if(await n(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let B of[".stx",".tsx",".jsx"]){let _=`${G}${B}`;if(await n(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(J)J.add(_);return _}}let K="",q=d.resolve(Q),z=process.cwd();for(let B=0;B<10;B++){let _=d.join(q,"layouts"),j=!1;try{j=hQ.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=_;break}let H=d.dirname(q);if(H===q||H.length<z.length)break;q=H}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,_=d.join(K,B);if(await n(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(J)J.add(_);return _}if(!B.endsWith(".stx")){let j=`${_}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.layoutsDir){let B=d.isAbsolute(Y.layoutsDir)?Y.layoutsDir:d.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,j=d.join(B,_);if(await n(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await n(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(J)J.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),_=d.join(Y.partialsDir||Q,"layouts",B[1]);if(await n(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(J)J.add(_);return _}if(!_.endsWith(".stx")){let j=`${_}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.partialsDir){if(K=d.join(Y.partialsDir,"layouts"),await n(K)){let B=d.join(K,$);if(await n(B)){if(Y.debug)console.log(`Found in partials layouts dir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await n(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}}let W=Y.partialsDir||d.join(process.cwd(),"views"),U=d.join(W,$);if(await n(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let B=`${U}.stx`;if(await n(B)){if(Y.debug)console.log(`Found in views path with extension: ${B}`);if(J)J.add(B);return B}}if(Q.includes("temp")){let B=d.join(d.dirname(Q),"layouts",$);if(await n(B)){if(Y.debug)console.log(`Found in temp layouts dir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await n(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function M9($,Z,Y){let J=0,Q="",X="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
|
|
803
|
+
`),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){J=q+1,Q=G[q].trim();let z=Math.max(0,q-2),W=Math.min(G.length,q+3);X=G.slice(z,W).map((U,B)=>{let _=z+B+1;return`${_===J?"> ":" "}${_}: ${U}`}).join(`
|
|
804
|
+
`);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return M9($,G)}}catch{}return{lineNumber:J,lineContent:Q,context:X}}function K0($,Z,Y,J,Q,X){let{lineNumber:G,context:K}=M9(J,Q,X),q=Y.split("/").pop(),z=0;if(typeof Q==="number"&&Q>=0&&J){let U=J.lastIndexOf(`
|
|
805
|
+
`,Math.max(0,Q-1));z=Q-(U+1)+1}let W="";if(G>0)W+=`
|
|
806
|
+
${Y}:${G}${z>0?`:${z}`:""}: ${$.toLowerCase()} error: ${Z}
|
|
807
|
+
`;if(W+=`
|
|
808
808
|
${t.bold}${t.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${t.reset}
|
|
809
|
-
`,
|
|
810
|
-
`,
|
|
811
|
-
`,
|
|
812
|
-
${t.cyan}${t.bold}File:${t.reset} ${t.dim}${q}${t.reset}`,G>0)
|
|
809
|
+
`,W+=`${t.bold}${t.red}\u2502${t.reset} ${t.bold}${t.bgRed} ERROR ${t.reset} ${t.red}${$} Error${t.reset}${" ".repeat(Math.max(0,43-$.length))}${t.bold}${t.red}\u2502${t.reset}
|
|
810
|
+
`,W+=`${t.bold}${t.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${t.reset}
|
|
811
|
+
`,W+=`
|
|
812
|
+
${t.cyan}${t.bold}File:${t.reset} ${t.dim}${q}${t.reset}`,G>0)W+=` ${t.gray}(line ${G}${z>0?`, col ${z}`:""})${t.reset}`;if(W+=`
|
|
813
813
|
${t.yellow}${t.bold}Message:${t.reset} ${Z}
|
|
814
|
-
`,K)
|
|
814
|
+
`,K)W+=`
|
|
815
815
|
${t.blue}${t.bold}Context:${t.reset}
|
|
816
816
|
${t.dim}${K}${t.reset}
|
|
817
|
-
`;return
|
|
818
|
-
`||O==="\r"||O===" "||O===void 0)U++;
|
|
817
|
+
`;return W}var o$,dQ=0,t;var A0=S(()=>{N5();r0();i1();W4();u1();u$();z9();b5();o$=new I5(500);t={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"}});async function I9($,Z,Y=""){let J=$,Q=[],X=/@markdown(?:\([^)]*\))?/g,G;while((G=X.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),z=q?q[1]:"",W=K+G[0].length,U=1,B=W,_=-1;while(U>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
|
|
818
|
+
`||O==="\r"||O===" "||O===void 0)U++;B=L+9}else{if(U--,U===0){_=F;break}B=F+12}}if(_===-1)continue;let j=$.slice(W,_),H=$.slice(K,_+12);Q.push({fullMatch:H,options:z,content:j,index:K}),X.lastIndex=_+12}for(let{fullMatch:K,options:q,content:z,index:W}of Q)try{let U={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)U[H]=!0});let B={gfm:U.gfm??!0,breaks:U.breaks??!1},_=F5(z.trim(),B);J=J.split(K).join(_)}catch(U){let B=U instanceof Error?U.message:String(U),_=K0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,W,K);J=J.split(K).join(_)}return J}async function D9($,Z,Y,J){let Q={gfm:!0,breaks:!1};return Z.forEach((X)=>{let G=X.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),F5($.trim(),Q)}var a$=S(()=>{A0()});function aQ($){if(sQ.set($.name,$),$.client)rQ.set($.name,$.client)}function U4($){return aQ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,Q,X)=>{let G=tQ(J,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let z=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(z)}}let K=Y;if($.transform)K=await $.transform(Y,G,Q,X);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function tQ($,Z){let Y={...Z};for(let J of $){let Q=J.indexOf(":"),X=J.indexOf("="),G=Q>=0&&(X<0||Q<X)?Q:X;if(G>=0){let K=J.slice(0,G).trim(),q=J.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var sQ,rQ;var t$=S(()=>{sQ=new Map,rQ=new Map});function e$($,Z=o1,Y={},J){return Z.sort((Q,X)=>Q-X).map((Q)=>{return`${y5($,{...Y,w:Q,fm:J})} ${Q}w`}).join(", ")}function E9($,Z,Y=eQ,J={},Q){return Y.sort((X,G)=>X-G).map((X)=>{let G=Math.round(Z*X);return`${y5($,{...J,w:G,dpr:X,fm:Q})} ${X}x`}).join(", ")}function $7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([Q,X])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:X,numericBp:Number.parseInt(G)||0}}).sort((Q,X)=>Q.numericBp-X.numericBp).map(({bp:Q,size:X})=>`(max-width: ${Q}) ${X}`);return J.push(Z),J.join(", ")}function y5($,Z={}){let Y=Object.entries(Z).filter(([,X])=>X!==void 0&&X!==null).map(([X,G])=>{if(Array.isArray(G))return[X,G.join(",")];return[X,String(G)]});if(Y.length===0)return $;let J=Y.map(([X,G])=>`${X}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${J}`}function Z7($){return $G[$]||"application/octet-stream"}var o1,eQ,S5,$G;var Y7=S(()=>{o1=[320,480,640,768,1024,1280,1536,1920,2560],eQ=[1,1.5,2,3],S5=["avif","webp","jpeg"],$G={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function YG(){try{return await import("ts-images")}catch{return null}}async function JG($,Z={}){let Y={...ZG,...Z},J=await YG();if(J)try{return await XG($,Y,J)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return QG($,Y)}async function XG($,Z,Y){let{generatePlaceholder:J,generateThumbHash:Q}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function QG($,Z){let Y=Z.width||20,J=Z.height||Y,Q="#e5e7eb",X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function k9($,Z,Y={}){let J=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
|
|
819
819
|
#${$} {
|
|
820
820
|
--stx-img-transition-duration: ${J}ms;
|
|
821
821
|
--stx-img-transition-easing: ${Q};
|
|
@@ -832,7 +832,7 @@ ${t.dim}${K}${t.reset}
|
|
|
832
832
|
#${$}.stx-img-loaded img {
|
|
833
833
|
opacity: 1;
|
|
834
834
|
}
|
|
835
|
-
`.trim()}async function
|
|
835
|
+
`.trim()}async function b9($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(J7.has(Y))return J7.get(Y);let J=await JG($,Z);return J7.set(Y,J),J}var ZG,X7,J7;var S9=S(()=>{ZG={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},X7=`
|
|
836
836
|
.stx-img-placeholder {
|
|
837
837
|
position: relative;
|
|
838
838
|
overflow: hidden;
|
|
@@ -861,8 +861,8 @@ ${t.dim}${K}${t.reset}
|
|
|
861
861
|
filter: blur(0);
|
|
862
862
|
transform: scale(1);
|
|
863
863
|
}
|
|
864
|
-
`.trim();Y7=new Map});import{createHash as y9}from"crypto";import{readFile as YG,stat as C9}from"fs/promises";async function I0($){try{let Z=await YG($);return y9("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function S9($){return y9("sha256").update($).digest("hex").slice(0,16)}function _4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${S9($)}-${S9(Y)}`}async function X7($){try{return(await C9($)).mtimeMs}catch{return 0}}async function M0($){try{return await C9($),!0}catch{return!1}}var D1=()=>{};import{mkdir as JG,readFile as XG,writeFile as QG,readdir as Oj,rm as GG,stat as Lj}from"fs/promises";import{join as v9,dirname as KG}from"path";async function qG($){try{await JG($,{recursive:!0})}catch{}}function x9($,Z,Y){return v9($,Y,`${Z}.json`)}async function P9($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await X7(Z)!==$.srcMtime)return!1;return!0}async function B4($,Z,Y,J=Q7){if(!J.enabled)return null;let Q=_4($,Z),X=s1.get(Q);if(X){if(await P9(X,$,J.maxAge))return X.lastAccessedAt=Date.now(),X.data;s1.delete(Q)}let G=x9(J.directory,Q,Y);if(await M0(G))try{let K=await XG(G,"utf-8"),q=JSON.parse(K);if(await P9(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),s1.set(Q,q),q.data}catch{}return null}async function j4($,Z,Y,J,Q=Q7){if(!Q.enabled)return;let X=_4($,Z),G=await I0($),K=await X7($),q={key:X,src:$,srcHash:G,srcMtime:K,optionsHash:_4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};s1.set(X,q);let W=x9(Q.directory,X,J);try{await qG(KG(W)),await QG(W,JSON.stringify(q,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function H4($,Z=Q7){if($==="all")s1.clear();else s1.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let Q=v9(Z.directory,J);try{await GG(Q,{recursive:!0,force:!0})}catch{}}}var s1,Q7;var G7=S(()=>{D1();s1=new Map,Q7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class L4{config;constructor($={}){this.config={...zG,...$}}async get($,Z){return B4($,Z,"image",this.config)}async set($,Z,Y){return j4($,Z,Y,"image",this.config)}async clear(){return H4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function K7($){if(!O4)O4=new L4($);else if($)O4.updateConfig($);return O4}async function F4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return K7(J).get($,Z)}async function V4($,Z,Y,J){let Q=J?{directory:`${J.outputDir}/../.cache`}:{};return K7(Q).set($,Z,Y)}async function f9(){return K7().clear()}var zG,O4=null;var q7=S(()=>{G7();zG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as WG,basename as UG,extname as _G,join as BG}from"path";import{mkdir as jG}from"fs/promises";async function z7(){try{return await import("ts-images")}catch{return null}}function g9($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function HG($,Z){let Y=Z?g9(Z):g9("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function h9($,Z,Y){let J=await z7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await F4($,Z,Y);if(Q)return Q;try{let X=WG($);if(!await M0(X))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=HG(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await jG(K,{recursive:!0});let W=await I0(X),z=UG($,_G($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],_={src:$,processed:!0,variants:[],hash:W},B=null;if(Z.transformations&&Z.transformations.length>0)B=await W7(X,Z.transformations,J);for(let j of U){let H=G[j]||{},L=`${z}-${W}.${j}`,F=BG(K,L);try{let O=await J.optimizeImage({input:B||X,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(_.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!_.originalWidth&&O.width)_.originalWidth=O.width,_.originalHeight=O.height}}catch(O){_.errors=_.errors||[],_.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await J.generateThumbHash(X);_.placeholder=j.dataUrl}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await J.generatePlaceholder(X,{strategy:"dominant-color"});_.dominantColor=j.dominantColor}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to extract dominant color: ${j}`)}return await V4($,Z,_,Y),_}catch(X){return{src:$,processed:!1,errors:[`Processing failed: ${X}`]}}}async function d9($,Z,Y,J){let Q=await z7();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function W7($,Z,Y){let J=Y||await z7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await J.decode($);for(let X of Z){let G=X.options||{};switch(X.type){case"resize":if(G.width||G.height)Q=await J.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await J.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await J.sharpen(Q,G.amount);break;case"grayscale":Q=await J.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await J.rotate(Q,G.angle);break;case"flip":Q=await J.flip(Q);break;case"flop":Q=await J.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await J.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await J.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await J.saturation(Q,G.value);break}}return await J.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var m9=S(()=>{D1();q7()});import{resolve as OG,basename as LG,extname as FG,join as VG}from"path";import{mkdir as wG}from"fs/promises";async function AG(){try{return await import("ts-images")}catch{return null}}async function u9($,Z,Y){let J=await AG();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=OG($);if(!await M0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let X=Z.responsiveWidths||Y.breakpoints||NG,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await wG(K,{recursive:!0});let W=await I0(Q),z=LG($,FG($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},_={src:$,byFormat:{},srcsets:{}};for(let j of G){_.byFormat[j]=[];let H=[];for(let L of X){let F=`${z}-${L}w-${W}.${j}`,O=VG(K,F),V=`${q}/${F}`;try{let w=U[j]?.quality||80;if(await M0(O)){_.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await J.processImage({input:Q,output:O,format:j,quality:w,resize:{width:L}});if(A)_.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${w}`)}}_.srcsets[j]=H.join(", ")}let B=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await J.generateThumbHash(Q);_.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await J.generatePlaceholder(Q,{strategy:B,width:20});_.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return _.sizes=Z.sizes||RG(X),_}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function RG($){let Z=[...$].sort((J,Q)=>J-Q),Y=[];for(let J=0;J<Z.length-1;J++){let Q=Z[J];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function p9($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var NG;var c9=S(()=>{D1();NG=[320,480,640,768,1024,1280,1536,1920]});var l9={};r(l9,{setCachedImageResult:()=>V4,processImage:()=>h9,optimizeImage:()=>d9,getCachedImageResult:()=>F4,generateSrcset:()=>p9,generateResponsiveVariants:()=>u9,clearImageCache:()=>f9,applyTransformations:()=>W7,ImageProcessorCache:()=>L4});var i9=S(()=>{m9();c9();q7()});async function TG(){try{return await Promise.resolve().then(() => (i9(),l9))}catch($){if(!n9)console.warn("[stx-media] Image processor not available, some features disabled:",$),n9=!0;return null}}async function w4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return EG(J,Y)}if(Y.processedResult?.processed)return j7($,Y.processedResult,Z);if(Y.responsiveVariants)return a9($,Y.responsiveVariants,Z);let{src:Q,alt:X,width:G,height:K,sizes:q,widths:W=o1,dpr:z,formats:U=k5,quality:_=U7,params:B={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":N4,decoding:V=A4,fetchpriority:w,objectFit:A,objectPosition:N,crossorigin:R,referrerpolicy:T}=$,M=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:P=!1,baseUrl:b=""}=Z;if(P&&!Z.optimize)return DG($);let k,y,g=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{k=await k9(Q,{strategy:j,...H}),y=E9(g,k,H)}catch{}let h=z!==void 0&&G!==void 0,m;if(h)m=IG($,g,k,Z);else m=await MG($,g,k,Z);let i;if(F){let F0=U.includes("webp")?"webp":U[0],_0=t$(Q,W,{...B,q:_},F0),$0=typeof q==="object"?e$(q):q||"100vw";i=`<link rel="preload" as="image" imagesrcset="${_0}" imagesizes="${$0}" />`}let c=[];if(!o9&&j!=="none")c.push(J7),o9=!0;if(y)c.push(y);let q0=L?r9(g):void 0;return{html:m,preloadLink:i,css:c.length>0?c.join(`
|
|
865
|
-
`):void 0,script:
|
|
864
|
+
`.trim();J7=new Map});import{createHash as C9}from"crypto";import{readFile as GG,stat as P9}from"fs/promises";async function D0($){try{let Z=await GG($);return C9("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function y9($){return C9("sha256").update($).digest("hex").slice(0,16)}function B4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${y9($)}-${y9(Y)}`}async function Q7($){try{return(await P9($)).mtimeMs}catch{return 0}}async function M0($){try{return await P9($),!0}catch{return!1}}var D1=()=>{};import{mkdir as KG,readFile as qG,writeFile as zG,readdir as wj,rm as WG,stat as Aj}from"fs/promises";import{join as x9,dirname as UG}from"path";async function BG($){try{await KG($,{recursive:!0})}catch{}}function f9($,Z,Y){return x9($,Y,`${Z}.json`)}async function v9($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await Q7(Z)!==$.srcMtime)return!1;return!0}async function _4($,Z,Y,J=G7){if(!J.enabled)return null;let Q=B4($,Z),X=s1.get(Q);if(X){if(await v9(X,$,J.maxAge))return X.lastAccessedAt=Date.now(),X.data;s1.delete(Q)}let G=f9(J.directory,Q,Y);if(await M0(G))try{let K=await qG(G,"utf-8"),q=JSON.parse(K);if(await v9(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),s1.set(Q,q),q.data}catch{}return null}async function j4($,Z,Y,J,Q=G7){if(!Q.enabled)return;let X=B4($,Z),G=await D0($),K=await Q7($),q={key:X,src:$,srcHash:G,srcMtime:K,optionsHash:B4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};s1.set(X,q);let z=f9(Q.directory,X,J);try{await BG(UG(z)),await zG(z,JSON.stringify(q,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function H4($,Z=G7){if($==="all")s1.clear();else s1.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let Q=x9(Z.directory,J);try{await WG(Q,{recursive:!0,force:!0})}catch{}}}var s1,G7;var K7=S(()=>{D1();s1=new Map,G7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class L4{config;constructor($={}){this.config={..._G,...$}}async get($,Z){return _4($,Z,"image",this.config)}async set($,Z,Y){return j4($,Z,Y,"image",this.config)}async clear(){return H4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function q7($){if(!O4)O4=new L4($);else if($)O4.updateConfig($);return O4}async function F4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return q7(J).get($,Z)}async function V4($,Z,Y,J){let Q=J?{directory:`${J.outputDir}/../.cache`}:{};return q7(Q).set($,Z,Y)}async function g9(){return q7().clear()}var _G,O4=null;var z7=S(()=>{K7();_G={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as jG,basename as HG,extname as OG,join as LG}from"path";import{mkdir as FG}from"fs/promises";async function W7(){try{return await import("ts-images")}catch{return null}}function h9($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function VG($,Z){let Y=Z?h9(Z):h9("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function d9($,Z,Y){let J=await W7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await F4($,Z,Y);if(Q)return Q;try{let X=jG($);if(!await M0(X))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=VG(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await FG(K,{recursive:!0});let z=await D0(X),W=HG($,OG($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:z},_=null;if(Z.transformations&&Z.transformations.length>0)_=await U7(X,Z.transformations,J);for(let j of U){let H=G[j]||{},L=`${W}-${z}.${j}`,F=LG(K,L);try{let O=await J.optimizeImage({input:_||X,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await J.generateThumbHash(X);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await J.generatePlaceholder(X,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await V4($,Z,B,Y),B}catch(X){return{src:$,processed:!1,errors:[`Processing failed: ${X}`]}}}async function m9($,Z,Y,J){let Q=await W7();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function U7($,Z,Y){let J=Y||await W7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await J.decode($);for(let X of Z){let G=X.options||{};switch(X.type){case"resize":if(G.width||G.height)Q=await J.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await J.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await J.sharpen(Q,G.amount);break;case"grayscale":Q=await J.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await J.rotate(Q,G.angle);break;case"flip":Q=await J.flip(Q);break;case"flop":Q=await J.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await J.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await J.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await J.saturation(Q,G.value);break}}return await J.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var u9=S(()=>{D1();z7()});import{resolve as wG,basename as AG,extname as NG,join as RG}from"path";import{mkdir as TG}from"fs/promises";async function MG(){try{return await import("ts-images")}catch{return null}}async function p9($,Z,Y){let J=await MG();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=wG($);if(!await M0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let X=Z.responsiveWidths||Y.breakpoints||IG,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await TG(K,{recursive:!0});let z=await D0(Q),W=AG($,NG($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of X){let F=`${W}-${L}w-${z}.${j}`,O=RG(K,F),V=`${q}/${F}`;try{let w=U[j]?.quality||80;if(await M0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await J.processImage({input:Q,output:O,format:j,quality:w,resize:{width:L}});if(A)B.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${w}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await J.generateThumbHash(Q);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await J.generatePlaceholder(Q,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||DG(X),B}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function DG($){let Z=[...$].sort((J,Q)=>J-Q),Y=[];for(let J=0;J<Z.length-1;J++){let Q=Z[J];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function c9($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var IG;var l9=S(()=>{D1();IG=[320,480,640,768,1024,1280,1536,1920]});var i9={};r(i9,{setCachedImageResult:()=>V4,processImage:()=>d9,optimizeImage:()=>m9,getCachedImageResult:()=>F4,generateSrcset:()=>c9,generateResponsiveVariants:()=>p9,clearImageCache:()=>g9,applyTransformations:()=>U7,ImageProcessorCache:()=>L4});var n9=S(()=>{u9();l9();z7()});async function EG(){try{return await Promise.resolve().then(() => (n9(),i9))}catch($){if(!o9)console.warn("[stx-media] Image processor not available, some features disabled:",$),o9=!0;return null}}async function w4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return yG(J,Y)}if(Y.processedResult?.processed)return H7($,Y.processedResult,Z);if(Y.responsiveVariants)return t9($,Y.responsiveVariants,Z);let{src:Q,alt:X,width:G,height:K,sizes:q,widths:z=o1,dpr:W,formats:U=S5,quality:B=B7,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":N4,decoding:V=A4,fetchpriority:w,objectFit:A,objectPosition:N,crossorigin:R,referrerpolicy:T}=$,M=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:P=!1,baseUrl:b=""}=Z;if(P&&!Z.optimize)return SG($);let k,y,g=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{k=await b9(Q,{strategy:j,...H}),y=k9(g,k,H)}catch{}let h=W!==void 0&&G!==void 0,m;if(h)m=bG($,g,k,Z);else m=await kG($,g,k,Z);let i;if(F){let F0=U.includes("webp")?"webp":U[0],_0=e$(Q,z,{..._,q:B},F0),$0=typeof q==="object"?$7(q):q||"100vw";i=`<link rel="preload" as="image" imagesrcset="${_0}" imagesizes="${$0}" />`}let c=[];if(!s9&&j!=="none")c.push(X7),s9=!0;if(y)c.push(y);let z0=L?a9(g):void 0;return{html:m,preloadLink:i,css:c.length>0?c.join(`
|
|
865
|
+
`):void 0,script:z0}}async function kG($,Z,Y,J){let{src:Q,alt:X,width:G,height:K,sizes:q,widths:z=o1,formats:W=S5,quality:U=B7,params:B={},lazy:_=!0,priority:j=!1,loading:H=j?"eager":N4,decoding:L=A4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A}=$,N=$.class,R=$.style,T=$.data||{},M=typeof q==="object"?$7(q):q||"100vw",I=[];for(let P of W){let b=e$(Q,z,{...B,q:U},P),k=Z7(P);if(_&&!j)I.push(` <source type="${k}" data-srcset="${b}" data-sizes="${M}" />`);else I.push(` <source type="${k}" srcset="${b}" sizes="${M}" />`)}let D=_7({src:y5(Q,{...B,q:U}),alt:X,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A,className:r9(N,Y),style:j7(R,O,V,Y),lazy:_&&!j,data:T}),E;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
|
|
866
866
|
<picture>
|
|
867
867
|
${I.join(`
|
|
868
868
|
`)}
|
|
@@ -872,9 +872,9 @@ ${I.join(`
|
|
|
872
872
|
${I.join(`
|
|
873
873
|
`)}
|
|
874
874
|
<img ${D} />
|
|
875
|
-
</picture>`;return E}function
|
|
875
|
+
</picture>`;return E}function bG($,Z,Y,J){let{src:Q,alt:X,width:G,height:K,dpr:q=[1,2,3],quality:z=B7,params:W={},lazy:U=!0,priority:B=!1,loading:_=B?"eager":N4,decoding:j=A4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,A=$.style,N=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),T=E9(Q,R,q,{...W,q:z}),M=_7({src:y5(Q,{...W,w:R,q:z}),alt:X,width:G,height:K,loading:B?void 0:_,decoding:j,fetchpriority:B?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:r9(w,Y),style:j7(A,L,F,Y),lazy:U&&!B,data:N}),I=U&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let D=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${D}">
|
|
876
876
|
<img ${M} ${I} />
|
|
877
|
-
</div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function
|
|
877
|
+
</div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function SG($){let{src:Z,alt:Y,width:J,height:Q,loading:X=N4,decoding:G=A4,fetchpriority:K,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U,priority:B=!1}=$,_=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${_7({src:Z,alt:Y,width:J,height:Q,loading:B?"eager":X,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U,className:_,style:j7(j,q,z),id:H,data:L})} />`}}function _7($){let Z=[];if($.lazy)Z.push(`data-src="${p0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${p0($.src)}"`);if(Z.push(`alt="${p0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${p0($.className)}"`);if($.style)Z.push(`style="${p0($.style)}"`);if($.id)Z.push(`id="${p0($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${p0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function r9($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function j7($,Z,Y,J){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(J)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function p0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function a9($){return`
|
|
878
878
|
(function() {
|
|
879
879
|
const container = document.getElementById('${$}');
|
|
880
880
|
if (!container) return;
|
|
@@ -911,7 +911,7 @@ ${I.join(`
|
|
|
911
911
|
|
|
912
912
|
observer.observe(container);
|
|
913
913
|
})();
|
|
914
|
-
`.trim()}async function
|
|
914
|
+
`.trim()}async function yG($,Z){let Y=await EG();if(!Y)return w4({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let X=await Y.generateResponsiveVariants($.src,$,J);if(X)return t9($,X,Z)}else{let X=await Y.processImage($.src,$,J);if(X.processed)return H7($,X,Z)}return w4({...$,process:!1},Z)}async function H7($,Z,Y){let{alt:J,width:Q,height:X,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U}=$,B=$.class,_=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((y)=>y.format==="jpeg")||L.find((y)=>y.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((y)=>y.format===(F?.format||"jpeg")).map((y)=>`${y.url} ${y.width}w`).join(", "),w=new Map;for(let y of L){if(!w.has(y.format))w.set(y.format,[]);w.get(y.format).push(y)}let A=[],N=["avif","webp","jpeg","png"];for(let y of N){let g=w.get(y);if(g&&g.length>0){let h=g.map((i)=>`${i.url} ${i.width}w`).join(", "),m=Z7(y);if(G&&!K)A.push(` <source type="${m}" data-srcset="${h}" />`);else A.push(` <source type="${m}" srcset="${h}" />`)}}let R=[];if(G&&!K){if(R.push(`data-src="${p0(O)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${p0(O)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${p0(J)}"`);let T=Q||Z.originalWidth,M=X||Z.originalHeight;if(T)R.push(`width="${T}"`);if(M)R.push(`height="${M}"`);if(!K)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(W)R.push(`crossorigin="${W}"`);if(U)R.push(`referrerpolicy="${U}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(z)I.push(`object-position: ${z}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)R.push(`style="${I.join("; ")}"`);let D=[];if(B)D.push(B);if(Z.placeholder)D.push("stx-img-blur");if(D.length>0)R.push(`class="${D.join(" ")}"`);if(G&&!K)R.push("data-stx-lazy");for(let[y,g]of Object.entries(H))R.push(`data-${y}="${p0(g)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let y=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${y}">
|
|
915
915
|
<picture>
|
|
916
916
|
${A.join(`
|
|
917
917
|
`)}
|
|
@@ -921,12 +921,12 @@ ${A.join(`
|
|
|
921
921
|
${A.join(`
|
|
922
922
|
`)}
|
|
923
923
|
<img ${R.join(" ")} />
|
|
924
|
-
</picture>`;let P=[];if(Z.placeholder)P.push(
|
|
925
|
-
`):void 0,script:b}}async function
|
|
926
|
-
`+
|
|
927
|
-
<style>${
|
|
928
|
-
<script>${
|
|
929
|
-
`)}async function y4($,Z,Y,J,Q){let X=await
|
|
924
|
+
</picture>`;let P=[];if(Z.placeholder)P.push(X7);let b=G?a9(j):void 0,k;if(K&&V)k=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:k,css:P.length>0?P.join(`
|
|
925
|
+
`):void 0,script:b}}async function t9($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,X]of Object.entries(Z.byFormat))if(X)J.variants.push(...X);return H7($,J,Y)}var o9=!1,B7=80,A4="async",N4="lazy",s9=!1;var e9=S(()=>{Y7();S9()});function CG(){return U4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:Q,alt:X,options:G}=PG($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:X||"",widths:G.widths||o1,formats:G.formats||S5,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,z=await w4(K,{isDev:q}),W=z.html;if(z.preloadLink)W=z.preloadLink+`
|
|
926
|
+
`+W;if(z.css)W+=`
|
|
927
|
+
<style>${z.css}</style>`;if(z.script)W+=`
|
|
928
|
+
<script>${z.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function PG($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=vG(J),X=O7(Q[0],Y)||"",G=O7(Q[1],Y)||"",K={};if(Q[2]){let q=O7(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:X,alt:G,options:K}}function vG($){let Z=[],Y="",J=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],z=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&z!=="\\"){if(!J)J=!0,Q=q;else if(q===Q)J=!1,Q="";else Y+=q;continue}if(!J){if(q==="{")X++;if(q==="}")X--;if(q==="[")G++;if(q==="]")G--;if(q===","&&X===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function O7($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var $8;var Z8=S(()=>{t$();e9();Y7();$8=CG()});class T4{config;constructor($={}){this.config={...xG,...$}}async get($,Z){return _4($,Z,"video",this.config)}async set($,Z,Y){return j4($,Z,Y,"video",this.config)}async clear(){return H4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function L7($){if(!R4)R4=new T4($);else if($)R4.updateConfig($);return R4}async function M4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return L7(J).get($,Z)}async function I4($,Z,Y,J){let Q=J?{directory:`${J.outputDir}/../.cache`}:{};return L7(Q).set($,Z,Y)}async function Y8(){return L7().clear()}var xG,R4=null;var F7=S(()=>{K7();xG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as V7,basename as w7,extname as A7,join as D4}from"path";import{mkdir as N7}from"fs/promises";async function R7(){try{return await import("ts-videos")}catch{return null}}async function E4($,Z,Y,J){let Q=await R7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=V7($);if(!await M0(X))return null;await N7(Y,{recursive:!0});let G=await D0(X),K=w7($,A7($)),q=Z.format||"webp",z=Z.timestamp||0,W=`${K}-poster-${G}.${q}`,U=D4(Y,W),B=await Q.extractThumbnails(X,{timestamps:[z],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:W.replace(`.${q}`,"")});if(B&&B.length>0){let _=B[0];return{path:U,url:`${J}/${W}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:z,size:_.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function k4($,Z,Y,J){let Q=await R7();if(!Q)return[];try{let X=V7($);if(!await M0(X))return[];await N7(Y,{recursive:!0});let G=await D0(X),K=w7($,A7($)),q=Z.format||"webp",U=(await new Q.Input(X).getInfo()).duration||60,B=Z.count||10,_=Z.interval||U/B,j=[];for(let L=0;L<B&&L*_<U;L++)j.push(L*_);let H=await Q.extractThumbnails(X,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||D4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${J}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(X){return console.warn(`[stx-media] Failed to generate thumbnails: ${X}`),[]}}async function J8($,Z,Y,J){let Q=await R7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=V7($);if(!await M0(X))return null;await N7(Y,{recursive:!0});let G=await D0(X),K=w7($,A7($)),W=(await new Q.Input(X).getInfo()).duration||60,U=Z.columns||10,B=Z.interval||5,_=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(W/B),F=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,V=D4(Y,O),w=[];for(let N=0;N<L;N++)w.push(N*B);let A=await Q.extractThumbnails(X,{timestamps:w,width:_,height:j,format:H,quality:Z.quality||70,outputDir:D4(Y,".temp")});if(!A||A.length===0)return null;try{let N=await import("ts-images"),R=U*_,T=F*j,M=await N.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:V,columns:U,rows:F,thumbnailWidth:_,thumbnailHeight:j,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(X){return console.warn(`[stx-media] Failed to generate sprite sheet: ${X}`),null}}var T7=S(()=>{D1()});import{resolve as Q8,basename as G8,extname as K8,join as E1}from"path";import{mkdir as b4,writeFile as q8}from"fs/promises";async function z8(){try{return await import("ts-videos")}catch{return null}}async function S4($,Z,Y,J,Q){let X=await z8();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=Q8($);if(!await M0(G))return null;let K=await D0(G),q=G8($,K8($)),z=E1(Y,`${q}-${K}-hls`);await b4(z,{recursive:!0});let W=Z.length>0?Z:W8,U=Q?.segmentDuration||6,j=(await new X.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of W){let w=E1(z,V.label);await b4(w,{recursive:!0});let A=`${V.label}.m3u8`,N=E1(w,A);try{let R=await X.generateHLS(G,{outputDir:w,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)H.push({quality:V,url:`${J}/${q}-${K}-hls/${V.label}/${A}`,path:N}),L+=R.segmentCount||Math.ceil(j/U)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(H.length===0)return null;let F=E1(z,"master.m3u8"),O=fG(H,J,q,K);return await q8(F,O),{manifestUrl:`${J}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function fG($,Z,Y,J){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let X of $){let{quality:G}=X,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
|
|
929
|
+
`)}async function y4($,Z,Y,J,Q){let X=await z8();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=Q8($);if(!await M0(G))return null;let K=await D0(G),q=G8($,K8($)),z=E1(Y,`${q}-${K}-dash`);await b4(z,{recursive:!0});let W=Z.length>0?Z:W8,U=Q?.segmentDuration||4,B=Q?.minBufferTime||2,H=(await new X.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of W){let N=E1(z,A.label);await b4(N,{recursive:!0});try{if(await X.generateDASH(G,{outputDir:N,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${q}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${J}/${q}-${K}-dash/${A.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${R}`)}}if(L.length===0)return null;let O=E1(z,"manifest.mpd"),V=gG(L,F,H,U,B);await q8(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${J}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function gG($,Z,Y,J,Q){let X=X8(Y),G=X8(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
|
|
930
930
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
931
931
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
932
932
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -936,23 +936,23 @@ ${A.join(`
|
|
|
936
936
|
profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
|
|
937
937
|
<Period>
|
|
938
938
|
<AdaptationSet mimeType="video/mp4" codecs="avc1.64001f" segmentAlignment="true" startWithSAP="1">
|
|
939
|
-
`;for(let q=0;q<$.length;q++){let
|
|
940
|
-
<BaseURL>${
|
|
939
|
+
`;for(let q=0;q<$.length;q++){let z=$[q];K+=` <Representation id="video${q}" bandwidth="${z.bandwidth}" width="${z.width}" height="${z.height}">
|
|
940
|
+
<BaseURL>${z.url}/</BaseURL>
|
|
941
941
|
<SegmentBase indexRange="0-999">
|
|
942
942
|
<Initialization range="0-999"/>
|
|
943
943
|
</SegmentBase>
|
|
944
944
|
</Representation>
|
|
945
945
|
`}if(K+=` </AdaptationSet>
|
|
946
946
|
`,Z.length>0){K+=` <AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.2" segmentAlignment="true" startWithSAP="1">
|
|
947
|
-
`;for(let q=0;q<Z.length;q++){let
|
|
948
|
-
<BaseURL>${
|
|
947
|
+
`;for(let q=0;q<Z.length;q++){let z=Z[q];K+=` <Representation id="audio${q}" bandwidth="${z.bandwidth}">
|
|
948
|
+
<BaseURL>${z.url}/</BaseURL>
|
|
949
949
|
<SegmentBase indexRange="0-999">
|
|
950
950
|
<Initialization range="0-999"/>
|
|
951
951
|
</SegmentBase>
|
|
952
952
|
</Representation>
|
|
953
953
|
`}K+=` </AdaptationSet>
|
|
954
954
|
`}return K+=` </Period>
|
|
955
|
-
</MPD>`,K}function
|
|
955
|
+
</MPD>`,K}function X8($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${J}S`,Q}var W8;var M7=S(()=>{D1();W8=[{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},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as U8,basename as hG,extname as dG,join as mG}from"path";import{mkdir as uG}from"fs/promises";async function B8(){try{return await import("ts-videos")}catch{return null}}function pG($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function cG($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function I7($){let Z=await B8();if(!Z)return null;try{let Y=U8($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function _8($,Z,Y,J){let Q=await B8();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let X=await M4($,Z,Y);if(X)return X;try{let G=U8($);if(!await M0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await uG(K,{recursive:!0});let z=await D0(G),W=hG($,dG($)),U={src:$,processed:!0,hash:z};J?.({percentage:5,stage:"analyzing"}),U.metadata=await I7(G)||void 0;let B={};if(Z.quality)B.bitrate=pG(Z.quality);if(Z.platform)Object.assign(B,cG(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let _=`${W}-${z}.mp4`,j=mG(K,_);try{let H=await lG(G,j,B,Q,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:j,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await E4(G,_,K,q);if(j)U.poster=j}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let _=await k4(G,Y.thumbnails,K,q);if(_.length>0)U.thumbnails=_}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let j=await S4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,hls:j}}if(_.format==="dash"){let j=await y4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,dash:j}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await I4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function lG($,Z,Y,J,Q){try{let G=await new J.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(X){return console.error(`[stx-media] Transcoding failed: ${X}`),null}}var j8=S(()=>{D1();F7();T7();M7()});var H8={};r(H8,{setCachedVideoResult:()=>I4,processVideo:()=>_8,getCachedVideoResult:()=>M4,generateThumbnails:()=>k4,generateSpriteSheet:()=>J8,generatePoster:()=>E4,generateHLSManifest:()=>S4,generateDASHManifest:()=>y4,clearVideoCache:()=>Y8,analyzeVideo:()=>I7,VideoProcessorCache:()=>T4});var O8=S(()=>{j8();T7();M7();F7()});async function F8(){try{return await Promise.resolve().then(() => (O8(),H8))}catch($){if(!L8)console.warn("[stx-media] Video processor not available, some features disabled:",$),L8=!0;return null}}async function C4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return aG(J,Y)}if(Y.processedResult?.processed)return N8($,Y.processedResult,Z);let Q;if(J.generatePoster&&J.src&&!$.poster)Q=await tG(J,Y);let{src:X,sources:G=[],poster:K,posterPlaceholder:q,controls:z=V8,autoplay:W=!1,muted:U=!1,loop:B=!1,preload:_=w8,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:N=!1}=$,R=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return oG($,Z);if(F&&F!=="video")return nG(X||"",F,$);let D=G.length>0?G:X?[{src:X,type:A8(X)}]:[],E=[`id="${I}"`];if(z)E.push("controls");if(W)E.push("autoplay");if(U)E.push("muted");if(B)E.push("loop");if(j)E.push("playsinline");if(A)E.push("disablepictureinpicture");if(N)E.push("disableremoteplayback");if(w)E.push(`crossorigin="${w}"`);if(H){if(E.push(`data-preload="${_}"`),E.push('preload="none"'),R)E.push(`data-poster="${V0(R)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${_}"`),R)E.push(`poster="${V0(R)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(T)E.push(`class="${V0(T)}"`);if(M)E.push(`style="${V0(M)}"`);let P=D.map((y)=>{return` <source ${H?`data-src="${V0(y.src)}"`:`src="${V0(y.src)}"`} type="${y.type}"${y.media?` media="${y.media}"`:""} />`}).join(`
|
|
956
956
|
`),b=`<video ${E.join(" ")}>
|
|
957
957
|
${P}
|
|
958
958
|
Your browser does not support the video tag.
|
|
@@ -991,9 +991,9 @@ ${P}
|
|
|
991
991
|
|
|
992
992
|
observer.observe(video);
|
|
993
993
|
})();
|
|
994
|
-
`.trim();return{html:b,script:k}}function
|
|
995
|
-
<iframe ${
|
|
996
|
-
</div>`}}function
|
|
994
|
+
`.trim();return{html:b,script:k}}function nG($,Z,Y){let{width:J=640,height:Q=360}=Y,X=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,z=null;switch(Z){case"youtube":z=sG($),q=z?`https://www.youtube-nocookie.com/embed/${z}`:$;break;case"vimeo":z=rG($),q=z?`https://player.vimeo.com/video/${z}`:$;break;case"dailymotion":z=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${z}`;break;case"twitch":z=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${z}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let W=[`id="${K}"`,`src="${V0(q)}"`,`width="${J}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(X)W.push(`class="${V0(X)}"`);if(G)W.push(`style="${V0(G)}"`);if(Y.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
995
|
+
<iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
996
|
+
</div>`}}function oG($,Z={}){let{src:Y,sources:J=[],poster:Q,controls:X=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:z="metadata",playsinline:W=!0,lazy:U=!0,width:B,height:_}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:J.length>0?J:Y,autoplay:G,loop:q,muted:K,playsinline:W,preload:z,poster:Q,controls:X,title:$.title},O=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
|
|
997
997
|
<div
|
|
998
998
|
id="${L}"
|
|
999
999
|
class="ts-video-player${j?" "+V0(j):""}"
|
|
@@ -1030,7 +1030,7 @@ ${P}
|
|
|
1030
1030
|
|
|
1031
1031
|
// Load ts-video-player from CDN
|
|
1032
1032
|
var script = document.createElement('script');
|
|
1033
|
-
script.src = '${
|
|
1033
|
+
script.src = '${iG}';
|
|
1034
1034
|
script.onload = initPlayer;
|
|
1035
1035
|
script.onerror = function() {
|
|
1036
1036
|
console.error('[stx] Failed to load ts-video-player');
|
|
@@ -1160,12 +1160,12 @@ else {
|
|
|
1160
1160
|
.ts-video-player__play-button svg {
|
|
1161
1161
|
margin-left: 4px;
|
|
1162
1162
|
}
|
|
1163
|
-
`.trim();return{html:V,script:w,css:A}}function
|
|
1163
|
+
`.trim();return{html:V,script:w,css:A}}function A8($){switch($.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 sG($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let J=$.match(Y);if(J)return J[1]}return null}function rG($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function V0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function aG($,Z){let Y=await F8();if(!Y)return C4({...$,process:!1},Z);let J=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,J,$.onProcessProgress);if(Q.processed)return N8($,Q,Z);return C4({...$,process:!1},Z)}async function tG($,Z){let Y=await F8();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,Q.outputDir,Q.baseUrl||"/videos"))?.url}function N8($,Z,Y){let{controls:J=V8,autoplay:Q=!1,muted:X=!1,loop:G=!1,preload:K=w8,playsinline:q=!0,lazy:z=!0,width:W,height:U,crossorigin:B,disablePictureInPicture:_=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=A8(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,N=[`id="${F}"`];if(J)N.push("controls");if(Q)N.push("autoplay");if(X)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(_)N.push("disablepictureinpicture");if(j)N.push("disableremoteplayback");if(B)N.push(`crossorigin="${B}"`);if(z){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),A)N.push(`data-poster="${V0(A)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),A)N.push(`poster="${V0(A)}"`);let R=W||Z.metadata?.width,T=U||Z.metadata?.height;if(R)N.push(`width="${R}"`);if(T)N.push(`height="${T}"`);if(H)N.push(`class="${V0(H)}"`);if(L)N.push(`style="${V0(L)}"`);let I=` <source ${z?`data-src="${V0(O)}"`:`src="${V0(O)}"`} type="${V}" />`,D=`<video ${N.join(" ")}>
|
|
1164
1164
|
${I}
|
|
1165
1165
|
Your browser does not support the video tag.
|
|
1166
1166
|
</video>`;if(Z.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${V0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
|
|
1167
1167
|
${D}
|
|
1168
|
-
</div>`;let E;if(
|
|
1168
|
+
</div>`;let E;if(z)E=`
|
|
1169
1169
|
(function() {
|
|
1170
1170
|
var video = document.getElementById('${F}');
|
|
1171
1171
|
if (!video) return;
|
|
@@ -1209,9 +1209,9 @@ ${D}
|
|
|
1209
1209
|
width: 100%;
|
|
1210
1210
|
height: auto;
|
|
1211
1211
|
}
|
|
1212
|
-
`.trim();return{html:D,script:E,css:P}}var
|
|
1213
|
-
<style>${
|
|
1214
|
-
<script>${
|
|
1212
|
+
`.trim();return{html:D,script:E,css:P}}var L8=!1,V8=!0,w8="metadata",iG="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var R8=S(()=>{E7()});function T8(){return U4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:Q,options:X}=eG($,Z,Y);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:X.poster,controls:X.controls!==!1,autoplay:X.autoplay||!1,muted:X.muted||!1,loop:X.loop||!1,preload:X.preload||"metadata",playsinline:X.playsinline!==!1,lazy:X.lazy!==!1,player:X.player||"native",type:X.type,width:X.width,height:X.height,class:X.class,style:X.style,id:X.id,crossorigin:X.crossorigin,disablePictureInPicture:X.disablePictureInPicture,disableRemotePlayback:X.disableRemotePlayback,title:X.title,quality:X.quality,platform:X.platform,process:X.process,generatePoster:X.generatePoster,streaming:X.streaming,transcode:X.transcode,spriteSheet:X.spriteSheet,waveform:X.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},z=await C4(G,q),W=z.html;if(z.css)W+=`
|
|
1213
|
+
<style>${z.css}</style>`;if(z.script)W+=`
|
|
1214
|
+
<script>${z.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function eG($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=$K(J),X=M8(Q[0],Y)||"",G={};if(Q[1]){let K=M8(Q[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:X,options:G}}function $K($){let Z=[],Y="",J=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],z=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&z!=="\\"){if(!J)J=!0,Q=q;else if(q===Q)J=!1,Q="";else Y+=q;continue}if(!J){if(q==="{")X++;if(q==="}")X--;if(q==="[")G++;if(q==="]")G--;if(q===","&&X===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function M8($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var D7;var E7=S(()=>{t$();R8();D7=T8()});function ZK($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
|
|
1215
1215
|
${$}
|
|
1216
1216
|
</div>
|
|
1217
1217
|
<script>
|
|
@@ -1256,7 +1256,7 @@ ${D}
|
|
|
1256
1256
|
}
|
|
1257
1257
|
}
|
|
1258
1258
|
})();
|
|
1259
|
-
</script>`}function
|
|
1259
|
+
</script>`}function YK($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,X=$.trim().length>0,G=`
|
|
1260
1260
|
<div class="stx-pwa-update-banner" style="
|
|
1261
1261
|
position: fixed;
|
|
1262
1262
|
bottom: 0;
|
|
@@ -1367,7 +1367,7 @@ else {
|
|
|
1367
1367
|
// Also listen for custom event
|
|
1368
1368
|
window.addEventListener('pwa-update-available', showUpdate);
|
|
1369
1369
|
})();
|
|
1370
|
-
</script>`}function
|
|
1370
|
+
</script>`}function JK($,Z){let Y=$.trim().length>0,J=`
|
|
1371
1371
|
<div class="stx-offline-indicator" style="
|
|
1372
1372
|
position: fixed;
|
|
1373
1373
|
top: 16px;
|
|
@@ -1428,7 +1428,7 @@ else {
|
|
|
1428
1428
|
window.addEventListener('offline', updateStatus);
|
|
1429
1429
|
updateStatus();
|
|
1430
1430
|
})();
|
|
1431
|
-
</script>`}function
|
|
1431
|
+
</script>`}function XK($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
|
|
1432
1432
|
${$}
|
|
1433
1433
|
</div>
|
|
1434
1434
|
<script>
|
|
@@ -1510,33 +1510,33 @@ catch (error) {
|
|
|
1510
1510
|
init();
|
|
1511
1511
|
}
|
|
1512
1512
|
})();
|
|
1513
|
-
</script>`}var
|
|
1514
|
-
${$.message}`),Z&&$.line){let X=
|
|
1513
|
+
</script>`}var QK,GK,KK,qK,I8;var D8=S(()=>{QK={name:"pwa.installButton",handler:($,Z,Y,J)=>{let Q=Y.__stx_options||{};return ZK($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},GK={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let Q=Y.__stx_options||{};return YK($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},KK={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let Q=Y.__stx_options||{};return JK($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},qK={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let Q=Y.__stx_options||{};return XK($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},I8=[QK,GK,KK,qK]});function k7($){for(let[Z,Y]of Object.entries(s))if(Y===$)return Z;return}var s;var P4=S(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function C5(){return!1}function P5(){return!C5()||process.env.STX_DEBUG==="true"}function v4(){return!1}import zK from"path";function x4(){return{...b7}}function f4($){if(!b7.showRelativePaths||!$)return $;let Z=b7.baseDir||process.cwd();try{let Y=zK.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var WK,b7,g4,k1,h4;var d4=S(()=>{P4();WK={showRelativePaths:!1,enableAutoRecovery:P5(),logRecoveryWarnings:!0},b7={...WK};g4=class g4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,Q,X,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=Q;this.context=X;if(this.name="StxError",this.numericCode=G||s.EVALUATION_ERROR,this.filePath)this.filePath=f4(this.filePath)}};k1=class k1 extends g4{constructor($,Z,Y,J,Q,X){super($,"stx_RUNTIME_ERROR",Z,Y,J,Q,X||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};h4=class h4 extends g4{isFatal=!0;constructor($,Z,Y,J,Q,X){super($,"stx_VALIDATION_ERROR",Z,Y,J,Q,X||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function k8($){let{type:Z,message:Y,code:J,filePath:Q,line:X,column:G,template:K,offset:q,snippet:z,suggestion:W,format:U="text"}=$,B=X,_=G;if(!B&&K&&q!==void 0){let O=OK(K,q);B=O.line,_=O.column}let j=Q?f4(Q):void 0,H=J?k7(J):void 0,L={type:Z,code:J,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:z,suggestion:W,timestamp:new Date().toISOString()},F;switch(U){case"html":F=BK(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=_K(L,K,q);break;case"text":default:F=UK(L,K,q);break}return{formatted:F,data:L}}function UK($,Z,Y){let J=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${Q}]`),$.filePath){let X=$.filePath;if($.line){if(X+=`:${$.line}`,$.column)X+=`:${$.column}`}J.push(`at ${X}`)}if(J.push(`
|
|
1514
|
+
${$.message}`),Z&&$.line){let X=jK(Z,$.line,2);if(X)J.push(`
|
|
1515
1515
|
${X}`)}if($.snippet)J.push(`
|
|
1516
1516
|
Snippet: ${$.snippet}`);if($.suggestion)J.push(`
|
|
1517
|
-
Suggestion: ${$.suggestion}`);return J.join(" ")}function
|
|
1518
|
-
\x1B[90mat\x1B[0m ${U}`)}if(
|
|
1517
|
+
Suggestion: ${$.suggestion}`);return J.join(" ")}function BK($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${E8($.message)}`;if($.suggestion)J+=` | Suggestion: ${E8($.suggestion)}`;return J+=" -->",J}function _K($,Z,Y){let z=[],W=$.code?` [${$.codeName||$.code}]`:"";if(z.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${W} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let U=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(U+=`\x1B[90m:${$.line}\x1B[0m`,$.column)U+=`\x1B[90m:${$.column}\x1B[0m`}z.push(`
|
|
1518
|
+
\x1B[90mat\x1B[0m ${U}`)}if(z.push(`
|
|
1519
1519
|
|
|
1520
|
-
${$.message}`),Z&&$.line){let U=
|
|
1520
|
+
${$.message}`),Z&&$.line){let U=HK(Z,$.line,2);if(U)z.push(`
|
|
1521
1521
|
|
|
1522
1522
|
\x1B[90mContext:\x1B[0m
|
|
1523
|
-
${U}`)}if($.suggestion)
|
|
1524
|
-
|
|
1525
|
-
\x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return
|
|
1526
|
-
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),
|
|
1527
|
-
`),Q=Math.max(0,Z-Y-1),X=Math.min(J.length-1,Z+Y-1),G=[];for(let K=Q;K<=X;K++){let q=(K+1).toString().padStart(4),
|
|
1528
|
-
`)}function
|
|
1529
|
-
`),Q=Math.max(0,Z-Y-1),X=Math.min(J.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",
|
|
1530
|
-
`)}function
|
|
1531
|
-
`);return{line:J.length,column:J[J.length-1].length}}function e($,Z,Y){return
|
|
1523
|
+
${U}`)}if($.suggestion)z.push(`
|
|
1524
|
+
|
|
1525
|
+
\x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return z.push(`
|
|
1526
|
+
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),z.join("")}function jK($,Z,Y){let J=$.split(`
|
|
1527
|
+
`),Q=Math.max(0,Z-Y-1),X=Math.min(J.length-1,Z+Y-1),G=[];for(let K=Q;K<=X;K++){let q=(K+1).toString().padStart(4),z=K===Z-1?">":" ";G.push(`${z}${q} | ${J[K]}`)}return G.join(`
|
|
1528
|
+
`)}function HK($,Z,Y){let J=$.split(`
|
|
1529
|
+
`),Q=Math.max(0,Z-Y-1),X=Math.min(J.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let W=Q;W<=X;W++){let U=(W+1).toString().padStart(4),B=W===Z-1,_=B?"\x1B[31m>\x1B[0m":" ",j=B?`\x1B[31m${J[W]}\x1B[0m`:`\x1B[90m${J[W]}\x1B[0m`;z.push(`${_}\x1B[90m${U}\x1B[0m | ${j}`)}return z.join(`
|
|
1530
|
+
`)}function E8($){return $.replace(/--/g,"- -").replace(/>/g,">")}function OK($,Z){let J=$.substring(0,Z).split(`
|
|
1531
|
+
`);return{line:J.length,column:J[J.length-1].length}}function e($,Z,Y){return k8({type:$,message:Z,code:Y,format:"html"}).formatted}async function r1($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var b8=S(()=>{P4();d4()});class y7{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let J={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
|
|
1532
1532
|
`).slice(1).join(`
|
|
1533
1533
|
`)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
|
|
1534
1534
|
`)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),J=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});await this.rotateIfNeeded(Z);let Q=`${this.formatEntry($)}
|
|
1535
1535
|
`;Z.appendFileSync(this.logFilePath,Q,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let J=`${this.logFilePath}.${Y}`,Q=`${this.logFilePath}.${Y+1}`;if($.existsSync(J))if(Y>=this.maxLogFiles-1)$.unlinkSync(J);else $.renameSync(J,Q)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let J=Y.error.constructor.name;$[J]=($[J]||0)+1;let Q=Y.level||"error";Z[Q]=(Z[Q]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),Q=(await import("path")).dirname($);if(!Y.existsSync(Q))Y.mkdirSync(Q,{recursive:!0});if(Z==="json"){let X=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Y.writeFileSync($,JSON.stringify(X,null,2),"utf-8")}else{let X=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,X.join(`
|
|
1536
1536
|
|
|
1537
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var
|
|
1538
|
-
@end${K}`;J.push(`Added ${
|
|
1539
|
-
`)}}});var
|
|
1537
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var S7,c0,C7;var S8=S(()=>{d4();S7={isEnabled(){return x4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=x4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],Q=(Y.match(/\{\{/g)||[]).length,X=(Y.match(/\}\}/g)||[]).length;if(Q>X){let K=Q-X;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,z=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>z){let W=q-z;for(let U=0;U<W;U++)Y+=`
|
|
1538
|
+
@end${K}`;J.push(`Added ${W} missing @end${K}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent($,Z){if(P5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};c0=new y7,C7={isDevelopment(){return P5()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
|
|
1539
|
+
`)}}});var y8=()=>{};var C8=S(()=>{P4();b8();S8();y8();d4()});var Y1=S(()=>{C8()});function P8($,Z,Y,J){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,z)=>{if(!z&&q.includes(":")){let W=q.split(":"),U=q,B=W.length>1?W[1]:"";if(B&&Z[B])z=Z[B];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[W[1]])z=Z.openGraph[W[1]];else z="";return z?`<meta property="${l(U)}" content="${l(z)}">`:""}return z?`<meta name="${l(q)}" content="${l(z)}">`:""});let X=/@metaTag\s*\(/g,G;while((G=X.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,z=1,W=q+1;while(W<Q.length&&z>0){if(Q[W]==="(")z++;else if(Q[W]===")"){if(z--,z===0)break}W++}if(z!==0)break;let U=Q.substring(q+1,W).trim(),B=W+1,_=(()=>{try{let j=N0(U,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${l(String(j.name))}"`;if(j.property)H+=` property="${l(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${l(String(j.httpEquiv))}"`;if(j.content)H+=` content="${l(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return e("MetaTag",H,s.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+_+Q.substring(B),X.lastIndex=0}return Q}function v8($,Z,Y){let J=$,Q=/@structuredData\s*\(/g,X;while((X=Q.exec(J))!==null){let G=X.index,K=G+X[0].length-1,q=1,z=K+1;while(z<J.length&&q>0){if(J[z]==="(")q++;else if(J[z]===")"){if(q--,q===0)break}z++}if(q!==0)break;let W=J.substring(K+1,z).trim(),U=z+1,B=(()=>{try{let _=N0(W,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let j=_ instanceof Error?_.message:String(_);return e("StructuredData",j,s.EVALUATION_ERROR)}})();J=J.substring(0,G)+B+J.substring(U),Q.lastIndex=0}return J}function x8($,Z,Y,J){let Q=$,X=/@seo\s*\(\s*\{/g,G;while((G=X.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,z=K+1,W=null,U=!1;while(z<Q.length&&q>0){let F=Q[z];if(U){U=!1,z++;continue}if(F==="\\"&&W){U=!0,z++;continue}if(W){if(F===W)W=null;z++;continue}if(F==='"'||F==="'"||F==="`"){W=F,z++;continue}if(F==="{")q++;else if(F==="}")q--;z++}if(q!==0)break;let B=Q.substring(z).match(/^\s*\)/);if(!B)break;let _=z+B[0].length,j=Q.substring(K,z),H=Q.substring(G.index,_),L=((F)=>{try{let O=N0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${l(O.title)}</title>
|
|
1540
1540
|
`,V+=`<meta name="title" content="${l(O.title)}">
|
|
1541
1541
|
`;if(O.description)V+=`<meta name="description" content="${l(O.description)}">
|
|
1542
1542
|
`;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${l(w)}">
|
|
@@ -1558,7 +1558,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
1558
1558
|
`}if(w.site)V+=`<meta name="twitter:site" content="${l(w.site)}">
|
|
1559
1559
|
`;if(w.creator)V+=`<meta name="twitter:creator" content="${l(w.creator)}">
|
|
1560
1560
|
`}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
|
|
1561
|
-
`}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return e("SEO",`Error processing @seo directive: ${V}`,s.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(
|
|
1561
|
+
`}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return e("SEO",`Error processing @seo directive: ${V}`,s.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(_),X.lastIndex=G.index+L.length}return Q}function f8($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let z=`
|
|
1562
1562
|
<!-- stx SEO Tags -->
|
|
1563
1563
|
<meta name="title" content="${l(G)}">
|
|
1564
1564
|
<meta name="description" content="${l(K)}">
|
|
@@ -1568,13 +1568,13 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
1568
1568
|
<meta name="twitter:card" content="summary_large_image">
|
|
1569
1569
|
<meta name="twitter:title" content="${l(G)}">
|
|
1570
1570
|
<meta name="twitter:description" content="${l(K)}">
|
|
1571
|
-
`;if(q)
|
|
1571
|
+
`;if(q)z+=`
|
|
1572
1572
|
<meta property="og:image" content="${l(q)}">
|
|
1573
1573
|
<meta name="twitter:image" content="${l(q)}">
|
|
1574
|
-
`;let
|
|
1575
|
-
<title>${l(G)}</title>`);return
|
|
1576
|
-
${
|
|
1577
|
-
`)}function l($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var
|
|
1574
|
+
`;let W=$;if(!X)W=W.replace(/<head[^>]*>/,`$&
|
|
1575
|
+
<title>${l(G)}</title>`);return W.replace(/<head[^>]*>/,`$&
|
|
1576
|
+
${z}
|
|
1577
|
+
`)}function l($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var g8,h8;var P7=S(()=>{Y1();R0();g8={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return e("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(Q)}" content="${l(X)}">`},hasEndTag:!1},h8={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return e("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return e("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let X=Q instanceof Error?Q.message:String(Q);return e("StructuredData",X,s.EVALUATION_ERROR)}},hasEndTag:!0}});import v5 from"path";function LK($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",Q=Z,X=[],G=!0;if(J){let U=J.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let B=U[1],_=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)Q=_[1];let j=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)X=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=B.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",z=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=z?z[1].trim():"";return{tag:Q,props:X,template:q,styles:W,script:J,shadowDOM:G}}function FK($){let{tag:Z,props:Y,template:J,styles:Q,shadowDOM:X}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),z=Y.map((U)=>`'${U}'`).join(", "),W=Y.map((U)=>`
|
|
1578
1578
|
get ${U}() {
|
|
1579
1579
|
return this.getAttribute('${U}') || '';
|
|
1580
1580
|
}
|
|
@@ -1598,7 +1598,7 @@ class ${G} extends HTMLElement {
|
|
|
1598
1598
|
}
|
|
1599
1599
|
|
|
1600
1600
|
static get observedAttributes() {
|
|
1601
|
-
return [${
|
|
1601
|
+
return [${z}];
|
|
1602
1602
|
}
|
|
1603
1603
|
|
|
1604
1604
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
@@ -1606,7 +1606,7 @@ class ${G} extends HTMLElement {
|
|
|
1606
1606
|
this._render();
|
|
1607
1607
|
}
|
|
1608
1608
|
}
|
|
1609
|
-
${
|
|
1609
|
+
${W}
|
|
1610
1610
|
|
|
1611
1611
|
_render() {
|
|
1612
1612
|
const template = \`${q?`<style>${q}</style>`:""}${K}\`;
|
|
@@ -1625,16 +1625,16 @@ ${z}
|
|
|
1625
1625
|
}
|
|
1626
1626
|
|
|
1627
1627
|
customElements.define('${Z}', ${G});
|
|
1628
|
-
`}async function
|
|
1629
|
-
${
|
|
1630
|
-
</script>`}var d8=S(()=>{Z1();A0()});var m8={};r(m8,{timingPlugin:()=>VK,pluginManager:()=>HK,definePlugin:()=>m4,debugPlugin:()=>FK,createVariablesPlugin:()=>wK,createFilterPlugin:()=>LK,createDirectivePlugin:()=>OK,PluginManager:()=>P7});function m4($){return $}class P7{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let X=await Q(Y);if(X){if(X.template!==void 0)Y.template=X.template;if(X.context)Y.context={...Y.context,...X.context};if(X.metadata)Y.metadata={...Y.metadata,...X.metadata};if(X.skip)break}}catch(X){console.error(`Error in plugin "${J.name}" ${$} hook:`,X)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let Q of this.sortedPlugins){let X=Q[$];if(X)try{let G=await X(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return J}}function OK($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function LK($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function wK($){return m4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var HK,FK,VK;var u8=S(()=>{HK=new P7;FK=m4({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),VK=m4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var c8={};r(c8,{validateConfig:()=>MK,loadStxConfig:()=>S1,defineStxConfig:()=>TK,defaultConfig:()=>b1,config:()=>x7});import v7 from"fs";import D0 from"path";import{loadConfigWithResult as AK}from"bunfig";function NK($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=D0.join(process.cwd(),"resources","views"),Q=D0.join(process.cwd(),"resources","layouts");if(v7.existsSync(J)&&v7.existsSync(Q))return{root:"resources",pagesDir:"views"};let X=D0.join(process.cwd(),"resources","views","pages");if(v7.existsSync(X))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function RK($){if(O6($.stateDir),$.stateDir=B5(),$.cachePath=j5($.cachePath),$.build)$.build.cacheDir=j5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=j5($.media.cache.directory);if($.story)$.story.outDir=j5($.story.outDir)}async function S1($){if(!$){if(a1)return a1;if(u4)return u4}let Z=$?D0.resolve($):process.cwd(),Y=p8.get(Z);if(Y)return Y;let J=(async()=>{let X=(await AK({name:"stx",alias:"ui",cwd:Z,defaultConfig:b1,verbose:!1})).config;RK(X);let G=NK(X.root,X.pagesDir);if(X.root=G.root,X.pagesDir=G.pagesDir,X.root&&X.root!=="."){let K=X.root;if(X.partialsDir&&!D0.isAbsolute(X.partialsDir))X.partialsDir=D0.join(K,X.partialsDir);if(X.componentsDir&&!D0.isAbsolute(X.componentsDir))X.componentsDir=D0.join(K,X.componentsDir);if(X.layoutsDir&&!D0.isAbsolute(X.layoutsDir))X.layoutsDir=D0.join(K,X.layoutsDir)}if(X.plugins&&X.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (u8(),m8)),q=[],W=[];for(let z of X.plugins){let U=typeof z==="string"?z:z[0],_=typeof z==="string"?{}:z[1]||{};try{let B,j;try{B=await import(U),j=D0.dirname(z0.resolve(U))}catch{let L=D0.resolve(process.cwd(),U);B=await import(L),j=D0.dirname(L)}let H=B.default||B;if(K.register(H,X),H.components){let L=D0.resolve(j,H.components);q.push(L)}if(H.pages){let L=D0.resolve(j,H.pages),F=_.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{X.customDirectives=X.customDirectives||[],X.customDirectives.push(F)},addRoute:(F,O)=>{X.apiRoutes=X.apiRoutes||{},X.apiRoutes[F]=O},addMiddleware:(F)=>{X.middleware=X.middleware||[],X.middleware.push(F)},pluginDir:j,config:X};await H.setup(_,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(B){console.warn(`[stx] Failed to load plugin ${U}:`,B.message)}}X._pluginComponentDirs=q,X._pluginPageDirs=W}return X})();if(p8.set(Z,J),!$)u4=J,J.then((Q)=>{a1=Q}).catch(()=>{});return J}function TK($){return $}function MK($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Q)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Q)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,X)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${X}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Q.strategy))Z.push({path:`pwa.routes[${X}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${X}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${X}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((X)=>!J.includes(X)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var b1,a1=null,p8,u4=null,x7;var t1=S(()=>{S$();y$();C$();P$();r$();$8();D7();I8();C7();H5();d8();b1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:m1,cachePath:".stx/cache",cacheVersion:"1.0.0",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:I9,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:h8,hasEndTag:!1,description:"Include a web component in the template"},V6,w6,f8,g8,A6,R6,T6,N6,E6,S6,e9,I7,...M8],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:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!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}};p8=new Map;x7=new Proxy(b1,{get($,Z){if(a1&&Z in a1)return a1[Z];if(!u4)S1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var s8={};r(s8,{resetCssCache:()=>SK,resetCrosswindCache:()=>yK,rebuildCrosswindCSS:()=>CK,loadCrosswindConfig:()=>m7,loadCrosswind:()=>d7,injectCrosswindCSS:()=>v5,getCachedCSS:()=>PK,generateCrosswindCSS:()=>o8,extractClassNames:()=>n8,buildCrosswindCSS:()=>i8});import Y0 from"path";import{hasLocalConfig as IK}from"bunfig/discovery";function h7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function f7($,Z){if(Y1.has($))Y1.delete($);else if(Y1.size>=DK)Y1.delete(Y1.keys().next().value);Y1.set($,Z)}async function EK($){if(!q1)return null;try{let Z=Bun.file(Y0.join(q1,`cw-${h7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function kK($,Z){if(!q1)return;try{if(!fs.existsSync(q1))fs.mkdirSync(q1,{recursive:!0});await Bun.write(Y0.join(q1,`cw-${h7($)}.css`),Z)}catch{}}async function l8($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function bK(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==Y0.dirname(Y))$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Y0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=Y0.dirname(Y);if(Z){let J=[Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...J)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function d7(){if(g7)return $5;g7=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let J=await l8(Y);if(J){if($5=J,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded`);return $5}}let Z=bK();for(let Y of Z)if(await Bun.file(Y).exists()){let J=await l8(Y);if(J){if($5=J,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(Y))}`);return $5}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${B0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${B0.reset}`),console.warn(`${B0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${B0.reset}`),null}}function SK(){Y1.clear()}function yK(){$5=null,g7=!1,l0=null,P5="",Y1.clear(),p4=null}async function m7($){try{if(!IK({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=Y0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${B0.yellow}[Crosswind]${B0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function i8($){if(e1)return P5;e1=!0;try{let Z=await d7();if(!Z||!Z.build)return e1=!1,"";if(!l0)l0=await m7($);if(!l0)return e1=!1,"";let Y=Z.defaultConfig?.theme||{},J=l0.theme||{},Q={...Z.defaultConfig,...l0,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},X=performance.now(),G=await Z.build(Q),K=performance.now()-X;if(P5=G.css,console.log(`${B0.cyan}[Crosswind]${B0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),Q.output){let q=Y0.isAbsolute(Q.output)?Q.output:Y0.join($,Q.output),W=Y0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,G.css)}return e1=!1,G.css}catch(Z){return console.error(`${B0.red}[Crosswind]${B0.reset} Build error:`,Z),e1=!1,P5}}async function CK($){l0=null,await i8($)}function PK(){return P5}function n8($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,X=Q.exec($);while(X!==null){let G=X[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}X=Q.exec($)}return Z}async function o8($,Z){try{let Y=await d7();if(!Y)return"";let J=n8($);if(J.size===0)return"";let Q=Z?Y0.resolve(Z):process.cwd();if(!q1)q1=Q1(Q,"cache");let X=[...J].sort().join(" "),G=`${p4||"default"}::${X}`,K=Y1.get(G);if(K!==void 0)return f7(G,K),K;let q=await EK(G);if(q!==null)return f7(G,q),q;if(!l0){let A=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (t1(),c8)),R=await N(Q);if(R.css)if(typeof R.css==="string"){let T=Y0.isAbsolute(R.css)?R.css:Y0.resolve(Q,R.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Y0.isAbsolute(R.css.config)?R.css.config:Y0.resolve(Q,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${B0.green}[Crosswind]${B0.reset} Using inline CSS config from stx.config.ts`)}}catch{}l0=A||await m7(Q);try{p4=h7(JSON.stringify(l0??{}))}catch{p4="unhashable"}}let W=Y.defaultConfig||Y.config,z=l0||{},U=W.theme||{},B=(z.theme||{}).extend||{},j={...U};if(Object.keys(B).length>0)j.extend=B;let H=[...W.safelist||[],...z.safelist||[]],L={...W,...z,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of J)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||z.shortcuts||{};for(let[A,N]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean);for(let T of R)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
|
|
1628
|
+
`}async function d8($,Z,Y,J){if(Z.length<1)return e("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[v5.join(v5.dirname(J),G,`${Q}.stx`),v5.join(process.cwd(),G,`${Q}.stx`),v5.join(v5.dirname(J),`${Q}.stx`)],q=null;for(let U of K)if(await n(U)){q=await Bun.file(U).text();break}if(!q)return e("WebComponent",`Component file not found: ${Q}.stx`,s.FILE_NOT_FOUND);let z=LK(q,Q);return`<script type="module">
|
|
1629
|
+
${FK(z)}
|
|
1630
|
+
</script>`}var m8=S(()=>{Y1();A0()});var u8={};r(u8,{timingPlugin:()=>RK,pluginManager:()=>VK,definePlugin:()=>m4,debugPlugin:()=>NK,createVariablesPlugin:()=>TK,createFilterPlugin:()=>AK,createDirectivePlugin:()=>wK,PluginManager:()=>v7});function m4($){return $}class v7{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let X=await Q(Y);if(X){if(X.template!==void 0)Y.template=X.template;if(X.context)Y.context={...Y.context,...X.context};if(X.metadata)Y.metadata={...Y.metadata,...X.metadata};if(X.skip)break}}catch(X){console.error(`Error in plugin "${J.name}" ${$} hook:`,X)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let Q of this.sortedPlugins){let X=Q[$];if(X)try{let G=await X(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return J}}function wK($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function AK($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function TK($){return m4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var VK,NK,RK;var p8=S(()=>{VK=new v7;NK=m4({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),RK=m4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var l8={};r(l8,{validateConfig:()=>kK,loadStxConfig:()=>S1,defineStxConfig:()=>EK,defaultConfig:()=>b1,config:()=>f7});import x7 from"fs";import E0 from"path";import{loadConfigWithResult as MK}from"bunfig";function IK($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=E0.join(process.cwd(),"resources","views"),Q=E0.join(process.cwd(),"resources","layouts");if(x7.existsSync(J)&&x7.existsSync(Q))return{root:"resources",pagesDir:"views"};let X=E0.join(process.cwd(),"resources","views","pages");if(x7.existsSync(X))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function DK($){if(L6($.stateDir),$.stateDir=H5(),$.cachePath=O5($.cachePath),$.build)$.build.cacheDir=O5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=O5($.media.cache.directory);if($.story)$.story.outDir=O5($.story.outDir)}async function S1($){if(!$){if(a1)return a1;if(u4)return u4}let Z=$?E0.resolve($):process.cwd(),Y=c8.get(Z);if(Y)return Y;let J=(async()=>{let X=(await MK({name:"stx",alias:"ui",cwd:Z,defaultConfig:b1,verbose:!1})).config;DK(X);let G=IK(X.root,X.pagesDir);if(X.root=G.root,X.pagesDir=G.pagesDir,X.root&&X.root!=="."){let K=X.root;if(X.partialsDir&&!E0.isAbsolute(X.partialsDir))X.partialsDir=E0.join(K,X.partialsDir);if(X.componentsDir&&!E0.isAbsolute(X.componentsDir))X.componentsDir=E0.join(K,X.componentsDir);if(X.layoutsDir&&!E0.isAbsolute(X.layoutsDir))X.layoutsDir=E0.join(K,X.layoutsDir)}if(X.plugins&&X.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (p8(),u8)),q=[],z=[];for(let W of X.plugins){let U=typeof W==="string"?W:W[0],B=typeof W==="string"?{}:W[1]||{};try{let _,j;try{_=await import(U),j=E0.dirname(W0.resolve(U))}catch{let L=E0.resolve(process.cwd(),U);_=await import(L),j=E0.dirname(L)}let H=_.default||_;if(K.register(H,X),H.components){let L=E0.resolve(j,H.components);q.push(L)}if(H.pages){let L=E0.resolve(j,H.pages),F=B.path||"/";z.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{X.customDirectives=X.customDirectives||[],X.customDirectives.push(F)},addRoute:(F,O)=>{X.apiRoutes=X.apiRoutes||{},X.apiRoutes[F]=O},addMiddleware:(F)=>{X.middleware=X.middleware||[],X.middleware.push(F)},pluginDir:j,config:X};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(_){console.warn(`[stx] Failed to load plugin ${U}:`,_.message)}}X._pluginComponentDirs=q,X._pluginPageDirs=z}return X})();if(c8.set(Z,J),!$)u4=J,J.then((Q)=>{a1=Q}).catch(()=>{});return J}function EK($){return $}function kK($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Q)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Q)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,X)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${X}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Q.strategy))Z.push({path:`pwa.routes[${X}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${X}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${X}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((X)=>!J.includes(X)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var b1,a1=null,c8,u4=null,f7;var t1=S(()=>{S$();y$();C$();P$();a$();Z8();E7();D8();P7();L5();m8();b1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:m1,cachePath:".stx/cache",cacheVersion:"1.0.0",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:D9,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:d8,hasEndTag:!1,description:"Include a web component in the template"},w6,A6,g8,h8,N6,T6,M6,R6,k6,y6,$8,D7,...I8],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:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!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}};c8=new Map;f7=new Proxy(b1,{get($,Z){if(a1&&Z in a1)return a1[Z];if(!u4)S1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var r8={};r(r8,{resetCssCache:()=>vK,resetCrosswindCache:()=>xK,rebuildCrosswindCSS:()=>fK,loadCrosswindConfig:()=>u7,loadCrosswind:()=>m7,injectCrosswindCSS:()=>f5,getCachedCSS:()=>gK,generateCrosswindCSS:()=>s8,extractClassNames:()=>o8,buildCrosswindCSS:()=>n8});import Y0 from"path";import{hasLocalConfig as bK}from"bunfig/discovery";function d7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function g7($,Z){if(J1.has($))J1.delete($);else if(J1.size>=SK)J1.delete(J1.keys().next().value);J1.set($,Z)}async function yK($){if(!z1)return null;try{let Z=Bun.file(Y0.join(z1,`cw-${d7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function CK($,Z){if(!z1)return;try{if(!fs.existsSync(z1))fs.mkdirSync(z1,{recursive:!0});await Bun.write(Y0.join(z1,`cw-${d7($)}.css`),Z)}catch{}}async function i8($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function PK(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==Y0.dirname(Y))$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Y0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=Y0.dirname(Y);if(Z){let J=[Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...J)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function m7(){if(h7)return $5;h7=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let J=await i8(Y);if(J){if($5=J,!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} CSS engine loaded`);return $5}}let Z=PK();for(let Y of Z)if(await Bun.file(Y).exists()){let J=await i8(Y);if(J){if($5=J,!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(Y))}`);return $5}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${j0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${j0.reset}`),console.warn(`${j0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${j0.reset}`),null}}function vK(){J1.clear()}function xK(){$5=null,h7=!1,l0=null,x5="",J1.clear(),p4=null}async function u7($){try{if(!bK({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=Y0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${j0.yellow}[Crosswind]${j0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function n8($){if(e1)return x5;e1=!0;try{let Z=await m7();if(!Z||!Z.build)return e1=!1,"";if(!l0)l0=await u7($);if(!l0)return e1=!1,"";let Y=Z.defaultConfig?.theme||{},J=l0.theme||{},Q={...Z.defaultConfig,...l0,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},X=performance.now(),G=await Z.build(Q),K=performance.now()-X;if(x5=G.css,console.log(`${j0.cyan}[Crosswind]${j0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),Q.output){let q=Y0.isAbsolute(Q.output)?Q.output:Y0.join($,Q.output),z=Y0.dirname(q);if(!fs.existsSync(z))fs.mkdirSync(z,{recursive:!0});await Bun.write(q,G.css)}return e1=!1,G.css}catch(Z){return console.error(`${j0.red}[Crosswind]${j0.reset} Build error:`,Z),e1=!1,x5}}async function fK($){l0=null,await n8($)}function gK(){return x5}function o8($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,X=Q.exec($);while(X!==null){let G=X[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}X=Q.exec($)}return Z}async function s8($,Z){try{let Y=await m7();if(!Y)return"";let J=o8($);if(J.size===0)return"";let Q=Z?Y0.resolve(Z):process.cwd();if(!z1)z1=G1(Q,"cache");let X=[...J].sort().join(" "),G=`${p4||"default"}::${X}`,K=J1.get(G);if(K!==void 0)return g7(G,K),K;let q=await yK(G);if(q!==null)return g7(G,q),q;if(!l0){let A=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (t1(),l8)),R=await N(Q);if(R.css)if(typeof R.css==="string"){let T=Y0.isAbsolute(R.css)?R.css:Y0.resolve(Q,R.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${j0.green}[Crosswind]${j0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Y0.isAbsolute(R.css.config)?R.css.config:Y0.resolve(Q,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${j0.green}[Crosswind]${j0.reset} Using inline CSS config from stx.config.ts`)}}catch{}l0=A||await u7(Q);try{p4=d7(JSON.stringify(l0??{}))}catch{p4="unhashable"}}let z=Y.defaultConfig||Y.config,W=l0||{},U=z.theme||{},_=(W.theme||{}).extend||{},j={...U};if(Object.keys(_).length>0)j.extend=_;let H=[...z.safelist||[],...W.safelist||[]],L={...z,...W,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of J)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||W.shortcuts||{};for(let[A,N]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean);for(let T of R)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
|
|
1631
1631
|
`);for(let[A,N]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of R){let D=I.startsWith("dark:"),b=`.${(D?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<w.length;k++){let y=w[k].trim();if(y===`${b} {`||y.startsWith(`${b} {`)){let g=k,h="";while(g<w.length){if(h+=w[g],w[g].includes("}"))break;g++}let m=h.match(/\{([^}]+)\}/);if(m)if(D)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
|
|
1632
1632
|
.${A} { ${T.join(" ")} }`;if(M.length)O+=`
|
|
1633
|
-
@media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return
|
|
1633
|
+
@media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return g7(G,O),CK(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function f5($,Z){let Y=await s8($,Z);if(!Y)return $;let J=`<style data-crosswind="generated">
|
|
1634
1634
|
${Y}
|
|
1635
1635
|
</style>`,Q=/<style data-crosswind="generated">[\s\S]*?<\/style>/g;if(Q.test($)){let X=!1;return $.replace(Q,()=>{if(X)return"";return X=!0,J})}if($.includes("</head>"))return $.replace("</head>",`${J}
|
|
1636
1636
|
</head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
1637
|
-
${J}`);return J+$}var $5=null,
|
|
1637
|
+
${J}`);return J+$}var $5=null,h7=!1,l0=null,x5="",e1=!1,SK=256,J1,z1=null,p4=null;var c4=S(()=>{L5();F6();J1=new Map});function a8(){return`
|
|
1638
1638
|
// STX Lifecycle Runtime
|
|
1639
1639
|
(function() {
|
|
1640
1640
|
if (typeof window === 'undefined') return;
|
|
@@ -1979,7 +1979,7 @@ else {
|
|
|
1979
1979
|
|
|
1980
1980
|
console.log('[stx] Lifecycle runtime initialized');
|
|
1981
1981
|
})();
|
|
1982
|
-
`}function
|
|
1982
|
+
`}function p7($){return Symbol($)}var PO,vO,xO;var t8=S(()=>{PO=p7("theme"),vO=p7("router"),xO=p7("i18n")});import*as $Z from"crypto";function e8($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function hK(){return`stx-${$Z.randomBytes(4).toString("hex")}`}function dK($){return/\$\w+\./.test($)}function mK($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(J,(X,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return X;let z=[],W=!1,U=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(dK(V)){W=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(z.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),e8(A).forEach((R)=>Y.add(R)),O==="text")U=U.replace(F,"");else if(O==="class")U=U.replace(F,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(F,"");else U=U.replace(F,`${O}=""`)}}}if(!W)return X;let j=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=hK(),U=` id="${H}"${U}`;for(let L of z)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:e8(L.expr)});return`<${G}${U}${q}`}),{html:Q,bindings:Z,stores:Y}}function uK($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
|
|
1983
1983
|
<script>
|
|
1984
1984
|
(function() {
|
|
1985
1985
|
'use strict';
|
|
@@ -2137,10 +2137,10 @@ else {
|
|
|
2137
2137
|
}
|
|
2138
2138
|
})();
|
|
2139
2139
|
</script>
|
|
2140
|
-
`,J}function
|
|
2140
|
+
`,J}function ZZ($){let{html:Z,bindings:Y,stores:J}=mK($);if(Y.length===0)return $;let Q=uK(Y,J),X=Z.lastIndexOf("</body>");if(X!==-1)return Z.slice(0,X)+Q+Z.slice(X);return Z+Q}var YZ=()=>{};function pK($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return cK(Z);case"google-analytics":return lK(Z);case"plausible":return iK(Z);case"self-hosted":return nK(Z);case"custom":return oK(Z);default:return""}}function cK($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",Q=[`data-site="${P0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${P0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
|
|
2141
2141
|
<!-- Fathom Analytics -->
|
|
2142
2142
|
<script src="${P0(Y)}" ${Q.join(" ")}${J}></script>
|
|
2143
|
-
`}function
|
|
2143
|
+
`}function lK($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=P0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
|
|
2144
2144
|
<!-- Google Analytics -->
|
|
2145
2145
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
|
|
2146
2146
|
<script>
|
|
@@ -2150,10 +2150,10 @@ else {
|
|
|
2150
2150
|
gtag('config', '${Y}');
|
|
2151
2151
|
${J}
|
|
2152
2152
|
</script>
|
|
2153
|
-
`}function
|
|
2153
|
+
`}function iK($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${P0(Z.domain)}"`],Q=Y,X=[];if(Z.trackLocalhost)X.push("local");if(Z.hashMode)X.push("hash");if(X.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${X.join(".")}.js`;return`
|
|
2154
2154
|
<!-- Plausible Analytics -->
|
|
2155
2155
|
<script defer data-domain="${P0(Z.domain)}" src="${P0(Q)}"></script>
|
|
2156
|
-
`}function
|
|
2156
|
+
`}function nK($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=P0(Z.siteId),J=P0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",X=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
|
|
2157
2157
|
d.addEventListener('click',function(e){
|
|
2158
2158
|
var a=e.target.closest('a');
|
|
2159
2159
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -2186,7 +2186,7 @@ else {
|
|
|
2186
2186
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
2187
2187
|
})();
|
|
2188
2188
|
</script>
|
|
2189
|
-
`}function
|
|
2189
|
+
`}function oK($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
|
|
2190
2190
|
<!-- Custom Analytics -->
|
|
2191
2191
|
<script>
|
|
2192
2192
|
${Z.inlineScript}
|
|
@@ -2194,7 +2194,7 @@ ${Z.inlineScript}
|
|
|
2194
2194
|
`;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${P0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,X]of Object.entries(Z.attributes))Y.push(`${P0(Q)}="${P0(X)}"`);return`
|
|
2195
2195
|
<!-- Custom Analytics -->
|
|
2196
2196
|
<script${Y.length>0?` ${Y.join(" ")}`:""} src="${P0(Z.scriptUrl)}" defer></script>
|
|
2197
|
-
`}function
|
|
2197
|
+
`}function JZ($,Z){let Y=pK(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function P0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var XZ=()=>{};function KZ($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let J=Y.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(sK.has(J))Z.systemKeys.push(J);else if(J in qZ)Z.mouse=J;else if(J in GZ||/^[a-z]$/.test(J))Z.keys.push(GZ[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Q=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(J.startsWith("throttle")){let Q=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function zZ($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=J.exec($))!==null){let[X,G,K]=Q,q=Q.index,z=q+X.length,W=`__stx_evt_${Y++}`,U=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=B.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!QZ.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:KZ(F.slice(1)),elementId:W})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=j.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!QZ.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:KZ(F.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:X,elementId:W,events:U,startIndex:q,endIndex:z})}return Z}function rK($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=qZ[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function aK($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function tK($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=rK($),Q=aK($.handler,Z),X=[];if(Z.once)X.push("once: true");if(Z.capture)X.push("capture: true");if(Z.passive)X.push("passive: true");let G=X.length>0?`, { ${X.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
2198
2198
|
(function() {
|
|
2199
2199
|
var $el = document.getElementById('${Y}');
|
|
2200
2200
|
if (!$el) return;
|
|
@@ -2248,7 +2248,7 @@ else {
|
|
|
2248
2248
|
__stx_runHandler('${K}', $event, $el);
|
|
2249
2249
|
}
|
|
2250
2250
|
}${G});
|
|
2251
|
-
})();`}function
|
|
2251
|
+
})();`}function eK($){if($.length===0)return"";return`
|
|
2252
2252
|
<script data-stx-events>
|
|
2253
2253
|
(function() {
|
|
2254
2254
|
'use strict';
|
|
@@ -2296,11 +2296,11 @@ else {
|
|
|
2296
2296
|
}
|
|
2297
2297
|
|
|
2298
2298
|
// Event listeners
|
|
2299
|
-
${$.flatMap((Y)=>Y.events).map(
|
|
2299
|
+
${$.flatMap((Y)=>Y.events).map(tK).join(`
|
|
2300
2300
|
`)}
|
|
2301
2301
|
})();
|
|
2302
|
-
</script>`}function
|
|
2303
|
-
`+X.slice(K);else X+=G;return X}var
|
|
2302
|
+
</script>`}function $q($){let Z=zZ($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];for(let Q=Z.length-1;Q>=0;Q--){let X=Z[Q],G=X.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${X.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of X.events)q.elementId=K[1]}for(let K of X.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(z,""),G=G.replace(W,"")}Y=Y.slice(0,X.startIndex)+G+Y.slice(X.endIndex),J.push(...X.events)}return{template:Y,bindings:J}}function WZ($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:z}=$q($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...z],q}let Q=zZ($);if(Q.length===0)return $;let X=$;for(let q=Q.length-1;q>=0;q--){let z=Q[q],W=z.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let U=W.match(/id=["']([^"']+)["']/);if(U)for(let B of z.events)B.elementId=U[1]}for(let U of z.events){let B=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");W=W.replace(_,""),W=W.replace(j,"")}X=X.slice(0,z.startIndex)+W+X.slice(z.endIndex)}let G=eK(Q),K=X.lastIndexOf("</body>");if(K!==-1)X=X.slice(0,K)+G+`
|
|
2303
|
+
`+X.slice(K);else X+=G;return X}var QZ,GZ,sK,qZ;var UZ=S(()=>{QZ=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"]),GZ={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"},sK=new Set(["ctrl","alt","shift","meta"]),qZ={left:0,middle:1,right:2}});function l4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function BZ($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function Yq($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[Q,X,G]=J,K=J.index,q=BZ(G,"x-data");if(!q)continue;let z=`__stx_scope_${jZ++}`,W=BZ(G,"x-init"),U=Jq($,X,K+Q.length),B=$.slice(K,U.endIndex),_=Xq(B);Z.push({id:z,selector:`[data-stx-scope="${z}"]`,stateExpr:q,initExpr:W,bindings:[],refs:_})}return Z}function Jq($,Z,Y){let J=1,Q=Y,X=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=X.exec($),z=G.exec($),W=K.exec($);if(W&&W.index<(q?.index??1/0)){Q=W.index+W[0].length;continue}if(!z)return{endIndex:$.length};if(q&&q.index<z.index)J++,Q=q.index+q[0].length;else{if(J--,J===0)return{endIndex:z.index+z[0].length};Q=z.index+z[0].length}}return{endIndex:$.length}}function Xq($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=J.exec(Y))!==null){let[,X,G]=Q,K=Qq(X);Z.set(G,K)}return Z}function Qq($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${Zq++}`}function Gq(){return`
|
|
2304
2304
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
2305
2305
|
(function() {
|
|
2306
2306
|
var style = document.createElement('style');
|
|
@@ -2507,7 +2507,7 @@ window.__stx_reactive = (function() {
|
|
|
2507
2507
|
|
|
2508
2508
|
return { initScope: initScope, reactive: reactive };
|
|
2509
2509
|
})();
|
|
2510
|
-
`}function _Z($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,Q)=>{try{let X=
|
|
2510
|
+
`}function _Z($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,Q)=>{try{let X=h0(Q,Z,!0);if(X===void 0)return J;return String(X)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,Q)=>{try{let X=h0(Q,Z,!0);if(X===void 0)return J;if(typeof X==="string"){let G=X.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(X)}catch{return J}}),Y}function Kq($,Z){if($.length===0)return"";let Y=$.map((J)=>{let Q=JSON.stringify(Object.fromEntries(J.refs)),X=_Z(J.stateExpr,Z),G=J.initExpr?_Z(J.initExpr,Z):null,K=JSON.stringify(X),q=G?JSON.stringify(G):"null";return`
|
|
2511
2511
|
(function() {
|
|
2512
2512
|
var scopeEl = document.querySelector('${J.selector}');
|
|
2513
2513
|
if (!scopeEl) return;
|
|
@@ -2516,16 +2516,16 @@ window.__stx_reactive = (function() {
|
|
|
2516
2516
|
})();`}).join(`
|
|
2517
2517
|
`);return`
|
|
2518
2518
|
<script data-stx-scoped data-stx-reactive>
|
|
2519
|
-
${
|
|
2519
|
+
${Gq()}
|
|
2520
2520
|
${Y}
|
|
2521
|
-
</script>`}function
|
|
2522
|
-
`+Q.slice(G);else Q+=X;return Q}function Xq($,Z){let Y=$;for(let J of Z){let X=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${l4(J.stateExpr)}["']`,"gi").exec(Y);if(X)J.id=X[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${l4(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)J.id=K[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${l4(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${l4(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Qq($){return/x-data\s*=\s*["']/.test($)}var BZ=0,aK=0;var HZ=S(()=>{r0()});import Gq from"fs";import p7 from"path";import{createHighlighter as Kq}from"ts-syntax-highlighter";async function qq($,Z={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let J=(await Gq.promises.stat($)).mtime.getTime();if(Z.cache&&c7.has($)){let U=c7.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let Q=await Bun.file($).text(),{data:X,content:G}=C6(Q),K=Z.markdown||x7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=O5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await zq(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:W,data:X||{}};if(Z.cache)c7.set($,{...z,updatedAt:J});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:K0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function zq($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!i4)try{i4=await Kq({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,z)=>{let U=z.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),_=W||(Y?"text":"");if(!_)return K;try{if(!i4.getSupportedLanguages().includes(_))return K;return(await i4.highlight(U,_,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return K},X=$,G=$.matchAll(J);for(let K of G){let[q,W,z,U]=K,_=await Q(q,W,z,U);X=X.replace(q,_)}return X}async function OZ($,Z,Y="",J={}){return await Wq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let z=K;if(!p7.isAbsolute(K))z=p7.resolve(p7.dirname(Y),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),N=V.substring(w+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(R||T)N=N.substring(1,N.length-1);U[A]=N}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:_,data:B}=await qq(z,J),j={...Z,...B,...U},H=_,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(z){let U=z instanceof Error?z.message:String(z);return K0("Markdown File",`Error including markdown file: ${U}`,Y,$,W,G)}})}async function Wq($,Z,Y){let J=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;J.push(Y(...W).then((z)=>({match:K,replacement:z,index:q})))}let X=await Promise.all(J);X.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of X)G=G.replace(K,()=>q);return G}var c7,i4=null;var LZ=S(()=>{t1();A0();c7=new Map});function z1($,Z){try{let Y=$.trim();if(Q0(Y))return G0(Y,Object.keys(Z))(...Object.values(Z));else return Z0(Y,Z)}catch{return!1}}var FZ=S(()=>{R0()});function W1($,Z){let Y=Uq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function Uq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=S0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function _q($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function y1($,Z,Y,J){let Q=1,X=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(X<$.length&&Q>0){G.lastIndex=X,K.lastIndex=X;let q=G.exec($),W=K.exec($),z=q?q.index:1/0,U=W?W.index:1/0;if(z<U)Q++,X=z+q[0].length;else if(U<1/0){if(Q--,Q===0)return U;X=U+W[0].length}else break}return-1}function VZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,Q=W1($,J);if(!Q)return null;let X=Q.endPos,G=y1($,"if","endif",X);if(G===-1)return null;let K=$.slice(X,G),q=[],W=0,z="if",U=Q.expression,_=0,B=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if(_q(K,j)){W++;continue}if(/^@if\s*\(/.test(H)){B++,W++;continue}if(/^@endif(?![a-z])/.test(H)){B--,W+=6;continue}if(B===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:z,condition:U,content:K.substring(_,W),start:X+_,end:X+W});let F=W+L[0].length,O=W1(K,F);if(!O){W++;continue}z="elseif",U=O.expression,W=O.endPos,_=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:z,condition:U,content:K.substring(_,W),start:X+_,end:X+W}),z="else",U=void 0,W+=5,_=W;continue}}W++}return q.push({type:z,condition:U,content:K.slice(_),start:X+_,end:X+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function x5($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let X=VZ($,J.index);if(X)Z.push(X),Y.lastIndex=X.end;J=Y.exec($)}return Z}function n4($,Z,Y){let J=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),X=Q.exec($);while(X!==null){if(J.some((H)=>X.index>H.start&&X.index<H.end)){X=Q.exec($);continue}let K=X.index,q=K+X[0].length-1,W=S0($,"(",")",q);if(W===-1){X=Q.exec($);continue}let z=$.slice(q+1,W),U=W+1,_=y1($,Z,Y,U);if(_===-1){X=Q.exec($);continue}let B=$.slice(U,_),j=_+`@${Y}`.length;J.push({fullMatch:$.slice(K,j),name:Z,params:z,content:B,start:K,end:j}),Q.lastIndex=j,X=Q.exec($)}return J}function l7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,Q=W1($,J);if(!Q)return null;let X=Q.endPos,G=y1($,"switch","endswitch",X);if(G===-1)return null;let K=$.slice(X,G),q=[],W=0,z=null,U=0;while(W<K.length){let _=K.slice(W),B=_.match(/^@switch\s*\(/),j=_.match(/^@endswitch(?![a-z])/);if(B){if(U++,z)z.content+=B[0];W+=B[0].length;continue}if(j){if(U--,z)z.content+=j[0];W+=j[0].length;continue}if(U>0){if(z)z.content+=K[W];W++;continue}let H=_.match(/^@case\s*/),L=_.match(/^@default(?![a-z])/),F=_.match(/^@break(?![a-z])/);if(H&&_.startsWith("@case")){if(z)q.push(z);let O=W+H[0].length,V=W1(K,O);if(!V){W++;continue}z={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&_.startsWith("@default")){if(z)q.push(z);z={type:"default",content:""},W+=L[0].length}else if(F&&_.startsWith("@break"))W+=F[0].length;else{if(z)z.content+=K[W];W++}}if(z)q.push(z);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var wZ=()=>{};var AZ=()=>{};var o4=S(()=>{wZ();AZ()});function Oq($,Z,Y){let J=$,Q=!0;while(Q){Q=!1;let X=J.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=l7(J,G);if(!K)break;try{let q;if(Q0(K.expression))q=G0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Z0(K.expression,Z);let W="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)W=U.content.trim()}else try{let _;if(U.value&&Q0(U.value))_=G0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)_=Z0(U.value,Z);if(q===_){W=U.content.trim(),z=!0;break}}catch{continue}J=J.substring(0,G)+W+J.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),z=e("Switch",`Error evaluating @switch expression: ${W}`,s.EVALUATION_ERROR);J=J.substring(0,G)+z+J.substring(K.end);break}}return J}function C1($,Z,Y){let J=$;J=Oq(J,Z,Y);{let X=!0;while(X){X=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=W1(J,K+7);if(!q)break;let W=q.endPos,z=y1(J,"unless","endunless",W);if(z===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=J.slice(W,z),_=q.expression,B=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((A,N)=>A.pos-N.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){B=A.pos;break}}let j;if(B!==-1){let H=U.slice(0,B),L=U.slice(B+5);j=`@if (${_})${L}@else ${H}@endif`}else j=`@if (!(${_}))${U}@endif`;J=J.substring(0,K)+j+J.substring(z+10),X=!0}}J=n7(J,Z,Y),J=o7(J,Z,Y),J=i7(J,Z);let Q=()=>{let X=x5(J);if(X.length===0)return!1;for(let G=X.length-1;G>=0;G--){let K=X[G];try{let q="",W=!1;for(let z of K.branches){if(W)break;if(z.type==="else")q=z.content,W=!0;else try{let U;if(z.condition&&Q0(z.condition))U=G0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Z0(z.condition,Z);if(U)q=z.content,W=!0}catch(U){q=e(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),W=!0}}J=J.substring(0,K.start)+q+J.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),z=e("If",`Error processing @if block: ${W}`,s.EVALUATION_ERROR);J=J.substring(0,K.start)+z+J.substring(K.end)}}return!0};while(!0){let X=J;if(!Q())break;if(J===X)break}return J}function NZ($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}J.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function i7($,Z){let Y=$;function J(K,q,W,z){let U=1,_=z,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(_<K.length&&U>0){B.lastIndex=_,j.lastIndex=_;let H=B.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)U++,_=F+H[0].length;else if(O<1/0){if(U--,U===0)return O;_=O+L[0].length}else break}return-1}function Q(K,q,W){let z=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],H;while((H=U.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")z++;else if(L.type==="close")z--;else if(L.type==="else"&&z===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,_=Y.slice(W+5),B=NZ(_);if(B)z=B.value,U=W+5+B.consumed;else U=W+5;let j=J(Y,"auth","endauth",U);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=z?z1(`auth?.check && auth?.user?.[${z}]`,Z):z1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,_=Y.slice(W+6),B=NZ(_);if(B)z=B.value,U=W+6+B.consumed;else U=W+6;let j=J(Y,"guest","endguest",U);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=z?z1(`!auth?.check || !auth?.user?.[${z}]`,Z):z1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function X(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(q)z.push(q);if(W){let U=z1(W,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let _=U.index,B=Y.slice(_+`@${K}`.length),j=G(B);if(!j)break;let H=_+`@${K}`.length+j.paramsEnd,L=J(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${_} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((k,y)=>k.pos-y.pos);for(let k of T){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)O.push(k)}let I=[],D=0;for(let k=0;k<O.length;k++){let y=O[k];if(I.push({content:F.slice(D,y.pos),ability:void 0}),y.type==="elseDirective"){let g=F.slice(y.pos+`@${W}`.length),h=G(g);if(h){I[I.length-1]={content:F.slice(D,y.pos)},D=y.pos+`@${W}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let m=O[k+1],i=m?m.pos:F.length;I.push({content:F.slice(D,i),ability:h.ability,type:h.type,id:h.id}),D=i}}else D=y.pos+5}if(D<F.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=X(j.ability,j.type,j.id),P=K==="can"?E:!E,b="";if(P)b=I[0]?.content||"";else{let k=!1;for(let y=1;y<I.length;y++){let g=I[y];if(g.isFinalElse){b=g.content,k=!0;break}if(g.ability){let h=X(g.ability,g.type,g.id);if(K==="can"?h:!h){b=g.content,k=!0;break}}}if(!k&&I.length>0){let y=I[I.length-1];if(y.isFinalElse)b=y.content}}Y=Y.substring(0,_)+b+Y.substring(L+`@${q}`.length),z=!0}}return Y}function n7($,Z,Y){let J=$;function Q(X,G,K,q,W){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),_=X.match(U);if(!_||_.index===void 0)break;let B=_.index,j=W1(X,B+`@${G}`.length);if(!j)break;let H=j.endPos,L=y1(X,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${K} \u2014 the block was skipped.`);break}let F=X.slice(H,L),O=j.expression,V=-1,w=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let R=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){V=N;break}A=N+1}try{let N=q(O.trim()),R;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);R=N?T:M}else R=N?F:"";X=X.substring(0,B)+R+X.substring(L+`@${K}`.length),z=!0}catch(N){let R=N instanceof Error?N.message:String(N),T=e(W,`Error processing @${G} directive: ${R}`,s.EVALUATION_ERROR);X=X.substring(0,B)+T+X.substring(L+`@${K}`.length);break}}return X}return J=Q(J,"isset","endisset",(X)=>{let G=z1(X,Z);return G!==void 0&&G!==null},"Isset"),J=Q(J,"empty","endempty",(X)=>{let G=z1(X,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function o7($,Z,Y){let J=$,Q="development";function X(G,K,q,W){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),_=new RegExp(`^@${K}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,z.lastIndex=0;let L=z.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=Q===E[2]}let V=1,w=O,A=-1;while(V>0&&w<j.length){z.lastIndex=w,U.lastIndex=w;let E=z.exec(j),P=U.exec(j),b=E?E.index:1/0,k=P?P.index:1/0;if(b<k)V++,w=b+E[0].length;else if(k<1/0){if(V--,V===0){A=k;break}w=k+P[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=j.substring(O,A),R=-1,T=0,M=0;while(M<N.length){let E=N.indexOf("@",M);if(E===-1)break;let P=N.substring(E);if(_.test(P)){T++,M=E+1;continue}if(B.test(P)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){R=E;break}M=E+1}let I;if(R!==-1){let E=N.slice(0,R),P=N.slice(R+5);I=W?E:P}else I=W?N:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+D),H=!0}return j}return J=X(J,"env","endenv",!1),J=X(J,"production","endproduction",Q==="production"),J=X(J,"development","enddevelopment",Q==="development"),J=X(J,"staging","endstaging",Q==="staging"),J=X(J,"testing","endtesting",Q==="testing"),J}var s4=S(()=>{FZ();Z1();o4();R0()});function TZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function r4($,Z){if(!$)return Z?.nonceGenerator?.()??TZ();let Y=RZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??TZ(),RZ.set($,Y);return Y}function Lq($,Z){let Y=[];for(let[J,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(J);continue}if(Array.isArray(Q)){let X=[...Q];if(Z&&(J==="script-src"||J==="style-src"))X=X.filter((G)=>!G.startsWith("'nonce-")),X.push(`'nonce-${Z}'`);if(X.length>0)Y.push(`${J} ${X.join(" ")}`)}}return Y.join("; ")}function MZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Lq($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function IZ($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?r4(Y,Z):void 0,Q=MZ(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
2523
|
-
${Q}`)}function
|
|
2524
|
-
${t4("@csrf",Z)}`,!["GET","POST"].includes(
|
|
2525
|
-
${t4(`@method('${
|
|
2526
|
-
`),J=[{obj:Z,indent:-1}];for(let Q of Y){let X=Q.replace(/#.*$/,"").trimEnd();if(!X.trim())continue;let G=X.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,q=X.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W
|
|
2521
|
+
</script>`}function HZ($,Z,Y){if(jZ=0,!zq($))return $;let J=Yq($);if(J.length===0)return $;let Q=qq($,J),X=Kq(J,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+X+`
|
|
2522
|
+
`+Q.slice(G);else Q+=X;return Q}function qq($,Z){let Y=$;for(let J of Z){let X=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${l4(J.stateExpr)}["']`,"gi").exec(Y);if(X)J.id=X[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${l4(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)J.id=K[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${l4(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${l4(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function zq($){return/x-data\s*=\s*["']/.test($)}var jZ=0,Zq=0;var OZ=S(()=>{r0()});import Wq from"fs";import c7 from"path";import{createHighlighter as Uq}from"ts-syntax-highlighter";async function Bq($,Z={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let J=(await Wq.promises.stat($)).mtime.getTime();if(Z.cache&&l7.has($)){let U=l7.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let Q=await Bun.file($).text(),{data:X,content:G}=P6(Q),K=Z.markdown||f7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},z=F5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)z=await _q(z,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:z,data:X||{}};if(Z.cache)l7.set($,{...W,updatedAt:J});return W}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:K0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function _q($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!i4)try{i4=await Uq({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,z,W)=>{let U=W.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),B=z||(Y?"text":"");if(!B)return K;try{if(!i4.getSupportedLanguages().includes(B))return K;return(await i4.highlight(U,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${z}:`,_)}return K},X=$,G=$.matchAll(J);for(let K of G){let[q,z,W,U]=K,B=await Q(q,z,W,U);X=X.replace(q,B)}return X}async function LZ($,Z,Y="",J={}){return await jq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,z)=>{try{let W=K;if(!c7.isAbsolute(K))W=c7.resolve(c7.dirname(Y),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),N=V.substring(w+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(R||T)N=N.substring(1,N.length-1);U[A]=N}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await Bq(W,J),j={...Z,..._,...U},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(W){let U=W instanceof Error?W.message:String(W);return K0("Markdown File",`Error including markdown file: ${U}`,Y,$,z,G)}})}async function jq($,Z,Y){let J=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,z=Q;J.push(Y(...z).then((W)=>({match:K,replacement:W,index:q})))}let X=await Promise.all(J);X.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of X)G=G.replace(K,()=>q);return G}var l7,i4=null;var FZ=S(()=>{t1();A0();l7=new Map});function W1($,Z){try{let Y=$.trim();if(Q0(Y))return G0(Y,Object.keys(Z))(...Object.values(Z));else return Z0(Y,Z)}catch{return!1}}var VZ=S(()=>{R0()});function U1($,Z){let Y=Hq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function Hq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=b0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function Oq($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function y1($,Z,Y,J){let Q=1,X=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(X<$.length&&Q>0){G.lastIndex=X,K.lastIndex=X;let q=G.exec($),z=K.exec($),W=q?q.index:1/0,U=z?z.index:1/0;if(W<U)Q++,X=W+q[0].length;else if(U<1/0){if(Q--,Q===0)return U;X=U+z[0].length}else break}return-1}function wZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,Q=U1($,J);if(!Q)return null;let X=Q.endPos,G=y1($,"if","endif",X);if(G===-1)return null;let K=$.slice(X,G),q=[],z=0,W="if",U=Q.expression,B=0,_=0;while(z<K.length){let j=K.indexOf("@",z);if(j===-1)break;z=j;let H=K.substring(j);if(Oq(K,j)){z++;continue}if(/^@if\s*\(/.test(H)){_++,z++;continue}if(/^@endif(?![a-z])/.test(H)){_--,z+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:W,condition:U,content:K.substring(B,z),start:X+B,end:X+z});let F=z+L[0].length,O=U1(K,F);if(!O){z++;continue}W="elseif",U=O.expression,z=O.endPos,B=z;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:W,condition:U,content:K.substring(B,z),start:X+B,end:X+z}),W="else",U=void 0,z+=5,B=z;continue}}z++}return q.push({type:W,condition:U,content:K.slice(B),start:X+B,end:X+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function g5($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let X=wZ($,J.index);if(X)Z.push(X),Y.lastIndex=X.end;J=Y.exec($)}return Z}function n4($,Z,Y){let J=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),X=Q.exec($);while(X!==null){if(J.some((H)=>X.index>H.start&&X.index<H.end)){X=Q.exec($);continue}let K=X.index,q=K+X[0].length-1,z=b0($,"(",")",q);if(z===-1){X=Q.exec($);continue}let W=$.slice(q+1,z),U=z+1,B=y1($,Z,Y,U);if(B===-1){X=Q.exec($);continue}let _=$.slice(U,B),j=B+`@${Y}`.length;J.push({fullMatch:$.slice(K,j),name:Z,params:W,content:_,start:K,end:j}),Q.lastIndex=j,X=Q.exec($)}return J}function i7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,Q=U1($,J);if(!Q)return null;let X=Q.endPos,G=y1($,"switch","endswitch",X);if(G===-1)return null;let K=$.slice(X,G),q=[],z=0,W=null,U=0;while(z<K.length){let B=K.slice(z),_=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(_){if(U++,W)W.content+=_[0];z+=_[0].length;continue}if(j){if(U--,W)W.content+=j[0];z+=j[0].length;continue}if(U>0){if(W)W.content+=K[z];z++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(W)q.push(W);let O=z+H[0].length,V=U1(K,O);if(!V){z++;continue}W={type:"case",value:V.expression,content:""},z=V.endPos}else if(L&&B.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},z+=L[0].length}else if(F&&B.startsWith("@break"))z+=F[0].length;else{if(W)W.content+=K[z];z++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var AZ=()=>{};var NZ=()=>{};var o4=S(()=>{AZ();NZ()});function wq($,Z,Y){let J=$,Q=!0;while(Q){Q=!1;let X=J.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=i7(J,G);if(!K)break;try{let q;if(Q0(K.expression))q=G0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Z0(K.expression,Z);let z="",W=!1;for(let U of K.cases)if(U.type==="default"){if(!W)z=U.content.trim()}else try{let B;if(U.value&&Q0(U.value))B=G0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)B=Z0(U.value,Z);if(q===B){z=U.content.trim(),W=!0;break}}catch{continue}J=J.substring(0,G)+z+J.substring(K.end),Q=!0}catch(q){let z=q instanceof Error?q.message:String(q),W=e("Switch",`Error evaluating @switch expression: ${z}`,s.EVALUATION_ERROR);J=J.substring(0,G)+W+J.substring(K.end);break}}return J}function C1($,Z,Y){let J=$;J=wq(J,Z,Y);{let X=!0;while(X){X=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=U1(J,K+7);if(!q)break;let z=q.endPos,W=y1(J,"unless","endunless",z);if(W===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=J.slice(z,W),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((A,N)=>A.pos-N.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let j;if(_!==-1){let H=U.slice(0,_),L=U.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${U}@endif`;J=J.substring(0,K)+j+J.substring(W+10),X=!0}}J=o7(J,Z,Y),J=s7(J,Z,Y),J=n7(J,Z);let Q=()=>{let X=g5(J);if(X.length===0)return!1;for(let G=X.length-1;G>=0;G--){let K=X[G];try{let q="",z=!1;for(let W of K.branches){if(z)break;if(W.type==="else")q=W.content,z=!0;else try{let U;if(W.condition&&Q0(W.condition))U=G0(W.condition,Object.keys(Z))(...Object.values(Z));else if(W.condition)U=Z0(W.condition,Z);if(U)q=W.content,z=!0}catch(U){q=e(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),z=!0}}J=J.substring(0,K.start)+q+J.substring(K.end)}catch(q){let z=q instanceof Error?q.message:String(q),W=e("If",`Error processing @if block: ${z}`,s.EVALUATION_ERROR);J=J.substring(0,K.start)+W+J.substring(K.end)}}return!0};while(!0){let X=J;if(!Q())break;if(J===X)break}return J}function RZ($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}J.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function n7($,Z){let Y=$;function J(K,q,z,W){let U=1,B=W,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${z}(?![a-z])`,"g");while(B<K.length&&U>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)U++,B=F+H[0].length;else if(O<1/0){if(U--,U===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,z){let W=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${z}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=U.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")W++;else if(L.type==="close")W--;else if(L.type==="else"&&W===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let z=q.index,W,U,B=Y.slice(z+5),_=RZ(B);if(_)W=_.value,U=z+5+_.consumed;else U=z+5;let j=J(Y,"auth","endauth",U);if(j===-1){console.warn(`[stx] @auth directive at position ${z} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=W?W1(`auth?.check && auth?.user?.[${W}]`,Z):W1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,z)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let z=q.index,W,U,B=Y.slice(z+6),_=RZ(B);if(_)W=_.value,U=z+6+_.consumed;else U=z+6;let j=J(Y,"guest","endguest",U);if(j===-1){console.warn(`[stx] @guest directive at position ${z} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=W?W1(`!auth?.check || !auth?.user?.[${W}]`,Z):W1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,z)+O+Y.substring(j+9),K=!0}}function X(K,q,z){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[K];if(q)W.push(q);if(z){let U=W1(z,Z);W.push(U)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,z=K==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let B=U.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=J(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${z}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((k,y)=>k.pos-y.pos);for(let k of T){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)O.push(k)}let I=[],D=0;for(let k=0;k<O.length;k++){let y=O[k];if(I.push({content:F.slice(D,y.pos),ability:void 0}),y.type==="elseDirective"){let g=F.slice(y.pos+`@${z}`.length),h=G(g);if(h){I[I.length-1]={content:F.slice(D,y.pos)},D=y.pos+`@${z}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let m=O[k+1],i=m?m.pos:F.length;I.push({content:F.slice(D,i),ability:h.ability,type:h.type,id:h.id}),D=i}}else D=y.pos+5}if(D<F.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=X(j.ability,j.type,j.id),P=K==="can"?E:!E,b="";if(P)b=I[0]?.content||"";else{let k=!1;for(let y=1;y<I.length;y++){let g=I[y];if(g.isFinalElse){b=g.content,k=!0;break}if(g.ability){let h=X(g.ability,g.type,g.id);if(K==="can"?h:!h){b=g.content,k=!0;break}}}if(!k&&I.length>0){let y=I[I.length-1];if(y.isFinalElse)b=y.content}}Y=Y.substring(0,B)+b+Y.substring(L+`@${q}`.length),W=!0}}return Y}function o7($,Z,Y){let J=$;function Q(X,G,K,q,z){let W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\s*\\(`),B=X.match(U);if(!B||B.index===void 0)break;let _=B.index,j=U1(X,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=y1(X,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=X.slice(H,L),O=j.expression,V=-1,w=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let R=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){V=N;break}A=N+1}try{let N=q(O.trim()),R;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);R=N?T:M}else R=N?F:"";X=X.substring(0,_)+R+X.substring(L+`@${K}`.length),W=!0}catch(N){let R=N instanceof Error?N.message:String(N),T=e(z,`Error processing @${G} directive: ${R}`,s.EVALUATION_ERROR);X=X.substring(0,_)+T+X.substring(L+`@${K}`.length);break}}return X}return J=Q(J,"isset","endisset",(X)=>{let G=W1(X,Z);return G!==void 0&&G!==null},"Isset"),J=Q(J,"empty","endempty",(X)=>{let G=W1(X,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function s7($,Z,Y){let J=$,Q="development";function X(G,K,q,z){let W=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,W.lastIndex=0;let L=W.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,z=Q===E[2]}let V=1,w=O,A=-1;while(V>0&&w<j.length){W.lastIndex=w,U.lastIndex=w;let E=W.exec(j),P=U.exec(j),b=E?E.index:1/0,k=P?P.index:1/0;if(b<k)V++,w=b+E[0].length;else if(k<1/0){if(V--,V===0){A=k;break}w=k+P[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=j.substring(O,A),R=-1,T=0,M=0;while(M<N.length){let E=N.indexOf("@",M);if(E===-1)break;let P=N.substring(E);if(B.test(P)){T++,M=E+1;continue}if(_.test(P)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){R=E;break}M=E+1}let I;if(R!==-1){let E=N.slice(0,R),P=N.slice(R+5);I=z?E:P}else I=z?N:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+D),H=!0}return j}return J=X(J,"env","endenv",!1),J=X(J,"production","endproduction",Q==="production"),J=X(J,"development","enddevelopment",Q==="development"),J=X(J,"staging","endstaging",Q==="staging"),J=X(J,"testing","endtesting",Q==="testing"),J}var s4=S(()=>{VZ();Y1();o4();R0()});function MZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function r4($,Z){if(!$)return Z?.nonceGenerator?.()??MZ();let Y=TZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??MZ(),TZ.set($,Y);return Y}function Aq($,Z){let Y=[];for(let[J,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(J);continue}if(Array.isArray(Q)){let X=[...Q];if(Z&&(J==="script-src"||J==="style-src"))X=X.filter((G)=>!G.startsWith("'nonce-")),X.push(`'nonce-${Z}'`);if(X.length>0)Y.push(`${J} ${X.join(" ")}`)}}return Y.join("; ")}function IZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Aq($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function DZ($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?r4(Y,Z):void 0,Q=IZ(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
2523
|
+
${Q}`)}function EZ($,Z,Y,J){let Q=$,X=J.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!X?.enabled||!X.directives)return"<!-- CSP not configured -->";let G=X.useNonce?r4(Z,X):void 0;return IZ(X.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return r4(Z,X)}),X?.enabled&&X.useNonce)Z.cspNonce=r4(Z,X);return Q}var TZ;var kZ=S(()=>{TZ=new WeakMap});import Nq from"crypto";function Tq($=Rq){let Z=Nq.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return r7=Z,Z}function Mq(){if(!r7)Tq();return r7}function Iq($=bZ){let Z=Mq();return`<input type="hidden" name="${$}" value="${Z}">`}function SZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return Iq(J||bZ)})}var Rq=40,bZ="_token",r7=null;var yZ=()=>{};async function CZ($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Q=$;for(let X of J.customDirectives){if(!X.name||typeof X.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",X);continue}if(X.hasEndTag)Q=await Dq(Q,X,Z,Y,J);else Q=await Eq(Q,X,Z,Y,J)}return Q}async function Dq($,Z,Y,J,Q){let{name:X,handler:G}=Z,K=`@${X}`,q=`@end${X}`,z=$,W=l1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],B=W.exec(z);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?PZ(j):[],O=H.trim(),V=await G(O,F,Y,J);U.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${X}:`,F);U.push({original:_,processed:e("CustomDirective",`Error in @${X}${j?`(${j})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:L})}B=W.exec(z)}for(let _=U.length-1;_>=0;_--){let{original:j,processed:H}=U[_];z=z.replace(j,H)}return z}async function Eq($,Z,Y,J,Q){let{name:X,handler:G}=Z,K=$,q=l1(`@${X}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),z=[],W=q.exec(K);while(W!==null){let[_,j=""]=W,H=W.index||0;try{let L=PZ(j),F=await G("",L,Y,J);z.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${X}:`,L);z.push({original:_,processed:e("CustomDirective",`Error in @${X}(${j}): ${F}`,s.EVALUATION_ERROR),startIndex:H})}W=q.exec(K)}let U=l1(`@${X}(?!\\w)(?!\\s*\\()`,"g"),B=U.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,J);z.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${X}:`,H);z.push({original:_,processed:e("CustomDirective",`Error in @${X}: ${L}`,s.EVALUATION_ERROR),startIndex:j})}B=U.exec(K)}for(let _=z.length-1;_>=0;_--){let{original:j,processed:H}=z[_];K=K.replace(j,H)}return K}function PZ($){if(!$.trim())return[];let Z=[],Y="",J=!1,Q="";for(let X=0;X<$.length;X++){let G=$[X];if((G==='"'||G==="'")&&(X===0||$[X-1]!=="\\"))if(!J)J=!0,Q=G;else if(G===Q)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((X)=>{let G=X.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var vZ=S(()=>{Y1();i1()});import kq from"crypto";function T0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function a4($,Z,Y,J){let Q=$||Z;return Y?`${Q} ${J}`:Q}function bq(){return kq.randomUUID()}function t4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=bq();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${T0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Q)=>{let X=Q.toUpperCase();if(Q&&!["GET","POST"].includes(X))return`<input type="hidden" name="_method" value="${T0(X)}">`;return J}),Y}function gZ($,Z,Y=fZ){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,X,G,K,q,z="")=>{let W=X||G||"POST",U=K||q||"",B=B1(z),_=W.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${T0(j)}" action="${T0(U)}"${B?` ${B}`:""}>`;if(H+=`
|
|
2524
|
+
${t4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
|
|
2525
|
+
${t4(`@method('${_}')`,Z)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,X,G,K,q,z="")=>{let W=X||G||"",U=K||q||"",B=B1(z),_=h5(W,Z),j=_!==void 0&&_!==null?_:U||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=d5(W,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=a4(O?O[1]:"",Y.input,F,Y.inputError),w=B.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${T0(L)}" name="${T0(W)}" value="${T0(j)}" class="${V}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,X,G="",K="")=>{let q=B1(G),z=h5(X,Z)||K.trim(),W=d5(X,Z),U=q.match(/class=['"]([^'"]+)['"]/i),B=a4(U?U[1]:"",Y.input,W,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${T0(X)}" class="${B}"${_?` ${_}`:""}>${T0(z)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,X,G="",K)=>{let q=B1(G),z=h5(X,Z),W=d5(X,Z),U=q.match(/class=['"]([^'"]+)['"]/i),B=a4(U?U[1]:"",Y.input,W,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(z!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(z)?z.some((V)=>String(V)===F):String(z)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${T0(X)}" class="${B}"${_?` ${_}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="1",K="")=>{let q=B1(K),z=h5(X,Z),W=z!==void 0&&(Array.isArray(z)?z.some((j)=>String(j)===G):z===!0||String(z)===G),U=q.match(/class=['"]([^'"]+)['"]/i),B=U?U[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${T0(X)}" value="${T0(G)}" class="${B}"${W?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G,K="")=>{let q=B1(K),z=h5(X,Z),W=z!==void 0&&z===G,U=q.match(/class=['"]([^'"]+)['"]/i),B=U?U[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${T0(X)}" value="${T0(G)}" class="${B}"${W?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="")=>{let K=B1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),z=q?q[1]:"",W=K.includes("multiple"),U=d5(X,Z),B=K.match(/class=['"]([^'"]+)['"]/i),_=a4(B?B[1]:"",Y.input,U,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${T0(X)}"`,`class="${_}"`];if(z)H.push(`accept="${T0(z)}"`);if(W)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,X,G="",K)=>{let q=B1(G),z=q.match(/class=['"]([^'"]+)['"]/i),W=z?z[1]:Y.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${T0(X)}" class="${W}"${U?` ${U}`:""}>${K}</label>`}),J}function hZ($,Z,Y=fZ){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Q,X)=>{try{if(d5(Q,Z))return X.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return xZ(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return xZ(Q,Z)}let q=K.trim();if(Q0(q)){let z=Z0(q,Z);return z!==void 0?String(z):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function d5($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function xZ($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function h5($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function B1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=J.exec(Y))!==null){let[,X,,G]=Q;Z.push(`${X}="${G.trim()}"`)}return Z.join(" ")}var fZ;var dZ=S(()=>{R0();fZ={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import e7 from"path";async function Sq(){if(m5!==void 0)return m5;try{m5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{m5=null}return m5}function yq($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function Cq($,Z){if({...Y3,...Z.i18n}.cache&&$3[$]){let Q=$3[$],X=Z.i18n?.cacheMaxAge??0;if(!yq(Q,X))return Q.translations}if(u5[$]?.state==="loading")return u5[$].promise;a7[$]="loading";let J=Z3($,Z).then((Q)=>{return a7[$]="loaded",delete u5[$],Q}).catch((Q)=>{throw a7[$]="error",u5[$]={promise:J,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return u5[$]={promise:J,state:"loading"},J}async function Z3($,Z){let Y={...Y3,...Z.i18n},J=e7.isAbsolute(Y.translationsDir)?Y.translationsDir:e7.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await Sq(),X=Q?await Q($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:gq(Y.format)}):await Pq($,Y,J);if(X===void 0){if($!==Y.defaultLocale)return Z3(Y.defaultLocale,Z);return{}}let G=X;if(Y.cache)$3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return Z3(Y.defaultLocale,Z);return{}}}async function Pq($,Z,Y){let J=e7.join(Y,`${$}${vq(Z.format)}`);try{let Q=await import(J);return Q.default||Q}catch(Q){try{let X=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return xq(X);if(Z.format==="json")return JSON.parse(X);throw Q}catch{return}}}function vq($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function xq($){let Z={},Y=$.split(`
|
|
2526
|
+
`),J=[{obj:Z,indent:-1}];for(let Q of Y){let X=Q.replace(/#.*$/,"").trimEnd();if(!X.trim())continue;let G=X.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,q=X.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,z,W]=q,U=z.trim(),B=W.trim();if(B==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=fq(B)}}return Z}function fq($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function gq($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function hq($,Z){return Cq($,Z)}function dq($,Z){for(let Y of $){let J=Y.trim(),Q=J.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let X=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10),K=X[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(X[2],10);if(Z>=G&&Z<=K)return X[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function mq($,Z={}){return pZ($,Z)}function pZ($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let Q=uq($,J);if(Q===-1){Y+=$[J],J++;continue}let X=$.slice(J+1,Q);Y+=pq(X,Z),J=Q+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function uq($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function pq($,Z){let Y=cq($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),Q=Z[J];if(Y.length===1)return Q!==void 0?String(Q):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return lq(Q,Y.slice(2).join(","),Z);case"select":return nq(Q,Y.slice(2).join(","));case"selectordinal":return oq(Q,Y.slice(2).join(","));case"number":return rq(Q,Y[2]?.trim());case"date":return aq(Q,Y[2]?.trim());case"time":return tq(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function cq($){let Z=[],Y="",J=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X==="{")J++,Y+=X;else if(X==="}")J--,Y+=X;else if(X===","&&J===0)Z.push(Y),Y="";else Y+=X}if(Y)Z.push(Y);return Z}function lq($,Z,Y){let J=Number($)||0,Q=J3(Z),X=`=${J}`;if(Q[X])return t7(Q[X],J,Y);let G=iq(J);if(Q[G])return t7(Q[G],J,Y);if(Q.other)return t7(Q.other,J,Y);return String(J)}function t7($,Z,Y){let J=$.replace(/#/g,String(Z));return pZ(J,Y)}function iq($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function nq($,Z){let Y=String($||""),J=J3(Z);if(J[Y])return J[Y];return J.other||String($)}function oq($,Z){let Y=Number($)||0,J=J3(Z),Q=sq(Y);if(J[Q])return J[Q].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function sq($){let Z=Math.abs($),Y=Z%10,J=Z%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function J3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function rq($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function aq($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function tq($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function eq($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function mZ($,Z,Y=!0,J={}){let Q=$.split("."),X=Z;for(let K of Q){if(X===void 0||X===null)break;X=X[K]}if(X===void 0||X===null)return Y?$:"";let G=String(X);if(eq(G))return mq(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),q=G.split("|");G=dq(q,K)}for(let[K,q]of Object.entries(J)){let z=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${z}`,"g"),String(q))}return G}async function cZ($,Z,Y,J){let Q=$,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...Y3,...J.i18n},K=await hq(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await uZ(Q,X,async(W,U,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return N0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(J.debug)console.error("Error parsing parameters for @translate directive:",F)}return mZ(U,K,G.fallbackToKey,H)||_.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return e("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let W=[...Q.matchAll(q)];console.warn(`Found ${W.length} @translate matches`),W.forEach((U,B)=>console.warn(`Match ${B}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return Q=await uZ(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,U,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return N0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return mZ(U,K,G.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return e("Translate",`Error in @translate('${U}'): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR)}}),Q}async function uZ($,Z,Y){let J=[];return $.replace(Z,(X,...G)=>{let K=Y(X,...G).then((q)=>({match:X,replacement:q}));return J.push(K),X}),(await Promise.all(J)).reduce((X,{match:G,replacement:K})=>X.replace(G,K),$)}var m5,Y3,$3,u5,a7;var lZ=S(()=>{Y1();R0();Y3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},$3={},u5={},a7={}});var G3={};r(G3,{streamingSuspenseDirective:()=>oZ,streamToResponse:()=>Uz,streamTemplateSimple:()=>Kz,streamTemplate:()=>Zz,renderStreamingPage:()=>Jz,registerStreamingDirectives:()=>zz,processStreamDirectives:()=>Qz,processSectionDirectives:()=>Wz,islandDirective:()=>sZ,generateHydrationRuntime:()=>Bz,extractStreamBoundaries:()=>Gz,createStreamRenderer:()=>qz,buildSuspenseResolveScript:()=>Q3,SUSPENSE_RESOLVER_RUNTIME:()=>nZ});import e4 from"path";function $z($){let Z=[],Y=0,J;iZ.lastIndex=0;while((J=iZ.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=J[1],X=J[2];Z.push({type:"suspense",name:Q,content:X}),Y=J.index+J[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function Zz($,Z={},Y={}){let J={...b1,...Y,streaming:{...X3,...Y.streaming}},Q=J.streaming?.bufferSize||16384;return new ReadableStream({async start(X){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",z=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...Z,__filename:$,__dirname:e4.dirname($)};if(q.trim())await M1(q,W,$);let U=$z(z),B=new Set;if(!U.some((j)=>j.type==="suspense")){let j=J.streaming?.strategy||"auto",H=new RegExp(P1.source,"g");if(!(j!=="manual"&&H.test(z))){let F=await H0(z,W,$,J,B);for(let O=0;O<F.length;O+=Q)X.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(P1.source,"g"),V;while((V=O.exec(z))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let A of F){if(A.start>w){let R=z.slice(w,A.start);if(R.trim()){let T=await H0(R,W,$,J,B);X.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let N=await H0(A.content,W,$,J,B);X.enqueue(N),await new Promise((R)=>setTimeout(R,0)),w=A.end}if(w<z.length){let A=z.slice(w);if(A.trim()){let N=await H0(A,W,$,J,B);X.enqueue(N)}}}}else{let j=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let F=await H0(L.content,W,$,J,B);X.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;X.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
|
|
2527
2527
|
<template data-suspense-fallback>Loading...</template>
|
|
2528
|
-
</div>`),j.set(L.name,
|
|
2528
|
+
</div>`),j.set(L.name,H0(L.content,W,$,J,B))}X.enqueue(`
|
|
2529
2529
|
<script>
|
|
2530
2530
|
(function() {
|
|
2531
2531
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -2541,13 +2541,13 @@ ${Q}`)}function DZ($,Z,Y,J){let Q=$,X=J.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!X?
|
|
|
2541
2541
|
}
|
|
2542
2542
|
};
|
|
2543
2543
|
})();
|
|
2544
|
-
</script>`);let H=Array.from(j.entries()).map(async([L,F])=>{X.enqueue(await
|
|
2544
|
+
</script>`);let H=Array.from(j.entries()).map(async([L,F])=>{X.enqueue(await Q3(L,F))});await Promise.all(H)}X.close()}catch(G){X.error(G)}}})}async function Q3($,Z){try{let J=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
|
|
2545
2545
|
<script>
|
|
2546
2546
|
window.__stxSuspense.resolve('${$}', \`${J}\`);
|
|
2547
2547
|
</script>`}catch(Y){let J=Y instanceof Error?Y.message:String(Y);return`
|
|
2548
2548
|
<script>
|
|
2549
2549
|
window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${u0(J)}</div>');
|
|
2550
|
-
</script>`}}function
|
|
2550
|
+
</script>`}}function Yz($,Z,Y){if(!Z||Z<=0)return $;let J,Q=new Promise((X,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(J))}function Jz($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(nZ),await Promise.all(Z.map(async(X)=>{let G=Yz(X.render(),J,X.id);Q.enqueue(await Q3(X.id,G))}));Q.close()}catch(X){Q.error(X)}}})}function Qz($,Z){return $.replace(Xz,(Y,J,Q)=>{let X=J.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[X]=K,`<div data-suspense="${X}">${q}</div>`})}function Gz($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,Q])=>({id:J,render:Q})):void 0}async function Kz($,Z={},Y={}){let J={...b1,...Y,streaming:{...X3,...Y.streaming}},Q=J.streaming?.bufferSize||16384;return new ReadableStream({async start(X){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",z=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...Z,__filename:$,__dirname:e4.dirname($)};if(q.trim())await M1(q,W,$);let U=new Set,B=J.streaming?.strategy||"auto",_=new RegExp(P1.source,"g");if(!(B!=="manual"&&_.test(z))){let H=await H0(z,W,$,J,U);for(let L=0;L<H.length;L+=Q)X.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(P1.source,"g"),F;while((F=L.exec(z))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=z.slice(O,V.start);if(A.trim()){let N=await H0(A,W,$,J,U);X.enqueue(N)}}let w=await H0(V.content,W,$,J,U);X.enqueue(w),O=V.end}if(O<z.length){let V=z.slice(O);if(V.trim()){let w=await H0(V,W,$,J,U);X.enqueue(w)}}}X.close()}catch(G){X.error(G)}}})}async function qz($,Z={}){let Y={...b1,...Z,streaming:{...X3,...Z.streaming}},J=await Bun.file($).text(),Q=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),X=Q?Q[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},z;P1.lastIndex=0;while((z=P1.exec(G))!==null){let B=z[1],_=z[2];q[B]=_}let W=G.replace(P1,"");return{renderShell:async(B={})=>{let _={...B,__filename:$,__dirname:e4.dirname($)};return await M1(X,_,$),H0(W,_,$,Y,new Set)},renderSection:async(B,_={})=>{try{if(!q[B])return`<div class="error-message">Section "${u0(B)}" not found in template "${u0($)}"</div>`;let j={..._,__filename:$,__dirname:e4.dirname($)};await M1(X,j,$);let H=new Set;return await H0(q[B],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return K0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function zz($={}){let Z=[];if($.streaming?.enabled)Z.push(oZ);if($.hydration?.enabled)Z.push(sZ);return Z}async function Wz($,Z,Y,J={}){return $}function Uz($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(X,G){G.enqueue(Y.encode(X))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(J,{...Z,headers:Q})}function Bz($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,Q=Object.entries(Y).map(([X,G])=>`'${X}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
|
|
2551
2551
|
`);if(Z==="loader")return`
|
|
2552
2552
|
(function() {
|
|
2553
2553
|
window.__stx = window.__stx || {};
|
|
@@ -2689,7 +2689,7 @@ else {
|
|
|
2689
2689
|
else {
|
|
2690
2690
|
stx.hydrate();
|
|
2691
2691
|
}
|
|
2692
|
-
})();`}var
|
|
2692
|
+
})();`}var X3,P1,iZ,nZ=`
|
|
2693
2693
|
<script>
|
|
2694
2694
|
(function(){
|
|
2695
2695
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -2709,25 +2709,25 @@ else {
|
|
|
2709
2709
|
}
|
|
2710
2710
|
};
|
|
2711
2711
|
})();
|
|
2712
|
-
</script
|
|
2713
|
-
${
|
|
2712
|
+
</script>`,Xz,oZ,sZ;var K3=S(()=>{t1();r0();W4();A0();X3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},P1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,iZ=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;Xz=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;oZ={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},sZ={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),X=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",z=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${X}">
|
|
2713
|
+
${z}
|
|
2714
2714
|
<script type="application/json" data-island-props="${G}">
|
|
2715
2715
|
${q?`{${q}}`:"{}"}
|
|
2716
2716
|
</script>
|
|
2717
|
-
</div>`}}});var
|
|
2718
|
-
`).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(
|
|
2719
|
-
`}if(V){let b=[];if(
|
|
2717
|
+
</div>`}}});var tZ={};r(tZ,{warnUnbalancedTags:()=>q3,findUnbalancedTags:()=>aZ});function Z5($){return $.replace(/[^\n]/g," ")}function aZ($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,Z5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,Z5).replace(/<!--[\s\S]*?-->/g,Z5).replace(/\{\{\{[\s\S]*?\}\}\}/g,Z5).replace(/\{\{[\s\S]*?\}\}/g,Z5).replace(/\{!![\s\S]*?!!\}/g,Z5),Y=new Map,J=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,X;while((X=Q.exec(Z))!==null){let K=X[1]==="/",q=X[2],z=X[3]==="/";if(_z.has(q.toLowerCase()))continue;if(z)continue;if(K)J.set(q,(J.get(q)??0)+1);else{let W=Y.get(q);if(W)W.count++;else{let U=Z.slice(0,X.index).split(`
|
|
2718
|
+
`).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(jz.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,z=J.get(K)??0;if(q!==z)G.push({tag:K,opened:q,closed:z,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function q3($,Z){let Y;try{Y=aZ($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(rZ.has(J))return;rZ.add(J);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:X,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let z=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${X}> ${G} opened, ${K} closed \u2014 an unclosed <${X}>${z} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${X}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${X}>.`)}var _z,jz,rZ;var z3=S(()=>{_z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),jz=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);rZ=new Set});import d0 from"path";import W3 from"fs";function eZ($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function $2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class Z2{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,X=J?.__importedComponents;if(X){let _=[Q,Q.toLowerCase(),eZ(Q),$2(Q)];for(let j of _)if(X.has(j))return X.get(j)}let G=[...new Set([`${Q}.stx`,`${eZ(Q)}.stx`,`${$2(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=d0.resolve(d0.dirname(Z),`${Q}.stx`);if(await n(_))return _;return null}let K=[],q=Y.componentsDir||"",z=J?.__originalFilePath;if(z)K.push(d0.join(d0.dirname(z),"components"));if(q)K.push(q);let W=d0.join(d0.dirname(Z),"components");if(!K.includes(W))K.push(W);let U=process.cwd(),B=[d0.resolve(U,"src/components"),d0.resolve(U,"components"),d0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=d0.join(_,j);if(await n(H))return H}try{if(!W3.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=W3.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=d0.join(_,L.name);for(let O of G){let V=d0.join(F,O);if(await n(V))return V}}}catch{}}return null}}var S0;var U3=S(()=>{A0();S0=new Z2});function _1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Hz($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var B3;var _3=S(()=>{B3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=Hz($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),X=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(J.reactive)q.push(`:href="${_1(J.value)}"`);else q.push(`href="${_1(J.value)}"`);if(Q)q.push(`class="${_1(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${_1(X)}"`),q.push(`data-stx-exact-active-class="${_1(G)}"`),K)q.push("data-stx-prefetch");let z=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[W,U]of Object.entries($.static)){if(z.has(W))continue;if(typeof U==="boolean"){if(U)q.push(_1(W))}else q.push(`${_1(W)}="${_1(U)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function O0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function k0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function H3($,Z,Y=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function Y2($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[Q,X]=J.split(":"),G=Oz[Q];if(G)Y.push(`(max-width: ${G}px) ${X}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${X}`)}}else Y.push(J);return Y.join(", ")}function O3($,Z,Y,J){return Z.map((Q)=>`${p5($,Q,void 0,Y,J)} ${Q}w`).join(", ")}function Lz($,Z,Y,J,Q){return Z.map((X)=>{let G=Y?Y*X:void 0;return`${p5($,G,void 0,J,Q)} ${X}x`}).join(", ")}function p5($,Z,Y,J,Q){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let X=[];if(Z)X.push(`w_${Z}`);if(Y)X.push(`h_${Y}`);if(Q)X.push(`f_${Q}`);X.push("q_auto");let G=X.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let X=new URLSearchParams;if(Z)X.set("w",String(Z));if(Y)X.set("h",String(Y));if(Q)X.set("fm",Q);X.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}if(J==="bunny"){let X=new URLSearchParams;if(Z)X.set("width",String(Z));if(Y)X.set("height",String(Y));if(Q)X.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}return $}function Fz($,Z,Y="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var Oz,j3,L3;var F3=S(()=>{Oz={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},j3=[320,640,768,1024,1280,1536,1920];L3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=k0($,"src")||"",Q=k0($,"alt")||"",X=k0($,"width"),G=k0($,"height"),K=k0($,"sizes"),q=k0($,"srcset"),z=k0($,"densities"),W=k0($,"format"),U=k0($,"placeholder"),B=k0($,"placeholderColor")||"#e5e7eb",_=k0($,"provider"),j=k0($,"class")||k0($,"className")||"",H=k0($,"style")||"",L=k0($,"quality"),F=H3($,"lazy",!0),O=H3($,"preload",!1),V=H3($,"picture",!1)||!!W,w=X?Number.parseInt(X):void 0,A=G?Number.parseInt(G):void 0,N=q||"",R="";if(!N&&K)N=O3(J,j3,_,W),R=Y2(K);else if(!N&&z){let b=z.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));N=Lz(J,b,w,_,W)}else if(K)R=Y2(K);let T=[];if(H)T.push(H);if(w&&A)T.push(`aspect-ratio:${w}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let b=Fz(w||16,A||9,B);T.push(`background-image:url(${b})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${O0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=p5(J,w,A,_,W),I=[];if(I.push(`src="${O0(M)}"`),I.push(`alt="${O0(Q)}"`),X)I.push(`width="${O0(X)}"`);if(G)I.push(`height="${O0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${O0(j)}"`);if(T.length>0)I.push(`style="${O0(T.join(";"))}"`);if(N)I.push(`srcset="${O0(N)}"`);if(R)I.push(`sizes="${O0(R)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[b,k]of Object.entries($.static)){if(D.has(b))continue;if(typeof k==="boolean"){if(k)I.push(O0(b))}else I.push(`${O0(b)}="${O0(k)}"`)}let E=`<img ${I.join(" ")} />`,P="";if(O){let k=W==="webp"?"image/webp":W==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${O0(M)}"${k?` type="${k}"`:""}${N?` imagesrcset="${O0(N)}"`:""}${R?` imagesizes="${O0(R)}"`:""} />
|
|
2719
|
+
`}if(V){let b=[];if(W==="avif"||W==="auto"){let k=p5(J,w,A,_,"avif"),y=N?O3(J,j3,_,"avif"):`${k}`;b.push(`<source type="image/avif" srcset="${O0(y)}"${R?` sizes="${O0(R)}"`:""} />`)}if(W==="webp"||W==="auto"){let k=p5(J,w,A,_,"webp"),y=N?O3(J,j3,_,"webp"):`${k}`;b.push(`<source type="image/webp" srcset="${O0(y)}"${R?` sizes="${O0(R)}"`:""} />`)}return`${P}<picture>
|
|
2720
2720
|
${b.join(`
|
|
2721
2721
|
`)}
|
|
2722
2722
|
${E}
|
|
2723
|
-
</picture>`}return`${P}${E}`}}});function
|
|
2724
|
-
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${X};background:${
|
|
2723
|
+
</picture>`}return`${P}${E}`}}});function j1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Y5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var Vz="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",V3;var w3=S(()=>{V3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=Y5($,"src")||"",Q=Y5($,"alt")||"",X=Y5($,"fallback")||"/images/safe-image-default.svg",G=Y5($,"class")||Y5($,"className")||"",K=Y5($,"fallbackClassName")||"",q=[];if(q.push(`src="${j1(J)}"`),q.push(`alt="${j1(Q)}"`),G)q.push(`class="${j1(G)}"`);if(q.push(`data-fallback="${j1(X)}"`),K)q.push(`data-fallback-class="${j1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let z=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[B,_]of Object.entries($.static)){if(z.has(B))continue;if(typeof _==="boolean"){if(_)q.push(j1(B))}else q.push(`${j1(B)}="${j1(_)}"`)}let W=`<img ${q.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${Vz}${W}`;return W}}});function A3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function c5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function $$($,Z,Y){let J=c5($,Z);if(J!==void 0){let Q=Number.parseInt(J,10);if(!Number.isNaN(Q))return Q}return Y}var N3;var R3=S(()=>{N3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=A3(c5($,"color")||"#6366f1"),Q=A3(c5($,"initialColor")||c5($,"initial-color")||""),X=A3(c5($,"height")||"3px"),G=$$($,"duration",2000),K=$$($,"throttle",200),q=$$($,"zIndex",999999)||$$($,"z-index",999999),z=Q?`linear-gradient(to right, ${Q}, ${J})`:J;return`
|
|
2724
|
+
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${X};background:${z};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
2725
2725
|
<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>
|
|
2726
2726
|
</div>
|
|
2727
2727
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
2728
2728
|
<script>
|
|
2729
2729
|
(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)},${K})},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()})})();
|
|
2730
|
-
</script>`}}});function i0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function
|
|
2730
|
+
</script>`}}});function i0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function X2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function wz($,Z,Y){let J=X2($,Z);if(J!==void 0){let Q=Number.parseInt(J,10);if(!Number.isNaN(Q))return Q}return Y}var J2,T3;var M3=S(()=>{J2={"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%)"},T3={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=i0(X2($,"position")||"top-right"),Q=wz($,"max",5),X=J2[J]||J2["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${Q}" style="position:fixed;${X};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
2731
2731
|
<style>
|
|
2732
2732
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
2733
2733
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -2735,7 +2735,7 @@ ${E}
|
|
|
2735
2735
|
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
2736
2736
|
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
2737
2737
|
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
2738
|
-
</style>`}}});function Z$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var
|
|
2738
|
+
</style>`}}});function Z$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var Q2,I3;var D3=S(()=>{Q2={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)"},I3={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=Z$($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=i0(J),X=Z$($,"size")||"md",G=Z$($,"closeOnBackdrop")!=="false",K=Z$($,"closeOnEscape")!=="false",q=Q2[X]||Q2.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" data-close-backdrop="${G}" data-close-escape="${K}" 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">
|
|
2739
2739
|
<div class="stx-modal-panel" style="${q};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)">
|
|
2740
2740
|
<div style="padding:1.5rem">${Z}</div>
|
|
2741
2741
|
</div>
|
|
@@ -2744,8 +2744,8 @@ ${E}
|
|
|
2744
2744
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
2745
2745
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
2746
2746
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
2747
|
-
</style>`}}});function J5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var
|
|
2748
|
-
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${
|
|
2747
|
+
</style>`}}});function J5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var G2,E3;var k3=S(()=>{G2={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},E3={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=J5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=i0(J),X=J5($,"side")||"right",G=J5($,"size")||"md",K=J5($,"closeOnBackdrop")!=="false",q=J5($,"closeOnEscape")!=="false",z=J5($,"overlay")!=="false",W=G2[G]||G2.md,U=X==="left",B=U?"left:0":"right:0",_=U?"translateX(-100%)":"translateX(100%)",j=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${z?"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">
|
|
2748
|
+
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${B};width:${W};max-width:100vw;transform:${_};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">
|
|
2749
2749
|
<div style="padding:1.5rem">${Z}</div>
|
|
2750
2750
|
</div>
|
|
2751
2751
|
</div>
|
|
@@ -2753,22 +2753,22 @@ ${E}
|
|
|
2753
2753
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
2754
2754
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
2755
2755
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
2756
|
-
</style>`}}});var
|
|
2757
|
-
`||T==="\t")F++;O=N+H.length}else{if(F--,F===0){V=R;break}O=R+L.length}}if(V===-1){Q=_;continue}let w=$.slice(_,V),A=V+L.length;J.push({fullMatch:$.slice(X,A),tagName:q,attributes:j,content:w,startIndex:X,endIndex:A,isSelfClosing:!1}),Q=A}}return J}function OY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var LY=S(()=>{R0();A0();X4()});var RY={};r(RY,{processESImports:()=>NY,processComponents:()=>G$});import Q$ from"fs";import v0 from"path";function Nz($,Z,Y){let J={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),X=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){J.events[q]=K;continue}if(q.startsWith("__stx_")){let W=X(q.slice(6));J.serverDynamic[W]=OY(K,Y);continue}if(q.startsWith(":")){let W=X(q.slice(1)),z=K==="true"?W:K;try{if(!Q0(z)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${z}`);J.clientReactive[W]=z;continue}let U=Object.keys(Z),B=G0(z,U)(...Object.values(Z));if(B===void 0){let j=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!U.includes(F))){J.clientReactive[W]=z;continue}}J.serverDynamic[W]=B}catch{J.clientReactive[W]=z}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let z=W[1];if(Q0(z)){let _=G0(z,Object.keys(Z))(...Object.values(Z));J.static[q]=_!=null?String(_):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${z}`);J.static[q]=K}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,z);J.static[q]=K}else{let z=K,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=U.exec(K))!==null)try{let B=_[1];if(!Q0(B)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let H=G0(B,Object.keys(Z))(...Object.values(Z));z=z.replace(_[0],String(H??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,B)}J.static[q]=z}continue}J.static[q]=K}return J}function Rz($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let Q="";while(Y<J&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let X="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,X+=$[Y],Y++;continue}if(K===G){Y++;break}X+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))X+=$[Y],Y++;Z[Q]=X}else Z[Q]="true"}return Z}function VY($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Tz($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let Q=J[1];if(y0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function Mz($){let Z=wY.get($);if(Z)return Z;let Y=new Map,J=[v0.join($,"src"),v0.join($,"dist"),$];function Q(X,G){if(G>6)return;let K;try{K=Q$.readdirSync(X,{withFileTypes:!0})}catch{return}for(let q of K){let W=v0.join(X,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let z=q.name.slice(0,-4);if(!Y.has(z))Y.set(z,W);let U=z.toLowerCase();if(!Y.has(U))Y.set(U,W);let _=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(_))Y.set(_,W)}}}for(let X of J)if(Q(X,0),Y.size>0)break;return wY.set($,Y),Y}function Iz($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=v0.join(Y,"node_modules",$);try{if(Q$.statSync(J).isDirectory())return J}catch{}let Q=v0.dirname(Y);if(Q===Y)return null;Y=Q}}async function NY($,Z,Y,J,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let X=Z.__importedComponents,G=v0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,z,U)=>{let _=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=U,j,H=[];while((j=_.exec(U))!==null){let[L,F,O,V]=j,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=v0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(Q$.statSync(M).isFile())A=M}catch{try{if(Q$.statSync(T).isDirectory())w=T}catch{}}}}else w=Iz(V,G);if(!w&&!A)continue;let N=!1,R=(T,M)=>{X.set(T,M),X.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();X.set(I,M),Q.add(M)};if(O&&A)R(O,A),N=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),M=w?Mz(w):null;for(let{source:I,local:D}of T){let E=null;if(A)E=A;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)R(D,E),N=!0}}if(N)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)B=B.slice(0,H[L].start)+B.slice(H[L].end);return`<script${z}>${B}</script>`}),K}async function Dz($,Z,Y,J,Q){let X=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(X))!==null){let[W,z]=q,U=z.split(",").map((_)=>_.trim().replace(/^['"]|['"]$/g,"")).filter((_)=>_.length>0);for(let _ of U){let B=_.split("/"),H=B[B.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[v0.resolve(v0.dirname(Y),`${_}.stx`),v0.resolve(v0.dirname(Y),_),v0.resolve(J.componentsDir||"components",`${_}.stx`),v0.resolve(J.componentsDir||"components",_),_.endsWith(".stx")?_:`${_}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),J.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${_}`)}X=X.replace(W,""),K.lastIndex=0}return X}async function Ez($,Z,Y,J,Q){let X=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(X))!==null){let z=W.index,U=z+W[0].length-1,_=1,B=U+1;while(B<X.length&&_>0){if(X[B]==="(")_++;else if(X[B]===")"){if(_--,_===0)break}B++}if(_!==0)break;let j=X.substring(U+1,B),H=B+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=N0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);X=X.replace(X.substring(z,H),`[Error parsing component props: ${E}]`);continue}let N="",R=H,M=X.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),R=H+M[0].length;let I=await I1(F,A,N,G,Z,Y,J,K,Q);X=X.substring(0,z)+I+X.substring(R),q.lastIndex=0}return X}async function kz($,Z,Y,J,Q){if(!$)return $;let X=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=x$(X);return X=q.output,X=await _(X,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),X=await _(X,/[A-Z][a-zA-Z0-9]*/,!0),X=await _(X,/[a-z][a-z0-9]*/,!1,Az),X=f$(X,q.scripts),X;async function _(B,j,H,L){if(!B)return B;let F=B,O=HY(F,j,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?jY(w.tagName):w.tagName,N=Rz(w.attributes),R=Nz(N,Z,J),T=y0.getBuiltin(w.tagName),M=T?await z4(A,G,Z,Y,J):!1;if(T&&!M){let P={context:Z,filePath:Y,options:J,dependencies:Q},b=T.render(R,w.content,P);if(Object.keys(R.clientReactive).length>0)b=AY(b,R.clientReactive);if(Object.keys(R.events).length>0){let k=Object.entries(R.events).map(([y,g])=>`${y}="${VY(g)}"`).join(" ");b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}F=F.substring(0,w.startIndex)+b+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await z4(A,G,Z,Y,J))continue;let I={};for(let[P,b]of Object.entries(R.static))I[P]=b;for(let[P,b]of Object.entries(R.serverDynamic))I[P]=b;let E=await I1(A,I,w.content,G,Z,Y,J,K,Q);if(Object.keys(R.clientReactive).length>0)E=AY(E,R.clientReactive);if(Object.keys(R.events).length>0){let P=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(P){let b=Object.entries(R.events).map(([y,g])=>`${y}="${VY(g)}"`).join(" "),k=P[1].length+P[2].length;E=E.substring(0,k)+" "+b+E.substring(k)}}F=F.substring(0,w.startIndex)+E+F.substring(w.endIndex)}return F}}function AY($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let J=Object.entries(Z).map(([X,G])=>`:${X}="${G.replace(/"/g,""")}"`).join(" "),Q=Y[1].length+Y[2].length;return $.substring(0,Q)+" "+J+$.substring(Q)}async function G$($,Z,Y,J,Q){if(!FY)_Y(),FY=!0;let X=await NY($,Z,Y,J,Q);X=await Dz(X,Z,Y,J,Q),X=await Ez(X,Z,Y,J,Q);for(let G=0;G<3;G++){let K=X;if(X=await kz(X,Z,Y,J,Q),X===K)break}if(J.debug){let G=Tz(X);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return X}var FY=!1,Az,wY;var P3=S(()=>{W3();BY();LY();A0();R0();Az=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","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"]);wY=new Map});var bY={};r(bY,{processLoops:()=>v3});function yz($,Z){let Y=/@component\s*\(/g,J=$,Q,X=[];while((Q=Y.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let z=J.substring(K+1,W),U=W+1,_=z.match(/^\s*['"]([^'"]+)['"]/);if(!_)continue;let B=_[1],j=z.slice(_[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=N0(L,Z),O=JSON.stringify(F),V=`@component('${B}', ${O})`;X.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=X[G];J=J.substring(0,K)+W+J.substring(q)}return J}function K$($,Z,Y){let J=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),X;while((X=Q.exec(J))!==null){let G=X.index,K=G+X[0].length-1,q=1,W=K+1,z=null,U=!1;while(W<J.length&&q>0){let j=J[W];if(U){U=!1,W++;continue}if(j==="\\"&&z){U=!0,W++;continue}if(z){if(j===z)z=null;W++;continue}if(j==='"'||j==="'"||j==="`"){z=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let _=J.substring(K+1,W),B=Y(_);J=J.substring(0,G)+B+J.substring(W+1)}return J}function Cz($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Q,X)=>{try{let G=Object.keys(Z),K=Object.values(Z);$4(X);let W=G0(X,G)(...K),z=JSON.stringify(W),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${Q}="${U}"`}catch(G){return J}}),Y}function Pz($,Z){let Y=$;return Y=K$(Y,"@break",(J)=>{try{let X=`!!(${J.trim()})`,G;if(Q0(X)){let K=G0(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(X,Z));return G?q$:""}catch{return""}}),Y=K$(Y,"@continue",(J)=>{try{let X=`!!(${J.trim()})`,G;if(Q0(X)){let K=G0(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(X,Z));return G?z$:""}catch{return""}}),Y}function vz($){let Z=$;return Z=Z.replace(/@break(?!\()/g,q$),Z=Z.replace(/@continue(?!\()/g,z$),Z}function TY($){let Z=$.includes(q$),Y=Z?$.substring(0,$.indexOf(q$)):$;return{hasBreak:Z,content:Y}}function MY($){let Z=$.includes(z$),Y=Z?$.substring(0,$.indexOf(z$)):$;return{hasContinue:Z,content:Y}}function DY($){let Z=$;return Z=K$(Z,"@break",(Y)=>{let J=Y.trim();if(!Z4(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=K$(Z,"@continue",(Y)=>{let J=Y.trim();if(!Z4(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function xz($){let Z=/@forelse\s*\(/g,Y,J=[],Q=/@foreach\s*\(/g,X=/@endforeach/g,G;while((G=Q.exec($))!==null)J.push({pos:G.index,delta:1});while((G=X.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((z,U)=>z.pos-U.pos);let K=[],q=0;for(let z of J)q+=z.delta,K.push({pos:z.pos,depth:q});function W(z){let U=0,_=K.length-1,B=0;while(U<=_){let j=U+_>>1;if(K[j].pos<=z)B=K[j].depth,U=j+1;else _=j-1}return B}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,_=1,B=U+1,j=-1;while(B<$.length&&_>0){if($[B]==="(")_++;else if($[B]===")"){if(_--,_===0){j=B;break}}B++}if(j===-1)continue;let H=$.substring(U+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,w=1,A=V,N=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(w>0&&A<$.length){N.lastIndex=A,R.lastIndex=A;let b=N.exec($),k=R.exec($);if(!k)break;if(b&&b.index<k.index)w++,A=b.index+b[0].length;else{if(w--,w===0){T=k.index;break}A=k.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,D=-1,E=0,P=0;while(P<M.length){let b=M.indexOf("@",P);if(b===-1)break;let k=M.substring(b);if(/^@forelse\s*\(/.test(k))E++,P=b+1;else if(k.startsWith("@endforelse"))E--,P=b+11;else if(E===0&&k.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){D=b;break}P=b+1}else P=b+1}if(D===-1)continue;return{start:z,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function IY($,Z){let Y=$;while(!0){let J=xz(Y);if(!J)break;let{start:Q,end:X,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=J;try{let z;if(Q0(G))z=G0(G,Object.keys(Z))(...Object.values(Z));else z=Z0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=W;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+U+Y.substring(X)}catch(z){let U=z instanceof Error?z.message:String(z),_=e("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,Q)+_+Y.substring(X)}}return Y}function v3($,Z,Y,J){let Q=$;Q=IY(Q,Z);function X(q){let W=/@foreach\s*\(/g,z;while((z=W.exec(q))!==null){let U=z.index,_=z.index+z[0].length-1,B=1,j=_+1,H=-1;while(j<q.length&&B>0){if(q[j]==="(")B++;else if(q[j]===")"){if(B--,B===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(_+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=U,V=L.substring(0,F),w=L.substring(F+4),A=H+1,N=1,R=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&R<q.length){T.lastIndex=R,M.lastIndex=R;let I=T.exec(q),D=M.exec(q);if(!D)break;if(I&&I.index<D.index)N++,R=I.index+I[0].length;else{if(N--,N===0){let E=q.substring(A,D.index),P=D.index+11;return{start:O,end:P,arrayExpr:V,itemVar:w,content:E}}R=D.index+11}}}return null}function G(q,W){let z=q;while(!0){let U=X(z);if(!U)break;let{start:_,end:B,arrayExpr:j,itemVar:H,content:L}=U;try{let F=j.trim(),O;if(Q0(F))O=G0(F,Object.keys(W))(...Object.values(W));else O=Z0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=e("Foreach",`Error in @foreach: ${F} is not iterable`,s.TYPE_ERROR);z=z.substring(0,_)+D+z.substring(B);continue}let w=J?.loops?.useAltLoopVariable??Sz,A=H.trim(),N=null,R,T=!1;if(A.includes("=>")){let D=A.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])N=D[0],R=D[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])R=D[0],N=D[1],T=!0;else R=A}else R=A;let M="",I=O;for(let D=0;D<I.length;D++){let E=I[D],P={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},b={...W,loop:P,$loop:P};if(R.startsWith("[")&&R.endsWith("]")){let h=R.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))h.forEach((m,i)=>{if(m)b[m]=E[i]});else b[R]=E}else b[R]=E;if(N)if(!T&&V&&Array.isArray(E)&&E.length===2)b[N]=E[0],b[R]=E[1];else b[N]=D;let k=Pz(L,b),y=MY(k);if(y.hasContinue){M+=y.content;continue}let g=TY(k);if(g.hasBreak){M+=g.content;break}if(k=IY(k,b),k=G(k,b),k=C1(k,b,Y),k=vz(k),g=TY(k),g.hasBreak){M+=g.content;break}if(y=MY(k),y.hasContinue){M+=y.content;continue}k=s0(k,b,Y),k=Cz(k,b),k=yz(k,b),M+=k}z=z.substring(0,_)+M+z.substring(B)}catch(F){let O=e("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,s.EVALUATION_ERROR);z=z.substring(0,_)+O+z.substring(B)}}return z}Q=G(Q,Z),Q=kY(Q,Z,Y,J);let K=J?.loops?.maxWhileIterations??bz;return Q=hz(Q,Z,K),Q}function EY($){return Z4($)}function kY($,Z,Y,J){let Q=$,X=!0;while(X){X=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=S0(Q,"(",")",q);if(W===-1)break;let z=Q.slice(q+1,W),U=W+1,_=n4(Q.slice(K),"for","endfor");if(_.length===0)break;let B=_[0].content,j=K+_[0].end;if(!EY(z)){let H=e("For",`Unsafe expression in @for: ${z}`,s.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),X=!0;continue}try{let H=fz(z),L=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(H.length>0&&L){let N=gz({forExpr:z,content:B,iterVarNames:H,context:Z,filePath:Y,options:J});Q=Q.substring(0,K)+N+Q.substring(j),X=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});V=DY(V);let A=Function(...F,`
|
|
2756
|
+
</style>`}}});var W2={};r(W2,{resolveCollectionPath:()=>b3,preloadIconCollection:()=>z2,IconBuiltin:()=>Y$});import{existsSync as Az,readFileSync as Nz}from"fs";function q2($){if(K2.has($))return;K2.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function b3($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(Az(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return W0.resolve(Y)}catch{}return null}function Rz($){if(v1.has($))return v1.get($);let Z=b3($);if(!Z)return q2($),null;try{let Y=JSON.parse(Nz(Z,"utf8"));return v1.set($,Y.icons),Y.icons}catch{return null}}async function Tz($){if(v1.has($))return v1.get($);let Z=b3($);if(!Z)return q2($),null;try{let Y=await Bun.file(Z).json();return v1.set($,Y.icons),Y.icons}catch{return null}}function X5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}async function z2($="lucide"){await Tz($)}var v1,K2,Y$;var J$=S(()=>{v1=new Map,K2=new Set;Y$={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=X5($,"name")??X5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",X=J;if(J.includes(":")){let O=J.split(":");Q=O[0],X=O[1]}let G=i0(X5($,"size")||"24"),K=i0(X5($,"color")||"currentColor"),q=i0(X5($,"class")||""),z=i0(X5($,"style")||""),W=v1.get(Q)??Rz(Q);if(!W)return`<!-- Icon: collection "${Q}" not loaded -->`;let U=W[X];if(!U)return`<!-- Icon: "${X}" not found in ${Q} -->`;let B=U.width||24,_=U.height||24,j=`0 0 ${B} ${_}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=z?` style="${z}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function U2($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function B2($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var S3;var y3=S(()=>{S3={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=B2(Z,"fallback"),Q=J.rest,X=B2(Q,"error"),G=X.rest,K=J.region??U2($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=X.region??U2($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function X$($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var C3;var P3=S(()=>{C3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(X$($,"name")||"v").replace(/["'<>]/g,""),Q=(X$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",X=X$($,"class"),G=X$($,"id"),K=[`data-stx-transition-group="${J}"`,X?`class="${X}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function _2(){S0.registerBuiltin(B3),S0.registerBuiltin(L3),S0.registerBuiltin(V3),S0.registerBuiltin(N3),S0.registerBuiltin(T3),S0.registerBuiltin(I3),S0.registerBuiltin(E3),S0.registerBuiltin(Y$),S0.registerBuiltin(S3),S0.registerBuiltin(C3)}var j2=S(()=>{_3();F3();w3();R3();M3();D3();k3();J$();y3();P3();U3();_3();F3();w3();R3();M3();D3();k3();J$();y3();P3()});function H2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function O2($,Z,Y){let J=[],Q=0;while(Q<$.length){let X=$.indexOf("<",Q);if(X===-1)break;let K=$.slice(X+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=X+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=X+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let z=X+1+q.length,W=null,U=z,B=-1,_=!1;while(z<$.length){let H=$[z];if(W){if(H==="\\"&&z+1<$.length){z+=2;continue}if(H===W)W=null;z++;continue}if(H==='"'||H==="'"){W=H,z++;continue}if(H==="/"&&z+1<$.length&&$[z+1]===">"){B=z+2,_=!0;break}if(H===">"){B=z+1;break}z++}if(B===-1){Q=X+1;continue}let j=$.slice(U,_?B-2:B-1).trim();if(_)J.push({fullMatch:$.slice(X,B),tagName:q,attributes:j,content:"",startIndex:X,endIndex:B,isSelfClosing:!0}),Q=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let N=$.indexOf(H,O),R=$.indexOf(L,O);if(R===-1)break;if(N!==-1&&N<R){let T=$[N+H.length];if(T===" "||T===">"||T==="/"||T===`
|
|
2757
|
+
`||T==="\t")F++;O=N+H.length}else{if(F--,F===0){V=R;break}O=R+L.length}}if(V===-1){Q=B;continue}let w=$.slice(B,V),A=V+L.length;J.push({fullMatch:$.slice(X,A),tagName:q,attributes:j,content:w,startIndex:X,endIndex:A,isSelfClosing:!1}),Q=A}}return J}function L2($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var F2=S(()=>{R0();A0();X4()});var T2={};r(T2,{processESImports:()=>R2,processComponents:()=>G$});import Q$ from"fs";import v0 from"path";function Iz($,Z,Y){let J={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),X=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){J.events[q]=K;continue}if(q.startsWith("__stx_")){let z=X(q.slice(6));J.serverDynamic[z]=L2(K,Y);continue}if(q.startsWith(":")){let z=X(q.slice(1)),W=K==="true"?z:K;try{if(!Q0(W)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${W}`);J.clientReactive[z]=W;continue}let U=Object.keys(Z),_=G0(W,U)(...Object.values(Z));if(_===void 0){let j=W.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!U.includes(F))){J.clientReactive[z]=W;continue}}J.serverDynamic[z]=_}catch{J.clientReactive[z]=W}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let z=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let W=z[1];if(Q0(W)){let B=G0(W,Object.keys(Z))(...Object.values(Z));J.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${W}`);J.static[q]=K}}catch(W){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,W);J.static[q]=K}else{let W=K,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=U.exec(K))!==null)try{let _=B[1];if(!Q0(_)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${_}`);continue}let H=G0(_,Object.keys(Z))(...Object.values(Z));W=W.replace(B[0],String(H??""))}catch(_){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,_)}J.static[q]=W}continue}J.static[q]=K}return J}function Dz($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let Q="";while(Y<J&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let X="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,X+=$[Y],Y++;continue}if(K===G){Y++;break}X+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))X+=$[Y],Y++;Z[Q]=X}else Z[Q]="true"}return Z}function w2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ez($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let Q=J[1];if(S0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function kz($){let Z=A2.get($);if(Z)return Z;let Y=new Map,J=[v0.join($,"src"),v0.join($,"dist"),$];function Q(X,G){if(G>6)return;let K;try{K=Q$.readdirSync(X,{withFileTypes:!0})}catch{return}for(let q of K){let z=v0.join(X,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(z,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let W=q.name.slice(0,-4);if(!Y.has(W))Y.set(W,z);let U=W.toLowerCase();if(!Y.has(U))Y.set(U,z);let B=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,z)}}}for(let X of J)if(Q(X,0),Y.size>0)break;return A2.set($,Y),Y}function bz($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=v0.join(Y,"node_modules",$);try{if(Q$.statSync(J).isDirectory())return J}catch{}let Q=v0.dirname(Y);if(Q===Y)return null;Y=Q}}async function R2($,Z,Y,J,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let X=Z.__importedComponents,G=v0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(z,W,U)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=U,j,H=[];while((j=B.exec(U))!==null){let[L,F,O,V]=j,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=v0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(Q$.statSync(M).isFile())A=M}catch{try{if(Q$.statSync(T).isDirectory())w=T}catch{}}}}else w=bz(V,G);if(!w&&!A)continue;let N=!1,R=(T,M)=>{X.set(T,M),X.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();X.set(I,M),Q.add(M)};if(O&&A)R(O,A),N=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),M=w?kz(w):null;for(let{source:I,local:D}of T){let E=null;if(A)E=A;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)R(D,E),N=!0}}if(N)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return z;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${W}>${_}</script>`}),K}async function Sz($,Z,Y,J,Q){let X=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(X))!==null){let[z,W]=q,U=W.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of U){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[v0.resolve(v0.dirname(Y),`${B}.stx`),v0.resolve(v0.dirname(Y),B),v0.resolve(J.componentsDir||"components",`${B}.stx`),v0.resolve(J.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),J.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${B}`)}X=X.replace(z,""),K.lastIndex=0}return X}async function yz($,Z,Y,J,Q){let X=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,z;while((z=q.exec(X))!==null){let W=z.index,U=W+z[0].length-1,B=1,_=U+1;while(_<X.length&&B>0){if(X[_]==="(")B++;else if(X[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=X.substring(U+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=N0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);X=X.replace(X.substring(W,H),`[Error parsing component props: ${E}]`);continue}let N="",R=H,M=X.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),R=H+M[0].length;let I=await I1(F,A,N,G,Z,Y,J,K,Q);X=X.substring(0,W)+I+X.substring(R),q.lastIndex=0}return X}async function Cz($,Z,Y,J,Q){if(!$)return $;let X=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=x$(X);return X=q.output,X=await B(X,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),X=await B(X,/[A-Z][a-zA-Z0-9]*/,!0),X=await B(X,/[a-z][a-z0-9]*/,!1,Mz),X=f$(X,q.scripts),X;async function B(_,j,H,L){if(!_)return _;let F=_,O=O2(F,j,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?H2(w.tagName):w.tagName,N=Dz(w.attributes),R=Iz(N,Z,J),T=S0.getBuiltin(w.tagName),M=T?await z4(A,G,Z,Y,J):!1;if(T&&!M){let P={context:Z,filePath:Y,options:J,dependencies:Q},b=T.render(R,w.content,P);if(Object.keys(R.clientReactive).length>0)b=N2(b,R.clientReactive);if(Object.keys(R.events).length>0){let k=Object.entries(R.events).map(([y,g])=>`${y}="${w2(g)}"`).join(" ");b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}F=F.substring(0,w.startIndex)+b+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await z4(A,G,Z,Y,J))continue;let I={};for(let[P,b]of Object.entries(R.static))I[P]=b;for(let[P,b]of Object.entries(R.serverDynamic))I[P]=b;let E=await I1(A,I,w.content,G,Z,Y,J,K,Q);if(Object.keys(R.clientReactive).length>0)E=N2(E,R.clientReactive);if(Object.keys(R.events).length>0){let P=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(P){let b=Object.entries(R.events).map(([y,g])=>`${y}="${w2(g)}"`).join(" "),k=P[1].length+P[2].length;E=E.substring(0,k)+" "+b+E.substring(k)}}F=F.substring(0,w.startIndex)+E+F.substring(w.endIndex)}return F}}function N2($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let J=Object.entries(Z).map(([X,G])=>`:${X}="${G.replace(/"/g,""")}"`).join(" "),Q=Y[1].length+Y[2].length;return $.substring(0,Q)+" "+J+$.substring(Q)}async function G$($,Z,Y,J,Q){if(!V2)_2(),V2=!0;let X=await R2($,Z,Y,J,Q);X=await Sz(X,Z,Y,J,Q),X=await yz(X,Z,Y,J,Q);for(let G=0;G<3;G++){let K=X;if(X=await Cz(X,Z,Y,J,Q),X===K)break}if(J.debug){let G=Ez(X);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return X}var V2=!1,Mz,A2;var v3=S(()=>{U3();j2();F2();A0();R0();Mz=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","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"]);A2=new Map});var S2={};r(S2,{processLoops:()=>x3});function xz($,Z){let Y=/@component\s*\(/g,J=$,Q,X=[];while((Q=Y.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,z=K+1;while(z<J.length&&q>0){if(J[z]==="(")q++;else if(J[z]===")"){if(q--,q===0)break}z++}if(q!==0)continue;let W=J.substring(K+1,z),U=z+1,B=W.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=W.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=N0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;X.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:z}=X[G];J=J.substring(0,K)+z+J.substring(q)}return J}function K$($,Z,Y){let J=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),X;while((X=Q.exec(J))!==null){let G=X.index,K=G+X[0].length-1,q=1,z=K+1,W=null,U=!1;while(z<J.length&&q>0){let j=J[z];if(U){U=!1,z++;continue}if(j==="\\"&&W){U=!0,z++;continue}if(W){if(j===W)W=null;z++;continue}if(j==='"'||j==="'"||j==="`"){W=j,z++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}z++}if(q!==0)break;let B=J.substring(K+1,z),_=Y(B);J=J.substring(0,G)+_+J.substring(z+1)}return J}function fz($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Q,X)=>{try{let G=Object.keys(Z),K=Object.values(Z);$4(X);let z=G0(X,G)(...K),W=JSON.stringify(z),U=Buffer.from(W,"utf8").toString("base64");return`__stx_${Q}="${U}"`}catch(G){return J}}),Y}function gz($,Z){let Y=$;return Y=K$(Y,"@break",(J)=>{try{let X=`!!(${J.trim()})`,G;if(Q0(X)){let K=G0(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(X,Z));return G?q$:""}catch{return""}}),Y=K$(Y,"@continue",(J)=>{try{let X=`!!(${J.trim()})`,G;if(Q0(X)){let K=G0(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(X,Z));return G?z$:""}catch{return""}}),Y}function hz($){let Z=$;return Z=Z.replace(/@break(?!\()/g,q$),Z=Z.replace(/@continue(?!\()/g,z$),Z}function M2($){let Z=$.includes(q$),Y=Z?$.substring(0,$.indexOf(q$)):$;return{hasBreak:Z,content:Y}}function I2($){let Z=$.includes(z$),Y=Z?$.substring(0,$.indexOf(z$)):$;return{hasContinue:Z,content:Y}}function E2($){let Z=$;return Z=K$(Z,"@break",(Y)=>{let J=Y.trim();if(!Z4(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=K$(Z,"@continue",(Y)=>{let J=Y.trim();if(!Z4(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function dz($){let Z=/@forelse\s*\(/g,Y,J=[],Q=/@foreach\s*\(/g,X=/@endforeach/g,G;while((G=Q.exec($))!==null)J.push({pos:G.index,delta:1});while((G=X.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((W,U)=>W.pos-U.pos);let K=[],q=0;for(let W of J)q+=W.delta,K.push({pos:W.pos,depth:q});function z(W){let U=0,B=K.length-1,_=0;while(U<=B){let j=U+B>>1;if(K[j].pos<=W)_=K[j].depth,U=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(z(Y.index)>0)continue;let W=Y.index,U=Y.index+Y[0].length-1,B=1,_=U+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(U+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,w=1,A=V,N=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(w>0&&A<$.length){N.lastIndex=A,R.lastIndex=A;let b=N.exec($),k=R.exec($);if(!k)break;if(b&&b.index<k.index)w++,A=b.index+b[0].length;else{if(w--,w===0){T=k.index;break}A=k.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,D=-1,E=0,P=0;while(P<M.length){let b=M.indexOf("@",P);if(b===-1)break;let k=M.substring(b);if(/^@forelse\s*\(/.test(k))E++,P=b+1;else if(k.startsWith("@endforelse"))E--,P=b+11;else if(E===0&&k.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){D=b;break}P=b+1}else P=b+1}if(D===-1)continue;return{start:W,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function D2($,Z){let Y=$;while(!0){let J=dz(Y);if(!J)break;let{start:Q,end:X,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:z}=J;try{let W;if(Q0(G))W=G0(G,Object.keys(Z))(...Object.values(Z));else W=Z0(G,Z);let U;if(!Array.isArray(W)||W.length===0)U=z;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+U+Y.substring(X)}catch(W){let U=W instanceof Error?W.message:String(W),B=e("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(X)}}return Y}function x3($,Z,Y,J){let Q=$;Q=D2(Q,Z);function X(q){let z=/@foreach\s*\(/g,W;while((W=z.exec(q))!==null){let U=W.index,B=W.index+W[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=U,V=L.substring(0,F),w=L.substring(F+4),A=H+1,N=1,R=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&R<q.length){T.lastIndex=R,M.lastIndex=R;let I=T.exec(q),D=M.exec(q);if(!D)break;if(I&&I.index<D.index)N++,R=I.index+I[0].length;else{if(N--,N===0){let E=q.substring(A,D.index),P=D.index+11;return{start:O,end:P,arrayExpr:V,itemVar:w,content:E}}R=D.index+11}}}return null}function G(q,z){let W=q;while(!0){let U=X(W);if(!U)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=U;try{let F=j.trim(),O;if(Q0(F))O=G0(F,Object.keys(z))(...Object.values(z));else O=Z0(F,z);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=e("Foreach",`Error in @foreach: ${F} is not iterable`,s.TYPE_ERROR);W=W.substring(0,B)+D+W.substring(_);continue}let w=J?.loops?.useAltLoopVariable??vz,A=H.trim(),N=null,R,T=!1;if(A.includes("=>")){let D=A.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])N=D[0],R=D[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])R=D[0],N=D[1],T=!0;else R=A}else R=A;let M="",I=O;for(let D=0;D<I.length;D++){let E=I[D],P={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},b={...z,loop:P,$loop:P};if(R.startsWith("[")&&R.endsWith("]")){let h=R.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))h.forEach((m,i)=>{if(m)b[m]=E[i]});else b[R]=E}else b[R]=E;if(N)if(!T&&V&&Array.isArray(E)&&E.length===2)b[N]=E[0],b[R]=E[1];else b[N]=D;let k=gz(L,b),y=I2(k);if(y.hasContinue){M+=y.content;continue}let g=M2(k);if(g.hasBreak){M+=g.content;break}if(k=D2(k,b),k=G(k,b),k=C1(k,b,Y),k=hz(k),g=M2(k),g.hasBreak){M+=g.content;break}if(y=I2(k),y.hasContinue){M+=y.content;continue}k=s0(k,b,Y),k=fz(k,b),k=xz(k,b),M+=k}W=W.substring(0,B)+M+W.substring(_)}catch(F){let O=e("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,s.EVALUATION_ERROR);W=W.substring(0,B)+O+W.substring(_)}}return W}Q=G(Q,Z),Q=b2(Q,Z,Y,J);let K=J?.loops?.maxWhileIterations??Pz;return Q=pz(Q,Z,K),Q}function k2($){return Z4($)}function b2($,Z,Y,J){let Q=$,X=!0;while(X){X=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,z=b0(Q,"(",")",q);if(z===-1)break;let W=Q.slice(q+1,z),U=z+1,B=n4(Q.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!k2(W)){let H=e("For",`Unsafe expression in @for: ${W}`,s.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),X=!0;continue}try{let H=mz(W),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let N=uz({forExpr:W,content:_,iterVarNames:H,context:Z,filePath:Y,options:J});Q=Q.substring(0,K)+N+Q.substring(j),X=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});V=E2(V);let A=Function(...F,`
|
|
2758
2758
|
let result = '';
|
|
2759
|
-
for (${
|
|
2759
|
+
for (${W}) {
|
|
2760
2760
|
result += \`${V}\`;
|
|
2761
2761
|
}
|
|
2762
2762
|
return result;
|
|
2763
|
-
`)(...O);Q=Q.substring(0,K)+A+Q.substring(j),X=!0}catch(H){let L=e("For",`Error in @for(${
|
|
2763
|
+
`)(...O);Q=Q.substring(0,K)+A+Q.substring(j),X=!0}catch(H){let L=e("For",`Error in @for(${W}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),X=!0}}return Q}function mz($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let X=Y[1];return X.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let z=q.indexOf(":");if(z>=0&&X.startsWith("{")){let B=q.slice(z+1).trim(),_=B.indexOf("=");return(_>=0?B.slice(0,_):B).trim()}let W=q.indexOf("="),U=(W>=0?q.slice(0,W):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function uz($){let{forExpr:Z,content:Y,iterVarNames:J,context:Q,filePath:X,options:G}=$,K=Object.keys(Q),q=Object.values(Q),z=Function(...K,"__pushIter",`
|
|
2764
2764
|
for (${Z}) {
|
|
2765
2765
|
__pushIter([${J.join(", ")}])
|
|
2766
2766
|
}
|
|
2767
|
-
`),
|
|
2767
|
+
`),W=[];z(...q,(_)=>{W.push(_)});let U=X??"inline.stx",B="";for(let _ of W){let j={...Q};J.forEach((L,F)=>{j[L]=_[F]});let H=b2(Y,j,X,G);H=C1(H,j,U),H=s0(H,j,U),B+=H}return B}function pz($,Z,Y){let J=$,Q=!0;while(Q){Q=!1;let X=J.match(/@while\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=G+X[0].length-1,q=b0(J,"(",")",K);if(q===-1)break;let z=J.slice(K+1,q),W=n4(J.slice(G),"while","endwhile");if(W.length===0)break;let U=W[0].content,B=G+W[0].end;if(!k2(z)){let _=e("While",`Unsafe expression in @while: ${z}`,s.UNSAFE_EXPRESSION);J=J.substring(0,G)+_+J.substring(B),Q=!0;continue}try{let _=Object.keys(Z),j=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=E2(H);let F=Function(..._,`
|
|
2768
2768
|
let result = '';
|
|
2769
2769
|
let maxIterations = ${Y}; // Configurable safety limit
|
|
2770
2770
|
let counter = 0;
|
|
2771
|
-
while (${
|
|
2771
|
+
while (${z} && counter < maxIterations) {
|
|
2772
2772
|
counter++;
|
|
2773
2773
|
result += \`${H}\`;
|
|
2774
2774
|
}
|
|
@@ -2776,8 +2776,8 @@ ${E}
|
|
|
2776
2776
|
result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
2777
2777
|
}
|
|
2778
2778
|
return result;
|
|
2779
|
-
`)(...j);J=J.substring(0,G)+F+J.substring(
|
|
2780
|
-
`)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},
|
|
2779
|
+
`)(...j);J=J.substring(0,G)+F+J.substring(B),Q=!0}catch(_){let j=e("While",`Error in @while(${z}): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR);J=J.substring(0,G)+j+J.substring(B),Q=!0}}return J}var Pz=1000,vz=!1,q$="<!--__STX_BREAK__-->",z$="<!--__STX_CONTINUE__-->";var f3=S(()=>{s4();Y1();r0();o4();R0()});import U0 from"path";function g3($,Z){let Y=0;for(let J=Z;J<$.length;J++){let Q=$[J];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return J}return-1}function cz($,Z,Y){let J=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),X=Q.exec(J);while(X){let G=X.index,K=G+X[0].length-1,q=1,z=K+1;while(z<J.length&&q>0){if(J[z]==="(")q++;else if(J[z]===")")q--;z++}if(q!==0)break;let W=J.substring(K+1,z-1),U=`${Y}(${W})`;J=J.substring(0,G)+U+J.substring(z),Q.lastIndex=G+U.length,X=Q.exec(J)}return J}function lz($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function iz($){let Z=$,Y=[],J=new Set,Q=0,X=0,G=Z.length,K=(U)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===U){X++;return}X++}},q=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let U=1;while(X<G&&U>0)if(Z[X]==="{")U++,X++;else if(Z[X]==="}")U--,X++;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},z=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
|
|
2780
|
+
`)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},W=()=>{if(Q!==0)return;let U=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!J.has(j))Y.push(j),J.add(j);return}let B=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!J.has(j))Y.push(j),J.add(j);return}let _=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!J.has(j))Y.push(j),J.add(j)}};while(X<G){if(z())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){Q++,X++;continue}if(Z[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))W();X++}return Y.join(", ")}function C2($,Z=""){return`
|
|
2781
2781
|
(function() {
|
|
2782
2782
|
var { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect, defineProps, withDefaults, defineEmits, defineExpose, defineSlots } = window.stx;
|
|
2783
2783
|
var __destroyHooks = [];
|
|
@@ -2786,11 +2786,11 @@ ${E}
|
|
|
2786
2786
|
|
|
2787
2787
|
${$}
|
|
2788
2788
|
${Z}})();
|
|
2789
|
-
`}function
|
|
2789
|
+
`}function P2($,Z){return`
|
|
2790
2790
|
// Register scope variables for STX runtime
|
|
2791
2791
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
2792
2792
|
var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
|
|
2793
|
-
${
|
|
2793
|
+
${iz($).split(",").map((X)=>X.trim()).filter(Boolean).map((X)=>` try { __scopeRegistration[${JSON.stringify(X)}] = ${X}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
2794
2794
|
`)}
|
|
2795
2795
|
// #1767: when the bundler renamed a component const that collided with an
|
|
2796
2796
|
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
@@ -2798,45 +2798,42 @@ ${uz($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeR
|
|
|
2798
2798
|
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
2799
2799
|
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
2800
2800
|
window.stx._scopes['${Z}'] = __scopeRegistration;
|
|
2801
|
-
|
|
2801
|
+
`}function nz($,Z){let Y=P2($,Z),J=`
|
|
2802
2802
|
(function() {
|
|
2803
2803
|
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
|
|
2804
2804
|
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
2805
2805
|
if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
|
|
2806
|
-
try {`,
|
|
2806
|
+
try {`,Q=`
|
|
2807
2807
|
} finally {
|
|
2808
2808
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
2809
2809
|
}
|
|
2810
|
-
})();`;return
|
|
2810
|
+
})();`;return J+C2($,Y)+`
|
|
2811
2811
|
} finally {
|
|
2812
2812
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
2813
2813
|
}
|
|
2814
|
-
})();`}function
|
|
2815
|
-
`;continue}if(c)try{let{extractVariables:$0}=await Promise.resolve().then(() => (
|
|
2816
|
-
|
|
2817
|
-
window.stx._scopes['${b}'] = { __destroyCallbacks: __destroyHooks };
|
|
2818
|
-
`,v=yY(k0,f0);P+=`${F0}<script data-stx-scoped${$0?` ${$0}`:""}>${v}</script>
|
|
2819
|
-
`}}if(b){let h=cz(A,b);if(A=h.html,h.mergedIntoExisting)P=P.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${h.mergedIntoExisting}']`),b=h.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await g3(A,I,O,J,Q,X);let{processLoops:k}=await Promise.resolve().then(() => (x3(),bY)),y=k(A,I,O);y=C1(y,I,O);let g=p1(w);if(y=s0(y,I,O,{forceSignals:g}),M)y+=`
|
|
2814
|
+
})();`}function oz($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let X=Y[1],G=Y[2],K=Y[3];return{html:`${X}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function rz($){if($.__onceStore instanceof Set)return $.__onceStore;return sz}async function h3($,Z,Y,J,Q,X=new Set){let G=J.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=cz($,"@partial","@include"),q=rz(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let N=A[1],R=z(N,G,Y),T="";if(R&&await Bun.file(R).exists())Q.add(R),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,A=V+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let N=K.substring(V+1,A-1),R=g3(N,0);if(R===-1){L.lastIndex=A;continue}let T=N.substring(0,R).trim(),M=N.substring(R+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let D=I[1],E=M.substring(I[0].length),P,b=g3(E,0);if(b!==-1)P=E.substring(b+1).trim();try{let k=`Boolean(${T})`,y;if(Q0(k)){let m=G0(k,Object.keys(Z));y=Boolean(m(...Object.values(Z)))}else y=Boolean(Z0(k,Z));let g=H?!y:y,h="";if(g){let m=z(D,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);h=`@include('${D}'${P?`, ${P}`:""})`}K=K.substring(0,O)+h+K.substring(A),L.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k),g=K0("Include",`Error evaluating ${j} condition: ${y}`,Y,$,O);K=K.substring(0,O)+g+K.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let[,R,T,M,I]=N;try{let D,E=T.trim();if(Q0(E))D=G0(E,Object.keys(Z))(...Object.values(Z));else D=Z0(E,Z);let P="";if(Array.isArray(D)&&D.length>0)for(let b of D){let k={...Z,[M]:b},y=await U(R,k,$,L);P+=y}else if(I)P=await U(I,{},$,L);K=K.substring(0,L)+P+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+K0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let R=N[1],T=w.slice(N[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let P=1,b=1;while(b<T.length&&P>0){if(T[b]==="{")P++;else if(T[b]==="}"){if(P--,P===0)break}b++}M=T.substring(0,b+1),T=T.slice(b+1)}let D,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let P=JSON.parse(R.replace(/'/g,'"')),b={};if(M)try{b=N0(M,Z)}catch(y){let g=y instanceof Error?y.message:String(y);if(J.debug){let h=K0("Include",`Error parsing includeFirst variables: ${g}`,Y,$,L,A);K=K.replace(A,()=>h)}else K=K.replace(A,()=>D||"");continue}let k=!1;for(let y of P){let g=z(y,G,Y);if(!g)continue;if(await n(g)){let h=await U(y,b,$,L);K=K.replace(A,()=>h),k=!0;break}}if(!k)if(D!==void 0)K=K.replace(A,()=>D);else if(J.debug){let y=K0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,L,A);K=K.replace(A,()=>y)}else K=K.replace(A,"")}catch(P){let b=P instanceof Error?P.message:String(P),k=K0("Include",`Error processing @includeFirst: ${b}`,Y,$,L,A);K=K.replace(A,()=>k)}j.lastIndex=0}}function z(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=U0.resolve(H,F);else w=U0.resolve(V,F);let A=U0.normalize(w),N=A.startsWith(O+U0.sep)||A===O,R=A.startsWith(V+U0.sep)||A===V,T=!1,M=U0.dirname(V);if(A.startsWith(M+U0.sep)){if(!U0.relative(M,A).split(U0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))T=!0}if(!N&&!R&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let W=U0.resolve(Y);X.add(W);async function U(j,H={},L,F){let O=z(j,G,Y);if(!O)return K0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=U0.resolve(O);if(X.has(V)){let w=[...X,V].map((A)=>U0.basename(A)).join(" -> ");return K0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(h){let m=h instanceof Error?h.message:String(h);return K0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:h}=await Promise.resolve().then(() => (K3(),G3));w=h(w,Z)}if(w&&(J.debug||!C5()&&!v4()))try{let{warnUnbalancedTags:h}=await Promise.resolve().then(() => (z3(),tZ));h(w,O)}catch{}let A=w;try{let{processESImports:h}=await Promise.resolve().then(() => (v3(),T2));await h(w,Z,O,J,Q)}catch(h){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,h instanceof Error?h.message:h)}let N=A.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|x-else|@for|@if|@else|:for|:if|:else)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(N)A=N[1].trim();let T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[h,m]of Object.entries(H))I[h]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...w.matchAll(D)],P="",b=null;for(let h of E){let m=h[1]||"",i=h[2]||"",c=m.includes("server"),z0=A1(m),F0="";try{let{extractAndStripCssImports:$0,renderVendorStyleTags:I0}=await Promise.resolve().then(() => (N5(),d6)),f0=$0(i,{filePath:O,projectRoot:process.cwd()});i=f0.code,F0=I0(f0.styles)}catch($0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,$0 instanceof Error?$0.message:$0)}if(z0&&i.trim())i=N1(i);if(!c)try{let{hasUserImports:$0,bundleClientScript:I0}=await Promise.resolve().then(() => (t5(),a5));if($0(i))i=await I0(i,O,{projectRoot:process.cwd()})}catch($0){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,$0 instanceof Error?$0.message:$0)}let _0=lz(i);if(_0&&!c){b=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++y2}`;let $0=Z1(i),I0=nz($0,b);P+=`${F0}<script data-stx-scoped>${I0}</script>
|
|
2815
|
+
`;continue}if(c)try{let{extractVariables:$0}=await Promise.resolve().then(() => (b5(),q4));await $0(i,I,O)}catch($0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,$0)}if(!c&&!_0){let $0=m.replace(/\bclient\b/i,"").trim();b=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++y2}`;let I0=Z1(i),f0=P2(I0,b),v=C2(I0,f0);P+=`${F0}<script data-stx-scoped${$0?` ${$0}`:""}>${v}</script>
|
|
2816
|
+
`}}if(b){let h=oz(A,b);if(A=h.html,h.mergedIntoExisting)P=P.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${h.mergedIntoExisting}']`),b=h.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await h3(A,I,O,J,Q,X);let{processLoops:k}=await Promise.resolve().then(() => (f3(),S2)),y=k(A,I,O);y=C1(y,I,O);let g=p1(w);if(y=s0(y,I,O,{forceSignals:g}),M)y+=`
|
|
2820
2817
|
`+M;if(P)y+=`
|
|
2821
|
-
`+P;return y}catch(w){let A=w instanceof Error?w.message:String(w);return K0("Include",`Error processing include ${j}: ${A}`,Y,L,F)}}let
|
|
2822
|
-
`)})}var
|
|
2818
|
+
`+P;return y}catch(w){let A=w instanceof Error?w.message:String(w);return K0("Include",`Error processing include ${j}: ${A}`,Y,L,F)}}let B=/@include\s*\(/g,_;while((_=B.exec(K))!==null){let j=_.index,H=j+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){B.lastIndex=F;continue}let A=w[1],N,R=V.substring(w[0].length),T=g3(R,0);if(T!==-1)N=R.substring(T+1).trim();let M={};if(N)try{M=N0(N,Z)}catch(D){let E=D instanceof Error?D.message:String(D);K=K.replace(O,K0("Include",`Error parsing include variables for ${A}: ${E}`,Y,$,j)),B.lastIndex=0;continue}let I=await U(A,M,$,j);K=K.substring(0,j)+I+K.substring(F),B.lastIndex=0}return K}function d3($,Z){let Y=$;function J(Q,X,G,K){let q=Q,z=!0;while(z){z=!1;let W=new RegExp(`@${X}\\(['"]([^'"]+)['"]\\)`),U=q.match(W);if(!U||U.index===void 0)break;let B=U.index,_=U[1],j=B+U[0].length,H=new RegExp(`@${X}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let A=q.slice(O),N=A.match(H),R=A.match(L),T=N?O+N.index:1/0,M=R?O+R.index:1/0;if(T<M)F++,O=T+(N[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let w=q.slice(j,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(w);else Z[_].push(w);q=q.substring(0,B)+q.substring(V+`@${G}`.length),z=!0}return q}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function m3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
|
|
2819
|
+
`)})}var y2=0,aF,sz;var v2=S(()=>{s4();r0();i1();R0();A0();aF=new I5(500),sz=new Set});import*as u3 from"path";async function x2($,Z,Y=""){if(u3.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return g2($,Z,Y,"@js","@endjs")}async function f2($,Z,Y=""){if(u3.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((X)=>({...X,displayName:`User ${X.id}: ${X.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return g2($,Z,Y,"@ts","@endts")}async function g2($,Z,Y,J,Q){let X=$,G=l1(`${J}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:z,content:W,index:U}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=W.trim();if(J==="@ts")j=j.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 L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
|
|
2823
2820
|
${j}
|
|
2824
2821
|
${F}
|
|
2825
|
-
`,w=Function(...
|
|
2826
|
-
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${u0(
|
|
2827
|
-
`)}}}return X}async function
|
|
2828
|
-
`,H=`${j}${
|
|
2829
|
-
@endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+j.length}return Z}function
|
|
2822
|
+
`,w=Function(...B,O)(..._);if(w&&typeof w==="object")Object.assign(Z,w);X=X.replace(z,"")}catch(B){console.error(`Error executing ${J} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=K0(`${J} Directive`,`Error executing code: ${_}`,Y,$,U,z);console.error(j),X=X.replace(z,"")}return X}var h2=S(()=>{i1();A0()});function az($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function d2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,Q,X)=>{return az(J,X||"_method")})}async function m2($,Z,Y,J,Q){if(!J.middleware||J.middleware.length===0)return $;let X=$,G=J.middleware.filter((K)=>K.timing===Q);if(G.length===0)return X;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(X,Z,Y,J);if(typeof q==="string")X=q;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(J.debug)console.error(`Error in middleware ${K.name}:`,q);if(J.debug){let z=K0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);X=X.replace(/<body[^>]*>/,`$&
|
|
2823
|
+
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${u0(z)}</div>
|
|
2824
|
+
`)}}}return X}async function u2($,Z,Y,J){return m2($,Z,Y,J,"before")}async function p2($,Z,Y,J){return m2($,Z,Y,J,"after")}var c2=S(()=>{r0();A0()});import{defineRoute as WV,defineRoutes as UV,resetRoutes as BV,route as _V,setAppUrl as jV}from"stx-router";import{route as tz}from"stx-router";function l2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,Q,X)=>{try{let G=Q?N0(Q,{}):{};return tz(J,G,X==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var i2=S(()=>{R0()});async function n2($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(l5.exact[$])for(let J of l5.exact[$])await Promise.resolve(J(Z,$));if(l5.exact[Y])for(let J of l5.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:Q}of l5.patterns)if(J.test($)||J.test(Y))await Promise.resolve(Q(Z,$))}var l5;var o2=S(()=>{l5={patterns:[],exact:{}}});function s2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>s2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function r2($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],X;while((X=J.exec($))!==null)Q.push([X.index,X.index+X[0].length]);function G(z){return Q.some(([W,U])=>z>=W&&z<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((X=K.exec(Y))!==null){if(G(X.index))continue;let z=X[0],W=X[2];if(!W||!W.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=W,j=!1;while((B=U.exec(W))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${L})`)(...O);if(H==="class"){let N=s2(A);if(N){let R=_.match(/\sclass="([^"]*)"/);if(R)_=_.replace(R[0],` class="${R[1]} ${N}"`);else _=_.replace(B[0],` class="${N}"`)}else _=_.replace(B[0],"");j=!0;continue}if(ez.has(H)){if(A)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(B[0],"");else{let N=String(A).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");_=_.replace(B[0],` ${H}="${N}"`)}j=!0}catch{continue}}if(j){let H=z.endsWith("/>")?" /":"",F=`<${X[1]}${_}${H}>`;q.push({start:X.index,end:X.index+z.length,replacement:F})}}for(let z=q.length-1;z>=0;z--){let{start:W,end:U,replacement:B}=q[z];Y=Y.slice(0,W)+B+Y.slice(U)}return Y}var ez;var a2=S(()=>{ez=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function x1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;return{full:J[0],tag:J[1],attrs:J[2],selfClosing:J[3].includes("/")||$W.has(J[1].toLowerCase()),start:J.index,end:J.index+J[0].length}}function YW($,Z,Y){let J=1,Q=Y,X=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q;let K=X.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)J++,Q=K.index+K[0].length;else{if(J--,J===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function a0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=YW($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function t2($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function Q5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function H1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function O1($,Z,Y){let J=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function JW($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function XW($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let Q=Q5(J.attrs,"v-for");if(Q===null){Y=J.end;continue}let X=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!X){Y=J.end;continue}let G=X[1].trim(),K=X[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let z=H1(J.attrs,"v-for"),W=H1(z,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=a0(Z,J),B=Z.slice(U.outerStart,U.outerEnd),_=O1(B,{...J,start:0,end:J.end-J.start},W),j=`@foreach(${q})
|
|
2825
|
+
`,H=`${j}${_}
|
|
2826
|
+
@endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+j.length}return Z}function QW($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let Q=Q5(J.attrs,"v-if");if(Q===null){Y=J.end;continue}let X=[],G=a0(Z,J),K=H1(J.attrs,"v-if"),q=O1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},K);X.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:J});let z=G.outerEnd,W=!0;while(W){let H=Z.slice(z).match(/^\s*/),L=H?H[0].length:0,F=x1(Z,z+L);if(!F){W=!1;break}let O=Q5(F.attrs,"v-else-if"),V=t2(F.attrs,"v-else");if(O!==null){let w=a0(Z,F),A=H1(F.attrs,"v-else-if"),N=O1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);X.push({type:"else-if",expr:O,outerStart:z,outerEnd:w.outerEnd,element:N,parsedTag:F}),z=w.outerEnd}else if(V){let w=a0(Z,F),A=H1(F.attrs,"v-else"),N=O1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);X.push({type:"else",outerStart:z,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=!1}else W=!1}let U=[];for(let H of X)if(H.type==="if")U.push(`@if(${H.expr})
|
|
2830
2827
|
${H.element}`);else if(H.type==="else-if")U.push(`@elseif(${H.expr})
|
|
2831
2828
|
${H.element}`);else U.push(`@else
|
|
2832
|
-
${H.element}`);U.push("@endif");let
|
|
2833
|
-
`),
|
|
2834
|
-
${
|
|
2835
|
-
@endonce`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function
|
|
2836
|
-
${$.slice(Z)}`}function
|
|
2829
|
+
${H.element}`);U.push("@endif");let B=U.join(`
|
|
2830
|
+
`),_=X[0].outerStart,j=X[X.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function GW($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function KW($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let Q=J.attrs,X=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){X=!0;let W=K[1],U=K[2],B=K[3];Q=Q.replace(K[0],""),Q+=` :${W}="${B}" @update:${W}="${B} = $event"`,K=Q.match(G)}if(X){let W=a0(Z,J),U=Z.slice(W.outerStart,W.outerEnd),B=O1(U,{...J,start:0,end:J.end-J.start},Q);Z=Z.slice(0,W.outerStart)+B+Z.slice(W.outerEnd),Y=W.outerStart+B.length;continue}let q=Q5(J.attrs,"v-model");if(q===null){Y=J.end;continue}if(ZW.has(J.tag.toLowerCase())){let W=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=a0(Z,J),B=Z.slice(U.outerStart,U.outerEnd),_=O1(B,{...J,start:0,end:J.end-J.start},W);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}else{let W=J.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=a0(Z,J),B=Z.slice(U.outerStart,U.outerEnd),_=O1(B,{...J,start:0,end:J.end-J.start},W);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}}return Z}function qW($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function zW($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function WW($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let Q=Q5(J.attrs,"v-html");if(Q===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=a0(Z,J),G=H1(J.attrs,"v-html"),K=J.selfClosing?" /":"",q=`<${J.tag}${G}${K}>{!! ${Q} !!}</${J.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function UW($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let Q=Q5(J.attrs,"v-text");if(Q===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=a0(Z,J),G=H1(J.attrs,"v-text"),K=J.selfClosing?" /":"",q=`<${J.tag}${G}${K}>{{ ${Q} }}</${J.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function BW($){return $.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 _W($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;if(!t2(J.attrs,"v-once")){Y=J.end;continue}let Q=H1(J.attrs,"v-once"),X=a0(Z,J),G=Z.slice(X.outerStart,X.outerEnd),q=`@once
|
|
2831
|
+
${O1(G,{...J,start:0,end:J.end-J.start},Q)}
|
|
2832
|
+
@endonce`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function jW($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function HW($){return $.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 e2($){if(!JW($))return $;let Z=$;return Z=XW(Z),Z=QW(Z),Z=_W(Z),Z=qW(Z),Z=zW(Z),Z=KW(Z),Z=GW(Z),Z=HW(Z),Z=WW(Z),Z=UW(Z),Z=BW(Z),Z=jW(Z),Z}var $W,ZW;var $Y=S(()=>{$W=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ZW=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 W$($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}async function ZY($,Z,Y,J,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let z=K.length-1;z>=0;z--){let W=K[z];try{let U=Z0(W.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${W$(W.expr)}" -->`;X=X.slice(0,W.index)+O+X.slice(W.index+W.full.length);continue}let B=W.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=Z0(V,Z)}catch{_[O]=V}else _[O]=V}let L=J.componentsDir||"components",F=await I1(U,_,W.slotContent,L,Z,Y,J,new Set,Q??new Set);X=X.slice(0,W.index)+F+X.slice(W.index+W.full.length)}catch(U){let B=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${W$(B)} -->`;X=X.slice(0,W.index)+_+X.slice(W.index+W.full.length)}}return X=await OW(X,Z,Y,J,Q),X}async function OW($,Z,Y,J,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let z=K.length-1;z>=0;z--){let W=K[z];try{let U=Z0(W.expr,Z);if(!U||typeof U!=="string"){let j=`<!-- dynamic component: could not resolve "${W$(W.expr)}" -->`;X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length);continue}let B=J.componentsDir||"components",_=await I1(U,{},"",B,Z,Y,J,new Set,Q??new Set);X=X.slice(0,W.index)+_+X.slice(W.index+W.full.length)}catch(U){let B=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${W$(B)} -->`;X=X.slice(0,W.index)+_+X.slice(W.index+W.full.length)}}return X}var YY=S(()=>{A0();R0()});function JY($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
|
|
2833
|
+
${$.slice(Z)}`}function LW($,Z={},Y={}){let{title:J="stx App",lang:Q="en",meta:X=[],link:G=[],script:K=[],headRaw:q="",bodyClass:z="",bodyAttrs:W={}}=Z,U=Y.title||J,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...X].map((A)=>{return` <meta ${Object.entries(A).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
|
|
2837
2834
|
`),H=G.map((A)=>{return` <link ${Object.entries(A).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
|
|
2838
2835
|
`),L=K.map((A)=>{if(A.src)return` <script ${Object.entries(A).filter(([R])=>R!=="content").map(([R,T])=>`${R}="${T}"`).join(" ")}></script>`;if(A.content)return` <script>${A.content}</script>`;return""}).filter(Boolean).join(`
|
|
2839
|
-
`),F=Object.entries(
|
|
2836
|
+
`),F=Object.entries(W).map(([A,N])=>` ${A}="${N}"`).join(""),O=z?` class="${z}"`:"",V=[j,` <title>${U}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((A)=>` ${A}`),...(Y.headScripts||[]).map((A)=>` ${A}`),Y.headStack||""].filter(Boolean),w=[$,...(Y.bodyScripts||[]).map((A)=>A),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
2840
2837
|
<html lang="${Q}">
|
|
2841
2838
|
<head>
|
|
2842
2839
|
${V.join(`
|
|
@@ -2846,9 +2843,9 @@ ${V.join(`
|
|
|
2846
2843
|
${w.join(`
|
|
2847
2844
|
`)}
|
|
2848
2845
|
</body>
|
|
2849
|
-
</html>`}function
|
|
2846
|
+
</html>`}function p3($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function XY($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:Q=[],script:X=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let z of J){let W=z.name?`name="${z.name}"`:z.property?`property="${z.property}"`:z.charset!=null?"charset=":z["http-equiv"]?`http-equiv="${z["http-equiv"]}"`:"";if(W&&K.includes(W))continue;q.push(` <meta ${Object.entries(z).map(([U,B])=>`${U}="${B}"`).join(" ")}>`)}for(let z of Q){if(z.href&&K.includes(`href="${z.href}"`))continue;q.push(` <link ${Object.entries(z).map(([W,U])=>`${W}="${U}"`).join(" ")}>`)}for(let z of X)if(z.src){if(K.includes(`src="${z.src}"`))continue;q.push(` <script ${Object.entries(z).filter(([W])=>W!=="content").map(([W,U])=>`${W}="${U}"`).join(" ")}></script>`)}else if(z.content){if(K.includes(z.content))continue;q.push(` <script>${z.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
|
|
2850
2847
|
`)}
|
|
2851
|
-
${$.slice(Y)}`}function
|
|
2848
|
+
${$.slice(Y)}`}function QY($,Z={},Y={}){if(p3($))return $;return LW($,Z,Y)}function _$($){let Z=$,Y=new Set,J=new Set,Q=()=>{if(x0)J.add(x0);return Z};return Q.set=(X)=>{if(!Object.is(X,Z)){let G=Z;if(Z=X,Y.forEach((K)=>K(Z,G)),i5)J.forEach((K)=>B$.add(K));else J.forEach((K)=>K())}},Q.update=(X)=>{Q.set(X(Z))},Q.subscribe=(X)=>{return Y.add(X),()=>Y.delete(X)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function j$($){let Z,Y=!0,J=new Set,Q=()=>{if(!Y)if(Y=!0,i5)J.forEach((G)=>B$.add(G));else J.forEach((G)=>G())},X=()=>{if(x0)J.add(x0);if(Y){let G=x0;x0=Q,U$.push(Q);try{Z=$()}finally{U$.pop(),x0=G}Y=!1}return Z};return Object.defineProperty(X,"_isDerived",{value:!0,writable:!1}),X}function H$($,Z={}){let Y,J=!1,Q=()=>{if(J)return;if(Y)Y(),Y=void 0;let X=x0;x0=Q,U$.push(Q);try{Y=$()}finally{U$.pop(),x0=X}};if(Z.immediate!==!1)Q();return()=>{if(J=!0,Y)Y()}}function c3($){if(i5){$();return}i5=!0;try{$()}finally{i5=!1,B$.forEach((Z)=>Z()),B$.clear()}}function l3($){FW.push($)}function i3($){VW.push($)}function O$($){return typeof $==="function"&&$._isSignal===!0}function L$($){return typeof $==="function"&&$._isDerived===!0}function n3($){if(O$($)||L$($))return $();return $}function F$($){let Z=x0;x0=null;try{return $()}finally{x0=Z}}function wW($,Z){let Y=typeof $==="function"?$:()=>$,J=_$([]),Q=j$(()=>J().reduce((K,q)=>Z(K,q.action),Y())),X=!1;return H$(()=>{if(Y(),!X){X=!0;return}if(F$(()=>J().length))J.set([])}),[Q,(K,q)=>{let z={action:K};J.set([...J(),z]);let W=()=>{let U=J().filter((B)=>B!==z);if(U.length!==J().length)J.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(W,W);return W}]}var x0=null,U$,i5=!1,B$,FW,VW;var o3=S(()=>{U$=[],B$=new Set,FW=[],VW=[]});var KY={};r(KY,{useOptimistic:()=>wW,untrack:()=>n3,state:()=>_$,peek:()=>F$,onMount:()=>l3,onDestroy:()=>i3,isSignal:()=>O$,isDerived:()=>L$,generateSignalsRuntimeDev:()=>V$,generateSignalsRuntime:()=>GY,effect:()=>H$,derived:()=>j$,default:()=>NW,batch:()=>c3});function GY(){try{let $=AW(V$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return V$()}}function AW($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let Q=$.indexOf(J,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let X=1,G=Q+J.length;while(G<$.length&&X>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")X++;else if(K===")")X--;G++}Z.push("0"),Y=G}return Z.join("")}function V$(){return`
|
|
2852
2849
|
// STX Signals Runtime (Development Build)
|
|
2853
2850
|
console.log('[stx] signals runtime loading');
|
|
2854
2851
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -5188,6 +5185,13 @@ else {
|
|
|
5188
5185
|
}
|
|
5189
5186
|
|
|
5190
5187
|
let currentElements = [];
|
|
5188
|
+
// One entry per list item, each holding EVERY node that item rendered.
|
|
5189
|
+
// currentElements stays flat for transition snapshots, but the keyed
|
|
5190
|
+
// diff below must pair a key with all of its nodes: a template row
|
|
5191
|
+
// routinely yields several (an element plus its surrounding text nodes),
|
|
5192
|
+
// and indexing a flat list by key position then paired the wrong node
|
|
5193
|
+
// with each key, leaving the list rotated after an update.
|
|
5194
|
+
let currentGroups = [];
|
|
5191
5195
|
let currentKeys = [];
|
|
5192
5196
|
let loadingElement = null;
|
|
5193
5197
|
let emptyElement = null;
|
|
@@ -5329,6 +5333,7 @@ catch (e) {
|
|
|
5329
5333
|
// Dispose scopes registered by items before they leave the DOM (#1727).
|
|
5330
5334
|
currentElements.forEach(e => { disposeSubtreeScopes(e); e.remove(); });
|
|
5331
5335
|
currentElements = [];
|
|
5336
|
+
currentGroups = [];
|
|
5332
5337
|
currentKeys = [];
|
|
5333
5338
|
showLoading();
|
|
5334
5339
|
return;
|
|
@@ -5377,6 +5382,7 @@ catch (e) {
|
|
|
5377
5382
|
// Dispose scopes registered by items before they leave the DOM (#1727).
|
|
5378
5383
|
currentElements.forEach(e => { disposeSubtreeScopes(e); e.remove(); });
|
|
5379
5384
|
currentElements = [];
|
|
5385
|
+
currentGroups = [];
|
|
5380
5386
|
currentKeys = [];
|
|
5381
5387
|
hideEmpty();
|
|
5382
5388
|
return;
|
|
@@ -5417,6 +5423,7 @@ catch (e) {
|
|
|
5417
5423
|
// Dispose scopes registered by items before they leave the DOM (#1727).
|
|
5418
5424
|
currentElements.forEach(e => { disposeSubtreeScopes(e); e.remove(); });
|
|
5419
5425
|
currentElements = [];
|
|
5426
|
+
currentGroups = [];
|
|
5420
5427
|
currentKeys = [];
|
|
5421
5428
|
if (emptyExpr) {
|
|
5422
5429
|
const emptyContent = evalLazy(emptyExpr);
|
|
@@ -5451,11 +5458,12 @@ catch (e) {
|
|
|
5451
5458
|
for (let i = 0; i < currentKeys.length; i++) {
|
|
5452
5459
|
const k = currentKeys[i];
|
|
5453
5460
|
if (!oldKeyMap.has(k)) oldKeyMap.set(k, []);
|
|
5454
|
-
oldKeyMap.get(k).push(
|
|
5461
|
+
oldKeyMap.get(k).push(currentGroups[i] || []);
|
|
5455
5462
|
}
|
|
5456
5463
|
|
|
5457
5464
|
// Build new element list, reusing existing DOM nodes by key
|
|
5458
5465
|
const newElements = [];
|
|
5466
|
+
const newGroups = [];
|
|
5459
5467
|
const usedKeys = new Set();
|
|
5460
5468
|
|
|
5461
5469
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -5463,10 +5471,12 @@ catch (e) {
|
|
|
5463
5471
|
const existing = oldKeyMap.get(key);
|
|
5464
5472
|
|
|
5465
5473
|
if (existing && existing.length > 0 && !usedKeys.has(key)) {
|
|
5466
|
-
// Reuse
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5474
|
+
// Reuse this item's nodes \u2014 move the whole group into position, in
|
|
5475
|
+
// order, so a multi-node row stays contiguous and correctly ordered.
|
|
5476
|
+
const group = existing.shift();
|
|
5477
|
+
group.forEach(el => parent.insertBefore(el, placeholder));
|
|
5478
|
+
newElements.push(...group);
|
|
5479
|
+
newGroups.push(group);
|
|
5470
5480
|
usedKeys.add(key);
|
|
5471
5481
|
// Update the item signal so bindings re-evaluate with new data.
|
|
5472
5482
|
// This is the fix for #1669 \u2014 without this, reused elements show
|
|
@@ -5481,14 +5491,16 @@ catch (e) {
|
|
|
5481
5491
|
const elements = createItemElements(list[i], i, key);
|
|
5482
5492
|
elements.forEach(el => { parent.insertBefore(el, placeholder); if (tgReady) tgEnter(el, tgName); });
|
|
5483
5493
|
newElements.push(...elements);
|
|
5494
|
+
newGroups.push(elements);
|
|
5484
5495
|
}
|
|
5485
5496
|
}
|
|
5486
5497
|
|
|
5487
5498
|
// Remove old elements whose keys are no longer in the list.
|
|
5488
5499
|
// Dispose any scopes registered inside removed items before the
|
|
5489
5500
|
// remove() call (#1727).
|
|
5490
|
-
for (const [key,
|
|
5501
|
+
for (const [key, groups] of oldKeyMap) {
|
|
5491
5502
|
if (!usedKeys.has(key)) {
|
|
5503
|
+
const elements = groups.flat();
|
|
5492
5504
|
// In a transition group, run the leave animation and let it remove the
|
|
5493
5505
|
// node; otherwise remove immediately. Scopes are disposed up-front
|
|
5494
5506
|
// either way (their destroy hooks shouldn't wait on a CSS transition).
|
|
@@ -5498,6 +5510,7 @@ catch (e) {
|
|
|
5498
5510
|
}
|
|
5499
5511
|
|
|
5500
5512
|
currentElements = newElements;
|
|
5513
|
+
currentGroups = newGroups;
|
|
5501
5514
|
currentKeys = newKeys;
|
|
5502
5515
|
|
|
5503
5516
|
// \u2500\u2500 <TransitionGroup> play (#1742) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
@@ -7665,6 +7678,10 @@ else {
|
|
|
7665
7678
|
processedScopes.add(el);
|
|
7666
7679
|
|
|
7667
7680
|
const scopeVars = window.stx._scopes && window.stx._scopes[scopeId];
|
|
7681
|
+
// Record the element this scope is bound to so cleanupContainer can tell a
|
|
7682
|
+
// dead registry entry (element replaced by an SPA swap) from a live one.
|
|
7683
|
+
// See sweepOrphanedScopes / #1775.
|
|
7684
|
+
if (scopeVars) scopeVars.__el = el;
|
|
7668
7685
|
|
|
7669
7686
|
// Deferred island (#1746): its setup script (type="stx/island") hasn't run
|
|
7670
7687
|
// yet, so the scope isn't registered. Arm the hydration trigger anyway \u2014
|
|
@@ -7824,6 +7841,54 @@ catch (e) {
|
|
|
7824
7841
|
}
|
|
7825
7842
|
}
|
|
7826
7843
|
|
|
7844
|
+
// Reclaim registry entries whose element is gone from the document.
|
|
7845
|
+
//
|
|
7846
|
+
// disposeSubtreeScopes only deletes scopes found UNDER the cleanup container,
|
|
7847
|
+
// so two shapes leaked forever across SPA navigation (#1775): components
|
|
7848
|
+
// rendered outside the swap container (an @include in the layout, above
|
|
7849
|
+
// <main>), and elements already detached by the time cleanup ran its
|
|
7850
|
+
// querySelectorAll. Each round-trip re-ran the include scripts under fresh
|
|
7851
|
+
// scope ids while the previous ids stayed in window.stx._scopes \u2014 ~4 orphans
|
|
7852
|
+
// per hop, unbounded, each retaining that scope's vars, signals and closures.
|
|
7853
|
+
//
|
|
7854
|
+
// The sweep is deliberately CONSERVATIVE \u2014 an over-eager delete is the #1737
|
|
7855
|
+
// failure (a scope removed from the registry cannot be recreated: its setup
|
|
7856
|
+
// IIFE ran once at page load), which is strictly worse than a leak. An entry
|
|
7857
|
+
// is dropped only when all three hold:
|
|
7858
|
+
// 1. the runtime actually bound it to an element (__el recorded),
|
|
7859
|
+
// 2. that element is no longer connected to the document, and
|
|
7860
|
+
// 3. neither it nor any ancestor is retained by a live conditional.
|
|
7861
|
+
// Entries with no __el (e.g. a scope whose element still sits inside untouched
|
|
7862
|
+
// <template> content, never inserted) are left alone \u2014 we can't prove they're
|
|
7863
|
+
// dead, and a later clone re-uses that registration.
|
|
7864
|
+
function sweepOrphanedScopes() {
|
|
7865
|
+
if (!window.stx || !window.stx._scopes) return;
|
|
7866
|
+
var scopes = window.stx._scopes;
|
|
7867
|
+
for (var id in scopes) {
|
|
7868
|
+
if (!Object.prototype.hasOwnProperty.call(scopes, id)) continue;
|
|
7869
|
+
var entry = scopes[id];
|
|
7870
|
+
if (!entry) continue;
|
|
7871
|
+
var el = entry.__el;
|
|
7872
|
+
if (!el || el.isConnected) continue;
|
|
7873
|
+
// Detached but RETAINED: :if toggles keep their element (bindIf re-inserts
|
|
7874
|
+
// the SAME node) and :if/:else chains keep their branches. Parent links
|
|
7875
|
+
// inside a detached subtree stay intact, so walking up from the scope
|
|
7876
|
+
// element still finds the conditional that owns it.
|
|
7877
|
+
var retained = false;
|
|
7878
|
+
for (var p = el; p; p = p.parentNode) {
|
|
7879
|
+
if (p.__stx_if_bound || p.__stx_chain_member) { retained = true; break; }
|
|
7880
|
+
}
|
|
7881
|
+
if (retained) continue;
|
|
7882
|
+
if (entry.__destroyCallbacks && Array.isArray(entry.__destroyCallbacks)) {
|
|
7883
|
+
for (var k = 0; k < entry.__destroyCallbacks.length; k++) {
|
|
7884
|
+
try { entry.__destroyCallbacks[k](); }
|
|
7885
|
+
catch (e) { console.warn('[stx] scope destroy error:', e); }
|
|
7886
|
+
}
|
|
7887
|
+
}
|
|
7888
|
+
delete scopes[id];
|
|
7889
|
+
}
|
|
7890
|
+
}
|
|
7891
|
+
|
|
7827
7892
|
// ==========================================================================
|
|
7828
7893
|
// Container Cleanup (for SPA navigation)
|
|
7829
7894
|
// ==========================================================================
|
|
@@ -7891,6 +7956,11 @@ catch (e) { console.warn('[stx] destroy hook error:', e); }
|
|
|
7891
7956
|
// through disposeSubtreeScopes so the same walk runs for SPA
|
|
7892
7957
|
// navigation and for :if/:for-driven unmount (see #1727).
|
|
7893
7958
|
disposeSubtreeScopes(container);
|
|
7959
|
+
|
|
7960
|
+
// 4. Reclaim entries the container walk can't see \u2014 components rendered
|
|
7961
|
+
// outside the swap container, or already detached before step 3 ran its
|
|
7962
|
+
// querySelectorAll. Without this the registry grew every navigation (#1775).
|
|
7963
|
+
sweepOrphanedScopes();
|
|
7894
7964
|
}
|
|
7895
7965
|
|
|
7896
7966
|
// Re-initialize components after SPA content swap.
|
|
@@ -7986,6 +8056,9 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
7986
8056
|
document.body.querySelectorAll('[data-stx-scope]').forEach(function(el) {
|
|
7987
8057
|
var scopeId = el.getAttribute('data-stx-scope');
|
|
7988
8058
|
var scopeVars = window.stx._scopes && window.stx._scopes[scopeId];
|
|
8059
|
+
// Record the bound element for the orphan sweep (#1775) \u2014 see the
|
|
8060
|
+
// DOMContentLoaded walk above for the rationale.
|
|
8061
|
+
if (scopeVars) scopeVars.__el = el;
|
|
7989
8062
|
// Deferred island reached via SPA navigation (#1746): its setup script is
|
|
7990
8063
|
// inert (type="stx/island"), so the scope isn't registered yet. Arm the
|
|
7991
8064
|
// hydration trigger (deferHydration) instead of skipping it \u2014 mirrors the
|
|
@@ -8087,60 +8160,60 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
|
|
|
8087
8160
|
}
|
|
8088
8161
|
}
|
|
8089
8162
|
})();
|
|
8090
|
-
`}var
|
|
8163
|
+
`}var NW;var qY=S(()=>{o3();o3();NW={state:_$,derived:j$,effect:H$,batch:c3,onMount:l3,onDestroy:i3,isSignal:O$,isDerived:L$,untrack:n3,peek:F$,generateSignalsRuntime:GY,generateSignalsRuntimeDev:V$}});var s3={};r(s3,{templateCache:()=>zY,readFileCached:()=>RW,invalidateFileCacheByDir:()=>MW,invalidateFileCache:()=>TW,hashFilePath:()=>n5,getCachedSignalsRuntime:()=>EW,getCachedRouterScript:()=>kW,clearDevCaches:()=>bW,checkCache:()=>SW,cacheTemplate:()=>yW,__setSignalsGeneratorsForTest:()=>DW});import L1 from"fs";import G5 from"path";async function RW($){let Y;for(let J=0;J<3;J++)try{let X=(await L1.promises.stat($)).mtime.getTime(),G=f1.get($);if(G&&G.mtime===X)return G.content;let K=await Bun.file($).text(),z=(await L1.promises.stat($)).mtime.getTime();if(z!==X)continue;return f1.set($,{content:K,mtime:z}),K}catch(Q){Y=Q;break}throw f1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function TW($){f1.delete($)}function MW($){for(let Z of f1.keys())if(Z.startsWith($))f1.delete(Z)}function DW($){WY=$}async function EW($=!1){let Z=WY??await Promise.resolve().then(() => (qY(),KY));if($)return Z.generateSignalsRuntimeDev();if(w$===null)w$=Z.generateSignalsRuntime();return w$}async function kW(){if(A$===null){let{getRouterScript:$}=await import("stx-router");A$=$()}return A$}function bW(){f1.clear(),w$=null,IW=null,A$=null}function UY($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function SW($,Z){try{if(!Z.cachePath)return null;let Y=G5.resolve(Z.cachePath),J=G5.join(Y,`${n5($)}.html`),Q=G5.join(Y,`${n5($)}.meta.json`);if(!await n(J)||!await n(Q))return null;let X=await Bun.file(Q).text(),G=JSON.parse(X);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==UY(Z))return null;if((await L1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await n(q)){if((await L1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function yW($,Z,Y,J){try{if(!J.cachePath)return;let Q=G5.resolve(J.cachePath);await L1.promises.mkdir(Q,{recursive:!0});let X=G5.join(Q,`${n5($)}.html`),G=G5.join(Q,`${n5($)}.meta.json`),K=await L1.promises.stat($);await Bun.write(X,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:UY(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),zY.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function n5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,CW)}var zY,f1,w$=null,IW=null,WY=null,A$=null,CW=16;var r3=S(()=>{A0();zY=new Map,f1=new Map});function BY($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",J;while((J=Z.exec($))!==null)Y+=J[1]+`
|
|
8091
8164
|
`;let Q=/\{\{([\s\S]*?)\}\}/g;while((J=Q.exec($))!==null)Y+=J[1]+`
|
|
8092
|
-
`;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((
|
|
8165
|
+
`;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Y)}),K=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"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,z,W=!1;while((z=q.exec(Y))!==null)if(!K.has(z[1])){W=!0;break}if(!G&&!W)return $;let U=`<script type="module">
|
|
8093
8166
|
// STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
|
|
8094
8167
|
import '@stacksjs/browser'
|
|
8095
|
-
</script>`;if($.includes("</head>")){let
|
|
8168
|
+
</script>`;if($.includes("</head>")){let B=$.indexOf("</head>"),j=$.slice(0,B).indexOf("<script");if(j!==-1)return $.slice(0,j)+U+`
|
|
8096
8169
|
`+$.slice(j);return $.replace("</head>",`${U}
|
|
8097
8170
|
</head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
8098
8171
|
${U}`);return U+`
|
|
8099
|
-
`+$}async function
|
|
8172
|
+
`+$}async function _Y($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
8100
8173
|
`+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
8101
8174
|
`+$.slice(q)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
8102
|
-
`+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (
|
|
8175
|
+
`+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (r3(),s3)),Q=`<script data-stx-scoped>${await Y(Z.debug)}</script>`,X=$.indexOf("<script");if(X!==-1)return $.slice(0,X)+Q+`
|
|
8103
8176
|
`+$.slice(X);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Q+`
|
|
8104
8177
|
`+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
|
|
8105
8178
|
`+Q+$.slice(K+1)}return Q+`
|
|
8106
|
-
`+$}async function
|
|
8107
|
-
`}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (
|
|
8108
|
-
</body>`+$.slice(G+7)}var
|
|
8109
|
-
`)}else{if(!
|
|
8110
|
-
`)
|
|
8111
|
-
`)j++;U=j;continue}if(
|
|
8112
|
-
${F}`)}let z
|
|
8113
|
-
|
|
8114
|
-
`);
|
|
8179
|
+
`+$}async function a3($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
|
|
8180
|
+
`}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (r3(),s3)),X=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+X+`
|
|
8181
|
+
</body>`+$.slice(G+7)}var TY={};r(TY,{scanScriptTags:()=>VY,rewriteStxImportSpecifiers:()=>RY,processSignals:()=>Y6,processScriptSetup:()=>AY,preEvalLiteralReactiveIfs:()=>$6,parseLoopExpression:()=>wY,hasSignalsSyntax:()=>M$,findMarkupIndexOutsideScripts:()=>T$,extractExports:()=>NY,convertSignalLoopsToAttributes:()=>Z6,convertSignalDirectivesToAttributes:()=>e3});function VY($,Z={}){let Y=[];N$.lastIndex=0;let J;while((J=N$.exec($))!==null){let Q=J[1],X=J.index+J[0].length,G=$.toLowerCase().indexOf("</script>",X);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(Q)){N$.lastIndex=K;continue}Y.push({fullMatch:$.slice(J.index,K),attrs:Q,body:$.slice(X,G),start:J.index,end:K}),N$.lastIndex=K}return Y}function wY($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),X=Y[2].trim(),{itemVar:G,indexVar:K}=jY(X);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Q=J[1].trim(),X=J[2].trim(),{itemVar:G,indexVar:K}=jY(Q);if(G)return{style:"in",iterable:X,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function jY($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let X=Z.match(/^(\w+)$/);if(X)return{itemVar:X[1],indexVar:null};return{itemVar:null,indexVar:null}}function M$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function vW($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let Q=J[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function xW($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let X=Q[1],G;while((G=J.exec(X))!==null)Z.add(G[1])}return Z}function fW($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function OY($,Z,Y){if(!$)return!1;let J=fW($),Q=!1,X=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(J))!==null){let B=q[1];if(J.slice(0,q.index).trimEnd().endsWith("."))continue;if(HY.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)X=!0}let z=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,W;while((W=z.exec(J))!==null){let B=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(HY.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!X}function R$($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,""")}"`,Q=$.trim(),X=Q.match(FY);if(X&&gW(X[3],X[1])){let[,G,K,q]=X;return`<${G}${K}${J}>${q}</${G}>`}return`<template${J}>${Q}</template>`}function gW($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(J--,J<0)return!1}else J++;return!0}function e3($,Z){let Y=xW($);function J(Q){let X=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(X))!==null){let z=K.index,W=z+K[0].length,U=1,B=W;while(B<X.length&&U>0){if(X[B]==="(")U++;else if(X[B]===")")U--;B++}if(U!==0)continue;let _=X.substring(W,B-1).trim(),j=B,H=1,L=j,F=/@(if\s*\(|endif)/g;F.lastIndex=j;let O;while((O=F.exec(X))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=X.substring(j,L-6).trim(),w;if(vW(V)){let A=g5(X.substring(z,L));if(A.length===0)continue;let N=A[0].branches.filter((M)=>M.type!=="else");if(!(N.length>0&&N.every((M)=>OY(M.condition,Y,Z))))continue;w=A[0].branches.map((M)=>{let I=J(M.content);if(M.type==="elseif")return R$(I,"@else-if",M.condition??"");if(M.type==="else")return R$(I,"@else");return R$(I,"@if",M.condition??"")}).join(`
|
|
8182
|
+
`)}else{if(!OY(_,Y,Z))continue;w=R$(J(V),"@if",_)}q.push({start:z,end:L,replacement:w}),G.lastIndex=L}for(let z=q.length-1;z>=0;z--){let{start:W,end:U,replacement:B}=q[z];X=X.substring(0,W)+B+X.substring(U)}return X}return J($)}function hW($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function dW($,Z,Y,J){if(t3.has(Y.toLowerCase()))return J;let Q=Y.toLowerCase(),X=$.toLowerCase(),G=$.length,K=1,q=J;while(q<G){let z=$.indexOf("<",q);if(z===-1)return-1;if(q=z,$.startsWith("<!--",q)){let _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let W=/^<(script|style)\b/i.exec($.slice(q,q+8));if(W){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let j=X.indexOf(`</${W[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===Q){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!U){q++;continue}let B=$.indexOf(">",q);if(B===-1)return-1;if(U[1].toLowerCase()===Q){let _=$.slice(q,B+1);if(!(/\/\s*>$/.test(_)||t3.has(Q)))K++}q=B+1}return-1}function uW($,Z){let Y=Z,J=$.length;for(;;){while(Y<J&&$[Y]!=="<")Y++;if(Y>=J)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let X=$.slice(Y,Q+1);return mW.test(X)}function $6($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Q=(U)=>Z.some(([B,_])=>U>=B&&U<_),X=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=X.exec($))!==null){if(Q(K.index))continue;let[U,B,_,j,H,L,F]=K,O=hW(H);if(O===void 0)continue;let V=K.index,w=V+U.length,R=!!F||/\/\s*>$/.test(U)||t3.has(B.toLowerCase())?w:dW($,V,B,w);if(R===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&uW($,R)){X.lastIndex=w;continue}if(O===!0){let M=`<${B}${_}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:R,replacement:""}),X.lastIndex=R}if(G.length===0)return $;G.sort((U,B)=>U.start-B.start);let q=[],z=-1;for(let U of G){if(U.start<z)continue;q.push(U),z=U.end}let W=$;for(let U=q.length-1;U>=0;U--){let{start:B,end:_,replacement:j}=q[U];W=W.substring(0,B)+j+W.substring(_)}return W}function Z6($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,Q,X=[];while((Q=J.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,z=1,W=q;while(W<Y.length&&z>0){if(Y[W]==="(")z++;else if(Y[W]===")")z--;W++}if(z!==0)continue;let U=Y.substring(q,W-1).trim(),B=W,_=wY(U);if(_.iterable){let N=_.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N))continue;if(Z){let R=N.split(/[.[(]/)[0].trim();if(R&&R in Z)continue}}if(_.style==="as")U=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-j.length).trim(),w=V.match(FY),A;if(w){let[,N,R,T]=w;A=`<${N}${R} @for="${U}">${T}</${N}>`}else A=`<template @for="${U}">${V}</template>`;X.push({start:K,end:L,replacement:A})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:z}=X[G];Y=Y.substring(0,K)+z+Y.substring(q)}return Y}function pW($){let Z=new Set,Y=[],J=0,Q=0,X=$.length,G=(W)=>{let U=J+1;while(U<X){let B=$[U];if(B==="\\"){U+=2;continue}if(B===W)return U+1;U++}return X},K=()=>{let W=J+2;while(W<X&&$[W]!==`
|
|
8183
|
+
`)W++;return W},q=()=>{let W=J+2;while(W<X-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return X},z=(W)=>{let U=W,B=0;while(U<X){let _=$[U];if(_==="/"&&$[U+1]==="/"){let j=U+2;while(j<X&&$[j]!==`
|
|
8184
|
+
`)j++;U=j;continue}if(_==="/"&&$[U+1]==="*"){let j=U+2;while(j<X-1&&!($[j]==="*"&&$[j+1]==="/"))j++;U=j+2;continue}if(_==='"'||_==="'"||_==="`"){let j=U+1;while(j<X){if($[j]==="\\"){j+=2;continue}if($[j]===_){j++;break}j++}U=j;continue}if(_==="("||_==="["||_==="{"){B++,U++;continue}if(_===")"||_==="]"||_==="}"){B--,U++;continue}if(_===";"&&B===0)return U+1;U++}return X};while(J<X){let W=$[J];if(W==="/"&&$[J+1]==="/"){let U=K();Y.push($.slice(J,U)),J=U;continue}if(W==="/"&&$[J+1]==="*"){let U=q();Y.push($.slice(J,U)),J=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);Y.push($.slice(J,U)),J=U;continue}if(W==="{"){Q++,Y.push(W),J++;continue}if(W==="}"){Q--,Y.push(W),J++;continue}if(Q===0){let U=J>0?$[J-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let _=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let j=_[2],H=z(J+_[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),J=H;continue}Z.add(j),Y.push($.slice(J,H)),J=H;continue}}}Y.push(W),J++}return Y.join("")}async function AY($,Z,Y){let J=VY($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,X=[];for(let H of J){let L=H.body;if(A1(H.attrs))L=N1(L);if(Q.test(L))X.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(X.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${PW++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (t5(),a5)),z=[];for(let H=0;H<X.length;H++){let L=X[H].content;if(K(L))console.log("[stx:bundler] bundling signal script imports"),L=await q(L,Z||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(O,V)=>RY(V));let F=Z1(L);z.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
|
|
8185
|
+
${F}`)}let W=z.join(`
|
|
8186
|
+
|
|
8187
|
+
`);W=pW(W);let U=NY(W),B=e5(W,Y),_=`
|
|
8115
8188
|
<script data-stx-scoped>
|
|
8116
8189
|
function ${G}() {
|
|
8117
8190
|
const { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect, defineProps, withDefaults, defineEmits, defineExpose, defineSlots } = window.stx;
|
|
8118
|
-
${
|
|
8191
|
+
${B}${W}
|
|
8119
8192
|
return { ${U} };
|
|
8120
8193
|
}
|
|
8121
8194
|
if(window.stx)window.stx._latestSetup=${G};
|
|
8122
|
-
</script>`,j=$;for(let H of X)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:
|
|
8123
|
-
`)return;X++}},
|
|
8124
|
-
`)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},
|
|
8125
|
-
${Q.slice(
|
|
8126
|
-
${G}${Q.slice(
|
|
8127
|
-
${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),
|
|
8195
|
+
</script>`,j=$;for(let H of X)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:_}}function NY($){let Z=$,Y=[],J=new Set,Q=0,X=0,G=Z.length,K="",q=()=>{X++;let j=!1;while(X<G){let H=Z[X];if(H==="\\"){X+=2;continue}if(H==="["&&!j){j=!0,X++;continue}if(H==="]"&&j){j=!1,X++;continue}if(H==="/"&&!j){X++;while(X<G&&/[gimsuyd]/.test(Z[X]))X++;return}if(H===`
|
|
8196
|
+
`)return;X++}},z=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},W=(j)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===j){X++;return}X++}},U=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let j=1;while(X<G&&j>0)if(Z[X]==="{")j++,X++;else if(Z[X]==="}")j--,X++;else if(Z[X]==="'"||Z[X]==='"')W(Z[X]);else if(Z[X]==="`")U();else X++;continue}X++}},B=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
|
|
8197
|
+
`)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},_=()=>{if(Q!==0)return;let j=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!J.has(V))Y.push(V),J.add(V);return}let H=Z.slice(X).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!J.has(R))Y.push(R),J.add(R)});return}let L=Z.slice(X).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!J.has(A))Y.push(A),J.add(A)});return}let F=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!J.has(V))Y.push(V),J.add(V);return}let O=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!J.has(V))Y.push(V),J.add(V)}};while(X<G){if(B())continue;if(Z[X]==="'"||Z[X]==='"'){W(Z[X]),K=Z[X-1];continue}if(Z[X]==="`"){U(),K="`";continue}if(Z[X]==="/"&&Z[X+1]!=="/"&&Z[X+1]!=="*"&&z()){q(),K="/";continue}if(Z[X]==="{"){Q++,K="{",X++;continue}if(Z[X]==="}"){Q--,K="}",X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))_();if(!/\s/.test(Z[X]))K=Z[X];X++}return Y.join(", ")}async function Y6($,Z,Y,J){if(!M$($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:X,setupCode:G}=await AY(Q,Y,J);if(Q=X,Q=await _Y(Q,Z),Q=BY(Q),G){let W=T$(Q,/<\/head>/i),U=W===-1?T$(Q,/<body[^>]*>/i):-1;if(W!==-1)Q=`${Q.slice(0,W)}${G}
|
|
8198
|
+
${Q.slice(W)}`;else if(U!==-1){let B=/<body[^>]*>/i.exec(Q.slice(U))[0],_=U+B.length;Q=`${Q.slice(0,_)}
|
|
8199
|
+
${G}${Q.slice(_)}`}else Q=`${Q}
|
|
8200
|
+
${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),z=q&&/data-stx/.test(q[1]);if(!G&&!z&&q&&!/data-stx-auto/.test(q[1])){let W=/<body[^>]*>/i,U=T$(Q,W);if(U!==-1){let B=Q.slice(0,U),_=Q.slice(U).replace(W,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=B+_}}return Q}function T$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],Q;while((Q=Y.exec($))!==null)J.push([Q.index,Q.index+Q[0].length]);let X=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=X.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!J.some(([W,U])=>q>=W&&q<U))return q;G=q+Math.max(K[0].length,1)}return-1}function RY($){let Z=[];for(let Y of $.split(",")){let J=Y.trim();if(!J||J.startsWith("type "))continue;let Q=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return LY;return`const ${Z.join(", ")}; ${LY}`}var PW=0,N$,FY,HY,t3,mW,LY="// [stx import stripped \u2014 resolved via window.stx in __stx_setup]";var J6=S(()=>{N5();o4();A0();N$=/<script\b([^>]*)>/gi,FY=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;HY=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"]);t3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);mW=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import K5 from"path";function MY($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function IY($,Z,Y){try{let J;if($.startsWith("/")){let Q=Z;for(let X=0;X<5;X++){let G=K5.join(Q,$);if(await Bun.file(G).exists())return G;Q=K5.dirname(Q)}J=K5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=K5.resolve(Z,$);else J=K5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function DY($,Z,Y){let J=$,Q=K5.dirname(Z),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=X.exec(J))!==null){let[z,W,U,B]=G;if(MY(U))continue;let _=await IY(U,Q,Z);if(_)try{let j=await Bun.file(_).text();if(Y.add(_),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:o0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
|
|
8128
8201
|
// Source: ${U}
|
|
8129
8202
|
${j}
|
|
8130
|
-
</script>`;J=J.replace(
|
|
8203
|
+
</script>`;J=J.replace(z,H),X.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(J))!==null){let[z,W,U,B]=q,_=W+B;if(MY(U))continue;if(/rel=["']stylesheet["']/.test(_)||U.endsWith(".css")){let H=await IY(U,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
|
|
8131
8204
|
/* Source: ${U} */
|
|
8132
8205
|
${L}
|
|
8133
|
-
</style>`;J=J.replace(
|
|
8134
|
-
`),U=[];
|
|
8206
|
+
</style>`;J=J.replace(z,F),K.lastIndex=0}catch(L){}}}return J}var EY=S(()=>{u1()});function X6($,Z){let Y=$,J=/@json\s*\(/g,Q;while((Q=J.exec(Y))!==null){let X=Q.index,G=X+Q[0].length-1,K=1,q=G+1,z=null,W=!1;while(q<Y.length&&K>0){let V=Y[q];if(W){W=!1,q++;continue}if(V==="\\"&&z){W=!0,q++;continue}if(z){if(V===z)z=null;q++;continue}if(V==='"'||V==="'"||V==="`"){z=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=Y.substring(G+1,q).trim(),B=Y.substring(X,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<U.length;V++){let w=U[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){_=V;break}}let F=_>=0?U.substring(0,_).trim():U,O=_>=0?U.substring(_+1).trim():void 0;try{let V=F.trim(),w;if(Q0(V))w=G0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let N=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,X)+N+Y.substring(q+1),J.lastIndex=X+N.length}catch(V){c0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),J.lastIndex=X+B.length}}return Y}function Q6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function kY($){let Z=$,Y=/@memo\s*\(/g,J,Q=[];while((J=Y.exec(Z))!==null){let X=J.index,G=X+J[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let z=Z.slice(G,q-1).trim(),W=q,U=Z.slice(W),B=U.indexOf("@endmemo");if(B===-1)continue;let _=U.slice(0,B),j=W+B+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(A){let[R,T,M="",I]=A,D=`<${T}${M} data-stx-memo="${z}"${I}>`;N=_.slice(0,L)+D+w.slice(R.length)+_.slice(L+w.length)}else N=`${_.slice(0,L)}<div data-stx-memo="${z}">${w}</div>${_.slice(L+w.length)}`;Q.push({start:X,end:j,replacement:N}),Y.lastIndex=j}for(let X=Q.length-1;X>=0;X--){let G=Q[X];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function G6($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function bY($){let Y=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"),J="",Q=0,X;while((X=Y.exec($))!==null){let G=X.index,K=G+X[0].length,q=!1,z=!1,W=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(z){if(H==='"')z=!1}else if(H==="'")q=!0;else if(H==='"')z=!0;else if(H===">"){W=K;break}K++}if(W===-1)continue;if($.slice(G,W+1).includes("x-cloak"))continue;let B=$.slice(W+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(Q,W)+" x-cloak>",Q=W+1}return J+=$.slice(Q),J}function SY($){let Z=/<[a-z][\w-]*/gi,Y="",J=0,Q;while((Q=Z.exec($))!==null){let X=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,X);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=X+Q[0].length,q=!1,z=!1,W=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(z){if(j==='"')z=!1}else if(j==="'")q=!0;else if(j==='"')z=!0;else if(j===">"){W=K;break}K++}if(W===-1)continue;let U=$.slice(X+Q[0].length,W);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!cW.test(U))continue;let B=$[W-1]==="/",_=B?W-1:W;Y+=`${$.slice(J,_)} x-cloak${B?" ":""}`,J=_}return Y+=$.slice(J),Y}var cW;var K6=S(()=>{Y1();R0();cW=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function q6($,Z,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=J.allowPatterns??[],X=[];for(let{pattern:G,message:K,suggestion:q}of lW){if(Q.some((W)=>K.includes(W)||G.source.includes(W)))continue;G.lastIndex=0;let z=$.match(G);if(z&&z.length>0){let W=$.split(`
|
|
8207
|
+
`),U=[];W.forEach((_,j)=>{if(G.lastIndex=0,G.test(_))U.push(j+1)});let B=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";X.push(` \u2717 ${K}${B}
|
|
8135
8208
|
\u2192 ${q}`)}}if(X.length>0&&J.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
|
|
8136
8209
|
${X.join(`
|
|
8137
8210
|
`)}
|
|
8138
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var
|
|
8139
|
-
${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${
|
|
8211
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var lW;var z6=S(()=>{lW=[{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:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{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"}]});var yY={};r(yY,{getStoreScript:()=>iW,clearStoreCache:()=>nW});import I$ from"path";async function iW($){let Z;if($)Z=I$.resolve($);else{let W=await S1();Z=I$.resolve(W.root||process.cwd(),W.storesDir||"stores")}let Y=q5.get(Z);if(Y!==void 0)return Y||null;let J=new Bun.Glob("*.ts"),Q=[];try{for await(let W of J.scan({cwd:Z,absolute:!0})){let U=I$.basename(W,".ts");if(["index","types"].includes(U))continue;if(W.includes(".d.ts"))continue;Q.push(W)}}catch{return q5.set(Z,""),null}if(Q.length===0)return q5.set(Z,""),null;let X=[];for(let W of Q){let U=await Bun.file(W).text();X.push({file:W,hasUseStore:/useStore\s*\(/.test(U)})}X.sort((W,U)=>{if(W.hasUseStore===U.hasUseStore)return 0;return W.hasUseStore?1:-1});let G=X.map((W)=>W.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()});for(let W of G)try{let U=await Bun.file(W).text(),B=I$.basename(W,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=q.transformSync(U),K.push(`// Store: ${B}
|
|
8212
|
+
${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${W}:`,U)}if(K.length===0)return q5.set(Z,""),null;let z=`;(function(){
|
|
8140
8213
|
${K.join(`
|
|
8141
8214
|
|
|
8142
8215
|
`)}
|
|
8143
|
-
})();`;return q5.set(Z,
|
|
8216
|
+
})();`;return q5.set(Z,z),z}function nW(){q5.clear()}var q5;var CY=S(()=>{t1();u1();q5=new Map});var vY={};r(vY,{processDeferDirectives:()=>tW});function oW(){return`stx-defer-${++PY}`}function sW($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function rW($,Z,Y){let{trigger:J,value:Q}=sW(Z),X=Y,G,K,q,z=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(z)G=z[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let W=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(W)K=W[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[2].trim(),X=X.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return X=X.trim(),{trigger:J,triggerValue:Q,content:X,placeholder:G,loading:K,error:q}}function aW($,Z){let{trigger:Y,triggerValue:J}=Z,Q;switch(Y){case"visible":Q=`
|
|
8144
8217
|
const observer = new IntersectionObserver((entries) => {
|
|
8145
8218
|
if (entries[0].isIntersecting) {
|
|
8146
8219
|
observer.disconnect();
|
|
@@ -8213,15 +8286,15 @@ else {
|
|
|
8213
8286
|
${Q}
|
|
8214
8287
|
})();
|
|
8215
8288
|
</script>
|
|
8216
|
-
`}function
|
|
8289
|
+
`}function tW($,Z,Y){PY=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(Q,X,G)=>{let K=oW(),q=rW(Q,X,G),z=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",W=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',U=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,_=aW(K,q);return`
|
|
8217
8290
|
<div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
|
|
8218
|
-
${W}
|
|
8219
8291
|
${z}
|
|
8220
|
-
${
|
|
8292
|
+
${W}
|
|
8293
|
+
${B}
|
|
8221
8294
|
${U}
|
|
8222
8295
|
</div>
|
|
8223
|
-
${
|
|
8224
|
-
`})}var
|
|
8296
|
+
${_}
|
|
8297
|
+
`})}var PY=0;var fY={};r(fY,{processTeleportDirectives:()=>YU,ensureTeleportTargets:()=>JU});function eW(){return`stx-teleport-${++xY}`}function $U($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let Q=1;Q<Z.length;Q++){let X=Z[Q].match(/disabled:\s*(.+)/);if(X)J=X[1].trim()}return{target:Y,disabled:J}}function ZU($,Z){return`
|
|
8225
8298
|
<script>
|
|
8226
8299
|
(function() {
|
|
8227
8300
|
const source = document.getElementById('${$}');
|
|
@@ -8267,12 +8340,12 @@ else {
|
|
|
8267
8340
|
});
|
|
8268
8341
|
})();
|
|
8269
8342
|
</script>
|
|
8270
|
-
`}function
|
|
8343
|
+
`}function YU($,Z,Y){xY=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(Q,X,G)=>{let K=eW(),{target:q,disabled:z}=$U(X),W=G.trim();if(z)try{let B=!1;if(z==="true")B=!0;else if(z==="false")B=!1;else if(z in Z)B=Boolean(Z[z]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${W}</div>`}catch{}let U=ZU(K,q);return`
|
|
8271
8344
|
<div id="${K}" class="stx-teleport-source" style="display: none;">
|
|
8272
|
-
<template>${
|
|
8345
|
+
<template>${W}</template>
|
|
8273
8346
|
</div>
|
|
8274
8347
|
${U}
|
|
8275
|
-
`})}function
|
|
8348
|
+
`})}function JU(){return`
|
|
8276
8349
|
<script>
|
|
8277
8350
|
(function() {
|
|
8278
8351
|
// Common teleport targets
|
|
@@ -8289,23 +8362,23 @@ else {
|
|
|
8289
8362
|
});
|
|
8290
8363
|
})();
|
|
8291
8364
|
</script>
|
|
8292
|
-
`}var
|
|
8365
|
+
`}var xY=0;var mY={};r(mY,{processTransitionDirectives:()=>KU,processTransitionAttributes:()=>UU,performLeave:()=>GU,performEnter:()=>QU,generateTransitionRuntime:()=>WU,generateTransitionCSS:()=>zU});function gY($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function XU($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=Z.animationDuration||"0s",Q=(X)=>{let G=X.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(J))}function hY($,Z){return new Promise((Y)=>{let J=Z??XU($);if(J===0){Y();return}let Q=!1,X=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)X()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(X,J+50)})}function dY($){$.offsetHeight}async function QU($,Z={}){let Y=Z.name||"stx",J=gY(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),dY($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((X)=>{Z.onEnter($,X)});else await hY($,Q);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function GU($,Z={}){let Y=Z.name||"stx",J=gY(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),dY($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((X)=>{Z.onLeave($,X)});else await hY($,Q);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function KU($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(Q,X,G)=>{let K=qU(X),q=K.name||"stx",z=K.duration||300,W=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
8293
8366
|
<div
|
|
8294
8367
|
class="stx-transition-wrapper"
|
|
8295
8368
|
data-transition="${q}"
|
|
8296
|
-
data-transition-id="${
|
|
8297
|
-
data-transition-duration="${
|
|
8369
|
+
data-transition-id="${W}"
|
|
8370
|
+
data-transition-duration="${z}"
|
|
8298
8371
|
${K.mode?`data-transition-mode="${K.mode}"`:""}
|
|
8299
8372
|
>
|
|
8300
8373
|
${G.trim()}
|
|
8301
8374
|
</div>
|
|
8302
8375
|
<script>
|
|
8303
8376
|
(function() {
|
|
8304
|
-
const wrapper = document.querySelector('[data-transition-id="${
|
|
8377
|
+
const wrapper = document.querySelector('[data-transition-id="${W}"]');
|
|
8305
8378
|
if (!wrapper) return;
|
|
8306
8379
|
|
|
8307
8380
|
const name = '${q}';
|
|
8308
|
-
const duration = ${
|
|
8381
|
+
const duration = ${z};
|
|
8309
8382
|
|
|
8310
8383
|
// Observe for child changes to trigger transitions
|
|
8311
8384
|
const observer = new MutationObserver(function(mutations) {
|
|
@@ -8331,7 +8404,7 @@ else {
|
|
|
8331
8404
|
});
|
|
8332
8405
|
})();
|
|
8333
8406
|
</script>
|
|
8334
|
-
`})}function
|
|
8407
|
+
`})}function qU($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3]||J[4]||J[5];switch(Q){case"name":Z.name=X;break;case"duration":Z.duration=parseInt(X,10);break;case"mode":Z.mode=X;break;case"easing":Z.easing=X;break}}return Z}function zU(){return`
|
|
8335
8408
|
/* STX Transition Presets */
|
|
8336
8409
|
|
|
8337
8410
|
/* Fade */
|
|
@@ -8518,7 +8591,7 @@ else {
|
|
|
8518
8591
|
opacity: 1;
|
|
8519
8592
|
max-height: 1000px;
|
|
8520
8593
|
}
|
|
8521
|
-
`}function
|
|
8594
|
+
`}function WU(){return`
|
|
8522
8595
|
// STX Transition Runtime
|
|
8523
8596
|
(function() {
|
|
8524
8597
|
if (typeof window === 'undefined') return;
|
|
@@ -8607,7 +8680,7 @@ else {
|
|
|
8607
8680
|
|
|
8608
8681
|
console.log('[stx] Transition runtime initialized');
|
|
8609
8682
|
})();
|
|
8610
|
-
`}function
|
|
8683
|
+
`}function UU($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,Q,X)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${X}" data-stx-transition-id="${K}"`})}var pY={};r(pY,{withErrorBoundary:()=>uY,processErrorBoundaryDirectives:()=>jU,generateErrorBoundaryRuntime:()=>VU,generateErrorBoundaryCSS:()=>FU,createErrorBoundary:()=>LU});function _U(){return`eb-${++BU}-${Date.now().toString(36)}`}function jU($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(Q,X,G,K)=>{let q=_U(),z=HU(X||"");return OU(q,G.trim(),K.trim(),z)})}function HU($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3]||J[4];switch(Q){case"id":Z.id=X;break;case"logErrors":Z.logErrors=X==="true";break}}return Z}function OU($,Z,Y,J){let Q=J.logErrors!==!1;return`
|
|
8611
8684
|
<div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
|
|
8612
8685
|
<div class="stx-error-boundary-content" data-boundary-content="${$}">
|
|
8613
8686
|
${Z}
|
|
@@ -8727,7 +8800,7 @@ else {
|
|
|
8727
8800
|
};
|
|
8728
8801
|
})();
|
|
8729
8802
|
</script>
|
|
8730
|
-
`}async function
|
|
8803
|
+
`}async function uY($,Z,Y){try{return await $()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return Z}}function LU($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>uY(J,$,Y)}function FU(){return`
|
|
8731
8804
|
/* STX Error Boundary Styles */
|
|
8732
8805
|
.stx-error-boundary {
|
|
8733
8806
|
position: relative;
|
|
@@ -8771,7 +8844,7 @@ else {
|
|
|
8771
8844
|
color: #fecaca;
|
|
8772
8845
|
}
|
|
8773
8846
|
}
|
|
8774
|
-
`}function
|
|
8847
|
+
`}function VU(){return`
|
|
8775
8848
|
// STX Error Boundary Runtime
|
|
8776
8849
|
(function() {
|
|
8777
8850
|
if (typeof window === 'undefined') return;
|
|
@@ -8836,7 +8909,7 @@ else {
|
|
|
8836
8909
|
|
|
8837
8910
|
console.log('[stx] Error boundary runtime initialized');
|
|
8838
8911
|
})();
|
|
8839
|
-
`}var
|
|
8912
|
+
`}var BU=0;var cY={};r(cY,{renderSSRSuspense:()=>IU,processSuspenseDirectives:()=>NU,generateSuspenseRuntime:()=>EU,generateSuspenseCSS:()=>DU,createSSRSuspense:()=>MU});function AU(){return`suspense-${++wU}-${Date.now().toString(36)}`}function NU($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(Q,X,G,K)=>{let q=AU(),z=RU(X||"");return TU(q,G.trim(),K.trim(),z)})}function RU($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3],G=J[4];switch(Q){case"id":Z.id=X;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function TU($,Z,Y,J){let Q=J.timeout||30000,X=J.id||$;return`
|
|
8840
8913
|
<div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${X}" data-status="pending">
|
|
8841
8914
|
<div class="stx-suspense-fallback" data-suspense-fallback="${$}">
|
|
8842
8915
|
${Y}
|
|
@@ -9026,7 +9099,7 @@ else {
|
|
|
9026
9099
|
}, 0);
|
|
9027
9100
|
})();
|
|
9028
9101
|
</script>
|
|
9029
|
-
`}function
|
|
9102
|
+
`}function MU($,Z,Y){return{id:$,fallback:Y,content:Z}}async function IU($){let Z=$.map((J)=>`
|
|
9030
9103
|
<div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
|
|
9031
9104
|
${J.fallback}
|
|
9032
9105
|
</div>
|
|
@@ -9051,7 +9124,7 @@ else {
|
|
|
9051
9124
|
}
|
|
9052
9125
|
})();
|
|
9053
9126
|
</script>
|
|
9054
|
-
`}}return{initial:Z,streaming:Y()}}function
|
|
9127
|
+
`}}return{initial:Z,streaming:Y()}}function DU(){return`
|
|
9055
9128
|
/* STX Suspense Styles */
|
|
9056
9129
|
.stx-suspense {
|
|
9057
9130
|
position: relative;
|
|
@@ -9107,7 +9180,7 @@ else {
|
|
|
9107
9180
|
background-size: 200% 100%;
|
|
9108
9181
|
}
|
|
9109
9182
|
}
|
|
9110
|
-
`}function
|
|
9183
|
+
`}function EU(){return`
|
|
9111
9184
|
// STX Suspense Runtime
|
|
9112
9185
|
(function() {
|
|
9113
9186
|
if (typeof window === 'undefined') return;
|
|
@@ -9174,7 +9247,7 @@ else {
|
|
|
9174
9247
|
|
|
9175
9248
|
console.log('[stx] Suspense runtime initialized');
|
|
9176
9249
|
})();
|
|
9177
|
-
`}var
|
|
9250
|
+
`}var wU=0;var oY={};r(oY,{processAsyncDirectives:()=>bU,isAsyncComponent:()=>yU,generateAsyncComponentRuntime:()=>PU,generateAsyncComponentCSS:()=>CU,defineAsyncComponent:()=>SU});function lY(){return`async-${++kU}-${Date.now().toString(36)}`}function bU($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,X=$;return X=X.replace(J,(G,K,q,z)=>{let W=lY(),U=iY(K);return nY(W,U,q.trim(),z.trim())}),X=X.replace(Q,(G,K,q)=>{let z=lY(),W=iY(K);return nY(z,W,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function iY($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3],G=J[4],K=J[5];switch(Q){case"component":Z.component=X||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=X||K;break;case"errorComponent":Z.errorComponent=X||K;break}}return Z}function nY($,Z,Y,J){let{component:Q,timeout:X,delay:G,suspensible:K,retries:q}=Z;return`
|
|
9178
9251
|
<div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
|
|
9179
9252
|
<div class="stx-async-loading" data-async-loading="${$}">
|
|
9180
9253
|
${Y}
|
|
@@ -9401,7 +9474,7 @@ catch (error) {
|
|
|
9401
9474
|
loadComponent();
|
|
9402
9475
|
})();
|
|
9403
9476
|
</script>
|
|
9404
|
-
`}function
|
|
9477
|
+
`}function SU($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function yU($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function CU(){return`
|
|
9405
9478
|
/* STX Async Component Styles */
|
|
9406
9479
|
.stx-async-component {
|
|
9407
9480
|
position: relative;
|
|
@@ -9475,7 +9548,7 @@ catch (error) {
|
|
|
9475
9548
|
background-size: 200% 100%;
|
|
9476
9549
|
}
|
|
9477
9550
|
}
|
|
9478
|
-
`}function
|
|
9551
|
+
`}function PU(){return`
|
|
9479
9552
|
// STX Async Component Runtime
|
|
9480
9553
|
(function() {
|
|
9481
9554
|
if (typeof window === 'undefined') return;
|
|
@@ -9529,7 +9602,7 @@ catch (error) {
|
|
|
9529
9602
|
|
|
9530
9603
|
console.log('[stx] Async component runtime initialized');
|
|
9531
9604
|
})();
|
|
9532
|
-
`}var
|
|
9605
|
+
`}var kU=0;var rY={};r(rY,{shouldCacheComponent:()=>dU,processKeepAliveDirectives:()=>xU,onDeactivated:()=>cU,onActivated:()=>pU,generateKeepAliveRuntime:()=>uU,generateKeepAliveCSS:()=>mU,createKeepAliveCache:()=>hU});function sY(){return`keep-alive-${++vU}-${Date.now().toString(36)}`}function xU($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(Q,X,G)=>{let K=sY(),q=fU(X||"");return gU(K,G.trim(),q)})}function fU($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3],G=J[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=X;break;case"exclude":Z.exclude=X;break;case"id":Z.id=X;break}}return Z}function gU($,Z,Y){let{max:J,include:Q,exclude:X}=Y,G=Y.id||$;return`
|
|
9533
9606
|
<div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
|
|
9534
9607
|
<div class="stx-keep-alive-content" data-keep-alive-content="${$}">
|
|
9535
9608
|
${Z}
|
|
@@ -9816,7 +9889,7 @@ else {
|
|
|
9816
9889
|
});
|
|
9817
9890
|
})();
|
|
9818
9891
|
</script>
|
|
9819
|
-
`}function
|
|
9892
|
+
`}function hU($={}){return{id:$.id||sY(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function dU($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function mU(){return`
|
|
9820
9893
|
/* STX Keep-Alive Styles */
|
|
9821
9894
|
.stx-keep-alive {
|
|
9822
9895
|
position: relative;
|
|
@@ -9841,7 +9914,7 @@ else {
|
|
|
9841
9914
|
.stx-keep-alive-content > [data-activated] {
|
|
9842
9915
|
opacity: 1;
|
|
9843
9916
|
}
|
|
9844
|
-
`}function
|
|
9917
|
+
`}function uU(){return`
|
|
9845
9918
|
// STX Keep-Alive Runtime
|
|
9846
9919
|
(function() {
|
|
9847
9920
|
if (typeof window === 'undefined') return;
|
|
@@ -9877,19 +9950,19 @@ else {
|
|
|
9877
9950
|
|
|
9878
9951
|
console.log('[stx] Keep-alive runtime initialized');
|
|
9879
9952
|
})();
|
|
9880
|
-
`}function
|
|
9881
|
-
<div class="virtual-item ${
|
|
9882
|
-
style="position: absolute; top: ${O*
|
|
9953
|
+
`}function pU($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function cU($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var vU=0;var ZJ={};r(ZJ,{useVirtualList:()=>tY,processVirtualListDirectives:()=>U6,processVirtualGridDirectives:()=>$J,processInfiniteListDirectives:()=>eY,generateVirtualListCSS:()=>aY,default:()=>lU,createVirtualList:()=>W6});function W6($,Z){let{itemHeight:Y,containerHeight:J,overscan:Q=3,keyProperty:X="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,z=[...$],W=0,U=new Map;function B(){if(G)return _();let N=Math.max(0,Math.floor(W/Y)-Q),R=Math.ceil(J/Y),T=Math.min(z.length-1,N+R+Q*2);return{startIndex:N,endIndex:T}}function _(){let N=0,R=0,T=z.length-1;for(let M=0;M<z.length;M++){let I=U.get(M)||K;if(N+I>W){R=Math.max(0,M-Q);break}N+=I}N=0;for(let M=0;M<z.length;M++){let I=U.get(M)||K;if(N+=I,N>W+J){T=Math.min(z.length-1,M+Q);break}}return{startIndex:R,endIndex:T}}function j(){if(G){let N=0;for(let R=0;R<z.length;R++)N+=U.get(R)||K;return N}return z.length*Y}function H(N){if(G){let R=0;for(let T=0;T<N;T++)R+=U.get(T)||K;return R}return N*Y}function L(){let{startIndex:N,endIndex:R}=B();return{startIndex:N,endIndex:R,scrollTop:W,totalHeight:j(),visibleItems:z.slice(N,R+1),itemHeights:new Map(U)}}function F(N,R="auto"){let T=H(N);O(T,R)}function O(N,R="auto"){W=Math.max(0,Math.min(N,j()-J))}function V(){B()}function w(N){z=[...N],U.clear(),V()}function A(){z=[],U.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:A}}function U6($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(Q,X,G,K)=>{let q=X.trim(),z=Z[q];if(!z||!Array.isArray(z))return`<!-- virtualList: items "${q}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();W={...W,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(W.containerHeight/W.itemHeight),_=W.overscan||3,j=0,H=Math.min(z.length-1,B+_),L="";for(let O=j;O<=H&&O<z.length;O++){let V=z[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
|
|
9954
|
+
<div class="virtual-item ${W.itemClass||""}"
|
|
9955
|
+
style="position: absolute; top: ${O*W.itemHeight}px; height: ${W.itemHeight}px; width: 100%;"
|
|
9883
9956
|
data-index="${O}">
|
|
9884
9957
|
${w}
|
|
9885
|
-
</div>`}let F=
|
|
9958
|
+
</div>`}let F=z.length*W.itemHeight;return`
|
|
9886
9959
|
<div id="${U}"
|
|
9887
|
-
class="virtual-list-container ${
|
|
9888
|
-
style="position: relative; height: ${
|
|
9889
|
-
data-item-height="${
|
|
9890
|
-
data-total-items="${
|
|
9891
|
-
data-overscan="${
|
|
9892
|
-
<div class="virtual-list-viewport ${
|
|
9960
|
+
class="virtual-list-container ${W.containerClass||""}"
|
|
9961
|
+
style="position: relative; height: ${W.containerHeight}px; overflow-y: auto;"
|
|
9962
|
+
data-item-height="${W.itemHeight}"
|
|
9963
|
+
data-total-items="${z.length}"
|
|
9964
|
+
data-overscan="${_}">
|
|
9965
|
+
<div class="virtual-list-viewport ${W.viewportClass||""}"
|
|
9893
9966
|
style="position: relative; height: ${F}px; width: 100%;">
|
|
9894
9967
|
${L}
|
|
9895
9968
|
</div>
|
|
@@ -9900,11 +9973,11 @@ else {
|
|
|
9900
9973
|
if (!container) return;
|
|
9901
9974
|
|
|
9902
9975
|
const viewport = container.querySelector('.virtual-list-viewport');
|
|
9903
|
-
const itemHeight = ${
|
|
9904
|
-
const totalItems = ${
|
|
9905
|
-
const overscan = ${
|
|
9906
|
-
const containerHeight = ${
|
|
9907
|
-
const items = ${JSON.stringify(
|
|
9976
|
+
const itemHeight = ${W.itemHeight};
|
|
9977
|
+
const totalItems = ${z.length};
|
|
9978
|
+
const overscan = ${_};
|
|
9979
|
+
const containerHeight = ${W.containerHeight};
|
|
9980
|
+
const items = ${JSON.stringify(z)};
|
|
9908
9981
|
const template = ${JSON.stringify(K.trim())};
|
|
9909
9982
|
|
|
9910
9983
|
let lastStartIndex = 0;
|
|
@@ -9923,7 +9996,7 @@ else {
|
|
|
9923
9996
|
for (let i = startIndex; i <= endIndex; i++) {
|
|
9924
9997
|
const item = items[i];
|
|
9925
9998
|
const div = document.createElement('div');
|
|
9926
|
-
div.className = 'virtual-item ${
|
|
9999
|
+
div.className = 'virtual-item ${W.itemClass||""}';
|
|
9927
10000
|
div.style.cssText = 'position: absolute; top: ' + (i * itemHeight) + 'px; height: ' + itemHeight + 'px; width: 100%;';
|
|
9928
10001
|
div.dataset.index = i;
|
|
9929
10002
|
|
|
@@ -9954,7 +10027,7 @@ else {
|
|
|
9954
10027
|
};
|
|
9955
10028
|
})();
|
|
9956
10029
|
</script>
|
|
9957
|
-
`})}function
|
|
10030
|
+
`})}function aY(){return`
|
|
9958
10031
|
.virtual-list-container {
|
|
9959
10032
|
position: relative;
|
|
9960
10033
|
overflow-y: auto;
|
|
@@ -10002,7 +10075,7 @@ else {
|
|
|
10002
10075
|
0% { background-position: 200% 0; }
|
|
10003
10076
|
100% { background-position: -200% 0; }
|
|
10004
10077
|
}
|
|
10005
|
-
`}function
|
|
10078
|
+
`}function tY($,Z){let Y=null,J=()=>{if(!Y)Y=W6($(),Z);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let X=Q.target;if(Y)Y.scrollToOffset(X.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{J().scrollToIndex(Q)}}}function eY($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(Q,X,G,K,q)=>{let z=X.trim(),W=Z[z];if(!W||!Array.isArray(W))return`<!-- infiniteList: items "${z}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();U={...U,...j}}catch{}let B=`ilist-${Math.random().toString(36).substring(2,9)}`,_=U6(`@virtualList(${z}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
|
|
10006
10079
|
// Infinite scroll detection
|
|
10007
10080
|
container.addEventListener('scroll', function() {
|
|
10008
10081
|
const scrollBottom = container.scrollTop + container.clientHeight;
|
|
@@ -10014,23 +10087,23 @@ else {
|
|
|
10014
10087
|
}
|
|
10015
10088
|
});
|
|
10016
10089
|
</script>`),`
|
|
10017
|
-
<div id="${
|
|
10018
|
-
${
|
|
10090
|
+
<div id="${B}" class="infinite-list-wrapper">
|
|
10091
|
+
${_}
|
|
10019
10092
|
<div class="infinite-list-loading" style="display: none;">
|
|
10020
10093
|
${q}
|
|
10021
10094
|
</div>
|
|
10022
10095
|
</div>
|
|
10023
|
-
`})}function
|
|
10096
|
+
`})}function $J($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(Q,X,G,K)=>{let q=X.trim(),z=Z[q];if(!z||!Array.isArray(z))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let W={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();W={...W,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(z.length/W.columns),_=B*(W.rowHeight+(W.gap||0)),j=Math.ceil(W.containerHeight/(W.rowHeight+(W.gap||0))),H=W.overscan||2,L=0,F=Math.min(B-1,j+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<W.columns;w++){let A=V*W.columns+w;if(A>=z.length)break;let N=z[A],R=w*(100/W.columns),T=V*(W.rowHeight+(W.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,D)=>{if(typeof N==="object"&&N!==null)return String(N[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
|
|
10024
10097
|
<div class="virtual-grid-item"
|
|
10025
|
-
style="position: absolute; top: ${T}px; left: ${R}%; width: calc(${100/
|
|
10098
|
+
style="position: absolute; top: ${T}px; left: ${R}%; width: calc(${100/W.columns}% - ${W.gap||0}px); height: ${W.rowHeight}px;"
|
|
10026
10099
|
data-index="${A}">
|
|
10027
10100
|
${M}
|
|
10028
10101
|
</div>`}return`
|
|
10029
10102
|
<div id="${U}"
|
|
10030
10103
|
class="virtual-grid-container"
|
|
10031
|
-
style="position: relative; height: ${
|
|
10104
|
+
style="position: relative; height: ${W.containerHeight}px; overflow-y: auto;">
|
|
10032
10105
|
<div class="virtual-grid-viewport"
|
|
10033
|
-
style="position: relative; height: ${
|
|
10106
|
+
style="position: relative; height: ${_}px; width: 100%;">
|
|
10034
10107
|
${O}
|
|
10035
10108
|
</div>
|
|
10036
10109
|
</div>
|
|
@@ -10040,13 +10113,13 @@ else {
|
|
|
10040
10113
|
if (!container) return;
|
|
10041
10114
|
|
|
10042
10115
|
const viewport = container.querySelector('.virtual-grid-viewport');
|
|
10043
|
-
const columns = ${
|
|
10044
|
-
const rowHeight = ${
|
|
10045
|
-
const gap = ${
|
|
10046
|
-
const totalItems = ${
|
|
10116
|
+
const columns = ${W.columns};
|
|
10117
|
+
const rowHeight = ${W.rowHeight};
|
|
10118
|
+
const gap = ${W.gap||0};
|
|
10119
|
+
const totalItems = ${z.length};
|
|
10047
10120
|
const overscan = ${H};
|
|
10048
|
-
const containerHeight = ${
|
|
10049
|
-
const items = ${JSON.stringify(
|
|
10121
|
+
const containerHeight = ${W.containerHeight};
|
|
10122
|
+
const items = ${JSON.stringify(z)};
|
|
10050
10123
|
const template = ${JSON.stringify(K.trim())};
|
|
10051
10124
|
|
|
10052
10125
|
let lastStartRow = 0;
|
|
@@ -10090,7 +10163,7 @@ else {
|
|
|
10090
10163
|
});
|
|
10091
10164
|
})();
|
|
10092
10165
|
</script>
|
|
10093
|
-
`})}var
|
|
10166
|
+
`})}var lU;var YJ=S(()=>{lU={createVirtualList:W6,processVirtualListDirectives:U6,processInfiniteListDirectives:eY,processVirtualGridDirectives:$J,generateVirtualListCSS:aY,useVirtualList:tY}});function JJ(){return`<script data-stx-hydration-runtime>
|
|
10094
10167
|
(function() {
|
|
10095
10168
|
'use strict';
|
|
10096
10169
|
|
|
@@ -10250,7 +10323,7 @@ else {
|
|
|
10250
10323
|
stxIslands.initIslands();
|
|
10251
10324
|
}
|
|
10252
10325
|
})();
|
|
10253
|
-
</script>`}function
|
|
10326
|
+
</script>`}function XJ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function QJ($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=J.exec($))!==null){let X=Q[1],G=Q[2];if(G in Z)Y[X]=Z[G];else Y[X]=G}return Y}var OJ={};r(OJ,{processStaticDirectives:()=>jJ,processPartialHydrationDirectives:()=>KJ,onHydrated:()=>_J,isHydrated:()=>BJ,hydrateIsland:()=>zJ,hydrateByStrategy:()=>WJ,hydrateAll:()=>UJ,generatePartialHydrationCSS:()=>qJ,generateIslandManifest:()=>HJ,default:()=>eU,createIslandRegistry:()=>GJ});function GJ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function iU($){return`
|
|
10254
10327
|
<script data-hydrate="${$}">
|
|
10255
10328
|
(function() {
|
|
10256
10329
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -10261,7 +10334,7 @@ else {
|
|
|
10261
10334
|
island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
10262
10335
|
})();
|
|
10263
10336
|
</script>
|
|
10264
|
-
`}function
|
|
10337
|
+
`}function nU($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
|
|
10265
10338
|
<script data-hydrate="${$}">
|
|
10266
10339
|
(function() {
|
|
10267
10340
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -10297,7 +10370,7 @@ else {
|
|
|
10297
10370
|
}
|
|
10298
10371
|
})();
|
|
10299
10372
|
</script>
|
|
10300
|
-
`}function
|
|
10373
|
+
`}function oU($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
|
|
10301
10374
|
<script data-hydrate="${$}">
|
|
10302
10375
|
(function() {
|
|
10303
10376
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -10330,7 +10403,7 @@ else {
|
|
|
10330
10403
|
}
|
|
10331
10404
|
})();
|
|
10332
10405
|
</script>
|
|
10333
|
-
`}function
|
|
10406
|
+
`}function sU($,Z){let Y=Z.media||"(min-width: 768px)";return`
|
|
10334
10407
|
<script data-hydrate="${$}">
|
|
10335
10408
|
(function() {
|
|
10336
10409
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -10359,7 +10432,7 @@ else {
|
|
|
10359
10432
|
}
|
|
10360
10433
|
})();
|
|
10361
10434
|
</script>
|
|
10362
|
-
`}function
|
|
10435
|
+
`}function rU($){return`
|
|
10363
10436
|
<script data-hydrate="${$}">
|
|
10364
10437
|
(function() {
|
|
10365
10438
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -10381,7 +10454,7 @@ else {
|
|
|
10381
10454
|
events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
|
|
10382
10455
|
})();
|
|
10383
10456
|
</script>
|
|
10384
|
-
`}function
|
|
10457
|
+
`}function aU($,Z){let Y=Z.event||"stx:activate";return`
|
|
10385
10458
|
<script data-hydrate="${$}">
|
|
10386
10459
|
(function() {
|
|
10387
10460
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -10402,19 +10475,19 @@ else {
|
|
|
10402
10475
|
});
|
|
10403
10476
|
})();
|
|
10404
10477
|
</script>
|
|
10405
|
-
`}function
|
|
10406
|
-
`+
|
|
10407
|
-
<script type="application/json" data-island-props="${q}">${JSON.stringify(
|
|
10478
|
+
`}function KJ($,Z={},Y){let J=$,Q=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=z5(J,"load",Z),J=z5(J,"idle",Z),J=z5(J,"visible",Z),J=z5(J,"media",Z),J=tU(J),J=z5(J,"hover",Z),J=z5(J,"event",Z),Q=X&&J!==$,Q)J+=`
|
|
10479
|
+
`+JJ();return J}function z5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(Q,X,G)=>{let K={strategy:Z};if(X)try{let H=X.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,z=XJ(G.trim()),W=QJ(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(z)U.push(`data-component="${z}"`);let _=Object.keys(W).length>0?`
|
|
10480
|
+
<script type="application/json" data-island-props="${q}">${JSON.stringify(W)}</script>`:"",j="";switch(Z){case"load":j=iU(q);break;case"idle":j=nU(q,K);break;case"visible":j=oU(q,K);break;case"media":j=sU(q,K);break;case"hover":j=rU(q);break;case"event":j=aU(q,K);break}return`
|
|
10408
10481
|
<div data-island="${q}"
|
|
10409
10482
|
data-strategy="${Z}"
|
|
10410
10483
|
${U.join(`
|
|
10411
10484
|
`)}
|
|
10412
10485
|
class="stx-island"
|
|
10413
10486
|
style="contents;">
|
|
10414
|
-
${G.trim()}${
|
|
10487
|
+
${G.trim()}${_}
|
|
10415
10488
|
</div>
|
|
10416
10489
|
${j}
|
|
10417
|
-
`})}function
|
|
10490
|
+
`})}function tU($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
|
|
10418
10491
|
<div data-island="${Q}"
|
|
10419
10492
|
data-strategy="only"
|
|
10420
10493
|
class="stx-island stx-client-only">
|
|
@@ -10433,7 +10506,7 @@ else {
|
|
|
10433
10506
|
}
|
|
10434
10507
|
})();
|
|
10435
10508
|
</script>
|
|
10436
|
-
`})}function
|
|
10509
|
+
`})}function qJ(){return`
|
|
10437
10510
|
/* Island base styles */
|
|
10438
10511
|
.stx-island {
|
|
10439
10512
|
display: contents;
|
|
@@ -10474,11 +10547,11 @@ else {
|
|
|
10474
10547
|
.stx-island.hydrated {
|
|
10475
10548
|
opacity: 1;
|
|
10476
10549
|
}
|
|
10477
|
-
`}function
|
|
10550
|
+
`}function zJ($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function WJ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function UJ(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function BJ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function _J($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function jJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function HJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
|
|
10478
10551
|
<script type="application/json" id="stx-island-manifest">
|
|
10479
10552
|
${JSON.stringify(Z)}
|
|
10480
10553
|
</script>
|
|
10481
|
-
`}var
|
|
10554
|
+
`}var eU;var LJ=S(()=>{eU={processPartialHydrationDirectives:KJ,processStaticDirectives:jJ,generatePartialHydrationCSS:qJ,generateIslandManifest:HJ,createIslandRegistry:GJ,hydrateIsland:zJ,hydrateByStrategy:WJ,hydrateAll:UJ,isHydrated:BJ,onHydrated:_J}});var EJ={};r(EJ,{watchMultiple:()=>NJ,watchEffect:()=>RJ,watch:()=>AJ,unref:()=>FJ,toRefs:()=>VJ,throttledComputed:()=>DJ,stxWatchMultiple:()=>NJ,stxWatchEffect:()=>RJ,stxWatch:()=>AJ,stxUnref:()=>FJ,stxToRefs:()=>VJ,stxThrottledComputed:()=>DJ,stxShallowRef:()=>wJ,stxRef:()=>W5,stxIsRef:()=>F1,stxDebouncedComputed:()=>IJ,stxComputed:()=>s5,shallowRef:()=>wJ,ref:()=>W5,processWatchDirectives:()=>MJ,processComputedDirectives:()=>TJ,isRef:()=>F1,default:()=>$B,debouncedComputed:()=>IJ,computed:()=>s5});function W5($){let Z=$,Y=new Set,J={get value(){if(t0){let Q=o5.get(J);if(!Q)Q=new Set,o5.set(J,Q);Q.add(t0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let X=o5.get(J);if(X)X.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return J}function F1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function FJ($){return F1($)?$.value:$}function VJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=W5($[Y]);return Z}function wJ($){return W5($)}function s5($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,X,G=!0,K=new Set,q=new Set,z=()=>{if(G=!0,q.size>0){let B=U.value;q.forEach((_)=>_(B))}};function W(){K.clear();let B=t0;t0=z,D$.push(z);try{return Y()}finally{D$.pop(),t0=B}}let U={get value(){if(t0){let B=o5.get(U);if(!B)B=new Set,o5.set(U,B);B.add(t0)}if(G){let B=W();if(!Q(X,B))X=B;G=!1}return X},set value(B){if(J)J(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)X=Y(),G=!1;return X},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function AJ($,Z,Y={}){let{immediate:J=!1,deep:Q=!1,flush:X="pre",once:G=!1}=Y,K,q=!0,z=!1,W=()=>{if(F1($))return Q?g1($.value):$.value;return $()},U=()=>{if(!q||z)return;let j=W();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?g1(j):j,G)_()};if(X==="sync")H();else if(X==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(F1($))B=$.subscribe(()=>U());else B=s5($).subscribe(()=>U());if(J)K=void 0,U();else K=W();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{z=!0},_.resume=()=>{z=!1},_}function NJ($,Z,Y={}){let{immediate:J=!1,once:Q=!1}=Y,X=$.map((U)=>F1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((B)=>F1(B)?B.value:void 0);if(Z(U,X),X=[...U],Q)W()},z=$.map((U)=>{if(F1(U))return U.subscribe(()=>q());return()=>{}});if(J)q();let W=()=>{G=!1,z.forEach((U)=>U())};return W.pause=()=>{K=!0},W.resume=()=>{K=!1},W}function RJ($,Z={}){let{flush:Y="pre"}=Z,J,Q=!0,X=!1,G=()=>{if(!Q||X)return;if(J)J();let q=t0;t0=G,D$.push(G);try{J=$()}finally{D$.pop(),t0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,J)J()};return K.pause=()=>{X=!0},K.resume=()=>{X=!1},K}function TJ($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(Q,X,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[X]=q,`<!-- computed: ${X} = ${q} -->`}catch(K){return`<!-- computed error: ${X} - ${K} -->`}})}function MJ($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(Q,X,G)=>{return`
|
|
10482
10555
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
10483
10556
|
(function() {
|
|
10484
10557
|
// Watch implementation for ${X}
|
|
@@ -10490,9 +10563,9 @@ else {
|
|
|
10490
10563
|
}
|
|
10491
10564
|
})();
|
|
10492
10565
|
</script>
|
|
10493
|
-
`})}function g1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>g1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,Q)=>Y.set(g1(Q),g1(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(g1(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=g1($[Y]);return Z}function
|
|
10494
|
-
`)}catch{return""}})}function
|
|
10495
|
-
`)}catch{return""}})}function
|
|
10566
|
+
`})}function g1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>g1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,Q)=>Y.set(g1(Q),g1(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(g1(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=g1($[Y]);return Z}function IJ($,Z=100){let Y=W5($()),J=null,Q=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return s5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function DJ($,Z=100){let Y=W5($()),J=0,Q=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return s5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var t0=null,D$,o5,$B;var kJ=S(()=>{D$=[],o5=new WeakMap;$B={ref:W5,computed:s5,watch:AJ,watchMultiple:NJ,watchEffect:RJ,isRef:F1,unref:FJ,toRefs:VJ,shallowRef:wJ,debouncedComputed:IJ,throttledComputed:DJ,processComputedDirectives:TJ,processWatchDirectives:MJ}});var CJ={};r(CJ,{v:()=>ZB,processHasErrorsDirective:()=>yJ,processFormValidationDirectives:()=>JB,processErrorsDirective:()=>SJ,processErrorDirective:()=>bJ,defineForm:()=>YB,Validator:()=>U5});class U5{rules=[];defaultValue="";addRule($){let Z=new U5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Y}})}length($,Z,Y){let J=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:J,validate:(Q)=>{if(!Q)return!0;let X=String(Q).length;return X>=$&&X<=Z||J}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Y}})}between($,Z,Y){let J=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:J,validate:(Q)=>{if(!Q&&Q!==0)return!0;let X=Number(Q);return X>=$&&X<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,Q)=>{if(!Q)return!0;return J===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return $.includes(J)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),J=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new U5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(Q,X)=>{if(!$(Q,X||{}))return!0;return J.validate(Q,X)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new U5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let Q=await J.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let Q=J.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function YB($,Z){let Y=Object.keys($),J={},Q={},X={},G={},K={};for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],X[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function z(O){K[O]=!0;let V=await $[O].validate(J[O],J);return Q[O]=V,K[O]=!1,V.length===0}async function W(){q=!0;let O=await Promise.all(Y.map(z));return q=!1,O.every(Boolean)}function U(){for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],X[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)J[V]=O[V],G[V]=!0}function _(O,V){J[O]=V,G[O]=!0}function j(O,V=!0){if(X[O]=V,V)z(O)}function H(O){return{value:J[O],errors:Q[O],touched:X[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)X[A]=!0;if(await W())await O(J)}}return{values:J,errors:Q,touched:X,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:W,validateField:z,reset:U,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function bJ($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let z=q;if(!z||!Array.isArray(z)||z.length===0)return"";return z.map((W)=>{return G.replace(/\{\{\s*message\s*\}\}/g,W)}).join(`
|
|
10567
|
+
`)}catch{return""}})}function SJ($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let z=q;if(!z||!Array.isArray(z)||z.length===0)return"";return z.map((W)=>G.replace(/\{\{\s*message\s*\}\}/g,W)).join(`
|
|
10568
|
+
`)}catch{return""}})}function yJ($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let z=q;if(!z||!Array.isArray(z)||z.length===0)return"";return G}catch{return""}})}function JB($,Z,Y){let J=$;return J=bJ(J,Z,Y),J=SJ(J,Z,Y),J=yJ(J,Z,Y),J}var ZB;var PJ=S(()=>{ZB=new U5});var fJ={};r(fJ,{processXElementDirectives:()=>XB,hasXElementDirectives:()=>xJ,generateXElementRuntime:()=>vJ});function vJ(){return`<script data-stx-scoped>
|
|
10496
10569
|
(function() {
|
|
10497
10570
|
'use strict';
|
|
10498
10571
|
|
|
@@ -10776,9 +10849,9 @@ else {
|
|
|
10776
10849
|
// Expose for manual initialization
|
|
10777
10850
|
window.XElement = XElement;
|
|
10778
10851
|
})();
|
|
10779
|
-
</script>`}function
|
|
10852
|
+
</script>`}function xJ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function XB($){if(!xJ($))return $;let Z=vJ(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
|
|
10780
10853
|
`+$.slice(Y);return $+`
|
|
10781
|
-
`+Z}var
|
|
10854
|
+
`+Z}var gJ={};r(gJ,{rewriteImagesWithSiblings:()=>KB});import X1 from"path";async function KB($,Z){let Y=Z.formats??GB;if(!Z.publicDir)return $;let J=WB($),Q=[],X=/<img\b[^>]*?>/gi,G=[],K;while((K=X.exec($))!==null){let U=K[0],B=U.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(UB(K.index,J))continue;G.push({idx:K.index,length:U.length,src:B[1],raw:U})}if(G.length===0)return $;let q=await Promise.all(G.map(async(U)=>{let B=await qB(U.src,Z.publicDir,Y);return{match:U,sources:B}}));for(let{match:U,sources:B}of q){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${BB(H.url)}">`).join("")}${U.raw}</picture>`;Q.push({start:U.idx,end:U.idx+U.length,replacement:j})}if(Q.length===0)return $;let z="",W=0;for(let U of Q)z+=$.slice(W,U.start),z+=U.replacement,W=U.end;return z+=$.slice(W),z}async function qB($,Z,Y){if(!zB($))return[];let J=X1.extname($).toLowerCase();if(!QB.has(J))return[];if(!$.startsWith("/"))return[];let Q=X1.join(Z,$.slice(1)),X=X1.dirname(Q),G=X1.basename(Q,J),K=X1.resolve(X),q=X1.resolve(Z);if(!K.startsWith(q))return[];let z=X1.posix.dirname($),W=Y.map(async(B)=>{let _=X1.join(X,`${G}${B.ext}`);if(!await Bun.file(_).exists())return null;return{url:X1.posix.join(z,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(W)).filter((B)=>B!==null)}function zB($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function WB($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);return Z}function UB($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function BB($){return $.replace(/&/g,"&").replace(/"/g,""")}var QB,GB;var hJ=S(()=>{QB=new Set([".jpg",".jpeg",".png",".gif"]),GB=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var dJ=()=>{};function B6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var mJ=S(()=>{dJ()});var uJ={};r(uJ,{injectPwaTags:()=>_B,generateThemeColorMeta:()=>OB,generateSwRegistrationScript:()=>jB,generatePwaTags:()=>E$,generateManifestLink:()=>HB});function E$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=B6($),X=`
|
|
10782
10855
|
<!-- stx PWA Meta Tags -->
|
|
10783
10856
|
<link rel="manifest" href="/manifest.json">
|
|
10784
10857
|
<meta name="theme-color" content="${_6(Y?.themeColor||"#000000")}">
|
|
@@ -10822,12 +10895,12 @@ if ('serviceWorker' in navigator) {
|
|
|
10822
10895
|
});
|
|
10823
10896
|
}
|
|
10824
10897
|
</script>
|
|
10825
|
-
<!-- End stx PWA -->`,X}function
|
|
10898
|
+
<!-- End stx PWA -->`,X}function _B($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let X=E$(Z);return $.slice(0,Q)+X+`
|
|
10826
10899
|
`+$.slice(Q)}return $+E$(Z)}let J=E$(Z);return $.replace("</head>",`${J}
|
|
10827
|
-
</head>`)}function
|
|
10900
|
+
</head>`)}function jB($){if(!$.pwa?.enabled)return"";return`<script>
|
|
10828
10901
|
if ('serviceWorker' in navigator) {
|
|
10829
10902
|
window.addEventListener('load', function() {
|
|
10830
|
-
navigator.serviceWorker.register('/${
|
|
10903
|
+
navigator.serviceWorker.register('/${B6($)}')
|
|
10831
10904
|
.then(function(registration) {
|
|
10832
10905
|
console.log('[PWA] Service Worker registered:', registration.scope);
|
|
10833
10906
|
})
|
|
@@ -10836,43 +10909,43 @@ if ('serviceWorker' in navigator) {
|
|
|
10836
10909
|
});
|
|
10837
10910
|
});
|
|
10838
10911
|
}
|
|
10839
|
-
</script>`}function
|
|
10840
|
-
`,J+2),J===-1)return-1;J+=1,Q=!0;continue}if(K==="/"&&$[J+1]==="*"){let q=$.indexOf("*/",J+2);if(q===-1)return-1;J=q+2,Q=!0;continue}if(K==="/"&&Q){let q=J+1,
|
|
10912
|
+
</script>`}function HB(){return'<link rel="manifest" href="/manifest.json">'}function OB($){return`<meta name="theme-color" content="${_6($)}">`}function _6($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var pJ=S(()=>{mJ()});import y0 from"path";import{deriveLayoutGroup as LB}from"stx-router/layout-metadata";function cJ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function FB($,Z){let Y=$.length,J=Z,Q=!0,X=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(J<Y){let K=$[J];if(G(J))return J;if(K==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
|
|
10913
|
+
`,J+2),J===-1)return-1;J+=1,Q=!0;continue}if(K==="/"&&$[J+1]==="*"){let q=$.indexOf("*/",J+2);if(q===-1)return-1;J=q+2,Q=!0;continue}if(K==="/"&&Q){let q=J+1,z=!1;while(q<Y){let W=$[q];if(W==="\\"){q+=2;continue}if(W==="[")z=!0;else if(W==="]")z=!1;else if(W==="/"&&!z){q++;break}else if(W===`
|
|
10841
10914
|
`){q=-1;break}q++}if(q===-1){J++,Q=!1;continue}while(q<Y&&/[a-z]/.test($[q]))q++;J=q,Q=!1;continue}if(K==="'"||K==='"'){let q=K;J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]===q){J++;break}if($[J]===`
|
|
10842
|
-
`)break;J++}Q=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){X.push(!0),J+=2,Q=!0;break}J++}if(X.length===0)Q=!1;continue}if(K==="}"&&X.length>0){X.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Q=!1;break}if($[J]==="$"&&$[J+1]==="{"){X.push(!0),J+=2,Q=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;J++}return-1}async function
|
|
10843
|
-
`),...
|
|
10844
|
-
<meta name="stx-layout" content="${
|
|
10845
|
-
<meta name="stx-layout-group" content="${
|
|
10846
|
-
`+
|
|
10915
|
+
`)break;J++}Q=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){X.push(!0),J+=2,Q=!0;break}J++}if(X.length===0)Q=!1;continue}if(K==="}"&&X.length>0){X.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Q=!1;break}if($[J]==="$"&&$[J+1]==="{"){X.push(!0),J+=2,Q=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;J++}return-1}async function H0($,Z,Y,J,Q){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;let X=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!C5()&&!v4())&&Y&&Y.endsWith(".stx"))q3($,Y);try{return await Q9.timeAsync("template-processing",async()=>{let G=await VB($,Z,Y,J,Q);if(X)G=G6(G);if(X&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},z=(Z.__stx_runtime_head||null)??D5(),W=(Z.__stx_head_raw||"").trim(),U,B=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)U=B[1].trim(),W=W.replace(B[0],"").trim();let _=Z.__sections?.title,j=z.title||U||_,H={...K,...j&&{title:j},meta:[...K.meta||[],...z.meta||[]],link:[...K.link||[],...z.link||[]],script:[...K.script||[],...z.script||[]],headRaw:[K.headRaw,W].filter(Boolean).join(`
|
|
10916
|
+
`),...z.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...z.htmlAttrs}},...z.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...z.bodyAttrs}}},L=p3(G);if(G=QY(G,H),L)G=XY(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=LB(V);G=G.replace("<head>",`<head>
|
|
10917
|
+
<meta name="stx-layout" content="${cJ(V)}">
|
|
10918
|
+
<meta name="stx-layout-group" content="${cJ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(X)G=JY(G);if(X)try{let{getStoreScript:K}=await Promise.resolve().then(() => (CY(),yY)),q=J.storesDir,z=await K(q);if(z){let W=`<script data-stx-stores>${z}</script>`,U=G.indexOf("<script data-stx-scoped>");if(U!==-1){let B=G.indexOf("</script>",U+24);if(B!==-1){let _=B+9;G=G.slice(0,_)+`
|
|
10919
|
+
`+W+G.slice(_)}}}}catch{}if(X&&Z.__stx_inject_css!==!1)G=await f5(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof h4)throw G;let K=G instanceof Error?G.message:String(G),q=new k1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(c0.log(q,{filePath:Y,context:Z}),C7.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),J.debug)throw q;return S7.createFallbackContent("Template Processing",q)}}async function VB($,Z,Y,J,Q){let X=process.cwd(),G={...J,partialsDir:J.partialsDir&&!y0.isAbsolute(J.partialsDir)?y0.resolve(X,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!y0.isAbsolute(J.componentsDir)?y0.resolve(X,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!y0.isAbsolute(J.layoutsDir)?y0.resolve(X,J.layoutsDir):J.layoutsDir},K=G,q=$;await NB(Y,Z),AB(Z,K),q=await r1(()=>u2(q,Z,Y,K),q,(O)=>{c0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let z=R5(q,s6,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=z.output;let W=z.tokens,U=(O)=>W.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>W[Number(w)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=e2(q),q=await DY(q,Y,Q);let _={};q=d3(q,_);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",A=y0.dirname(Y),N=K.layoutsDir?y0.dirname(K.layoutsDir):process.cwd();for(let R=0;R<20;R++){let T=y0.join(A,"_layout.stx");if(await n(T)){w=T;break}let M=y0.dirname(A);if(M===A||M.length<N.length)break;A=M}if(w)H=w;else if(K.layoutsDir){let R=y0.isAbsolute(K.layoutsDir)?K.layoutsDir:y0.resolve(process.cwd(),K.layoutsDir),T=y0.join(R,`${K.defaultLayout}.stx`);if(await n(T))H=T}if(H&&!V)q=`@section('content')
|
|
10847
10920
|
${q.trim()}
|
|
10848
|
-
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return j[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=Z0(w.trim(),Z);if(A===void 0)return O;return j[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))j[V]=w.replace("@parent",h1);else j[V]=w.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return j[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=
|
|
10921
|
+
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return j[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=Z0(w.trim(),Z);if(A===void 0)return O;return j[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))j[V]=w.replace("@parent",h1);else j[V]=w.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return j[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=m3(q,_),H){let O=[];if(q=q.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,(V)=>{return O.push(V),""}),O.length>0){let V=O.join(`
|
|
10849
10922
|
`);j.content=j.content?`${j.content}
|
|
10850
|
-
${V}`:V,Z.__sections=j}}if(H)try{let O;if(
|
|
10851
|
-
${q}`,U(q)}catch(O){return c0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await
|
|
10852
|
-
`;if(X=M(X,Z),X=I(X,Z),X=
|
|
10923
|
+
${V}`:V,Z.__sections=j}}if(H)try{let O;if(y0.isAbsolute(H))O=H,Q.add(H);else O=await r1(()=>r$(H,Y,G,Q),null,()=>{throw new k1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(c0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new k1(T,Y);return q}let V=await r1(()=>Bun.file(O).text(),"",()=>{throw new k1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,P,b)=>{return T[P]=b.trim(),""});for(let[E,P]of Object.entries(T))if(j[E]&&j[E].includes(h1)){let b=j[E].indexOf(h1);j[E]=j[E].slice(0,b)+P+j[E].slice(b+h1.length)}else if(!j[E])j[E]=P;let I={...Z,__sections:j},D=`@layout('${w[1]}')${M}`;return await H0(D,I,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=d3(A,_),R={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return R[M]=I.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let D=j[M];if(D.includes(h1)){let E=R[M]||"",P=D.indexOf(h1);D=D.slice(0,P)+E+D.slice(P+h1.length)}return D}return I||""}),N=wB(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=m3(N,_),Z.__originalFilePath=Y,q=await lJ(N,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
|
|
10924
|
+
${q}`,U(q)}catch(O){return c0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await lJ(q,Z,Y,G,Q))}function wB($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,Q)=>{let X=Z[J];if(X!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(X))return X}return Q||""})}function AB($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Q,X]of Object.entries(process.env))if(Q.startsWith(Y)&&X!==void 0)J[Q]=X;$.$env=J}async function NB($,Z){await r1(()=>n2($,Z),void 0,(Y)=>{c0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function RB($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=J.exec($))!==null){let X=Q[1],G=Q[2];if(!/\bserver\b/.test(X)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (b5(),q4));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let z=q instanceof Error?q:Error(String(q));c0.log(z,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${z.message}`)}}}async function TB($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await Promise.resolve().then(() => (r0(),Y9));return J($,Z,{skipServer:!0})}catch(J){let Q=J instanceof Error?J:Error(String(J));return c0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function lJ($,Z,Y,J,Q){let X=$,G=J;if(await RB(X,Z,Y),X=await TB(X,Z,Y),X=await x2(X,Z,Y),X=await f2(X,Z,Y),X=await CZ(X,Z,Y,G),p1(X))X=e3(X,Z),X=Z6(X,Z);X=$6(X);let{processStreamDirectives:K}=await Promise.resolve().then(() => (K3(),G3));X=K(X,Z),X=x3(X,Z,Y,G),X=await G$(X,Z,Y,G,Q),X=await ZY(X,Z,Y,G,Q),X=I6(X,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => vY);X=q(X,Z,Y);let{processTeleportDirectives:z}=await Promise.resolve().then(() => fY);X=z(X,Z,Y);let{processTransitionDirectives:W,processTransitionAttributes:U}=await Promise.resolve().then(() => mY);X=W(X,Z,Y),X=U(X);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => pY);X=B(X,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => cY);X=_(X,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => oY);X=j(X,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => rY);X=H(X,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (YJ(),ZJ));X=L(X,Z,Y),X=F(X,Z,Y),X=O(X,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (LJ(),OJ));X=V(X,Z,Y),X=w(X);let{processComputedDirectives:A,processWatchDirectives:N}=await Promise.resolve().then(() => (kJ(),EJ));X=A(X,Z,Y),X=N(X,Z,Y);let{processFormValidationDirectives:R}=await Promise.resolve().then(() => (PJ(),CJ));X=R(X,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:D}=await Promise.resolve().then(() => (E5(),p$));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=T(X);if(X=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
|
|
10925
|
+
`;if(X=M(X,Z),X=I(X,Z),X=l2(X),X=n7(X,Z),X=SZ(X),X=d2(X),X=await h3(X,Z,Y,G,Q),X=await G$(X,Z,Y,G,Q),X=X.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),X=G6(X),X=C1(X,Z,Y),X=o7(X,Z),X=s7(X,Z),X=t4(X,Z),X=gZ(X,Z),X=hZ(X,Z),X=await LZ(X,Z,Y,G),X=await I9(X,Z,Y),X=await cZ(X,Z,Y,G),X=V6(X,Z,Y,G),X=P8(X,Z,Y,G),X=v8(X,Z,Y),X=x8(X,Z,Y,G),X=EZ(X,Z,Y,G),X=X6(X,Z),X=Q6(X),X=kY(X),!G.skipEventDirectives)X=WZ(X,Z,Y);if(X=HZ(X,Z,Y),G.debug){let C=/\bx-data\s*=/.test(X),x=M$($);if(C&&x)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
10853
10926
|
Both work on the same page, but they manage separate scopes.
|
|
10854
|
-
Prefer signals (state/derived/effect) for new components.`)}X=
|
|
10927
|
+
Prefer signals (state/derived/effect) for new components.`)}X=r2(X,Z),X=await s0(X,Z,Y),X=bY(X),X=SY(X),X=ZZ(X);let{processXElementDirectives:P}=await Promise.resolve().then(() => fJ);X=P(X);let b=Z.__originalFilePath||Y,k=w5(Z);if(X=await Y6(X,G,b,k),X=await p2(X,Z,Y,G),G.media?.image?.autoSiblings){let C=G.publicDir||"public",{rewriteImagesWithSiblings:x}=await Promise.resolve().then(() => (hJ(),gJ));X=await x(X,{publicDir:C})}if(G.seo?.enabled)X=f8(X,Z,G);let y=(C,x)=>{if(!x)return C;if(/<\/head>/i.test(C))return C.replace(/<\/head>/i,`${x}
|
|
10855
10928
|
</head>`);if(/<head\b[^>]*>/i.test(C))return C.replace(/(<head\b[^>]*>)/i,`$1
|
|
10856
10929
|
${x}`);if(/<html\b[^>]*>/i.test(C))return C.replace(/(<html\b[^>]*>)/i,`$1
|
|
10857
10930
|
<head>
|
|
10858
10931
|
${x}
|
|
10859
|
-
</head>`);return C},{renderHead:g,getHead:h}=await Promise.resolve().then(() => (
|
|
10860
|
-
${
|
|
10861
|
-
</script>`;if(X.includes("</head>")){let u=X.indexOf("</head>"),X0=X.slice(0,u).indexOf("<script");if(X0!==-1){let
|
|
10862
|
-
`+
|
|
10932
|
+
</head>`);return C},{renderHead:g,getHead:h}=await Promise.resolve().then(() => (E5(),p$)),m=Z.__stx_runtime_head,i=m&&(m.title||m.meta?.length||m.link?.length)?m:h();if(i.title||i.meta?.length||i.link?.length){let C=g(i);if(C)X=y(X,C)}if(E.headContent)X=y(X,E.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)X=DZ(X,G.csp,Z);if(G.analytics?.enabled)X=JZ(X,G);if(G.heatmap?.enabled)X=S6(X,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:C}=await Promise.resolve().then(() => (pJ(),uJ));X=C(X,G)}let c=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),z0=/\bSTX\.\w+/.test(X),F0=/window\.STX\s*=/.test(X);if(c&&z0&&!F0){let x=`<script data-stx-scoped>
|
|
10933
|
+
${a8()}
|
|
10934
|
+
</script>`;if(X.includes("</head>")){let u=X.indexOf("</head>"),X0=X.slice(0,u).indexOf("<script");if(X0!==-1){let q0=X.slice(0,X0),C0=X.slice(X0);X=q0+x+`
|
|
10935
|
+
`+C0}else X=X.replace("</head>",`${x}
|
|
10863
10936
|
</head>`)}else if(X.includes("<body"))X=X.replace(/<body([^>]*)>/,`<body$1>
|
|
10864
10937
|
${x}`);else X=x+`
|
|
10865
|
-
`+X}{let C=/<script\s+server\b[^>]*>/gi,x,u=[];while((x=C.exec(X))!==null){let p=x.index+x[0].length,X0=
|
|
10938
|
+
`+X}{let C=/<script\s+server\b[^>]*>/gi,x,u=[];while((x=C.exec(X))!==null){let p=x.index+x[0].length,X0=FB(X,p);if(X0===-1)continue;let q0=X0+9;while(q0<X.length&&/\s/.test(X[q0]))q0++;u.push({start:x.index,end:q0}),C.lastIndex=q0}for(let p=u.length-1;p>=0;p--){let{start:X0,end:q0}=u[p];X=X.substring(0,X0)+X.substring(q0)}}let _0=Q4(X,Y);if(_0.hasScoped)X=_0.html;let $0=Z.__stx_event_bindings||[],I0=!1,f0=[],v=/\s:[a-z][\w.-]*\s*=/.test(X),{scanScriptTags:f}=await Promise.resolve().then(() => (J6(),TY));for(let C of f(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))f0.push({match:C.fullMatch,attrs:C.attrs,content:C.body});for(let{match:C,attrs:x,content:u}of f0){I0=!0;let p=u;q6(u,Y,J.strict);let X0=await A5(u,{eventBindings:$0,attrs:x,hasColonDirectives:v,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:k});X=X.replace(C,()=>X0)}if(I0)Z.__stx_event_bindings=[];return X}var h1="<!--PARENT_CONTENT_PLACEHOLDER-->";var W4=S(()=>{c4();X4();S$();t8();YZ();XZ();P$();y$();UZ();N5();OZ();FZ();s4();kZ();yZ();vZ();Y1();E5();r0();dZ();lZ();v2();h2();f3();a$();c2();i1();i2();P7();A0();o2();a2();$Y();YY();u$();J6();v3();EY();K6();z6();R0();z3();K6();z6()});import L0 from"fs";import J0 from"path";import{matchRoute as nB,Router as qX}from"stx-router";import{findErrorPage as rB,formatRoutes as aB,generateRouteManifest as tB,generateRouteTypes as eB,matchRoute as $_}from"stx-router";function b$($,Z={}){return new qX($,Z).routes}W4();import{createHash as MB}from"crypto";function IB($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var DB=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function EB($){return Bun.hash($).toString(16)}function iJ($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,J=$.replace(DB,(X,G,K,q)=>{let z=q.trim();if(!z)return X;if(/\bdata-stx-src=/.test(K))return X;if(Z.minify)z=IB(z);let W=EB(z);if(!Y.has(W))Y.set(W,z);let U=Z.integrity?` data-stx-integrity="sha384-${MB("sha384").update(z).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${W}.js"${U}${K}></script>`}),Q=Array.from(Y,([X,G])=>({hash:X,code:G}));return{html:J,chunks:Q}}var kB=new Set(["visible","idle"]);function nJ($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Y.exec($))!==null)Z.set(J[1],J[2]);let Q=new Set,X=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=X.exec($))!==null)if(kB.has(Z.get(G[1])||""))Q.add(G[2]);let K=$.lastIndexOf("</head>");if(Q.size===0||K===-1)return $;let q=Array.from(Q).filter((z)=>!$.includes(`rel="prefetch" href="${z}"`)).map((z)=>`<link rel="prefetch" href="${z}" as="script">`).join("");if(!q)return $;return $.slice(0,K)+q+$.slice(K)}t1();L5();c4();import{abortNavigation as YA,clearMiddleware as oJ,createClientCookieManager as JA,createMiddlewareContext as sJ,createRouteLocation as rJ,createServerCookieManager as XA,createStorageManager as QA,defineMiddleware as GA,getMiddleware as KA,getMiddlewareNames as aJ,hasMiddleware as qA,loadMiddlewareFromDirectory as tJ,navigateTo as zA,registerMiddleware as WA,runMiddleware as eJ}from"stx-router";class $X{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=J0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,J]of Object.entries(Z))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await L0.promises.mkdir(this.cacheDir,{recursive:!0});let $=J0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,J]of this.cache)Z[Y]=J;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=L0.statSync($),J=`${$}:${Y.mtimeMs}`;for(let X of Z)if(L0.existsSync(X)){let G=L0.statSync(X);J+=`:${X}:${G.mtimeMs}`}let Q=0;for(let X=0;X<J.length;X++){let G=J.charCodeAt(X);Q=(Q<<5)-Q+G,Q=Q&Q}return Math.abs(Q).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let J=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==J)return this.cache.delete($),null;return Y.html}set($,Z,Y,J){let Q=this.getHash(Z,Y);this.cache.set($,{hash:Q,html:J,generatedAt:Date.now(),dependencies:Y})}}class ZX{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return J0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await L0.promises.mkdir(J0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await L0.promises.unlink(Z)}async invalidatePattern($){let Z=J0.join(this.cacheDir,"isr");if(!L0.existsSync(Z))return;let Y=await L0.promises.readdir(Z);for(let J of Y){let Q=J.replace(/_/g,"/").replace(".json","");if($.test(Q))await L0.promises.unlink(J0.join(Z,J))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function bB($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let J=Y[1];if(!J.includes("getStaticPaths"))return null;let Q=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!Q)return null;return await Function(`
|
|
10866
10939
|
return (async function getStaticPaths() {
|
|
10867
10940
|
${Q[1]}
|
|
10868
10941
|
})()
|
|
10869
|
-
`)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function
|
|
10942
|
+
`)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function SB($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let Y=await bB($.filePath);if(!Y||Y.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let J of Y.paths){let Q=$.pattern;for(let[X,G]of Object.entries(J.params))Q=Q.replace(`:${X}`,G).replace(`:${X}*`,G);Z.push({url:Q,params:J.params,props:J.props,revalidate:J.revalidate})}}return Z}async function yB($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Y of Z)if(await Bun.file(Y).exists())try{let J=await import(Y);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:Q,...X}=J;return X}}catch(J){console.error(`Error loading data file ${Y}:`,J)}return null}async function CB($,Z,Y){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let Q=J[1];if(!Q.includes("getStaticProps"))return null;try{let X=Q.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!X)return null;return await Function("params",`
|
|
10870
10943
|
return (async function getStaticProps() {
|
|
10871
10944
|
${X[1]}
|
|
10872
10945
|
})()
|
|
10873
|
-
`)(Z)}catch(X){return console.error(`Error executing getStaticProps in ${Y}:`,X),null}}async function
|
|
10874
|
-
</head>`);else U=`${
|
|
10875
|
-
${U}`}if(U=await
|
|
10946
|
+
`)(Z)}catch(X){return console.error(`Error executing getStaticProps in ${Y}:`,X),null}}async function YX($,Z,Y={},J,Q){let X=await Bun.file($.filePath).text(),G=await yB($.filePath),K=await CB(X,Z,$.filePath),q={...G||{},...K||{},...Y,params:Z,$route:{path:$.pattern,params:Z}},z=new Set,W={...Q,debug:!1,cache:!1,autoShell:!0},U=await H0(X,q,$.filePath,W,z);if(Object.keys(Z).length>0){let B=`<script>if(window.stx)window.stx._rp=${JSON.stringify(Z)};else window.__stx_rp=${JSON.stringify(Z)};</script>`;if(U.includes("</head>"))U=U.replace("</head>",`${B}
|
|
10947
|
+
</head>`);else U=`${B}
|
|
10948
|
+
${U}`}if(U=await a3(U),U=await f5(U),J.minify!==!1)return{html:PB(U),dependencies:Array.from(z)};return{html:U,dependencies:Array.from(z)}}function PB($){let Z=[],Y=0,J=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,Q;while((Q=J.exec($))!==null){let G=$.slice(Y,Q.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=Q[1],q=Q[2],z=Q[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+q+z),Y=Q.index+Q[0].length}let X=$.slice(Y);return Z.push(X.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function vB($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function xB($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
10876
10949
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
10877
10950
|
${$.map((J)=>{let Q=new URL(J.loc,Z).href,X=` <url>
|
|
10878
10951
|
<loc>${n0(Q)}</loc>`;if(J.lastmod)X+=`
|
|
@@ -10881,7 +10954,7 @@ ${$.map((J)=>{let Q=new URL(J.loc,Z).href,X=` <url>
|
|
|
10881
10954
|
<priority>${J.priority}</priority>`;return X+=`
|
|
10882
10955
|
</url>`,X}).join(`
|
|
10883
10956
|
`)}
|
|
10884
|
-
</urlset>`}function n0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function
|
|
10957
|
+
</urlset>`}function n0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function fB($,Z){let Y=Z.map((J)=>{let Q=" <item>";if(Q+=`
|
|
10885
10958
|
<title>${n0(J.title)}</title>`,Q+=`
|
|
10886
10959
|
<link>${n0(J.link)}</link>`,J.description)Q+=`
|
|
10887
10960
|
<description>${n0(J.description)}</description>`;if(J.pubDate)Q+=`
|
|
@@ -10902,10 +10975,10 @@ ${$.map((J)=>{let Q=new URL(J.loc,Z).href,X=` <url>
|
|
|
10902
10975
|
${Y.join(`
|
|
10903
10976
|
`)}
|
|
10904
10977
|
</channel>
|
|
10905
|
-
</rss>`}async function
|
|
10978
|
+
</rss>`}async function gB($={}){let Z=Date.now(),Y=await S1(),J={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:$.domain||"http://localhost",revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||G1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},Q={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},X=new Set,G=0,K={},q={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&L0.existsSync(J.outputDir))await L0.promises.rm(J.outputDir,{recursive:!0});await L0.promises.mkdir(J.outputDir,{recursive:!0});let W=new $X(J.cacheDir);if(J.cache)await W.load();try{let{preloadIconCollection:V}=await Promise.resolve().then(() => (J$(),W2));await V("lucide")}catch{}try{let{generateCrosswindCSS:V}=await Promise.resolve().then(() => (c4(),r8));await V('<div class="bg-black"></div>')}catch{}oJ();let U=Y?.routeMiddleware?.dir||"middleware";await tJ(process.cwd(),U);let B=aJ();if(B.length>0)console.log(`Loaded ${B.length} middleware: ${B.join(", ")}`);let _=Y?.routeMiddleware?.global||[],j=b$(".",{pagesDir:J.pagesDir});console.log(`Found ${j.length} routes`);let H=[];for(let V of j){let w=await SB(V);for(let A of w)H.push({route:V,url:A.url,params:A.params,props:A.props,revalidate:A.revalidate??J.revalidate})}Q.totalPages=H.length,console.log(`Generating ${Q.totalPages} pages...`);let L=[],F=[];for(let V=0;V<H.length;V+=J.concurrency)F.push(H.slice(V,V+J.concurrency));for(let V of F)await Promise.all(V.map(async(w)=>{let{route:A,url:N,params:R,props:T,revalidate:M}=w;try{await J.hooks.onPageStart?.(N);let I=await Bun.file(A.filePath).text(),D=uB(I),E=D?.middleware?Array.isArray(D.middleware)?D.middleware:[D.middleware]:[],P=[..._,...E];if(P.length>0){let m=rJ(N,R,D||{}),i=sJ(m,null),c=await eJ(P,i);if(c.redirect){let z0=typeof c.redirect==="string"?c.redirect:c.redirect.path||c.redirect,F0=pB(String(z0),N),_0=cB(N,J);await L0.promises.mkdir(J0.dirname(_0),{recursive:!0}),await Bun.write(_0,F0),Q.successCount++,Q.pages.push({route:N,outputPath:_0,size:Buffer.byteLength(F0),cached:!1}),L.push({loc:N,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${N} \u2192 redirect to ${z0}`);return}if(c.abort){let z0=typeof c.abort==="string"?c.abort:c.abort?.error?.message||"aborted";console.warn(` \u21B3 ${N} \u2014 middleware aborted: ${z0}`);return}}let b=I.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(b)try{if(!await Function("route",`
|
|
10906
10979
|
const validate = ${b[1]};
|
|
10907
10980
|
return validate(route);
|
|
10908
|
-
`)({params:R})){console.warn(`Validation failed for ${N}, skipping...`);return}}catch{}let k=null,y=!1;if(J.cache){if(k=
|
|
10981
|
+
`)({params:R})){console.warn(`Validation failed for ${N}, skipping...`);return}}catch{}let k=null,y=!1;if(J.cache){if(k=W.get(N,A.filePath),k)y=!0,Q.cachedCount++}if(!k){let m=await YX(A,R,T,J,Y);if(k=m.html,J.cache)W.set(N,A.filePath,m.dependencies,k)}let g;if(J.trailingSlash)g=J0.join(J.outputDir,N,"index.html");else g=N==="/"?J0.join(J.outputDir,"index.html"):J0.join(J.outputDir,`${N}.html`);if(J.chunkIslands){let{html:m,chunks:i}=iJ(k,{integrity:J.integrityIslands,minify:J.minify});if(i.length>0){let c=J0.join(J.outputDir,"_stx","islands");await L0.promises.mkdir(c,{recursive:!0});for(let z0 of i){let F0=J0.join(c,`${z0.hash}.js`);if(!await Bun.file(F0).exists())await Bun.write(F0,z0.code);if(!X.has(z0.hash)){X.add(z0.hash);let _0=Buffer.byteLength(z0.code,"utf8");G+=_0,K[z0.hash]={bytes:_0,file:`/_stx/islands/${z0.hash}.js`}}}if(q[N]=i.map((z0)=>z0.hash),k=m,J.prefetchIslands)k=nJ(k)}}await L0.promises.mkdir(J0.dirname(g),{recursive:!0}),await Bun.write(g,k),L.push({loc:N,lastmod:new Date().toISOString().split("T")[0],priority:N==="/"?1:0.8});let h={route:N,outputPath:g,size:Buffer.byteLength(k,"utf8"),cached:y};if(M!==!1)h.revalidateAt=Date.now()+M*1000;Q.pages.push(h),Q.successCount++,await J.hooks.onPageEnd?.(N,k)}catch(I){Q.failedCount++,Q.errors.push({route:N,error:I}),await J.hooks.onError?.(I,N),console.error(`Error generating ${N}:`,I)}}));if(J.cache)await W.save();if(J.generate404){let V=J0.join(J.pagesDir,"404.stx");if(await Bun.file(V).exists()){let w=new Set,A={...Y,debug:!1,cache:!1},N=await H0(await Bun.file(V).text(),{},V,A,w);await Bun.write(J0.join(J.outputDir,"404.html"),N)}else await Bun.write(J0.join(J.outputDir,"404.html"),`<!DOCTYPE html>
|
|
10909
10982
|
<html lang="en">
|
|
10910
10983
|
<head>
|
|
10911
10984
|
<meta charset="UTF-8">
|
|
@@ -10926,16 +10999,16 @@ ${Y.join(`
|
|
|
10926
10999
|
<a href="/">Go home</a>
|
|
10927
11000
|
</div>
|
|
10928
11001
|
</body>
|
|
10929
|
-
</html>`)}for(let V of[500]){let w=J0.join(J.pagesDir,`${V}.stx`);if(await Bun.file(w).exists()){let A=new Set,N={...Y,debug:!1,cache:!1},R=await
|
|
11002
|
+
</html>`)}for(let V of[500]){let w=J0.join(J.pagesDir,`${V}.stx`);if(await Bun.file(w).exists()){let A=new Set,N={...Y,debug:!1,cache:!1},R=await H0(await Bun.file(w).text(),{},w,N,A);await Bun.write(J0.join(J.outputDir,`${V}.html`),R)}}let O=J0.join(J.pagesDir,"error.stx");if(await Bun.file(O).exists()){let V=new Set,w={...Y,debug:!1,cache:!1},A=await H0(await Bun.file(O).text(),{},O,w,V);await Bun.write(J0.join(J.outputDir,"error.html"),A)}if(J.sitemap&&L.length>0){let V=xB(L,J.domain),w=J0.join(J.outputDir,"sitemap.xml");await Bun.write(w,V),Q.sitemapPath=w,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(J.rss){let V=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},w=[];if(V.getItems)w=await V.getItems();let A=fB(V,w),N=J0.join(J.outputDir,"rss.xml");await Bun.write(N,A),Q.rssPath=N,console.log(`Generated rss.xml with ${w.length} items`)}if(J.publicDir&&L0.existsSync(J.publicDir))await JX(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`)}catch(W){throw await J.hooks.onError?.(W),W}if(Q.buildTime=Date.now()-Z,X.size>0){Q.islandChunks={count:X.size,totalBytes:G};let W={generatedChunks:X.size,totalBytes:G,chunks:K,pages:q};await Bun.write(J0.join(J.outputDir,"_stx","islands-manifest.json"),JSON.stringify(W,null,2))}await J.hooks.onBuildEnd?.(Q);let z=Q.islandChunks?`
|
|
10930
11003
|
Island chunks: ${Q.islandChunks.count} (${(Q.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
|
|
10931
11004
|
Build complete!
|
|
10932
11005
|
Total: ${Q.totalPages} pages
|
|
10933
11006
|
Success: ${Q.successCount}
|
|
10934
11007
|
Cached: ${Q.cachedCount}
|
|
10935
11008
|
Failed: ${Q.failedCount}
|
|
10936
|
-
Time: ${Q.buildTime}ms${
|
|
10937
|
-
`),Q}async function
|
|
10938
|
-
`)){let U=
|
|
11009
|
+
Time: ${Q.buildTime}ms${z}
|
|
11010
|
+
`),Q}async function JX($,Z){let Y=await L0.promises.readdir($,{withFileTypes:!0});for(let J of Y){let Q=J0.join($,J.name),X=J0.join(Z,J.name);if(J.isDirectory())await L0.promises.mkdir(X,{recursive:!0}),await JX(Q,X);else await L0.promises.copyFile(Q,X)}}function hB($={}){let Z=$.cacheDir||G1(process.cwd(),"ssg-cache"),Y=new ZX(Z),J=$.revalidate||3600;return{async get(Q){let X=await Y.get(Q);if(!X)return null;if(Date.now()>X.revalidateAfter)this.revalidate(Q).catch(console.error);return{html:X.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:X.etag,"X-ISR-Generated":new Date(X.generatedAt).toISOString(),...X.headers}}},async revalidate(Q){let G=b$(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return Q.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${Q}`);return}let K=Q.match(G.regex),q={};if(K)G.params.forEach((U,B)=>{q[U]=K[B+1]});let z=await S1(),{html:W}=await YX(G,q,{},$,z);await Y.set(Q,{html:W,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:vB(W)}),console.log(`Revalidated: ${Q}`)},async invalidate(Q){if(typeof Q==="string")await Y.invalidate(Q);else await Y.invalidatePattern(Q)}}}function dB($){return async()=>{return{paths:await $(),fallback:!1}}}function mB(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),Y=Z.match(/^---\n([\s\S]*?)\n---/),J={},Q=Z;if(Y){let z=Y[1];Q=Z.slice(Y[0].length).trim();for(let W of z.split(`
|
|
11011
|
+
`)){let U=W.indexOf(":");if(U>0){let B=W.slice(0,U).trim(),_=W.slice(U+1).trim();if(_==="true")_=!0;else if(_==="false")_=!1;else if(/^\d+$/.test(_))_=parseInt(_,10);else if(/^\d+\.\d+$/.test(_))_=parseFloat(_);else if(_.startsWith("[")&&_.endsWith("]"))_=_.slice(1,-1).split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,""));J[B]=_}}}let X=Q.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),G=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,q;while((q=K.exec(X))!==null){let z=parseInt(q[1],10),W=q[2],U=W.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:W,level:z})}return{content:X,data:J,toc:G}}}}function uB($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function pB($,Z){return`<!DOCTYPE html>
|
|
10939
11012
|
<html>
|
|
10940
11013
|
<head>
|
|
10941
11014
|
<meta charset="utf-8">
|
|
@@ -10947,4 +11020,4 @@ Build complete!
|
|
|
10947
11020
|
<p>Redirecting to <a href="${$}">${$}</a>...</p>
|
|
10948
11021
|
<script>window.location.replace('${$}')</script>
|
|
10949
11022
|
</body>
|
|
10950
|
-
</html>`}function
|
|
11023
|
+
</html>`}function cB($,Z){if($==="/"||$==="")return J0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return J0.join(Z.outputDir,Y,"index.html");return J0.join(Z.outputDir,`${Y}.html`)}var wA={generateStaticSite:gB,createISRHandler:hB,defineStaticPaths:dB,createMarkdownLoader:mB};export{gB as generateStaticSite,dB as defineStaticPaths,wA as default,mB as createMarkdownLoader,hB as createISRHandler};
|