@stacksjs/stx 0.2.160 → 0.2.161
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 +518 -518
- package/dist/craft.js +254 -254
- package/dist/expressions.d.ts +21 -2
- package/dist/expressions.js +35 -6
- package/dist/pwa.js +241 -241
- package/dist/ssg.js +237 -237
- package/package.json +5 -5
package/dist/ssg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var _K=Object.defineProperty;var OK=($)=>$;function FK($,Z){this[$]=OK.bind(null,Z)}var t=($,Z)=>{for(var J in Z)_K($,J,{get:Z[J],enumerable:!0,configurable:!0,set:FK.bind(Z,J)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var U0=import.meta.require;import{matchRoute as fF,Router as AK}from"stx-router";import{findErrorPage as uF,formatRoutes as mF,generateRouteManifest as dF,generateRouteTypes as pF,matchRoute as lF}from"stx-router";function i5($,Z={}){return new AK($,Z).routes}var u7=()=>{};function Q8($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function m7($,Z){let J={...$};for(let[Y,X]of Object.entries(Z))J[Y]=Q8(X)&&Q8(J[Y])?m7(J[Y],X):X;return J}function G8($={},Z={}){let J=$.theme||{},Y=Z.theme||{},{extend:X,...Q}=Y,{extend:G,...K}=J,W=m7(K,Q),q=m7(G||{},X||{});if(Object.keys(q).length>0)W.extend=q;let z=[...$.safelist||[],...Z.safelist||[]],U={...$.shortcuts||{},...Z.shortcuts||{}},j=[...$.preflights||[],...Z.preflights||[]];return{config:{...$,...Z,theme:W,safelist:z,shortcuts:U,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:z,shortcuts:U,includePreflight:Z.preflight!==!1,minify:Z.minify===!0}}import n5 from"path";function W8($){K8=$?.trim()||null}function o5(){return process.env[MK]?.trim()||K8||_5}function _1($=process.cwd(),...Z){let J=o5();return n5.isAbsolute(J)?n5.join(J,...Z):n5.join($,J,...Z)}function s5($){if(!$||n5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==_5&&!Z.startsWith(`${_5}/`))return $;let J=Z.slice(_5.length+1);return J?n5.join(o5(),J):o5()}var _5=".stx",MK="STX_DIR",K8=null;var r5=()=>{};var O0;var q8=b(()=>{O0={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 z8($,Z,J,Y){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let z={"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: ${W||z} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return X=X.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),X=X.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,W)=>{return`<span id="${`desc-${K}`}" class="sr-only">${W}</span>`}),X}var U8,j8;var d7=b(()=>{U8={name:"a11y",handler:($,Z,J,Y)=>{if(!Z.length)return $;let X=Z[0].replace(/['"]/g,""),Q=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"}[X]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},j8={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function TK($,Z={}){let{duration:J,delay:Y,ease:X,direction:Q,custom:G}={...O1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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 HK=Object.defineProperty;var _K=($)=>$;function OK($,Z){this[$]=_K.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`${Q==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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 IK(){return`
|
|
13
13
|
<script data-stx-scoped data-stx-run="once">
|
|
14
14
|
// Motion preferences handling
|
|
15
15
|
(function() {
|
|
@@ -37,7 +37,7 @@ else {
|
|
|
37
37
|
});
|
|
38
38
|
})();
|
|
39
39
|
</script>
|
|
40
|
-
`}function
|
|
40
|
+
`}function DK($){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((J)=>J.test($))}function kK($=0.1,Z="0px"){return`
|
|
41
41
|
<script data-stx-scoped data-stx-run="always">
|
|
42
42
|
// Intersection Observer for scroll animations
|
|
43
43
|
(function() {
|
|
@@ -80,7 +80,7 @@ else {
|
|
|
80
80
|
}
|
|
81
81
|
})();
|
|
82
82
|
</script>
|
|
83
|
-
`}function
|
|
83
|
+
`}function EK(){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 bK($,Z,J={}){let{staggerDelay:Y=50,sequence:X=!1}=J;return`
|
|
199
199
|
<script data-stx-scoped data-stx-run="always">
|
|
200
200
|
// Animation Group: ${$}
|
|
201
201
|
(function() {
|
|
@@ -232,11 +232,11 @@ else {
|
|
|
232
232
|
}
|
|
233
233
|
})();
|
|
234
234
|
</script>
|
|
235
|
-
`}function F8($,Z,J,Y){let X=$;if(Y.animation?.enabled===!1)return X;let Q=J.includes("test")&&J.includes("animation");if(!
|
|
236
|
-
</head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let W=
|
|
237
|
-
`+X.slice(q)}}return X}var O1,B8,H8,_8,O8;var p7=b(()=>{O1={duration:300,delay:0,ease:"ease",direction:"both"};B8={name:"transition",handler:($,Z,J,Y)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||O1.duration:O1.duration,G=Z.length>2?Z[2]||O1.ease:O1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||O1.delay:O1.delay,W=Z.length>4?Z[4]||O1.direction:O1.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=
|
|
238
|
-
style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},H8={name:"scrollAnimate",handler:($,Z,J,Y)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let X=Z[0],Q=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,W=Z.length>4?Number.parseInt(Z[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,z=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(X==="fade")U+=" stx-fade";else if(X==="slide-up"||X==="slide")U+=" stx-from-bottom";else if(X==="slide-down")U+=" stx-from-top";else if(X==="slide-left")U+=" stx-from-right";else if(X==="slide-right")U+=" stx-from-left";else if(X==="scale")U+=" stx-scale";else if(X.includes("-"))U+=` stx-${X}`;else U+=` stx-${X}`;return`<div id="${q}" class="${U}" style="${z}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},_8={name:"animationGroup",handler:($,Z,J,Y)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let X=Z[0],Q=Z.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),G=J.staggerDelay||50,K=J.sequence||!0,W=
|
|
239
|
-
${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},O8={name:"motion",handler:($,Z,J,Y)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=
|
|
235
|
+
`}function F8($,Z,J,Y){let X=$;if(Y.animation?.enabled===!1)return X;let Q=J.includes("test")&&J.includes("animation");if(!DK(X)&&!Q)return X;if(!X.includes('<style id="stx-animation-base">')){let K=EK();X=X.replace("</head>",`${K}
|
|
236
|
+
</head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let W=kK(),q=X.lastIndexOf("</body>");if(q!==-1)X=X.slice(0,q)+W+`
|
|
237
|
+
`+X.slice(q)}}return X}var O1,B8,H8,_8,O8;var p7=b(()=>{O1={duration:300,delay:0,ease:"ease",direction:"both"};B8={name:"transition",handler:($,Z,J,Y)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||O1.duration:O1.duration,G=Z.length>2?Z[2]||O1.ease:O1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||O1.delay:O1.delay,W=Z.length>4?Z[4]||O1.direction:O1.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=TK(X,{duration:Q,delay:K,ease:G,direction:W}),U="stx-transition",j="";if(X==="fade")j="stx-fade";else if(X==="slide")j="stx-slide";else if(X==="scale")j="stx-scale";else if(X==="flip")j="stx-flip";else if(X==="rotate")j="stx-rotate";return`<div id="${q}" class="${U} ${j} ${W==="out"?"stx-out":""}"
|
|
238
|
+
style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},H8={name:"scrollAnimate",handler:($,Z,J,Y)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let X=Z[0],Q=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,W=Z.length>4?Number.parseInt(Z[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,z=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(X==="fade")U+=" stx-fade";else if(X==="slide-up"||X==="slide")U+=" stx-from-bottom";else if(X==="slide-down")U+=" stx-from-top";else if(X==="slide-left")U+=" stx-from-right";else if(X==="slide-right")U+=" stx-from-left";else if(X==="scale")U+=" stx-scale";else if(X.includes("-"))U+=` stx-${X}`;else U+=` stx-${X}`;return`<div id="${q}" class="${U}" style="${z}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},_8={name:"animationGroup",handler:($,Z,J,Y)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let X=Z[0],Q=Z.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),G=J.staggerDelay||50,K=J.sequence||!0,W=bK(X,Q,{staggerDelay:G,sequence:K});return`${$}
|
|
239
|
+
${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},O8={name:"motion",handler:($,Z,J,Y)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=IK();return`<div data-animate="${X?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as V8}from"stx-router";var L8=b(()=>{l7()});async function SK($,Z,J,Y){let X=Z[0]?.replace(/['"]/g,"")||"main",Q=V8();if(X!=="main")Q=Q.replace("container:'main'",`container:'${X}'`);return`<script data-stx-router>${Q}</script>`}var w8;var l7=b(()=>{L8();w8={name:"stxRouter",handler:SK,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function N8($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...yK,...Z};return`
|
|
240
240
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
241
241
|
<script>
|
|
242
242
|
(function() {
|
|
@@ -619,7 +619,7 @@ else {
|
|
|
619
619
|
};
|
|
620
620
|
})();
|
|
621
621
|
</script>
|
|
622
|
-
`}function R8($,Z){let J=N8(Z);if(!J)return $;let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+J+$.slice(Y);return $+J}function
|
|
622
|
+
`}function R8($,Z){let J=N8(Z);if(!J)return $;let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+J+$.slice(Y);return $+J}function PK($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of J){let[X,Q]=Y.split("="),G=Q?.replace(/["']/g,"");switch(X){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 yK,A8;var c7=b(()=>{yK={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};A8={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,Y)=>{let X=J.__stx_config||{};if(Z.length>0){let Q=PK(Z.join(" "));X.heatmap={...X.heatmap,...Q,enabled:!0}}return N8(X)}}});function I1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function M8($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function T8($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let Y=J[1],X=$.slice(J[0].length),Q={};for(let G of Y.split(`
|
|
623
623
|
`)){let K=G.trim();if(!K||K.startsWith("#"))continue;let W=K.indexOf(":");if(W===-1)continue;let q=K.slice(0,W).trim(),z=K.slice(W+1).trim();if(typeof z==="string"){if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))z=z.slice(1,-1);else if(z.startsWith("[")&&z.endsWith("]"))try{z=JSON.parse(z)}catch{}else if(z==="true")z=!0;else if(z==="false")z=!1;else if(/^-?\d+(?:\.\d+)?$/.test(z))z=Number(z)}Q[q]=z}return{data:Q,content:X.trim()}}function a5($,Z={}){let{gfm:J=!0,breaks:Y=!1}=Z,X=$,Q=[];if(X=X.replace(/```(\w*)\n([\s\S]*?)```/g,(z,U,j)=>{let H=Q.length,B=U?` class="language-${I1(U)}"`:"";return Q.push(`<pre><code${B}>${I1(j.trim())}</code></pre>`),`\x00CODEBLOCK${H}\x00`}),X=X.replace(/`([^`]*)`/g,(z,U)=>`<code>${I1(U)}</code>`),X=X.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),X=X.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),X=X.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),X=X.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),X=X.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),X=X.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),X=X.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),X=X.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),X=X.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),X=X.replace(/__(.+?)__/g,"<strong>$1</strong>"),X=X.replace(/\*(.+?)\*/g,"<em>$1</em>"),X=X.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)X=X.replace(/~~(.+?)~~/g,"<del>$1</del>");if(X=X.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(z,U,j)=>{return`<img src="${M8(j)?I1(j):""}" alt="${I1(U)}" />`}),X=X.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(z,U,j)=>{return`<a href="${M8(j)?I1(j):""}">${U}</a>`}),X=X.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),X=X.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),X=X.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
624
624
|
`),X=X.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),X=X.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),X=X.replace(/<\/ul>\n<ul>/g,""),X=X.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),X=X.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),X=X.replace(/<\/ol>\n<ol>/g,""),X=X.replace(/<li data-ul>/g,"<li>"),X=X.replace(/<li data-ol>/g,"<li>"),J)X=X.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(z,U,j)=>{let B=`<tr>${U.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<th>${I1(O)}</th>`).join("")}</tr>`,_=j.trim().split(`
|
|
625
625
|
`).map((O)=>{return`<tr>${O.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<td>${I1(F)}</td>`).join("")}</tr>`}).join(`
|
|
@@ -637,7 +637,7 @@ ${_}
|
|
|
637
637
|
`:`
|
|
638
638
|
`)}</p>`);if(X=K.join(`
|
|
639
639
|
`),Y)X=X.replace(/\n/g,`<br />
|
|
640
|
-
`);for(let z=0;z<Q.length;z++)X=X.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function O5($="const",Z=[],J){let Y=Z.length?F1.filter((X)=>!Z.includes(X)):F1;if(J!==void 0)Y=Y.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(J)});return`${$} { ${Y.join(", ")} } = window.stx;`}function i7($){if(!$)return!1;return
|
|
640
|
+
`);for(let z=0;z<Q.length;z++)X=X.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function O5($="const",Z=[],J){let Y=Z.length?F1.filter((X)=>!Z.includes(X)):F1;if(J!==void 0)Y=Y.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(J)});return`${$} { ${Y.join(", ")} } = window.stx;`}function i7($){if(!$)return!1;return vK.some((Z)=>new RegExp(`\\b${Z}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function n7($){if(!$)return!1;let Z=S8($);if(xK.some((J)=>J.test(Z)))return!0;return i7(Z)}function D8($){if(!$)return!1;return fK.test(S8($))||n7($)}function b8(){return`{${k8.map(($)=>`'${$}':1`).join(",")}}`}function S8($){if(!$)return $;let Z=(J)=>J.replace(/(<[^>]*>)|([^<]+)/g,(Y,X,Q)=>X??" ".repeat(Q.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(J,Y,X,Q)=>Y+Z(X)+Q).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(J,Y,X,Q)=>Y+Z(X)+Q).replace(/<!--[\s\S]*?-->/g,(J)=>" ".repeat(J.length))}var F1,I8,CK,vK,xK,fK,k8,gK,E8;var K1=b(()=>{F1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],I8=["onMount","onDestroy"];CK=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],vK=F1.filter(($)=>!CK.includes($));xK=[/@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*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],fK=/\s@[a-z][\w.:-]*\s*=/i;k8=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],gK=["x-init","x-transition","x-effect","x-on"],E8=[...k8,...gK]});function C8($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let Y=J.toLowerCase();if(Y==="prevent")Z.prevent=!0;else if(Y==="stop")Z.stop=!0;else if(Y==="once")Z.once=!0;else if(Y==="capture")Z.capture=!0;else if(Y==="self")Z.self=!0;else if(Y==="passive")Z.passive=!0;else if(hK.has(Y))Z.systemKeys.push(Y);else if(Y in v8)Z.mouse=Y;else if(Y in P8||/^[a-z]$/.test(Y))Z.keys.push(P8[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let X=Y.match(/debounce(?:\.(\d+))?/);Z.debounce=X?.[1]?Number.parseInt(X[1],10):300}else if(Y.startsWith("throttle")){let X=Y.match(/throttle(?:\.(\d+))?/);Z.throttle=X?.[1]?Number.parseInt(X[1],10):300}}return Z}function x8($){let Z=[],J=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,G,K]=X,W=X.index,q=W+Q.length,z=`__stx_evt_${J++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,H;while((H=j.exec(K))!==null){let[,_,O]=H,V=_.split("."),F=V[0];if(!y8.has(F))continue;U.push({attribute:`@${_}`,event:F,handler:O,modifiers:C8(V.slice(1)),elementId:z})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((H=B.exec(K))!==null){let[,_,O]=H,V=_.split("."),F=V[0];if(!y8.has(F))continue;U.push({attribute:`@${_}`,event:F,handler:O,modifiers:C8(V.slice(1)),elementId:z})}if(U.length>0)Z.push({originalTag:Q,elementId:z,events:U,startIndex:W,endIndex:q})}return Z}function uK($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let Y of J.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if(J.keys.length>0){let Y=J.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if(J.mouse!==null){let Y=v8[J.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function mK($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function o7($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function dK($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=uK($),X=mK(o7($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
641
641
|
(function() {
|
|
642
642
|
var $el = document.getElementById('${J}');
|
|
643
643
|
if (!$el) return;
|
|
@@ -746,16 +746,16 @@ else {
|
|
|
746
746
|
}
|
|
747
747
|
|
|
748
748
|
// Event listeners
|
|
749
|
-
${$.map(
|
|
749
|
+
${$.map(dK).join(`
|
|
750
750
|
`)}
|
|
751
751
|
})();
|
|
752
|
-
</script>`}function
|
|
753
|
-
`+X.slice(G);else X+=Q;return X}var y8,P8,
|
|
752
|
+
</script>`}function pK($){let Z=x8($);if(Z.length===0)return{template:$,bindings:[]};let J=$,Y=[];for(let X=Z.length-1;X>=0;X--){let Q=Z[X],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let W of Q.events)W.elementId=K[1]}for(let K of Q.events){let W=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(q,""),G=G.replace(z,"")}J=J.slice(0,Q.startIndex)+G+J.slice(Q.endIndex),Y.push(...Q.events)}return{template:J,bindings:Y}}function f8($,Z,J){if(n7($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:K,bindings:W}=pK($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...W],K}let Y=x8($);if(Y.length===0)return $;let X=$;for(let K=Y.length-1;K>=0;K--){let W=Y[K],q=W.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=q.match(/id=["']([^"']+)["']/);if(z)for(let U of W.events)U.elementId=z[1]}for(let z of W.events){let U=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),H=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");q=q.replace(j,""),q=q.replace(H,"")}X=X.slice(0,W.startIndex)+q+X.slice(W.endIndex)}let Q=s7(Y.flatMap((K)=>K.events)),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
|
|
753
|
+
`+X.slice(G);else X+=Q;return X}var y8,P8,hK,v8;var r7=b(()=>{K1();y8=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"]),P8={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"},hK=new Set(["ctrl","alt","shift","meta"]),v8={left:0,middle:1,right:2}});function p0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(Y,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
754
754
|
`});let J=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(J,(Y,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
755
|
-
`}),$}function m$($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function
|
|
755
|
+
`}),$}function m$($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function lK(){let $=globalThis;return $[g8]??=new Map,$[g8]}function e($,Z){let J=lK(),Y=`${import.meta.url}\x00${$}`,X=J.get(Y);if(X)return X;let Q=Z();return J.set(Y,Q),Q.catch(()=>{if(J.get(Y)===Q)J.delete(Y)}),Q}var g8;var t5=b(()=>{g8=Symbol.for("stx.lazy-module-promises")});function F5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(cK,"<\\/$1")}var cK;var a7=b(()=>{cK=/<\/(script)/gi});import iK from"process";function g0($="STX_PUBLIC_"){let Z={},J={};for(let[Y,X]of Object.entries(iK.env)){if(!Y.startsWith($)||X===void 0)continue;Z[`import.meta.env.${Y}`]=JSON.stringify(X),J[Y]=X}return Z["import.meta.env"]=JSON.stringify(J),Z}var D1=()=>{};function nK($){if(!$||typeof $!=="object")return!1;let Z=$;return typeof Z.message==="string"&&(Z.name==="BuildMessage"||Z.name==="ResolveMessage"||("position"in Z))}function oK($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function t7($,Z){let J=[];for(let Y of oK($)){if(nK(Y)){let X=Y.position||void 0;J.push({file:Z||X?.file,line:X?.line,column:X?.column,message:Y.message??"",lineText:X?.lineText});continue}J.push({file:Z,message:Y instanceof Error?Y.message:String(Y)})}return J}function h8($,Z){return t7($,Z).map((J)=>{let Y=J.file?`${J.file}${J.line?`:${J.line}${J.column?`:${J.column}`:""}`:""}`:"",X=J.lineText?`
|
|
756
756
|
${J.lineText.trim()}`:"";return Y?`${Y}: ${J.message}${X}`:`${J.message}${X}`}).join(`
|
|
757
|
-
`)}var e5={};t(e5,{shouldLogBundlerDiagnostics:()=>p8,setBundlerFallbackMode:()=>
|
|
758
|
-
export { ${H.join(", ")} }`:"";await Bun.write(z,$+V),p1("bundling:",G,"from:",L0.basename(Z));let F=new Set;try{let L=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:X,plugins:[
|
|
757
|
+
`)}var e5={};t(e5,{shouldLogBundlerDiagnostics:()=>p8,setBundlerFallbackMode:()=>tK,resolveBundlerFallback:()=>c8,recordBundleFailure:()=>l8,queueClientBundleBuild:()=>i8,hasUserImports:()=>eK,getBundleFailures:()=>rK,clearBundleFailures:()=>aK,bundleClientScript:()=>ZW});import L0 from"path";import h0 from"fs";function p8($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function p1(...$){if(p8())console.log("[stx:bundler]",...$)}function l8($,Z,J){Z3.push({filePath:$||"<inline>",message:Z,details:J})}function rK(){return Z3.slice()}function aK(){Z3.length=0}function tK($){$3=$}function c8(){if($3)return $3;try{return Z$.strict?.bundlerFallback??"warn"}catch{return"warn"}}function eK($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,J;while((J=Z.exec($))!==null){let X=J[1];if(!u8.some((G)=>G.test(X)))return p1("detected user import:",X),!0}let Y=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((J=Y.exec($))!==null){let X=J[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!u8.some((G)=>G.test(X)))return p1("detected side-effect import:",X),!0}return!1}function $W($,Z,J,Y){let X=(Q,G)=>{let K=Q===J?Z:L0.dirname(Q),W=L0.resolve(K,G),q=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,L0.join(W,"index.ts"),L0.join(W,"index.tsx"),L0.join(W,"index.js"),L0.join(W,"index.mjs")];for(let z of q)try{if(h0.existsSync(z)&&h0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(h0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=X(G.importer,G.path);return Y.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=L0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,L0.join(K,"index.ts"),L0.join(K,"index.tsx"),L0.join(K,"index.js"),L0.join(K,"index.mjs")];for(let q of W)if(h0.existsSync(q)&&h0.statSync(q,{throwIfNoEntry:!1})?.isFile())return p1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",q),Y.add(q),{path:q};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=L0.extname(G.path).toLowerCase(),W=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==J)Y.add(G.path);return{contents:h0.readFileSync(G.path,"utf8"),loader:W}})}}}function i8($){let Z=globalThis,Y=(Z[m8]??Promise.resolve()).then($,$);return Z[m8]=Y.then(()=>{return},()=>{return}),Y}async function ZW($,Z,J={}){let Y=J.projectRoot||process.cwd(),X=J.minify??!1,Q=J.cacheDir||_1(Y,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${sK}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=L0.join(Q,`${K}.js`),q=L0.join(Q,`${K}.deps.json`),z=Bun.file(W);if(await z.exists()){let H=Bun.file(q),B=!0;if(await H.exists())try{let _=JSON.parse(await H.text());if(_.metadataVersion!==d8||!Array.isArray(_.files))B=!1;for(let O of Array.isArray(_.files)?_.files:[])try{if(h0.statSync(O.path).mtimeMs!==O.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return p1("cache hit:",K),await z.text();p1("cache invalidated by dep change:",K)}let U=e7.get(K);if(U)return await U;let j=i8(()=>JW($,Z,{projectRoot:Y,minify:X,cacheDir:Q,hash:K,cachePath:W,depsPath:q}));e7.set(K,j);try{return await j}finally{e7.delete(K)}}async function JW($,Z,J){let{projectRoot:Y,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=J,q=_1(Y,"bundle-tmp"),z=L0.join(q,`${G}.ts`),U=L0.join(q,"out",G);h0.mkdirSync(q,{recursive:!0}),h0.mkdirSync(U,{recursive:!0});let j=L0.dirname(Z),H=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=B.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((L)=>{let w=L.split(":")[0].trim();if(w)H.push(w)});else if(O[3])H.push(O[3])}while((O=_.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
|
|
758
|
+
export { ${H.join(", ")} }`:"";await Bun.write(z,$+V),p1("bundling:",G,"from:",L0.basename(Z));let F=new Set;try{let L=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:X,plugins:[$W(Y,j,z,F)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...g0()},root:Y});if(!L.success){let D=L.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of L.outputs){w=await D.text();break}let N=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of D[1].split(",")){let S=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){N.push([S[2],S[1]]);continue}let P=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(P))N.push([P,P])}let R=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let A=`__stxBundle_${G}`,M=N.map(([D,y])=>`${JSON.stringify(D)}: ${y}`).join(", "),T=N.map(([D])=>`var ${D} = undefined;`).join(`
|
|
759
759
|
`),I=N.map(([D])=>`${D} = ${A}[${JSON.stringify(D)}];`).join(`
|
|
760
760
|
`);if(w=`${R.join(`
|
|
761
761
|
`)}
|
|
@@ -764,7 +764,7 @@ var ${A} = (function() {
|
|
|
764
764
|
${w}
|
|
765
765
|
return { ${M} };
|
|
766
766
|
})();
|
|
767
|
-
${I}`.trim(),p1("bundled:",G,"output:",w.length,"bytes"),H.length>0&&N.length===0)return console.warn(`[stx:bundler] dropped every binding for ${L0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;h0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let E=Array.from(F).map((D)=>{try{return{path:D,mtimeMs:h0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({metadataVersion:d8,files:E})),w}catch(L){let w=t7(L,Z||void 0),N=h8(L,Z||void 0);if(console.warn(`[stx:bundler] error: ${N}`),l8(Z||"",N,w),c8()==="error")throw L;return $}finally{try{h0.rmSync(z,{force:!0}),h0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var
|
|
767
|
+
${I}`.trim(),p1("bundled:",G,"output:",w.length,"bytes"),H.length>0&&N.length===0)return console.warn(`[stx:bundler] dropped every binding for ${L0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;h0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let E=Array.from(F).map((D)=>{try{return{path:D,mtimeMs:h0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({metadataVersion:d8,files:E})),w}catch(L){let w=t7(L,Z||void 0),N=h8(L,Z||void 0);if(console.warn(`[stx:bundler] error: ${N}`),l8(Z||"",N,w),c8()==="error")throw L;return $}finally{try{h0.rmSync(z,{force:!0}),h0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var sK=5,d8=1,Z3,$3,u8,e7,m8;var $$=b(()=>{D1();r5();V1();Z3=[];u8=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];e7=new Map,m8=Symbol.for("stx.client-bundle-build-queue")});var ZZ={};t(ZZ,{stripCommentsAndLiterals:()=>l$,renderVendorStyleTags:()=>p$,processClientScript:()=>X$,injectBrowserCoreAutoImports:()=>V5,generateServerDataBridge:()=>c$,generateBrowserAutoImportDestructuring:()=>BW,generateAutoImportDestructuring:()=>J3,extractBridgeData:()=>Y$,extractAndStripCssImports:()=>d$,STX_AUTO_IMPORTS:()=>r8});import l1 from"path";import J$ from"fs";function XW($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let J=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!J)return null;return{pkg:J[1],subpath:J[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function QW($,Z){let J=Z;while(!0){let Y=l1.join(J,"node_modules",$,"package.json");if(J$.existsSync(Y))return l1.dirname(Y);let X=l1.dirname(J);if(X===J)return null;J=X}}function GW($,Z){if(!$||typeof $!=="object")return null;let J=(X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"){if(typeof X.import==="string")return X.import;if(typeof X.default==="string")return X.default;if(typeof X.import==="object")return J(X.import);if(typeof X.default==="object")return J(X.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return J($[Z]);let Y=null;for(let X of Object.keys($)){let Q=X.indexOf("*");if(Q===-1)continue;let G=X.slice(0,Q),K=X.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!Y||G.length>Y.prefix.length)Y={pattern:X,prefix:G,suffix:K}}if(Y){let X=Z.slice(Y.prefix.length,Z.length-Y.suffix.length),Q=J($[Y.pattern]);if(Q)return Q.replace("*",X)}return null}function KW($,Z){let J=XW($);if(!J||!J.subpath)return null;let Y=QW(J.pkg,Z);if(!Y)return null;let X;try{X=JSON.parse(J$.readFileSync(l1.join(Y,"package.json"),"utf8"))}catch{return null}let Q=`.${J.subpath}`,G=GW(X.exports,Q);if(!G)return null;let K=l1.resolve(Y,G);return J$.existsSync(K)?K:null}function d$($,Z){let J=Z.filePath?l1.dirname(Z.filePath):Z.projectRoot||process.cwd(),Y=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(YW,(K,W)=>{let q;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(q=W.startsWith("/")?W:l1.resolve(J,W),!J$.existsSync(q))throw Error(`file not found: ${q}`)}else{let z=null;try{z=Bun.resolveSync(W,Y)}catch{z=KW(W,Y)}if(!z)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);q=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(X.has(q))return"";X.add(q);try{let z=J$.readFileSync(q,"utf8");Q.push({source:W,resolvedPath:q,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${q}: ${z?.message||z}`)}return""}),styles:Q}}function WW($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function p$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${WW(Z.source)}" data-stx-layer="vendor">
|
|
768
768
|
@layer vendor {
|
|
769
769
|
${Z.contents}
|
|
770
770
|
}
|
|
@@ -772,7 +772,7 @@ ${Z.contents}
|
|
|
772
772
|
`)}
|
|
773
773
|
`}function V5($){let Z=l$($),J=new Set;for(let K of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let W of K[1].split(",")){let q=W.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)J.add(q)}let Y=new Set;for(let K of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(K[1]);for(let K of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let W of K[1].split(",")){let q=W.trim().split(/[:=]/).pop()?.trim();if(q)Y.add(q)}let X=a8.filter((K)=>{if(J.has(K)||Y.has(K))return!1;return new RegExp(`\\b${K}\\s*\\(`).test(Z)}),Q=e8(Z).filter((K)=>!J.has(K)&&!Y.has(K));if(X.length===0&&Q.length===0)return{code:$,imports:X,models:Q};return{code:`${[X.length>0?`import { ${X.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
774
774
|
`)}
|
|
775
|
-
${$}`,imports:X,models:Q}}function
|
|
775
|
+
${$}`,imports:X,models:Q}}function zW($,Z){let J=$[Z],Y=Z+1;while(Y<$.length){if($[Y]==="\\"){Y+=2;continue}if($[Y]===J)return Y+1;Y++}return $.length}function UW($,Z){let J=Z+1;while(J<$.length){if($[J]==="\\"){J+=2;continue}if($[J]==="`")return J+1;if($[J]==="$"&&$[J+1]==="{"){if(J=t8($,J+2),J<$.length)J++;continue}J++}return $.length}function t8($,Z){let J=1,Y=Z;while(Y<$.length){let X=$[Y];if(X==="\\"){Y+=2;continue}if(X==='"'||X==="'"){Y=zW($,Y);continue}if(X==="`"){Y=UW($,Y);continue}if(X==="/"&&$[Y+1]==="/"){while(Y<$.length&&$[Y]!==`
|
|
776
776
|
`)Y++;continue}if(X==="/"&&$[Y+1]==="*"){Y+=2;while(Y<$.length&&$.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(X==="{"){J++,Y++;continue}if(X==="}"){if(J--,J===0)return Y;Y++;continue}Y++}return $.length}function l$($){let Z="",J=0;while(J<$.length){let Y=$.slice(J,J+2);if(Y==="//"){while(J<$.length&&$[J]!==`
|
|
777
777
|
`)Z+=" ",J++;continue}if(Y==="/*"){while(J<$.length&&$.slice(J,J+2)!=="*/")Z+=$[J]===`
|
|
778
778
|
`?`
|
|
@@ -780,10 +780,10 @@ ${$}`,imports:X,models:Q}}function qW($,Z){let J=$[Z],Y=Z+1;while(Y<$.length){if
|
|
|
780
780
|
`?`
|
|
781
781
|
`:" ",J++}Z+=" ",J++;continue}if(X==="`"){Z+=" ",J++;while(J<$.length&&$[J]!=="`"){if($[J]==="\\"){Z+=" ",J+=2;continue}if($[J]==="$"&&$[J+1]==="{"){let Q=J+2,G=t8($,Q);if(Z+=" ",Z+=l$($.slice(Q,G)),G<$.length)Z+=" ";J=G+1;continue}Z+=$[J]===`
|
|
782
782
|
`?`
|
|
783
|
-
`:" ",J++}Z+=" ",J++;continue}Z+=X,J++}return Z}function e8($){let Z=new Set,J=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=J.exec($))!==null)if(!
|
|
783
|
+
`:" ",J++}Z+=" ",J++;continue}Z+=X,J++}return Z}function e8($){let Z=new Set,J=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=J.exec($))!==null)if(!qW.has(Y[1]))Z.add(Y[1]);return Array.from(Z)}function jW($){let Z=new Set;for(let J of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(J[1]);for(let J of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Y of J[1].split(",")){let X=Y.trim().split(/[:=]/).pop()?.trim();if(X&&/^[A-Za-z_$][\w$]*$/.test(X))Z.add(X)}return Z}function $Z($){let Z=new Set,J=new Set,Y=$;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let X=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let q=G[1],z=G[2];if(G[0].includes("import type"))continue;let U=[];for(let H of q.split(",")){let B=H.trim();if(!B||B.startsWith("type "))continue;let _=B.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let O=_[1],V=_[2]||O;if(X.add(O),X.add(V),z==="stx"||z==="@stacksjs/stx")Z.add(O);else J.add(O);if(V!==O)U.push(`${V} = ${O}`)}let j=U.length>0?`var ${U.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";Y=Y.replace(G[0],j)}let K=jW(Y);for(let q of r8){if(X.has(q)||K.has(q))continue;if(new RegExp(`\\b${q}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))Z.add(q)}for(let q of a8){if(X.has(q)||K.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(Y))J.add(q)}let W=e8(Y);for(let q of W)if(!X.has(q)&&!K.has(q))J.add(q);return{code:Y,stxImports:Array.from(Z),browserImports:Array.from(J)}}function J3($,Z){let J=[];if($.length>0)J.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)J.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(J.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
784
784
|
${J.join(`
|
|
785
785
|
`)}
|
|
786
|
-
${
|
|
786
|
+
${HW($,Z)}`;return""}function BW($,Z=[]){let{browserImports:J}=$Z($),Y=new Set(Z);return J3([],J.filter((X)=>!Y.has(X)))}function HW($,Z){let J=[...$.map((Y)=>`['${Y}', typeof ${Y}, 'stx']`),...Z.map((Y)=>`['${Y}', typeof ${Y}, '@stacksjs/browser']`)];if(J.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
787
787
|
[${J.join(", ")}].forEach(function (e) {
|
|
788
788
|
if (e[1] !== 'undefined') return;
|
|
789
789
|
console.error(
|
|
@@ -792,10 +792,10 @@ ${BW($,Z)}`;return""}function jW($,Z=[]){let{browserImports:J}=$Z($),Y=new Set(Z
|
|
|
792
792
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
793
793
|
);
|
|
794
794
|
});
|
|
795
|
-
`}function Y$($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let Y={};for(let X in Z){let Q=Z[X];if(typeof Q==="function")continue;Y[X]=Q}return Y.__stxDeclaredPayload=!0,Y}let J={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let X=$[Y];if(typeof X==="function")continue;J[Y]=X}return J}function n8($,Z){let J=new Set;for(let Y of $.split(",")){let X=Y.trim().replace(/^\.\.\./,"").trim();if(!X)continue;if(Z){let Q=X.lastIndexOf(":");if(Q!==-1)X=X.slice(Q+1).trim()}if(X=X.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(X))J.add(X)}return J}function
|
|
795
|
+
`}function Y$($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let Y={};for(let X in Z){let Q=Z[X];if(typeof Q==="function")continue;Y[X]=Q}return Y.__stxDeclaredPayload=!0,Y}let J={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let X=$[Y];if(typeof X==="function")continue;J[Y]=X}return J}function n8($,Z){let J=new Set;for(let Y of $.split(",")){let X=Y.trim().replace(/^\.\.\./,"").trim();if(!X)continue;if(Z){let Q=X.lastIndexOf(":");if(Q!==-1)X=X.slice(Q+1).trim()}if(X=X.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(X))J.add(X)}return J}function _W($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let J of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(n8(J[1],!0).has(Z))return!0;for(let J of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(n8(J[1],!1).has(Z))return!0;return!1}function OW($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}function VW($,Z){let J=FW.test($),Y=Z.length>32768;if(!J&&!Y)return;if(o8.has($))return;if(o8.add($),J)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(Y)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function c$($,Z){if(!Z)return"";let J=l$($),Y=Z.__stxDeclaredPayload===!0,X=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!Y&&!OW(J,Q))continue;if(_W($,Q))continue;let K;try{K=JSON.stringify(G)}catch{continue}if(K===void 0)continue;VW(Q,K),X.push(` var ${Q} = ${K.replace(/</g,"\\u003c")};`)}if(X.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
796
796
|
${X.join(`
|
|
797
797
|
`)}
|
|
798
|
-
`}function
|
|
798
|
+
`}function wW($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let J of $.systemKeys)Z.push(`if (!$event.${J}Key) return`);if($.keys.length>0){let J=$.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if($.mouse!==null){let J=LW[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function NW($,Z){let{elementId:J,event:Y,modifiers:X}=$,Q=o7($.handler),G=wW(X),K=[];if(X.once)K.push("once: true");if(X.capture)K.push("capture: true");if(X.passive)K.push("passive: true");let W=K.length>0?`, { ${K.join(", ")} }`:"",q="";if(G)q+=`${G}; `;let z=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
|
|
799
799
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
800
800
|
};`;function j(H){if(/\$emit\s*\(/.test(H))return`${U}
|
|
801
801
|
${H}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
@@ -838,11 +838,11 @@ else {
|
|
|
838
838
|
else {
|
|
839
839
|
${Q}
|
|
840
840
|
}
|
|
841
|
-
}${W})`}function
|
|
841
|
+
}${W})`}function RW($){if($.length===0)return"";return`
|
|
842
842
|
// STX: auto-generated event bindings
|
|
843
|
-
${$.map((J,Y)=>
|
|
843
|
+
${$.map((J,Y)=>NW(J,Y)).join(`
|
|
844
844
|
`)}`}function s8($){let Z=[],J=new Set,Y=$.replace(/^\s*import\s+.*$/gm,""),X=0,Q=Y.length,G=0;while(G<Q){let K=Y[G];if(K==="'"||K==='"'||K==="`"){let W=K;if(G++,W==="`"){let q=0;while(G<Q){if(Y[G]==="\\"){G+=2;continue}if(Y[G]==="`"&&q===0){G++;break}if(Y[G]==="$"&&Y[G+1]==="{"){q++,G+=2;continue}if(Y[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(Y[G]==="\\"){G+=2;continue}if(Y[G]===W){G++;break}G++}continue}if(K==="/"&&Y[G+1]==="/"){while(G<Q&&Y[G]!==`
|
|
845
|
-
`)G++;continue}if(K==="/"&&Y[G+1]==="*"){G+=2;while(G<Q-1&&!(Y[G]==="*"&&Y[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let W=Y.slice(G),q=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let j=q[1];if(!j.startsWith("_")&&!J.has(j))Z.push(j),J.add(j);G+=q[0].length;continue}let z=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((j)=>{let H=j.trim(),B=H.indexOf(":"),_=B>=0?H.slice(B+1).trim().split(/[\s=]/)[0]:H.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!J.has(_))Z.push(_),J.add(_)}),G+=z[0].length;continue}let U=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let j=U[1];if(!j.startsWith("_")&&!J.has(j))Z.push(j),J.add(j);G+=U[0].length;continue}}G++}return Z}function
|
|
845
|
+
`)G++;continue}if(K==="/"&&Y[G+1]==="*"){G+=2;while(G<Q-1&&!(Y[G]==="*"&&Y[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let W=Y.slice(G),q=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let j=q[1];if(!j.startsWith("_")&&!J.has(j))Z.push(j),J.add(j);G+=q[0].length;continue}let z=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((j)=>{let H=j.trim(),B=H.indexOf(":"),_=B>=0?H.slice(B+1).trim().split(/[\s=]/)[0]:H.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!J.has(_))Z.push(_),J.add(_)}),G+=z[0].length;continue}let U=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let j=U[1];if(!j.startsWith("_")&&!J.has(j))Z.push(j),J.add(j);G+=U[0].length;continue}}G++}return Z}function MW($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(j){let H;while((H=J.exec(j))!==null){let B=H[0];if(!AW.has(B))Z.add(B)}}let X=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=X.exec($))!==null)Y(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)Y(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)Y(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)Y(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)Y(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)Y(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)Y(Q[1]);return Z}async function X$($,Z={}){let J=$,Y="",X=!1,Q=[],G=d$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let K=p$(G.styles),W=V5(J);J=W.code,Q=[...W.imports,...W.models];let{hasUserImports:q,bundleClientScript:z}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => ($$(),e5)));if(q(J))J=await z(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let F=$Z(J);J=F.code,Y=J3(F.stxImports,F.browserImports.filter((L)=>!Q.includes(L)))}if(Y=`${c$(J,Z.serverData)}${Y}`,J=p0(J),!X&&c1(Z.attrs||""))J=i1(J);let U=RW(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let F=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${F?` ${F}`:""}`;return`${K}<script ${L}>
|
|
846
846
|
${F5(`${Y}${J}
|
|
847
847
|
${U}`)}
|
|
848
848
|
</script>`}let B=i7($),_=/function __stx_setup_/.test(J),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(F){let L=F.length>0?`
|
|
@@ -851,12 +851,12 @@ window.stx.mount(function() {
|
|
|
851
851
|
'use strict';
|
|
852
852
|
${F5(`${Y}${J}
|
|
853
853
|
${U}${L}`)}
|
|
854
|
-
})</script>`}if(!O&&!_){if(B)return V(s8($));if(Z.templateContent){let F=s8($);if(F.length>0){let L=
|
|
854
|
+
})</script>`}if(!O&&!_){if(B)return V(s8($));if(Z.templateContent){let F=s8($);if(F.length>0){let L=MW(Z.templateContent);if(F.some((N)=>L.has(N)))return V(F)}}}return`${K}<script data-stx-scoped data-stx-run="always">
|
|
855
855
|
;(function() {
|
|
856
856
|
'use strict';
|
|
857
857
|
${F5(`${Y}${J}
|
|
858
858
|
${U}`)}
|
|
859
|
-
})()</script>`}var
|
|
859
|
+
})()</script>`}var YW,r8,a8,qW,FW,o8,LW,AW;var Q$=b(()=>{r7();I0();t5();K1();a7();YW=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;r8=F1,a8=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];qW=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"]);FW=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,o8=new Set;LW={left:0,middle:1,right:2};AW=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"])});import{createHash as TW}from"crypto";function JZ($){let Z=$[i$];return Z instanceof Map?Z:null}function YZ($){$[i$]=new Map}function XZ($,Z){let J=JZ($);if(!J)return null;let Y=TW("sha256").update(Z).digest("hex").slice(0,16),X=J.get(Y);if(X)X.instances++;else J.set(Y,{body:Z,instances:1});return Y}function QZ($,Z){let J=JZ(Z);if(!J?.size)return $;let Y=$;for(let[W,q]of J){if(q.instances!==1)continue;let z=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(W)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(z,(U,j)=>`(${q.body})(${j});`)}let X=[...J].filter(([,W])=>W.instances>1);if(X.length===0)return Y;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
860
860
|
(function() {
|
|
861
861
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
862
862
|
${X.map(([W,q])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${q.body}; }
|
|
@@ -865,7 +865,7 @@ ${X.map(([W,q])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.str
|
|
|
865
865
|
})();
|
|
866
866
|
</script>`,K=Y.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(K<0)return`${G}
|
|
867
867
|
${Y}`;return`${Y.slice(0,K)}${G}
|
|
868
|
-
${Y.slice(K)}`}var i$="__stx_component_client_factories";var Y3=()=>{};function
|
|
868
|
+
${Y.slice(K)}`}var i$="__stx_component_client_factories";var Y3=()=>{};function EW($){let Z="",J=null,Y=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){Y=!1;continue}if(Q==="\\"&&J){Y=!0;continue}if(J){if(J==="`"&&Q==="$"&&X+1<$.length&&$[X+1]==="{"){let G=1;X+=2;while(X<$.length&&G>0){if($[X]==="{")G++;else if($[X]==="}")G--;if(G>0)Z+=$[X],X++}continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}Z+=Q}return Z}function bW($,Z){let J=/[$A-Z_a-z][$\w]*/g,Y;while((Y=J.exec($))!==null){let X=Y[0],Q=$[Y.index-1];if(DW.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&qZ.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function SW($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,J;while((J=Z.exec($))!==null){let Y=J[2];if(!qZ.has(Y))continue;let X=$.slice(0,J.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(J.index+J[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${J[2]}): ${$}`)}}function n$($){let Z=$.trim(),J=EW(Z);bW(J,Z),SW(Z);for(let Y of WZ)if(Y.test(J))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${Z}`);if(!KZ.allowBracketNotation&&kW.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function yW($){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[J,Y]of Object.entries($)){if(J.startsWith("__")||WZ.some((X)=>X.test(J)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))Z[J]=X3(Y);else Z[J]=Y}return Z}function X3($,Z=0){if(Z>=KZ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>X3(Y,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let J={};for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(X&&typeof X==="object")J[Y]=X3(X,Z+1);else J[Y]=X}return J}function Y0($,Z){try{let J=yW(Z),Y=Object.keys(J),X=Object.values(J);return q0($,Y)(...X)}catch{return}}function W0($){try{return n$($),!0}catch{return!1}}function A0($,Z){try{let J=Y0($,Z);if(J&&typeof J==="object"&&!Array.isArray(J))return J;return{}}catch{return{}}}function q0($,Z){let J=n$($),Y=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let q=0;q<Z.length;q++){let z=Z[q];if(!Y.test(z))continue;if(zZ.has(z))continue;X.push(q),Q.push(z)}let G=(q)=>Function(...Q,...q,`
|
|
869
869
|
'use strict';
|
|
870
870
|
try {
|
|
871
871
|
return ${J};
|
|
@@ -876,7 +876,7 @@ catch (e) {
|
|
|
876
876
|
}
|
|
877
877
|
throw e;
|
|
878
878
|
}
|
|
879
|
-
`),K=G([]);if(Q.length===Z.length)return GZ(K,Q,G);return GZ((...q)=>{let z=Array(X.length);for(let U=0;U<X.length;U++)z[U]=q[X[U]];return K(...z)},Q,G,(q)=>{K=G(q)})}function GZ($,Z,J,Y){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...q)=>{for(let z=0;z<=8;z++)try{return G(...q)}catch(U){let j=U instanceof Error?U.message:"",H=Q.exec(j);if(!(U instanceof ReferenceError)||!H)return;let B=H[1];if(W.has(B)||zZ.has(B))return;W.add(B),K.push(B),G=J(K),Y?.(K)}return}}function o$($){let Z=$.trim(),J=[/\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 Y of J)if(Y.test(Z))return!1;return!0}var TW,KZ,WZ,IW,qZ,DW,zZ;var M0=b(()=>{TW={maxSanitizeDepth:10,allowBracketNotation:!1},KZ={...TW},WZ=[/\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/],IW=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"]),qZ=new Set(["__proto__","constructor","prototype"]),DW=/[\w)\]]\s*\[\s*['"]/;zZ=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 s$($,Z){let J=yW++,Y=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return PW.set(Y,{type:$,expression:Z}),Y}var yW=0,PW;var UZ=b(()=>{PW=new Map});function OZ($,Z,J,Y){J.lastIndex=Z;let X=J.exec($);if(!X||X.index!==Z)return-1;Y.lastIndex=J.lastIndex;let Q=Y.exec($);if(!Q)return-1;return Q.index+Q[0].length}function k1($,Z){return OZ($,Z,jZ,BZ)}function L5($,Z){return OZ($,Z,HZ,_Z)}function G$($,Z){if(!$.startsWith("<!--",Z))return-1;let J=$.indexOf("-->",Z+4);if(J===-1)return-1;return J+3}function CW($,Z){if($.startsWith("<!--",Z)){let J=G$($,Z);return J===-1?$.length:J}for(let[J,Y]of[[jZ,BZ],[HZ,_Z]]){J.lastIndex=Z;let X=J.exec($);if(!X||X.index!==Z)continue;Y.lastIndex=J.lastIndex;let Q=Y.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function Q3($,Z){let J=[],Y=0,X=$.length,Q=!1,G=null;while(Y<X){let K=$[Y];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;Y++;continue}if(K!=="<"){Y++;continue}let W=Z($,Y);if(W>Y){J.push({start:Y,end:W,token:$.slice(Y,W)}),Y=W;continue}let q=CW($,Y);if(q>Y){Y=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Y,Y+2)))Q=!0;Y++}return J}function W1($,Z,J){let Y=Q3($,Z);if(Y.length===0)return{output:$,tokens:[]};let X=Y.map((K)=>K.token),Q="",G=0;for(let K=0;K<Y.length;K++){let W=Y[K];Q+=$.slice(G,W.start),Q+=J(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function E1($){let{output:Z,tokens:J}=W1($,k1,(Y,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:J}}function K$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(J,Y)=>Z[+Y]??"")}var jZ,BZ,HZ,_Z;var n1=b(()=>{jZ=/<script\b[^>]*>/iy,BZ=/<\/script\s*>/ig,HZ=/<style\b[^>]*>/iy,_Z=/<\/style\s*>/ig});var RZ={};t(RZ,{usesSignalsInScript:()=>L1,unescapeHtml:()=>dW,registerFilters:()=>xW,registerFilter:()=>LZ,processExpressions:()=>b1,interpolateScriptsInTemplate:()=>gW,interpolateScriptExpressions:()=>r$,getAllFilters:()=>wZ,evaluateExpression:()=>n0,escapeHtml:()=>t0,defaultFilters:()=>q$,clearCustomFilters:()=>fW,applyFilters:()=>NZ});function vW($){let Z=FZ.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),FZ.set($,Z)}return Z.lastIndex=0,Z}function LZ($,Z){if($ in q$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);W$[$]=Z}function xW($){for(let[Z,J]of Object.entries($))LZ(Z,J)}function wZ(){return{...q$,...W$}}function fW(){for(let $ of Object.keys(W$))delete W$[$]}function t0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function L1($){let{scripts:Z}=E1($);for(let J of Z){let Y=J.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let X=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))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 VZ($,Z){let J=["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"],Y=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let q=0;q<Y.length;q++){let z=Y[q];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&Y[q+1]==="{"){G++,q++,X+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){X+=z;continue}continue}X+=z}Y=X;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=K.exec(Y))!==null){let q=W[1];if(!Y.substring(0,W.index).trimEnd().endsWith(".")){if(!J.includes(q)&&!(q in Z))return!1}}return!0}function r$($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(Y,X)=>{try{let Q=n0(X,Z);if(Q===void 0)return Y;return Q===null?"":String(Q)}catch{return Y}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(Y,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return Y;try{let G=n0(X,Z);if(G===void 0)return Y;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return Y}}),J}function gW($,Z,J={}){let{output:Y,scripts:X}=E1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!K||!W||q===-1)return G;let z=K[1],U=K[2];if(/\bsrc\s*=/.test(z))return G;if(/\bdata-raw\b/.test(z))return G;if(/\btype\s*=\s*["']application\/json["']/.test(z))return G;if(J.skipServer&&/\bserver\b/.test(z))return G;let j=r$(U,Z);return W[0]+j+G.slice(q)});return K$(Y,Q)}function b1($,Z,J){let Y=$,X=(U,j)=>{let H=L5(U,j);if(H===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(j,H))?-1:H},Q=(U,j,H,B)=>{let _=H.length,{output:O,tokens:V}=W1(U,j,(F,L)=>B(_+L));return H.push(...V),O},G=[];Y=Q(Y,X,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let K=[];Y=Q(Y,k1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let W=Z?.__stx_signals_gate===!0||L1($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,j,H)=>{try{let B=n0(j,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${_}`,J,$,H,U)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(U,j,H)=>{try{let B=n0(j,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return s$("raw",j.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return s$("raw",j.trim());let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${_}`,J,$,H,U)}}),Y=Q(Y,k1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),Y=Q(Y,X,G,(U)=>`<!--__STX_STYLE_${U}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(U,j,H)=>{let B=j.trim();if(z.has(B))return U;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=B.match(O)?.[1],L=F&&((F in Z)||_.includes(F)),w=Boolean(F&&q.has(F)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(N),A=R&&!_.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let M=n0(j,Z);if(w)return U;if(W&&!VZ(B,Z))return U;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return s$("expr",B);return M!==void 0&&M!==null?t0(String(M)):""}catch(M){if(w)return U;if(W&&!VZ(B,Z))return U;if(A)return U;let T=M instanceof Error?M.message:String(M);return j0("Expression",`Error evaluating: {{ ${B} }}: ${T}`,J,$,H,U)}});for(let U=0;U<K.length;U++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>K[U]);for(let U=0;U<G.length;U++)Y=Y.replace(`<!--__STX_STYLE_${U}__-->`,()=>G[U]);return Y}function NZ($,Z,J){if(!Z.trim())return $;let Y=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=W$[G]||q$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(wZ()).join(", ")}`);let W=[];if(X.startsWith(":")){let q=X.match(/^:([^|\s]+)/);if(q){let z=q[1].trim();try{let U=Number(z);W=[Number.isNaN(U)?z:U]}catch{W=[z]}X=X.substring(q[0].length).trim()}}else if(X.startsWith("(")){let q=1,z=1;while(q>0&&z<X.length){if(X[z]==="(")q++;if(X[z]===")")q--;z++}if(q===0){let U=X.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[n0(`(${U})`,J,!0)];else{let j=[],H="",B=null,_=0,O=0,V=0,F=!1;for(let L=0;L<U.length;L++){let w=U[L];if(F){H+=w,F=!1;continue}if(w==="\\"){H+=w,F=!0;continue}if(B){if(H+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,H+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&_===0&&O===0&&V===0){j.push(H),H="";continue}H+=w}if(H)j.push(H);W=j.map((L)=>{let w=L.trim();return n0(w,J,!0)})}}catch{W=[U]}X=X.substring(z).trim()}}try{Y=K(Y,J,...W)}catch(q){let z=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${z}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return Y}function hW($){let Z=!1,J="",Y=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],q=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,J=W;else if(W===J)Z=!1,J="";continue}if(Z&&J==="`"&&W==="$"&&q==="{"){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(W==="(")Y++;else if(W===")")Y--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&Y===0&&X===0&&Q===0){if(q==="|"){K++;continue}if(q==="="){K++;continue}return K}}return-1}function n0($,Z,J=!1){try{let Y=$.trim(),X=hW(Y);if(X>0){let Q=Y.substring(0,X).trim(),G=Y.substring(X+1).trim(),K=n0(Q,Z,!0);return NZ(K,G,Z)}if(!W0(Y)){if(!J)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Y0(Y,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return q0(Y,Q)(...G)}catch{return Y0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(Y.message);if(X){let Q=X[1],G=uW(Q,Object.keys(Z));if(G&&G!==Q)Y.message=`${Y.message} \u2014 did you mean '${G}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function uW($,Z){let J=null;for(let X of Z){if(X===$)continue;let Q=mW($,X);if(J===null||Q<J.dist)J={key:X,dist:Q}}if(!J)return null;let Y=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/Y<=0.35)return J.key;return null}function mW($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,Y]=$.length<Z.length?[$,Z]:[Z,$],X=Array(J.length+1),Q=Array(J.length+1);for(let G=0;G<=J.length;G++)X[G]=G;for(let G=1;G<=Y.length;G++){Q[0]=G;for(let K=1;K<=J.length;K++){let W=J[K-1]===Y[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=J.length;K++)X[K]=Q[K]}return X[J.length]}function dW($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var W$,FZ,q$;var q1=b(()=>{M0();I0();UZ();n1();W$={},FZ=new Map;q$={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let Y=Number($);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return Y.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return t0(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let Y=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=Y;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(J).forEach(([W,q])=>{K=K.replace(vW(W),String(q))}),K},t:($,Z,J={})=>{return q$.translate($,Z,J)},truncate:($,Z,J=50,Y="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=J)return X;if(J<=Y.length)return Y.substring(0,J);return X.substring(0,J-Y.length)+Y},date:($,Z,J="short",Y="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return X.toISOString();return new Intl.DateTimeFormat(Y,Q[J]||Q.short).format(X)}catch{return String($)}},currency:($,Z,J="USD",Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(Y,{style:"currency",currency:J}).format(X)}catch{return String($)}},pluralize:($,Z,J,Y)=>{let X=Number($);if(Number.isNaN(X))return J;let Q=Y||`${J}s`;return X===1?J:Q},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 J=String($);return J.charAt(J.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,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,Y);return $},replace:($,Z,J,Y="")=>{if($===void 0||$===null)return"";let X=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>Y)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let Y=Number($);if(Number.isNaN(Y))return 0;let X=10**J;return Math.round(Y*X)/X}}});class o1{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 J=this.cache.keys().next().value;if(J!==void 0)this.cache.delete(J)}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 N5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let J=`${$}:${Z||""}`;if(!w5.has(J)){if(w5.size>=pW){let Y=w5.keys().next().value;if(Y)w5.delete(Y)}w5.set(J,new RegExp($,Z))}return w5.get(J)}class AZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),J=Z.sort().join(","),Y=this.pool.find((K)=>K.context.join(",")===J);if(Y)return Y.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let q=`${J}:${W}`,z=X.get(q);if(!z){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}z=Function(...Z,`
|
|
879
|
+
`),K=G([]);if(Q.length===Z.length)return GZ(K,Q,G);return GZ((...q)=>{let z=Array(X.length);for(let U=0;U<X.length;U++)z[U]=q[X[U]];return K(...z)},Q,G,(q)=>{K=G(q)})}function GZ($,Z,J,Y){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...q)=>{for(let z=0;z<=8;z++)try{return G(...q)}catch(U){let j=U instanceof Error?U.message:"",H=Q.exec(j);if(!(U instanceof ReferenceError)||!H)return;let B=H[1];if(W.has(B)||zZ.has(B))return;W.add(B),K.push(B),G=J(K),Y?.(K)}return}}function o$($){let Z=$.trim(),J=[/\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 Y of J)if(Y.test(Z))return!1;return!0}var IW,KZ,WZ,DW,qZ,kW,zZ;var M0=b(()=>{IW={maxSanitizeDepth:10,allowBracketNotation:!1},KZ={...IW},WZ=[/\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/],DW=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"]),qZ=new Set(["__proto__","constructor","prototype"]),kW=/[\w)\]]\s*\[\s*['"]/;zZ=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 s$($,Z){let J=PW++,Y=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return CW.set(Y,{type:$,expression:Z}),Y}var PW=0,CW;var UZ=b(()=>{CW=new Map});function OZ($,Z,J,Y){J.lastIndex=Z;let X=J.exec($);if(!X||X.index!==Z)return-1;Y.lastIndex=J.lastIndex;let Q=Y.exec($);if(!Q)return-1;return Q.index+Q[0].length}function k1($,Z){return OZ($,Z,jZ,BZ)}function L5($,Z){return OZ($,Z,HZ,_Z)}function G$($,Z){if(!$.startsWith("<!--",Z))return-1;let J=$.indexOf("-->",Z+4);if(J===-1)return-1;return J+3}function vW($,Z){if($.startsWith("<!--",Z)){let J=G$($,Z);return J===-1?$.length:J}for(let[J,Y]of[[jZ,BZ],[HZ,_Z]]){J.lastIndex=Z;let X=J.exec($);if(!X||X.index!==Z)continue;Y.lastIndex=J.lastIndex;let Q=Y.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function Q3($,Z){let J=[],Y=0,X=$.length,Q=!1,G=null;while(Y<X){let K=$[Y];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;Y++;continue}if(K!=="<"){Y++;continue}let W=Z($,Y);if(W>Y){J.push({start:Y,end:W,token:$.slice(Y,W)}),Y=W;continue}let q=vW($,Y);if(q>Y){Y=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Y,Y+2)))Q=!0;Y++}return J}function W1($,Z,J){let Y=Q3($,Z);if(Y.length===0)return{output:$,tokens:[]};let X=Y.map((K)=>K.token),Q="",G=0;for(let K=0;K<Y.length;K++){let W=Y[K];Q+=$.slice(G,W.start),Q+=J(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function E1($){let{output:Z,tokens:J}=W1($,k1,(Y,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:J}}function K$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(J,Y)=>Z[+Y]??"")}var jZ,BZ,HZ,_Z;var n1=b(()=>{jZ=/<script\b[^>]*>/iy,BZ=/<\/script\s*>/ig,HZ=/<style\b[^>]*>/iy,_Z=/<\/style\s*>/ig});var AZ={};t(AZ,{usesSignalsInScript:()=>L1,unescapeHtml:()=>pW,registerFilters:()=>fW,registerFilter:()=>LZ,processExpressions:()=>b1,interpolateScriptsInTemplate:()=>hW,interpolateScriptExpressions:()=>r$,interpolateScriptAttributes:()=>NZ,getAllFilters:()=>wZ,evaluateExpression:()=>u0,escapeHtml:()=>t0,defaultFilters:()=>q$,clearCustomFilters:()=>gW,applyFilters:()=>RZ});function xW($){let Z=FZ.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),FZ.set($,Z)}return Z.lastIndex=0,Z}function LZ($,Z){if($ in q$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);W$[$]=Z}function fW($){for(let[Z,J]of Object.entries($))LZ(Z,J)}function wZ(){return{...q$,...W$}}function gW(){for(let $ of Object.keys(W$))delete W$[$]}function t0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function L1($){let{scripts:Z}=E1($);for(let J of Z){let Y=J.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let X=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))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 VZ($,Z){let J=["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"],Y=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let q=0;q<Y.length;q++){let z=Y[q];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&Y[q+1]==="{"){G++,q++,X+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){X+=z;continue}continue}X+=z}Y=X;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=K.exec(Y))!==null){let q=W[1];if(!Y.substring(0,W.index).trimEnd().endsWith(".")){if(!J.includes(q)&&!(q in Z))return!1}}return!0}function r$($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(Y,X)=>{try{let Q=u0(X,Z);if(Q===void 0)return Y;return Q===null?"":String(Q)}catch{return Y}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(Y,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return Y;try{let G=u0(X,Z);if(G===void 0)return Y;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return Y}}),J}function NZ($,Z){if(!$.includes("{"))return $;let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(Y,X)=>{try{let Q=u0(X,Z);if(Q===void 0)return Y;return Q===null?"":String(Q)}catch{return Y}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(Y,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return Y;try{let G=u0(X,Z);if(G===void 0)return Y;if(G===null)return"";return String(G).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch{return Y}}),J}function hW($,Z,J={}){let{output:Y,scripts:X}=E1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!K||!W||q===-1)return G;let z=K[1],U=K[2];if(/\bdata-raw\b/.test(z))return G;if(J.skipServer&&/\bserver\b/.test(z))return G;let H=`<script${NZ(z,Z)}>`;if(/\bsrc\s*=/.test(z)||/\btype\s*=\s*["']application\/json["']/.test(z))return H+U+G.slice(q);return H+r$(U,Z)+G.slice(q)});return K$(Y,Q)}function b1($,Z,J){let Y=$,X=(U,j)=>{let H=L5(U,j);if(H===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(j,H))?-1:H},Q=(U,j,H,B)=>{let _=H.length,{output:O,tokens:V}=W1(U,j,(F,L)=>B(_+L));return H.push(...V),O},G=[];Y=Q(Y,X,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let K=[];Y=Q(Y,k1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let W=Z?.__stx_signals_gate===!0||L1($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,j,H)=>{try{let B=u0(j,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${_}`,J,$,H,U)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(U,j,H)=>{try{let B=u0(j,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return s$("raw",j.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return s$("raw",j.trim());let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${_}`,J,$,H,U)}}),Y=Q(Y,k1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),Y=Q(Y,X,G,(U)=>`<!--__STX_STYLE_${U}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(U,j,H)=>{let B=j.trim();if(z.has(B))return U;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=B.match(O)?.[1],L=F&&((F in Z)||_.includes(F)),w=Boolean(F&&q.has(F)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(N),A=R&&!_.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let M=u0(j,Z);if(w)return U;if(W&&!VZ(B,Z))return U;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return s$("expr",B);return M!==void 0&&M!==null?t0(String(M)):""}catch(M){if(w)return U;if(W&&!VZ(B,Z))return U;if(A)return U;let T=M instanceof Error?M.message:String(M);return j0("Expression",`Error evaluating: {{ ${B} }}: ${T}`,J,$,H,U)}});for(let U=0;U<K.length;U++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>K[U]);for(let U=0;U<G.length;U++)Y=Y.replace(`<!--__STX_STYLE_${U}__-->`,()=>G[U]);return Y}function RZ($,Z,J){if(!Z.trim())return $;let Y=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=W$[G]||q$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(wZ()).join(", ")}`);let W=[];if(X.startsWith(":")){let q=X.match(/^:([^|\s]+)/);if(q){let z=q[1].trim();try{let U=Number(z);W=[Number.isNaN(U)?z:U]}catch{W=[z]}X=X.substring(q[0].length).trim()}}else if(X.startsWith("(")){let q=1,z=1;while(q>0&&z<X.length){if(X[z]==="(")q++;if(X[z]===")")q--;z++}if(q===0){let U=X.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[u0(`(${U})`,J,!0)];else{let j=[],H="",B=null,_=0,O=0,V=0,F=!1;for(let L=0;L<U.length;L++){let w=U[L];if(F){H+=w,F=!1;continue}if(w==="\\"){H+=w,F=!0;continue}if(B){if(H+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,H+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&_===0&&O===0&&V===0){j.push(H),H="";continue}H+=w}if(H)j.push(H);W=j.map((L)=>{let w=L.trim();return u0(w,J,!0)})}}catch{W=[U]}X=X.substring(z).trim()}}try{Y=K(Y,J,...W)}catch(q){let z=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${z}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return Y}function uW($){let Z=!1,J="",Y=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],q=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,J=W;else if(W===J)Z=!1,J="";continue}if(Z&&J==="`"&&W==="$"&&q==="{"){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(W==="(")Y++;else if(W===")")Y--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&Y===0&&X===0&&Q===0){if(q==="|"){K++;continue}if(q==="="){K++;continue}return K}}return-1}function u0($,Z,J=!1){try{let Y=$.trim(),X=uW(Y);if(X>0){let Q=Y.substring(0,X).trim(),G=Y.substring(X+1).trim(),K=u0(Q,Z,!0);return RZ(K,G,Z)}if(!W0(Y)){if(!J)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Y0(Y,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return q0(Y,Q)(...G)}catch{return Y0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(Y.message);if(X){let Q=X[1],G=mW(Q,Object.keys(Z));if(G&&G!==Q)Y.message=`${Y.message} \u2014 did you mean '${G}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function mW($,Z){let J=null;for(let X of Z){if(X===$)continue;let Q=dW($,X);if(J===null||Q<J.dist)J={key:X,dist:Q}}if(!J)return null;let Y=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/Y<=0.35)return J.key;return null}function dW($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,Y]=$.length<Z.length?[$,Z]:[Z,$],X=Array(J.length+1),Q=Array(J.length+1);for(let G=0;G<=J.length;G++)X[G]=G;for(let G=1;G<=Y.length;G++){Q[0]=G;for(let K=1;K<=J.length;K++){let W=J[K-1]===Y[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=J.length;K++)X[K]=Q[K]}return X[J.length]}function pW($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var W$,FZ,q$;var q1=b(()=>{M0();I0();UZ();n1();W$={},FZ=new Map;q$={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let Y=Number($);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return Y.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return t0(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let Y=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=Y;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(J).forEach(([W,q])=>{K=K.replace(xW(W),String(q))}),K},t:($,Z,J={})=>{return q$.translate($,Z,J)},truncate:($,Z,J=50,Y="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=J)return X;if(J<=Y.length)return Y.substring(0,J);return X.substring(0,J-Y.length)+Y},date:($,Z,J="short",Y="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return X.toISOString();return new Intl.DateTimeFormat(Y,Q[J]||Q.short).format(X)}catch{return String($)}},currency:($,Z,J="USD",Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(Y,{style:"currency",currency:J}).format(X)}catch{return String($)}},pluralize:($,Z,J,Y)=>{let X=Number($);if(Number.isNaN(X))return J;let Q=Y||`${J}s`;return X===1?J:Q},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 J=String($);return J.charAt(J.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,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,Y);return $},replace:($,Z,J,Y="")=>{if($===void 0||$===null)return"";let X=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>Y)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let Y=Number($);if(Number.isNaN(Y))return 0;let X=10**J;return Math.round(Y*X)/X}}});class o1{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 J=this.cache.keys().next().value;if(J!==void 0)this.cache.delete(J)}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 N5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let J=`${$}:${Z||""}`;if(!w5.has(J)){if(w5.size>=lW){let Y=w5.keys().next().value;if(Y)w5.delete(Y)}w5.set(J,new RegExp($,Z))}return w5.get(J)}class MZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),J=Z.sort().join(","),Y=this.pool.find((K)=>K.context.join(",")===J);if(Y)return Y.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let q=`${J}:${W}`,z=X.get(q);if(!z){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}z=Function(...Z,`
|
|
880
880
|
'use strict';
|
|
881
881
|
try {
|
|
882
882
|
return ${W};
|
|
@@ -887,34 +887,34 @@ catch (e) {
|
|
|
887
887
|
}
|
|
888
888
|
throw e;
|
|
889
889
|
}
|
|
890
|
-
`),X.set(q,z)}return z(...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
|
|
890
|
+
`),X.set(q,z)}return z(...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 TZ{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,J]of Object.entries($))this.setBudget(Z,J)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,J]of this.budgets.entries())$[Z]=J;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 J=performance.now(),Y=Z(),X=performance.now()-J;return this.recordTime($,X),this.checkBudget($,X),Y}async timeAsync($,Z){if(!this.enabled)return Z();let J=performance.now(),Y=await Z(),X=performance.now()-J;return this.recordTime($,X),this.checkBudget($,X),Y}checkBudget($,Z){let J=this.budgets.get($);if(!J)return;let Y=Z/J.maxTime*100,X=J.warnThreshold!==void 0?Z>=J.maxTime*J.warnThreshold&&Z<J.maxTime:!1,Q=Z>=J.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:J.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:X};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(G)}catch{}let K=X?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${Y.toFixed(1)}% of ${J.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${J.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(J.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let J=this.metrics.get($);if(J)J.count++,J.totalTime+=Z,J.maxTime=Math.max(J.maxTime,Z),J.minTime=Math.min(J.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let J=this.metrics.get($);if(!J)return{};let Y=this.budgets.get($);return{count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Y?.maxTime,budgetUtilization:Y?J.totalTime/J.count/Y.maxTime*100:void 0}}let Z={};for(let[J,Y]of this.metrics.entries()){let X=this.budgets.get(J);Z[J]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,J=0;for(let Y of this.violations)if($[Y.label]=($[Y.label]||0)+1,Y.isWarning)Z++;else J++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:J}}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 cW(){if(!G3)G3=new TZ;return G3}var w5,lW=500,xV,G3=null,IZ;var R5=b(()=>{w5=new Map;xV=new MZ;IZ=new Proxy({},{get($,Z){return cW()[Z]}})});function DZ($,Z=""){let J=`${$}${Z}`,Y=0;for(let X=0;X<J.length;X++){let Q=J.charCodeAt(X);Y=(Y<<5)-Y+Q,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function kZ($,Z,J={}){let{prefix:Y="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=J;if(!$.trim())return"";let K=K3($),W=[],q=new Map;if(Q)for(let z of K){let U=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let j=U[1],H=`${Z}_${j}`;q.set(j,H)}}for(let z of K){let U=EZ(z,Z,Y,X,q,G);W.push(U)}return W.join(`
|
|
891
891
|
|
|
892
892
|
`)}function K3($){let Z=[],J=$.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,X="",Q=!1,G="";for(let K=0;K<J.length;K++){let W=J[K];if(W==="@"&&Y===0)Q=!0;if(W==="{")Y++;else if(W==="}"){if(Y--,Y===0){if(Q){G+=W;let q=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(q){let[,z,U,j]=q;if(z==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:j.trim()});else if(z==="media"||z==="supports"||z==="container"){let H=K3(j);Z.push({selector:`@${z} ${U.trim()}`,declarations:H.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
|
|
893
|
-
`)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(X.trim()){X+=W;let q=X.match(/([^{]+)\{([^}]*)\}/);if(q)Z.push({selector:q[1].trim(),declarations:q[2].trim()});X=""}continue}}if(Q)G+=W;else X+=W}return Z}function
|
|
893
|
+
`)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(X.trim()){X+=W;let q=X.match(/([^{]+)\{([^}]*)\}/);if(q)Z.push({selector:q[1].trim(),declarations:q[2].trim()});X=""}continue}}if(Q)G+=W;else X+=W}return Z}function EZ($,Z,J,Y,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=K3(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>EZ(j,Z,J,Y,X,Q)).join(`
|
|
894
894
|
`);return`${G} {
|
|
895
895
|
${U}
|
|
896
|
-
}`}return`${G} { ${K} }`}let W=
|
|
897
|
-
`)}function
|
|
898
|
-
`,""}),headContent:Z.trim()}}function
|
|
899
|
-
`);for(let X of Y){let Q=J,G=null,K=!1;for(let W=0;W<X.length;W++){let q=X[W];if(K){K=!1;continue}if(q==="\\"){K=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&W+1<X.length&&X[W+1]==="/")break;if(q==="{")J++;else if(q==="}")J--}if(Q===0){let W=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let q=X.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let U=q[1].slice(1,-1).split(",").map((j)=>{let H=j.split(":");return(H.length>1?H[1]:H[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...U)}}}}return[...new Set(Z)]}function
|
|
896
|
+
}`}return`${G} { ${K} }`}let W=iW(G,Z,J,Y),q=K;for(let[z,U]of X)q=q.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(Q)q=q.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${q} }`}function iW($,Z,J,Y){let X=$.split(",").map((G)=>G.trim()),Q=[];for(let G of X){if(G.startsWith(":host")){if(Y)Q.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(q)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=J?`${J} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let W=nW(G,Z);if(W)Q.push(J?`${J} ${W}`:W)}return Q.join(", ")}function nW($,Z){let J=0,Y=$.length;for(let W=0;W<$.length;W++){let q=$[W];if(q==="["||q==="(")J++;else if(q==="]"||q===")")J--;else if(J===0&&(q===" "||q===">"||q==="+"||q==="~")){Y=W;break}}let X=$.slice(0,Y),Q=$.slice(Y);if(!X)return"";let G=X.length,K=0;for(let W=0;W<X.length;W++){let q=X[W];if(q==="["||q==="(")K++;else if(q==="]"||q===")")K--;else if(J===0&&K===0&&q===":"){G=W;break}}return`${X.slice(0,G)}.${Z}${X.slice(G)}${Q}`}function SZ($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(J)=>{let Y=J.trim();if(Z.has(Y))return"";return Z.add(Y),J})}function a$($,Z){if(!oW.test($))return{html:$,hasScoped:!1};let J=DZ(Z),Y=`data-v-${J}`,X=$,Q=new RegExp(`<style\\s+([^>]*${W3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,W,q)=>{G=!0;let z=sW(q,Y),U=W.replace(new RegExp(W3,"gi"),"").trim(),j=U?` ${U}`:"";return`<style data-stx-scoped="${J}"${j}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return X=aW(X,Y),{html:X,hasScoped:!0}}function sW($,Z){return kZ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function aW($,Z){let J=W1($,(X,Q)=>{let G=k1(X,Q);return G>Q?G:L5(X,Q)},(X,Q)=>rW(Q)),Y=tW(J.output,Z);return bZ.lastIndex=0,Y.replace(bZ,(X,Q)=>J.tokens[Number(Q)])}function tW($,Z){let J=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,(Y,X,Q)=>{if(J.has(X.toLowerCase()))return Y;if(Y.includes(Z))return Y;if(X.toLowerCase()==="style"||X.toLowerCase()==="script")return Y;if(Q)return Y.replace(`<${X}${Q}`,`<${X} ${Z}${Q}`);if(Y.endsWith("/>"))return`<${X} ${Z} />`;return`<${X} ${Z}>`})}var W3,oW,rW=($)=>`\x00stx-scope-mask-${$}\x00`,bZ;var q3=b(()=>{n1();W3=String.raw`(?<![\w-])scoped(?![\w-])`,oW=new RegExp(`<style\\s+[^>]*${W3}`,"i");bZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function $q($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return eW.test(Z)}function t$($){z$.lastIndex=0;let Z;while((Z=z$.exec($))!==null){if(Z[0].startsWith("</")||$q(Z[0]))continue;let J=Z.index,Y=z$.lastIndex,X=1,Q;while((Q=z$.exec($))!==null)if(Q[0].startsWith("</")){if(X--,X===0){let G=Q.index;return{start:J,openEnd:Y,closeStart:G,end:z$.lastIndex,content:$.slice(Y,G)}}}else X++;return null}return null}var z$,eW;var z3=b(()=>{z$=/<\/?template\b[^>]*>/gi,eW=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var yZ=()=>{};function k0($,Z,J,Y=0){let X=0,Q=Y,G=null,K=0,W=!1;while(Q<$.length){let q=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&q==="\\"){W=!0,Q++;continue}if(W=!1,(q==='"'||q==="'"||q==="`")&&!G){G=q,Q++;continue}if(q===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&q==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&q==="}"){K--,Q++;continue}if(q==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(q===Z)X++;else if(q===J){if(X--,X===0)return Q}Q++}return-1}var B3={};t(B3,{useTitle:()=>Qq,useSeoMeta:()=>PZ,usePageTitle:()=>Qq,useHead:()=>j3,seoMetaToHeadConfig:()=>$4,resetHead:()=>Yq,renderHtmlAttrs:()=>Kq,renderHead:()=>Gq,renderBodyAttrs:()=>Wq,processTitleDirective:()=>Uq,processMetaDirective:()=>jq,processHeadDirective:()=>zq,mergeHeadConfigs:()=>A5,getPageMeta:()=>Jq,getHead:()=>U3,definePageMeta:()=>Xq,applyHead:()=>qq});function U3(){return S1}function Jq(){return e$}function Yq(){S1={},Zq.length=0,e$={}}function j3($){S1=A5(S1,$)}function A5($,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 PZ($){j3($4($))}function $4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let W=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:W})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let J=$.ogTitle??$.title,Y=$.ogDescription??$.description;if(J)Z.push({property:"og:title",content:J});if(Y)Z.push({property:"og:description",content:Y});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 X=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(X)Z.push({name:"twitter:title",content:X});if(Q)Z.push({name:"twitter:description",content:Q});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 W of $.articleTags)Z.push({property:"article:tag",content:W});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function Xq($){if(e$={...e$,...$},$.title||$.description)PZ({title:$.title,description:$.description})}function Qq($){let Z=typeof $==="function"?$():$;j3({title:Z})}function Gq($=S1){let Z=[];if($.title){let J=$.title;if($.titleTemplate)J=typeof $.titleTemplate==="function"?$.titleTemplate(J):$.titleTemplate.replace("%s",J);Z.push(`<title>${s1(J)}</title>`)}if($.base){let J=Object.entries($.base).map(([Y,X])=>`${Y}="${s1(X)}"`).join(" ");Z.push(`<base ${J}>`)}for(let J of $.meta||[]){let Y=Object.entries(J).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>{return`${X==="httpEquiv"?"http-equiv":X}="${s1(String(Q))}"`}).join(" ");Z.push(`<meta ${Y}>`)}for(let J of $.link||[]){let Y=Object.entries(J).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>`${X}="${s1(String(Q))}"`).join(" ");Z.push(`<link ${Y}>`)}for(let J of $.script||[]){let{content:Y,...X}=J,Q=Object.entries(X).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${s1(String(K))}"`}).filter(Boolean).join(" ");if(Y)Z.push(`<script ${Q}>${Y}</script>`);else Z.push(`<script ${Q}></script>`)}for(let J of $.style||[]){let Y=J.type?` type="${J.type}"`:"";Z.push(`<style${Y}>${J.content}</style>`)}return Z.join(`
|
|
897
|
+
`)}function Kq($=S1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,J])=>`${Z}="${s1(J)}"`).join(" ")}function Wq($=S1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,J])=>`${Z}="${s1(J)}"`).join(" ")}function s1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function qq($=S1){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 J=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(J){let Y=document.querySelector(J);if(!Y){if(Y=document.createElement("meta"),Z.name)Y.setAttribute("name",Z.name);if(Z.property)Y.setAttribute("property",Z.property);document.head.appendChild(Y)}Y.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let J=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,Y=document.querySelector(J);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[X,Q]of Object.entries(Z))if(Q!==void 0)Y.setAttribute(X,String(Q))}if($.htmlAttrs)for(let[Z,J]of Object.entries($.htmlAttrs))if(Z==="class")for(let Y of String(J).split(/\s+/).filter(Boolean))document.documentElement.classList.add(Y);else document.documentElement.setAttribute(Z,J);if($.bodyAttrs)for(let[Z,J]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,J)}function zq($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,X)=>{return Z+=X.trim()+`
|
|
898
|
+
`,""}),headContent:Z.trim()}}function Uq($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(J,Y,X,Q)=>{let G=Y?X:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=A5(K,{title:G}),""})}function jq($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(J,Y,X,Q,G,K)=>{let W=Q?G:K,q=Q?W:Z[(W||"").trim()]??W,U=X.includes(":")?{property:X,content:q}:{name:X,content:q},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=A5(j,{meta:[U]}),""})}var S1,Zq,e$;var U$=b(()=>{S1={},Zq=[],e$={}});var Z4={};t(Z4,{stripTypeScript:()=>gZ,splitDeclaration:()=>lZ,isModuleResolutionFailure:()=>hZ,isMissingBindingFailure:()=>uZ,isCompleteImport:()=>mZ,hasVariables:()=>oZ,extractVariables:()=>r1,extractScriptFromTemplate:()=>nZ,convertToCommonJS:()=>_3});import y1 from"path";import M5 from"process";function Bq($){let Z=[],J=0,Y=$.split(`
|
|
899
|
+
`);for(let X of Y){let Q=J,G=null,K=!1;for(let W=0;W<X.length;W++){let q=X[W];if(K){K=!1;continue}if(q==="\\"){K=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&W+1<X.length&&X[W+1]==="/")break;if(q==="{")J++;else if(q==="}")J--}if(Q===0){let W=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let q=X.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let U=q[1].slice(1,-1).split(",").map((j)=>{let H=j.split(":");return(H.length>1?H[1]:H[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...U)}}}}return[...new Set(Z)]}function gZ($){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 J(Y){if(!Y.includes(":"))return Y;let X=[],Q="",G=0,K=0,W=null;for(let q=0;q<Y.length;q++){let z=Y[q];if(W){if(Q+=z,z===W)W=null;continue}if(z==='"'||z==="'"||z==="`"){W=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")K++;else if(z===")")K--;if(z===","&&G===0&&K===0){X.push(Q),Q="";continue}Q+=z}if(Q)X.push(Q);return X.map((q)=>{let z=q.trim(),U=z.startsWith("..."),j=U?z.slice(3):z,H=-1,B=0;for(let N=0;N<j.length;N++)if(j[N]==="<")B++;else if(j[N]===">")B--;else if(j[N]===":"&&B===0){H=N;break}if(H===-1)return q;let O=j.substring(0,H).trim().replace(/\?$/,""),V=j.substring(H+1),F=-1,L=0;for(let N=0;N<V.length;N++)if(V[N]==="<")L++;else if(V[N]===">")L--;else if(V[N]==="="&&L===0){F=N;break}let w=U?"...":"";if(F!==-1)return`${w}${O} = ${V.substring(F+1).trim()}`;return`${w}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,X,Q)=>{if(!Q.includes(":"))return Y;return`${X}(${J(Q)})`});{let Y=/\b(function\s+\w*\s*)\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let G=X.index+X[0].length-1,K=1,W=G+1,q=0,z=null;while(W<Z.length&&K>0){let H=Z[W];if(z){if(H===z)z=null;W++;continue}if(H==='"'||H==="'"||H==="`"){z=H,W++;continue}if(H==="<")q++;else if(H===">"&&q>0)q--;else if(q===0){if(H==="(")K++;else if(H===")")K--}if(K>0)W++}if(K!==0)continue;let U=Z.substring(G+1,W);if(!U.includes(":"))continue;let j=J(U);Q.push({start:G+1,end:W,replacement:j})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Z=Z.substring(0,K)+q+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,X)=>{if(!X.includes(":"))return Y;if(X.includes("{")||X.includes("}"))return Y;return`(${X.split(",").map((G)=>{let[K,...W]=G.split("="),q=K.split(":")[0].trim();if(W.length>0)return`${q} = ${W.join("=").trim()}`;return q}).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,`
|
|
900
900
|
|
|
901
|
-
`),Z}function
|
|
901
|
+
`),Z}function hZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function uZ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function r1($,Z,J,Y={}){if(!$.trim())return;let X;try{let k=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=k.transformSync(v)}catch{X=gZ($)}let Q={exports:{}},G=Q.exports,K=M5.cwd(),W={},q=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((k)=>k[1]).filter((k)=>!k.startsWith("node:")&&!k.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(k));for(let k of q)try{let v=y1.resolve(K,"node_modules",k),m=y1.join(v,"package.json"),h=JSON.parse(U0("fs").readFileSync(m,"utf8")),r=h.main||"index.js";if(h.exports){let G0=typeof h.exports==="string"?h.exports:h.exports["."];if(typeof G0==="string")r=G0;else if(G0?.bun)r=G0.bun;else if(G0?.import)r=G0.import;else if(G0?.default)r=G0.default}W[k]=await import(y1.resolve(v,r))}catch{}let z=(k)=>{if(W[k])return W[k];return U0(k)},U=Z.props||{},j=(k)=>{if(!k)return U;let v={};for(let[m,h]of Object.entries(k)){let r=U[m];if(r!==void 0)v[m]=r;else if(typeof h==="function")v[m]=h();else v[m]=h}return v};for(let[k,v]of Object.entries(U))Object.defineProperty(j,k,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let k of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,k))continue;try{Object.defineProperty(j,k,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(k)=>{if(!k)return U;let v={...U};for(let[m,h]of Object.entries(k)){let r=h&&typeof h==="object"&&!Array.isArray(h)?h:{type:h};if(v[m]===void 0&&r.default!==void 0)v[m]=typeof r.default==="function"?r.default():r.default}return v},B=()=>Z.slots||{},_=(k,v)=>{let m={...k};for(let[h,r]of Object.entries(v))if(m[h]===void 0)if(typeof r==="function")m[h]=r();else m[h]=r;return m},O=(k)=>{let v=()=>k;return v.set=(m)=>{},v.update=(m)=>{},v},V=(k)=>{let v,m=!1;return()=>{if(!m)try{v=k(),m=!0}catch{v=void 0}return v}},F=(k)=>{},L=(k)=>k(),w=(k)=>{},N=(k)=>{};function R(k){let v=k||{};if(v.title!==void 0||v.description!==void 0)E({title:v.title,description:v.description})}function A(k){if(!k||typeof k!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,k),Z.__stxClientPayload=v}let M=()=>{let k=Z.__stxServeContext,v=Z.__stxServeSearch??k?.search??"",m=k?.path??"",h=Object.fromEntries(new URLSearchParams(v)),r=Z.query,G0=Object.keys(h).length>0?h:r??{},r0=v||(Object.keys(G0).length>0?`?${new URLSearchParams(G0).toString()}`:"");return{params:Z.params??{},query:G0,path:m,name:"",fullPath:m+r0,hash:"",matched:[]}},T=()=>({push:(k)=>{},replace:(k)=>{},back:()=>{},forward:()=>{},go:(k)=>{}}),I=(k)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=A5(v,k||{})},E=(k)=>{I($4(k||{}))},D=(k)=>({value:k}),y=(k)=>k,S=(k)=>({value:typeof k==="function"?k():k}),P=(k,v)=>{},C=(k)=>{},x=(k)=>{},f=(k)=>k?k():Promise.resolve(),d=(k)=>(v,...m)=>{},$0=(k)=>{},P0=(k,v)=>{},B0=(k,v)=>v,N0=()=>({value:"light"}),u=()=>O(!1),a=(k)=>O(!1),R0=()=>O(!1),C0=()=>a("(prefers-color-scheme: dark)"),U5=()=>a("(prefers-color-scheme: light)"),j5=()=>a("(prefers-reduced-motion: reduce)"),n=()=>a("(prefers-contrast: more)"),s={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:{}},z0=new Proxy(s,{get(k,v){if(v in k)return k[v];return},set(k,v,m){return k[v]=m,!0}}),D0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},K0=console;try{let k=_3(X,J),v=new Set(Object.keys(U)),m=(i)=>/^[a-z_$][\w$]*$/i.test(i),h=Object.keys(Z).filter((i)=>!v.has(i)&&i!=="props"&&m(i)),r=h.map((i)=>Z[i]),G0=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"]),r0=[],f0=[];for(let[i,G1]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(G0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(k))continue;r0.push(i),f0.push(G1)}let a0=Bq(k).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
|
|
902
902
|
`),B5=Z.params??{},M1=[],T1=[];for(let i=0;i<h.length;i++){if(h[i]==="params")continue;M1.push(h[i]),T1.push(r[i])}let Q1=await Function("module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...r0,...M1,`return (async () => {
|
|
903
903
|
${k}
|
|
904
904
|
${a0}
|
|
905
905
|
return module.exports
|
|
906
|
-
})()`)(Q,G,z,U,j,H,_,A,O,V,F,L,w,N,R,M,T,I,E,D,y,S,P,C,x,f,d,$0,B,P0,B0,N0,u,a,R0,C0,U5,j5,n,z0,D0,K0,s.confirm,s.alert,s.fetch,B5,...f0,...T1);if(Y.preserveExisting){for(let[i,G1]of Object.entries(Q1))if(!(i in Z)||Z[i]===void 0)Z[i]=G1}else Object.assign(Z,Q1);for(let[i,G1]of Object.entries(U))if(!(i in Z))Z[i]=G1}catch(k){let v=k instanceof Error?k.message:String(k);if(
|
|
906
|
+
})()`)(Q,G,z,U,j,H,_,A,O,V,F,L,w,N,R,M,T,I,E,D,y,S,P,C,x,f,d,$0,B,P0,B0,N0,u,a,R0,C0,U5,j5,n,z0,D0,K0,s.confirm,s.alert,s.fetch,B5,...f0,...T1);if(Y.preserveExisting){for(let[i,G1]of Object.entries(Q1))if(!(i in Z)||Z[i]===void 0)Z[i]=G1}else Object.assign(Z,Q1);for(let[i,G1]of Object.entries(U))if(!(i in Z))Z[i]=G1}catch(k){let v=k instanceof Error?k.message:String(k);if(hZ(v))console.warn(`[stx] server <script> in ${J??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(uZ(v))console.warn(`[stx] server <script> in ${J??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(M5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${J??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await Vq(X,Z,J)}catch(m){if(M5.env.STX_DEBUG){let h=m instanceof Error?m.message:String(m);console.warn(`[stx] fallback extraction also failed in ${J??"<unknown>"}: ${h}`)}}}}function mZ($){let Z=0,J=null,Y=!1,X=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G===J){if(J=null,Y||Z===0)X=!0}continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)Y=!0}return J===null&&Z===0&&X}function _3($,Z){let J=Z?y1.dirname(Z):M5.cwd(),Y=M5.cwd(),X=$.split(`
|
|
907
907
|
`),Q=[],G=0;while(G<X.length){let K=X[G].trim();if(K.startsWith("interface ")||K.startsWith("export interface ")||K.startsWith("type ")||K.startsWith("export type ")){if(K.includes("{")&&!K.includes("}")){let W=0;for(;G<X.length;G++){for(let q of X[G])if(q==="{")W++;else if(q==="}")W--;if(W<=0)break}}G++;continue}if(K.startsWith("definePageMeta(")){let W=0,q=!1,z=G;for(let H=G;H<X.length&&!q;H++){let B=null,_=!1,O=X[H];for(let V=0;V<O.length;V++){let F=O[V];if(_){_=!1;continue}if(F==="\\"){_=!0;continue}if(B){if(F===B)B=null;continue}if(F==='"'||F==="'"||F==="`"){B=F;continue}if(F==="(")W++;else if(F===")"){if(W--,W===0){G=H+1,q=!0;break}}}}if(!q)G=X.length;let U=X.slice(z,G).join(`
|
|
908
|
-
`),j=[];for(let H of["title","description"]){let B=new RegExp(`\\b${H}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(B)j.push(`${H}: ${JSON.stringify(B[2])}`)}if(j.length>0)Q.push(`useSeoMeta({ ${j.join(", ")} });`);continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let W=K,q=0;while(!
|
|
909
|
-
`+H;if(U<=0&&j>=G)break}Q.push(z),Q.push(`module.exports.${q} = ${q};`),G=j+1}else Q.push(K),G++}else if(K.includes("module.exports"))Q.push(K),G++;else if(K.trim()&&!K.startsWith("//"))Q.push(K),G++;else G++}return
|
|
910
|
-
`),J,Y)}function
|
|
911
|
-
`)K=!1;Q++;continue}if(W){if(X+=z,z==="*"&&U==="/"){X+=U,Q+=2,W=!1;continue}Q++;continue}if(!G&&z==="/"&&U==="/"){K=!0,X+=z,Q++;continue}if(!G&&z==="/"&&U==="*"){W=!0,X+=z,Q++;continue}if(G){if(X+=z,z==="\\"){X+=U,Q+=2;continue}if(z===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(z==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(z==="`"){G=null,Q++;continue}}Q++;continue}if(q>0){if(z==="{")q++;else if(z==="}")q--}if(z==='"'||z==="'"||z==="`"){G=z,X+=z,Q++;continue}if(z==="a"&&$.startsWith("await",Q)){let j=
|
|
908
|
+
`),j=[];for(let H of["title","description"]){let B=new RegExp(`\\b${H}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(B)j.push(`${H}: ${JSON.stringify(B[2])}`)}if(j.length>0)Q.push(`useSeoMeta({ ${j.join(", ")} });`);continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let W=K,q=0;while(!mZ(W)&&G+q+1<X.length)q++,W=`${W} ${X[G+q].trim()}`;G+=q;let z=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),j=W.match(/^import\s+['"](.+?)['"]/),H=W,B=(_)=>{if(_.startsWith("."))return y1.resolve(J,_);if(_.startsWith("~/")||_.startsWith("@/"))return y1.resolve(Y,_.slice(2));return _};if(z){let[,_,O]=z,V=B(O);Q.push(`const ${_} = await import('${V}')`),Q.push(`module.exports.${_} = ${_};`)}else if(U){let[,_,O]=U,V=B(O),F=[],L=[];for(let w of _.split(",")){let N=w.trim();if(!N)continue;let R=N.split(/\s+as\s+/);if(R.length===2){let[A,M]=[R[0].trim(),R[1].trim()];F.push(`${A}: ${M}`),L.push(M)}else F.push(N),L.push(N)}Q.push(`const { ${F.join(", ")} } = await import('${V}')`);for(let w of L)Q.push(`module.exports.${w} = ${w};`)}else if(j){let _=B(j[1]);Q.push(`await import('${_}')`)}else Q.push(H);G++;continue}if((K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")||K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var "))&&!K.includes("="))Q.push(X[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let W=CZ(X,G),{type:q,name:z,value:U}=W;Q.push(`${q} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=W.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let W=H3(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let W=CZ(X,G),{type:q,name:z,value:U}=W;Q.push(`${q} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=W.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let W=H3(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let W=X[G].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[G]=W;let z=H3(q,G);if(Q.push(z.functionCode),z.name)Q.push(`module.exports.default = ${z.name};`);G=z.nextIndex}else if(K.startsWith("export default ")){let W=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${W};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let W=K.match(/(?:export\s+)?class\s+(\w+)/);if(W){let q=W[1],z=X[G].replace(/^export\s+/,""),U=0,j=G;for(;j<X.length;j++){let H=X[j];for(let B of H)if(B==="{")U++;else if(B==="}")U--;if(j>G)z+=`
|
|
909
|
+
`+H;if(U<=0&&j>=G)break}Q.push(z),Q.push(`module.exports.${q} = ${q};`),G=j+1}else Q.push(K),G++}else if(K.includes("module.exports"))Q.push(K),G++;else if(K.trim()&&!K.startsWith("//"))Q.push(K),G++;else G++}return Hq(Q.join(`
|
|
910
|
+
`),J,Y)}function Hq($,Z,J){let Y=$.length,X="",Q=0,G=null,K=!1,W=!1,q=0;while(Q<Y){let z=$[Q],U=$[Q+1];if(K){if(X+=z,z===`
|
|
911
|
+
`)K=!1;Q++;continue}if(W){if(X+=z,z==="*"&&U==="/"){X+=U,Q+=2,W=!1;continue}Q++;continue}if(!G&&z==="/"&&U==="/"){K=!0,X+=z,Q++;continue}if(!G&&z==="/"&&U==="*"){W=!0,X+=z,Q++;continue}if(G){if(X+=z,z==="\\"){X+=U,Q+=2;continue}if(z===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(z==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(z==="`"){G=null,Q++;continue}}Q++;continue}if(q>0){if(z==="{")q++;else if(z==="}")q--}if(z==='"'||z==="'"||z==="`"){G=z,X+=z,Q++;continue}if(z==="a"&&$.startsWith("await",Q)){let j=_q($,Q);if(j){let{quote:H,path:B,end:_}=j;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let O=B.startsWith(".")?y1.resolve(Z,B):y1.resolve(J,B.slice(2));X+=`await import(${H}${O}${H})`,Q=_;continue}}}X+=z,Q++}return X}function _q($,Z){let J=Z+5;if(J>=$.length)return null;if(!/\s/.test($[J]))return null;while(J<$.length&&/\s/.test($[J]))J++;if(!$.startsWith("import",J))return null;J+=6;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;J++;while(J<$.length&&/\s/.test($[J]))J++;let Y=$[J];if(Y!=="'"&&Y!=='"')return null;J++;let X=J;while(J<$.length&&$[J]!==Y)if($[J]==="\\")J+=2;else J++;if(J>=$.length)return null;let Q=$.slice(X,J);J++;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!==")")return null;return{quote:Y,path:Q,end:J+1}}function dZ($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let X=k0($,J,J==="{"?"}":"]",Z);if(X===-1)return null;return{pattern:$.slice(Z,X+1),endPos:X+1}}function pZ($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let Y=0,X=0,Q="";while(Y<J.length){let G=J[Y];if(G==="{"||G==="["){if(X++,X===1){let K=dZ(J,Y);if(K){let W=pZ(K.pattern);Z.push(...W),Y=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")X--;if(X>0){Y++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",Y++;continue}if(G===":"){Q="",Y++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",Y++;while(Y<J.length&&J[Y]!==","&&X===0){if(J[Y]==="{"||J[Y]==="[")X++;else if(J[Y]==="}"||J[Y]==="]")X--;Y++}continue}if(/[\w$]/.test(G))Q+=G;Y++}if(Q.trim())Z.push(Q.trim());return Z}function lZ($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let J=Z[0].length,Y=(X)=>X===" "||X==="\t";while(J<$.length&&Y($[J]))J++;if($[J]===":"){let X=0,Q=null;J++;for(;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){X++;continue}if(G===")"||G==="]"||G==="}"||G===">"){X--;continue}if(G==="="&&X<=0){let K=$[J+1],W=$[J-1];if(K!=="="&&K!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if($[J]!=="=")return null}while(J<$.length&&Y($[J]))J++;if($[J]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(J+1).trim()}}function CZ($,Z){let J=$[Z].trim(),Y=lZ(J),X=Y?[J,Y.type,Y.name,Y.value]:null;if(!X){let z=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(z){let U=J.slice(z[0].length),j=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let B=U.startsWith("{")?"}":"]",_=U;for(let O=Z+1;O<$.length;O++)if(_+=" "+$[O].trim(),j=O,$[O].includes(B))break;U=_}let H=dZ(U,0);if(H){let B=z[1],_=H.pattern,O=U.slice(H.endPos).trim();if(O.startsWith("=")){let V=O.slice(1).trim(),F=V,L=Math.max(j,Z);if(vZ(V)){let A=xZ($,L,V);F=A.value,L=A.nextIndex}else L=L+1;F=F.trim().replace(/;$/,"");let w=pZ(_),N=`__stx_src_${Z}`,R=w.map((A)=>`module.exports.${A} = ${A};`).join(`
|
|
912
912
|
`);return{type:B,name:N,value:`${F}; ${B} ${_} = ${N};
|
|
913
|
-
${R}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,G,K]=X,W=K,q=Z;if(
|
|
914
|
-
${$[q]}`,q++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:q}}function H3($,Z){let J=$[Z].trim(),Y=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${J}`);let[,X]=Y,Q=J.replace(/^export\s+/,""),G=Z;if(
|
|
913
|
+
${R}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,G,K]=X,W=K,q=Z;if(vZ(K)){let z=xZ($,Z,K);W=z.value,q=z.nextIndex}else q=Z+1;while(q<$.length){let z=$[q].trim();if(z.startsWith(".")||z.startsWith("?."))W+=`
|
|
914
|
+
${$[q]}`,q++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:q}}function H3($,Z){let J=$[Z].trim(),Y=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${J}`);let[,X]=Y,Q=J.replace(/^export\s+/,""),G=Z;if(Oq(J)){let K=Fq($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function vZ($){let Z=$.trim();if(Z.startsWith("{"))return k0(Z,"{","}",0)===-1;if(Z.startsWith("["))return k0(Z,"[","]",0)===-1;return!cZ(Z)}function cZ($){let Z={paren:0,bracket:0,brace:0},J=null,Y=0;for(let X=0;X<$.length;X++){let Q=$[X];if((X>0?$[X-1]:"")==="\\"&&J)continue;if((Q==='"'||Q==="'")&&!J){J=Q;continue}if(Q===J&&J!=="`"){J=null;continue}if(Q==="`"&&!J){J="`";continue}if(Q==="`"&&J==="`"&&Y===0){J=null;continue}if(J==="`"&&Q==="$"&&$[X+1]==="{"){Y++,X++;continue}if(Y>0&&Q==="{"){Y++;continue}if(Y>0&&Q==="}"){Y--;continue}if(J)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function iZ($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let J=k0($,"(",")",Z);if(J===-1)return-1;return $.indexOf("{",J)}function Oq($){let Z=iZ($);if(Z===-1)return!0;return k0($,"{","}",Z)===-1}function xZ($,Z,J){let Y=J,X=Z+1;while(X<$.length&&!cZ(Y)){let Q=$[X];Y+=`
|
|
915
915
|
${Q}`,X++}while(X<$.length){let Q=$[X].trim();if(Q.startsWith(".")||Q.startsWith("?."))Y+=`
|
|
916
|
-
${$[X]}`,X++;else break}return{value:Y,nextIndex:X}}function
|
|
917
|
-
${G}`,X++}return{functionCode:Y,nextIndex:X}}function xZ($,Z){let J=Y0($,Z)??Y0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let Y={...Z,process:Object.freeze({env:{...M5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${$});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${$};`)(...Object.values(Y))}catch{return}}}async function Fq($,Z,J){let Y=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of Y){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),q=xZ(W,Z);if(q!==void 0)Z[G]=q}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),q=xZ(W,Z);if(q!==void 0)Z[G]=q}catch{}}}function iZ($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",Y=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:Y}}function nZ($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var j$=b(()=>{U$();D1();M0()});var O3={};t(O3,{renderSlot:()=>sZ,processSlots:()=>aZ,parseSlots:()=>oZ,parseSlotElement:()=>Rq,extractSlotContent:()=>Tq,applySlots:()=>Iq});function Vq($,Z){let J=1,Y=Z,X="<template",Q="</template";while(Y<$.length&&J>0){let G=$.indexOf("<",Y);if(G===-1)break;if(Y=G,$.startsWith(X,Y)&&(Y+X.length>=$.length||/[\s>\/]/.test($[Y+X.length]))){J++,Y+=X.length;continue}if($.startsWith(Q,Y)){let K=$.indexOf(">",Y+Q.length);if(K!==-1){if(J--,J===0)return K+1;Y=K+1;continue}}Y++}return J===0?Y:-1}function wq($,Z){let J=null;for(let Y=Z;Y<$.length;Y++){let X=$[Y];if(J){if(X==="\\"){Y++;continue}if(X===J)J=null;continue}if(X==='"'||X==="'"){J=X;continue}if(X===">")return Y+1}return-1}function Nq($){let Z=[],J=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=wq($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){X=G;continue}let q=W[1]==="/",z=W[2].toLowerCase();if(q){let j=J.lastIndexOf(z);if(j!==-1)J.splice(j);X=G;continue}if(z==="template"&&J.length===0){let j=K.match(Y);if(j){let H=Vq($,G);if(H!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:H,slotName:B,content:$.slice(G,H-11).trim(),propsBinding:j[4]||void 0}),X=H;continue}}}if(!/\/\s*>$/.test(K)&&!Lq.has(z)){if(J.push(z),z==="script"||z==="style"){let j=$.toLowerCase().indexOf(`</${z}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function oZ($){let Z={default:"",named:new Map},J=$,Y=Nq($);for(let W of Y)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});Y.sort((W,q)=>q.start-W.start);for(let W of Y)J=J.slice(0,W.start)+J.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(J))!==null){let[W,q,z,U,j,H]=G,B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(B+_).trim(),V=`<${q}${O?" "+O:""}>${H}</${q}>`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:V})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(J))!==null){let[W,q,z,U,j]=G,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(H+B).trim(),O=`<${q}${_?" "+_:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:O})}X.sort((W,q)=>q.start-W.start);for(let W of X){let q=Z.named.get(W.slotName);if(q)q.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});J=J.slice(0,W.start)+J.slice(W.end)}return Z.default=J.trim(),Z}function Rq($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),J=Z?Z[1]:"",Y={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)Y[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:J,props:Y,defaultContent:K}}async function sZ($,Z,J,Y){if(!$)return J;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...Y};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[q,z]=W.split(":").map((j)=>j.trim()),U=z||q;if(Z[q]!==void 0)G[U]=Z[q]}}else G[Q]=Z;X=Aq(X,G)}return X}function Aq($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(J,Y)=>{try{let X=Y.trim(),Q=rZ(X,Z);return t0(String(Q??""))}catch{return`{{ ${Y} }}`}})}function rZ($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let Y=$.split("."),X=Z;for(let Q of Y)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let J=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(J){let[,Y,X,Q]=J,G=Z[Y],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!W0($))return;return q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function aZ($,Z,J){let Y=$;Y=await Mq(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,q)=>{let z=Z.named.get(K),U=q?.trim()||"",j=W||"",H={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(j))!==null){let O=_[1],V=_[2];H[O]=rZ(V,J)}return await sZ(z,H,U,J)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),Y}async function Mq($,Z,J){let Y=[],X=[];$.replace(Z,(K,...W)=>{let q=W[W.length-2];return X.push({match:K,index:q}),Y.push(J(K,...W.slice(0,-2))),K});let Q=await Promise.all(Y),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:q}=X[K];G=G.slice(0,q)+Q[K]+G.slice(q+W.length)}return G}function Tq($){let Z=oZ($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function Iq($,Z,J,Y){return await aZ($,{default:Z,named:J},Y)}var Lq;var F3=b(()=>{q1();M0();Lq=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function P1($,Z){let J=Dq($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function Dq($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let Y=k0($,"(",")",J);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,Y),endPos:Y+1}}function kq($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function a1($,Z,J,Y){let X=1,Q=Y,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),q=K.exec($),z=W?W.index:1/0,U=q?q.index:1/0;if(z<U)X++,Q=z+W[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+q[0].length}else break}return-1}function tZ($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let Y=Z+J[0].length,X=P1($,Y);if(!X)return null;let Q=X.endPos,G=a1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,z="if",U=X.expression,j=0,H=0;while(q<K.length){let B=K.indexOf("@",q);if(B===-1)break;q=B;let _=K.substring(B);if(kq(K,B)){q++;continue}if(/^@if\s*\(/.test(_)){H++,q++;continue}if(/^@endif(?![a-z])/.test(_)){H--,q+=6;continue}if(H===0){let O=_.match(/^@elseif\s*/);if(O){W.push({type:z,condition:U,content:K.substring(j,q),start:Q+j,end:Q+q});let V=q+O[0].length,F=P1(K,V);if(!F){q++;continue}z="elseif",U=F.expression,q=F.endPos,j=q;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:z,condition:U,content:K.substring(j,q),start:Q+j,end:Q+q}),z="else",U=void 0,q+=5,j=q;continue}}q++}return W.push({type:z,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function B$($){let Z=[],J=/@if\s*\(/g,Y=J.exec($);while(Y!==null){if(Z.some((G)=>Y.index>G.start&&Y.index<G.end)){Y=J.exec($);continue}let Q=tZ($,Y.index);if(Q)Z.push(Q),J.lastIndex=Q.end;Y=J.exec($)}return Z}function J4($,Z,J){let Y=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(Y.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,q=k0($,"(",")",W);if(q===-1){Q=X.exec($);continue}let z=$.slice(W+1,q),U=q+1,j=a1($,Z,J,U);if(j===-1){Q=X.exec($);continue}let H=$.slice(U,j),B=j+`@${J}`.length;Y.push({fullMatch:$.slice(K,B),name:Z,params:z,content:H,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return Y}function V3($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let Y=Z+J[0].length,X=P1($,Y);if(!X)return null;let Q=X.endPos,G=a1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,z=null,U=0;while(q<K.length){let j=K.slice(q),H=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(H){if(U++,z)z.content+=H[0];q+=H[0].length;continue}if(B){if(U--,z)z.content+=B[0];q+=B[0].length;continue}if(U>0){if(z)z.content+=K[q];q++;continue}let _=j.match(/^@case\s*/),O=j.match(/^@default(?![a-z])/),V=j.match(/^@break(?![a-z])/);if(_&&j.startsWith("@case")){if(z)W.push(z);let F=q+_[0].length,L=P1(K,F);if(!L){q++;continue}z={type:"case",value:L.expression,content:""},q=L.endPos}else if(O&&j.startsWith("@default")){if(z)W.push(z);z={type:"default",content:""},q+=O[0].length}else if(V&&j.startsWith("@break"))q+=V[0].length;else{if(z)z.content+=K[q];q++}}if(z)W.push(z);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var eZ=()=>{};var $2=()=>{};var Y4=b(()=>{eZ();$2()});async function J2($){let Z=$;if(!Z)try{Z=(await e0())?.pagesDir||"pages"}catch{Z="pages"}let J=Z,Y=Z2.get(J);if(Y)return Y;let X=[];try{X=i5(".",{pagesDir:J}).map((Q)=>Q.regex.source).filter(Boolean)}catch{X=[]}return Z2.set(J,X),X}var Z2;var Y2=b(()=>{u7();V1();Z2=new Map});function yq($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function X2($){return yq(JSON.stringify($))}function X4($){let Z=0;while(Z<$.length){let J=$.slice(Z),Y=/<body\b([^>]*)>/i.exec(J);if(!Y)return null;let X=Z+Y.index,Q=-1,G="";for(let W of Pq){let q=W.open.exec(J);if(!q)continue;let z=Z+q.index;if(z<X&&(Q===-1||z<Q))Q=z,G=W.close}if(Q===-1)return{index:X,tag:Y[0],attrs:Y[1]??""};let K=$.toLowerCase().indexOf(G,Q);if(K===-1)return null;Z=K+G.length}return null}function L3($,Z){let J=X4($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var Pq;var w3=b(()=>{Pq=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function C1($){let Z=$,J=new Set,Y=new Set,X=()=>{if(p0)Y.add(p0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,J.forEach((K)=>K(Z,G)),H$)Y.forEach((K)=>G4.add(K));else Y.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return J.add(Q),()=>J.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function W4($){let Z,J=!0,Y=new Set,X=()=>{if(!J)if(J=!0,H$)Y.forEach((G)=>G4.add(G));else Y.forEach((G)=>G())},Q=()=>{if(p0)Y.add(p0);if(J){let G=p0;p0=X,Q4.push(X);try{Z=$()}finally{Q4.pop(),p0=G}J=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function q4($,Z={}){let J,Y=!1,X=()=>{if(Y)return;if(J)J(),J=void 0;let Q=p0;p0=X,Q4.push(X);try{let G=$();J=typeof G==="function"?G:void 0}finally{Q4.pop(),p0=Q}};if(Z.immediate!==!1)X();return()=>{if(Y=!0,J)J()}}function R3($){if(H$){$();return}H$=!0;try{$()}finally{H$=!1,G4.forEach((Z)=>Z()),G4.clear()}}function A3($){N3.push($)}function M3($){K4.push($)}function Cq(){Q2(N3,"onMount",K4)}function vq(){Q2(K4,"onDestroy")}function Q2($,Z,J){let Y=$.splice(0,$.length);for(let X of Y)try{let Q=X();if(J&&typeof Q==="function")J.push(Q)}catch(Q){console.error(`[stx] ${Z} callback threw:`,Q)}}function xq(){return{mount:N3.length,destroy:K4.length}}function z4($){return typeof $==="function"&&$._isSignal===!0}function U4($){return typeof $==="function"&&$._isDerived===!0}function T3($){if(z4($)||U4($))return $();return $}function j4($){let Z=p0;p0=null;try{return $()}finally{p0=Z}}function fq($,Z){let J=typeof $==="function"?$:()=>$,Y=C1([]),X=W4(()=>Y().reduce((K,W)=>Z(K,W.action),J())),Q=!1;return q4(()=>{if(J(),!Q){Q=!0;return}if(j4(()=>Y().length))Y.set([])}),[X,(K,W)=>{let q={action:K};Y.set([...Y(),q]);let z=()=>{let U=Y().filter((j)=>j!==q);if(U.length!==Y().length)Y.set(U)};if(W&&typeof W.then==="function")Promise.resolve(W).then(z,z);return z}]}var p0=null,Q4,H$=!1,G4,N3,K4;var B4=b(()=>{Q4=[],G4=new Set,N3=[],K4=[]});var K2={};t(K2,{useOptimistic:()=>fq,untrack:()=>T3,state:()=>C1,runMountCallbacks:()=>Cq,runDestroyCallbacks:()=>vq,pendingLifecycleCounts:()=>xq,peek:()=>j4,onMount:()=>A3,onDestroy:()=>M3,isSignal:()=>z4,isDerived:()=>U4,generateSignalsRuntimeDev:()=>I3,generateSignalsRuntime:()=>G2,effect:()=>q4,derived:()=>W4,default:()=>hq,batch:()=>R3});function G2(){let $=gq(I3());try{let J=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return J=J.replace(/\}(var |let |const |function )/g,"};$1"),J}catch{return $}}function gq($){let Z=[],J=0,Y="console.log(";while(J<$.length){let X=$.indexOf(Y,J);if(X===-1){Z.push($.slice(J));break}Z.push($.slice(J,X));let Q=1,G=X+Y.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),J=G}return Z.join("")}function I3(){return`
|
|
916
|
+
${$[X]}`,X++;else break}return{value:Y,nextIndex:X}}function Fq($,Z,J){let Y=J,X=Z+1;while(X<$.length){let Q=iZ(Y);if(Q!==-1){if(k0(Y,"{","}",Q)!==-1)break}let G=$[X];Y+=`
|
|
917
|
+
${G}`,X++}return{functionCode:Y,nextIndex:X}}function fZ($,Z){let J=Y0($,Z)??Y0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let Y={...Z,process:Object.freeze({env:{...M5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${$});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${$};`)(...Object.values(Y))}catch{return}}}async function Vq($,Z,J){let Y=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of Y){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),q=fZ(W,Z);if(q!==void 0)Z[G]=q}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),q=fZ(W,Z);if(q!==void 0)Z[G]=q}catch{}}}function nZ($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",Y=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:Y}}function oZ($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var j$=b(()=>{U$();D1();M0()});var O3={};t(O3,{renderSlot:()=>rZ,processSlots:()=>tZ,parseSlots:()=>sZ,parseSlotElement:()=>Aq,extractSlotContent:()=>Iq,applySlots:()=>Dq});function Lq($,Z){let J=1,Y=Z,X="<template",Q="</template";while(Y<$.length&&J>0){let G=$.indexOf("<",Y);if(G===-1)break;if(Y=G,$.startsWith(X,Y)&&(Y+X.length>=$.length||/[\s>\/]/.test($[Y+X.length]))){J++,Y+=X.length;continue}if($.startsWith(Q,Y)){let K=$.indexOf(">",Y+Q.length);if(K!==-1){if(J--,J===0)return K+1;Y=K+1;continue}}Y++}return J===0?Y:-1}function Nq($,Z){let J=null;for(let Y=Z;Y<$.length;Y++){let X=$[Y];if(J){if(X==="\\"){Y++;continue}if(X===J)J=null;continue}if(X==='"'||X==="'"){J=X;continue}if(X===">")return Y+1}return-1}function Rq($){let Z=[],J=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=Nq($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){X=G;continue}let q=W[1]==="/",z=W[2].toLowerCase();if(q){let j=J.lastIndexOf(z);if(j!==-1)J.splice(j);X=G;continue}if(z==="template"&&J.length===0){let j=K.match(Y);if(j){let H=Lq($,G);if(H!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:H,slotName:B,content:$.slice(G,H-11).trim(),propsBinding:j[4]||void 0}),X=H;continue}}}if(!/\/\s*>$/.test(K)&&!wq.has(z)){if(J.push(z),z==="script"||z==="style"){let j=$.toLowerCase().indexOf(`</${z}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function sZ($){let Z={default:"",named:new Map},J=$,Y=Rq($);for(let W of Y)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});Y.sort((W,q)=>q.start-W.start);for(let W of Y)J=J.slice(0,W.start)+J.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(J))!==null){let[W,q,z,U,j,H]=G,B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(B+_).trim(),V=`<${q}${O?" "+O:""}>${H}</${q}>`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:V})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(J))!==null){let[W,q,z,U,j]=G,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(H+B).trim(),O=`<${q}${_?" "+_:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:O})}X.sort((W,q)=>q.start-W.start);for(let W of X){let q=Z.named.get(W.slotName);if(q)q.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});J=J.slice(0,W.start)+J.slice(W.end)}return Z.default=J.trim(),Z}function Aq($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),J=Z?Z[1]:"",Y={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)Y[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:J,props:Y,defaultContent:K}}async function rZ($,Z,J,Y){if(!$)return J;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...Y};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[q,z]=W.split(":").map((j)=>j.trim()),U=z||q;if(Z[q]!==void 0)G[U]=Z[q]}}else G[Q]=Z;X=Mq(X,G)}return X}function Mq($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(J,Y)=>{try{let X=Y.trim(),Q=aZ(X,Z);return t0(String(Q??""))}catch{return`{{ ${Y} }}`}})}function aZ($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let Y=$.split("."),X=Z;for(let Q of Y)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let J=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(J){let[,Y,X,Q]=J,G=Z[Y],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!W0($))return;return q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function tZ($,Z,J){let Y=$;Y=await Tq(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,q)=>{let z=Z.named.get(K),U=q?.trim()||"",j=W||"",H={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(j))!==null){let O=_[1],V=_[2];H[O]=aZ(V,J)}return await rZ(z,H,U,J)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),Y}async function Tq($,Z,J){let Y=[],X=[];$.replace(Z,(K,...W)=>{let q=W[W.length-2];return X.push({match:K,index:q}),Y.push(J(K,...W.slice(0,-2))),K});let Q=await Promise.all(Y),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:q}=X[K];G=G.slice(0,q)+Q[K]+G.slice(q+W.length)}return G}function Iq($){let Z=sZ($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function Dq($,Z,J,Y){return await tZ($,{default:Z,named:J},Y)}var wq;var F3=b(()=>{q1();M0();wq=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function P1($,Z){let J=kq($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function kq($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let Y=k0($,"(",")",J);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,Y),endPos:Y+1}}function Eq($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function a1($,Z,J,Y){let X=1,Q=Y,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),q=K.exec($),z=W?W.index:1/0,U=q?q.index:1/0;if(z<U)X++,Q=z+W[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+q[0].length}else break}return-1}function eZ($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let Y=Z+J[0].length,X=P1($,Y);if(!X)return null;let Q=X.endPos,G=a1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,z="if",U=X.expression,j=0,H=0;while(q<K.length){let B=K.indexOf("@",q);if(B===-1)break;q=B;let _=K.substring(B);if(Eq(K,B)){q++;continue}if(/^@if\s*\(/.test(_)){H++,q++;continue}if(/^@endif(?![a-z])/.test(_)){H--,q+=6;continue}if(H===0){let O=_.match(/^@elseif\s*/);if(O){W.push({type:z,condition:U,content:K.substring(j,q),start:Q+j,end:Q+q});let V=q+O[0].length,F=P1(K,V);if(!F){q++;continue}z="elseif",U=F.expression,q=F.endPos,j=q;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:z,condition:U,content:K.substring(j,q),start:Q+j,end:Q+q}),z="else",U=void 0,q+=5,j=q;continue}}q++}return W.push({type:z,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function B$($){let Z=[],J=/@if\s*\(/g,Y=J.exec($);while(Y!==null){if(Z.some((G)=>Y.index>G.start&&Y.index<G.end)){Y=J.exec($);continue}let Q=eZ($,Y.index);if(Q)Z.push(Q),J.lastIndex=Q.end;Y=J.exec($)}return Z}function J4($,Z,J){let Y=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(Y.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,q=k0($,"(",")",W);if(q===-1){Q=X.exec($);continue}let z=$.slice(W+1,q),U=q+1,j=a1($,Z,J,U);if(j===-1){Q=X.exec($);continue}let H=$.slice(U,j),B=j+`@${J}`.length;Y.push({fullMatch:$.slice(K,B),name:Z,params:z,content:H,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return Y}function V3($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let Y=Z+J[0].length,X=P1($,Y);if(!X)return null;let Q=X.endPos,G=a1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,z=null,U=0;while(q<K.length){let j=K.slice(q),H=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(H){if(U++,z)z.content+=H[0];q+=H[0].length;continue}if(B){if(U--,z)z.content+=B[0];q+=B[0].length;continue}if(U>0){if(z)z.content+=K[q];q++;continue}let _=j.match(/^@case\s*/),O=j.match(/^@default(?![a-z])/),V=j.match(/^@break(?![a-z])/);if(_&&j.startsWith("@case")){if(z)W.push(z);let F=q+_[0].length,L=P1(K,F);if(!L){q++;continue}z={type:"case",value:L.expression,content:""},q=L.endPos}else if(O&&j.startsWith("@default")){if(z)W.push(z);z={type:"default",content:""},q+=O[0].length}else if(V&&j.startsWith("@break"))q+=V[0].length;else{if(z)z.content+=K[q];q++}}if(z)W.push(z);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var $2=()=>{};var Z2=()=>{};var Y4=b(()=>{$2();Z2()});async function Y2($){let Z=$;if(!Z)try{Z=(await e0())?.pagesDir||"pages"}catch{Z="pages"}let J=Z,Y=J2.get(J);if(Y)return Y;let X=[];try{X=i5(".",{pagesDir:J}).map((Q)=>Q.regex.source).filter(Boolean)}catch{X=[]}return J2.set(J,X),X}var J2;var X2=b(()=>{u7();V1();J2=new Map});function Pq($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Q2($){return Pq(JSON.stringify($))}function X4($){let Z=0;while(Z<$.length){let J=$.slice(Z),Y=/<body\b([^>]*)>/i.exec(J);if(!Y)return null;let X=Z+Y.index,Q=-1,G="";for(let W of Cq){let q=W.open.exec(J);if(!q)continue;let z=Z+q.index;if(z<X&&(Q===-1||z<Q))Q=z,G=W.close}if(Q===-1)return{index:X,tag:Y[0],attrs:Y[1]??""};let K=$.toLowerCase().indexOf(G,Q);if(K===-1)return null;Z=K+G.length}return null}function L3($,Z){let J=X4($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var Cq;var w3=b(()=>{Cq=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function C1($){let Z=$,J=new Set,Y=new Set,X=()=>{if(l0)Y.add(l0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,J.forEach((K)=>K(Z,G)),H$)Y.forEach((K)=>G4.add(K));else Y.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return J.add(Q),()=>J.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function W4($){let Z,J=!0,Y=new Set,X=()=>{if(!J)if(J=!0,H$)Y.forEach((G)=>G4.add(G));else Y.forEach((G)=>G())},Q=()=>{if(l0)Y.add(l0);if(J){let G=l0;l0=X,Q4.push(X);try{Z=$()}finally{Q4.pop(),l0=G}J=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function q4($,Z={}){let J,Y=!1,X=()=>{if(Y)return;if(J)J(),J=void 0;let Q=l0;l0=X,Q4.push(X);try{let G=$();J=typeof G==="function"?G:void 0}finally{Q4.pop(),l0=Q}};if(Z.immediate!==!1)X();return()=>{if(Y=!0,J)J()}}function R3($){if(H$){$();return}H$=!0;try{$()}finally{H$=!1,G4.forEach((Z)=>Z()),G4.clear()}}function A3($){N3.push($)}function M3($){K4.push($)}function vq(){G2(N3,"onMount",K4)}function xq(){G2(K4,"onDestroy")}function G2($,Z,J){let Y=$.splice(0,$.length);for(let X of Y)try{let Q=X();if(J&&typeof Q==="function")J.push(Q)}catch(Q){console.error(`[stx] ${Z} callback threw:`,Q)}}function fq(){return{mount:N3.length,destroy:K4.length}}function z4($){return typeof $==="function"&&$._isSignal===!0}function U4($){return typeof $==="function"&&$._isDerived===!0}function T3($){if(z4($)||U4($))return $();return $}function j4($){let Z=l0;l0=null;try{return $()}finally{l0=Z}}function gq($,Z){let J=typeof $==="function"?$:()=>$,Y=C1([]),X=W4(()=>Y().reduce((K,W)=>Z(K,W.action),J())),Q=!1;return q4(()=>{if(J(),!Q){Q=!0;return}if(j4(()=>Y().length))Y.set([])}),[X,(K,W)=>{let q={action:K};Y.set([...Y(),q]);let z=()=>{let U=Y().filter((j)=>j!==q);if(U.length!==Y().length)Y.set(U)};if(W&&typeof W.then==="function")Promise.resolve(W).then(z,z);return z}]}var l0=null,Q4,H$=!1,G4,N3,K4;var B4=b(()=>{Q4=[],G4=new Set,N3=[],K4=[]});var W2={};t(W2,{useOptimistic:()=>gq,untrack:()=>T3,state:()=>C1,runMountCallbacks:()=>vq,runDestroyCallbacks:()=>xq,pendingLifecycleCounts:()=>fq,peek:()=>j4,onMount:()=>A3,onDestroy:()=>M3,isSignal:()=>z4,isDerived:()=>U4,generateSignalsRuntimeDev:()=>I3,generateSignalsRuntime:()=>K2,effect:()=>q4,derived:()=>W4,default:()=>uq,batch:()=>R3});function K2(){let $=hq(I3());try{let J=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return J=J.replace(/\}(var |let |const |function )/g,"};$1"),J}catch{return $}}function hq($){let Z=[],J=0,Y="console.log(";while(J<$.length){let X=$.indexOf(Y,J);if(X===-1){Z.push($.slice(J));break}Z.push($.slice(J,X));let Q=1,G=X+Y.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),J=G}return Z.join("")}function I3(){return`
|
|
918
918
|
// STX Signals Runtime (Development Build)
|
|
919
919
|
console.log('[stx] signals runtime loading');
|
|
920
920
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -8675,7 +8675,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
8675
8675
|
}
|
|
8676
8676
|
}
|
|
8677
8677
|
})();
|
|
8678
|
-
`}var
|
|
8678
|
+
`}var uq;var q2=b(()=>{B4();K1();B4();uq={state:C1,derived:W4,effect:q4,batch:R3,onMount:A3,onDestroy:M3,isSignal:z4,isDerived:U4,untrack:T3,peek:j4,generateSignalsRuntime:K2,generateSignalsRuntimeDev:I3}});var D3={};t(D3,{templateCache:()=>z2,readFileCached:()=>mq,invalidateFileCacheByDir:()=>pq,invalidateFileCache:()=>dq,hashFilePath:()=>_$,getCachedSignalsRuntime:()=>iq,getCachedRouterScript:()=>nq,clearDevCaches:()=>oq,checkCache:()=>sq,cacheTemplate:()=>rq,__setSignalsGeneratorsForTest:()=>cq});import v1 from"fs";import T5 from"path";async function mq($){let J;for(let Y=0;Y<3;Y++)try{let Q=(await v1.promises.stat($)).mtime.getTime(),G=t1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),q=(await v1.promises.stat($)).mtime.getTime();if(q!==Q)continue;return t1.set($,{content:K,mtime:q}),K}catch(X){J=X;break}throw t1.delete($),Error(`File not found: ${$}${J?` (${J.message})`:""}`)}function dq($){t1.delete($)}function pq($){for(let Z of t1.keys())if(Z.startsWith($))t1.delete(Z)}function cq($){U2=$}async function iq($=!1){let Z=U2??await Promise.resolve().then(() => (q2(),W2));if($)return Z.generateSignalsRuntimeDev();if(H4===null)H4=Z.generateSignalsRuntime();return H4}async function nq(){if(_4===null){let{getRouterScript:$}=await import("stx-router");_4=$()}return _4}function oq(){t1.clear(),B2(),H4=null,lq=null,_4=null}function j2($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((J)=>({name:J.name,timing:J.timing,handler:String(J.handler)})),customDirectives:($.customDirectives??[]).map((J)=>({name:J.name,hasEndTag:J.hasEndTag===!0,handler:String(J.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function sq($,Z){try{if(!Z.cachePath)return null;let J=T5.resolve(Z.cachePath),Y=T5.join(J,`${_$($)}.html`),X=T5.join(J,`${_$($)}.meta.json`);if(!await c(Y)||!await c(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==j2(Z))return null;if((await v1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await c(W)){if((await v1.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(Y).text()}catch(J){return console.warn(`Cache error for ${$}:`,J),null}}async function rq($,Z,J,Y){try{if(!Y.cachePath)return;let X=T5.resolve(Y.cachePath);await v1.promises.mkdir(X,{recursive:!0});let Q=T5.join(X,`${_$($)}.html`),G=T5.join(X,`${_$($)}.meta.json`),K=await v1.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(J),cacheVersion:Y.cacheVersion,optionsSignature:j2(Y),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),z2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:J})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function _$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,aq)}var z2,t1,H4=null,lq=null,U2=null,_4=null,aq=16;var k3=b(()=>{I0();z2=new Map,t1=new Map});function H2($){return $.includes("data-stx-runtime")}function _2($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let J=Z.exec($);J!==null;J=Z.exec($)){let Y=$.slice(Math.max(0,J.index-80),J.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}async function O4($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
|
|
8679
8679
|
`+$.slice(K);if($.includes("</head>")){let W=$.indexOf("</head>");return $.slice(0,W)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
|
|
8680
8680
|
`+$.slice(W)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
|
|
8681
8681
|
`+$}if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
@@ -8685,15 +8685,15 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
8685
8685
|
`+$.slice(Q);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+X+`
|
|
8686
8686
|
`+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
|
|
8687
8687
|
`+X+$.slice(K+1)}return X+`
|
|
8688
|
-
`+$}async function E3($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let J=Z?.router,Y="";{let K={};if(J){if(J.container)K.container=J.container;if(J.interceptAllLinks!==void 0)K.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)K.progress=J.progress;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight}try{let W=await
|
|
8688
|
+
`+$}async function E3($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let J=Z?.router,Y="";{let K={};if(J){if(J.container)K.container=J.container;if(J.interceptAllLinks!==void 0)K.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)K.progress=J.progress;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight}try{let W=await Y2(Z?.pagesDir);if(W.length>0)K.ownedRoutes=W}catch{}if(Object.keys(K).length>0)Y=`<script>window.__stxRouterConfig=${Q2(K)};</script>
|
|
8689
8689
|
`}let{getCachedRouterScript:X}=await Promise.resolve().then(() => (k3(),D3)),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await X()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+Y+Q+`
|
|
8690
|
-
</body>`+$.slice(G+7)}var F4=b(()=>{
|
|
8691
|
-
`)}else{if(!
|
|
8690
|
+
</body>`+$.slice(G+7)}var F4=b(()=>{X2();w3()});var N4={};t(N4,{scanScriptTags:()=>R2,rewriteStxImportSpecifiers:()=>I2,processSignals:()=>C3,processScriptSetup:()=>M2,preEvalLiteralReactiveIfs:()=>y3,parseLoopExpression:()=>A2,hasSignalsSyntax:()=>w4,findMarkupIndexOutsideScripts:()=>L4,extractExports:()=>T2,convertSignalLoopsToAttributes:()=>P3,convertSignalDirectivesToAttributes:()=>S3});function R2($,Z={}){let J=[];for(let Y of Q3($,k1)){let X=Y.token.match(/^<script\b([^>]*)>/i),Q=Y.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let G=X[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=X[0].length,W=Y.token.length-Q[0].length;J.push({fullMatch:Y.token,attrs:G,body:Y.token.slice(K,W),start:Y.start,end:Y.end})}return J}function A2($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=F2(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let Y=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=F2(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function F2($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let Y=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let X=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(X)return{itemVar:X[1],indexVar:X[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function w4($){return D8($)}function eq($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(X.startsWith("if"))J++;else if(X==="endif")J--;else if(J===0)return!0}return!1}function $z($){let Z=new Set,J=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,X;while((X=J.exec($))!==null){let Q=X[1],G;while((G=Y.exec(Q))!==null)Z.add(G[1])}return Z}function Zz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function L2($,Z,J){if(!$)return!1;let Y=Zz($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,W;while((W=K.exec(Y))!==null){let j=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(V2.has(j))continue;if(Z.has(j))X=!0;else if(J&&j in J)Q=!0}let q=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=q.exec(Y))!==null){let j=z[1];if(Y.slice(0,z.index).trimEnd().endsWith("."))continue;if(V2.has(j)||J&&j in J)continue;G=!0}return(X||G)&&!Q}function V4($,Z,J){let Y=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,""")}"`,X=$.trim(),Q=X.match(N2);if(Q&&Jz(Q[3],Q[1])){let[,G,K,W]=Q;return`<${G}${K}${Y}>${W}</${G}>`}return`<template${Y}>${X}</template>`}function Jz($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),Y=0,X;while((X=J.exec($))!==null)if(X[1]){if(Y--,Y<0)return!1}else Y++;return!0}function S3($,Z){let J=$z($);function Y(X){let Q=X,G=/@if\s*\(/g,K,W=[];while((K=G.exec(Q))!==null){let q=K.index,z=q+K[0].length,U=1,j=z;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")")U--;j++}if(U!==0)continue;let H=Q.substring(z,j-1).trim(),B=j,_=1,O=B,V=/@(if\s*\(|endif)/g;V.lastIndex=B;let F;while((F=V.exec(Q))!==null)if(F[1].startsWith("if"))_++;else if(F[1]==="endif"){if(_--,_===0){O=F.index+F[0].length;break}}if(_!==0)continue;let L=Q.substring(B,O-6).trim(),w;if(eq(L)){let N=B$(Q.substring(q,O));if(N.length===0)continue;let R=N[0].branches.filter((T)=>T.type!=="else");if(!(R.length>0&&R.every((T)=>L2(T.condition,J,Z))))continue;w=N[0].branches.map((T)=>{let I=Y(T.content);if(T.type==="elseif")return V4(I,"@else-if",T.condition??"");if(T.type==="else")return V4(I,"@else");return V4(I,"@if",T.condition??"")}).join(`
|
|
8691
|
+
`)}else{if(!L2(H,J,Z))continue;w=V4(Y(L),"@if",H)}W.push({start:q,end:O,replacement:w}),G.lastIndex=O}for(let q=W.length-1;q>=0;q--){let{start:z,end:U,replacement:j}=W[q];Q=Q.substring(0,z)+j+Q.substring(U)}return Q}return Y($)}function Yz($){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 X=Number(Z);return X!==0&&!Number.isNaN(X)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let Y=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}function Xz($,Z,J,Y){if(b3.has(J.toLowerCase()))return Y;let X=J.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,W=Y;while(W<G){let q=$.indexOf("<",W);if(q===-1)return-1;if(W=q,$.startsWith("<!--",W)){let H=$.indexOf("-->",W+4);if(H===-1)return-1;W=H+3;continue}let z=/^<(script|style)\b/i.exec($.slice(W,W+8));if(z){let H=$.indexOf(">",W);if(H===-1)return-1;if($[H-1]==="/"){W=H+1;continue}let B=Q.indexOf(`</${z[1].toLowerCase()}`,W);if(B===-1)return-1;let _=$.indexOf(">",B);if(_===-1)return-1;W=_+1;continue}if($[W+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!H){W++;continue}if(H[1].toLowerCase()===X){if(K--,W+=H[0].length,K===0)return W;continue}W+=H[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!U){W++;continue}let j=$.indexOf(">",W);if(j===-1)return-1;if(U[1].toLowerCase()===X){let H=$.slice(W,j+1);if(!(/\/\s*>$/.test(H)||b3.has(X)))K++}W=j+1}return-1}function Gz($,Z){let J=Z,Y=$.length;for(;;){while(J<Y&&$[J]!=="<")J++;if(J>=Y)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let X=$.indexOf(">",J);if(X===-1)return!1;let Q=$.slice(J,X+1);return Qz.test(Q)}function y3($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Y;while((Y=J.exec($))!==null)Z.push([Y.index,Y.index+Y[0].length]);let X=(U)=>Z.some(([j,H])=>U>=j&&U<H),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(X(K.index))continue;let[U,j,H,B,_,O,V]=K,F=Yz(_);if(F===void 0)continue;let L=K.index,w=L+U.length,A=!!V||/\/\s*>$/.test(U)||b3.has(j.toLowerCase())?w:Xz($,L,j,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Gz($,A)){Q.lastIndex=w;continue}if(F===!0){let T=`<${j}${H}${O}${V}>`;G.push({start:L,end:w,replacement:T});continue}G.push({start:L,end:A,replacement:""}),Q.lastIndex=A}if(G.length===0)return $;G.sort((U,j)=>U.start-j.start);let W=[],q=-1;for(let U of G){if(U.start<q)continue;W.push(U),q=U.end}let z=$;for(let U=W.length-1;U>=0;U--){let{start:j,end:H,replacement:B}=W[U];z=z.substring(0,j)+B+z.substring(H)}return z}function P3($,Z){let J=$,Y=/@(for|foreach)\s*\(/g,X,Q=[],G=[];while((X=Y.exec(J))!==null){let K=X[1],W=X.index,q=W+X[0].length,z=1,U=q;while(U<J.length&&z>0){if(J[U]==="(")z++;else if(J[U]===")")z--;U++}if(z!==0)continue;let j=J.substring(q,U-1).trim(),H=U,B=A2(j),_=K==="for"?"@endfor":"@endforeach",O=1,V=H,F=K==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${K}\\s*\\(|end${K})`,"g");F.lastIndex=H;let L;while((L=F.exec(J))!==null)if(L[1].startsWith(K))O++;else if(O--,O===0){V=L.index+L[0].length;break}if(O!==0)continue;let w=()=>{let M=[B.itemVar,B.indexVar].filter(Boolean);if(M.length)G.push({start:W,end:V,vars:M})};if(B.iterable){let M=B.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){w();continue}let T=M.split(/[.[(]/)[0].trim(),I=Z?T in Z:!1,E=G.some((D)=>W>D.start&&W<D.end&&D.vars.includes(T));if(T&&(I||E)){w();continue}}if(B.style==="as")j=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let N=J.substring(H,V-_.length).trim(),R=N.match(N2),A;if(R){let[,M,T,I]=R;A=`<${M}${T} @for="${j}">${I}</${M}>`}else A=`<template @for="${j}">${N}</template>`;Q.push({start:W,end:V,replacement:A})}for(let K=Q.length-1;K>=0;K--){let{start:W,end:q,replacement:z}=Q[K];J=J.substring(0,W)+z+J.substring(q)}return J}function Kz($){let Z=new Set,J=[],Y=0,X=0,Q=$.length,G=(z)=>{let U=Y+1;while(U<Q){let j=$[U];if(j==="\\"){U+=2;continue}if(j===z)return U+1;U++}return Q},K=()=>{let z=Y+2;while(z<Q&&$[z]!==`
|
|
8692
8692
|
`)z++;return z},W=()=>{let z=Y+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},q=(z)=>{let U=z,j=0;while(U<Q){let H=$[U];if(H==="/"&&$[U+1]==="/"){let B=U+2;while(B<Q&&$[B]!==`
|
|
8693
|
-
`)B++;U=B;continue}if(H==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(H==='"'||H==="'"||H==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===H){B++;break}B++}U=B;continue}if(H==="("||H==="["||H==="{"){j++,U++;continue}if(H===")"||H==="]"||H==="}"){j--,U++;continue}if(H===";"&&j===0)return U+1;U++}return Q};while(Y<Q){let z=$[Y];if(z==="/"&&$[Y+1]==="/"){let U=K();J.push($.slice(Y,U)),Y=U;continue}if(z==="/"&&$[Y+1]==="*"){let U=W();J.push($.slice(Y,U)),Y=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);J.push($.slice(Y,U)),Y=U;continue}if(z==="{"){X++,J.push(z),Y++;continue}if(z==="}"){X--,J.push(z),Y++;continue}if(X===0){let U=Y>0?$[Y-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let H=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(H){let B=H[2],_=q(Y+H[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),Y=_;continue}Z.add(B),J.push($.slice(Y,_)),Y=_;continue}}}J.push(z),Y++}return J.join("")}async function
|
|
8693
|
+
`)B++;U=B;continue}if(H==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(H==='"'||H==="'"||H==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===H){B++;break}B++}U=B;continue}if(H==="("||H==="["||H==="{"){j++,U++;continue}if(H===")"||H==="]"||H==="}"){j--,U++;continue}if(H===";"&&j===0)return U+1;U++}return Q};while(Y<Q){let z=$[Y];if(z==="/"&&$[Y+1]==="/"){let U=K();J.push($.slice(Y,U)),Y=U;continue}if(z==="/"&&$[Y+1]==="*"){let U=W();J.push($.slice(Y,U)),Y=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);J.push($.slice(Y,U)),Y=U;continue}if(z==="{"){X++,J.push(z),Y++;continue}if(z==="}"){X--,J.push(z),Y++;continue}if(X===0){let U=Y>0?$[Y-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let H=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(H){let B=H[2],_=q(Y+H[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),Y=_;continue}Z.add(B),J.push($.slice(Y,_)),Y=_;continue}}}J.push(z),Y++}return J.join("")}async function M2($,Z,J){let Y=R2($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let O of Y){let V=O.body;if(c1(O.attrs))V=i1(V);if(X.test(V))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${tq++}`,{hasUserImports:K,bundleClientScript:W}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => ($$(),e5))),q=[];for(let O=0;O<Q.length;O++){let V=Q[O].content;if(V=V5(V).code,K(V))V=await W(V,Z||"",{projectRoot:process.cwd()});V=V.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L,w)=>I2(w));let F=p0(V);q.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
|
|
8694
8694
|
${F}`)}let z=q.join(`
|
|
8695
8695
|
|
|
8696
|
-
`);z=
|
|
8696
|
+
`);z=Kz(z);let U=T2(z),j=U.split(",").map((O)=>O.trim()).filter(Boolean),H=c$(z,J),B=`
|
|
8697
8697
|
<script data-stx-scoped>
|
|
8698
8698
|
function ${G}() {
|
|
8699
8699
|
${O5("const",j)}
|
|
@@ -8702,17 +8702,17 @@ ${F5(`${H}${z}`)}
|
|
|
8702
8702
|
}
|
|
8703
8703
|
window.__stx_latestSetup=${G};
|
|
8704
8704
|
if(window.stx)window.stx._latestSetup=${G};
|
|
8705
|
-
</script>`,_=$;for(let O of Q)_=_.split(O.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${
|
|
8705
|
+
</script>`,_=$;for(let O of Q)_=_.split(O.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${O2})>`),`<body$1 data-stx="${G}">`);else{let O=["script","style","html","head","meta","link","title","!doctype"],V=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${O2})>`,"gi"),(F,L,w)=>{if(V||O.includes(L.toLowerCase()))return F;return V=!0,`<${L}${w} data-stx="${G}">`})}return{output:_,setupCode:B}}function T2($){let Z=$,J=[],Y=new Set,X=0,Q=0,G=Z.length,K="",W=()=>{Q++;let B=!1;while(Q<G){let _=Z[Q];if(_==="\\"){Q+=2;continue}if(_==="["&&!B){B=!0,Q++;continue}if(_==="]"&&B){B=!1,Q++;continue}if(_==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(_===`
|
|
8706
8706
|
`)return;Q++}},q=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},z=(B)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===B){Q++;return}Q++}},U=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let B=1;while(Q<G&&B>0)if(Z[Q]==="{")B++,Q++;else if(Z[Q]==="}")B--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")U();else Q++;continue}Q++}},j=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
8707
|
-
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},H=()=>{if(X!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let L=B[2];if(!Y.has(L))J.push(L),Y.add(L);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let N=w.indexOf(":"),A=(N>=0?w.slice(N+1).trim():w).split(/[\s=]/)[0];if(A&&!Y.has(A))J.push(A),Y.add(A)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let N=w.split(/[\s=]/)[0];if(N&&!Y.has(N))J.push(N),Y.add(N)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let L=V[1];if(!Y.has(L))J.push(L),Y.add(L);return}let F=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let L=F[1];if(!Y.has(L))J.push(L),Y.add(L)}};while(Q<G){if(j())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){U(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){W(),K="/";continue}if(Z[Q]==="{"){X++,K="{",Q++;continue}if(Z[Q]==="}"){X--,K="}",Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))H();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return J.join(", ")}async function C3($,Z,J,Y){if(!w4($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await
|
|
8707
|
+
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},H=()=>{if(X!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let L=B[2];if(!Y.has(L))J.push(L),Y.add(L);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let N=w.indexOf(":"),A=(N>=0?w.slice(N+1).trim():w).split(/[\s=]/)[0];if(A&&!Y.has(A))J.push(A),Y.add(A)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let N=w.split(/[\s=]/)[0];if(N&&!Y.has(N))J.push(N),Y.add(N)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let L=V[1];if(!Y.has(L))J.push(L),Y.add(L);return}let F=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let L=F[1];if(!Y.has(L))J.push(L),Y.add(L)}};while(Q<G){if(j())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){U(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){W(),K="/";continue}if(Z[Q]==="{"){X++,K="{",Q++;continue}if(Z[Q]==="}"){X--,K="}",Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))H();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return J.join(", ")}async function C3($,Z,J,Y){if(!w4($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await M2(X,J,Y);if(X=Q,X=await O4(X,Z),G){let z=L4(X,/<\/head>/i),U=z===-1?L4(X,/<body[^>]*>/i):-1;if(z!==-1)X=`${X.slice(0,z)}${G}
|
|
8708
8708
|
${X.slice(z)}`;else if(U!==-1){let j=/<body[^>]*>/i.exec(X.slice(U))[0],H=U+j.length;X=`${X.slice(0,H)}
|
|
8709
8709
|
${G}${X.slice(H)}`}else X=`${X}
|
|
8710
|
-
${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=W&&/data-stx/.test(W[1]);if(!G&&!q&&W&&!/data-stx-auto/.test(W[1])){let z=/<body[^>]*>/i,U=L4(X,z);if(U!==-1){let j=X.slice(0,U),H=X.slice(U).replace(z,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+H}}return X}function L4($,Z){let J=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],X;while((X=J.exec($))!==null)Y.push([X.index,X.index+X[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let W=G+K.index;if(!Y.some(([z,U])=>W>=z&&W<U))return W;G=W+Math.max(K[0].length,1)}return-1}function
|
|
8711
|
-
`)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},q=()=>{if(Y!==0)return;let z=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let B=z[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!J.has(_))Z.push(_),J.add(_);return}let U=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){Y++,X++;continue}if($[X]==="}"){Y--,X++;continue}if(Y===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))q();X++}return Z}function
|
|
8710
|
+
${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=W&&/data-stx/.test(W[1]);if(!G&&!q&&W&&!/data-stx-auto/.test(W[1])){let z=/<body[^>]*>/i,U=L4(X,z);if(U!==-1){let j=X.slice(0,U),H=X.slice(U).replace(z,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+H}}return X}function L4($,Z){let J=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],X;while((X=J.exec($))!==null)Y.push([X.index,X.index+X[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let W=G+K.index;if(!Y.some(([z,U])=>W>=z&&W<U))return W;G=W+Math.max(K[0].length,1)}return-1}function I2($){let Z=[];for(let J of $.split(",")){let Y=J.trim();if(!Y||Y.startsWith("type "))continue;let X=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X&&X[1]!==X[2])Z.push(`${X[2]} = ${X[1]}`)}if(Z.length===0)return w2;return`var ${Z.join(", ")}; ${w2}`}var tq=0,O2=`(?:"[^"]*"|'[^']*'|[^>"'])*`,N2,V2,b3,Qz,w2="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var O$=b(()=>{Q$();Y4();K1();a7();I0();F4();n1();t5();N2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;V2=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"]);b3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Qz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Wz from"fs";import g from"path";function zz($){let Z=new WeakSet;try{let J=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if(Z.has(Y))throw TypeError("Circular component input");if(Z.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(J);let X={};for(let Q of Object.keys(Y).sort())X[Q]=J(Y[Q]);return X};return JSON.stringify(J($))}catch{return null}}function D2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Uz($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function c1($){return!Uz($)}function i1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let J=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=J.length;return J.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=J.length;return J.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=J.length;return J.push(Q),`"__STX_EXPR_${G}__"`});let X=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}).transformSync(Z);for(let Q=0;Q<J.length;Q++)X=X.replace(`"__STX_EXPR_${Q}__"`,J[Q]),X=X.replace(`'__STX_EXPR_${Q}__'`,J[Q]);return X}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function jz($){let Z=[],J=new Set,Y=0,X=0,Q=$.length,G=(z)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===z){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let z=1;while(X<Q&&z>0)if($[X]==="{")z++,X++;else if($[X]==="}")z--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},W=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
|
|
8711
|
+
`)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},q=()=>{if(Y!==0)return;let z=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let B=z[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!J.has(_))Z.push(_),J.add(_);return}let U=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){Y++,X++;continue}if($[X]==="}"){Y--,X++;continue}if(Y===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))q();X++}return Z}function Bz($){let Z=[],J=0,Y=0,X=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G==="\\"){Q++;continue}if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(Y,Q)),Y=Q+1}if(Y<$.length)Z.push($.slice(Y));return Z}function Hz($){let Z=0,J=null;for(let Y=0;Y<$.length;Y++){let X=$[Y];if(J){if(X==="\\"){Y++;continue}if(X===J)J=null;continue}if(X==='"'||X==="'"||X==="`"){J=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[Y-1],G=$[Y+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return Y}}return-1}function _z($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let Y=J.index-1;while(Y>=0&&/\s/.test($[Y]))Y--;if($[Y]!=="}")return;let X=Y,Q=0,G=-1;for(;Y>=0;Y--){let W=$[Y];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=Y;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of Bz(K)){let q=W.trim();if(!q||q.startsWith("..."))continue;let z=Hz(q);if(z===-1)continue;let U=q.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=q.slice(z+1).trim();if(!j)continue;try{let H=Object.keys(Z),B=Function(...H,`"use strict"; return (${j});`);Z[U]=B(...H.map((_)=>Z[_]))}catch{}}}catch{}}async function M4($,Z,J,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=J.__importedComponents;if(W){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],z=typeof X.root==="string"?g.resolve(X.root):void 0,U=z??g.dirname(Y),j=[],H=(O)=>{if(O&&!j.includes(O))j.push(O)},B=J.__originalFilePath;if(B)H(g.join(g.dirname(B),"components"));H(Z),H(X._rootComponentsDir),H(g.join(g.dirname(Y),"components")),H(X.componentsDir);let _=X._pluginComponentDirs;if(Array.isArray(_))for(let O of _)H(typeof O==="string"?O:null);if(z)H(g.resolve(z,"resources/views/components")),H(g.resolve(z,"resources/components")),H(g.resolve(z,"src/components")),H(g.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(g.resolve(g.dirname(Y),`${Q}.stx`));for(let O of j){let V=g.isAbsolute(O)?O:g.resolve(U,O);for(let F of q)if(await c(g.join(V,F)))return!0}return!1}function Oz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Fz($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function Vz($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let Y of $){let X;while((X=J.exec(Y))!==null)Z.add(X[1]);J.lastIndex=0}return[...Z]}async function e1($,Z,J,Y,X,Q,G,K=new Set,W){let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (j$(),Z4))),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let U=new Set(z);U.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let H=j&&j!=="load"&&Oz(j)?j:"";try{let B=(k)=>k.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(k)=>k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,V=null,F=X.__importedComponents;if(F){let k=[O,O.toLowerCase(),B(O),_(O)];for(let v of k)if(F.has(v)){V=F.get(v);break}}let L=[];if(!V){let k=[`${O}.stx`,`${B(O)}.stx`,`${_(O)}.stx`],v=[...new Set(k)],m=X.__originalFilePath,h=[];if(m){let H0=g.join(g.dirname(m),"components");h.push(H0)}if(Y)h.push(Y);let r=G._rootComponentsDir;if(typeof r==="string"&&!h.includes(r))h.push(r);let G0=g.join(g.dirname(Q),"components");if(!h.includes(G0))h.push(G0);if(G.componentsDir&&G.componentsDir!==Y&&!h.includes(G.componentsDir))h.push(G.componentsDir);let r0=G._pluginComponentDirs;if(Array.isArray(r0)){for(let H0 of r0)if(typeof H0==="string"&&!h.includes(H0))h.push(H0)}let f0=typeof G.root==="string"?g.resolve(G.root):void 0,d0=f0??g.dirname(Q),a0=[];if(f0)a0.push(g.resolve(f0,"resources/views/components")),a0.push(g.resolve(f0,"resources/components")),a0.push(g.resolve(f0,"src/components")),a0.push(g.resolve(f0,"components"));a0.push(g.resolve(import.meta.dir,"components"));for(let H0 of a0)if(!h.includes(H0))h.push(H0);let B5=[...new Set(h.map((H0)=>{if(!H0)return H0;return g.isAbsolute(H0)?H0:g.resolve(d0,H0)}))];h.length=0,h.push(...B5);let M1=`${O}\x00${Q}\x00${B5.join("\x00")}`,T1=A4.get(M1);if(T1)if(await c(T1))V=T1;else A4.delete(M1);if(!V&&(O.startsWith("./")||O.startsWith("../")))V=g.resolve(g.dirname(Q),`${O}.stx`),L.push(V);else if(!V)for(let H0 of h){if(!H0)continue;for(let Q1 of v){let i=g.join(H0,Q1);if(L.push(i),await c(i)){V=i;break}}if(V)break;if(!V)try{let Q1=await import("fs");if(!Q1.statSync(H0,{throwIfNoEntry:!1})?.isDirectory())continue;let G1=8,d1=[{path:H0,depth:0}];while(d1.length>0&&!V){let H1=d1.pop();if(H1.depth>=G1)continue;let h$;try{h$=Q1.readdirSync(H1.path,{withFileTypes:!0})}catch{continue}for(let u$ of h$){if(!u$.isDirectory())continue;if(u$.name==="node_modules"||u$.name.startsWith("."))continue;let e9=g.join(H1.path,u$.name);for(let HK of v){let f7=g.join(e9,HK);if(L.push(f7),await c(f7)){V=f7;break}}if(V)break;d1.push({path:e9,depth:H1.depth+1})}}}catch{}if(V)break}if(V)A4.set(M1,V)}if(!V||!await c(V)){let k=L.length>0?`
|
|
8712
8712
|
Searched paths:
|
|
8713
8713
|
${L.map((v)=>` - ${v}`).join(`
|
|
8714
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${k}`}W.add(V);let w;if(R4.has(V))w=R4.get(V);else try{w=await Bun.file(V).text(),R4.set(V,w)}catch(k){return`[Error loading component: ${k instanceof Error?k.message:String(k)}]`}let N=new Set(["__originalFilePath","__importedComponents",i$]),R={};for(let[k,v]of Object.entries(X))if(!k.startsWith("__")||N.has(k))R[k]=v;let{extractSlotContent:A}=await e("stx/slots",()=>Promise.resolve().then(() => (F3(),O3))),M=A(J),T={};if(M.defaultSlot?.trim())T.default=M.defaultSlot;for(let[k,v]of M.namedSlots)T[k]=v.content;let I={...R,...Z,props:Z,slot:J,$slots:T,__processedComponents:U,__sections:{},__stx_signals_gate:L1(w)||
|
|
8715
|
-
`)}`}if(J&&u.includes("{{ text || slot }}"))u=u.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:a}=await e("stx/slots",()=>Promise.resolve().then(() => (F3(),O3))),{defaultSlot:R0,namedSlots:C0}=M;u=await a(u,R0,C0,I);let U5=P.some((k)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(k)),j5=
|
|
8714
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${k}`}W.add(V);let w;if(R4.has(V))w=R4.get(V);else try{w=await Bun.file(V).text(),R4.set(V,w)}catch(k){return`[Error loading component: ${k instanceof Error?k.message:String(k)}]`}let N=new Set(["__originalFilePath","__importedComponents",i$]),R={};for(let[k,v]of Object.entries(X))if(!k.startsWith("__")||N.has(k))R[k]=v;let{extractSlotContent:A}=await e("stx/slots",()=>Promise.resolve().then(() => (F3(),O3))),M=A(J),T={};if(M.defaultSlot?.trim())T.default=M.defaultSlot;for(let[k,v]of M.namedSlots)T[k]=v.content;let I={...R,...Z,props:Z,slot:J,$slots:T,__processedComponents:U,__sections:{},__stx_signals_gate:L1(w)||Fz(J)};_z(w,I);let E=w,D=t$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(y)],P=[],C=S.some((k)=>/\bserver\b/.test(k[1]||"")&&/\bcache\b/.test(k[1]||""))&&S.every((k)=>/\bserver\b/.test(k[1]||"")),x=null,f=null;if(C){let k=zz({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(k!==null){x=`${V}\x00${k}`;let v=v3.get(x);if(v){for(let m of v.dependencies)W.add(m);return v.output}f=new Set(W)}}for(let k of S){let v=k[1]||"",m=k[2]||"",h=v.includes("server");if(c1(v)&&m.trim())m=i1(m);if(h&&m)try{await q(m,I,V)}catch(G0){}if(!h){let G0=m.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),r0=G0.includes("{{")&&G0.includes("}}"),f0=G0.includes("{!!")&&G0.includes("!!}");if(r0||f0)G0=r$(G0,I);let d0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");P.push(`<script${d0}>${G0}</script>`)}}let d=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),$0=d?d[1]:"",P0=d?d[2]:"",B0="",N0=$0&&/\bscoped\b/i.test($0);if(d)B0=`<style${$0}>${P0}</style>`;let u=E;if(u=u.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),d)u=u.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let k=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(u=u.replace(k,(m,h)=>{let r=h.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(r)v.push(`<style${r[1]}>${r[2]}</style>`);return""}),u=u.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)B0=`${B0}${v.join(`
|
|
8715
|
+
`)}`}if(J&&u.includes("{{ text || slot }}"))u=u.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:a}=await e("stx/slots",()=>Promise.resolve().then(() => (F3(),O3))),{defaultSlot:R0,namedSlots:C0}=M;u=await a(u,R0,C0,I);let U5=P.some((k)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(k)),j5=Vz(P);if(j5.length>0)I.__stx_client_signal_names=j5;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:U5||P.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let s=await F0(u,I,V,n,W),z0=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let k of s.matchAll(/\{\{([\s\S]*?)\}\}/g))z0.add(k[1].trim());if(z0.size>0)X.__stx_preserved_client_expressions=[...z0];let D0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++qz}_${Math.random().toString(36).slice(2,8)}`,K0=s;if(U5){let k="";if(Object.keys(Z).length>0)try{k=` data-stx-props="${D2(JSON.stringify(Z))}"`}catch{}let v=H?` stx-hydrate="${D2(H)}"`:"";K0=`<div data-stx-scope="${D0}"${k}${v}>${s}</div>`;let m=await Promise.all(P.map(async(h)=>{let r=h.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!r)return h;let[,G0,r0]=r,f0=d$(r0,{filePath:V,projectRoot:process.cwd()}),d0=f0.code,a0=p$(f0.styles);d0=V5(d0).code;let{hasUserImports:B5,bundleClientScript:M1}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => ($$(),e5)));if(B5(d0))d0=await M1(d0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:T1}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (O$(),N4)));d0=d0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(H1,h$)=>T1(h$));let H0=p0(d0),Q1=jz(H0),i=`function(__scopeId) {
|
|
8716
8716
|
${O5("const",[...I8,...Q1],H0)}
|
|
8717
8717
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
8718
8718
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -8746,9 +8746,9 @@ finally {
|
|
|
8746
8746
|
`+B0}else{if(B0)K0+=`
|
|
8747
8747
|
`+B0;if(P.length>0){let k=I.__stx_event_bindings||[],v=Y$(I),m=await Promise.all(P.map(async(h)=>{let r=h.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!r)return h;return await X$(r[1],{eventBindings:k,templateContent:K0,filePath:V,projectRoot:process.cwd(),serverData:v})}));K0+=`
|
|
8748
8748
|
`+m.join(`
|
|
8749
|
-
`),I.__stx_event_bindings=[]}}if(N0){let k=a$(K0,V);if(k.hasScoped)K0=k.html}if(x&&f)v3.set(x,{output:K0,dependencies:[...W].filter((k)=>!f.has(k))});return K0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{z.delete($)}}async function c($){return Bun.file($).exists()}function x3($,Z){let J=g.resolve(Z),Y=g.resolve($),X=J.endsWith(g.sep)?J:J+g.sep;if(Y===J||Y.startsWith(X))return Y;return null}async function f3($,Z,J,Y){let X=await
|
|
8749
|
+
`),I.__stx_event_bindings=[]}}if(N0){let k=a$(K0,V);if(k.hasScoped)K0=k.html}if(x&&f)v3.set(x,{output:K0,dependencies:[...W].filter((k)=>!f.has(k))});return K0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{z.delete($)}}async function c($){return Bun.file($).exists()}function x3($,Z){let J=g.resolve(Z),Y=g.resolve($),X=J.endsWith(g.sep)?J:J+g.sep;if(Y===J||Y.startsWith(X))return Y;return null}async function f3($,Z,J,Y){let X=await Lz($,Z,J,Y);if(X===null)return null;let Q=x3(X,process.cwd());if(Q)return Q;let G=[J.root,J.layoutsDir,J.componentsDir,J.partialsDir,J.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=g.isAbsolute(K)?K:g.resolve(process.cwd(),K);if(x3(X,W))return g.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function Lz($,Z,J,Y){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=g.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=g.join(Q,$),H=x3(j,Q);if(!H)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(J.debug)console.log(`Checking absolute path: ${H}`);if(await c(H)&&Y)Y.add(H);return H}let G=g.join(X,$);if(await c(G)){if(J.debug)console.log(`Found direct path: ${G}`);if(Y)Y.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let H=`${G}${j}`;if(await c(H)){if(J.debug)console.log(`Found direct path with extension: ${H}`);if(Y)Y.add(H);return H}}let K="",W=g.resolve(X),q=process.cwd();for(let j=0;j<10;j++){let H=g.join(W,"layouts"),B=!1;try{B=Wz.statSync(H,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=H;break}let _=g.dirname(W);if(_===W||_.length<q.length)break;W=_}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,H=g.join(K,j);if(await c(H)){if(J.debug)console.log(`Found in current layouts dir: ${H}`);if(Y)Y.add(H);return H}if(!j.endsWith(".stx")){let B=`${H}.stx`;if(await c(B)){if(J.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(J.layoutsDir){let j=g.isAbsolute(J.layoutsDir)?J.layoutsDir:g.resolve(process.cwd(),J.layoutsDir),H=$.startsWith("layouts/")?$.slice(8):$,B=g.join(j,H);if(await c(B)){if(J.debug)console.log(`Found in options.layoutsDir: ${B}`);if(Y)Y.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await c(_)){if(J.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(Y)Y.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),H=g.join(J.partialsDir||X,"layouts",j[1]);if(await c(H)){if(J.debug)console.log(`Found in layouts path: ${H}`);if(Y)Y.add(H);return H}if(!H.endsWith(".stx")){let B=`${H}.stx`;if(await c(B)){if(J.debug)console.log(`Found in layouts path with extension: ${B}`);if(Y)Y.add(B);return B}}}if(J.partialsDir){if(K=g.join(J.partialsDir,"layouts"),await c(K)){let j=g.join(K,$);if(await c(j)){if(J.debug)console.log(`Found in partials layouts dir: ${j}`);if(Y)Y.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await c(H)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${H}`);if(Y)Y.add(H);return H}}}}let z=J.partialsDir||g.join(process.cwd(),"views"),U=g.join(z,$);if(await c(U)){if(J.debug)console.log(`Found in views path: ${U}`);if(Y)Y.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await c(j)){if(J.debug)console.log(`Found in views path with extension: ${j}`);if(Y)Y.add(j);return j}}if(X.includes("temp")){let j=g.join(g.dirname(X),"layouts",$);if(await c(j)){if(J.debug)console.log(`Found in temp layouts dir: ${j}`);if(Y)Y.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await c(H)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${H}`);if(Y)Y.add(H);return H}}}if(J.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 k2($,Z,J){let Y=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
|
|
8750
8750
|
`),K=0;for(let W=0;W<G.length;W++)if(K+=G[W].length+1,K>=Z){Y=W+1,X=G[W].trim();let q=Math.max(0,W-2),z=Math.min(G.length,W+3);Q=G.slice(q,z).map((U,j)=>{let H=q+j+1;return`${H===Y?"> ":" "}${H}: ${U}`}).join(`
|
|
8751
|
-
`);break}}else if(J){let G=$.indexOf(J);if(G>=0)return
|
|
8751
|
+
`);break}}else if(J){let G=$.indexOf(J);if(G>=0)return k2($,G)}}catch{}return{lineNumber:Y,lineContent:X,context:Q}}function j0($,Z,J,Y,X,Q){let{lineNumber:G,context:K}=k2(Y,X,Q),W=J.split("/").pop(),q=0;if(typeof X==="number"&&X>=0&&Y){let U=Y.lastIndexOf(`
|
|
8752
8752
|
`,Math.max(0,X-1));q=X-(U+1)+1}let z="";if(G>0)z+=`
|
|
8753
8753
|
${J}:${G}${q>0?`:${q}`:""}: ${$.toLowerCase()} error: ${Z}
|
|
8754
8754
|
`;if(z+=`
|
|
@@ -8761,8 +8761,8 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
|
|
|
8761
8761
|
`,K)z+=`
|
|
8762
8762
|
${Z0.blue}${Z0.bold}Context:${Z0.reset}
|
|
8763
8763
|
${Z0.dim}${K}${Z0.reset}
|
|
8764
|
-
`;return z}function
|
|
8765
|
-
`||F==="\r"||F===" "||F===void 0)U++;j=O+9}else{if(U--,U===0){H=V;break}j=V+12}}if(H===-1)continue;let B=$.slice(z,H),_=$.slice(K,H+12);X.push({fullMatch:_,options:q,content:B,index:K}),Q.lastIndex=H+12}for(let{fullMatch:K,options:W,content:q,index:z}of X)try{let U={};if(W)W.split(",").forEach((B)=>{let _=B.trim();if(_)U[_]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},H=a5(q.trim(),j);Y=Y.split(K).join(H)}catch(U){let j=U instanceof Error?U.message:String(U),H=j0("Markdown Directive",`Error processing markdown: ${j}`,J,$,z,K);Y=Y.split(K).join(H)}return Y}async function
|
|
8764
|
+
`;return z}function B2(){R4.clear(),A4.clear(),v3.clear()}var R4,A4,v3,qz=0,Z0;var I0=b(()=>{Q$();Y3();q1();K1();R5();T4();D1();q3();z3();t5();yZ();j$();R4=new o1(500),A4=new o1(1000),v3=new o1(2000);Z0={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 E2($,Z,J=""){let Y=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),q=W?W[1]:"",z=K+G[0].length,U=1,j=z,H=-1;while(U>0&&j<$.length){let O=$.indexOf("@markdown",j),V=$.indexOf("@endmarkdown",j);if(V===-1)break;if(O!==-1&&O<V&&O!==K){let F=$[O+9];if(F==="("||F===`
|
|
8765
|
+
`||F==="\r"||F===" "||F===void 0)U++;j=O+9}else{if(U--,U===0){H=V;break}j=V+12}}if(H===-1)continue;let B=$.slice(z,H),_=$.slice(K,H+12);X.push({fullMatch:_,options:q,content:B,index:K}),Q.lastIndex=H+12}for(let{fullMatch:K,options:W,content:q,index:z}of X)try{let U={};if(W)W.split(",").forEach((B)=>{let _=B.trim();if(_)U[_]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},H=a5(q.trim(),j);Y=Y.split(K).join(H)}catch(U){let j=U instanceof Error?U.message:String(U),H=j0("Markdown Directive",`Error processing markdown: ${j}`,J,$,z,K);Y=Y.split(K).join(H)}return Y}async function b2($,Z,J,Y){let X={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")X.breaks=!0;if(G==="no-gfm")X.gfm=!1}),a5($.trim(),X)}var g3=b(()=>{I0()});function Rz($){if(wz.set($.name,$),$.client)Nz.set($.name,$.client)}function I4($){return Rz($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(J,Y,X,Q)=>{let G=Az(Y,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let q=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(q)}}let K=J;if($.transform)K=await $.transform(J,G,X,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function Az($,Z){let J={...Z};for(let Y of $){let X=Y.indexOf(":"),Q=Y.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=Y.slice(0,G).trim(),W=Y.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}J[K]=W}else{let K=Object.keys(J).filter((W)=>!Z||!(W in Z)).length;J[K===0?"value":`arg${K}`]=Y}}return J}var wz,Nz;var h3=b(()=>{wz=new Map,Nz=new Map});function u3($,Z=I5,J={},Y){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${V$($,{...J,w:X,fm:Y})} ${X}w`}).join(", ")}function S2($,Z,J=Mz,Y={},X){return J.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${V$($,{...Y,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function m3($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let Y=Object.entries($).map(([X,Q])=>{let G=/^\d+$/.test(X)?`${X}px`:X;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((X,Q)=>X.numericBp-Q.numericBp).map(({bp:X,size:Q})=>`(max-width: ${X}) ${Q}`);return Y.push(Z),Y.join(", ")}function V$($,Z={}){let J=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(J.length===0)return $;let Y=J.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${Y}`}function d3($){return Tz[$]||"application/octet-stream"}var I5,Mz,F$,Tz;var p3=b(()=>{I5=[320,480,640,768,1024,1280,1536,1920,2560],Mz=[1,1.5,2,3],F$=["avif","webp","jpeg"],Tz={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function Dz(){try{return await import("ts-images")}catch{return null}}async function kz($,Z={}){let J={...Iz,...Z},Y=await Dz();if(Y)try{return await Ez($,J,Y)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return bz($,J)}async function Ez($,Z,J){let{generatePlaceholder:Y,generateThumbHash:X}=J,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 X($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await Y($,{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 bz($,Z){let J=Z.width||20,Y=Z.height||J,X="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${Y}" viewBox="0 0 ${J} ${Y}"><rect fill="#e5e7eb" width="${J}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:J,height:Y,aspectRatio:J/Y,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function y2($,Z,J={}){let Y=J.transitionDuration||300,X=J.easing||"ease-out";return`
|
|
8766
8766
|
#${$} {
|
|
8767
8767
|
--stx-img-transition-duration: ${Y}ms;
|
|
8768
8768
|
--stx-img-transition-easing: ${X};
|
|
@@ -8779,7 +8779,7 @@ ${Z0.dim}${K}${Z0.reset}
|
|
|
8779
8779
|
#${$}.stx-img-loaded img {
|
|
8780
8780
|
opacity: 1;
|
|
8781
8781
|
}
|
|
8782
|
-
`.trim()}async function
|
|
8782
|
+
`.trim()}async function P2($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(l3.has(J))return l3.get(J);let Y=await kz($,Z);return l3.set(J,Y),Y}var Iz,c3,l3;var C2=b(()=>{Iz={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},c3=`
|
|
8783
8783
|
.stx-img-placeholder {
|
|
8784
8784
|
position: relative;
|
|
8785
8785
|
overflow: hidden;
|
|
@@ -8808,8 +8808,8 @@ ${Z0.dim}${K}${Z0.reset}
|
|
|
8808
8808
|
filter: blur(0);
|
|
8809
8809
|
transform: scale(1);
|
|
8810
8810
|
}
|
|
8811
|
-
`.trim();l3=new Map});import{createHash as v2}from"crypto";import{readFile as bz,stat as x2}from"fs/promises";async function v0($){try{let Z=await bz($);return v2("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function C2($){return v2("sha256").update($).digest("hex").slice(0,16)}function D4($,Z){let J=JSON.stringify(Z,Object.keys(Z).sort());return`${C2($)}-${C2(J)}`}async function i3($){try{return(await x2($)).mtimeMs}catch{return 0}}async function E0($){try{return await x2($),!0}catch{return!1}}var $5=()=>{};import{mkdir as Sz,readFile as yz,writeFile as Pz,readdir as Fw,rm as Cz,stat as Vw}from"fs/promises";import{join as g2,dirname as vz}from"path";async function xz($){try{await Sz($,{recursive:!0})}catch{}}function h2($,Z,J){return g2($,J,`${Z}.json`)}async function f2($,Z,J){if((Date.now()-$.createdAt)/86400000>J)return!1;if(await i3(Z)!==$.srcMtime)return!1;return!0}async function k4($,Z,J,Y=n3){if(!Y.enabled)return null;let X=D4($,Z),Q=D5.get(X);if(Q){if(await f2(Q,$,Y.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;D5.delete(X)}let G=h2(Y.directory,X,J);if(await E0(G))try{let K=await yz(G,"utf-8"),W=JSON.parse(K);if(await f2(W,$,Y.maxAge))return W.lastAccessedAt=Date.now(),D5.set(X,W),W.data}catch{}return null}async function E4($,Z,J,Y,X=n3){if(!X.enabled)return;let Q=D4($,Z),G=await v0($),K=await i3($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:D4("",Z),data:J,createdAt:Date.now(),lastAccessedAt:Date.now()};D5.set(Q,W);let q=h2(X.directory,Q,Y);try{await xz(vz(q)),await Pz(q,JSON.stringify(W,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function b4($,Z=n3){if($==="all")D5.clear();else D5.clear();let J=$==="all"?["image","video"]:[$];for(let Y of J){let X=g2(Z.directory,Y);try{await Cz(X,{recursive:!0,force:!0})}catch{}}}var D5,n3;var o3=b(()=>{$5();D5=new Map,n3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class y4{config;constructor($={}){this.config={...fz,...$}}async get($,Z){return k4($,Z,"image",this.config)}async set($,Z,J){return E4($,Z,J,"image",this.config)}async clear(){return b4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function s3($){if(!S4)S4=new y4($);else if($)S4.updateConfig($);return S4}async function P4($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return s3(Y).get($,Z)}async function C4($,Z,J,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return s3(X).set($,Z,J)}async function u2(){return s3().clear()}var fz,S4=null;var r3=b(()=>{o3();fz={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as gz,basename as hz,extname as uz,join as mz}from"path";import{mkdir as dz}from"fs/promises";async function a3(){try{return await import("ts-images")}catch{return null}}function m2($){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 pz($,Z){let J=Z?m2(Z):m2("web"),Y=$.formatQuality||{};return{jpeg:{...J.jpeg,...Y.jpeg},png:{...J.png,...Y.png},webp:{...J.webp,...Y.webp},avif:{...J.avif,...Y.avif}}}async function d2($,Z,J){let Y=await a3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await P4($,Z,J);if(X)return X;try{let Q=gz($);if(!await E0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=pz(J,Z.preset),K=J.outputDir||"dist/images",W=J.baseUrl||"/images";await dz(K,{recursive:!0});let q=await v0(Q),z=hz($,uz($)),U=Z.outputFormat?[Z.outputFormat]:J.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:q},H=null;if(Z.transformations&&Z.transformations.length>0)H=await t3(Q,Z.transformations,Y);for(let B of U){let _=G[B]||{},O=`${z}-${q}.${B}`,V=mz(K,O);try{let F=await Y.optimizeImage({input:H||Q,output:V,format:B,quality:_.quality,progressive:_.progressive});if(F){if(j.variants.push({path:V,url:`${W}/${O}`,width:F.width||0,height:F.height||0,format:B,size:F.outputSize||0}),!j.originalWidth&&F.width)j.originalWidth=F.width,j.originalHeight=F.height}}catch(F){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${F}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await Y.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await Y.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await C4($,Z,j,J),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function p2($,Z,J,Y){let X=await a3();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:Y,format:Z,quality:J}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function t3($,Z,J){let Y=J||await a3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await Y.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await Y.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await Y.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await Y.sharpen(X,G.amount);break;case"grayscale":X=await Y.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await Y.rotate(X,G.angle);break;case"flip":X=await Y.flip(X);break;case"flop":X=await Y.flop(X);break;case"brightness":if(G.value!==void 0)X=await Y.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await Y.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await Y.saturation(X,G.value);break}}return await Y.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var l2=b(()=>{$5();r3()});import{resolve as lz,basename as cz,extname as iz,join as nz}from"path";import{mkdir as oz}from"fs/promises";async function sz(){try{return await import("ts-images")}catch{return null}}async function c2($,Z,J){let Y=await sz();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=lz($);if(!await E0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||J.breakpoints||rz,G=Z.formats||J.defaultFormats||["avif","webp","jpeg"],K=J.outputDir||"dist/images",W=J.baseUrl||"/images";await oz(K,{recursive:!0});let q=await v0(X),z=cz($,iz($)),U=J.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let _=[];for(let O of Q){let V=`${z}-${O}w-${q}.${B}`,F=nz(K,V),L=`${W}/${V}`;try{let w=U[B]?.quality||80;if(await E0(F)){j.byFormat[B].push({path:F,url:L,width:O,height:0,format:B,size:0}),_.push(`${L} ${O}w`);continue}let N=await Y.processImage({input:X,output:F,format:B,quality:w,resize:{width:O}});if(N)j.byFormat[B].push({path:F,url:L,width:O,height:N.height||Math.round(O*(N.height||1)/(N.width||1)),format:B,size:N.outputSize||0}),_.push(`${L} ${O}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${O}w: ${w}`)}}j.srcsets[B]=_.join(", ")}let H=Z.placeholder||J.placeholderStrategy||"thumbhash";if(H!=="none")try{if(H==="thumbhash"){let B=await Y.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await Y.generatePlaceholder(X,{strategy:H,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:H}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||az(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function az($){let Z=[...$].sort((Y,X)=>Y-X),J=[];for(let Y=0;Y<Z.length-1;Y++){let X=Z[Y];J.push(`(max-width: ${X}px) ${X}px`)}return J.push(`${Z[Z.length-1]}px`),J.join(", ")}function i2($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((J)=>J.dpr).map((J)=>`${J.url} ${J.dpr}x`).join(", ");return $.map((J)=>`${J.url} ${J.width}w`).join(", ")}var rz;var n2=b(()=>{$5();rz=[320,480,640,768,1024,1280,1536,1920]});var o2={};t(o2,{setCachedImageResult:()=>C4,processImage:()=>d2,optimizeImage:()=>p2,getCachedImageResult:()=>P4,generateSrcset:()=>i2,generateResponsiveVariants:()=>c2,clearImageCache:()=>u2,applyTransformations:()=>t3,ImageProcessorCache:()=>y4});var s2=b(()=>{l2();n2();r3()});async function tz(){try{return await Promise.resolve().then(() => (s2(),o2))}catch($){if(!r2)console.warn("[stx-media] Image processor not available, some features disabled:",$),r2=!0;return null}}async function v4($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return JU(Y,J)}if(J.processedResult?.processed)return J6($,J.processedResult,Z);if(J.responsiveVariants)return $J($,J.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=I5,dpr:z,formats:U=F$,quality:j=e3,params:H={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:V=!1,loading:F=V?"eager":f4,decoding:L=x4,fetchpriority:w,objectFit:N,objectPosition:R,crossorigin:A,referrerpolicy:M}=$,T=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return ZU($);let P,C,x=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!V)try{P=await y2(X,{strategy:B,..._}),C=S2(x,P,_)}catch{}let f=z!==void 0&&G!==void 0,d;if(f)d=$U($,x,P,Z);else d=await ez($,x,P,Z);let $0;if(V){let N0=U.includes("webp")?"webp":U[0],u=u3(X,q,{...H,q:j},N0),a=typeof W==="object"?m3(W):W||"100vw";$0=`<link rel="preload" as="image" imagesrcset="${u}" imagesizes="${a}" />`}let P0=[];if(!a2&&B!=="none")P0.push(c3),a2=!0;if(C)P0.push(C);let B0=O?e2(x):void 0;return{html:d,preloadLink:$0,css:P0.length>0?P0.join(`
|
|
8812
|
-
`):void 0,script:B0}}async function
|
|
8811
|
+
`.trim();l3=new Map});import{createHash as x2}from"crypto";import{readFile as Sz,stat as f2}from"fs/promises";async function v0($){try{let Z=await Sz($);return x2("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function v2($){return x2("sha256").update($).digest("hex").slice(0,16)}function D4($,Z){let J=JSON.stringify(Z,Object.keys(Z).sort());return`${v2($)}-${v2(J)}`}async function i3($){try{return(await f2($)).mtimeMs}catch{return 0}}async function E0($){try{return await f2($),!0}catch{return!1}}var $5=()=>{};import{mkdir as yz,readFile as Pz,writeFile as Cz,readdir as Vw,rm as vz,stat as Lw}from"fs/promises";import{join as h2,dirname as xz}from"path";async function fz($){try{await yz($,{recursive:!0})}catch{}}function u2($,Z,J){return h2($,J,`${Z}.json`)}async function g2($,Z,J){if((Date.now()-$.createdAt)/86400000>J)return!1;if(await i3(Z)!==$.srcMtime)return!1;return!0}async function k4($,Z,J,Y=n3){if(!Y.enabled)return null;let X=D4($,Z),Q=D5.get(X);if(Q){if(await g2(Q,$,Y.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;D5.delete(X)}let G=u2(Y.directory,X,J);if(await E0(G))try{let K=await Pz(G,"utf-8"),W=JSON.parse(K);if(await g2(W,$,Y.maxAge))return W.lastAccessedAt=Date.now(),D5.set(X,W),W.data}catch{}return null}async function E4($,Z,J,Y,X=n3){if(!X.enabled)return;let Q=D4($,Z),G=await v0($),K=await i3($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:D4("",Z),data:J,createdAt:Date.now(),lastAccessedAt:Date.now()};D5.set(Q,W);let q=u2(X.directory,Q,Y);try{await fz(xz(q)),await Cz(q,JSON.stringify(W,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function b4($,Z=n3){if($==="all")D5.clear();else D5.clear();let J=$==="all"?["image","video"]:[$];for(let Y of J){let X=h2(Z.directory,Y);try{await vz(X,{recursive:!0,force:!0})}catch{}}}var D5,n3;var o3=b(()=>{$5();D5=new Map,n3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class y4{config;constructor($={}){this.config={...gz,...$}}async get($,Z){return k4($,Z,"image",this.config)}async set($,Z,J){return E4($,Z,J,"image",this.config)}async clear(){return b4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function s3($){if(!S4)S4=new y4($);else if($)S4.updateConfig($);return S4}async function P4($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return s3(Y).get($,Z)}async function C4($,Z,J,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return s3(X).set($,Z,J)}async function m2(){return s3().clear()}var gz,S4=null;var r3=b(()=>{o3();gz={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as hz,basename as uz,extname as mz,join as dz}from"path";import{mkdir as pz}from"fs/promises";async function a3(){try{return await import("ts-images")}catch{return null}}function d2($){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 lz($,Z){let J=Z?d2(Z):d2("web"),Y=$.formatQuality||{};return{jpeg:{...J.jpeg,...Y.jpeg},png:{...J.png,...Y.png},webp:{...J.webp,...Y.webp},avif:{...J.avif,...Y.avif}}}async function p2($,Z,J){let Y=await a3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await P4($,Z,J);if(X)return X;try{let Q=hz($);if(!await E0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=lz(J,Z.preset),K=J.outputDir||"dist/images",W=J.baseUrl||"/images";await pz(K,{recursive:!0});let q=await v0(Q),z=uz($,mz($)),U=Z.outputFormat?[Z.outputFormat]:J.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:q},H=null;if(Z.transformations&&Z.transformations.length>0)H=await t3(Q,Z.transformations,Y);for(let B of U){let _=G[B]||{},O=`${z}-${q}.${B}`,V=dz(K,O);try{let F=await Y.optimizeImage({input:H||Q,output:V,format:B,quality:_.quality,progressive:_.progressive});if(F){if(j.variants.push({path:V,url:`${W}/${O}`,width:F.width||0,height:F.height||0,format:B,size:F.outputSize||0}),!j.originalWidth&&F.width)j.originalWidth=F.width,j.originalHeight=F.height}}catch(F){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${F}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await Y.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await Y.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await C4($,Z,j,J),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function l2($,Z,J,Y){let X=await a3();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:Y,format:Z,quality:J}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function t3($,Z,J){let Y=J||await a3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await Y.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await Y.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await Y.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await Y.sharpen(X,G.amount);break;case"grayscale":X=await Y.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await Y.rotate(X,G.angle);break;case"flip":X=await Y.flip(X);break;case"flop":X=await Y.flop(X);break;case"brightness":if(G.value!==void 0)X=await Y.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await Y.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await Y.saturation(X,G.value);break}}return await Y.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var c2=b(()=>{$5();r3()});import{resolve as cz,basename as iz,extname as nz,join as oz}from"path";import{mkdir as sz}from"fs/promises";async function rz(){try{return await import("ts-images")}catch{return null}}async function i2($,Z,J){let Y=await rz();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=cz($);if(!await E0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||J.breakpoints||az,G=Z.formats||J.defaultFormats||["avif","webp","jpeg"],K=J.outputDir||"dist/images",W=J.baseUrl||"/images";await sz(K,{recursive:!0});let q=await v0(X),z=iz($,nz($)),U=J.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let _=[];for(let O of Q){let V=`${z}-${O}w-${q}.${B}`,F=oz(K,V),L=`${W}/${V}`;try{let w=U[B]?.quality||80;if(await E0(F)){j.byFormat[B].push({path:F,url:L,width:O,height:0,format:B,size:0}),_.push(`${L} ${O}w`);continue}let N=await Y.processImage({input:X,output:F,format:B,quality:w,resize:{width:O}});if(N)j.byFormat[B].push({path:F,url:L,width:O,height:N.height||Math.round(O*(N.height||1)/(N.width||1)),format:B,size:N.outputSize||0}),_.push(`${L} ${O}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${O}w: ${w}`)}}j.srcsets[B]=_.join(", ")}let H=Z.placeholder||J.placeholderStrategy||"thumbhash";if(H!=="none")try{if(H==="thumbhash"){let B=await Y.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await Y.generatePlaceholder(X,{strategy:H,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:H}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||tz(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function tz($){let Z=[...$].sort((Y,X)=>Y-X),J=[];for(let Y=0;Y<Z.length-1;Y++){let X=Z[Y];J.push(`(max-width: ${X}px) ${X}px`)}return J.push(`${Z[Z.length-1]}px`),J.join(", ")}function n2($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((J)=>J.dpr).map((J)=>`${J.url} ${J.dpr}x`).join(", ");return $.map((J)=>`${J.url} ${J.width}w`).join(", ")}var az;var o2=b(()=>{$5();az=[320,480,640,768,1024,1280,1536,1920]});var s2={};t(s2,{setCachedImageResult:()=>C4,processImage:()=>p2,optimizeImage:()=>l2,getCachedImageResult:()=>P4,generateSrcset:()=>n2,generateResponsiveVariants:()=>i2,clearImageCache:()=>m2,applyTransformations:()=>t3,ImageProcessorCache:()=>y4});var r2=b(()=>{c2();o2();r3()});async function ez(){try{return await Promise.resolve().then(() => (r2(),s2))}catch($){if(!a2)console.warn("[stx-media] Image processor not available, some features disabled:",$),a2=!0;return null}}async function v4($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return YU(Y,J)}if(J.processedResult?.processed)return J6($,J.processedResult,Z);if(J.responsiveVariants)return ZJ($,J.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=I5,dpr:z,formats:U=F$,quality:j=e3,params:H={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:V=!1,loading:F=V?"eager":f4,decoding:L=x4,fetchpriority:w,objectFit:N,objectPosition:R,crossorigin:A,referrerpolicy:M}=$,T=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return JU($);let P,C,x=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!V)try{P=await P2(X,{strategy:B,..._}),C=y2(x,P,_)}catch{}let f=z!==void 0&&G!==void 0,d;if(f)d=ZU($,x,P,Z);else d=await $U($,x,P,Z);let $0;if(V){let N0=U.includes("webp")?"webp":U[0],u=u3(X,q,{...H,q:j},N0),a=typeof W==="object"?m3(W):W||"100vw";$0=`<link rel="preload" as="image" imagesrcset="${u}" imagesizes="${a}" />`}let P0=[];if(!t2&&B!=="none")P0.push(c3),t2=!0;if(C)P0.push(C);let B0=O?$J(x):void 0;return{html:d,preloadLink:$0,css:P0.length>0?P0.join(`
|
|
8812
|
+
`):void 0,script:B0}}async function $U($,Z,J,Y){let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=I5,formats:z=F$,quality:U=e3,params:j={},lazy:H=!0,priority:B=!1,loading:_=B?"eager":f4,decoding:O=x4,fetchpriority:V,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:N}=$,R=$.class,A=$.style,M=$.data||{},T=typeof W==="object"?m3(W):W||"100vw",I=[];for(let y of z){let S=u3(X,q,{...j,q:U},y),P=d3(y);if(H&&!B)I.push(` <source type="${P}" data-srcset="${S}" data-sizes="${T}" />`);else I.push(` <source type="${P}" srcset="${S}" sizes="${T}" />`)}let E=$6({src:V$(X,{...j,q:U}),alt:Q,width:G,height:K,loading:B?void 0:_,decoding:O,fetchpriority:B?"high":V,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:N,className:e2(R,J),style:Z6(A,F,L,J),lazy:H&&!B,data:M}),D;if(J){let y=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
|
|
8813
8813
|
<picture>
|
|
8814
8814
|
${I.join(`
|
|
8815
8815
|
`)}
|
|
@@ -8819,9 +8819,9 @@ ${I.join(`
|
|
|
8819
8819
|
${I.join(`
|
|
8820
8820
|
`)}
|
|
8821
8821
|
<img ${E} />
|
|
8822
|
-
</picture>`;return D}function
|
|
8822
|
+
</picture>`;return D}function ZU($,Z,J,Y){let{src:X,alt:Q,width:G,height:K,dpr:W=[1,2,3],quality:q=e3,params:z={},lazy:U=!0,priority:j=!1,loading:H=j?"eager":f4,decoding:B=x4,fetchpriority:_,objectFit:O,objectPosition:V,crossorigin:F,referrerpolicy:L}=$,w=$.class,N=$.style,R=$.data||{},A=typeof G==="number"?G:Number.parseInt(String(G),10),M=S2(X,A,W,{...z,q}),T=$6({src:V$(X,{...z,w:A,q}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:B,fetchpriority:j?"high":_,objectFit:O,objectPosition:V,crossorigin:F,referrerpolicy:L,className:e2(w,J),style:Z6(N,O,V,J),lazy:U&&!j,data:R}),I=U&&!j?`data-srcset="${M}"`:`srcset="${M}"`;if(J){let E=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
|
|
8823
8823
|
<img ${T} ${I} />
|
|
8824
|
-
</div>`}return`<img ${Z?`id="${Z}" `:""}${T} ${I} />`}function
|
|
8824
|
+
</div>`}return`<img ${Z?`id="${Z}" `:""}${T} ${I} />`}function JU($){let{src:Z,alt:J,width:Y,height:X,loading:Q=f4,decoding:G=x4,fetchpriority:K,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U,priority:j=!1}=$,H=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${$6({src:Z,alt:J,width:Y,height:X,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U,className:H,style:Z6(B,W,q),id:_,data:O})} />`}}function $6($){let Z=[];if($.lazy)Z.push(`data-src="${$1($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${$1($.src)}"`);if(Z.push(`alt="${$1($.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="${$1($.className)}"`);if($.style)Z.push(`style="${$1($.style)}"`);if($.id)Z.push(`id="${$1($.id)}"`);if($.data)for(let[J,Y]of Object.entries($.data))Z.push(`data-${J}="${$1(Y)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function e2($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function Z6($,Z,J,Y){let X=[];if(Z)X.push(`object-fit: ${Z}`);if(J)X.push(`object-position: ${J}`);if(Y)X.push("opacity: 0; transition: opacity 300ms ease-out");if($)X.push($);return X.join("; ")}function $1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function $J($){return`
|
|
8825
8825
|
(function() {
|
|
8826
8826
|
const container = document.getElementById('${$}');
|
|
8827
8827
|
if (!container) return;
|
|
@@ -8858,7 +8858,7 @@ ${I.join(`
|
|
|
8858
8858
|
|
|
8859
8859
|
observer.observe(container);
|
|
8860
8860
|
})();
|
|
8861
|
-
`.trim()}async function
|
|
8861
|
+
`.trim()}async function YU($,Z){let J=await ez();if(!J)return v4({...$,process:!1},Z);let Y=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await J.generateResponsiveVariants($.src,$,Y);if(Q)return ZJ($,Q,Z)}else{let Q=await J.processImage($.src,$,Y);if(Q.processed)return J6($,Q,Z)}return v4({...$,process:!1},Z)}async function J6($,Z,J){let{alt:Y,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U}=$,j=$.class,H=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],V=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],F=V?.url||$.src,L=O.filter((C)=>C.format===(V?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of O){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let N=[],R=["avif","webp","jpeg","png"];for(let C of R){let x=w.get(C);if(x&&x.length>0){let f=x.map(($0)=>`${$0.url} ${$0.width}w`).join(", "),d=d3(C);if(G&&!K)N.push(` <source type="${d}" data-srcset="${f}" />`);else N.push(` <source type="${d}" srcset="${f}" />`)}}let A=[];if(G&&!K){if(A.push(`data-src="${$1(F)}"`),A.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)A.push(`data-srcset="${L}"`)}else if(A.push(`src="${$1(F)}"`),L)A.push(`srcset="${L}"`);A.push(`alt="${$1(Y)}"`);let M=X||Z.originalWidth,T=Q||Z.originalHeight;if(M)A.push(`width="${M}"`);if(T)A.push(`height="${T}"`);if(!K)A.push(`loading="${G?"lazy":"eager"}"`);if(A.push('decoding="async"'),K)A.push('fetchpriority="high"');if(z)A.push(`crossorigin="${z}"`);if(U)A.push(`referrerpolicy="${U}"`);let I=[];if(W)I.push(`object-fit: ${W}`);if(q)I.push(`object-position: ${q}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(H)I.push(H);if(I.length>0)A.push(`style="${I.join("; ")}"`);let E=[];if(j)E.push(j);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)A.push(`class="${E.join(" ")}"`);if(G&&!K)A.push("data-stx-lazy");for(let[C,x]of Object.entries(_))A.push(`data-${C}="${$1(x)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${C}">
|
|
8862
8862
|
<picture>
|
|
8863
8863
|
${N.join(`
|
|
8864
8864
|
`)}
|
|
@@ -8868,12 +8868,12 @@ ${N.join(`
|
|
|
8868
8868
|
${N.join(`
|
|
8869
8869
|
`)}
|
|
8870
8870
|
<img ${A.join(" ")} />
|
|
8871
|
-
</picture>`;let y=[];if(Z.placeholder)y.push(c3);let S=G
|
|
8872
|
-
`):void 0,script:S}}async function
|
|
8871
|
+
</picture>`;let y=[];if(Z.placeholder)y.push(c3);let S=G?$J(B):void 0,P;if(K&&L)P=`<link rel="preload" as="image" imagesrcset="${L}" />`;return{html:D,preloadLink:P,css:y.length>0?y.join(`
|
|
8872
|
+
`):void 0,script:S}}async function ZJ($,Z,J){let Y={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[X,Q]of Object.entries(Z.byFormat))if(Q)Y.variants.push(...Q);return J6($,Y,J)}var a2=!1,e3=80,x4="async",f4="lazy",t2=!1;var JJ=b(()=>{p3();C2()});function XU(){return I4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,Y)=>{let{src:X,alt:Q,options:G}=QU($,Z,J);if(!X)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:X,alt:Q||"",widths:G.widths||I5,formats:G.formats||F$,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},W=J.__isDev||!1,q=await v4(K,{isDev:W}),z=q.html;if(q.preloadLink)z=q.preloadLink+`
|
|
8873
8873
|
`+z;if(q.css)z+=`
|
|
8874
8874
|
<style>${q.css}</style>`;if(q.script)z+=`
|
|
8875
|
-
<script>${q.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function
|
|
8876
|
-
`)}async function n4($,Z,J,Y,X){let Q=await
|
|
8875
|
+
<script>${q.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function QU($,Z,J){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let Y=$.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=GU(Y),Q=Y6(X[0],J)||"",G=Y6(X[1],J)||"",K={};if(X[2]){let W=Y6(X[2],J);if(typeof W==="object"&&W!==null)K=W;else if(typeof X[2]==="string")try{K=JSON.parse(X[2])}catch{}}return{src:Q,alt:G,options:K}}function GU($){let Z=[],J="",Y=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],q=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&q!=="\\"){if(!Y)Y=!0,X=W;else if(W===X)Y=!1,X="";else J+=W;continue}if(!Y){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=W}if(J.trim())Z.push(J.trim());return Z}function Y6($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let Y=Z[J];if(Y!==void 0)return Y}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var YJ;var XJ=b(()=>{h3();JJ();p3();YJ=XU()});class h4{config;constructor($={}){this.config={...KU,...$}}async get($,Z){return k4($,Z,"video",this.config)}async set($,Z,J){return E4($,Z,J,"video",this.config)}async clear(){return b4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function X6($){if(!g4)g4=new h4($);else if($)g4.updateConfig($);return g4}async function u4($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return X6(Y).get($,Z)}async function m4($,Z,J,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return X6(X).set($,Z,J)}async function QJ(){return X6().clear()}var KU,g4=null;var Q6=b(()=>{o3();KU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as G6,basename as K6,extname as W6,join as d4}from"path";import{mkdir as q6}from"fs/promises";async function z6(){try{return await import("ts-videos")}catch{return null}}async function p4($,Z,J,Y){let X=await z6();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=G6($);if(!await E0(Q))return null;await q6(J,{recursive:!0});let G=await v0(Q),K=K6($,W6($)),W=Z.format||"webp",q=Z.timestamp||0,z=`${K}-poster-${G}.${W}`,U=d4(J,z),j=await X.extractThumbnails(Q,{timestamps:[q],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:J,outputPattern:z.replace(`.${W}`,"")});if(j&&j.length>0){let H=j[0];return{path:U,url:`${Y}/${z}`,width:H.width||Z.width||1280,height:H.height||720,timestamp:q,size:H.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function l4($,Z,J,Y){let X=await z6();if(!X)return[];try{let Q=G6($);if(!await E0(Q))return[];await q6(J,{recursive:!0});let G=await v0(Q),K=K6($,W6($)),W=Z.format||"webp",U=(await new X.Input(Q).getInfo()).duration||60,j=Z.count||10,H=Z.interval||U/j,B=[];for(let O=0;O<j&&O*H<U;O++)B.push(O*H);let _=await X.extractThumbnails(Q,{timestamps:B,width:Z.width||320,format:W,quality:Z.quality||80,outputDir:J,outputPattern:`${K}-thumb-${G}`});if(_&&_.length>0)return _.map((O,V)=>({path:O.path||d4(J,`${K}-thumb-${G}-${V}.${W}`),url:`${Y}/${K}-thumb-${G}-${V}.${W}`,width:O.width||Z.width||320,height:O.height||180,timestamp:B[V],size:O.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function GJ($,Z,J,Y){let X=await z6();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=G6($);if(!await E0(Q))return null;await q6(J,{recursive:!0});let G=await v0(Q),K=K6($,W6($)),z=(await new X.Input(Q).getInfo()).duration||60,U=Z.columns||10,j=Z.interval||5,H=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,_=Z.format||"jpeg",O=Math.ceil(z/j),V=Math.ceil(O/U),F=`${K}-sprite-${G}.${_}`,L=d4(J,F),w=[];for(let R=0;R<O;R++)w.push(R*j);let N=await X.extractThumbnails(Q,{timestamps:w,width:H,height:B,format:_,quality:Z.quality||70,outputDir:d4(J,".temp")});if(!N||N.length===0)return null;try{let R=await import("ts-images"),A=U*H,M=V*B,T=await R.createSprite({images:N.map((I)=>I.path),columns:U,padding:0,outputPath:L,format:_,quality:Z.quality||70});return{url:`${Y}/${F}`,path:L,columns:U,rows:V,thumbnailWidth:H,thumbnailHeight:B,interval:j,totalFrames:O}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var U6=b(()=>{$5()});import{resolve as WJ,basename as qJ,extname as zJ,join as Z5}from"path";import{mkdir as c4,writeFile as UJ}from"fs/promises";async function jJ(){try{return await import("ts-videos")}catch{return null}}async function i4($,Z,J,Y,X){let Q=await jJ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=WJ($);if(!await E0(G))return null;let K=await v0(G),W=qJ($,zJ($)),q=Z5(J,`${W}-${K}-hls`);await c4(q,{recursive:!0});let z=Z.length>0?Z:BJ,U=X?.segmentDuration||6,B=(await new Q.Input(G).getInfo()).duration||0,_=[],O=0;for(let L of z){let w=Z5(q,L.label);await c4(w,{recursive:!0});let N=`${L.label}.m3u8`,R=Z5(w,N);try{let A=await Q.generateHLS(G,{outputDir:w,segmentDuration:U,width:L.width,height:L.height,videoBitrate:L.bitrate,audioBitrate:L.audioBitrate,playlistName:L.label});if(A)_.push({quality:L,url:`${Y}/${W}-${K}-hls/${L.label}/${N}`,path:R}),O+=A.segmentCount||Math.ceil(B/U)}catch(A){console.warn(`[stx-media] Failed to generate HLS for ${L.label}: ${A}`)}}if(_.length===0)return null;let V=Z5(q,"master.m3u8"),F=WU(_,Y,W,K);return await UJ(V,F),{manifestUrl:`${Y}/${W}-${K}-hls/master.m3u8`,manifestPath:V,playlists:_,segmentCount:O,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function WU($,Z,J,Y){let X=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),W=`${G.width}x${G.height||Math.round(G.width*9/16)}`;X.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${W},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return X.join(`
|
|
8876
|
+
`)}async function n4($,Z,J,Y,X){let Q=await jJ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=WJ($);if(!await E0(G))return null;let K=await v0(G),W=qJ($,zJ($)),q=Z5(J,`${W}-${K}-dash`);await c4(q,{recursive:!0});let z=Z.length>0?Z:BJ,U=X?.segmentDuration||4,j=X?.minBufferTime||2,_=(await new Q.Input(G).getInfo()).duration||0,O=[],V=[];for(let N of z){let R=Z5(q,N.label);await c4(R,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:R,segmentDuration:U,width:N.width,height:N.height,videoBitrate:N.bitrate,audioBitrate:N.audioBitrate})){if(O.push({bandwidth:N.bitrate,width:N.width,height:N.height||Math.round(N.width*9/16),url:`${Y}/${W}-${K}-dash/${N.label}/video`}),N.audioBitrate)V.push({bandwidth:N.audioBitrate,url:`${Y}/${W}-${K}-dash/${N.label}/audio`})}}catch(A){console.warn(`[stx-media] Failed to generate DASH for ${N.label}: ${A}`)}}if(O.length===0)return null;let F=Z5(q,"manifest.mpd"),L=qU(O,V,_,U,j);await UJ(F,L);let w=[{type:"video",representations:O}];if(V.length>0)w.push({type:"audio",representations:V});return{manifestUrl:`${Y}/${W}-${K}-dash/manifest.mpd`,manifestPath:F,adaptationSets:w,duration:_}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function qU($,Z,J,Y,X){let Q=KJ(J),G=KJ(X),K=`<?xml version="1.0" encoding="UTF-8"?>
|
|
8877
8877
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
8878
8878
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
8879
8879
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -8899,7 +8899,7 @@ ${N.join(`
|
|
|
8899
8899
|
</Representation>
|
|
8900
8900
|
`}K+=` </AdaptationSet>
|
|
8901
8901
|
`}return K+=` </Period>
|
|
8902
|
-
</MPD>`,K}function
|
|
8902
|
+
</MPD>`,K}function KJ($){let Z=Math.floor($/3600),J=Math.floor($%3600/60),Y=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(J>0)X+=`${J}M`;return X+=`${Y}S`,X}var BJ;var j6=b(()=>{$5();BJ=[{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 HJ,basename as zU,extname as UU,join as jU}from"path";import{mkdir as BU}from"fs/promises";async function _J(){try{return await import("ts-videos")}catch{return null}}function HU($){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 _U($){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 B6($){let Z=await _J();if(!Z)return null;try{let J=HJ($),X=await new Z.Input(J).getInfo();return{duration:X.duration||0,width:X.width||0,height:X.height||0,frameRate:X.frameRate||0,bitrate:X.bitrate||0,codec:X.videoCodec||"",audioCodec:X.audioCodec}}catch(J){return console.warn(`[stx-media] Failed to analyze video: ${J}`),null}}async function OJ($,Z,J,Y){let X=await _J();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await u4($,Z,J);if(Q)return Q;try{let G=HJ($);if(!await E0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=J.outputDir||"dist/videos",W=J.baseUrl||"/videos";await BU(K,{recursive:!0});let q=await v0(G),z=zU($,UU($)),U={src:$,processed:!0,hash:q};Y?.({percentage:5,stage:"analyzing"}),U.metadata=await B6(G)||void 0;let j={};if(Z.quality)j.bitrate=HU(Z.quality);if(Z.platform)Object.assign(j,_U(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){Y?.({percentage:10,stage:"transcoding"});let H=`${z}-${q}.mp4`,B=jU(K,H);try{let _=await OU(G,B,j,X,(O)=>Y?.({percentage:10+O*0.5,stage:"transcoding"}));if(_)U.transcoded={path:B,url:`${W}/${H}`,duration:_.duration,size:_.size,video:{codec:j.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(_){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${_}`)}}if(Z.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let H=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await p4(G,H,K,W);if(B)U.poster=B}if(J.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let H=await l4(G,J.thumbnails,K,W);if(H.length>0)U.thumbnails=H}if(Z.streaming){Y?.({percentage:80,stage:"generating-manifests"});let H=typeof Z.streaming==="object"?Z.streaming:J.streaming||{format:"hls"};if(H.format==="hls"||H.format===void 0){let B=await i4(G,H.qualities||J.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,hls:B}}if(H.format==="dash"){let B=await n4(G,H.qualities||J.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,dash:B}}}if(Z.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await m4($,Z,U,J),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function OU($,Z,J,Y,X){try{let G=await new Y.Conversion($,Z,{videoCodec:J.codec,videoBitrate:J.bitrate,width:J.maxWidth,height:J.maxHeight,frameRate:J.frameRate,audioCodec:J.audioCodec,audioBitrate:J.audioBitrate,sampleRate:J.sampleRate,channels:J.channels}).run((K)=>{X?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||J.maxWidth||0,height:G.height||J.maxHeight||0,bitrate:G.bitrate||J.bitrate||0,frameRate:G.frameRate||J.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var FJ=b(()=>{$5();Q6();U6();j6()});var VJ={};t(VJ,{setCachedVideoResult:()=>m4,processVideo:()=>OJ,getCachedVideoResult:()=>u4,generateThumbnails:()=>l4,generateSpriteSheet:()=>GJ,generatePoster:()=>p4,generateHLSManifest:()=>i4,generateDASHManifest:()=>n4,clearVideoCache:()=>QJ,analyzeVideo:()=>B6,VideoProcessorCache:()=>h4});var LJ=b(()=>{FJ();U6();j6();Q6()});async function NJ(){try{return await Promise.resolve().then(() => (LJ(),VJ))}catch($){if(!wJ)console.warn("[stx-media] Video processor not available, some features disabled:",$),wJ=!0;return null}}async function o4($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return RU(Y,J)}if(J.processedResult?.processed)return TJ($,J.processedResult,Z);let X;if(Y.generatePoster&&Y.src&&!$.poster)X=await AU(Y,J);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:q=RJ,autoplay:z=!1,muted:U=!1,loop:j=!1,preload:H=AJ,playsinline:B=!0,lazy:_=!0,player:O="native",type:V,width:F,height:L,crossorigin:w,disablePictureInPicture:N=!1,disableRemotePlayback:R=!1}=$,A=X||K,M=$.class,T=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return LU($,Z);if(V&&V!=="video")return VU(Q||"",V,$);let E=G.length>0?G:Q?[{src:Q,type:MJ(Q)}]:[],D=[`id="${I}"`];if(q)D.push("controls");if(z)D.push("autoplay");if(U)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(N)D.push("disablepictureinpicture");if(R)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(_){if(D.push(`data-preload="${H}"`),D.push('preload="none"'),A)D.push(`data-poster="${T0(A)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${H}"`),A)D.push(`poster="${T0(A)}"`);if(F)D.push(`width="${F}"`);if(L)D.push(`height="${L}"`);if(M)D.push(`class="${T0(M)}"`);if(T)D.push(`style="${T0(T)}"`);let y=E.map((C)=>{return` <source ${_?`data-src="${T0(C.src)}"`:`src="${T0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
|
|
8903
8903
|
`),S=`<video ${D.join(" ")}>
|
|
8904
8904
|
${y}
|
|
8905
8905
|
Your browser does not support the video tag.
|
|
@@ -8938,9 +8938,9 @@ ${y}
|
|
|
8938
8938
|
|
|
8939
8939
|
observer.observe(video);
|
|
8940
8940
|
})();
|
|
8941
|
-
`.trim();return{html:S,script:P}}function
|
|
8941
|
+
`.trim();return{html:S,script:P}}function VU($,Z,J){let{width:Y=640,height:X=360}=J,Q=J.class,G=J.style,K=J.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,q=null;switch(Z){case"youtube":q=wU($),W=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=NU($),W=q?`https://player.vimeo.com/video/${q}`:$;break;case"dailymotion":q=$.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=$.split("/").pop()||"",W=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=$}let z=[`id="${K}"`,`src="${T0(W)}"`,`width="${Y}"`,`height="${X}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)z.push(`class="${T0(Q)}"`);if(G)z.push(`style="${T0(G)}"`);if(J.lazy)z.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
8942
8942
|
<iframe ${z.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
8943
|
-
</div>`}}function
|
|
8943
|
+
</div>`}}function LU($,Z={}){let{src:J,sources:Y=[],poster:X,controls:Q=!0,autoplay:G=!1,muted:K=!1,loop:W=!1,preload:q="metadata",playsinline:z=!0,lazy:U=!0,width:j,height:H}=$,B=$.class,_=$.style,O=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,V={src:Y.length>0?Y:J,autoplay:G,loop:W,muted:K,playsinline:z,preload:q,poster:X,controls:Q,title:$.title},F=["position: relative",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",H?`height: ${typeof H==="number"?H+"px":H}`:"",_||""].filter(Boolean).join("; "),L=`
|
|
8944
8944
|
<div
|
|
8945
8945
|
id="${O}"
|
|
8946
8946
|
class="ts-video-player${B?" "+T0(B):""}"
|
|
@@ -8977,7 +8977,7 @@ ${y}
|
|
|
8977
8977
|
|
|
8978
8978
|
// Load ts-video-player from CDN
|
|
8979
8979
|
var script = document.createElement('script');
|
|
8980
|
-
script.src = '${
|
|
8980
|
+
script.src = '${FU}';
|
|
8981
8981
|
script.onload = initPlayer;
|
|
8982
8982
|
script.onerror = function() {
|
|
8983
8983
|
console.error('[stx] Failed to load ts-video-player');
|
|
@@ -9107,7 +9107,7 @@ else {
|
|
|
9107
9107
|
.ts-video-player__play-button svg {
|
|
9108
9108
|
margin-left: 4px;
|
|
9109
9109
|
}
|
|
9110
|
-
`.trim();return{html:L,script:w,css:N}}function
|
|
9110
|
+
`.trim();return{html:L,script:w,css:N}}function MJ($){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 wU($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let J of Z){let Y=$.match(J);if(Y)return Y[1]}return null}function NU($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function T0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function RU($,Z){let J=await NJ();if(!J)return o4({...$,process:!1},Z);let Y=Z.tsVideosConfig,X=await J.processVideo($.src,$,Y,$.onProcessProgress);if(X.processed)return TJ($,X,Z);return o4({...$,process:!1},Z)}async function AU($,Z){let J=await NJ();if(!J||!$.src)return;let Y=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},X=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,Y,X.outputDir,X.baseUrl||"/videos"))?.url}function TJ($,Z,J){let{controls:Y=RJ,autoplay:X=!1,muted:Q=!1,loop:G=!1,preload:K=AJ,playsinline:W=!0,lazy:q=!0,width:z,height:U,crossorigin:j,disablePictureInPicture:H=!1,disableRemotePlayback:B=!1}=$,_=$.class,O=$.style,V=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,F=$.src,L=MJ(F);if(Z.transcoded)F=Z.transcoded.url,L="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)F=Z.streaming.hls.manifestUrl,L="application/x-mpegURL";else if(Z.streaming?.dash)F=Z.streaming.dash.manifestUrl,L="application/dash+xml"}let N=Z.poster?.url||$.poster,R=[`id="${V}"`];if(Y)R.push("controls");if(X)R.push("autoplay");if(Q)R.push("muted");if(G)R.push("loop");if(W)R.push("playsinline");if(H)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(j)R.push(`crossorigin="${j}"`);if(q){if(R.push(`data-preload="${K}"`),R.push('preload="none"'),N)R.push(`data-poster="${T0(N)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${K}"`),N)R.push(`poster="${T0(N)}"`);let A=z||Z.metadata?.width,M=U||Z.metadata?.height;if(A)R.push(`width="${A}"`);if(M)R.push(`height="${M}"`);if(_)R.push(`class="${T0(_)}"`);if(O)R.push(`style="${T0(O)}"`);let I=` <source ${q?`data-src="${T0(F)}"`:`src="${T0(F)}"`} type="${L}" />`,E=`<video ${R.join(" ")}>
|
|
9111
9111
|
${I}
|
|
9112
9112
|
Your browser does not support the video tag.
|
|
9113
9113
|
</video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${T0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
|
|
@@ -9156,9 +9156,9 @@ ${E}
|
|
|
9156
9156
|
width: 100%;
|
|
9157
9157
|
height: auto;
|
|
9158
9158
|
}
|
|
9159
|
-
`.trim();return{html:E,script:D,css:y}}var
|
|
9159
|
+
`.trim();return{html:E,script:D,css:y}}var wJ=!1,RJ=!0,AJ="metadata",FU="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var IJ=b(()=>{_6()});function DJ(){return I4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,Y)=>{let{src:X,options:Q}=MU($,Z,J);if(!X)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:X,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},W={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},q=await o4(G,W),z=q.html;if(q.css)z+=`
|
|
9160
9160
|
<style>${q.css}</style>`;if(q.script)z+=`
|
|
9161
|
-
<script>${q.script}</script>`;return z},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function
|
|
9161
|
+
<script>${q.script}</script>`;return z},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function MU($,Z,J){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let Y=$.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=TU(Y),Q=kJ(X[0],J)||"",G={};if(X[1]){let K=kJ(X[1],J);if(typeof K==="object"&&K!==null)G=K;else if(typeof X[1]==="string")try{G=JSON.parse(X[1])}catch{}}return{src:Q,options:G}}function TU($){let Z=[],J="",Y=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],q=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&q!=="\\"){if(!Y)Y=!0,X=W;else if(W===X)Y=!1,X="";else J+=W;continue}if(!Y){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=W}if(J.trim())Z.push(J.trim());return Z}function kJ($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let Y=Z[J];if(Y!==void 0)return Y}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var H6;var _6=b(()=>{h3();IJ();H6=DJ()});function IU($,Z){let J=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
|
|
9162
9162
|
${$}
|
|
9163
9163
|
</div>
|
|
9164
9164
|
<script>
|
|
@@ -9203,7 +9203,7 @@ ${E}
|
|
|
9203
9203
|
}
|
|
9204
9204
|
}
|
|
9205
9205
|
})();
|
|
9206
|
-
</script>`}function
|
|
9206
|
+
</script>`}function DU($,Z){let J=Z.pwa?.updates,Y=J?.message||"A new version is available. Reload to update?",X=J?.autoReload||!1,Q=$.trim().length>0,G=`
|
|
9207
9207
|
<div class="stx-pwa-update-banner" style="
|
|
9208
9208
|
position: fixed;
|
|
9209
9209
|
bottom: 0;
|
|
@@ -9314,7 +9314,7 @@ else {
|
|
|
9314
9314
|
// Also listen for custom event
|
|
9315
9315
|
window.addEventListener('pwa-update-available', showUpdate);
|
|
9316
9316
|
})();
|
|
9317
|
-
</script>`}function
|
|
9317
|
+
</script>`}function kU($,Z){let J=$.trim().length>0,Y=`
|
|
9318
9318
|
<div class="stx-offline-indicator" style="
|
|
9319
9319
|
position: fixed;
|
|
9320
9320
|
top: 16px;
|
|
@@ -9375,7 +9375,7 @@ else {
|
|
|
9375
9375
|
window.addEventListener('offline', updateStatus);
|
|
9376
9376
|
updateStatus();
|
|
9377
9377
|
})();
|
|
9378
|
-
</script>`}function
|
|
9378
|
+
</script>`}function EU($,Z){let J=Z.pwa?.push,Y=J?.vapidPublicKey||"",X=J?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
|
|
9379
9379
|
${$}
|
|
9380
9380
|
</div>
|
|
9381
9381
|
<script>
|
|
@@ -9457,33 +9457,33 @@ catch (error) {
|
|
|
9457
9457
|
init();
|
|
9458
9458
|
}
|
|
9459
9459
|
})();
|
|
9460
|
-
</script>`}var
|
|
9461
|
-
${$.message}`),Z&&$.line){let Q=
|
|
9460
|
+
</script>`}var bU,SU,yU,PU,EJ;var bJ=b(()=>{bU={name:"pwa.installButton",handler:($,Z,J,Y)=>{let X=J.__stx_options||{};return IU($,X)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},SU={name:"pwa.updatePrompt",handler:($,Z,J,Y)=>{let X=J.__stx_options||{};return DU($,X)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},yU={name:"pwa.offlineIndicator",handler:($,Z,J,Y)=>{let X=J.__stx_options||{};return kU($,X)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},PU={name:"pwa.pushSubscribe",handler:($,Z,J,Y)=>{let X=J.__stx_options||{};return EU($,X)},hasEndTag:!0,description:"Renders a push notification subscription button"},EJ=[bU,SU,yU,PU]});function O6($){for(let[Z,J]of Object.entries(o))if(J===$)return Z;return}var o;var s4=b(()=>{o={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 L$(){return!1}function w$(){return!L$()||process.env.STX_DEBUG==="true"}function r4(){return!1}import CU from"path";function a4(){return{...F6}}function t4($){if(!F6.showRelativePaths||!$)return $;let Z=F6.baseDir||process.cwd();try{let J=CU.relative(Z,$);return J.startsWith("..")?$:J}catch{return $}}var vU,F6,e4,J5,$7;var Z7=b(()=>{s4();vU={showRelativePaths:!1,enableAutoRecovery:w$(),logRecoveryWarnings:!0},F6={...vU};e4=class e4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,J,Y,X,Q,G){super($);this.code=Z;this.filePath=J;this.line=Y;this.column=X;this.context=Q;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=t4(this.filePath)}};J5=class J5 extends e4{constructor($,Z,J,Y,X,Q){super($,"stx_RUNTIME_ERROR",Z,J,Y,X,Q||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};$7=class $7 extends e4{isFatal=!0;constructor($,Z,J,Y,X,Q){super($,"stx_VALIDATION_ERROR",Z,J,Y,X,Q||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function yJ($){let{type:Z,message:J,code:Y,filePath:X,line:Q,column:G,template:K,offset:W,snippet:q,suggestion:z,format:U="text"}=$,j=Q,H=G;if(!j&&K&&W!==void 0){let F=mU(K,W);j=F.line,H=F.column}let B=X?t4(X):void 0,_=Y?O6(Y):void 0,O={type:Z,code:Y,codeName:_,message:J,filePath:B,line:j,column:H,snippet:q,suggestion:z,timestamp:new Date().toISOString()},V;switch(U){case"html":V=fU(O);break;case"json":V=JSON.stringify(O,null,2);break;case"console":V=gU(O,K,W);break;case"text":default:V=xU(O,K,W);break}return{formatted:V,data:O}}function xU($,Z,J){let Y=[],X=$.code?` [${$.codeName||$.code}]`:"";if(Y.push(`[${$.type} Error${X}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}Y.push(`at ${Q}`)}if(Y.push(`
|
|
9461
|
+
${$.message}`),Z&&$.line){let Q=hU(Z,$.line,2);if(Q)Y.push(`
|
|
9462
9462
|
${Q}`)}if($.snippet)Y.push(`
|
|
9463
9463
|
Snippet: ${$.snippet}`);if($.suggestion)Y.push(`
|
|
9464
|
-
Suggestion: ${$.suggestion}`);return Y.join(" ")}function
|
|
9464
|
+
Suggestion: ${$.suggestion}`);return Y.join(" ")}function fU($){let Z=$.code?` [${$.code}]`:"",J=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",Y=`<!-- [${$.type} Error${Z}]${J}: ${SJ($.message)}`;if($.suggestion)Y+=` | Suggestion: ${SJ($.suggestion)}`;return Y+=" -->",Y}function gU($,Z,J){let q=[],z=$.code?` [${$.codeName||$.code}]`:"";if(q.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${z} \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`}q.push(`
|
|
9465
9465
|
\x1B[90mat\x1B[0m ${U}`)}if(q.push(`
|
|
9466
9466
|
|
|
9467
|
-
${$.message}`),Z&&$.line){let U=
|
|
9467
|
+
${$.message}`),Z&&$.line){let U=uU(Z,$.line,2);if(U)q.push(`
|
|
9468
9468
|
|
|
9469
9469
|
\x1B[90mContext:\x1B[0m
|
|
9470
9470
|
${U}`)}if($.suggestion)q.push(`
|
|
9471
9471
|
|
|
9472
9472
|
\x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return q.push(`
|
|
9473
|
-
${"\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"}`),q.join("")}function
|
|
9473
|
+
${"\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"}`),q.join("")}function hU($,Z,J){let Y=$.split(`
|
|
9474
9474
|
`),X=Math.max(0,Z-J-1),Q=Math.min(Y.length-1,Z+J-1),G=[];for(let K=X;K<=Q;K++){let W=(K+1).toString().padStart(4),q=K===Z-1?">":" ";G.push(`${q}${W} | ${Y[K]}`)}return G.join(`
|
|
9475
|
-
`)}function
|
|
9475
|
+
`)}function uU($,Z,J){let Y=$.split(`
|
|
9476
9476
|
`),X=Math.max(0,Z-J-1),Q=Math.min(Y.length-1,Z+J-1),G="\x1B[90m",K="\x1B[31m",W="\x1B[0m",q=[];for(let z=X;z<=Q;z++){let U=(z+1).toString().padStart(4),j=z===Z-1,H=j?"\x1B[31m>\x1B[0m":" ",B=j?`\x1B[31m${Y[z]}\x1B[0m`:`\x1B[90m${Y[z]}\x1B[0m`;q.push(`${H}\x1B[90m${U}\x1B[0m | ${B}`)}return q.join(`
|
|
9477
|
-
`)}function
|
|
9478
|
-
`);return{line:Y.length,column:Y[Y.length-1].length}}function J0($,Z,J){return
|
|
9477
|
+
`)}function SJ($){return $.replace(/--/g,"- -").replace(/>/g,">")}function mU($,Z){let Y=$.substring(0,Z).split(`
|
|
9478
|
+
`);return{line:Y.length,column:Y[Y.length-1].length}}function J0($,Z,J){return yJ({type:$,message:Z,code:J,format:"html"}).formatted}async function k5($,Z,J){try{return await $()}catch(Y){if(J&&Y instanceof Error)J(Y);return Z}}var PJ=b(()=>{s4();Z7()});class L6{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,J="error"){let Y={timestamp:new Date,error:$,context:Z,level:J};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(J))this.writeToFile(Y)}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(`
|
|
9479
9479
|
`).slice(1).join(`
|
|
9480
9480
|
`)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
|
|
9481
9481
|
`)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(Y))Z.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded(Z);let X=`${this.formatEntry($)}
|
|
9482
9482
|
`;Z.appendFileSync(this.logFilePath,X,"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 J=this.maxLogFiles-1;J>=1;J--){let Y=`${this.logFilePath}.${J}`,X=`${this.logFilePath}.${J+1}`;if($.existsSync(Y))if(J>=this.maxLogFiles-1)$.unlinkSync(Y);else $.renameSync(Y,X)}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 J of this.errors){let Y=J.error.constructor.name;$[Y]=($[Y]||0)+1;let X=J.level||"error";Z[X]=(Z[X]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let J=await import("fs"),X=(await import("path")).dirname($);if(!J.existsSync(X))J.mkdirSync(X,{recursive:!0});if(Z==="json"){let Q=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}));J.writeFileSync($,JSON.stringify(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));J.writeFileSync($,Q.join(`
|
|
9483
9483
|
|
|
9484
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var V6,Z1,w6;var
|
|
9484
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var V6,Z1,w6;var CJ=b(()=>{Z7();V6={isEnabled(){return a4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=a4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let J=$,Y=[],X=(J.match(/\{\{/g)||[]).length,Q=(J.match(/\}\}/g)||[]).length;if(X>Q){let K=X-Q;J+="}}".repeat(K),Y.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let W=(J.match(new RegExp(`@${K}\\b`,"g"))||[]).length,q=(J.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(W>q){let z=W-q;for(let U=0;U<z;U++)J+=`
|
|
9485
9485
|
@end${K}`;Y.push(`Added ${z} missing @end${K}`)}}if(Y.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:J,fixes:Y}},createFallbackContent($,Z){if(w$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};Z1=new L6,w6={isDevelopment(){return w$()},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 J=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)J.push(`Context: ${JSON.stringify(Z,null,2)}`);return J.push("========================"),J.join(`
|
|
9486
|
-
`)}}});var
|
|
9486
|
+
`)}}});var vJ=()=>{};var xJ=b(()=>{s4();PJ();CJ();vJ();Z7()});var w1=b(()=>{xJ()});function fJ($,Z,J,Y){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,q)=>{if(!q&&W.includes(":")){let z=W.split(":"),U=W,j=z.length>1?z[1]:"";if(j&&Z[j])q=Z[j];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])q=Z.openGraph[z[1]];else q="";return q?`<meta property="${l(U)}" content="${l(q)}">`:""}return q?`<meta name="${l(W)}" content="${l(q)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,W=K+G[0].length-1,q=1,z=W+1;while(z<X.length&&q>0){if(X[z]==="(")q++;else if(X[z]===")"){if(q--,q===0)break}z++}if(q!==0)break;let U=X.substring(W+1,z).trim(),j=z+1,H=(()=>{try{let B=A0(U,Z);if(!B)return"";let _="<meta";if(B.name)_+=` name="${l(String(B.name))}"`;if(B.property)_+=` property="${l(String(B.property))}"`;if(B.httpEquiv)_+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)_+=` content="${l(String(B.content))}"`;return _+=">",_}catch(B){let _=B instanceof Error?B.message:String(B);return J0("MetaTag",_,o.EVALUATION_ERROR)}})();X=X.substring(0,K)+H+X.substring(j),Q.lastIndex=0}return X}function gJ($,Z,J){let Y=$,X=/@structuredData\s*\(/g,Q;while((Q=X.exec(Y))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")"){if(W--,W===0)break}q++}if(W!==0)break;let z=Y.substring(K+1,q).trim(),U=q+1,j=(()=>{try{let H=A0(z,Z);if(!H)return"";if(!H["@context"])H["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(H).replace(/<\//g,"<\\/")}</script>`}catch(H){let B=H instanceof Error?H.message:String(H);return J0("StructuredData",B,o.EVALUATION_ERROR)}})();Y=Y.substring(0,G)+j+Y.substring(U),X.lastIndex=0}return Y}function hJ($,Z,J,Y){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),W=1,q=K+1,z=null,U=!1;while(q<X.length&&W>0){let V=X[q];if(U){U=!1,q++;continue}if(V==="\\"&&z){U=!0,q++;continue}if(z){if(V===z)z=null;q++;continue}if(V==='"'||V==="'"||V==="`"){z=V,q++;continue}if(V==="{")W++;else if(V==="}")W--;q++}if(W!==0)break;let j=X.substring(q).match(/^\s*\)/);if(!j)break;let H=q+j[0].length,B=X.substring(K,q),_=X.substring(G.index,H),O=((V)=>{try{let F=A0(V,Z);if(!F)return"";let L="";if(F.title)L+=`<title>${l(F.title)}</title>
|
|
9487
9487
|
`,L+=`<meta name="title" content="${l(F.title)}">
|
|
9488
9488
|
`;if(F.description)L+=`<meta name="description" content="${l(F.description)}">
|
|
9489
9489
|
`;if(F.keywords){let w=Array.isArray(F.keywords)?F.keywords.join(", "):F.keywords;L+=`<meta name="keywords" content="${l(w)}">
|
|
@@ -9505,7 +9505,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
9505
9505
|
`}if(w.site)L+=`<meta name="twitter:site" content="${l(w.site)}">
|
|
9506
9506
|
`;if(w.creator)L+=`<meta name="twitter:creator" content="${l(w.creator)}">
|
|
9507
9507
|
`}if(F.structuredData){let w=JSON.stringify(F.structuredData).replace(/<\//g,"<\\/");L+=`<script type="application/ld+json">${w}</script>
|
|
9508
|
-
`}return L.trim()}catch(F){let L=F instanceof Error?F.message:String(F);return J0("SEO",`Error processing @seo directive: ${L}`,o.EVALUATION_ERROR)}})(B);X=X.substring(0,G.index)+O+X.substring(H),Q.lastIndex=G.index+O.length}return X}function
|
|
9508
|
+
`}return L.trim()}catch(F){let L=F instanceof Error?F.message:String(F);return J0("SEO",`Error processing @seo directive: ${L}`,o.EVALUATION_ERROR)}})(B);X=X.substring(0,G.index)+O+X.substring(H),Q.lastIndex=G.index+O.length}return X}function uJ($,Z,J){if(J.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||J.skipDefaultSeoTags===!0)return $;let Y=Z.__stx_runtime_head;if(!!(Y?.title||Y?.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 Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(J.seo?.defaultConfig?.title)G=J.seo.defaultConfig.title;else G=J.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(J.seo?.defaultConfig?.description)K=J.seo.defaultConfig.description;else K=J.defaultDescription||"A website built with stx templating engine";let W="";if(Z.image)W=Z.image;else if(Z.meta&&Z.meta.image)W=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)W=Z.openGraph.image;else if(J.seo?.defaultImage)W=J.seo.defaultImage;else if(J.defaultImage)W=J.defaultImage;let q=`
|
|
9509
9509
|
<!-- stx SEO Tags -->
|
|
9510
9510
|
<meta name="title" content="${l(G)}">
|
|
9511
9511
|
<meta name="description" content="${l(K)}">
|
|
@@ -9521,8 +9521,8 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
9521
9521
|
`;let z=$;if(!Q)z=z.replace(/<head[^>]*>/,`$&
|
|
9522
9522
|
<title>${l(G)}</title>`);return z.replace(/<head[^>]*>/,`$&
|
|
9523
9523
|
${q}
|
|
9524
|
-
`)}function l($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function
|
|
9525
|
-
`).trim()}var
|
|
9524
|
+
`)}function l($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function pJ($){let Z=[];for(let J of $.rules){if(Z.push(`User-agent: ${J.userAgent}`),J.allow)for(let Y of J.allow)Z.push(`Allow: ${Y}`);if(J.disallow)for(let Y of J.disallow)Z.push(`Disallow: ${Y}`);if(J.crawlDelay!==void 0)Z.push(`Crawl-delay: ${J.crawlDelay}`);Z.push("")}if($.sitemap){let J=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let Y of J)Z.push(`Sitemap: ${Y}`)}if($.host)Z.push(`Host: ${$.host}`);return Z.join(`
|
|
9525
|
+
`).trim()}var mJ,dJ;var J7=b(()=>{w1();M0();mJ={name:"meta",handler:($,Z,J,Y)=>{if(Z.length<1)return J0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(X)}" content="${l(Q)}">`},hasEndTag:!1},dJ={name:"structuredData",handler:($,Z,J,Y)=>{if($.trim()==="")return J0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let X=JSON.parse($);if(!X["@context"])X["@context"]="https://schema.org";if(!X["@type"])return J0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(X)}</script>`}catch(X){let Q=X instanceof Error?X.message:String(X);return J0("StructuredData",Q,o.EVALUATION_ERROR)}},hasEndTag:!0}});import N$ from"path";function dU($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=J?J[1].trim():"",X=Z,Q=[],G=!0;if(Y){let U=Y.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let j=U[1],H=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(H)X=H[1];let B=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((O)=>O.trim().replace(/['"`]/g,"")).filter((O)=>O.length>0);let _=j.match(/shadowDOM\s*:\s*(true|false)/);if(_)G=_[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),W=K?K[1].trim():"",q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),z=q?q[1].trim():"";return{tag:X,props:Q,template:W,styles:z,script:Y,shadowDOM:G}}function pU($){let{tag:Z,props:J,template:Y,styles:X,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),W=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=J.map((U)=>`'${U}'`).join(", "),z=J.map((U)=>`
|
|
9526
9526
|
get ${U}() {
|
|
9527
9527
|
return this.getAttribute('${U}') || '';
|
|
9528
9528
|
}
|
|
@@ -9573,16 +9573,16 @@ ${z}
|
|
|
9573
9573
|
}
|
|
9574
9574
|
|
|
9575
9575
|
customElements.define('${Z}', ${G});
|
|
9576
|
-
`}async function
|
|
9577
|
-
${
|
|
9578
|
-
</script>`}var lJ=b(()=>{w1();I0()});var cJ={};t(cJ,{timingPlugin:()=>nU,pluginManager:()=>pU,definePlugin:()=>Y7,debugPlugin:()=>iU,createVariablesPlugin:()=>oU,createFilterPlugin:()=>cU,createDirectivePlugin:()=>lU,PluginManager:()=>N6});function Y7($){return $}class N6{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 J of $.dependencies)if(!this.plugins.has(J))throw Error(`Plugin "${$.name}" depends on "${J}" 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[J,Y]of this.plugins)if(Y.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${J}" 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 J=await Z.onError($);if(J){if(J.template!==void 0)$.template=J.template;if(J.context)$.context={...$.context,...J.context};if(J.metadata)$.metadata={...$.metadata,...J.metadata};if(J.skip)return $}}catch(J){console.error(`Error in plugin "${Z.name}" onError hook:`,J)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let J={...Z};for(let Y of this.sortedPlugins){let X=Y[$];if(X)try{let Q=await X(J);if(Q){if(Q.template!==void 0)J.template=Q.template;if(Q.context)J.context={...J.context,...Q.context};if(Q.metadata)J.metadata={...J.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${Y.name}" ${$} hook:`,Q)}}return J}async runDirectiveHooks($,Z,J){let Y={...J};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,Y);if(G){if(G.template!==void 0)Y.template=G.template;if(G.context)Y.context={...Y.context,...G.context};if(G.metadata)Y.metadata={...Y.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return Y}}function lU($,Z,J={}){return{name:$,...J,registerDirectives:()=>Z}}function cU($,Z,J={}){return{name:$,...J,registerFilters:()=>Z}}function oU($){return Y7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var pU,iU,nU;var iJ=b(()=>{pU=new N6;iU=Y7({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)}}),nU=Y7({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 J=performance.now()-Z;console.log(`[stx-timing] Processing took ${J.toFixed(2)}ms`)}}})});var rJ={};t(rJ,{validateConfig:()=>Zj,resolveStxDirectories:()=>sJ,loadStxConfig:()=>e0,defineStxConfig:()=>$j,defaultConfig:()=>Y5,config:()=>Z$});import X7 from"fs";import l0 from"path";import{loadConfigWithResult as sU}from"bunfig";function rU($,Z,J){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=J||process.cwd(),Q=l0.join(X,"resources","views"),G=l0.join(X,"resources","layouts");if(X7.existsSync(Q)&&X7.existsSync(G))return{root:"resources",pagesDir:"views"};let K=l0.join(X,"resources","views","pages");if(X7.existsSync(K))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function aU($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let Y=$.replace(/\\/g,"/"),X=J.replace(/\\/g,"/");return Y===X||Y.startsWith(`${X}/`)}function sJ($,Z){let J=!$.root,Y=rU($.root,$.pagesDir,Z);if($.root=Y.root,$.pagesDir=Y.pagesDir,J&&Y.root!=="."){let X=`${Z}::${Y.root}`;if(!nJ.has(X))nJ.add(X),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let X=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(l0.isAbsolute(G)||aU(G,X))continue;$[Q]=l0.join(X,G)}}return $}function tU($,Z){let J=["componentsDir","layoutsDir","partialsDir"];for(let Y of J){let X=$[Y];if(typeof X!=="string"||!X)continue;let Q=l0.isAbsolute(X)?X:l0.join(Z,X);if(X7.existsSync(Q))continue;let G=$.root,K=!!G&&G!==".";console.warn(`[stx] ${String(Y)} resolves to "${Q}", which does not exist. Configured as "${X}"`+(K?`, resolved under root "${G}".`:"."))}}function eU($){if(W8($.stateDir),$.stateDir=o5(),$.cachePath=s5($.cachePath),$.build)$.build.cacheDir=s5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=s5($.media.cache.directory);if($.story)$.story.outDir=s5($.story.outDir)}async function e0($){if(!$){if(E5)return E5;if(Q7)return Q7}let Z=$?l0.resolve($):process.cwd(),J=oJ.get(Z);if(J)return J;let Y=(async()=>{let Q=(await sU({name:"stx",alias:"ui",cwd:Z,defaultConfig:Y5,verbose:!1})).config;if(eU(Q),sJ(Q,Z),tU(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await Promise.resolve().then(() => (iJ(),cJ)),K=[],W=[];for(let q of Q.plugins){let z=typeof q==="string"?q:q[0],U=typeof q==="string"?{}:q[1]||{};try{let j,H;try{j=await import(z),H=l0.dirname(U0.resolve(z))}catch{let _=l0.resolve(process.cwd(),z);j=await import(_),H=l0.dirname(_)}let B=j.default||j;if(G.register(B,Q),B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)K.push(l0.resolve(H,O))}if(B.pages){let _=l0.resolve(H,B.pages),O=U.path||"/";W.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,V)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=V},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:H,config:Q};await B.setup(U,_)}console.log(`[stx] Plugin loaded: ${B.name||z}`)}catch(j){console.warn(`[stx] Failed to load plugin ${z}:`,j.message)}}Q._pluginComponentDirs=K,Q._pluginPageDirs=W}return Q})();if(oJ.set(Z,Y),!$)Q7=Y,Y.then((X)=>{E5=X}).catch(()=>{});return Y}function $j($){return $}function Zj($){let Z=[],J=[];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 Y=["auto","manual","sections"];if(!Y.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.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 Y=["AA","AAA"];if(!Y.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((Y,X)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`customDirectives[${X}].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((Y,X)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.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)J.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 Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((X,Q)=>{if(!X.pattern||typeof X.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(X.maxAgeSeconds!==void 0&&(typeof X.maxAgeSeconds!=="number"||X.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(X.maxEntries!==void 0&&(typeof X.maxEntries!=="number"||X.maxEntries<1))Z.push({path:`pwa.routes[${Q}].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((X)=>typeof X!=="number"||X<16||X>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 Y=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!Y.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.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)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var Y5,nJ,E5=null,oJ,Q7=null,Z$;var V1=b(()=>{d7();p7();l7();c7();g3();YJ();_6();EJ();J7();r5();lJ();Y5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:_5,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:E2,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:pJ,hasEndTag:!1,description:"Include a web component in the template"},U8,j8,uJ,mJ,B8,_8,O8,H8,w8,A8,JJ,H6,...kJ],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,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}};nJ=new Set;oJ=new Map;Z$=new Proxy(Y5,{get($,Z){if(E5&&Z in E5)return E5[Z];if(!Q7)e0().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}})});var JY={};t(JY,{resetCssCache:()=>qj,resetCrosswindCache:()=>zj,rebuildCrosswindCSS:()=>Uj,loadCrosswindConfig:()=>T6,loadCrosswind:()=>M6,injectCrosswindCSS:()=>A$,getCrosswindServeAsset:()=>Xj,getCachedCSS:()=>jj,generateCrosswindCSS:()=>ZY,extractClassNames:()=>$Y,buildCrosswindCSS:()=>eJ});import X0 from"path";import{hasLocalConfig as Jj}from"bunfig";function K7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function R6($,Z){if(N1.has($))N1.delete($);else if(N1.size>=tJ)N1.delete(N1.keys().next().value);N1.set($,Z)}function Yj($){let Z=K7($);if(J1.has(Z))J1.delete(Z);else if(J1.size>=tJ)J1.delete(J1.keys().next().value);return J1.set(Z,$),Z}function Xj($){let Z=J1.get($);if(Z===void 0)return;return J1.delete($),J1.set($,Z),Z}async function Qj($){if(!x1)return null;try{let Z=Bun.file(X0.join(x1,`cw-${K7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function Gj($,Z){if(!x1)return;try{if(!fs.existsSync(x1))fs.mkdirSync(x1,{recursive:!0});await Bun.write(X0.join(x1,`cw-${K7($)}.css`),Z)}catch{}}async function aJ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function Kj(){let $=[],Z=process.cwd();while(Z!==X0.dirname(Z))$.push(X0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=X0.dirname(Z);return $}function Wj(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let J=[X0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...J)}return $.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function M6(){if(A6)return z1;A6=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await aJ(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=X0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return z1=Q,z1}let Z=await $(Kj());if(Z)return z1=Z,z1;let J=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of J){let Q=await aJ(X);if(Q){if(z1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return z1}}let Y=await $(Wj());if(Y)return z1=Y,z1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}function qj(){N1.clear(),J1.clear()}function zj(){z1=null,A6=!1,Y1=null,R$="",N1.clear(),J1.clear(),G7=null}async function T6($){try{if(!Jj({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),J=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!J?.path||!J.config||Object.keys(J.config).length===0)return null;let Y=X0.relative($,J.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${Y||J.path}`);return J.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function eJ($){if(b5)return R$;b5=!0;try{let Z=await M6();if(!Z||!Z.build)return b5=!1,"";if(!Y1)Y1=await T6($);if(!Y1)return b5=!1,"";let J=Z.defaultConfig?.theme||{},Y=Y1.theme||{},X={...Z.defaultConfig,...Y1,theme:{...J,...Y,extend:{...J.extend||{},...Y.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(R$=G.css,console.log(`${O0.cyan}[Crosswind]${O0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let W=X0.isAbsolute(X.output)?X.output:X0.join($,X.output),q=X0.dirname(W);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(W,G.css)}return b5=!1,G.css}catch(Z){return console.error(`${O0.red}[Crosswind]${O0.reset} Build error:`,Z),b5=!1,R$}}async function Uj($){Y1=null,await eJ($)}function jj(){return R$}function $Y($){let Z=new Set,J=/class\s*=\s*["']([^"']+)["']/gi,Y=J.exec($);while(Y!==null){for(let G of Y[1].split(/\s+/))if(G.trim())Z.add(G.trim());Y=J.exec($)}let X=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=X.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=X.exec($)}return Z}async function ZY($,Z){try{let J=await M6();if(!J)return"";let Y=typeof J.extractClasses==="function"?J.extractClasses($):$Y($);if(Y.size===0)return"";let X=Z?X0.resolve(Z):process.cwd();if(!x1)x1=_1(X,"cache");let Q=[...Y].sort().join(" "),G=`${G7||"default"}::${Q}`,K=N1.get(G);if(K!==void 0)return R6(G,K),K;let W=await Qj(G);if(W!==null)return R6(G,W),W;if(!Y1){let w=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (V1(),rJ)),R=await N(X);if(R.css)if(typeof R.css==="string"){let A=X0.isAbsolute(R.css)?R.css:X0.resolve(X,R.css);if(await Bun.file(A).exists()){let M=await import(A);w=M.default||M,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(w={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let A=X0.isAbsolute(R.css.config)?R.css.config:X0.resolve(X,R.css.config);if(await Bun.file(A).exists()){let M=await import(A);w={...M.default||M,...w}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}Y1=w||await T6(X);try{G7=K7(JSON.stringify(Y1??{}))}catch{G7="unhashable"}}let q=J.defaultConfig||J.config,z=Y1||{},U=G8(q,z),{safelist:j,includePreflight:H,minify:B}=U,_=U.config,O=new J.CSSGenerator(_);for(let w of j)O.generate(w);for(let w of Y)O.generate(w);let V=O.toCSS(H,B),F=_.shortcuts||z.shortcuts||{};for(let[w,N]of Object.entries(F)){if(!Y.has(w)&&!j.includes(w))continue;let R=N.split(/\s+/).filter(Boolean);for(let A of R)O.generate(A)}V=O.toCSS(H,B);let L=V.split(`
|
|
9576
|
+
`}async function lJ($,Z,J,Y){if(Z.length<1)return J0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",K=[N$.join(N$.dirname(Y),G,`${X}.stx`),N$.join(process.cwd(),G,`${X}.stx`),N$.join(N$.dirname(Y),`${X}.stx`)],W=null;for(let U of K)if(await c(U)){W=await Bun.file(U).text();break}if(!W)return J0("WebComponent",`Component file not found: ${X}.stx`,o.FILE_NOT_FOUND);let q=dU(W,X);return`<script type="module">
|
|
9577
|
+
${pU(q)}
|
|
9578
|
+
</script>`}var cJ=b(()=>{w1();I0()});var iJ={};t(iJ,{timingPlugin:()=>oU,pluginManager:()=>lU,definePlugin:()=>Y7,debugPlugin:()=>nU,createVariablesPlugin:()=>sU,createFilterPlugin:()=>iU,createDirectivePlugin:()=>cU,PluginManager:()=>N6});function Y7($){return $}class N6{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 J of $.dependencies)if(!this.plugins.has(J))throw Error(`Plugin "${$.name}" depends on "${J}" 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[J,Y]of this.plugins)if(Y.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${J}" 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 J=await Z.onError($);if(J){if(J.template!==void 0)$.template=J.template;if(J.context)$.context={...$.context,...J.context};if(J.metadata)$.metadata={...$.metadata,...J.metadata};if(J.skip)return $}}catch(J){console.error(`Error in plugin "${Z.name}" onError hook:`,J)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let J={...Z};for(let Y of this.sortedPlugins){let X=Y[$];if(X)try{let Q=await X(J);if(Q){if(Q.template!==void 0)J.template=Q.template;if(Q.context)J.context={...J.context,...Q.context};if(Q.metadata)J.metadata={...J.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${Y.name}" ${$} hook:`,Q)}}return J}async runDirectiveHooks($,Z,J){let Y={...J};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,Y);if(G){if(G.template!==void 0)Y.template=G.template;if(G.context)Y.context={...Y.context,...G.context};if(G.metadata)Y.metadata={...Y.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return Y}}function cU($,Z,J={}){return{name:$,...J,registerDirectives:()=>Z}}function iU($,Z,J={}){return{name:$,...J,registerFilters:()=>Z}}function sU($){return Y7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var lU,nU,oU;var nJ=b(()=>{lU=new N6;nU=Y7({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)}}),oU=Y7({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 J=performance.now()-Z;console.log(`[stx-timing] Processing took ${J.toFixed(2)}ms`)}}})});var aJ={};t(aJ,{validateConfig:()=>Jj,resolveStxDirectories:()=>rJ,loadStxConfig:()=>e0,defineStxConfig:()=>Zj,defaultConfig:()=>Y5,config:()=>Z$});import X7 from"fs";import c0 from"path";import{loadConfigWithResult as rU}from"bunfig";function aU($,Z,J){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=J||process.cwd(),Q=c0.join(X,"resources","views"),G=c0.join(X,"resources","layouts");if(X7.existsSync(Q)&&X7.existsSync(G))return{root:"resources",pagesDir:"views"};let K=c0.join(X,"resources","views","pages");if(X7.existsSync(K))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function tU($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let Y=$.replace(/\\/g,"/"),X=J.replace(/\\/g,"/");return Y===X||Y.startsWith(`${X}/`)}function rJ($,Z){let J=!$.root,Y=aU($.root,$.pagesDir,Z);if($.root=Y.root,$.pagesDir=Y.pagesDir,J&&Y.root!=="."){let X=`${Z}::${Y.root}`;if(!oJ.has(X))oJ.add(X),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let X=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(c0.isAbsolute(G)||tU(G,X))continue;$[Q]=c0.join(X,G)}}return $}function eU($,Z){let J=["componentsDir","layoutsDir","partialsDir"];for(let Y of J){let X=$[Y];if(typeof X!=="string"||!X)continue;let Q=c0.isAbsolute(X)?X:c0.join(Z,X);if(X7.existsSync(Q))continue;let G=$.root,K=!!G&&G!==".";console.warn(`[stx] ${String(Y)} resolves to "${Q}", which does not exist. Configured as "${X}"`+(K?`, resolved under root "${G}".`:"."))}}function $j($){if(W8($.stateDir),$.stateDir=o5(),$.cachePath=s5($.cachePath),$.build)$.build.cacheDir=s5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=s5($.media.cache.directory);if($.story)$.story.outDir=s5($.story.outDir)}async function e0($){if(!$){if(E5)return E5;if(Q7)return Q7}let Z=$?c0.resolve($):process.cwd(),J=sJ.get(Z);if(J)return J;let Y=(async()=>{let Q=(await rU({name:"stx",alias:"ui",cwd:Z,defaultConfig:Y5,verbose:!1})).config;if($j(Q),rJ(Q,Z),eU(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await Promise.resolve().then(() => (nJ(),iJ)),K=[],W=[];for(let q of Q.plugins){let z=typeof q==="string"?q:q[0],U=typeof q==="string"?{}:q[1]||{};try{let j,H;try{j=await import(z),H=c0.dirname(U0.resolve(z))}catch{let _=c0.resolve(process.cwd(),z);j=await import(_),H=c0.dirname(_)}let B=j.default||j;if(G.register(B,Q),B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)K.push(c0.resolve(H,O))}if(B.pages){let _=c0.resolve(H,B.pages),O=U.path||"/";W.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,V)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=V},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:H,config:Q};await B.setup(U,_)}console.log(`[stx] Plugin loaded: ${B.name||z}`)}catch(j){console.warn(`[stx] Failed to load plugin ${z}:`,j.message)}}Q._pluginComponentDirs=K,Q._pluginPageDirs=W}return Q})();if(sJ.set(Z,Y),!$)Q7=Y,Y.then((X)=>{E5=X}).catch(()=>{});return Y}function Zj($){return $}function Jj($){let Z=[],J=[];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 Y=["auto","manual","sections"];if(!Y.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.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 Y=["AA","AAA"];if(!Y.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((Y,X)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`customDirectives[${X}].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((Y,X)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.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)J.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 Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((X,Q)=>{if(!X.pattern||typeof X.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(X.maxAgeSeconds!==void 0&&(typeof X.maxAgeSeconds!=="number"||X.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(X.maxEntries!==void 0&&(typeof X.maxEntries!=="number"||X.maxEntries<1))Z.push({path:`pwa.routes[${Q}].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((X)=>typeof X!=="number"||X<16||X>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 Y=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!Y.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.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)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var Y5,oJ,E5=null,sJ,Q7=null,Z$;var V1=b(()=>{d7();p7();l7();c7();g3();XJ();_6();bJ();J7();r5();cJ();Y5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:_5,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:b2,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:lJ,hasEndTag:!1,description:"Include a web component in the template"},U8,j8,mJ,dJ,B8,_8,O8,H8,w8,A8,YJ,H6,...EJ],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,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}};oJ=new Set;sJ=new Map;Z$=new Proxy(Y5,{get($,Z){if(E5&&Z in E5)return E5[Z];if(!Q7)e0().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}})});var YY={};t(YY,{resetCssCache:()=>zj,resetCrosswindCache:()=>Uj,rebuildCrosswindCSS:()=>jj,loadCrosswindConfig:()=>T6,loadCrosswind:()=>M6,injectCrosswindCSS:()=>A$,getCrosswindServeAsset:()=>Qj,getCachedCSS:()=>Bj,generateCrosswindCSS:()=>JY,extractClassNames:()=>ZY,buildCrosswindCSS:()=>$Y});import X0 from"path";import{hasLocalConfig as Yj}from"bunfig";function K7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function R6($,Z){if(N1.has($))N1.delete($);else if(N1.size>=eJ)N1.delete(N1.keys().next().value);N1.set($,Z)}function Xj($){let Z=K7($);if(J1.has(Z))J1.delete(Z);else if(J1.size>=eJ)J1.delete(J1.keys().next().value);return J1.set(Z,$),Z}function Qj($){let Z=J1.get($);if(Z===void 0)return;return J1.delete($),J1.set($,Z),Z}async function Gj($){if(!x1)return null;try{let Z=Bun.file(X0.join(x1,`cw-${K7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function Kj($,Z){if(!x1)return;try{if(!fs.existsSync(x1))fs.mkdirSync(x1,{recursive:!0});await Bun.write(X0.join(x1,`cw-${K7($)}.css`),Z)}catch{}}async function tJ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function Wj(){let $=[],Z=process.cwd();while(Z!==X0.dirname(Z))$.push(X0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=X0.dirname(Z);return $}function qj(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let J=[X0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...J)}return $.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function M6(){if(A6)return z1;A6=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await tJ(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=X0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return z1=Q,z1}let Z=await $(Wj());if(Z)return z1=Z,z1;let J=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of J){let Q=await tJ(X);if(Q){if(z1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return z1}}let Y=await $(qj());if(Y)return z1=Y,z1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}function zj(){N1.clear(),J1.clear()}function Uj(){z1=null,A6=!1,Y1=null,R$="",N1.clear(),J1.clear(),G7=null}async function T6($){try{if(!Yj({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),J=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!J?.path||!J.config||Object.keys(J.config).length===0)return null;let Y=X0.relative($,J.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${Y||J.path}`);return J.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function $Y($){if(b5)return R$;b5=!0;try{let Z=await M6();if(!Z||!Z.build)return b5=!1,"";if(!Y1)Y1=await T6($);if(!Y1)return b5=!1,"";let J=Z.defaultConfig?.theme||{},Y=Y1.theme||{},X={...Z.defaultConfig,...Y1,theme:{...J,...Y,extend:{...J.extend||{},...Y.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(R$=G.css,console.log(`${O0.cyan}[Crosswind]${O0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let W=X0.isAbsolute(X.output)?X.output:X0.join($,X.output),q=X0.dirname(W);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(W,G.css)}return b5=!1,G.css}catch(Z){return console.error(`${O0.red}[Crosswind]${O0.reset} Build error:`,Z),b5=!1,R$}}async function jj($){Y1=null,await $Y($)}function Bj(){return R$}function ZY($){let Z=new Set,J=/class\s*=\s*["']([^"']+)["']/gi,Y=J.exec($);while(Y!==null){for(let G of Y[1].split(/\s+/))if(G.trim())Z.add(G.trim());Y=J.exec($)}let X=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=X.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=X.exec($)}return Z}async function JY($,Z){try{let J=await M6();if(!J)return"";let Y=typeof J.extractClasses==="function"?J.extractClasses($):ZY($);if(Y.size===0)return"";let X=Z?X0.resolve(Z):process.cwd();if(!x1)x1=_1(X,"cache");let Q=[...Y].sort().join(" "),G=`${G7||"default"}::${Q}`,K=N1.get(G);if(K!==void 0)return R6(G,K),K;let W=await Gj(G);if(W!==null)return R6(G,W),W;if(!Y1){let w=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (V1(),aJ)),R=await N(X);if(R.css)if(typeof R.css==="string"){let A=X0.isAbsolute(R.css)?R.css:X0.resolve(X,R.css);if(await Bun.file(A).exists()){let M=await import(A);w=M.default||M,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(w={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let A=X0.isAbsolute(R.css.config)?R.css.config:X0.resolve(X,R.css.config);if(await Bun.file(A).exists()){let M=await import(A);w={...M.default||M,...w}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}Y1=w||await T6(X);try{G7=K7(JSON.stringify(Y1??{}))}catch{G7="unhashable"}}let q=J.defaultConfig||J.config,z=Y1||{},U=G8(q,z),{safelist:j,includePreflight:H,minify:B}=U,_=U.config,O=new J.CSSGenerator(_);for(let w of j)O.generate(w);for(let w of Y)O.generate(w);let V=O.toCSS(H,B),F=_.shortcuts||z.shortcuts||{};for(let[w,N]of Object.entries(F)){if(!Y.has(w)&&!j.includes(w))continue;let R=N.split(/\s+/).filter(Boolean);for(let A of R)O.generate(A)}V=O.toCSS(H,B);let L=V.split(`
|
|
9579
9579
|
`);for(let[w,N]of Object.entries(F)){if(!Y.has(w)&&!j.includes(w))continue;let R=N.split(/\s+/).filter(Boolean),A=[],M=[];for(let T of R){let I=T.startsWith("dark:"),y=`.${(I?T.slice(5):T).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let S=0;S<L.length;S++){let P=L[S].trim();if(P===`${y} {`||P.startsWith(`${y} {`)){let C=S,x="";while(C<L.length){if(x+=L[C],L[C].includes("}"))break;C++}let f=x.match(/\{([^}]+)\}/);if(f)if(I)M.push(f[1].trim());else A.push(f[1].trim());break}}}if(A.length)V+=`
|
|
9580
9580
|
.${w} { ${A.join(" ")} }`;if(M.length)V+=`
|
|
9581
|
-
@media (prefers-color-scheme: dark) { .dark .${w} { ${M.join(" ")} } }`}return R6(G,V),
|
|
9581
|
+
@media (prefers-color-scheme: dark) { .dark .${w} { ${M.join(" ")} } }`}return R6(G,V),Kj(G,V),V}catch(J){return console.warn("Failed to generate Crosswind CSS:",J),""}}async function A$($,Z,J=!1){let Y=await JY($,Z);if(!Y)return $;let X=J?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${Xj(Y)}.css">`:`<style data-crosswind="generated">
|
|
9582
9582
|
${Y}
|
|
9583
9583
|
</style>`,Q=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(Q.test($)){let G=!1;return $.replace(Q,()=>{if(G)return"";return G=!0,X})}if($.includes("</head>"))return $.replace("</head>",`${X}
|
|
9584
9584
|
</head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
9585
|
-
${X}`);return X+$}var z1=null,A6=!1,Y1=null,R$="",b5=!1,
|
|
9585
|
+
${X}`);return X+$}var z1=null,A6=!1,Y1=null,R$="",b5=!1,eJ=256,N1,J1,x1=null,G7=null;var W7=b(()=>{r5();q8();N1=new Map,J1=new Map});function XY(){return`
|
|
9586
9586
|
// STX Lifecycle Runtime
|
|
9587
9587
|
(function() {
|
|
9588
9588
|
if (typeof window === 'undefined') return;
|
|
@@ -9927,7 +9927,7 @@ else {
|
|
|
9927
9927
|
|
|
9928
9928
|
console.log('[stx] Lifecycle runtime initialized');
|
|
9929
9929
|
})();
|
|
9930
|
-
`}function I6($){return Symbol($)}var
|
|
9930
|
+
`}function I6($){return Symbol($)}var PR,CR,vR;var QY=b(()=>{PR=I6("theme"),CR=I6("router"),vR=I6("i18n")});import*as KY from"crypto";function GY($){let Z=/\$(\w+)\./g,J=[],Y;while((Y=Z.exec($))!==null)if(!J.includes(Y[1]))J.push(Y[1]);return J}function Hj(){return`stx-${KY.randomBytes(4).toString("hex")}`}function _j($){return/\$\w+\./.test($)}function Oj($){let Z=[],J=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,X=$;return X=X.replace(Y,(Q,G,K,W)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let q=[],z=!1,U=K,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,H=[...K.matchAll(j)];for(let O of H){let V=O[0],F=O[1],L=O[2];if(_j(L)){z=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let N=w[1];if(q.push({attr:F,expr:N,fullMatch:V,originalAttr:F}),GY(N).forEach((A)=>J.add(A)),F==="text")U=U.replace(V,"");else if(F==="class")U=U.replace(V,'class=""');else if(F==="disabled"||F==="hidden")U=U.replace(V,"");else U=U.replace(V,`${F}=""`)}}}if(!z)return Q;let B=U.match(/\bid\s*=\s*"([^"]+)"/),_;if(B)_=B[1];else _=Hj(),U=` id="${_}"${U}`;for(let O of q)Z.push({elementId:_,attribute:O.attr,expression:O.expr,stores:GY(O.expr)});return`<${G}${U}${W}`}),{html:X,bindings:Z,stores:J}}function Fj($,Z){if($.length===0)return"";let J=Array.from(Z),Y=`
|
|
9931
9931
|
<script>
|
|
9932
9932
|
(function() {
|
|
9933
9933
|
'use strict';
|
|
@@ -10085,10 +10085,10 @@ else {
|
|
|
10085
10085
|
}
|
|
10086
10086
|
})();
|
|
10087
10087
|
</script>
|
|
10088
|
-
`,Y}function
|
|
10088
|
+
`,Y}function WY($){let{html:Z,bindings:J,stores:Y}=Oj($);if(J.length===0)return $;let X=Fj(J,Y),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var qY=()=>{};function Vj($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return Lj(Z);case"google-analytics":return wj(Z);case"plausible":return Nj(Z);case"self-hosted":return Rj(Z);case"custom":return Aj(Z);default:return""}}function Lj($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",Y=Z.defer!==!1?" defer":"",X=[`data-site="${i0(Z.siteId)}"`];if(Z.honorDnt)X.push('data-honor-dnt="true"');if(Z.spa)X.push('data-spa="auto"');if(Z.canonical)X.push(`data-canonical="${i0(Z.canonical)}"`);if(Z.auto===!1)X.push('data-auto="false"');return`
|
|
10089
10089
|
<!-- Fathom Analytics -->
|
|
10090
|
-
<script src="${
|
|
10091
|
-
`}function
|
|
10090
|
+
<script src="${i0(J)}" ${X.join(" ")}${Y}></script>
|
|
10091
|
+
`}function wj($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=i0(Z.measurementId),Y=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
|
|
10092
10092
|
<!-- Google Analytics -->
|
|
10093
10093
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${J}"></script>
|
|
10094
10094
|
<script>
|
|
@@ -10098,10 +10098,10 @@ else {
|
|
|
10098
10098
|
gtag('config', '${J}');
|
|
10099
10099
|
${Y}
|
|
10100
10100
|
</script>
|
|
10101
|
-
`}function
|
|
10101
|
+
`}function Nj($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${i0(Z.domain)}"`],X=J,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&J==="https://plausible.io/js/script.js")X=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
|
|
10102
10102
|
<!-- Plausible Analytics -->
|
|
10103
|
-
<script defer data-domain="${
|
|
10104
|
-
`}function
|
|
10103
|
+
<script defer data-domain="${i0(Z.domain)}" src="${i0(X)}"></script>
|
|
10104
|
+
`}function Rj($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=i0(Z.siteId),Y=i0(Z.apiEndpoint),X=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
|
|
10105
10105
|
d.addEventListener('click',function(e){
|
|
10106
10106
|
var a=e.target.closest('a');
|
|
10107
10107
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -10134,15 +10134,15 @@ else {
|
|
|
10134
10134
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
10135
10135
|
})();
|
|
10136
10136
|
</script>
|
|
10137
|
-
`}function
|
|
10137
|
+
`}function Aj($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
|
|
10138
10138
|
<!-- Custom Analytics -->
|
|
10139
10139
|
<script>
|
|
10140
10140
|
${Z.inlineScript}
|
|
10141
10141
|
</script>
|
|
10142
|
-
`;if(!Z.scriptUrl)return"";let J=[];if(Z.scriptId)J.push(`id="${
|
|
10142
|
+
`;if(!Z.scriptUrl)return"";let J=[];if(Z.scriptId)J.push(`id="${i0(Z.scriptId)}"`);if(Z.attributes)for(let[X,Q]of Object.entries(Z.attributes))J.push(`${i0(X)}="${i0(Q)}"`);return`
|
|
10143
10143
|
<!-- Custom Analytics -->
|
|
10144
|
-
<script${J.length>0?` ${J.join(" ")}`:""} src="${
|
|
10145
|
-
`}function
|
|
10144
|
+
<script${J.length>0?` ${J.join(" ")}`:""} src="${i0(Z.scriptUrl)}" defer></script>
|
|
10145
|
+
`}function zY($,Z){let J=Vj(Z);if(!J)return $;if(!$.includes("</head>")){let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+J+$.slice(Y);return $+J}return $.replace("</head>",`${J}</head>`)}function i0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var UY=()=>{};function q7($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function jY($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}function BY($,Z){let J=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(J)return J[1];let Y=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function Tj($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[X,Q,G]=Y,K=Y.index,W=BY(G,"x-data");if(!W)continue;let q=`__stx_scope_${_Y++}`,z=BY(G,"x-init"),U=Ij($,Q,K+X.length),j=$.slice(K,U.endIndex),H=Dj(j);Z.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:W,initExpr:z,bindings:[],refs:H})}return Z}function Ij($,Z,J){let Y=1,X=J,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(Y>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X,K.lastIndex=X;let W=Q.exec($),q=G.exec($),z=K.exec($);if(z&&z.index<(W?.index??1/0)){X=z.index+z[0].length;continue}if(!q)return{endIndex:$.length};if(W&&W.index<q.index)Y++,X=W.index+W[0].length;else{if(Y--,Y===0)return{endIndex:q.index+q[0].length};X=q.index+q[0].length}}return{endIndex:$.length}}function Dj($){let Z=new Map,J=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,X;while((X=Y.exec(J))!==null){let[,Q,G]=X,K=kj(Q);Z.set(G,K)}return Z}function kj($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${Mj++}`}function Ej(){return`
|
|
10146
10146
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
10147
10147
|
(function() {
|
|
10148
10148
|
var style = document.createElement('style');
|
|
@@ -10349,7 +10349,7 @@ window.__stx_reactive = (function() {
|
|
|
10349
10349
|
|
|
10350
10350
|
return { initScope: initScope, reactive: reactive };
|
|
10351
10351
|
})();
|
|
10352
|
-
`}function
|
|
10352
|
+
`}function HY($,Z){let J=$.replace(/\{!!([\s\S]*?)!!\}/g,(K,W)=>{try{let q=u0(W,Z,!0);if(q===void 0)return K;return String(q)}catch{return K}}),Y="",X=0,Q=null;while(X<J.length){let K=J[X];if(Q&&K==="\\"){Y+=K+(J[X+1]??""),X+=2;continue}if(K==="{"&&J[X+1]==="{"){let W=J.indexOf("}}",X+2);if(W!==-1){let q=J.slice(X,W+2);Y+=G(J.slice(X+2,W),q,Q),X=W+2;continue}}if(Q){if(K===Q)Q=null}else if(K==="'"||K==='"'||K==="`")Q=K;Y+=K,X++}return Y;function G(K,W,q){let z;try{z=u0(K,Z,!0)}catch{return W}if(z===void 0)return W;if(q){let U=String(z).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?U.replace(/\$\{/g,"\\${"):U}if(typeof z==="string"){let U=z.trim();if(U.startsWith("{")&&U.endsWith("}")||U.startsWith("[")&&U.endsWith("]"))try{return JSON.parse(U),U}catch{}}return JSON.stringify(z)}}function bj($,Z){if($.length===0)return"";let J=$.map((Y)=>{let X=JSON.stringify(Object.fromEntries(Y.refs)),Q=HY(Y.stateExpr,Z),G=Y.initExpr?HY(Y.initExpr,Z):null,K=JSON.stringify(Q),W=G?JSON.stringify(G):"null";return`
|
|
10353
10353
|
(function() {
|
|
10354
10354
|
var scopeEl = document.querySelector('${Y.selector}');
|
|
10355
10355
|
if (!scopeEl) return;
|
|
@@ -10358,14 +10358,14 @@ window.__stx_reactive = (function() {
|
|
|
10358
10358
|
})();`}).join(`
|
|
10359
10359
|
`);return`
|
|
10360
10360
|
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
10361
|
-
${
|
|
10361
|
+
${Ej()}
|
|
10362
10362
|
${J}
|
|
10363
|
-
</script>`}function
|
|
10364
|
-
`+X.slice(G);else X+=Q;return X}function bj($,Z){let J=0,Y=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(X,Q,G)=>{let K=Z[J++];if(!K)return X;let W=/data-stx-scope="([^"]*)"/.exec(G);if(W)return K.id=W[1],K.selector=`[data-stx-scope="${K.id}"]`,X;return`<${Q} data-stx-scope="${K.id}"${G}>`});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 Sj($){return/x-data\s*=\s*["']/.test($)}var HY=0,Aj=0;var OY=b(()=>{q1()});import yj from"fs";import D6 from"path";import{createHighlighter as Pj}from"ts-syntax-highlighter";async function Cj($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let Y=(await yj.promises.stat($)).mtime.getTime();if(Z.cache&&k6.has($)){let U=k6.get($);if(U.updatedAt>=Y)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=T8(X),K=Z.markdown||Z$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=a5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)q=await vj(q,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:q,data:Q||{}};if(Z.cache)k6.set($,{...z,updatedAt:Y});return z}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let Y=J instanceof Error?J.message:String(J);return{content:j0("Markdown File",`Error reading/parsing markdown file: ${Y}`,$,"",0,""),data:{}}}}async function vj($,Z,J){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!z7)try{z7=await Pj({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,q,z)=>{let U=z.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),j=q||(J?"text":"");if(!j)return K;try{if(!z7.getSupportedLanguages().includes(j))return K;return(await z7.highlight(U,j,{theme:Z})).html}catch(H){console.error(`Error highlighting code block with language ${q}:`,H)}return K},Q=$,G=$.matchAll(Y);for(let K of G){let[W,q,z,U]=K,j=await X(W,q,z,U);Q=Q.replace(W,j)}return Q}async function FY($,Z,J="",Y={}){return await xj($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,q)=>{try{let z=K;if(!D6.isAbsolute(K))z=D6.resolve(D6.dirname(J),K);let U={};if(W)try{try{U=JSON.parse(W)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let F=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let N=L.substring(0,w).trim(),R=L.substring(w+1).trim(),A=R.startsWith('"')&&R.endsWith('"'),M=R.startsWith("'")&&R.endsWith("'");if(A||M)R=R.substring(1,R.length-1);U[N]=R}}}}catch(V){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:j,data:H}=await Cj(z,Y),B={...Z,...H,...U},_=j,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(V,F)=>{let L=F.trim();return B[L]!==void 0?String(B[L]):V}),_}catch(z){let U=z instanceof Error?z.message:String(z);return j0("Markdown File",`Error including markdown file: ${U}`,J,$,q,G)}})}async function xj($,Z,J){let Y=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,q=X;Y.push(J(...q).then((z)=>({match:K,replacement:z,index:W})))}let Q=await Promise.all(Y);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var k6,z7=null;var VY=b(()=>{V1();I0();k6=new Map});function f1($,Z){try{let J=$.trim();if(W0(J))return q0(J,Object.keys(Z))(...Object.values(Z));else return Y0(J,Z)}catch{return!1}}var LY=b(()=>{M0()});function fj($,Z,J){let Y=$,X=!0;while(X){X=!1;let Q=Y.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=V3(Y,G);if(!K)break;try{let W;if(W0(K.expression))W=q0(K.expression,Object.keys(Z))(...Object.values(Z));else W=Y0(K.expression,Z);let q="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)q=U.content.trim()}else try{let j;if(U.value&&W0(U.value))j=q0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=Y0(U.value,Z);if(W===j){q=U.content.trim(),z=!0;break}}catch{continue}Y=Y.substring(0,G)+q+Y.substring(K.end),X=!0}catch(W){let q=W instanceof Error?W.message:String(W),z=J0("Switch",`Error evaluating @switch expression: ${q}`,o.EVALUATION_ERROR);Y=Y.substring(0,G)+z+Y.substring(K.end);break}}return Y}function gj($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return Z.push(Y),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function hj($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,Y)=>Z[Number(Y)]??J)}function X5($,Z,J){let{masked:Y,scripts:X}=gj($);return hj(uj(Y,Z,J),X)}function uj($,Z,J){let Y=$;Y=fj(Y,Z,J);{let Q=!0;while(Q){Q=!1;let G=Y.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=P1(Y,K+7);if(!W)break;let q=W.endPos,z=a1(Y,"unless","endunless",q);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=Y.slice(q,z),j=W.expression,H=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=O.exec(U))!==null)L.push({pos:w.index,type:"open"});while((w=V.exec(U))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(U))!==null)L.push({pos:w.index,type:"else"});L.sort((N,R)=>N.pos-R.pos);for(let N of L)if(N.type==="open")_++;else if(N.type==="close")_--;else if(N.type==="else"&&_===0){H=N.pos;break}}let B;if(H!==-1){let _=U.slice(0,H),O=U.slice(H+5);B=`@if (${j})${O}@else ${_}@endif`}else B=`@if (!(${j}))${U}@endif`;Y=Y.substring(0,K)+B+Y.substring(z+10),Q=!0}}Y=b6(Y,Z,J),Y=S6(Y,Z,J),Y=E6(Y,Z);let X=()=>{let Q=B$(Y);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",q=!1;for(let z of K.branches){if(q)break;if(z.type==="else")W=z.content,q=!0;else try{let U;if(z.condition&&W0(z.condition))U=q0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Y0(z.condition,Z);if(U)W=z.content,q=!0}catch(U){W=J0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,o.EVALUATION_ERROR),q=!0}}Y=Y.substring(0,K.start)+W+Y.substring(K.end)}catch(W){let q=W instanceof Error?W.message:String(W),z=J0("If",`Error processing @if block: ${q}`,o.EVALUATION_ERROR);Y=Y.substring(0,K.start)+z+Y.substring(K.end)}}return!0};while(!0){let Q=Y;if(!X())break;if(Y===Q)break}return Y}function wY($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let Y=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){Y.push($[Z+1]),Z+=2;continue}if(X===J){Z++;break}Y.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:Y.join(""),consumed:Z}}function E6($,Z){let J=$;function Y(K,W,q,z){let U=1,j=z,H=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(j<K.length&&U>0){H.lastIndex=j,B.lastIndex=j;let _=H.exec(K),O=B.exec(K),V=_?_.index:1/0,F=O?O.index:1/0;if(V<F)U++,j=V+_[0].length;else if(F<1/0){if(U--,U===0)return F;j=F+O[0].length}else break}return-1}function X(K,W,q){let z=0,U=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${q}(?![a-z])`,"g"),H=/@else(?![a-z])/g,B=[],_;while((_=U.exec(K))!==null)B.push({pos:_.index,type:"open"});while((_=j.exec(K))!==null)B.push({pos:_.index,type:"close"});while((_=H.exec(K))!==null)B.push({pos:_.index,type:"else"});B.sort((O,V)=>O.pos-V.pos);for(let O of B)if(O.type==="open")z++;else if(O.type==="close")z--;else if(O.type==="else"&&z===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let W=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,z,U,j=J.slice(q+5),H=wY(j);if(H)z=H.value,U=q+5+H.consumed;else U=q+5;let B=Y(J,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let _=J.slice(U,B),O=X(_,"auth","endauth"),V;if(!Z.auth)V=!1;else V=z?f1(`auth?.check && auth?.user?.[${z}]`,Z):f1("auth?.check",Z);let F;if(O!==-1){let L=_.slice(0,O),w=_.slice(O+5);F=V?L:w}else F=V?_:"";J=J.substring(0,q)+F+J.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let W=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,z,U,j=J.slice(q+6),H=wY(j);if(H)z=H.value,U=q+6+H.consumed;else U=q+6;let B=Y(J,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let _=J.slice(U,B),O=X(_,"guest","endguest"),V;if(!Z.auth)V=!0;else V=z?f1(`!auth?.check || !auth?.user?.[${z}]`,Z):f1("!auth?.check",Z);let F;if(O!==-1){let L=_.slice(0,O),w=_.slice(O+5);F=V?L:w}else F=V?_:"";J=J.substring(0,q)+F+J.substring(B+9),K=!0}}function Q(K,W,q){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(W)z.push(W);if(q){let U=f1(q,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,q=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=J.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,H=J.slice(j+`@${K}`.length),B=G(H);if(!B)break;let _=j+`@${K}`.length+B.paramsEnd,O=Y(J,K,W,_);if(O===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let V=J.slice(_,O),F=[],L=0,w=new RegExp(`@${K}\\s*\\(`,"g"),N=new RegExp(`@${W}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),A=/@else(?![a-z])/g,M=[],T;while((T=w.exec(V))!==null)M.push({pos:T.index,type:"open"});while((T=N.exec(V))!==null)M.push({pos:T.index,type:"close"});while((T=R.exec(V))!==null)M.push({pos:T.index,type:"elseDirective"});while((T=A.exec(V))!==null)M.push({pos:T.index,type:"else"});M.sort((P,C)=>P.pos-C.pos);for(let P of M){if(P.type==="open"){L++;continue}if(P.type==="close"){L--;continue}if(L===0)F.push(P)}let I=[],E=0;for(let P=0;P<F.length;P++){let C=F[P];if(I.push({content:V.slice(E,C.pos),ability:void 0}),C.type==="elseDirective"){let x=V.slice(C.pos+`@${q}`.length),f=G(x);if(f){I[I.length-1]={content:V.slice(E,C.pos)},E=C.pos+`@${q}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let d=F[P+1],$0=d?d.pos:V.length;I.push({content:V.slice(E,$0),ability:f.ability,type:f.type,id:f.id}),E=$0}}else E=C.pos+5}if(E<V.length){let P=I[I.length-1];if(F.length>0&&F[F.length-1].type==="else")I.push({content:V.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:V.slice(E)})}let D=Q(B.ability,B.type,B.id),y=K==="can"?D:!D,S="";if(y)S=I[0]?.content||"";else{let P=!1;for(let C=1;C<I.length;C++){let x=I[C];if(x.isFinalElse){S=x.content,P=!0;break}if(x.ability){let f=Q(x.ability,x.type,x.id);if(K==="can"?f:!f){S=x.content,P=!0;break}}}if(!P&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)S=C.content}}J=J.substring(0,j)+S+J.substring(O+`@${W}`.length),z=!0}}return J}function b6($,Z,J){let Y=$;function X(Q,G,K,W,q){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),j=Q.match(U);if(!j||j.index===void 0)break;let H=j.index,B=P1(Q,H+`@${G}`.length);if(!B)break;let _=B.endPos,O=a1(Q,G,K,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${H} has no matching @${K} \u2014 the block was skipped.`);break}let V=Q.slice(_,O),F=B.expression,L=-1,w=0,N=0;while(N<V.length){let R=V.indexOf("@",N);if(R===-1)break;let A=V.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,N=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,N=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){L=R;break}N=R+1}try{let R=W(F.trim()),A;if(L!==-1){let M=V.slice(0,L),T=V.slice(L+5);A=R?M:T}else A=R?V:"";Q=Q.substring(0,H)+A+Q.substring(O+`@${K}`.length),z=!0}catch(R){let A=R instanceof Error?R.message:String(R),M=J0(q,`Error processing @${G} directive: ${A}`,o.EVALUATION_ERROR);Q=Q.substring(0,H)+M+Q.substring(O+`@${K}`.length);break}}return Q}return Y=X(Y,"isset","endisset",(Q)=>{let G=f1(Q,Z);return G!==void 0&&G!==null},"Isset"),Y=X(Y,"empty","endempty",(Q)=>{let G=f1(Q,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"),Y}function S6($,Z,J){let Y=$,X="development";function Q(G,K,W,q){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),H=new RegExp(`^@${W}(?![a-z])`),B=G,_=!0;while(_){_=!1,z.lastIndex=0;let O=z.exec(B);if(!O)break;let V=O.index,F=V+O[0].length;if(K==="env"){let D=B.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;F+=D[0].length,q=X===D[2]}let L=1,w=F,N=-1;while(L>0&&w<B.length){z.lastIndex=w,U.lastIndex=w;let D=z.exec(B),y=U.exec(B),S=D?D.index:1/0,P=y?y.index:1/0;if(S<P)L++,w=S+D[0].length;else if(P<1/0){if(L--,L===0){N=P;break}w=P+y[0].length}else break}if(N===-1){console.warn(`[stx] @${K} directive at position ${V} has no matching @${W} \u2014 the block was skipped.`);break}let R=B.substring(F,N),A=-1,M=0,T=0;while(T<R.length){let D=R.indexOf("@",T);if(D===-1)break;let y=R.substring(D);if(j.test(y)){M++,T=D+1;continue}if(H.test(y)){M--,T=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(y)){A=D;break}T=D+1}let I;if(A!==-1){let D=R.slice(0,A),y=R.slice(A+5);I=q?D:y}else I=q?R:"";let E=`@${W}`.length;B=B.substring(0,V)+I+B.substring(N+E),_=!0}return B}return Y=Q(Y,"env","endenv",!1),Y=Q(Y,"production","endproduction",X==="production"),Y=Q(Y,"development","enddevelopment",X==="development"),Y=Q(Y,"staging","endstaging",X==="staging"),Y=Q(Y,"testing","endtesting",X==="testing"),Y}var U7=b(()=>{LY();w1();Y4();M0()});function RY($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function j7($,Z){if(!$)return Z?.nonceGenerator?.()??RY();let J=NY.get($);if(!J)J=Z?.nonceGenerator?.()??RY(),NY.set($,J);return J}function mj($,Z){let J=[];for(let[Y,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)J.push(Y);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(Y==="script-src"||Y==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${Y} ${Q.join(" ")}`)}}return J.join("; ")}function AY($,Z){return`<meta http-equiv="Content-Security-Policy" content="${mj($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function MY($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=Z.useNonce?j7(J,Z):void 0,X=AY(Z.directives,Y);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
10365
|
-
${X}`)}function
|
|
10363
|
+
</script>`}function OY($,Z,J){if(_Y=0,!yj($))return $;let Y=Tj($);if(Y.length===0)return $;let X=Sj($,Y),Q=bj(Y,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
|
|
10364
|
+
`+X.slice(G);else X+=Q;return X}function Sj($,Z){let J=0,Y=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(X,Q,G)=>{let K=Z[J++];if(!K)return X;let W=/data-stx-scope="([^"]*)"/.exec(G);if(W)return K.id=W[1],K.selector=`[data-stx-scope="${K.id}"]`,X;return`<${Q} data-stx-scope="${K.id}"${G}>`});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 yj($){return/x-data\s*=\s*["']/.test($)}var _Y=0,Mj=0;var FY=b(()=>{q1()});import Pj from"fs";import D6 from"path";import{createHighlighter as Cj}from"ts-syntax-highlighter";async function vj($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let Y=(await Pj.promises.stat($)).mtime.getTime();if(Z.cache&&k6.has($)){let U=k6.get($);if(U.updatedAt>=Y)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=T8(X),K=Z.markdown||Z$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=a5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)q=await xj(q,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:q,data:Q||{}};if(Z.cache)k6.set($,{...z,updatedAt:Y});return z}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let Y=J instanceof Error?J.message:String(J);return{content:j0("Markdown File",`Error reading/parsing markdown file: ${Y}`,$,"",0,""),data:{}}}}async function xj($,Z,J){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!z7)try{z7=await Cj({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,q,z)=>{let U=z.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),j=q||(J?"text":"");if(!j)return K;try{if(!z7.getSupportedLanguages().includes(j))return K;return(await z7.highlight(U,j,{theme:Z})).html}catch(H){console.error(`Error highlighting code block with language ${q}:`,H)}return K},Q=$,G=$.matchAll(Y);for(let K of G){let[W,q,z,U]=K,j=await X(W,q,z,U);Q=Q.replace(W,j)}return Q}async function VY($,Z,J="",Y={}){return await fj($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,q)=>{try{let z=K;if(!D6.isAbsolute(K))z=D6.resolve(D6.dirname(J),K);let U={};if(W)try{try{U=JSON.parse(W)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let F=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let N=L.substring(0,w).trim(),R=L.substring(w+1).trim(),A=R.startsWith('"')&&R.endsWith('"'),M=R.startsWith("'")&&R.endsWith("'");if(A||M)R=R.substring(1,R.length-1);U[N]=R}}}}catch(V){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:j,data:H}=await vj(z,Y),B={...Z,...H,...U},_=j,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(V,F)=>{let L=F.trim();return B[L]!==void 0?String(B[L]):V}),_}catch(z){let U=z instanceof Error?z.message:String(z);return j0("Markdown File",`Error including markdown file: ${U}`,J,$,q,G)}})}async function fj($,Z,J){let Y=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,q=X;Y.push(J(...q).then((z)=>({match:K,replacement:z,index:W})))}let Q=await Promise.all(Y);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var k6,z7=null;var LY=b(()=>{V1();I0();k6=new Map});function f1($,Z){try{let J=$.trim();if(W0(J))return q0(J,Object.keys(Z))(...Object.values(Z));else return Y0(J,Z)}catch{return!1}}var wY=b(()=>{M0()});function gj($,Z,J){let Y=$,X=!0;while(X){X=!1;let Q=Y.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=V3(Y,G);if(!K)break;try{let W;if(W0(K.expression))W=q0(K.expression,Object.keys(Z))(...Object.values(Z));else W=Y0(K.expression,Z);let q="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)q=U.content.trim()}else try{let j;if(U.value&&W0(U.value))j=q0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=Y0(U.value,Z);if(W===j){q=U.content.trim(),z=!0;break}}catch{continue}Y=Y.substring(0,G)+q+Y.substring(K.end),X=!0}catch(W){let q=W instanceof Error?W.message:String(W),z=J0("Switch",`Error evaluating @switch expression: ${q}`,o.EVALUATION_ERROR);Y=Y.substring(0,G)+z+Y.substring(K.end);break}}return Y}function hj($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return Z.push(Y),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function uj($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,Y)=>Z[Number(Y)]??J)}function X5($,Z,J){let{masked:Y,scripts:X}=hj($);return uj(mj(Y,Z,J),X)}function mj($,Z,J){let Y=$;Y=gj(Y,Z,J);{let Q=!0;while(Q){Q=!1;let G=Y.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=P1(Y,K+7);if(!W)break;let q=W.endPos,z=a1(Y,"unless","endunless",q);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=Y.slice(q,z),j=W.expression,H=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=O.exec(U))!==null)L.push({pos:w.index,type:"open"});while((w=V.exec(U))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(U))!==null)L.push({pos:w.index,type:"else"});L.sort((N,R)=>N.pos-R.pos);for(let N of L)if(N.type==="open")_++;else if(N.type==="close")_--;else if(N.type==="else"&&_===0){H=N.pos;break}}let B;if(H!==-1){let _=U.slice(0,H),O=U.slice(H+5);B=`@if (${j})${O}@else ${_}@endif`}else B=`@if (!(${j}))${U}@endif`;Y=Y.substring(0,K)+B+Y.substring(z+10),Q=!0}}Y=b6(Y,Z,J),Y=S6(Y,Z,J),Y=E6(Y,Z);let X=()=>{let Q=B$(Y);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",q=!1;for(let z of K.branches){if(q)break;if(z.type==="else")W=z.content,q=!0;else try{let U;if(z.condition&&W0(z.condition))U=q0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Y0(z.condition,Z);if(U)W=z.content,q=!0}catch(U){W=J0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,o.EVALUATION_ERROR),q=!0}}Y=Y.substring(0,K.start)+W+Y.substring(K.end)}catch(W){let q=W instanceof Error?W.message:String(W),z=J0("If",`Error processing @if block: ${q}`,o.EVALUATION_ERROR);Y=Y.substring(0,K.start)+z+Y.substring(K.end)}}return!0};while(!0){let Q=Y;if(!X())break;if(Y===Q)break}return Y}function NY($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let Y=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){Y.push($[Z+1]),Z+=2;continue}if(X===J){Z++;break}Y.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:Y.join(""),consumed:Z}}function E6($,Z){let J=$;function Y(K,W,q,z){let U=1,j=z,H=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(j<K.length&&U>0){H.lastIndex=j,B.lastIndex=j;let _=H.exec(K),O=B.exec(K),V=_?_.index:1/0,F=O?O.index:1/0;if(V<F)U++,j=V+_[0].length;else if(F<1/0){if(U--,U===0)return F;j=F+O[0].length}else break}return-1}function X(K,W,q){let z=0,U=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${q}(?![a-z])`,"g"),H=/@else(?![a-z])/g,B=[],_;while((_=U.exec(K))!==null)B.push({pos:_.index,type:"open"});while((_=j.exec(K))!==null)B.push({pos:_.index,type:"close"});while((_=H.exec(K))!==null)B.push({pos:_.index,type:"else"});B.sort((O,V)=>O.pos-V.pos);for(let O of B)if(O.type==="open")z++;else if(O.type==="close")z--;else if(O.type==="else"&&z===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let W=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,z,U,j=J.slice(q+5),H=NY(j);if(H)z=H.value,U=q+5+H.consumed;else U=q+5;let B=Y(J,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let _=J.slice(U,B),O=X(_,"auth","endauth"),V;if(!Z.auth)V=!1;else V=z?f1(`auth?.check && auth?.user?.[${z}]`,Z):f1("auth?.check",Z);let F;if(O!==-1){let L=_.slice(0,O),w=_.slice(O+5);F=V?L:w}else F=V?_:"";J=J.substring(0,q)+F+J.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let W=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,z,U,j=J.slice(q+6),H=NY(j);if(H)z=H.value,U=q+6+H.consumed;else U=q+6;let B=Y(J,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let _=J.slice(U,B),O=X(_,"guest","endguest"),V;if(!Z.auth)V=!0;else V=z?f1(`!auth?.check || !auth?.user?.[${z}]`,Z):f1("!auth?.check",Z);let F;if(O!==-1){let L=_.slice(0,O),w=_.slice(O+5);F=V?L:w}else F=V?_:"";J=J.substring(0,q)+F+J.substring(B+9),K=!0}}function Q(K,W,q){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(W)z.push(W);if(q){let U=f1(q,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,q=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=J.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,H=J.slice(j+`@${K}`.length),B=G(H);if(!B)break;let _=j+`@${K}`.length+B.paramsEnd,O=Y(J,K,W,_);if(O===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let V=J.slice(_,O),F=[],L=0,w=new RegExp(`@${K}\\s*\\(`,"g"),N=new RegExp(`@${W}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),A=/@else(?![a-z])/g,M=[],T;while((T=w.exec(V))!==null)M.push({pos:T.index,type:"open"});while((T=N.exec(V))!==null)M.push({pos:T.index,type:"close"});while((T=R.exec(V))!==null)M.push({pos:T.index,type:"elseDirective"});while((T=A.exec(V))!==null)M.push({pos:T.index,type:"else"});M.sort((P,C)=>P.pos-C.pos);for(let P of M){if(P.type==="open"){L++;continue}if(P.type==="close"){L--;continue}if(L===0)F.push(P)}let I=[],E=0;for(let P=0;P<F.length;P++){let C=F[P];if(I.push({content:V.slice(E,C.pos),ability:void 0}),C.type==="elseDirective"){let x=V.slice(C.pos+`@${q}`.length),f=G(x);if(f){I[I.length-1]={content:V.slice(E,C.pos)},E=C.pos+`@${q}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let d=F[P+1],$0=d?d.pos:V.length;I.push({content:V.slice(E,$0),ability:f.ability,type:f.type,id:f.id}),E=$0}}else E=C.pos+5}if(E<V.length){let P=I[I.length-1];if(F.length>0&&F[F.length-1].type==="else")I.push({content:V.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:V.slice(E)})}let D=Q(B.ability,B.type,B.id),y=K==="can"?D:!D,S="";if(y)S=I[0]?.content||"";else{let P=!1;for(let C=1;C<I.length;C++){let x=I[C];if(x.isFinalElse){S=x.content,P=!0;break}if(x.ability){let f=Q(x.ability,x.type,x.id);if(K==="can"?f:!f){S=x.content,P=!0;break}}}if(!P&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)S=C.content}}J=J.substring(0,j)+S+J.substring(O+`@${W}`.length),z=!0}}return J}function b6($,Z,J){let Y=$;function X(Q,G,K,W,q){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),j=Q.match(U);if(!j||j.index===void 0)break;let H=j.index,B=P1(Q,H+`@${G}`.length);if(!B)break;let _=B.endPos,O=a1(Q,G,K,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${H} has no matching @${K} \u2014 the block was skipped.`);break}let V=Q.slice(_,O),F=B.expression,L=-1,w=0,N=0;while(N<V.length){let R=V.indexOf("@",N);if(R===-1)break;let A=V.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,N=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,N=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){L=R;break}N=R+1}try{let R=W(F.trim()),A;if(L!==-1){let M=V.slice(0,L),T=V.slice(L+5);A=R?M:T}else A=R?V:"";Q=Q.substring(0,H)+A+Q.substring(O+`@${K}`.length),z=!0}catch(R){let A=R instanceof Error?R.message:String(R),M=J0(q,`Error processing @${G} directive: ${A}`,o.EVALUATION_ERROR);Q=Q.substring(0,H)+M+Q.substring(O+`@${K}`.length);break}}return Q}return Y=X(Y,"isset","endisset",(Q)=>{let G=f1(Q,Z);return G!==void 0&&G!==null},"Isset"),Y=X(Y,"empty","endempty",(Q)=>{let G=f1(Q,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"),Y}function S6($,Z,J){let Y=$,X="development";function Q(G,K,W,q){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),H=new RegExp(`^@${W}(?![a-z])`),B=G,_=!0;while(_){_=!1,z.lastIndex=0;let O=z.exec(B);if(!O)break;let V=O.index,F=V+O[0].length;if(K==="env"){let D=B.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;F+=D[0].length,q=X===D[2]}let L=1,w=F,N=-1;while(L>0&&w<B.length){z.lastIndex=w,U.lastIndex=w;let D=z.exec(B),y=U.exec(B),S=D?D.index:1/0,P=y?y.index:1/0;if(S<P)L++,w=S+D[0].length;else if(P<1/0){if(L--,L===0){N=P;break}w=P+y[0].length}else break}if(N===-1){console.warn(`[stx] @${K} directive at position ${V} has no matching @${W} \u2014 the block was skipped.`);break}let R=B.substring(F,N),A=-1,M=0,T=0;while(T<R.length){let D=R.indexOf("@",T);if(D===-1)break;let y=R.substring(D);if(j.test(y)){M++,T=D+1;continue}if(H.test(y)){M--,T=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(y)){A=D;break}T=D+1}let I;if(A!==-1){let D=R.slice(0,A),y=R.slice(A+5);I=q?D:y}else I=q?R:"";let E=`@${W}`.length;B=B.substring(0,V)+I+B.substring(N+E),_=!0}return B}return Y=Q(Y,"env","endenv",!1),Y=Q(Y,"production","endproduction",X==="production"),Y=Q(Y,"development","enddevelopment",X==="development"),Y=Q(Y,"staging","endstaging",X==="staging"),Y=Q(Y,"testing","endtesting",X==="testing"),Y}var U7=b(()=>{wY();w1();Y4();M0()});function AY($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function j7($,Z){if(!$)return Z?.nonceGenerator?.()??AY();let J=RY.get($);if(!J)J=Z?.nonceGenerator?.()??AY(),RY.set($,J);return J}function dj($,Z){let J=[];for(let[Y,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)J.push(Y);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(Y==="script-src"||Y==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${Y} ${Q.join(" ")}`)}}return J.join("; ")}function MY($,Z){return`<meta http-equiv="Content-Security-Policy" content="${dj($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function TY($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=Z.useNonce?j7(J,Z):void 0,X=MY(Z.directives,Y);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
10365
|
+
${X}`)}function IY($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,X)=>{if(X.includes("nonce="))return Y;return`<script nonce="${Z}"${X}>`}),J=J.replace(/<style([^>]*)>/gi,(Y,X)=>{if(X.includes("nonce="))return Y;return`<style nonce="${Z}"${X}>`}),J}function DY($,Z,J,Y){let X=$,Q=Y.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?j7(Z,Q):void 0;return MY(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return j7(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=j7(Z,Q);return X}var RY;var kY=b(()=>{RY=new WeakMap});import pj from"crypto";function cj($=lj){let Z=pj.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return y6=Z,Z}function ij(){if(!y6)cj();return y6}function nj($=EY){let Z=ij();return`<input type="hidden" name="${$}" value="${Z}">`}function bY($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,Y)=>{return nj(Y||EY)})}var lj=40,EY="_token",y6=null;var SY=()=>{};async function yY($,Z,J,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return $;let X=$;for(let Q of Y.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)X=await oj(X,Q,Z,J,Y);else X=await sj(X,Q,Z,J,Y)}return X}async function oj($,Z,J,Y,X){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,q=$,z=N5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),U=[],j=z.exec(q);while(j!==null){let[H,B="",_=""]=j,O=j.index||0;try{let V=B?PY(B):[],F=_.trim(),L=await G(F,V,J,Y);U.push({original:H,processed:L,startIndex:O})}catch(V){let F=V instanceof Error?V.message:String(V);if(X.debug)console.error(`Error processing custom directive @${Q}:`,V);U.push({original:H,processed:J0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${F}`,o.EVALUATION_ERROR),startIndex:O})}j=z.exec(q)}for(let H=U.length-1;H>=0;H--){let{original:B,processed:_}=U[H];q=q.replace(B,_)}return q}async function sj($,Z,J,Y,X){let{name:Q,handler:G}=Z,K=$,W=N5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],z=W.exec(K);while(z!==null){let[H,B=""]=z,_=z.index||0;try{let O=PY(B),V=await G("",O,J,Y);q.push({original:H,processed:V,startIndex:_})}catch(O){let V=O instanceof Error?O.message:String(O);if(X.debug)console.error(`Error processing custom directive @${Q}:`,O);q.push({original:H,processed:J0("CustomDirective",`Error in @${Q}(${B}): ${V}`,o.EVALUATION_ERROR),startIndex:_})}z=W.exec(K)}let U=N5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=U.exec(K);while(j!==null){let[H]=j,B=j.index||0;try{let _=await G("",[],J,Y);q.push({original:H,processed:_,startIndex:B})}catch(_){let O=_ instanceof Error?_.message:String(_);if(X.debug)console.error(`Error processing custom directive @${Q}:`,_);q.push({original:H,processed:J0("CustomDirective",`Error in @${Q}: ${O}`,o.EVALUATION_ERROR),startIndex:B})}j=U.exec(K)}for(let H=q.length-1;H>=0;H--){let{original:B,processed:_}=q[H];K=K.replace(B,_)}return K}function PY($){if(!$.trim())return[];let Z=[],J="",Y=!1,X="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!Y)Y=!0,X=G;else if(G===X)Y=!1;else J+=G;else if(G===","&&!Y)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var CY=b(()=>{w1();R5()});function Q5($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function aj($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,Y=Z.colorMode;if(Q5(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(Q5(J.key,"appearance.key"),Q5(J.attribute,"appearance.attribute"),Q5(J.default,"appearance.default"),Q5(Y.key,"colorMode.key"),Q5(Y.attribute,"colorMode.attribute"),Q5(Y.default,"colorMode.default"),!xY.test(J.key)||!xY.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!vY.test(J.attribute)||!vY.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((X)=>typeof X!=="string"||X.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!rj.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function tj($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ej($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${tj($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function $B($,Z){let J=1,Y=null,X=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(X){X=!1;continue}if(Y){if(G==="\\")X=!0;else if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function fY($,Z){let J=$,Y=/@appearanceBootstrap\s*\(/g,X;while((X=Y.exec(J))!==null){let Q=X.index+X[0].length-1,G=$B(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=J.slice(Q+1,G).trim(),W=Y0(`(${K})`,Z),q=ej(aj(W));J=J.slice(0,X.index)+q+J.slice(G+1),Y.lastIndex=X.index+q.length}return J}var vY,xY,rj;var gY=b(()=>{M0();vY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,xY=/^[A-Za-z_$][\w$]*$/,rj=new Set(["light","dark","system"])});import ZB from"crypto";function V0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function B7($,Z,J,Y){let X=$||Z;return J?`${X} ${Y}`:X}function o0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function S5($,Z){if(/\bid\s*=/i.test($))return"";return` id="${V0(Z)}"`}function P6($,Z,J){if(!Z)return"";let Y="";if(!/\baria-invalid\s*=/i.test(J))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))Y+=` aria-describedby="${V0(`${o0($)}-error`)}"`;return Y}function JB(){return ZB.randomUUID()}function H7($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let Y=JB();Z.csrf={token:Y}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${V0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,X)=>{let Q=X.toUpperCase();if(X&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${V0(Q)}">`;return Y}),J}function mY($,Z,J=uY){let Y=$;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,W,q="")=>{let z=Q||G||"POST",U=K||W||"",j=g1(q),H=z.toUpperCase(),B=["GET","POST"].includes(H)?H:"POST",_=`<form method="${V0(B)}" action="${V0(U)}"${j?` ${j}`:""}>`;if(_+=`
|
|
10366
10366
|
${H7("@csrf",Z)}`,!["GET","POST"].includes(H))_+=`
|
|
10367
|
-
${H7(`@method('${H}')`,Z)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,q="")=>{let z=Q||G||"",U=K||W||"",j=g1(q),H=M$(z,Z),B=H!==void 0&&H!==null?H:U||"",_=j.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",V=T$(z,Z),F=j.match(/class=['"]([^'"]+)['"]/i),L=B7(F?F[1]:"",J.input,V,J.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(O)}" name="${V0(z)}"${S5(j,o0(z))} value="${V0(B)}" class="${L}"${P6(z,V,j)}${w?` ${w}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=g1(G),q=M$(Q,Z)||K.trim(),z=T$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=B7(U?U[1]:"",J.input,z,J.inputError),H=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(Q)}"${S5(W,o0(Q))} class="${j}"${P6(Q,z,W)}${H?` ${H}`:""}>${V0(q)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=g1(G),q=M$(Q,Z),z=T$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=B7(U?U[1]:"",J.input,z,J.inputError),H=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(q!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,V)=>{if((Array.isArray(q)?q.some((L)=>String(L)===V):String(q)===V)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${V0(Q)}"${S5(W,o0(Q))} class="${j}"${P6(Q,z,W)}${H?` ${H}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=G===void 0?"1":G,q=G===void 0?o0(Q):`${o0(Q)}-${o0(W)}`,z=g1(K),U=M$(Q,Z),j=U!==void 0&&(Array.isArray(U)?U.some((O)=>String(O)===W):U===!0||String(U)===W),H=z.match(/class=['"]([^'"]+)['"]/i),B=H?H[1]:J.checkInput,_=z.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(Q)}"${S5(z,q)} value="${V0(W)}" class="${B}"${j?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=g1(K),q=M$(Q,Z),z=q!==void 0&&q===G,U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:J.checkInput,H=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(Q)}"${S5(W,`${o0(Q)}-${o0(G)}`)} value="${V0(G)}" class="${j}"${z?" checked":""}${H?` ${H}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=g1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),q=W?W[1]:"",z=K.includes("multiple"),U=T$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),H=B7(j?j[1]:"",J.input,U,J.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${V0(Q)}"${S5(K,o0(Q))}`,`class="${H}"`];if(q)_.push(`accept="${V0(q)}"`);if(z)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=g1(G),q=W.match(/class=['"]([^'"]+)['"]/i),z=q?q[1]:J.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(o0(Q))}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),Y}function
|
|
10368
|
-
`),Y=[{obj:Z,indent:-1}];for(let X of J){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=G)Y.pop();let K=Y[Y.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,q,z]=W,U=q.trim(),j=z.trim();if(j==="")K[U]={},Y.push({obj:K[U],indent:G});else K[U]=
|
|
10367
|
+
${H7(`@method('${H}')`,Z)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,q="")=>{let z=Q||G||"",U=K||W||"",j=g1(q),H=M$(z,Z),B=H!==void 0&&H!==null?H:U||"",_=j.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",V=T$(z,Z),F=j.match(/class=['"]([^'"]+)['"]/i),L=B7(F?F[1]:"",J.input,V,J.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(O)}" name="${V0(z)}"${S5(j,o0(z))} value="${V0(B)}" class="${L}"${P6(z,V,j)}${w?` ${w}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=g1(G),q=M$(Q,Z)||K.trim(),z=T$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=B7(U?U[1]:"",J.input,z,J.inputError),H=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(Q)}"${S5(W,o0(Q))} class="${j}"${P6(Q,z,W)}${H?` ${H}`:""}>${V0(q)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=g1(G),q=M$(Q,Z),z=T$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=B7(U?U[1]:"",J.input,z,J.inputError),H=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(q!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,V)=>{if((Array.isArray(q)?q.some((L)=>String(L)===V):String(q)===V)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${V0(Q)}"${S5(W,o0(Q))} class="${j}"${P6(Q,z,W)}${H?` ${H}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=G===void 0?"1":G,q=G===void 0?o0(Q):`${o0(Q)}-${o0(W)}`,z=g1(K),U=M$(Q,Z),j=U!==void 0&&(Array.isArray(U)?U.some((O)=>String(O)===W):U===!0||String(U)===W),H=z.match(/class=['"]([^'"]+)['"]/i),B=H?H[1]:J.checkInput,_=z.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(Q)}"${S5(z,q)} value="${V0(W)}" class="${B}"${j?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=g1(K),q=M$(Q,Z),z=q!==void 0&&q===G,U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:J.checkInput,H=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(Q)}"${S5(W,`${o0(Q)}-${o0(G)}`)} value="${V0(G)}" class="${j}"${z?" checked":""}${H?` ${H}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=g1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),q=W?W[1]:"",z=K.includes("multiple"),U=T$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),H=B7(j?j[1]:"",J.input,U,J.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${V0(Q)}"${S5(K,o0(Q))}`,`class="${H}"`];if(q)_.push(`accept="${V0(q)}"`);if(z)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=g1(G),q=W.match(/class=['"]([^'"]+)['"]/i),z=q?q[1]:J.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(o0(Q))}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),Y}function dY($,Z,J=uY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,X,Q)=>{try{if(T$(X,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(K,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return hY(X,Z);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return hY(X,Z)}let q=W.trim();if(W0(q)){let z=Y0(q,Z);return z!==void 0?String(z):q}return q}catch{return W}});return`<div id="${V0(`${o0(X)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),Y}})}function T$($,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 hY($,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 J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function M$($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let Y=$.slice(0,-2);if(J=Z[Y],J!==void 0)return J}return Z[$]}function g1($){if(!$.trim())return"";let Z=[],J=$.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=Y.exec(J))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var uY;var pY=b(()=>{M0();uY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import x6 from"path";async function YB(){if(I$!==void 0)return I$;try{I$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{I$=null}return I$}function XB($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function QB($,Z){if({...h6,...Z.i18n}.cache&&f6[$]){let X=f6[$],Q=Z.i18n?.cacheMaxAge??0;if(!XB(X,Q))return X.translations}if(D$[$]?.state==="loading")return D$[$].promise;C6[$]="loading";let Y=g6($,Z).then((X)=>{return C6[$]="loaded",delete D$[$],X}).catch((X)=>{throw C6[$]="error",D$[$]={promise:Y,state:"error",error:X instanceof Error?X:Error(String(X))},X});return D$[$]={promise:Y,state:"loading"},Y}async function g6($,Z){let J={...h6,...Z.i18n},Y=x6.isAbsolute(J.translationsDir)?J.translationsDir:x6.resolve(Z.root||process.cwd(),J.translationsDir);try{let X=await YB(),Q=X?await X($,{translationsDir:Y,defaultLocale:J.defaultLocale,sources:zB(J.format)}):await GB($,J,Y);if(Q===void 0){if($!==J.defaultLocale)return g6(J.defaultLocale,Z);return{}}let G=Q;if(J.cache)f6[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(X){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,X);if($!==J.defaultLocale)return g6(J.defaultLocale,Z);return{}}}async function GB($,Z,J){let Y=x6.join(J,`${$}${KB(Z.format)}`);try{let X=await import(Y);return X.default||X}catch(X){try{let Q=await Bun.file(Y).text();if(Z.format==="yaml"||Z.format==="yml")return WB(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function KB($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function WB($){let Z={},J=$.split(`
|
|
10368
|
+
`),Y=[{obj:Z,indent:-1}];for(let X of J){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=G)Y.pop();let K=Y[Y.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,q,z]=W,U=q.trim(),j=z.trim();if(j==="")K[U]={},Y.push({obj:K[U],indent:G});else K[U]=qB(j)}}return Z}function qB($){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 J=Number($);if(!Number.isNaN(J)&&$!=="")return J;return $}function zB($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function UB($,Z){return QB($,Z)}function jB($,Z){for(let J of $){let Y=J.trim(),X=Y.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function BB($,Z={}){return iY($,Z)}function iY($,Z){let J="",Y=0;while(Y<$.length)if($[Y]==="{"){let X=HB($,Y);if(X===-1){J+=$[Y],Y++;continue}let Q=$.slice(Y+1,X);J+=_B(Q,Z),Y=X+1}else if($[Y]==="'"&&Y+1<$.length)if($[Y+1]==="'")J+="'",Y+=2;else if($[Y+1]==="{"||$[Y+1]==="}")J+=$[Y+1],Y+=2;else J+=$[Y],Y++;else J+=$[Y],Y++;return J}function HB($,Z){let J=0;for(let Y=Z;Y<$.length;Y++)if($[Y]==="{")J++;else if($[Y]==="}"){if(J--,J===0)return Y}return-1}function _B($,Z){let J=OB($);if(J.length===0)return`{${$}}`;let Y=J[0].trim(),X=Z[Y];if(J.length===1)return X!==void 0?String(X):`{${Y}}`;switch(J[1].trim().toLowerCase()){case"plural":return FB(X,J.slice(2).join(","),Z);case"select":return LB(X,J.slice(2).join(","));case"selectordinal":return wB(X,J.slice(2).join(","));case"number":return RB(X,J[2]?.trim());case"date":return AB(X,J[2]?.trim());case"time":return MB(X,J[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function OB($){let Z=[],J="",Y=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")Y++,J+=Q;else if(Q==="}")Y--,J+=Q;else if(Q===","&&Y===0)Z.push(J),J="";else J+=Q}if(J)Z.push(J);return Z}function FB($,Z,J){let Y=Number($)||0,X=u6(Z),Q=`=${Y}`;if(X[Q])return v6(X[Q],Y,J);let G=VB(Y);if(X[G])return v6(X[G],Y,J);if(X.other)return v6(X.other,Y,J);return String(Y)}function v6($,Z,J){let Y=$.replace(/#/g,String(Z));return iY(Y,J)}function VB($){let Z=Math.abs($),J=Math.floor(Z),Y=String($).includes(".")?String($).split(".")[1].length:0;if(J===1&&Y===0)return"one";return"other"}function LB($,Z){let J=String($||""),Y=u6(Z);if(Y[J])return Y[J];return Y.other||String($)}function wB($,Z){let J=Number($)||0,Y=u6(Z),X=NB(J);if(Y[X])return Y[X].replace(/#/g,String(J));if(Y.other)return Y.other.replace(/#/g,String(J));return String(J)}function NB($){let Z=Math.abs($),J=Z%10,Y=Z%100;if(J===1&&Y!==11)return"one";if(J===2&&Y!==12)return"two";if(J===3&&Y!==13)return"few";return"other"}function u6($){let Z={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=J.exec($);while(Y!==null)Z[Y[1]]=Y[2],Y=J.exec($);return Z}function RB($,Z){let J=Number($);if(Number.isNaN(J))return String($);switch(Z){case"integer":return Math.floor(J).toLocaleString();case"percent":return`${(J*100).toFixed(0)}%`;case"currency":return J.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return J.toLocaleString()}}function AB($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return J.toLocaleDateString(void 0,Y)}function MB($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return J.toLocaleTimeString(void 0,Y)}function TB($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function lY($,Z,J=!0,Y={}){let X=$.split("."),Q=Z;for(let K of X){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return J?$:"";let G=String(Q);if(TB(G))return BB(G,Y);if(G.includes("|")&&"count"in Y){let K=Number(Y.count),W=G.split("|");G=jB(W,K)}for(let[K,W]of Object.entries(Y)){let q=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${q}`,"g"),String(W))}return G}async function nY($,Z,J,Y){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...h6,...Y.i18n},K=await UB(G.locale,Y);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await cY(X,Q,async(z,U,j,H,B)=>{try{let _={};if(j)try{let V=[()=>JSON.parse(j),()=>{let F=`{"data":${j}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return A0(j,Z)}];for(let F of V)try{if(_=F(),Object.keys(_).length>0)break}catch{}}catch(V){if(Y.debug)console.error("Error parsing parameters for @translate directive:",V)}return lY(U,K,G.fallbackToKey,_)||H.trim()}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return J0("Translate",`Error in @translate('${U}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...X.matchAll(W)];console.warn(`Found ${z.length} @translate matches`),z.forEach((U,j)=>console.warn(`Match ${j}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return X=await cY(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,U,j,H)=>{try{let B={};if(j)try{let _=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return A0(j,Z)}];for(let O of _)try{if(B=O(),Object.keys(B).length>0)break}catch{}}catch(_){if(Y.debug)console.error("Error parsing parameters for @translate directive:",_)}return lY(U,K,G.fallbackToKey,B)}catch(B){if(Y.debug)console.error("Error processing @translate directive:",B);return J0("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),X}async function cY($,Z,J){let Y=[];return $.replace(Z,(Q,...G)=>{let K=J(Q,...G).then((W)=>({match:Q,replacement:W}));return Y.push(K),Q}),(await Promise.all(Y)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var I$,h6,f6,D$,C6;var oY=b(()=>{w1();M0();h6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},f6={},D$={},C6={}});var p6={};t(p6,{streamingSuspenseDirective:()=>aY,streamToResponse:()=>fB,streamTemplateSimple:()=>PB,streamTemplate:()=>DB,renderStreamingPage:()=>EB,registerStreamingDirectives:()=>vB,processStreamDirectives:()=>SB,processSectionDirectives:()=>xB,islandDirective:()=>tY,generateHydrationRuntime:()=>gB,extractStreamBoundaries:()=>yB,createStreamRenderer:()=>CB,buildSuspenseResolveScript:()=>d6,SUSPENSE_RESOLVER_RUNTIME:()=>rY});import _7 from"path";function IB($){let Z=[],J=0,Y;sY.lastIndex=0;while((Y=sY.exec($))!==null){if(Y.index>J){let G=$.slice(J,Y.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let X=Y[1],Q=Y[2];Z.push({type:"suspense",name:X,content:Q}),J=Y.index+Y[0].length}if(J<$.length){let X=$.slice(J);if(X.trim())Z.push({type:Z.length===0?"shell":"content",content:X})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function DB($,Z={},J={}){let Y={...Y5,...J,streaming:{...m6,...J.streaming}},X=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:_7.dirname($)};if(W.trim())await r1(W,z,$);let U=IB(q),j=new Set;if(!U.some((B)=>B.type==="suspense")){let B=Y.streaming?.strategy||"auto",_=new RegExp(G5.source,"g");if(!(B!=="manual"&&_.test(q))){let V=await F0(q,z,$,Y,j);for(let F=0;F<V.length;F+=X)Q.enqueue(V.slice(F,F+X)),await new Promise((L)=>setTimeout(L,0))}else{let V=[],F=new RegExp(G5.source,"g"),L;while((L=F.exec(q))!==null)V.push({name:L[1],content:L[2],start:L.index,end:L.index+L[0].length});let w=0;for(let N of V){if(N.start>w){let A=q.slice(w,N.start);if(A.trim()){let M=await F0(A,z,$,Y,j);Q.enqueue(M),await new Promise((T)=>setTimeout(T,0))}}let R=await F0(N.content,z,$,Y,j);Q.enqueue(R),await new Promise((A)=>setTimeout(A,0)),w=N.end}if(w<q.length){let N=q.slice(w);if(N.trim()){let R=await F0(N,z,$,Y,j);Q.enqueue(R)}}}}else{let B=new Map;for(let O of U)if(O.type==="shell"||O.type==="content"){let V=await F0(O.content,z,$,Y,j);Q.enqueue(V)}else if(O.type==="suspense"&&O.name){let V=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${V}" data-suspense="${O.name}" style="display:contents;">
|
|
10369
10369
|
<template data-suspense-fallback>Loading...</template>
|
|
10370
10370
|
</div>`),B.set(O.name,F0(O.content,z,$,Y,j))}Q.enqueue(`
|
|
10371
10371
|
<script>
|
|
@@ -10389,7 +10389,7 @@ window.__stxSuspense.resolve('${$}', \`${Y}\`);
|
|
|
10389
10389
|
</script>`}catch(J){let Y=J instanceof Error?J.message:String(J);return`
|
|
10390
10390
|
<script>
|
|
10391
10391
|
window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${t0(Y)}</div>');
|
|
10392
|
-
</script>`}}function
|
|
10392
|
+
</script>`}}function kB($,Z,J){if(!Z||Z<=0)return $;let Y,X=new Promise((Q,G)=>{Y=setTimeout(()=>G(Error(`streaming boundary "${J}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(Y))}function EB($,Z=[],J={}){let Y=J.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(rY),await Promise.all(Z.map(async(Q)=>{let G=kB(Q.render(),Y,Q.id);X.enqueue(await d6(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function SB($,Z){return $.replace(bB,(J,Y,X)=>{let Q=Y.trim(),G=X.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function yB($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let J=Object.entries(Z).filter(([,Y])=>typeof Y==="function");return J.length>0?J.map(([Y,X])=>({id:Y,render:X})):void 0}async function PB($,Z={},J={}){let Y={...Y5,...J,streaming:{...m6,...J.streaming}},X=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:_7.dirname($)};if(W.trim())await r1(W,z,$);let U=new Set,j=Y.streaming?.strategy||"auto",H=new RegExp(G5.source,"g");if(!(j!=="manual"&&H.test(q))){let _=await F0(q,z,$,Y,U);for(let O=0;O<_.length;O+=X)Q.enqueue(_.slice(O,O+X))}else{let _=[],O=new RegExp(G5.source,"g"),V;while((V=O.exec(q))!==null)_.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let F=0;for(let L of _){if(L.start>F){let N=q.slice(F,L.start);if(N.trim()){let R=await F0(N,z,$,Y,U);Q.enqueue(R)}}let w=await F0(L.content,z,$,Y,U);Q.enqueue(w),F=L.end}if(F<q.length){let L=q.slice(F);if(L.trim()){let w=await F0(L,z,$,Y,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function CB($,Z={}){let J={...Y5,...Z,streaming:{...m6,...Z.streaming}},Y=await Bun.file($).text(),X=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},q;G5.lastIndex=0;while((q=G5.exec(G))!==null){let j=q[1],H=q[2];W[j]=H}let z=G.replace(G5,"");return{renderShell:async(j={})=>{let H={...j,__filename:$,__dirname:_7.dirname($)};return await r1(Q,H,$),F0(z,H,$,J,new Set)},renderSection:async(j,H={})=>{try{if(!W[j])return`<div class="error-message">Section "${t0(j)}" not found in template "${t0($)}"</div>`;let B={...H,__filename:$,__dirname:_7.dirname($)};await r1(Q,B,$);let _=new Set;return await F0(W[j],B,$,J,_)}catch(B){let _=B instanceof Error?B.message:String(B);return j0("Expression",_,$,W[j]||"",0,W[j]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function vB($={}){let Z=[];if($.streaming?.enabled)Z.push(aY);if($.hydration?.enabled)Z.push(tY);return Z}async function xB($,Z,J,Y={}){return $}function fB($,Z={}){let J=new TextEncoder,Y=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(J.encode(Q))}})),X=new Headers(Z.headers);if(!X.has("Content-Type"))X.set("Content-Type","text/html; charset=utf-8");if(!X.has("Transfer-Encoding"))X.set("Transfer-Encoding","chunked");if(!X.has("X-Content-Type-Options"))X.set("X-Content-Type-Options","nosniff");if(!X.has("X-Accel-Buffering"))X.set("X-Accel-Buffering","no");return new Response(Y,{...Z,headers:X})}function gB($={mode:"full"}){let{mode:Z,components:J={},dynamicImports:Y=!0}=$,X=Object.entries(J).map(([Q,G])=>`'${Q}': ${Y?`() => import('${G}')`:`require('${G}')`}`).join(`,
|
|
10393
10393
|
`);if(Z==="loader")return`
|
|
10394
10394
|
(function() {
|
|
10395
10395
|
window.__stx = window.__stx || {};
|
|
@@ -10531,7 +10531,7 @@ else {
|
|
|
10531
10531
|
else {
|
|
10532
10532
|
stx.hydrate();
|
|
10533
10533
|
}
|
|
10534
|
-
})();`}var m6,G5,
|
|
10534
|
+
})();`}var m6,G5,sY,rY=`
|
|
10535
10535
|
<script>
|
|
10536
10536
|
(function(){
|
|
10537
10537
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -10551,25 +10551,25 @@ else {
|
|
|
10551
10551
|
}
|
|
10552
10552
|
};
|
|
10553
10553
|
})();
|
|
10554
|
-
</script>`,
|
|
10554
|
+
</script>`,bB,aY,tY;var l6=b(()=>{V1();q1();T4();I0();m6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},G5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,sY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;bB=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;aY={name:"suspense",hasEndTag:!0,handler:($,Z,J,Y)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let X=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${X} -->${$}<!-- @endsuspense:${X} -->`}},tY={name:"island",hasEndTag:!0,handler:($,Z,J,Y)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let X=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${X}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",q=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
|
|
10555
10555
|
${q}
|
|
10556
10556
|
<script type="application/json" data-island-props="${G}">
|
|
10557
10557
|
${W?`{${W}}`:"{}"}
|
|
10558
10558
|
</script>
|
|
10559
|
-
</div>`}}});var
|
|
10560
|
-
`).length;J.set(W,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...J.keys(),...Y.keys()])){if(
|
|
10559
|
+
</div>`}}});var ZX={};t(ZX,{warnUnbalancedTags:()=>c6,findUnbalancedTags:()=>$X});function y5($){return $.replace(/[^\n]/g," ")}function $X($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,y5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,y5).replace(/<!--[\s\S]*?-->/g,y5).replace(/\{\{\{[\s\S]*?\}\}\}/g,y5).replace(/\{\{[\s\S]*?\}\}/g,y5).replace(/\{!![\s\S]*?!!\}/g,y5),J=new Map,Y=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",W=Q[2],q=Q[3]==="/";if(hB.has(W.toLowerCase()))continue;if(q)continue;if(K)Y.set(W,(Y.get(W)??0)+1);else{let z=J.get(W);if(z)z.count++;else{let U=Z.slice(0,Q.index).split(`
|
|
10560
|
+
`).length;J.set(W,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...J.keys(),...Y.keys()])){if(uB.has(K.toLowerCase()))continue;let W=J.get(K)?.count??0,q=Y.get(K)??0;if(W!==q)G.push({tag:K,opened:W,closed:q,firstOpenLine:J.get(K)?.firstLine??0})}return G}function c6($,Z){let J;try{J=$X($)}catch{return}if(J.length===0)return;let Y=`${Z}:${$.length}`;if(eY.has(Y))return;eY.add(Y);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:W}of J)if(G>K){let q=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${q} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var hB,uB,eY;var i6=b(()=>{hB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),uB=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);eY=new Set});import s0 from"path";import n6 from"fs";function JX($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function YX($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class XX{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,J,Y){let X=$.endsWith(".stx")?$.slice(0,-4):$,Q=Y?.__importedComponents;if(Q){let H=[X,X.toLowerCase(),JX(X),YX(X)];for(let B of H)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${X}.stx`,`${JX(X)}.stx`,`${YX(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let H=s0.resolve(s0.dirname(Z),`${X}.stx`);if(await c(H))return H;return null}let K=[],W=J.componentsDir||"",q=Y?.__originalFilePath;if(q)K.push(s0.join(s0.dirname(q),"components"));if(W)K.push(W);let z=s0.join(s0.dirname(Z),"components");if(!K.includes(z))K.push(z);let U=process.cwd(),j=[s0.resolve(U,"src/components"),s0.resolve(U,"components"),s0.resolve(import.meta.dir,"components")];for(let H of j)if(!K.includes(H))K.push(H);for(let H of K){if(!H)continue;for(let B of G){let _=s0.join(H,B);if(await c(_))return _}try{if(!n6.statSync(H,{throwIfNoEntry:!1})?.isDirectory())continue;let _=n6.readdirSync(H,{withFileTypes:!0});for(let O of _)if(O.isDirectory()){let V=s0.join(H,O.name);for(let F of G){let L=s0.join(V,F);if(await c(L))return L}}}catch{}}return null}}var m0;var o6=b(()=>{I0();m0=new XX});function b0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function QX($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var K5="\x00stx-boolean-attribute";function P5($,Z){let J=[];for(let[Y,X]of Object.entries($.static)){if(Z.has(Y))continue;let Q=$.staticNames?.[Y]??Y;if(typeof X==="boolean"){if(X)J.push(b0(Q));continue}if(X===K5){J.push(b0(Q));continue}J.push(`${b0(Q)}="${b0(QX(String(X)))}"`)}return J}var O7=()=>{};function k$($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function mB($){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 s6;var r6=b(()=>{O7();s6={name:"StxLink",aliases:["stx-link"],render($,Z,J){let Y=mB($),X=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=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,W=[];if(Y.reactive)W.push(`:href="${k$(Y.value)}"`);else W.push(`href="${k$(Y.value)}"`);if(X)W.push(`class="${k$(X)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${k$(Q)}"`),W.push(`data-stx-exact-active-class="${k$(G)}"`),K)W.push("data-stx-prefetch");let q=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...P5($,q)),`<a ${W.join(" ")}>${Z}</a>`}}});function S0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function x0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function t6($,Z,J=!1){let Y=$.serverDynamic[Z];if(Y!==void 0)return Y!==!1&&Y!=="false";let X=$.static[Z];if(X!==void 0)return X!=="false"&&X!==!1;return J}function GX($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let Y of Z)if(Y.includes(":")){let[X,Q]=Y.split(":"),G=dB[X];if(G)J.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(X);if(!Number.isNaN(K))J.push(`(max-width: ${K}px) ${Q}`)}}else J.push(Y);return J.join(", ")}function e6($,Z,J,Y){return Z.map((X)=>`${E$($,X,void 0,J,Y)} ${X}w`).join(", ")}function pB($,Z,J,Y,X){return Z.map((Q)=>{let G=J?J*Q:void 0;return`${E$($,G,void 0,Y,X)} ${Q}x`}).join(", ")}function E$($,Z,J,Y,X){if(!Y||Y==="local"||Y==="static")return $;if(Y==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(J)Q.push(`h_${J}`);if(X)Q.push(`f_${X}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(Y==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(J)Q.set("h",String(J));if(X)Q.set("fm",X);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(Y==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(J)Q.set("height",String(J));if(X)Q.set("format",X);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function lB($,Z,J="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var dB,a6,$9;var Z9=b(()=>{O7();dB={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},a6=[320,640,768,1024,1280,1536,1920];$9={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,J){let Y=x0($,"src")||"",X=x0($,"alt")||"",Q=x0($,"width"),G=x0($,"height"),K=x0($,"sizes"),W=x0($,"srcset"),q=x0($,"densities"),z=x0($,"format"),U=x0($,"placeholder"),j=x0($,"placeholderColor")||"#e5e7eb",H=x0($,"provider"),B=x0($,"class")||x0($,"className")||"",_=x0($,"style")||"",O=x0($,"quality"),V=t6($,"lazy",!0),F=t6($,"preload",!1),L=t6($,"picture",!1)||!!z,w=Q?Number.parseInt(Q):void 0,N=G?Number.parseInt(G):void 0,R=W||"",A="";if(!R&&K)R=e6(Y,a6,H,z),A=GX(K);else if(!R&&q){let S=q.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));R=pB(Y,S,w,H,z)}else if(K)A=GX(K);let M=[];if(_)M.push(_);if(w&&N)M.push(`aspect-ratio:${w}/${N}`);if(U==="blur"||U==="color"||U==="thumbhash"){let S=lB(w||16,N||9,j);M.push(`background-image:url(${S})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")M.push(`background-image:url(${S0(U)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let T=E$(Y,w,N,H,z),I=[];if(I.push(`src="${S0(T)}"`),I.push(`alt="${S0(X)}"`),Q)I.push(`width="${S0(Q)}"`);if(G)I.push(`height="${S0(G)}"`);if(V)I.push('loading="lazy"');if(I.push('decoding="async"'),B)I.push(`class="${S0(B)}"`);if(M.length>0)I.push(`style="${S0(M.join(";"))}"`);if(R)I.push(`srcset="${S0(R)}"`);if(A)I.push(`sizes="${S0(A)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...P5($,E));let D=`<img ${I.join(" ")} />`,y="";if(F){let P=z==="webp"?"image/webp":z==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${S0(T)}"${P?` type="${P}"`:""}${R?` imagesrcset="${S0(R)}"`:""}${A?` imagesizes="${S0(A)}"`:""} />
|
|
10561
10561
|
`}if(L){let S=[];if(z==="avif"||z==="auto"){let P=E$(Y,w,N,H,"avif"),C=R?e6(Y,a6,H,"avif"):`${P}`;S.push(`<source type="image/avif" srcset="${S0(C)}"${A?` sizes="${S0(A)}"`:""} />`)}if(z==="webp"||z==="auto"){let P=E$(Y,w,N,H,"webp"),C=R?e6(Y,a6,H,"webp"):`${P}`;S.push(`<source type="image/webp" srcset="${S0(C)}"${A?` sizes="${S0(A)}"`:""} />`)}return`${y}<picture>
|
|
10562
10562
|
${S.join(`
|
|
10563
10563
|
`)}
|
|
10564
10564
|
${D}
|
|
10565
|
-
</picture>`}return`${y}${D}`}}});function b$($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function C5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var
|
|
10565
|
+
</picture>`}return`${y}${D}`}}});function b$($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function C5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var KX="/images/safe-image-default.svg",cB,J9;var Y9=b(()=>{O7();cB=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${KX}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,J9={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,J){let Y=C5($,"src")||"",X=C5($,"alt")||"",Q=C5($,"fallback")||KX,G=C5($,"class")||C5($,"className")||"",K=C5($,"fallbackClassName")||"",W=[];if(W.push(`src="${b$(Y)}"`),W.push(`alt="${b$(X)}"`),G)W.push(`class="${b$(G)}"`);if(W.push(`data-fallback="${b$(Q)}"`),K)W.push(`data-fallback-class="${b$(K)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...P5($,q));let z=`<img ${W.join(" ")} />`,U=J.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${cB}${z}`;return z}}});function X9($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function S$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function F7($,Z,J){let Y=S$($,Z);if(Y!==void 0){let X=Number.parseInt(Y,10);if(!Number.isNaN(X))return X}return J}var Q9;var G9=b(()=>{Q9={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let Y=X9(S$($,"color")||"#6366f1"),X=X9(S$($,"initialColor")||S$($,"initial-color")||""),Q=X9(S$($,"height")||"3px"),G=F7($,"duration",2000),K=F7($,"throttle",200),W=F7($,"zIndex",999999)||F7($,"z-index",999999),q=X?`linear-gradient(to right, ${X}, ${Y})`:Y;return`
|
|
10566
10566
|
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${q};z-index:${W};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
10567
10567
|
<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>
|
|
10568
10568
|
</div>
|
|
10569
10569
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
10570
10570
|
<script>
|
|
10571
10571
|
(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()})})();
|
|
10572
|
-
</script>`}}});function
|
|
10572
|
+
</script>`}}});function qX($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function iB($,Z,J){let Y=qX($,Z);if(Y!==void 0){let X=Number.parseInt(Y,10);if(!Number.isNaN(X))return X}return J}var WX,K9;var W9=b(()=>{WX={"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%)"},K9={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let Y=b0(qX($,"position")||"top-right"),X=iB($,"max",5),Q=WX[Y]||WX["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${X}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
10573
10573
|
<style>
|
|
10574
10574
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
10575
10575
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -10577,7 +10577,7 @@ ${D}
|
|
|
10577
10577
|
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
10578
10578
|
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
10579
10579
|
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
10580
|
-
</style>`}}});function V7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var
|
|
10580
|
+
</style>`}}});function V7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var zX,q9;var z9=b(()=>{zX={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)"},q9={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let Y=V7($,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let X=b0(Y),Q=V7($,"size")||"md",G=V7($,"closeOnBackdrop")!=="false",K=V7($,"closeOnEscape")!=="false",W=zX[Q]||zX.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" 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">
|
|
10581
10581
|
<div class="stx-modal-panel" style="${W};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)">
|
|
10582
10582
|
<div style="padding:1.5rem">${Z}</div>
|
|
10583
10583
|
</div>
|
|
@@ -10586,7 +10586,7 @@ ${D}
|
|
|
10586
10586
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
10587
10587
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
10588
10588
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
10589
|
-
</style>`}}});function v5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var
|
|
10589
|
+
</style>`}}});function v5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var UX,U9;var j9=b(()=>{UX={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},U9={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let Y=v5($,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let X=b0(Y),Q=v5($,"side")||"right",G=v5($,"size")||"md",K=v5($,"closeOnBackdrop")!=="false",W=v5($,"closeOnEscape")!=="false",q=v5($,"overlay")!=="false",z=UX[G]||UX.md,U=Q==="left",j=U?"left:0":"right:0",H=U?"translateX(-100%)":"translateX(100%)",B=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${K}" data-close-escape="${W}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"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">
|
|
10590
10590
|
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${j};width:${z};max-width:100vw;transform:${H};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">
|
|
10591
10591
|
<div style="padding:1.5rem">${Z}</div>
|
|
10592
10592
|
</div>
|
|
@@ -10595,18 +10595,18 @@ ${D}
|
|
|
10595
10595
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
10596
10596
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
10597
10597
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
10598
|
-
</style>`}}});import{existsSync as
|
|
10599
|
-
`||M==="\t")V++;F=R+_.length}else{if(V--,V===0){L=A;break}F=A+O.length}}if(L===-1){X=j;continue}let w=$.slice(j,L),N=L+O.length;Y.push({fullMatch:$.slice(Q,N),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:N,isSelfClosing:!1}),X=N}}return Y}function FX($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function VX($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}var LX=b(()=>{M0();I0();n1()});var IX={};t(IX,{processESImports:()=>MX,processComponents:()=>A7});import R7 from"fs";import i0 from"path";function tB($,Z,J){let Y={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(E8),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(W,q)=>q.toUpperCase())},G=(K,W)=>{let q=Q(K);if(Y.static[q]=W,q!==K)Y.staticNames[q]=K};for(let[K,W]of Object.entries($)){let q=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(q.startsWith("@")){Y.events[q]=W;continue}if(q.startsWith("__stx_")){let z=Q(q.slice(6));Y.serverDynamic[z]=VX(W,J);continue}if(q.startsWith(":")){let z=Q(q.slice(1)),U=W===K5?z:W;if(z==="if"||z==="for"||z==="show"){Y.clientReactive[z]=U;continue}try{if(!W0(U)){if(J.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);Y.clientReactive[z]=U;continue}let j=Object.keys(Z),B=q0(U,j)(...Object.values(Z));if(B===void 0){let _=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((F)=>!O.has(F)&&!j.includes(F))){Y.clientReactive[z]=U;continue}}Y.serverDynamic[z]=B}catch{Y.clientReactive[z]=U}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let z=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let U=z[1];if(W0(U)){let H=q0(U,Object.keys(Z))(...Object.values(Z));G(q,H!=null?String(H):"")}else{if(J.debug)console.error(`Unsafe expression in ${q}: ${U}`);G(q,W)}}catch(U){if(J.debug)console.error(`Error evaluating expression for ${q}:`,U);G(q,W)}else{let U=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(W))!==null)try{let B=H[1];if(!W0(B)){if(J.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let O=q0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(H[0],String(O??""))}catch(B){if(J.debug)console.error(`Error evaluating expression in ${q}:`,B)}G(q,U)}continue}G(q,W===K5?"true":FX(W))}return Y}function eB($){let Z={},J=0,Y=$.length;while(J<Y){while(J<Y&&/\s/.test($[J]))J++;if(J>=Y)break;let X="";while(J<Y&&!/[\s=]/.test($[J]))X+=$[J],J++;if(!X)break;while(J<Y&&/\s/.test($[J]))J++;if(J<Y&&$[J]==="="){J++;while(J<Y&&/\s/.test($[J]))J++;let Q="";if(J<Y&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<Y){let K=$[J];if(K==="\\"&&J+1<Y){J++,Q+=$[J],J++;continue}if(K===G){J++;break}Q+=K,J++}}else while(J<Y&&!/\s/.test($[J]))Q+=$[J],J++;Z[X]=Q}else Z[X]=K5}return Z}function NX($){return Object.entries($).map(([Z,J])=>J===K5?Z:`${Z}="${$H(J)}"`).join(" ")}function $H($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ZH($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=J.exec($))!==null){let X=Y[1];if(u0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function JH($){let Z=RX.get($);if(Z)return Z;let J=new Map,Y=[i0.join($,"src"),i0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=R7.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let q=i0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(q,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let z=W.name.slice(0,-4);if(!J.has(z))J.set(z,q);let U=z.toLowerCase();if(!J.has(U))J.set(U,q);let j=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!J.has(j))J.set(j,q)}}}for(let Q of Y)if(X(Q,0),J.size>0)break;return RX.set($,J),J}function YH($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let Y=i0.join(J,"node_modules",$);try{if(R7.statSync(Y).isDirectory())return Y}catch{}let X=i0.dirname(J);if(X===J)return null;J=X}}async function MX($,Z,J,Y,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=i0.dirname(J),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(q,z,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,H=U,B,_=[];while((B=j.exec(U))!==null){let[O,V,F,L]=B,w=null,N=null;if(L.startsWith(".")||L.startsWith("/")){let M=i0.resolve(G,L);if(M.endsWith(".stx"))N=M;else{let T=`${M}.stx`;try{if(R7.statSync(T).isFile())N=T}catch{try{if(R7.statSync(M).isDirectory())w=M}catch{}}}}else w=YH(L,G);if(!w&&!N)continue;let R=!1,A=(M,T)=>{Q.set(M,T),Q.set(M.toLowerCase(),T);let I=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,T),X.add(T)};if(F&&N)A(F,N),R=!0;else if(V){let M=V.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),T=w?JH(w):null;for(let{source:I,local:E}of M){let D=null;if(N)D=N;else if(T)D=T.get(I)??T.get(I.toLowerCase())??T.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)A(E,D),R=!0}}if(R)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return q;for(let O=_.length-1;O>=0;O--)H=H.slice(0,_[O].start)+H.slice(_[O].end);return`<script${z}>${H}</script>`}),K}async function XH($,Z,J,Y,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[q,z]=W,U=z.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let H=j.split("/"),_=H[H.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),V=null,F=[i0.resolve(i0.dirname(J),`${j}.stx`),i0.resolve(i0.dirname(J),j),i0.resolve(Y.componentsDir||"components",`${j}.stx`),i0.resolve(Y.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let L of F)try{if(await Bun.file(L).exists()){V=L;break}}catch{}if(V){G.set(O,V),G.set(_,V),G.set(_.toLowerCase(),V);let L=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,V),X.add(V),Y.debug)console.log(`Imported component: ${O} -> ${V}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(q,""),K.lastIndex=0}return Q}async function QH($,Z,J,Y,X){let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,q;while((q=W.exec(Q))!==null){let z=q.index,U=z+q[0].length-1,j=1,H=U+1;while(H<Q.length&&j>0){if(Q[H]==="(")j++;else if(Q[H]===")"){if(j--,j===0)break}H++}if(j!==0)break;let B=Q.substring(U+1,H),_=H+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let V=O[1],F,L=B.slice(O[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let N={};if(F)try{N=A0(F,Z)}catch(E){let D=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(z,_),`[Error parsing component props: ${D}]`);continue}let R="",A=_,T=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(T)R=T[1].trim(),A=_+T[0].length;let I=await e1(V,N,R,G,Z,J,Y,K,X);Q=Q.substring(0,z)+I+Q.substring(A),W.lastIndex=0}return Q}async function GH($,Z,J,Y,X){if(!$)return $;let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=E1(Q);return Q=W.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,aB),Q=K$(Q,W.scripts),Q;async function j(H,B,_,O){if(!H)return H;let V=H,F=OX(V,B,O);for(let L=F.length-1;L>=0;L--){let w=F[L],N=_?N7(w.tagName):w.tagName,R=eB(w.attributes),A=tB(R,Z,Y),M=u0.getBuiltin(w.tagName),T=M?await M4(N,G,Z,J,Y):!1;if(M&&!T){let y={context:Z,filePath:J,options:Y,dependencies:X},S=M.render(A,w.content,y);if(Object.keys(A.clientReactive).length>0)S=AX(S,A.clientReactive);if(Object.keys(A.events).length>0){let P=NX(A.events);S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${P}`)}V=V.substring(0,w.startIndex)+S+V.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await M4(N,G,Z,J,Y))continue;let I={};for(let[y,S]of Object.entries(A.static))I[y]=S;for(let[y,S]of Object.entries(A.serverDynamic))I[y]=S;let D=await e1(N,I,w.content,G,Z,J,Y,K,X);if(Object.keys(A.clientReactive).length>0)D=AX(D,A.clientReactive);if(Object.keys(A.events).length>0){let y=TX(D);if(y){let S=NX(A.events),P=Object.keys(A.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${P}" ${S}`+D.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+D+V.substring(w.endIndex)}return V}}function AX($,Z){let J=new Set(["if","for"]),Y=new Set(["show"]),X=Object.entries(Z).filter(([z])=>!J.has(z)),Q=X.filter(([z])=>!Y.has(z)).map(([z])=>N7(z)).join(" "),G=$,K=X.length>0?TX(G):null;if(K){let z=X.map(([j,H])=>`:${N7(j)}="${H.replace(/"/g,""")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${z}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,""")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,""")}">${G}</template>`;return G}function TX($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let J=0;while(J<$.length){let Y=$.slice(J),X=Y.match(/^\s+/);if(X){J+=X[0].length;continue}if(Y.startsWith("<!--")){let K=$.indexOf("-->",J+4);if(K===-1)return null;J=K+3;continue}let Q=Y.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,J+Q[0].length);if(W===-1)return null;J=W+K.length;continue}let G=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function A7($,Z,J,Y,X){if(!wX)HX(),wX=!0;let Q=await MX($,Z,J,Y,X);Q=await XH(Q,Z,J,Y,X),Q=await QH(Q,Z,J,Y,X);let G=[];for(let K=0;K<3;K++){let W=W1(Q,G$,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...W.tokens);let q=Q;if(Q=await GH(W.output,Z,J,Y,X),Q===q)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(Y.debug){let K=ZH(Q);if(K.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var wX=!1,aB,RX;var L9=b(()=>{o6();_X();LX();n1();I0();M0();K1();aB=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);RX=new Map});var PX={};t(PX,{processLoops:()=>N9,parseLoopBinding:()=>w9});function qH($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",X=0,Q;while((Q=J.exec($))!==null){let G=Q.index+Q[0].length,K=Q.index+Q[0].indexOf("("),W=k0($,"(",")",K);if(W===-1)continue;let q=$.slice(G,W).trim();if(!q)continue;if(!Object.keys(Z).some((j)=>new RegExp(`(?:^|[^\\w$.])${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let U;try{let j=A0(q,Z);if(!j||typeof j!=="object")continue;U=JSON.stringify(j)}catch{continue}Y+=$.slice(X,G)+U,X=W,J.lastIndex=W}return X===0?$:Y+$.slice(X)}function zH($,Z){let J=/@component\s*\(/g,Y=$,X,Q=[];while((X=J.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,W=1,q=K+1;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")"){if(W--,W===0)break}q++}if(W!==0)continue;let z=Y.substring(K+1,q),U=q+1,j=z.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let H=j[1],B=z.slice(j[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let O=B.slice(_[0].length).trim();if(!O)continue;try{let V=A0(O,Z),F=JSON.stringify(V),L=`@component('${H}', ${F})`;Q.push({start:G,end:U,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Y=Y.substring(0,K)+q+Y.substring(W)}return Y}function M7($,Z,J){let Y=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(Y))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1,z=null,U=!1;while(q<Y.length&&W>0){let B=Y[q];if(U){U=!1,q++;continue}if(B==="\\"&&z){U=!0,q++;continue}if(z){if(B===z)z=null;q++;continue}if(B==='"'||B==="'"||B==="`"){z=B,q++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}q++}if(W!==0)break;let j=Y.substring(K+1,q),H=J(j);Y=Y.substring(0,G)+H+Y.substring(q+1)}return Y}function UH($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,X)=>{if(X in Z)return`:${X}="${X}"`;return Y}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);n$(Q);let q=q0(Q,G)(...K),z=JSON.stringify(q),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return Y}}),J}function jH($,Z){let J=$;return J=M7(J,"@break",(Y)=>{try{let Q=`!!(${Y.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(Q,Z));return G?T7:""}catch{return""}}),J=M7(J,"@continue",(Y)=>{try{let Q=`!!(${Y.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(Q,Z));return G?I7:""}catch{return""}}),J}function BH($){let Z=$;return Z=Z.replace(/@break(?!\()/g,T7),Z=Z.replace(/@continue(?!\()/g,I7),Z}function DX($){let Z=$.includes(T7),J=Z?$.substring(0,$.indexOf(T7)):$;return{hasBreak:Z,content:J}}function kX($){let Z=$.includes(I7),J=Z?$.substring(0,$.indexOf(I7)):$;return{hasContinue:Z,content:J}}function bX($){let Z=$;return Z=M7(Z,"@break",(J)=>{let Y=J.trim();if(!o$(Y))return"";return`\`; if (${Y}) { break; } result += \``}),Z=M7(Z,"@continue",(J)=>{let Y=J.trim();if(!o$(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function HH($){let Z=/@forelse\s*\(/g,J,Y=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)Y.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)Y.push({pos:G.index,delta:-1});Y.sort((z,U)=>z.pos-U.pos);let K=[],W=0;for(let z of Y)W+=z.delta,K.push({pos:z.pos,depth:W});function q(z){let U=0,j=K.length-1,H=0;while(U<=j){let B=U+j>>1;if(K[B].pos<=z)H=K[B].depth,U=B+1;else j=B-1}return H}while((J=Z.exec($))!==null){if(q(J.index)>0)continue;let z=J.index,U=J.index+J[0].length-1,j=1,H=U+1,B=-1;while(H<$.length&&j>0){if($[H]==="(")j++;else if($[H]===")"){if(j--,j===0){B=H;break}}H++}if(B===-1)continue;let _=$.substring(U+1,B),O=w9(_);if(!O)continue;let{arrayExpr:V,itemVar:F}=O,L=B+1,w=1,N=L,R=/@forelse\s*\(/g,A=/@endforelse/g,M=-1;while(w>0&&N<$.length){R.lastIndex=N,A.lastIndex=N;let S=R.exec($),P=A.exec($);if(!P)break;if(S&&S.index<P.index)w++,N=S.index+S[0].length;else{if(w--,w===0){M=P.index;break}N=P.index+11}}if(M===-1)continue;let T=$.substring(L,M),I=M+11,E=-1,D=0,y=0;while(y<T.length){let S=T.indexOf("@",y);if(S===-1)break;let P=T.substring(S);if(/^@forelse\s*\(/.test(P))D++,y=S+1;else if(P.startsWith("@endforelse"))D--,y=S+11;else if(D===0&&P.startsWith("@empty")){if(T.length<=S+6||!/[a-z]/i.test(T[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:z,end:I,arrayExpr:V,itemVar:F,foreachContent:T.substring(0,E),emptyContent:T.substring(E+6)}}return null}function EX($,Z){let J=$;while(!0){let Y=HH(J);if(!Y)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:q}=Y;try{let z;if(W0(G))z=q0(G,Object.keys(Z))(...Object.values(Z));else z=Y0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=q;else U=`@foreach (${G} as ${K})${W}@endforeach`;J=J.substring(0,X)+U+J.substring(Q)}catch(z){let U=z instanceof Error?z.message:String(z),j=J0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,o.EVALUATION_ERROR);J=J.substring(0,X)+j+J.substring(Q)}}return J}function w9($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let J=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!J)return null;let Y=J[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),X=J[2].trim();return Y&&X?{arrayExpr:X,itemVar:Y}:null}function N9($,Z,J,Y){let X=$;X=EX(X,Z);function Q(W){let q=/@foreach\s*\(/g,z;while((z=q.exec(W))!==null){let U=z.index,j=z.index+z[0].length-1,H=1,B=j+1,_=-1;while(B<W.length&&H>0){if(W[B]==="(")H++;else if(W[B]===")"){if(H--,H===0){_=B;break}}B++}if(_===-1)continue;let O=W.substring(j+1,_),V=w9(O);if(!V)continue;let F=U,{arrayExpr:L,itemVar:w}=V,N=_+1,R=1,A=N,M=/@foreach\s*\(/g,T=/@endforeach/g;while(R>0&&A<W.length){M.lastIndex=A,T.lastIndex=A;let I=M.exec(W),E=T.exec(W);if(!E)break;if(I&&I.index<E.index)R++,A=I.index+I[0].length;else{if(R--,R===0){let D=W.substring(N,E.index),y=E.index+11;return{start:F,end:y,arrayExpr:L,itemVar:w,content:D}}A=E.index+11}}}return null}function G(W,q){let z=W;while(!0){let U=Q(z);if(!U)break;let{start:j,end:H,arrayExpr:B,itemVar:_,content:O}=U;try{let V=B.trim(),F;if(W0(V))F=q0(V,Object.keys(q))(...Object.values(q));else F=Y0(V,q);let L=!1;if(!Array.isArray(F))if(F instanceof Map)F=Array.from(F),L=!0;else if(F instanceof Set)F=Array.from(F);else if(typeof F==="string")F=Array.from(F);else if(F&&typeof F==="object"&&!(F instanceof Date)&&!(F instanceof RegExp))F=Object.entries(F),L=!0;else{console.warn(`[stx] @foreach(${V}) in ${J}: ${V} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let E=J0("Foreach",`Error in @foreach: ${V} is not iterable`,o.TYPE_ERROR);z=z.substring(0,j)+E+z.substring(H);continue}let w=Y?.loops?.useAltLoopVariable??WH,N=_.trim(),R=null,A,M=!1;if(N.includes("=>")){let E=N.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],A=E[1];else A=N}else if(!N.startsWith("[")&&!N.startsWith("{")&&N.includes(",")){let E=N.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])A=E[0],R=E[1],M=!0;else A=N}else A=N;let T="",I=F;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...q,loop:y,$loop:y};if(A.startsWith("[")&&A.endsWith("]")){let f=A.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(D))f.forEach((d,$0)=>{if(d)S[d]=D[$0]});else S[A]=D}else S[A]=D;if(R)if(!M&&L&&Array.isArray(D)&&D.length===2)S[R]=D[0],S[A]=D[1];else S[R]=E;let P=jH(O,S),C=kX(P);if(C.hasContinue){T+=C.content;continue}let x=DX(P);if(x.hasBreak){T+=x.content;break}if(P=EX(P,S),P=G(P,S),P=X5(P,S,J),P=BH(P),x=DX(P),x.hasBreak){T+=x.content;break}if(C=kX(P),C.hasContinue){T+=C.content;continue}P=b1(P,S,J),P=UH(P,S),P=zH(P,S),P=qH(P,S),T+=P}z=z.substring(0,j)+T+z.substring(H)}catch(V){let F=J0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${V instanceof Error?V.message:String(V)}`,o.EVALUATION_ERROR);z=z.substring(0,j)+F+z.substring(H)}}return z}X=G(X,Z),X=yX(X,Z,J,Y);let K=Y?.loops?.maxWhileIterations??KH;return X=FH(X,Z,K),X}function SX($){return o$($)}function yX($,Z,J,Y){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,q=k0(X,"(",")",W);if(q===-1)break;let z=X.slice(W+1,q),U=q+1,j=J4(X.slice(K),"for","endfor");if(j.length===0)break;let H=j[0].content,B=K+j[0].end;if(!SX(z)){let _=J0("For",`Unsafe expression in @for: ${z}`,o.UNSAFE_EXPRESSION);X=X.substring(0,K)+_+X.substring(B),Q=!0;continue}try{let _=_H(z),O=/@(?:for|foreach|if|unless)\s*\(/.test(H);if(_.length>0&&O){let R=OH({forExpr:z,content:H,iterVarNames:_,context:Z,filePath:J,options:Y});X=X.substring(0,K)+R+X.substring(B),Q=!0;continue}let V=Object.keys(Z),F=Object.values(Z),L=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,A)=>{return`\${${A}}`});L=bX(L);let N=Function(...V,`
|
|
10598
|
+
</style>`}}});import{existsSync as nB,readFileSync as oB}from"fs";function sB($){if(jX.has($))return;jX.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function rB($){let Z=process.cwd();for(let J 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(nB(J))return J;for(let J of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return U0.resolve(J)}catch{}return null}function aB($){if(L7.has($))return L7.get($);let Z=rB($);if(!Z)return sB($),null;try{let J=JSON.parse(oB(Z,"utf8"));return L7.set($,J.icons),J.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}var L7,jX,B9;var H9=b(()=>{L7=new Map,jX=new Set;B9={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let Y=x5($,"name")??x5($,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=Y;if(Y.includes(":")){let F=Y.split(":");X=F[0],Q=F[1]}let G=b0(x5($,"size")||"24"),K=b0(x5($,"color")||"currentColor"),W=b0(x5($,"class")||""),q=b0(x5($,"style")||""),z=L7.get(X)??aB(X);if(!z)return`<!-- Icon: collection "${X}" not loaded -->`;let U=z[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${X} -->`;let j=U.width||24,H=U.height||24,B=`0 0 ${j} ${H}`,_=U.body;if(K!=="currentColor")_=_.replace(/currentColor/g,K);let O=W?` class="${W}"`:"",V=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${O}${V}>${_}</svg>`}}});function BX($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let Y=$.static[J];if(typeof Y==="string")return Y}return}function HX($,Z){let J=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=$.match(J);if(!Y)return{region:null,rest:$};return{region:Y[2],rest:$.replace(Y[0],"")}}var _9;var O9=b(()=>{_9={name:"Suspense",aliases:["suspense"],render($,Z,J){let Y=HX(Z,"fallback"),X=Y.rest,Q=HX(X,"error"),G=Q.rest,K=Y.region??BX($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??BX($,"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>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function w7($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let Y=$.static[J];if(typeof Y==="string")return Y}return}var F9;var V9=b(()=>{F9={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let Y=(w7($,"name")||"v").replace(/["'<>]/g,""),X=(w7($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=w7($,"class"),G=w7($,"id"),K=[`data-stx-transition-group="${Y}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function _X(){m0.registerBuiltin(s6),m0.registerBuiltin($9),m0.registerBuiltin(J9),m0.registerBuiltin(Q9),m0.registerBuiltin(K9),m0.registerBuiltin(q9),m0.registerBuiltin(U9),m0.registerBuiltin(B9),m0.registerBuiltin(_9),m0.registerBuiltin(F9)}var OX=b(()=>{r6();Z9();Y9();G9();W9();z9();j9();H9();O9();V9();o6();r6();Z9();Y9();G9();W9();z9();j9();H9();O9();V9()});function N7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function FX($,Z,J){let Y=[],X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!K){X=Q+1;continue}let W=K[1];if(J&&J.has(W.toLowerCase())){let _=Q+1+W.length;while(_<$.length&&$[_]!==">")_++;X=_+1;continue}let q=Q+1+W.length,z=null,U=q,j=-1,H=!1;while(q<$.length){let _=$[q];if(z){if(_==="\\"&&q+1<$.length){q+=2;continue}if(_===z)z=null;q++;continue}if(_==='"'||_==="'"){z=_,q++;continue}if(_==="/"&&q+1<$.length&&$[q+1]===">"){j=q+2,H=!0;break}if(_===">"){j=q+1;break}q++}if(j===-1){X=Q+1;continue}let B=$.slice(U,H?j-2:j-1).trim();if(H)Y.push({fullMatch:$.slice(Q,j),tagName:W,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),X=j;else{let _=`<${W}`,O=`</${W}>`,V=1,F=j,L=-1;while(V>0&&F<$.length){let R=$.indexOf(_,F),A=$.indexOf(O,F);if(A===-1)break;if(R!==-1&&R<A){let M=$[R+_.length];if(M===" "||M===">"||M==="/"||M===`
|
|
10599
|
+
`||M==="\t")V++;F=R+_.length}else{if(V--,V===0){L=A;break}F=A+O.length}}if(L===-1){X=j;continue}let w=$.slice(j,L),N=L+O.length;Y.push({fullMatch:$.slice(Q,N),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:N,isSelfClosing:!1}),X=N}}return Y}function VX($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function LX($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}var wX=b(()=>{M0();I0();n1()});var DX={};t(DX,{processESImports:()=>TX,processComponents:()=>A7});import R7 from"fs";import n0 from"path";function eB($,Z,J){let Y={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(E8),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(W,q)=>q.toUpperCase())},G=(K,W)=>{let q=Q(K);if(Y.static[q]=W,q!==K)Y.staticNames[q]=K};for(let[K,W]of Object.entries($)){let q=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(q.startsWith("@")){Y.events[q]=W;continue}if(q.startsWith("__stx_")){let z=Q(q.slice(6));Y.serverDynamic[z]=LX(W,J);continue}if(q.startsWith(":")){let z=Q(q.slice(1)),U=W===K5?z:W;if(z==="if"||z==="for"||z==="show"){Y.clientReactive[z]=U;continue}try{if(!W0(U)){if(J.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);Y.clientReactive[z]=U;continue}let j=Object.keys(Z),B=q0(U,j)(...Object.values(Z));if(B===void 0){let _=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((F)=>!O.has(F)&&!j.includes(F))){Y.clientReactive[z]=U;continue}}Y.serverDynamic[z]=B}catch{Y.clientReactive[z]=U}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let z=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let U=z[1];if(W0(U)){let H=q0(U,Object.keys(Z))(...Object.values(Z));G(q,H!=null?String(H):"")}else{if(J.debug)console.error(`Unsafe expression in ${q}: ${U}`);G(q,W)}}catch(U){if(J.debug)console.error(`Error evaluating expression for ${q}:`,U);G(q,W)}else{let U=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(W))!==null)try{let B=H[1];if(!W0(B)){if(J.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let O=q0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(H[0],String(O??""))}catch(B){if(J.debug)console.error(`Error evaluating expression in ${q}:`,B)}G(q,U)}continue}G(q,W===K5?"true":VX(W))}return Y}function $H($){let Z={},J=0,Y=$.length;while(J<Y){while(J<Y&&/\s/.test($[J]))J++;if(J>=Y)break;let X="";while(J<Y&&!/[\s=]/.test($[J]))X+=$[J],J++;if(!X)break;while(J<Y&&/\s/.test($[J]))J++;if(J<Y&&$[J]==="="){J++;while(J<Y&&/\s/.test($[J]))J++;let Q="";if(J<Y&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<Y){let K=$[J];if(K==="\\"&&J+1<Y){J++,Q+=$[J],J++;continue}if(K===G){J++;break}Q+=K,J++}}else while(J<Y&&!/\s/.test($[J]))Q+=$[J],J++;Z[X]=Q}else Z[X]=K5}return Z}function RX($){return Object.entries($).map(([Z,J])=>J===K5?Z:`${Z}="${ZH(J)}"`).join(" ")}function ZH($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function JH($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=J.exec($))!==null){let X=Y[1];if(m0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function YH($){let Z=AX.get($);if(Z)return Z;let J=new Map,Y=[n0.join($,"src"),n0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=R7.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let q=n0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(q,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let z=W.name.slice(0,-4);if(!J.has(z))J.set(z,q);let U=z.toLowerCase();if(!J.has(U))J.set(U,q);let j=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!J.has(j))J.set(j,q)}}}for(let Q of Y)if(X(Q,0),J.size>0)break;return AX.set($,J),J}function XH($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let Y=n0.join(J,"node_modules",$);try{if(R7.statSync(Y).isDirectory())return Y}catch{}let X=n0.dirname(J);if(X===J)return null;J=X}}async function TX($,Z,J,Y,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=n0.dirname(J),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(q,z,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,H=U,B,_=[];while((B=j.exec(U))!==null){let[O,V,F,L]=B,w=null,N=null;if(L.startsWith(".")||L.startsWith("/")){let M=n0.resolve(G,L);if(M.endsWith(".stx"))N=M;else{let T=`${M}.stx`;try{if(R7.statSync(T).isFile())N=T}catch{try{if(R7.statSync(M).isDirectory())w=M}catch{}}}}else w=XH(L,G);if(!w&&!N)continue;let R=!1,A=(M,T)=>{Q.set(M,T),Q.set(M.toLowerCase(),T);let I=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,T),X.add(T)};if(F&&N)A(F,N),R=!0;else if(V){let M=V.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),T=w?YH(w):null;for(let{source:I,local:E}of M){let D=null;if(N)D=N;else if(T)D=T.get(I)??T.get(I.toLowerCase())??T.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)A(E,D),R=!0}}if(R)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return q;for(let O=_.length-1;O>=0;O--)H=H.slice(0,_[O].start)+H.slice(_[O].end);return`<script${z}>${H}</script>`}),K}async function QH($,Z,J,Y,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[q,z]=W,U=z.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let H=j.split("/"),_=H[H.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),V=null,F=[n0.resolve(n0.dirname(J),`${j}.stx`),n0.resolve(n0.dirname(J),j),n0.resolve(Y.componentsDir||"components",`${j}.stx`),n0.resolve(Y.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let L of F)try{if(await Bun.file(L).exists()){V=L;break}}catch{}if(V){G.set(O,V),G.set(_,V),G.set(_.toLowerCase(),V);let L=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,V),X.add(V),Y.debug)console.log(`Imported component: ${O} -> ${V}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(q,""),K.lastIndex=0}return Q}async function GH($,Z,J,Y,X){let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,q;while((q=W.exec(Q))!==null){let z=q.index,U=z+q[0].length-1,j=1,H=U+1;while(H<Q.length&&j>0){if(Q[H]==="(")j++;else if(Q[H]===")"){if(j--,j===0)break}H++}if(j!==0)break;let B=Q.substring(U+1,H),_=H+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let V=O[1],F,L=B.slice(O[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let N={};if(F)try{N=A0(F,Z)}catch(E){let D=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(z,_),`[Error parsing component props: ${D}]`);continue}let R="",A=_,T=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(T)R=T[1].trim(),A=_+T[0].length;let I=await e1(V,N,R,G,Z,J,Y,K,X);Q=Q.substring(0,z)+I+Q.substring(A),W.lastIndex=0}return Q}async function KH($,Z,J,Y,X){if(!$)return $;let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=E1(Q);return Q=W.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,tB),Q=K$(Q,W.scripts),Q;async function j(H,B,_,O){if(!H)return H;let V=H,F=FX(V,B,O);for(let L=F.length-1;L>=0;L--){let w=F[L],N=_?N7(w.tagName):w.tagName,R=$H(w.attributes),A=eB(R,Z,Y),M=m0.getBuiltin(w.tagName),T=M?await M4(N,G,Z,J,Y):!1;if(M&&!T){let y={context:Z,filePath:J,options:Y,dependencies:X},S=M.render(A,w.content,y);if(Object.keys(A.clientReactive).length>0)S=MX(S,A.clientReactive);if(Object.keys(A.events).length>0){let P=RX(A.events);S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${P}`)}V=V.substring(0,w.startIndex)+S+V.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await M4(N,G,Z,J,Y))continue;let I={};for(let[y,S]of Object.entries(A.static))I[y]=S;for(let[y,S]of Object.entries(A.serverDynamic))I[y]=S;let D=await e1(N,I,w.content,G,Z,J,Y,K,X);if(Object.keys(A.clientReactive).length>0)D=MX(D,A.clientReactive);if(Object.keys(A.events).length>0){let y=IX(D);if(y){let S=RX(A.events),P=Object.keys(A.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${P}" ${S}`+D.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+D+V.substring(w.endIndex)}return V}}function MX($,Z){let J=new Set(["if","for"]),Y=new Set(["show"]),X=Object.entries(Z).filter(([z])=>!J.has(z)),Q=X.filter(([z])=>!Y.has(z)).map(([z])=>N7(z)).join(" "),G=$,K=X.length>0?IX(G):null;if(K){let z=X.map(([j,H])=>`:${N7(j)}="${H.replace(/"/g,""")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${z}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,""")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,""")}">${G}</template>`;return G}function IX($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let J=0;while(J<$.length){let Y=$.slice(J),X=Y.match(/^\s+/);if(X){J+=X[0].length;continue}if(Y.startsWith("<!--")){let K=$.indexOf("-->",J+4);if(K===-1)return null;J=K+3;continue}let Q=Y.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,J+Q[0].length);if(W===-1)return null;J=W+K.length;continue}let G=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function A7($,Z,J,Y,X){if(!NX)_X(),NX=!0;let Q=await TX($,Z,J,Y,X);Q=await QH(Q,Z,J,Y,X),Q=await GH(Q,Z,J,Y,X);let G=[];for(let K=0;K<3;K++){let W=W1(Q,G$,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...W.tokens);let q=Q;if(Q=await KH(W.output,Z,J,Y,X),Q===q)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(Y.debug){let K=JH(Q);if(K.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var NX=!1,tB,AX;var L9=b(()=>{o6();OX();wX();n1();I0();M0();K1();tB=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);AX=new Map});var CX={};t(CX,{processLoops:()=>N9,parseLoopBinding:()=>w9});function zH($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",X=0,Q;while((Q=J.exec($))!==null){let G=Q.index+Q[0].length,K=Q.index+Q[0].indexOf("("),W=k0($,"(",")",K);if(W===-1)continue;let q=$.slice(G,W).trim();if(!q)continue;if(!Object.keys(Z).some((j)=>new RegExp(`(?:^|[^\\w$.])${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let U;try{let j=A0(q,Z);if(!j||typeof j!=="object")continue;U=JSON.stringify(j)}catch{continue}Y+=$.slice(X,G)+U,X=W,J.lastIndex=W}return X===0?$:Y+$.slice(X)}function UH($,Z){let J=/@component\s*\(/g,Y=$,X,Q=[];while((X=J.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,W=1,q=K+1;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")"){if(W--,W===0)break}q++}if(W!==0)continue;let z=Y.substring(K+1,q),U=q+1,j=z.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let H=j[1],B=z.slice(j[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let O=B.slice(_[0].length).trim();if(!O)continue;try{let V=A0(O,Z),F=JSON.stringify(V),L=`@component('${H}', ${F})`;Q.push({start:G,end:U,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Y=Y.substring(0,K)+q+Y.substring(W)}return Y}function M7($,Z,J){let Y=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(Y))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1,z=null,U=!1;while(q<Y.length&&W>0){let B=Y[q];if(U){U=!1,q++;continue}if(B==="\\"&&z){U=!0,q++;continue}if(z){if(B===z)z=null;q++;continue}if(B==='"'||B==="'"||B==="`"){z=B,q++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}q++}if(W!==0)break;let j=Y.substring(K+1,q),H=J(j);Y=Y.substring(0,G)+H+Y.substring(q+1)}return Y}function jH($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,X)=>{if(X in Z)return`:${X}="${X}"`;return Y}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);n$(Q);let q=q0(Q,G)(...K),z=JSON.stringify(q),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return Y}}),J}function BH($,Z){let J=$;return J=M7(J,"@break",(Y)=>{try{let Q=`!!(${Y.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(Q,Z));return G?T7:""}catch{return""}}),J=M7(J,"@continue",(Y)=>{try{let Q=`!!(${Y.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(Q,Z));return G?I7:""}catch{return""}}),J}function HH($){let Z=$;return Z=Z.replace(/@break(?!\()/g,T7),Z=Z.replace(/@continue(?!\()/g,I7),Z}function kX($){let Z=$.includes(T7),J=Z?$.substring(0,$.indexOf(T7)):$;return{hasBreak:Z,content:J}}function EX($){let Z=$.includes(I7),J=Z?$.substring(0,$.indexOf(I7)):$;return{hasContinue:Z,content:J}}function SX($){let Z=$;return Z=M7(Z,"@break",(J)=>{let Y=J.trim();if(!o$(Y))return"";return`\`; if (${Y}) { break; } result += \``}),Z=M7(Z,"@continue",(J)=>{let Y=J.trim();if(!o$(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function _H($){let Z=/@forelse\s*\(/g,J,Y=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)Y.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)Y.push({pos:G.index,delta:-1});Y.sort((z,U)=>z.pos-U.pos);let K=[],W=0;for(let z of Y)W+=z.delta,K.push({pos:z.pos,depth:W});function q(z){let U=0,j=K.length-1,H=0;while(U<=j){let B=U+j>>1;if(K[B].pos<=z)H=K[B].depth,U=B+1;else j=B-1}return H}while((J=Z.exec($))!==null){if(q(J.index)>0)continue;let z=J.index,U=J.index+J[0].length-1,j=1,H=U+1,B=-1;while(H<$.length&&j>0){if($[H]==="(")j++;else if($[H]===")"){if(j--,j===0){B=H;break}}H++}if(B===-1)continue;let _=$.substring(U+1,B),O=w9(_);if(!O)continue;let{arrayExpr:V,itemVar:F}=O,L=B+1,w=1,N=L,R=/@forelse\s*\(/g,A=/@endforelse/g,M=-1;while(w>0&&N<$.length){R.lastIndex=N,A.lastIndex=N;let S=R.exec($),P=A.exec($);if(!P)break;if(S&&S.index<P.index)w++,N=S.index+S[0].length;else{if(w--,w===0){M=P.index;break}N=P.index+11}}if(M===-1)continue;let T=$.substring(L,M),I=M+11,E=-1,D=0,y=0;while(y<T.length){let S=T.indexOf("@",y);if(S===-1)break;let P=T.substring(S);if(/^@forelse\s*\(/.test(P))D++,y=S+1;else if(P.startsWith("@endforelse"))D--,y=S+11;else if(D===0&&P.startsWith("@empty")){if(T.length<=S+6||!/[a-z]/i.test(T[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:z,end:I,arrayExpr:V,itemVar:F,foreachContent:T.substring(0,E),emptyContent:T.substring(E+6)}}return null}function bX($,Z){let J=$;while(!0){let Y=_H(J);if(!Y)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:q}=Y;try{let z;if(W0(G))z=q0(G,Object.keys(Z))(...Object.values(Z));else z=Y0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=q;else U=`@foreach (${G} as ${K})${W}@endforeach`;J=J.substring(0,X)+U+J.substring(Q)}catch(z){let U=z instanceof Error?z.message:String(z),j=J0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,o.EVALUATION_ERROR);J=J.substring(0,X)+j+J.substring(Q)}}return J}function w9($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let J=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!J)return null;let Y=J[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),X=J[2].trim();return Y&&X?{arrayExpr:X,itemVar:Y}:null}function N9($,Z,J,Y){let X=$;X=bX(X,Z);function Q(W){let q=/@foreach\s*\(/g,z;while((z=q.exec(W))!==null){let U=z.index,j=z.index+z[0].length-1,H=1,B=j+1,_=-1;while(B<W.length&&H>0){if(W[B]==="(")H++;else if(W[B]===")"){if(H--,H===0){_=B;break}}B++}if(_===-1)continue;let O=W.substring(j+1,_),V=w9(O);if(!V)continue;let F=U,{arrayExpr:L,itemVar:w}=V,N=_+1,R=1,A=N,M=/@foreach\s*\(/g,T=/@endforeach/g;while(R>0&&A<W.length){M.lastIndex=A,T.lastIndex=A;let I=M.exec(W),E=T.exec(W);if(!E)break;if(I&&I.index<E.index)R++,A=I.index+I[0].length;else{if(R--,R===0){let D=W.substring(N,E.index),y=E.index+11;return{start:F,end:y,arrayExpr:L,itemVar:w,content:D}}A=E.index+11}}}return null}function G(W,q){let z=W;while(!0){let U=Q(z);if(!U)break;let{start:j,end:H,arrayExpr:B,itemVar:_,content:O}=U;try{let V=B.trim(),F;if(W0(V))F=q0(V,Object.keys(q))(...Object.values(q));else F=Y0(V,q);let L=!1;if(!Array.isArray(F))if(F instanceof Map)F=Array.from(F),L=!0;else if(F instanceof Set)F=Array.from(F);else if(typeof F==="string")F=Array.from(F);else if(F&&typeof F==="object"&&!(F instanceof Date)&&!(F instanceof RegExp))F=Object.entries(F),L=!0;else{console.warn(`[stx] @foreach(${V}) in ${J}: ${V} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let E=J0("Foreach",`Error in @foreach: ${V} is not iterable`,o.TYPE_ERROR);z=z.substring(0,j)+E+z.substring(H);continue}let w=Y?.loops?.useAltLoopVariable??qH,N=_.trim(),R=null,A,M=!1;if(N.includes("=>")){let E=N.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],A=E[1];else A=N}else if(!N.startsWith("[")&&!N.startsWith("{")&&N.includes(",")){let E=N.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])A=E[0],R=E[1],M=!0;else A=N}else A=N;let T="",I=F;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...q,loop:y,$loop:y};if(A.startsWith("[")&&A.endsWith("]")){let f=A.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(D))f.forEach((d,$0)=>{if(d)S[d]=D[$0]});else S[A]=D}else S[A]=D;if(R)if(!M&&L&&Array.isArray(D)&&D.length===2)S[R]=D[0],S[A]=D[1];else S[R]=E;let P=BH(O,S),C=EX(P);if(C.hasContinue){T+=C.content;continue}let x=kX(P);if(x.hasBreak){T+=x.content;break}if(P=bX(P,S),P=G(P,S),P=X5(P,S,J),P=HH(P),x=kX(P),x.hasBreak){T+=x.content;break}if(C=EX(P),C.hasContinue){T+=C.content;continue}P=b1(P,S,J),P=jH(P,S),P=UH(P,S),P=zH(P,S),T+=P}z=z.substring(0,j)+T+z.substring(H)}catch(V){let F=J0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${V instanceof Error?V.message:String(V)}`,o.EVALUATION_ERROR);z=z.substring(0,j)+F+z.substring(H)}}return z}X=G(X,Z),X=PX(X,Z,J,Y);let K=Y?.loops?.maxWhileIterations??WH;return X=VH(X,Z,K),X}function yX($){return o$($)}function PX($,Z,J,Y){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,q=k0(X,"(",")",W);if(q===-1)break;let z=X.slice(W+1,q),U=q+1,j=J4(X.slice(K),"for","endfor");if(j.length===0)break;let H=j[0].content,B=K+j[0].end;if(!yX(z)){let _=J0("For",`Unsafe expression in @for: ${z}`,o.UNSAFE_EXPRESSION);X=X.substring(0,K)+_+X.substring(B),Q=!0;continue}try{let _=OH(z),O=/@(?:for|foreach|if|unless)\s*\(/.test(H);if(_.length>0&&O){let R=FH({forExpr:z,content:H,iterVarNames:_,context:Z,filePath:J,options:Y});X=X.substring(0,K)+R+X.substring(B),Q=!0;continue}let V=Object.keys(Z),F=Object.values(Z),L=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,A)=>{return`\${${A}}`});L=SX(L);let N=Function(...V,`
|
|
10600
10600
|
let result = '';
|
|
10601
10601
|
for (${z}) {
|
|
10602
10602
|
result += \`${L}\`;
|
|
10603
10603
|
}
|
|
10604
10604
|
return result;
|
|
10605
|
-
`)(...F);X=X.substring(0,K)+N+X.substring(B),Q=!0}catch(_){let O=J0("For",`Error in @for(${z}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);X=X.substring(0,K)+O+X.substring(B),Q=!0}}return X}function
|
|
10605
|
+
`)(...F);X=X.substring(0,K)+N+X.substring(B),Q=!0}catch(_){let O=J0("For",`Error in @for(${z}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);X=X.substring(0,K)+O+X.substring(B),Q=!0}}return X}function OH($){let Z=$.trim(),J=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(J){let Q=J[1];return Q.slice(1,-1).split(",").map((K)=>{let W=K.trim();if(!W)return"";let q=W.indexOf(":");if(q>=0&&Q.startsWith("{")){let j=W.slice(q+1).trim(),H=j.indexOf("=");return(H>=0?j.slice(0,H):j).trim()}let z=W.indexOf("="),U=(z>=0?W.slice(0,z):W).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(X)return[X[1]];return[]}function FH($){let{forExpr:Z,content:J,iterVarNames:Y,context:X,filePath:Q,options:G}=$,K=Object.keys(X),W=Object.values(X),q=Function(...K,"__pushIter",`
|
|
10606
10606
|
for (${Z}) {
|
|
10607
10607
|
__pushIter([${Y.join(", ")}])
|
|
10608
10608
|
}
|
|
10609
|
-
`),z=[];q(...W,(H)=>{z.push(H)});let U=Q??"inline.stx",j="";for(let H of z){let B={...X};Y.forEach((O,V)=>{B[O]=H[V]});let _=
|
|
10609
|
+
`),z=[];q(...W,(H)=>{z.push(H)});let U=Q??"inline.stx",j="";for(let H of z){let B={...X};Y.forEach((O,V)=>{B[O]=H[V]});let _=PX(J,B,Q,G);_=X5(_,B,U),_=b1(_,B,U),j+=_}return j}function VH($,Z,J){let Y=$,X=!0;while(X){X=!1;let Q=Y.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,W=k0(Y,"(",")",K);if(W===-1)break;let q=Y.slice(K+1,W),z=J4(Y.slice(G),"while","endwhile");if(z.length===0)break;let U=z[0].content,j=G+z[0].end;if(!yX(q)){let H=J0("While",`Unsafe expression in @while: ${q}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,G)+H+Y.substring(j),X=!0;continue}try{let H=Object.keys(Z),B=Object.values(Z),_=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(F,L)=>{return`\${${L}}`});_=SX(_);let V=Function(...H,`
|
|
10610
10610
|
let result = '';
|
|
10611
10611
|
let maxIterations = ${J}; // Configurable safety limit
|
|
10612
10612
|
let counter = 0;
|
|
@@ -10618,8 +10618,8 @@ ${D}
|
|
|
10618
10618
|
result += '<!-- [While Error [1104]]: Maximum iterations (${J}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
10619
10619
|
}
|
|
10620
10620
|
return result;
|
|
10621
|
-
`)(...B);Y=Y.substring(0,G)+V+Y.substring(j),X=!0}catch(H){let B=J0("While",`Error in @while(${q}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Y=Y.substring(0,G)+B+Y.substring(j),X=!0}}return Y}var
|
|
10622
|
-
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(X!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!Y.has(B))J.push(B),Y.add(B);return}let j=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))J.push(B),Y.add(B);return}let H=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!Y.has(B))J.push(B),Y.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){W();continue}if(Z[Q]==="{"){X++,Q++;continue}if(Z[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))z();Q++}return J.join(", ")}function
|
|
10621
|
+
`)(...B);Y=Y.substring(0,G)+V+Y.substring(j),X=!0}catch(H){let B=J0("While",`Error in @while(${q}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Y=Y.substring(0,G)+B+Y.substring(j),X=!0}}return Y}var WH=1000,qH=!1,T7="<!--__STX_BREAK__-->",I7="<!--__STX_CONTINUE__-->";var R9=b(()=>{U7();w1();q1();Y4();M0()});import _0 from"path";function A9($,Z){let J=0;for(let Y=Z;Y<$.length;Y++){let X=$[Y];if(X==="("||X==="["||X==="{")J++;else if(X===")"||X==="]"||X==="}")J--;else if(X===","&&J===0)return Y}return-1}function LH($,Z,J){let Y=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=X.exec(Y);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")")W--;q++}if(W!==0)break;let z=Y.substring(K+1,q-1),U=`${J}(${z})`;Y=Y.substring(0,G)+U+Y.substring(q),X.lastIndex=G+U.length,Q=X.exec(Y)}return Y}function wH($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function xX($){let Z=$,J=[],Y=new Set,X=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
10622
|
+
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(X!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!Y.has(B))J.push(B),Y.add(B);return}let j=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))J.push(B),Y.add(B);return}let H=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!Y.has(B))J.push(B),Y.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){W();continue}if(Z[Q]==="{"){X++,Q++;continue}if(Z[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))z();Q++}return J.join(", ")}function fX($,Z=""){let J=xX($).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
|
|
10623
10623
|
(function() {
|
|
10624
10624
|
${O5("var",J)}
|
|
10625
10625
|
var __destroyHooks = [];
|
|
@@ -10628,11 +10628,11 @@ ${D}
|
|
|
10628
10628
|
|
|
10629
10629
|
${$}
|
|
10630
10630
|
${Z}})();
|
|
10631
|
-
`}function
|
|
10631
|
+
`}function gX($,Z){return`
|
|
10632
10632
|
// Register scope variables for STX runtime
|
|
10633
10633
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
10634
10634
|
var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
|
|
10635
|
-
${
|
|
10635
|
+
${xX($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
10636
10636
|
`)}
|
|
10637
10637
|
// #1767: when the bundler renamed a component const that collided with an
|
|
10638
10638
|
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
@@ -10640,7 +10640,7 @@ ${vX($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
10640
10640
|
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
10641
10641
|
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
10642
10642
|
window.stx._scopes['${Z}'] = __scopeRegistration;
|
|
10643
|
-
`}function
|
|
10643
|
+
`}function NH($,Z){let J=gX($,Z),Y=`
|
|
10644
10644
|
(function() {
|
|
10645
10645
|
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
|
|
10646
10646
|
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
@@ -10649,37 +10649,37 @@ ${vX($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
10649
10649
|
} finally {
|
|
10650
10650
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
10651
10651
|
}
|
|
10652
|
-
})();`;return Y+
|
|
10652
|
+
})();`;return Y+fX($,J)+`
|
|
10653
10653
|
} finally {
|
|
10654
10654
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
10655
10655
|
}
|
|
10656
|
-
})();`}function
|
|
10657
|
-
`;continue}if($0)try{let{extractVariables:u}=await Promise.resolve().then(() => (j$(),Z4));await u(d,I,F)}catch(u){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,u)}if(!$0&&!N0){let u=f.replace(/\bclient\b/i,"").trim();S=`stx_scope_${_0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++
|
|
10658
|
-
`}}if(S){let x=
|
|
10656
|
+
})();`}function RH($,Z){let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=(J[2]+J[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=J[1],G=J[2],K=J[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function MH($){if($.__onceStore instanceof Set)return $.__onceStore;return AH}async function M9($,Z,J,Y,X,Q=new Set){let G=Y.partialsDir||_0.join(_0.dirname(J),"partials");if(G&&!_0.isAbsolute(G))G=_0.resolve(process.cwd(),G);let K=LH($,"@partial","@include"),W=MH(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,_,O)=>{let V=_.trim(),F=`${J}:${V}`;if(W.has(F))return"";return W.add(F),_});{let B=/@includeIf\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,V=O+_[0].length-1,F=1,L=V+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")")F--;L++}if(F!==0)break;let w=K.substring(V+1,L-1),N=w.match(/^\s*['"]([^'"]+)['"]/);if(!N){B.lastIndex=L;continue}let R=N[1],A=q(R,G,J),M="";if(A&&await Bun.file(A).exists())X.add(A),M=`@include(${w})`;K=K.substring(0,O)+M+K.substring(L),B.lastIndex=0}}for(let[B,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),V;while((V=O.exec(K))!==null){let F=V.index,L=F+V[0].length-1,w=1,N=L+1;while(N<K.length&&w>0){if(K[N]==="(")w++;else if(K[N]===")")w--;N++}if(w!==0)break;let R=K.substring(L+1,N-1),A=A9(R,0);if(A===-1){O.lastIndex=N;continue}let M=R.substring(0,A).trim(),T=R.substring(A+1).trim(),I=T.match(/^\s*['"]([^'"]+)['"]/);if(!I){O.lastIndex=N;continue}let E=I[1],D=T.substring(I[0].length),y,S=A9(D,0);if(S!==-1)y=D.substring(S+1).trim();try{let P=`Boolean(${M})`,C;if(W0(P)){let d=q0(P,Object.keys(Z));C=Boolean(d(...Object.values(Z)))}else C=Boolean(Y0(P,Z));let x=_?!C:C,f="";if(x){let d=q(E,G,J);if(d&&await Bun.file(d).exists())X.add(d);f=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,F)+f+K.substring(N),O.lastIndex=0}catch(P){let C=P instanceof Error?P.message:String(P),x=j0("Include",`Error evaluating ${B} condition: ${C}`,J,$,F);K=K.substring(0,F)+x+K.substring(N),O.lastIndex=0}}}{let B=/@each\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,V=O+_[0].length-1,F=1,L=V+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")"){if(F--,F===0)break}L++}if(F!==0)break;let w=K.substring(V+1,L),N=K.substring(O,L+1),R=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){B.lastIndex=0,K=K.replace(N,"");continue}let[,A,M,T,I]=R;try{let E,D=M.trim();if(W0(D))E=q0(D,Object.keys(Z))(...Object.values(Z));else E=Y0(D,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let P={...Z,[T]:S},C=await U(A,P,$,O);y+=C}else if(I)y=await U(I,{},$,O);K=K.substring(0,O)+y+K.substring(L+1),B.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,O)+j0("Each",`Error in @each: ${D}`,J,$,O)+K.substring(L+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,V=O+_[0].length-1,F=1,L=V+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")"){if(F--,F===0)break}L++}if(F!==0)break;let w=K.substring(V+1,L),N=K.substring(O,L+1),R=w.match(/^\s*(\[[^\]]+\])/);if(!R){B.lastIndex=0,K=K.replace(N,"");continue}let A=R[1],M=w.slice(R[0].length),T,I=M.match(/^\s*,\s*\{/);if(I){M=M.slice(I[0].length-1);let y=1,S=1;while(S<M.length&&y>0){if(M[S]==="{")y++;else if(M[S]==="}"){if(y--,y===0)break}S++}T=M.substring(0,S+1),M=M.slice(S+1)}let E,D=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let y=JSON.parse(A.replace(/'/g,'"')),S={};if(T)try{S=A0(T,Z)}catch(C){let x=C instanceof Error?C.message:String(C);if(Y.debug){let f=j0("Include",`Error parsing includeFirst variables: ${x}`,J,$,O,N);K=K.replace(N,()=>f)}else K=K.replace(N,()=>E||"");continue}let P=!1;for(let C of y){let x=q(C,G,J);if(!x)continue;if(await c(x)){let f=await U(C,S,$,O);K=K.replace(N,()=>f),P=!0;break}}if(!P)if(E!==void 0)K=K.replace(N,()=>E);else if(Y.debug){let C=j0("Include",`None of the includeFirst paths exist: ${A}`,J,$,O,N);K=K.replace(N,()=>C)}else K=K.replace(N,"")}catch(y){let S=y instanceof Error?y.message:String(y),P=j0("Include",`Error processing @includeFirst: ${S}`,J,$,O,N);K=K.replace(N,()=>P)}B.lastIndex=0}}function q(B,_,O){try{let V=B;if(!B.endsWith(".stx"))V=`${B}.stx`;let F=_0.resolve(_),L=_0.resolve(_0.dirname(O)),w;if(!V.startsWith("./")&&!V.startsWith("../"))w=_0.resolve(_,V);else w=_0.resolve(L,V);let N=_0.normalize(w),R=N.startsWith(F+_0.sep)||N===F,A=N.startsWith(L+_0.sep)||N===L,M=!1,T=_0.dirname(L);if(N.startsWith(T+_0.sep)){if(!_0.relative(T,N).split(_0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))M=!0}if(!R&&!A&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${F}, ${L}`),null;return N}catch(V){return console.error(`Error resolving path ${B}: ${V}`),null}}let z=_0.resolve(J);Q.add(z);async function U(B,_={},O,V){let F=q(B,G,J);if(!F)return j0("Include",`Could not resolve path for include: ${B}`,J,O,V);let L=_0.resolve(F);if(Q.has(L)){let w=[...Q,L].map((N)=>_0.basename(N)).join(" -> ");return j0("Include",`Circular include detected: ${w}`,J,O,V)}try{X.add(F);let w;if(!w)try{w=await Bun.file(F).text()}catch(x){let f=x instanceof Error?x.message:String(x);return j0("Include",`Error loading include file ${B}: ${f}`,J,O,V)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (l6(),p6));w=x(w,Z)}if(w&&(Y.debug||!L$()&&!r4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (i6(),ZX));x(w,F)}catch{}let N=w;try{let{processESImports:x}=await Promise.resolve().then(() => (L9(),DX));await x(w,Z,F,Y,X)}catch(x){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,x instanceof Error?x.message:x)}let R=t$(N);if(R)N=R.content.trim();let M=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(M)T=`<style${M[1]}>${M[2]}</style>`;N=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};I.__stx_signals_gate=L1(w);for(let[x,f]of Object.entries(_))I[x]=f;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(E)],y="",S=null;for(let x of D){let f=x[1]||"",d=x[2]||"",$0=f.includes("server"),P0=c1(f),B0="";try{let{extractAndStripCssImports:u,renderVendorStyleTags:a}=await Promise.resolve().then(() => (Q$(),ZZ)),R0=u(d,{filePath:F,projectRoot:process.cwd()});d=R0.code,B0=a(R0.styles)}catch(u){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,u instanceof Error?u.message:u)}if(P0&&d.trim())d=i1(d);if(!$0)try{let{hasUserImports:u,bundleClientScript:a}=await Promise.resolve().then(() => ($$(),e5));if(u(d))d=await a(d,F,{projectRoot:process.cwd()})}catch(u){if(Y.debug)console.warn(`[stx] bundler skipped for ${F}:`,u instanceof Error?u.message:u)}let N0=wH(d);if(N0&&!$0){S=`stx_scope_${_0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++vX}`;let u=p0(d),a=NH(u,S);y+=`${B0}<script data-stx-scoped data-stx-run="always">${a}</script>
|
|
10657
|
+
`;continue}if($0)try{let{extractVariables:u}=await Promise.resolve().then(() => (j$(),Z4));await u(d,I,F)}catch(u){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,u)}if(!$0&&!N0){let u=f.replace(/\bclient\b/i,"").trim();S=`stx_scope_${_0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++vX}`;let a=p0(d),R0=gX(a,S),C0=fX(a,R0);y+=`${B0}<script data-stx-scoped data-stx-run="always"${u?` ${u}`:""}>${C0}</script>
|
|
10658
|
+
`}}if(S){let x=RH(N,S);if(N=x.html,x.mergedIntoExisting)y=y.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),S=x.mergedIntoExisting}if(N.includes("@include")||N.includes("@partial"))N=await M9(N,I,F,Y,X,Q);let{processLoops:P}=await Promise.resolve().then(() => (R9(),CX)),C=P(N,I,F);if(C=X5(C,I,F),C=b1(C,I,F),T)C+=`
|
|
10659
10659
|
`+T;if(y)C+=`
|
|
10660
10660
|
`+y;return C}catch(w){let N=w instanceof Error?w.message:String(w);return j0("Include",`Error processing include ${B}: ${N}`,J,O,V)}}let j=/@include\s*\(/g,H;while((H=j.exec(K))!==null){let B=H.index,_=B+H[0].length-1,O=1,V=_+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let F=K.substring(B,V),L=K.substring(_+1,V-1),w=L.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=V;continue}let N=w[1],R,A=L.substring(w[0].length),M=A9(A,0);if(M!==-1)R=A.substring(M+1).trim();let T={};if(R)try{T=A0(R,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(F,j0("Include",`Error parsing include variables for ${N}: ${D}`,J,$,B)),j.lastIndex=0;continue}let I=await U(N,T,$,B);K=K.substring(0,B)+I+K.substring(V),j.lastIndex=0}return K}function T9($,Z){let J=$;function Y(X,Q,G,K){let W=X,q=!0;while(q){q=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=W.match(z);if(!U||U.index===void 0)break;let j=U.index,H=U[1],B=j+U[0].length,_=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),V=1,F=B,L=-1;while(V>0&&F<W.length){let N=W.slice(F),R=N.match(_),A=N.match(O),M=R?F+R.index:1/0,T=A?F+A.index:1/0;if(M<T)V++,F=M+(R[0].length||1);else if(T<1/0){if(V--,V===0){L=T;break}F=T+G.length+1}else break}if(L===-1)break;let w=W.slice(B,L);if(!Z[H])Z[H]=[];if(K)Z[H].unshift(w);else Z[H].push(w);W=W.substring(0,j)+W.substring(L+`@${G}`.length),q=!0}return W}return J=Y(J,"push","endpush",!1),J=Y(J,"prepend","endprepend",!0),J}function I9($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,Y)=>{if(!Z[Y]||Z[Y].length===0)return"";return Z[Y].join(`
|
|
10661
|
-
`)})}var
|
|
10661
|
+
`)})}var vX=0,tM,AH;var hX=b(()=>{z3();U7();q1();K1();R5();M0();I0();tM=new o1(500),AH=new Set});import*as D9 from"path";async function uX($,Z,J=""){if(D9.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return dX($,Z,J,"@js","@endjs")}async function mX($,Z,J=""){if(D9.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return dX($,Z,J,"@ts","@endts")}async function dX($,Z,J,Y,X){let Q=$,G=N5(`${Y}([\\s\\S]*?)${X}`,"g"),K=[],W;while((W=G.exec($))!==null)K.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:q,content:z,index:U}of K)try{let j={...Z,global:Z},H=Object.keys(j),B=Object.values(j),_=z.trim();if(Y==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let V=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=V.length>0?`return { ${V.join(", ")} };`:"return {};",L=`
|
|
10662
10662
|
${_}
|
|
10663
10663
|
${F}
|
|
10664
|
-
`,N=Function(...H,L)(...B);if(N&&typeof N==="object")Object.assign(Z,N);Q=Q.replace(q,"")}catch(j){console.error(`Error executing ${Y} code block in ${J}:`,j);let H=j instanceof Error?j.message:String(j),B=j0(`${Y} Directive`,`Error executing code: ${H}`,J,$,U,q);console.error(B),Q=Q.replace(q,"")}return Q}var
|
|
10664
|
+
`,N=Function(...H,L)(...B);if(N&&typeof N==="object")Object.assign(Z,N);Q=Q.replace(q,"")}catch(j){console.error(`Error executing ${Y} code block in ${J}:`,j);let H=j instanceof Error?j.message:String(j),B=j0(`${Y} Directive`,`Error executing code: ${H}`,J,$,U,q);console.error(B),Q=Q.replace(q,"")}return Q}var pX=b(()=>{R5();I0()});function TH($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function lX($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,Y,X,Q)=>{return TH(Y,Q||"_method")})}async function cX($,Z,J,Y,X){if(!Y.middleware||Y.middleware.length===0)return $;let Q=$,G=Y.middleware.filter((K)=>K.timing===X);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,J,Y);if(typeof W==="string")Q=W;else if(Y.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(Y.debug)console.error(`Error in middleware ${K.name}:`,W);if(Y.debug){let q=j0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,J,$);Q=Q.replace(/<body[^>]*>/,`$&
|
|
10665
10665
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${t0(q)}</div>
|
|
10666
|
-
`)}}}return Q}async function
|
|
10666
|
+
`)}}}return Q}async function iX($,Z,J,Y){return cX($,Z,J,Y,"before")}async function nX($,Z,J,Y){return cX($,Z,J,Y,"after")}var oX=b(()=>{q1();I0()});import{defineRoute as UT,defineRoutes as jT,resetRoutes as BT,route as HT,setAppUrl as _T}from"stx-router";import{route as IH}from"stx-router";function sX($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,Y,X,Q)=>{try{let G=X?A0(X,{}):{};return IH(Y,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var rX=b(()=>{M0()});async function aX($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(y$.exact[$])for(let Y of y$.exact[$])await Promise.resolve(Y(Z,$));if(y$.exact[J])for(let Y of y$.exact[J])await Promise.resolve(Y(Z,$));for(let{pattern:Y,callback:X}of y$.patterns)if(Y.test($)||Y.test(J))await Promise.resolve(X(Z,$))}var y$;var tX=b(()=>{y$={patterns:[],exact:{}}});function eX($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>eX(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function $Q($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(q){return X.some(([z,U])=>q>=z&&q<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(J))!==null){if(G(Q.index))continue;let q=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,H=z,B=!1;while((j=U.exec(z))!==null){let _=j[1],O=j[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let V=Object.keys(Z),F=Object.values(Z),L=O.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!V.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let N=Function(...V,`return (${O})`)(...F);if(_==="class"){let R=eX(N);if(R){let A=H.match(/\sclass="([^"]*)"/);if(A)H=H.replace(A[0],` class="${A[1]} ${R}"`);else H=H.replace(j[0],` class="${R}"`)}else H=H.replace(j[0],"");B=!0;continue}if(DH.has(_)){if(N)H=H.replace(j[0],` ${_}`);else H=H.replace(j[0],"");B=!0;continue}if(N===null||N===void 0||N===!1)H=H.replace(j[0],"");else{let R=String(N).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");H=H.replace(j[0],` ${_}="${R}"`)}B=!0}catch{continue}}if(B){let _=q.endsWith("/>")?" /":"",V=`<${Q[1]}${H}${_}>`;W.push({start:Q.index,end:Q.index+q.length,replacement:V})}}for(let q=W.length-1;q>=0;q--){let{start:z,end:U,replacement:j}=W[q];J=J.slice(0,z)+j+J.slice(U)}return J}var DH;var ZQ=b(()=>{DH=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function W5($,Z){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=Z;let Y=J.exec($);if(!Y)return null;let X=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&kH.has(Y[1]),Q=X?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:Q,selfClosing:X,start:Y.index,end:Y.index+Y[0].length}}function bH($,Z,J){let Y=1,X=J,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(Y>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)Y++,X=K.index+K[0].length;else{if(Y--,Y===0)return W.index+W[0].length;X=W.index+W[0].length}}return-1}function U1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=bH($,Z.tag,Z.end);if(J===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:J,innerHTML:$.slice(Z.end,J-`</${Z.tag}>`.length)}}function JQ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function f5($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return Y?Y[1]:null}function h1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function u1($,Z,J){let Y=Z.selfClosing?" /":"",X=`<${Z.tag}${J}${Y}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function SH($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function yH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;let X=f5(Y.attrs,"v-for");if(X===null){J=Y.end;continue}let Q=X.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){J=Y.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let O=G.split(",").map((L)=>L.trim()),V=O[0],F=O[1];W=`${K} as ${F} => ${V}`}else W=`${K} as ${G}`;let q=h1(Y.attrs,"v-for"),z=h1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=U1(Z,Y),j=Z.slice(U.outerStart,U.outerEnd),H=u1(j,{...Y,start:0,end:Y.end-Y.start},z),B=`@foreach(${W})
|
|
10667
10667
|
`,_=`${B}${H}
|
|
10668
|
-
@endforeach`;Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),J=U.outerStart+B.length}return Z}function
|
|
10668
|
+
@endforeach`;Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),J=U.outerStart+B.length}return Z}function PH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;let X=f5(Y.attrs,"v-if");if(X===null){J=Y.end;continue}let Q=[],G=U1(Z,Y),K=h1(Y.attrs,"v-if"),W=u1(Z.slice(G.outerStart,G.outerEnd),{...Y,start:0,end:Y.end-Y.start},K);Q.push({type:"if",expr:X,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:Y});let q=G.outerEnd,z=!0;while(z){let _=Z.slice(q).match(/^\s*/),O=_?_[0].length:0,V=W5(Z,q+O);if(!V){z=!1;break}let F=f5(V.attrs,"v-else-if"),L=JQ(V.attrs,"v-else");if(F!==null){let w=U1(Z,V),N=h1(V.attrs,"v-else-if"),R=u1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},N);Q.push({type:"else-if",expr:F,outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:V}),q=w.outerEnd}else if(L){let w=U1(Z,V),N=h1(V.attrs,"v-else"),R=u1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},N);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:V}),z=!1}else z=!1}let U=[];for(let _ of Q)if(_.type==="if")U.push(`@if(${_.expr})
|
|
10669
10669
|
${_.element}`);else if(_.type==="else-if")U.push(`@elseif(${_.expr})
|
|
10670
10670
|
${_.element}`);else U.push(`@else
|
|
10671
10671
|
${_.element}`);U.push("@endif");let j=U.join(`
|
|
10672
|
-
`),H=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,H)+j+Z.slice(B),J=H+j.length}return Z}function
|
|
10672
|
+
`),H=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,H)+j+Z.slice(B),J=H+j.length}return Z}function CH($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function vH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;let X=Y.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=X.match(G);while(K){Q=!0;let z=K[1],U=K[2],j=K[3];X=X.replace(K[0],""),X+=` :${z}="${j}" @update:${z}="${j} = $event"`,K=X.match(G)}if(Q){let z=U1(Z,Y),U=Z.slice(z.outerStart,z.outerEnd),j=u1(U,{...Y,start:0,end:Y.end-Y.start},X);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),J=z.outerStart+j.length;continue}let W=f5(Y.attrs,"v-model");if(W===null){J=Y.end;continue}if(EH.has(Y.tag)){let z=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,U=U1(Z,Y),j=Z.slice(U.outerStart,U.outerEnd),H=u1(j,{...Y,start:0,end:Y.end-Y.start},z);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),J=U.outerStart+H.length}else{let z=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let U=U1(Z,Y),j=Z.slice(U.outerStart,U.outerEnd),H=u1(j,{...Y,start:0,end:Y.end-Y.start},z);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),J=U.outerStart+H.length}}return Z}function xH($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function fH($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function gH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;let X=f5(Y.attrs,"v-html");if(X===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let Q=U1(Z,Y),G=h1(Y.attrs,"v-html"),K=Y.selfClosing?" /":"",W=`<${Y.tag}${G}${K}>{!! ${X} !!}</${Y.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),J=Q.outerStart+W.length}return Z}function hH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;let X=f5(Y.attrs,"v-text");if(X===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let Q=U1(Z,Y),G=h1(Y.attrs,"v-text"),K=Y.selfClosing?" /":"",W=`<${Y.tag}${G}${K}>{{ ${X} }}</${Y.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),J=Q.outerStart+W.length}return Z}function uH($){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 mH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;if(!JQ(Y.attrs,"v-once")){J=Y.end;continue}let X=h1(Y.attrs,"v-once"),Q=U1(Z,Y),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
|
|
10673
10673
|
${u1(G,{...Y,start:0,end:Y.end-Y.start},X)}
|
|
10674
|
-
@endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),J=Q.outerStart+W.length}return Z}function
|
|
10675
|
-
${Y}${$.slice(J)}`}function E9($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let J=Z.index+Z[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(J));if(Y)J+=Y[0].length;return J}function
|
|
10676
|
-
${Q[0]}`+G+$.slice(J+X.length)}function
|
|
10677
|
-
${Z[0]}${Y.slice(X)}`}var
|
|
10678
|
-
<meta name="stx-build" content="${Z}">${$.slice(Y)}`}var y9=null;function R1($){return String($).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function
|
|
10679
|
-
${$.slice(Z)}`}function
|
|
10674
|
+
@endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),J=Q.outerStart+W.length}return Z}function dH($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function pH($){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 YQ($){if(!SH($))return $;let Z=$;return Z=yH(Z),Z=PH(Z),Z=mH(Z),Z=xH(Z),Z=fH(Z),Z=vH(Z),Z=CH(Z),Z=pH(Z),Z=gH(Z),Z=hH(Z),Z=uH(Z),Z=dH(Z),Z}var kH,EH;var XQ=b(()=>{kH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),EH=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 D7($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}function QQ($,Z){let J=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),Y=J?J[1]:$,X=Y0(Y,Z);if(X&&typeof X==="string")return X;let Q=Y.trim();return k9.has(Q)?Q:null}function GQ($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function KQ($,Z,J){let Y=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),X=Y?`<${$} ${Y}>`:`<${$}>`;if(lH.has($))return Y?`<${$} ${Y}>`:`<${$}>`;return`${X}${J}</${$}>`}async function WQ($,Z,J,Y,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let q=K.length-1;q>=0;q--){let z=K[q];try{let U=QQ(z.expr,Z);if(!U||typeof U!=="string"){let F=`<!-- dynamic component: could not resolve "${D7(GQ(z.expr))}" -->`;Q=Q.slice(0,z.index)+F+Q.slice(z.index+z.full.length);continue}if(k9.has(U)){let F=KQ(U,z.attrs,z.slotContent);Q=Q.slice(0,z.index)+F+Q.slice(z.index+z.full.length);continue}let j=z.attrs.trim(),H={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=B.exec(j))!==null){let F=_[1]||_[2],L=_[3];if(_[1])try{H[F]=Y0(L,Z)}catch{H[F]=L}else H[F]=L}let O=Y.componentsDir||"components",V=await e1(U,H,z.slotContent,O,Z,J,Y,new Set,X??new Set);Q=Q.slice(0,z.index)+V+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),H=`<!-- dynamic component error: ${D7(j)} -->`;Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}}return Q=await cH(Q,Z,J,Y,X),Q}async function cH($,Z,J,Y,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let q=K.length-1;q>=0;q--){let z=K[q];try{let U=QQ(z.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${D7(GQ(z.expr))}" -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length);continue}if(k9.has(U)){let B=KQ(U,z.attrs,"");Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length);continue}let j=Y.componentsDir||"components",H=await e1(U,{},"",j,Z,J,Y,new Set,X??new Set);Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),H=`<!-- dynamic component error: ${D7(j)} -->`;Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}}return Q}var k9,lH;var qQ=b(()=>{I0();M0();k9=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),lH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function rH($){let Z=$.storageKey??"stx-color-mode",J=$.initialMode??"auto",Y=$.darkClass===void 0?"dark":$.darkClass,X=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!iH.has(J))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(J)}`);if(Y!==null&&(typeof Y!=="string"||!sH.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(X!==null&&(typeof X!=="string"||!oH.test(X)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(X)}`);if(Q!==null&&!nH.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(Y===null&&X===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:J==="system"?"auto":J,darkClass:Y,attribute:X,autoValue:Q}}function aH($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function b9($={}){let Z=rH($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${aH(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function zQ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let J=E9($);if(J===null)return $;let Y=b9(Z);return`${$.slice(0,J)}
|
|
10675
|
+
${Y}${$.slice(J)}`}function E9($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let J=Z.index+Z[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(J));if(Y)J+=Y[0].length;return J}function $_($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length,Y=$.toLowerCase().indexOf("</head>",J),X=$.slice(J,Y===-1?$.length:Y),Q=eH.exec(X);if(!Q||X.slice(0,Q.index).trim()==="")return $;let G=X.slice(0,Q.index)+X.slice(Q.index+Q[0].length);return $.slice(0,J)+`
|
|
10676
|
+
${Q[0]}`+G+$.slice(J+X.length)}function UQ($){return Z_($_($))}function Z_($){let Z=tH.exec($);if(!Z)return $;let J=E9($);if(J===null)return $;if(Z.index<=J||$.slice(J,Z.index).trim()==="")return $;let Y=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),X=E9(Y);if(X===null)return $;return`${Y.slice(0,X)}
|
|
10677
|
+
${Z[0]}${Y.slice(X)}`}var iH,nH,oH,sH,tH,eH;var S9=b(()=>{iH=new Set(["light","dark","auto","system"]),nH=new Set(["auto","system"]),oH=/^[a-z][\w:-]*$/i,sH=/^[\w-]+$/;tH=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),eH=/<meta\b[^>]*\bcharset\b[^>]*>/i});function J_(){if(y9===null)y9=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return y9}function jQ($,Z=J_()){if($.includes('name="stx-build"'))return $;let J=/<head\b[^>]*>/i.exec($);if(!J)return $;let Y=J.index+J[0].length;return`${$.slice(0,Y)}
|
|
10678
|
+
<meta name="stx-build" content="${Z}">${$.slice(Y)}`}var y9=null;function R1($){return String($).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Y_($){return String($).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function P9($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function g5($,Z){return Object.entries($).filter(([J])=>!Z?.(J)).map(([J,Y])=>`${J}="${R1(String(Y))}"`).join(" ")}function X_($={},Z="en"){let J=[],Y=[],X="",Q=Z;for(let[K,W]of Object.entries($||{})){if(W==null)continue;let q=K.trim();if(!HQ.test(q))continue;let z=q.toLowerCase();if(z==="lang"){Q=String(W);continue}if(z==="class"){X=String(W).trim();continue}J.push(` ${q}="${R1(String(W))}"`),Y.push(q)}let G=` lang="${R1(Q)}"`;if(X)G+=` class="${R1(X)}"`;if(G+=J.join(""),X)G+=` ${E7}="${R1(X)}"`;if(Y.length)G+=` ${k7}="${R1(Y.join(" "))}"`;return G}function _Q($={},Z={}){let J={...$,...Z};if($.class&&Z.class){let Y=$.class.split(/\s+/).filter(Boolean);for(let X of Z.class.split(/\s+/).filter(Boolean))if(!Y.includes(X))Y.push(X);J.class=Y.join(" ")}return J}function OQ($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let J=$.match(/<html\b([^>]*)>/i);if(!J)return $;let Y={},X=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(J[1]))!==null){let z=G[1];if(!(z in Y))X.push(z);Y[z]=G[2]??G[3]??G[4]??""}let K=[],W=[];for(let[z,U]of Object.entries(Z)){if(U==null)continue;let j=z.trim();if(!HQ.test(j))continue;let H=j.toLowerCase();if(H==="class"){let B=(Y.class||"").split(/\s+/).filter(Boolean);for(let _ of String(U).split(/\s+/).filter(Boolean))if(!B.includes(_))B.push(_),K.push(_);if(!("class"in Y))X.push("class");Y.class=B.join(" ");continue}if(!(j in Y))X.push(j);if(Y[j]=String(U),H!=="lang")W.push(j)}if(K.length){if(!(E7 in Y))X.push(E7);Y[E7]=K.join(" ")}if(W.length){if(!(k7 in Y))X.push(k7);Y[k7]=W.join(" ")}let q=X.map((z)=>` ${z}="${R1(Y[z])}"`).join("");return $.replace(J[0],()=>`<html${q}>`)}function FQ($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${BQ}
|
|
10679
|
+
${$.slice(Z)}`}function Q_($){let Z=[],J=0;while(J<$.length){let Q=$.slice(J),G=Q.match(/^\s+/);if(G){J+=G[0].length;continue}if(Q.startsWith("<!--")){let U=$.indexOf("-->",J);if(U===-1)break;J=U+3;continue}let K=Q.match(/^<script\b[^>]*>/i);if(K){let U=$.toLowerCase().indexOf("</script>",J+K[0].length);if(U===-1)break;J=U+9;continue}let W=Q.match(/^<link\b[^>]*>/i);if(W){Z.push(W[0]),J+=W[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q){Z.push(q[0]),J+=q[0].length;continue}let z=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(z){Z.push(z[0]),J+=z[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let Y="",X=0;while(X<$.length&&X<J){let Q=$.slice(X),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){X+=G[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){X+=K[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W&&Z.includes(W[0])){X+=W[0].length;continue}Y+=$[X],X++}return Y+=$.slice(J),{body:Y,hoisted:Z}}function G_($,Z={},J={}){let{title:Y="stx App",lang:X="en",meta:Q=[],link:G=[],script:K=[],headRaw:W="",htmlAttrs:q={},bodyClass:z="",bodyAttrs:U={}}=Z,j=J.title||Y,H=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map(P9).filter(Boolean)),O=[...H.filter((I)=>!B.has(P9(I))),...Q].map((I)=>{return` <meta ${g5(I)}>`}).join(`
|
|
10680
10680
|
`),V=G.map((I)=>{return` <link ${g5(I)}>`}).join(`
|
|
10681
10681
|
`),F=K.map((I)=>{if(I.src)return` <script ${g5(I,(E)=>E==="content")}></script>`;if(I.content)return` <script>${I.content}</script>`;return""}).filter(Boolean).join(`
|
|
10682
|
-
`),L=
|
|
10682
|
+
`),L=X_(q,X),w=Object.entries(U).map(([I,E])=>` ${I}="${R1(String(E))}"`).join(""),N=z?` class="${R1(z)}"`:"",{body:R,hoisted:A}=Q_($),M=[O,J.colorMode?` ${b9(J.colorMode)}`:"",` <title>${J.titleIsHtml?j:Y_(j)}</title>`,` ${BQ}`,V,F,W?` ${W}`:"",...(J.styles||[]).map((I)=>` ${I}`),...A.map((I)=>` ${I}`),...(J.headScripts||[]).map((I)=>` ${I}`),J.headStack||""].filter(Boolean),T=[R,...(J.bodyScripts||[]).map((I)=>I),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
10683
10683
|
<html${L}>
|
|
10684
10684
|
<head>
|
|
10685
10685
|
${M.join(`
|
|
@@ -10689,23 +10689,23 @@ ${M.join(`
|
|
|
10689
10689
|
${T.join(`
|
|
10690
10690
|
`)}
|
|
10691
10691
|
</body>
|
|
10692
|
-
</html>`}function C9($){let Z=0;while(Z<$.length){let J=$.slice(Z),Y=J.match(/^\s+/);if(Y){Z+=Y[0].length;continue}if(J.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let X=J.match(/^<(script|style)\b[^>]*>/i);if(X){let Q=`</${X[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+X[0].length);if(G===-1)return!1;Z=G+Q.length;continue}return/^<!DOCTYPE\b/i.test(J)||/^<html[\s>]/i.test(J)}return!1}function v9($){return C9($)}function
|
|
10692
|
+
</html>`}function C9($){let Z=0;while(Z<$.length){let J=$.slice(Z),Y=J.match(/^\s+/);if(Y){Z+=Y[0].length;continue}if(J.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let X=J.match(/^<(script|style)\b[^>]*>/i);if(X){let Q=`</${X[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+X[0].length);if(G===-1)return!1;Z=G+Q.length;continue}return/^<!DOCTYPE\b/i.test(J)||/^<html[\s>]/i.test(J)}return!1}function v9($){return C9($)}function VQ($,Z={}){let J=$.lastIndexOf("</head>");if(J===-1)return $;let{meta:Y=[],link:X=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,J),W=[];for(let q of Y){let z=P9(q);if(z&&K.includes(z))continue;W.push(` <meta ${g5(q)}>`)}for(let q of X){if(q.href&&K.includes(`href="${q.href}"`))continue;W.push(` <link ${g5(q)}>`)}for(let q of Q)if(q.src){if(K.includes(`src="${q.src}"`))continue;W.push(` <script ${g5(q,(z)=>z==="content")}></script>`)}else if(q.content){if(K.includes(q.content))continue;W.push(` <script>${q.content}</script>`)}if(G&&!K.includes(G))W.push(` ${G}`);if(W.length===0)return $;return`${$.slice(0,J)}${W.join(`
|
|
10693
10693
|
`)}
|
|
10694
|
-
${$.slice(J)}`}function
|
|
10694
|
+
${$.slice(J)}`}function LQ($,Z={},J={}){if(v9($))return $;return G_($,Z,J)}var BQ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",k7="data-stx-html-attrs",E7="data-stx-html-class",HQ;var wQ=b(()=>{S9();HQ=/^[A-Za-z_:][\w:.-]*$/});import h5 from"path";function NQ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function RQ($,Z,J){try{let Y;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=h5.join(X,$);if(await Bun.file(G).exists())return G;X=h5.dirname(X)}Y=h5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))Y=h5.resolve(Z,$);else Y=h5.resolve(Z,$);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function AQ($,Z,J){let Y=$,X=h5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(Y))!==null){let[q,z,U,j]=G;if(NQ(U))continue;let H=await RQ(U,X,Z);if(H)try{let B=await Bun.file(H).text();if(J.add(H),U.endsWith(".ts")||U.endsWith(".tsx")){let O=await Bun.build({entrypoints:[H],target:"browser",minify:!1,define:g0()});if(O.outputs.length>0)B=await O.outputs[0].text()}let _=`<script>
|
|
10695
10695
|
// Source: ${U}
|
|
10696
10696
|
${B}
|
|
10697
|
-
</script>`;Y=Y.replace(q,_),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(Y))!==null){let[q,z,U,j]=W,H=z+j;if(
|
|
10697
|
+
</script>`;Y=Y.replace(q,_),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(Y))!==null){let[q,z,U,j]=W,H=z+j;if(NQ(U))continue;if(/rel=["']stylesheet["']/.test(H)||U.endsWith(".css")){let _=await RQ(U,X,Z);if(_)try{let O=await Bun.file(_).text();J.add(_);let V=`<style>
|
|
10698
10698
|
/* Source: ${U} */
|
|
10699
10699
|
${O}
|
|
10700
|
-
</style>`;Y=Y.replace(q,V),K.lastIndex=0}catch(O){}}}return Y}var
|
|
10700
|
+
</style>`;Y=Y.replace(q,V),K.lastIndex=0}catch(O){}}}return Y}var MQ=b(()=>{D1()});function x9($,Z){let J=$,Y=/@json\s*\(/g,X;while((X=Y.exec(J))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,q=null,z=!1;while(W<J.length&&K>0){let L=J[W];if(z){z=!1,W++;continue}if(L==="\\"&&q){z=!0,W++;continue}if(q){if(L===q)q=null;W++;continue}if(L==='"'||L==="'"||L==="`"){q=L,W++;continue}if(L==="(")K++;else if(L===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=J.substring(G+1,W).trim(),j=J.substring(Q,W+1),H=-1,B=0,_=null,O=!1;for(let L=0;L<U.length;L++){let w=U[L];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){H=L;break}}let V=H>=0?U.substring(0,H).trim():U,F=H>=0?U.substring(H+1).trim():void 0;try{let L=V.trim(),w;if(W0(L))w=q0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let N;if(F==="true")N=JSON.stringify(w,null,2);else N=JSON.stringify(w);let R=N.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,Q)+R+J.substring(W+1),Y.lastIndex=Q+R.length}catch(L){Z1.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),Y.lastIndex=Q+j.length}}return J}function f9($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function TQ($){let Z=$,J=/@memo\s*\(/g,Y,X=[];while((Y=J.exec(Z))!==null){let Q=Y.index,G=Q+Y[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let q=Z.slice(G,W-1).trim(),z=W,U=Z.slice(z),j=U.indexOf("@endmemo");if(j===-1)continue;let H=U.slice(0,j),B=z+j+8,_=H.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=_?_[0].length:0,V=H.slice(O),F=H.match(/(\s*)$/),L=F?F[0].length:0,w=V.slice(0,V.length-L),N=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(N){let[A,M,T="",I]=N,E=`<${M}${T} data-stx-memo="${q}"${I}>`;R=H.slice(0,O)+E+w.slice(A.length)+H.slice(O+w.length)}else R=`${H.slice(0,O)}<div data-stx-memo="${q}">${w}</div>${H.slice(O+w.length)}`;X.push({start:Q,end:B,replacement:R}),J.lastIndex=B}for(let Q=X.length-1;Q>=0;Q--){let G=X[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function g9($){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 IQ($){let J=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"),Y="",X=0,Q;while((Q=J.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,q=!1,z=-1;while(K<$.length){let _=$[K];if(W){if(_==="'")W=!1}else if(q){if(_==='"')q=!1}else if(_==="'")W=!0;else if(_==='"')q=!0;else if(_===">"){z=K;break}K++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let j=$.slice(z+1),H=j.indexOf("</"),B=H>=0?j.slice(0,H):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))Y+=$.slice(X,z)+" x-cloak>",X=z+1}return Y+=$.slice(X),Y}function DQ($){let Z=/<[a-z][\w-]*/gi,J="",Y=0,X;while((X=Z.exec($))!==null){let Q=X.index,G=X[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,_=$.toLowerCase().indexOf(B,Q);if(_!==-1)Z.lastIndex=_+B.length;continue}let K=Q+X[0].length,W=!1,q=!1,z=-1;while(K<$.length){let B=$[K];if(W){if(B==="'")W=!1}else if(q){if(B==='"')q=!1}else if(B==="'")W=!0;else if(B==='"')q=!0;else if(B===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(Q+X[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!K_.test(U))continue;let j=$[z-1]==="/",H=j?z-1:z;J+=`${$.slice(Y,H)} x-cloak${j?" ":""}`,Y=H}return J+=$.slice(Y),J}var K_;var h9=b(()=>{w1();M0();K_=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function u9($,Z,J,Y){let X=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1},Q=X.allowPatterns??[],G=[];for(let{pattern:K,message:W,suggestion:q}of W_){if(Q.some((U)=>/\w/.test(U)&&W.includes(U)))continue;K.lastIndex=0;let z=$.match(K);if(z&&z.length>0){let U=$.split(`
|
|
10701
10701
|
`),j=[];U.forEach((O,V)=>{if(K.lastIndex=0,K.test(O))j.push(V+1)});let H=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",B=j.slice(0,3).map((O)=>` ${O} | ${(U[O-1]??"").trim().slice(0,100)}`).join(`
|
|
10702
10702
|
`),_=B?`
|
|
10703
10703
|
${B}`:"";G.push(` \u2717 ${W}${H}
|
|
10704
10704
|
\u2192 ${q}${_}`)}}if(G.length>0&&X.enabled){let K=(z)=>{let U=`${process.cwd()}/`;return z.startsWith(U)?z.slice(U.length):z},q=`[STX] DOM API violation in ${Y&&Y!==Z?`${K(Y)} (composed into ${K(Z)})`:K(Z)}:
|
|
10705
10705
|
${G.join(`
|
|
10706
10706
|
`)}
|
|
10707
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(q);else console.warn(q)}}var
|
|
10708
|
-
`)}function S7($,Z,J){let Y=$.get(Z);return Y!==void 0&&Y.signature===J?Y.value:void 0}function j1($,Z,J,Y){return $.set(Z,{signature:J,value:Y}),Y}var d9=()=>{};var
|
|
10707
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(q);else console.warn(q)}}var W_;var m9=b(()=>{W_=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{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"}]});import q_ from"fs";function b7($){return[...$].sort().map((Z)=>{try{let J=q_.statSync(Z);return`${Z}:${J.size}:${J.mtimeMs}`}catch{return`${Z}:missing`}}).join(`
|
|
10708
|
+
`)}function S7($,Z,J){let Y=$.get(Z);return Y!==void 0&&Y.signature===J?Y.value:void 0}function j1($,Z,J,Y){return $.set(Z,{signature:J,value:Y}),Y}var d9=()=>{};var kQ={};t(kQ,{getStoreScript:()=>U_,clearStoreCache:()=>j_});import y7 from"path";function z_($,Z){for(let J of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])Z.add(J[1]);for(let J of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let Y of(J[1]??"").split(",")){let Q=((Y.includes(":")?Y.split(":").pop():Y)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Q))Z.add(Q)}for(let J of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let Y of(J[1]??"").split(",")){let X=Y.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(X))Z.add(X)}}async function U_($){let Z;if($)Z=y7.resolve($);else{let B=await e0();Z=y7.resolve(B.root||process.cwd(),B.storesDir||"stores")}let J=new Bun.Glob("*.ts"),Y=[];try{for await(let B of J.scan({cwd:Z,absolute:!0})){let _=y7.basename(B,".ts");if(["index","types"].includes(_))continue;if(B.includes(".d.ts"))continue;Y.push(B)}}catch{return j1(u5,Z,"",""),null}let X=b7(Y),Q=S7(u5,Z,X);if(Q!==void 0)return Q||null;if(Y.length===0)return j1(u5,Z,X,""),null;let G=[];for(let B of Y){let _=await Bun.file(B).text();G.push({file:B,hasUseStore:/useStore\s*\(/.test(_)})}G.sort((B,_)=>{if(B.hasUseStore===_.hasUseStore)return 0;return B.hasUseStore?1:-1});let K=G.map((B)=>B.file),W=[],q=new Set,z=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()});for(let B of K)try{let _=await Bun.file(B).text(),O=y7.basename(B,".ts");z_(_,q),_=p0(_),_=m$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=z.transformSync(_),W.push(`// Store: ${O}
|
|
10709
10709
|
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${B}:`,_)}if(W.length===0)return j1(u5,Z,X,""),null;let U=W.join(`
|
|
10710
10710
|
|
|
10711
10711
|
`),H=`;(function(){
|
|
@@ -10713,8 +10713,8 @@ var __stx = window.stx || {};
|
|
|
10713
10713
|
${F1.filter((B)=>!q.has(B)&&new RegExp(`\\b${B}\\b`).test(U)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
|
|
10714
10714
|
`)}
|
|
10715
10715
|
${U}
|
|
10716
|
-
})();`;return j1(u5,Z,X,H),H}function
|
|
10717
|
-
${G.transformSync(_).trim()}`);for(let V of O)q.add(V)}catch(V){console.warn(`[stx] framework composable ${P7.basename(B)} could not be bundled:`,V)}}let U=J.filter((B)=>!q.has(B)&&!
|
|
10716
|
+
})();`;return j1(u5,Z,X,H),H}function j_(){u5.clear()}var u5;var EQ=b(()=>{V1();D1();K1();d9();u5=new Map});var p9,dT;var bQ=b(()=>{p9=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],dT=new Set(p9)});var PQ={};t(PQ,{selectComposableFiles:()=>SQ,referencedFrameworkComposables:()=>yQ,getFrameworkComposableScript:()=>O_,clearFrameworkComposableCache:()=>H_,__setRuntimeOwnedForTest:()=>F_});import P7 from"path";function H_(){P$.clear()}function SQ($){let Z=new Map;for(let J of $){let Y=P7.basename(J);if(Y.endsWith(".d.ts"))continue;let X=Y.replace(/\.[jt]s$/,"");if(X==="index")continue;if(X===Y)continue;let Q=Z.get(X);if(Q&&!Q.endsWith(".js"))continue;Z.set(X,J)}return[...Z.values()].sort()}function __($,Z){let J=Z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${J}\\b`).test($)}function yQ($){if(!$)return[];let Z=$.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),J=[];for(let Y of B_){if(l9.has(Y))continue;let X=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${X}\\s*\\(`).test(Z))J.push(Y)}return J.sort()}async function O_($,Z){let J=yQ($);if(J.length===0)return null;let Y=Z??P7.join(import.meta.dir,"composables"),X=`${Y}\x00${J.join(",")}`,Q=P$.get(X);if(Q!==void 0)return Q||null;let G=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),K=new Set(J),W=[],q=new Set,z=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let _ of B.scan({cwd:Y,absolute:!0}))z.push(_)}catch{return P$.set(X,""),null}z=SQ(z);for(let B of z){let _;try{_=await Bun.file(B).text()}catch{continue}let O=[];try{O=G.scan(_).exports.filter((V)=>V!=="default")}catch{continue}if(!O.some((V)=>K.has(V)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${P7.basename(B).replace(/\.[jt]s$/,"")}
|
|
10717
|
+
${G.transformSync(_).trim()}`);for(let V of O)q.add(V)}catch(V){console.warn(`[stx] framework composable ${P7.basename(B)} could not be bundled:`,V)}}let U=J.filter((B)=>!q.has(B)&&!__($,B));if(U.length>0)console.warn(`[stx] could not bundle ${U.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return P$.set(X,""),null;let j=[...q].map((B)=>` try { if (!(${JSON.stringify(B)} in __s)) { __s[${JSON.stringify(B)}] = ${B}; if (!(${JSON.stringify(B)} in window)) window[${JSON.stringify(B)}] = ${B}; } } catch (e) {}`).join(`
|
|
10718
10718
|
`),H=`<script data-stx-framework-composables>
|
|
10719
10719
|
;(function(){
|
|
10720
10720
|
var __s = window.stx = window.stx || {};
|
|
@@ -10723,7 +10723,7 @@ ${W.join(`
|
|
|
10723
10723
|
`)}
|
|
10724
10724
|
${j}
|
|
10725
10725
|
})();
|
|
10726
|
-
</script>`;return P$.set(X,H),H}function
|
|
10726
|
+
</script>`;return P$.set(X,H),H}function F_($){l9.clear();for(let Z of $)l9.add(Z)}var P$,l9,B_;var CQ=b(()=>{D1();bQ();P$=new Map,l9=new Set,B_=new Set(p9)});var xQ={};t(xQ,{getComposableScript:()=>N_,clearComposableCache:()=>R_});import C$ from"path";function vQ($){let Z=C$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function L_($){if($)return C$.resolve($);let Z=`<default>:${process.cwd()}`,J=c9.get(Z);if(J!==void 0)return J;let Y=await w_();if(Y!==null)c9.set(Z,Y);return Y}async function w_(){let $=await e0(),Z=$.root||process.cwd(),J=$.composablesDir;if(J)return C$.resolve(Z,J);for(let Y of V_){let X=C$.resolve(Z,Y);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:X,absolute:!0}))if(!vQ(G))return X}catch{}}return null}async function N_($){let Z=await L_($);if(!Z)return null;let J=[];try{let B=new Bun.Glob("**/*.ts");for await(let _ of B.scan({cwd:Z,absolute:!0})){if(vQ(_))continue;J.push(_)}}catch{return j1(m5,Z,"",""),null}let Y=b7(J),X=S7(m5,Z,Y);if(X!==void 0)return X||null;if(J.length===0)return j1(m5,Z,Y,""),null;J.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),G=[],K=new Set,W=new Set;for(let B of J)try{let _=await Bun.file(B).text(),O=C$.basename(B,".ts");for(let V of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(V[1])W.add(V[1]);try{for(let V of Q.scan(_).exports)if(V!=="default")K.add(V)}catch{}_=p0(_),_=m$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=Q.transformSync(_),G.push(`// Composable: ${O}
|
|
10727
10727
|
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${B}:`,_)}if(G.length===0||K.size===0)return j1(m5,Z,Y,""),null;let q=[...K].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
|
|
10728
10728
|
`),z=JSON.stringify([...K]),U=G.join(`
|
|
10729
10729
|
|
|
@@ -10748,7 +10748,7 @@ ${q}
|
|
|
10748
10748
|
}
|
|
10749
10749
|
window[__n] = __c[__n];
|
|
10750
10750
|
}
|
|
10751
|
-
})();`;return j1(m5,Z,Y,H),H}function
|
|
10751
|
+
})();`;return j1(m5,Z,Y,H),H}function R_(){m5.clear(),c9.clear()}var m5,c9,V_;var fQ=b(()=>{V1();D1();d9();K1();m5=new Map,c9=new Map,V_=["composables","functions"]});var hQ={};t(hQ,{processDeferDirectives:()=>D_});function A_(){return`stx-defer-${++gQ}`}function M_($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function T_($,Z,J){let{trigger:Y,value:X}=M_(Z),Q=J,G,K,W,q=J.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(q)G=q[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=J.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=J.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)W=U[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:Y,triggerValue:X,content:Q,placeholder:G,loading:K,error:W}}function I_($,Z){let{trigger:J,triggerValue:Y}=Z,X;switch(J){case"visible":X=`
|
|
10752
10752
|
const observer = new IntersectionObserver((entries) => {
|
|
10753
10753
|
if (entries[0].isIntersecting) {
|
|
10754
10754
|
observer.disconnect();
|
|
@@ -10821,7 +10821,7 @@ else {
|
|
|
10821
10821
|
${X}
|
|
10822
10822
|
})();
|
|
10823
10823
|
</script>
|
|
10824
|
-
`}function
|
|
10824
|
+
`}function D_($,Z,J){gQ=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(Y,(X,Q,G)=>{let K=A_(),W=T_(X,Q,G),q=W.placeholder?`<div data-defer-placeholder>${W.placeholder}</div>`:"",z=W.loading?`<div data-defer-loading style="display: none;">${W.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',U=W.error?`<div data-defer-error style="display: none;">${W.error}</div>`:"",j=`<div data-defer-content style="display: none;">${W.content}</div>`,H=I_(K,W);return`
|
|
10825
10825
|
<div id="${K}" class="stx-defer" data-defer-trigger="${W.trigger}">
|
|
10826
10826
|
${q}
|
|
10827
10827
|
${z}
|
|
@@ -10829,7 +10829,7 @@ else {
|
|
|
10829
10829
|
${U}
|
|
10830
10830
|
</div>
|
|
10831
10831
|
${H}
|
|
10832
|
-
`})}var
|
|
10832
|
+
`})}var gQ=0;var mQ={};t(mQ,{processTeleportDirectives:()=>S_,ensureTeleportTargets:()=>y_});function k_(){return`stx-teleport-${++uQ}`}function E_($){let Z=$.split(",").map((X)=>X.trim()),J=Z[0].replace(/['"]/g,""),Y;for(let X=1;X<Z.length;X++){let Q=Z[X].match(/disabled:\s*(.+)/);if(Q)Y=Q[1].trim()}return{target:J,disabled:Y}}function b_($,Z){return`
|
|
10833
10833
|
<script>
|
|
10834
10834
|
(function() {
|
|
10835
10835
|
const source = document.getElementById('${$}');
|
|
@@ -10875,12 +10875,12 @@ else {
|
|
|
10875
10875
|
});
|
|
10876
10876
|
})();
|
|
10877
10877
|
</script>
|
|
10878
|
-
`}function
|
|
10878
|
+
`}function S_($,Z,J){uQ=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(Y,(X,Q,G)=>{let K=k_(),{target:W,disabled:q}=E_(Q),z=G.trim();if(q)try{let j=!1;if(q==="true")j=!0;else if(q==="false")j=!1;else if(q in Z)j=Boolean(Z[q]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${z}</div>`}catch{}let U=b_(K,W);return`
|
|
10879
10879
|
<div id="${K}" class="stx-teleport-source" style="display: none;">
|
|
10880
10880
|
<template>${z}</template>
|
|
10881
10881
|
</div>
|
|
10882
10882
|
${U}
|
|
10883
|
-
`})}function
|
|
10883
|
+
`})}function y_(){return`
|
|
10884
10884
|
<script>
|
|
10885
10885
|
(function() {
|
|
10886
10886
|
// Common teleport targets
|
|
@@ -10897,7 +10897,7 @@ else {
|
|
|
10897
10897
|
});
|
|
10898
10898
|
})();
|
|
10899
10899
|
</script>
|
|
10900
|
-
`}var
|
|
10900
|
+
`}var uQ=0;var cQ={};t(cQ,{processTransitionDirectives:()=>x_,processTransitionAttributes:()=>u_,performLeave:()=>v_,performEnter:()=>C_,generateTransitionRuntime:()=>h_,generateTransitionCSS:()=>g_});function dQ($,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 P_($){let Z=getComputedStyle($),J=Z.transitionDuration||"0s",Y=Z.animationDuration||"0s",X=(Q)=>{let G=Q.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(X(J),X(Y))}function pQ($,Z){return new Promise((J)=>{let Y=Z??P_($);if(Y===0){J();return}let X=!1,Q=()=>{if(X)return;X=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),J()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,Y+50)})}function lQ($){$.offsetHeight}async function C_($,Z={}){let J=Z.name||"stx",Y=dQ(J,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(Y.enterFrom),$.classList.add(Y.enterActive),lQ($),$.classList.remove(Y.enterFrom),$.classList.add(Y.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await pQ($,X);$.classList.remove(Y.enterActive),$.classList.remove(Y.enterTo),Z.onAfterEnter?.($)}async function v_($,Z={}){let J=Z.name||"stx",Y=dQ(J,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(Y.leaveFrom),$.classList.add(Y.leaveActive),lQ($),$.classList.remove(Y.leaveFrom),$.classList.add(Y.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await pQ($,X);$.classList.remove(Y.leaveActive),$.classList.remove(Y.leaveTo),Z.onAfterLeave?.($)}function x_($,Z={},J){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(Y,(X,Q,G)=>{let K=f_(Q),W=K.name||"stx",q=K.duration||300,z=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
10901
10901
|
<div
|
|
10902
10902
|
class="stx-transition-wrapper"
|
|
10903
10903
|
data-transition="${W}"
|
|
@@ -10939,7 +10939,7 @@ else {
|
|
|
10939
10939
|
});
|
|
10940
10940
|
})();
|
|
10941
10941
|
</script>
|
|
10942
|
-
`})}function
|
|
10942
|
+
`})}function f_($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let X=Y[1],Q=Y[2]||Y[3]||Y[4]||Y[5];switch(X){case"name":Z.name=Q;break;case"duration":Z.duration=parseInt(Q,10);break;case"mode":Z.mode=Q;break;case"easing":Z.easing=Q;break}}return Z}function g_(){return`
|
|
10943
10943
|
/* STX Transition Presets */
|
|
10944
10944
|
|
|
10945
10945
|
/* Fade */
|
|
@@ -11126,7 +11126,7 @@ else {
|
|
|
11126
11126
|
opacity: 1;
|
|
11127
11127
|
max-height: 1000px;
|
|
11128
11128
|
}
|
|
11129
|
-
`}function
|
|
11129
|
+
`}function h_(){return`
|
|
11130
11130
|
// STX Transition Runtime
|
|
11131
11131
|
(function() {
|
|
11132
11132
|
if (typeof window === 'undefined') return;
|
|
@@ -11215,7 +11215,7 @@ else {
|
|
|
11215
11215
|
|
|
11216
11216
|
console.log('[stx] Transition runtime initialized');
|
|
11217
11217
|
})();
|
|
11218
|
-
`}function
|
|
11218
|
+
`}function u_($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(J,Y,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var nQ={};t(nQ,{withErrorBoundary:()=>iQ,processErrorBoundaryDirectives:()=>p_,generateErrorBoundaryRuntime:()=>o_,generateErrorBoundaryCSS:()=>n_,createErrorBoundary:()=>i_});function d_(){return`eb-${++m_}-${Date.now().toString(36)}`}function p_($,Z={},J){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(Y,(X,Q,G,K)=>{let W=d_(),q=l_(Q||"");return c_(W,G.trim(),K.trim(),q)})}function l_($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=J.exec($))!==null){let X=Y[1],Q=Y[2]||Y[3]||Y[4];switch(X){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function c_($,Z,J,Y){let X=Y.logErrors!==!1;return`
|
|
11219
11219
|
<div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
|
|
11220
11220
|
<div class="stx-error-boundary-content" data-boundary-content="${$}">
|
|
11221
11221
|
${Z}
|
|
@@ -11335,7 +11335,7 @@ else {
|
|
|
11335
11335
|
};
|
|
11336
11336
|
})();
|
|
11337
11337
|
</script>
|
|
11338
|
-
`}async function
|
|
11338
|
+
`}async function iQ($,Z,J){try{return await $()}catch(Y){if(J)J(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return Z}}function i_($,Z={}){let J=Z.onError?(Y)=>Z.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>iQ(Y,$,J)}function n_(){return`
|
|
11339
11339
|
/* STX Error Boundary Styles */
|
|
11340
11340
|
.stx-error-boundary {
|
|
11341
11341
|
position: relative;
|
|
@@ -11379,7 +11379,7 @@ else {
|
|
|
11379
11379
|
color: #fecaca;
|
|
11380
11380
|
}
|
|
11381
11381
|
}
|
|
11382
|
-
`}function
|
|
11382
|
+
`}function o_(){return`
|
|
11383
11383
|
// STX Error Boundary Runtime
|
|
11384
11384
|
(function() {
|
|
11385
11385
|
if (typeof window === 'undefined') return;
|
|
@@ -11444,7 +11444,7 @@ else {
|
|
|
11444
11444
|
|
|
11445
11445
|
console.log('[stx] Error boundary runtime initialized');
|
|
11446
11446
|
})();
|
|
11447
|
-
`}var
|
|
11447
|
+
`}var m_=0;var oQ={};t(oQ,{renderSSRSuspense:()=>ZO,processSuspenseDirectives:()=>a_,generateSuspenseRuntime:()=>YO,generateSuspenseCSS:()=>JO,createSSRSuspense:()=>$O});function r_(){return`suspense-${++s_}-${Date.now().toString(36)}`}function a_($,Z={},J){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(Y,(X,Q,G,K)=>{let W=r_(),q=t_(Q||"");return e_(W,G.trim(),K.trim(),q)})}function t_($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let X=Y[1],Q=Y[2]||Y[3],G=Y[4];switch(X){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function e_($,Z,J,Y){let X=Y.timeout||30000,Q=Y.id||$;return`
|
|
11448
11448
|
<div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${Q}" data-status="pending">
|
|
11449
11449
|
<div class="stx-suspense-fallback" data-suspense-fallback="${$}">
|
|
11450
11450
|
${J}
|
|
@@ -11634,7 +11634,7 @@ else {
|
|
|
11634
11634
|
}, 0);
|
|
11635
11635
|
})();
|
|
11636
11636
|
</script>
|
|
11637
|
-
`}function
|
|
11637
|
+
`}function $O($,Z,J){return{id:$,fallback:J,content:Z}}async function ZO($){let Z=$.map((Y)=>`
|
|
11638
11638
|
<div id="stx-ssr-suspense-${Y.id}" class="stx-ssr-suspense">
|
|
11639
11639
|
${Y.fallback}
|
|
11640
11640
|
</div>
|
|
@@ -11659,7 +11659,7 @@ else {
|
|
|
11659
11659
|
}
|
|
11660
11660
|
})();
|
|
11661
11661
|
</script>
|
|
11662
|
-
`}}return{initial:Z,streaming:J()}}function
|
|
11662
|
+
`}}return{initial:Z,streaming:J()}}function JO(){return`
|
|
11663
11663
|
/* STX Suspense Styles */
|
|
11664
11664
|
.stx-suspense {
|
|
11665
11665
|
position: relative;
|
|
@@ -11715,7 +11715,7 @@ else {
|
|
|
11715
11715
|
background-size: 200% 100%;
|
|
11716
11716
|
}
|
|
11717
11717
|
}
|
|
11718
|
-
`}function
|
|
11718
|
+
`}function YO(){return`
|
|
11719
11719
|
// STX Suspense Runtime
|
|
11720
11720
|
(function() {
|
|
11721
11721
|
if (typeof window === 'undefined') return;
|
|
@@ -11782,7 +11782,7 @@ else {
|
|
|
11782
11782
|
|
|
11783
11783
|
console.log('[stx] Suspense runtime initialized');
|
|
11784
11784
|
})();
|
|
11785
|
-
`}var
|
|
11785
|
+
`}var s_=0;var tQ={};t(tQ,{processAsyncDirectives:()=>QO,isAsyncComponent:()=>KO,generateAsyncComponentRuntime:()=>qO,generateAsyncComponentCSS:()=>WO,defineAsyncComponent:()=>GO});function sQ(){return`async-${++XO}-${Date.now().toString(36)}`}function QO($,Z={},J){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(Y,(G,K,W,q)=>{let z=sQ(),U=rQ(K);return aQ(z,U,W.trim(),q.trim())}),Q=Q.replace(X,(G,K,W)=>{let q=sQ(),z=rQ(K);return aQ(q,z,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function rQ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let X=Y[1],Q=Y[2]||Y[3],G=Y[4],K=Y[5];switch(X){case"component":Z.component=Q||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=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function aQ($,Z,J,Y){let{component:X,timeout:Q,delay:G,suspensible:K,retries:W}=Z;return`
|
|
11786
11786
|
<div class="stx-async-component" data-async-id="${$}" data-component="${X}" data-status="pending">
|
|
11787
11787
|
<div class="stx-async-loading" data-async-loading="${$}">
|
|
11788
11788
|
${J}
|
|
@@ -12009,7 +12009,7 @@ catch (error) {
|
|
|
12009
12009
|
loadComponent();
|
|
12010
12010
|
})();
|
|
12011
12011
|
</script>
|
|
12012
|
-
`}function
|
|
12012
|
+
`}function GO($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function KO($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function WO(){return`
|
|
12013
12013
|
/* STX Async Component Styles */
|
|
12014
12014
|
.stx-async-component {
|
|
12015
12015
|
position: relative;
|
|
@@ -12083,7 +12083,7 @@ catch (error) {
|
|
|
12083
12083
|
background-size: 200% 100%;
|
|
12084
12084
|
}
|
|
12085
12085
|
}
|
|
12086
|
-
`}function
|
|
12086
|
+
`}function qO(){return`
|
|
12087
12087
|
// STX Async Component Runtime
|
|
12088
12088
|
(function() {
|
|
12089
12089
|
if (typeof window === 'undefined') return;
|
|
@@ -12137,7 +12137,7 @@ catch (error) {
|
|
|
12137
12137
|
|
|
12138
12138
|
console.log('[stx] Async component runtime initialized');
|
|
12139
12139
|
})();
|
|
12140
|
-
`}var
|
|
12140
|
+
`}var XO=0;var $G={};t($G,{shouldCacheComponent:()=>_O,processKeepAliveDirectives:()=>UO,onDeactivated:()=>LO,onActivated:()=>VO,generateKeepAliveRuntime:()=>FO,generateKeepAliveCSS:()=>OO,createKeepAliveCache:()=>HO});function eQ(){return`keep-alive-${++zO}-${Date.now().toString(36)}`}function UO($,Z={},J){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(Y,(X,Q,G)=>{let K=eQ(),W=jO(Q||"");return BO(K,G.trim(),W)})}function jO($){let Z={max:10},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let X=Y[1],Q=Y[2]||Y[3],G=Y[4];switch(X){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=Q;break;case"exclude":Z.exclude=Q;break;case"id":Z.id=Q;break}}return Z}function BO($,Z,J){let{max:Y,include:X,exclude:Q}=J,G=J.id||$;return`
|
|
12141
12141
|
<div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
|
|
12142
12142
|
<div class="stx-keep-alive-content" data-keep-alive-content="${$}">
|
|
12143
12143
|
${Z}
|
|
@@ -12424,7 +12424,7 @@ else {
|
|
|
12424
12424
|
});
|
|
12425
12425
|
})();
|
|
12426
12426
|
</script>
|
|
12427
|
-
`}function
|
|
12427
|
+
`}function HO($={}){return{id:$.id||eQ(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((J)=>J.trim()):null,exclude:$.exclude?$.exclude.split(",").map((J)=>J.trim()):null}}function _O($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function OO(){return`
|
|
12428
12428
|
/* STX Keep-Alive Styles */
|
|
12429
12429
|
.stx-keep-alive {
|
|
12430
12430
|
position: relative;
|
|
@@ -12449,7 +12449,7 @@ else {
|
|
|
12449
12449
|
.stx-keep-alive-content > [data-activated] {
|
|
12450
12450
|
opacity: 1;
|
|
12451
12451
|
}
|
|
12452
|
-
`}function
|
|
12452
|
+
`}function FO(){return`
|
|
12453
12453
|
// STX Keep-Alive Runtime
|
|
12454
12454
|
(function() {
|
|
12455
12455
|
if (typeof window === 'undefined') return;
|
|
@@ -12485,7 +12485,7 @@ else {
|
|
|
12485
12485
|
|
|
12486
12486
|
console.log('[stx] Keep-alive runtime initialized');
|
|
12487
12487
|
})();
|
|
12488
|
-
`}function
|
|
12488
|
+
`}function VO($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function LO($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var zO=0;var QG={};t(QG,{useVirtualList:()=>JG,processVirtualListDirectives:()=>n9,processVirtualGridDirectives:()=>XG,processInfiniteListDirectives:()=>YG,generateVirtualListCSS:()=>ZG,default:()=>wO,createVirtualList:()=>i9});function i9($,Z){let{itemHeight:J,containerHeight:Y,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=J,direction:W="vertical"}=Z,q=[...$],z=0,U=new Map;function j(){if(G)return H();let R=Math.max(0,Math.floor(z/J)-X),A=Math.ceil(Y/J),M=Math.min(q.length-1,R+A+X*2);return{startIndex:R,endIndex:M}}function H(){let R=0,A=0,M=q.length-1;for(let T=0;T<q.length;T++){let I=U.get(T)||K;if(R+I>z){A=Math.max(0,T-X);break}R+=I}R=0;for(let T=0;T<q.length;T++){let I=U.get(T)||K;if(R+=I,R>z+Y){M=Math.min(q.length-1,T+X);break}}return{startIndex:A,endIndex:M}}function B(){if(G){let R=0;for(let A=0;A<q.length;A++)R+=U.get(A)||K;return R}return q.length*J}function _(R){if(G){let A=0;for(let M=0;M<R;M++)A+=U.get(M)||K;return A}return R*J}function O(){let{startIndex:R,endIndex:A}=j();return{startIndex:R,endIndex:A,scrollTop:z,totalHeight:B(),visibleItems:q.slice(R,A+1),itemHeights:new Map(U)}}function V(R,A="auto"){let M=_(R);F(M,A)}function F(R,A="auto"){z=Math.max(0,Math.min(R,B()-Y))}function L(){j()}function w(R){q=[...R],U.clear(),L()}function N(){q=[],U.clear()}return{scrollToIndex:V,scrollToOffset:F,getState:O,refresh:L,setItems:w,destroy:N}}function n9($,Z={},J){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(Y,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let F=G.trim(),L=Function(`return ${F}`)();z={...z,...L}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(z.containerHeight/z.itemHeight),H=z.overscan||3,B=0,_=Math.min(q.length-1,j+H),O="";for(let F=B;F<=_&&F<q.length;F++){let L=q[F],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof L==="object"?JSON.stringify(L):String(L)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(N,R)=>{if(typeof L==="object"&&L!==null)return String(L[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(F));O+=`
|
|
12489
12489
|
<div class="virtual-item ${z.itemClass||""}"
|
|
12490
12490
|
style="position: absolute; top: ${F*z.itemHeight}px; height: ${z.itemHeight}px; width: 100%;"
|
|
12491
12491
|
data-index="${F}">
|
|
@@ -12562,7 +12562,7 @@ else {
|
|
|
12562
12562
|
};
|
|
12563
12563
|
})();
|
|
12564
12564
|
</script>
|
|
12565
|
-
`})}function
|
|
12565
|
+
`})}function ZG(){return`
|
|
12566
12566
|
.virtual-list-container {
|
|
12567
12567
|
position: relative;
|
|
12568
12568
|
overflow-y: auto;
|
|
@@ -12610,7 +12610,7 @@ else {
|
|
|
12610
12610
|
0% { background-position: 200% 0; }
|
|
12611
12611
|
100% { background-position: -200% 0; }
|
|
12612
12612
|
}
|
|
12613
|
-
`}function
|
|
12613
|
+
`}function JG($,Z){let J=null,Y=()=>{if(!J)J=i9($(),Z);return J};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(X)=>{let Q=X.target;if(J)J.scrollToOffset(Q.scrollTop)}}),itemProps:(X)=>({style:{position:"absolute",top:`${X*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":X}),scrollToIndex:(X)=>{Y().scrollToIndex(X)}}}function YG($,Z={},J){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(Y,(X,Q,G,K,W)=>{let q=Q.trim(),z=Z[q];if(!z||!Array.isArray(z))return`<!-- infiniteList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();U={...U,...B}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,H=n9(`@virtualList(${q}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return H=H.replace("</script>",`
|
|
12614
12614
|
// Infinite scroll detection
|
|
12615
12615
|
container.addEventListener('scroll', function() {
|
|
12616
12616
|
const scrollBottom = container.scrollTop + container.clientHeight;
|
|
@@ -12628,7 +12628,7 @@ else {
|
|
|
12628
12628
|
${W}
|
|
12629
12629
|
</div>
|
|
12630
12630
|
</div>
|
|
12631
|
-
`})}function
|
|
12631
|
+
`})}function XG($,Z={},J){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(Y,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualGrid: items "${W}" not found or not an array -->`;let z={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let L=Function(`return ${G.trim()}`)();z={...z,...L}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(q.length/z.columns),H=j*(z.rowHeight+(z.gap||0)),B=Math.ceil(z.containerHeight/(z.rowHeight+(z.gap||0))),_=z.overscan||2,O=0,V=Math.min(j-1,B+_),F="";for(let L=O;L<=V;L++)for(let w=0;w<z.columns;w++){let N=L*z.columns+w;if(N>=q.length)break;let R=q[N],A=w*(100/z.columns),M=L*(z.rowHeight+(z.gap||0)),T=K.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,E)=>{if(typeof R==="object"&&R!==null)return String(R[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(N));F+=`
|
|
12632
12632
|
<div class="virtual-grid-item"
|
|
12633
12633
|
style="position: absolute; top: ${M}px; left: ${A}%; width: calc(${100/z.columns}% - ${z.gap||0}px); height: ${z.rowHeight}px;"
|
|
12634
12634
|
data-index="${N}">
|
|
@@ -12698,7 +12698,7 @@ else {
|
|
|
12698
12698
|
});
|
|
12699
12699
|
})();
|
|
12700
12700
|
</script>
|
|
12701
|
-
`})}var
|
|
12701
|
+
`})}var wO;var GG=b(()=>{wO={createVirtualList:i9,processVirtualListDirectives:n9,processInfiniteListDirectives:YG,processVirtualGridDirectives:XG,generateVirtualListCSS:ZG,useVirtualList:JG}});function KG(){return`<script data-stx-hydration-runtime>
|
|
12702
12702
|
(function() {
|
|
12703
12703
|
'use strict';
|
|
12704
12704
|
|
|
@@ -12858,7 +12858,7 @@ else {
|
|
|
12858
12858
|
stxIslands.initIslands();
|
|
12859
12859
|
}
|
|
12860
12860
|
})();
|
|
12861
|
-
</script>`}function
|
|
12861
|
+
</script>`}function WG($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let J=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(J)return J[1];return null}function qG($,Z){let J={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,X;while((X=Y.exec($))!==null){let Q=X[1],G=X[2];if(G in Z)J[Q]=Z[G];else J[Q]=G}return J}var wG={};t(wG,{processStaticDirectives:()=>VG,processPartialHydrationDirectives:()=>UG,onHydrated:()=>FG,isHydrated:()=>OG,hydrateIsland:()=>BG,hydrateByStrategy:()=>HG,hydrateAll:()=>_G,generatePartialHydrationCSS:()=>jG,generateIslandManifest:()=>LG,default:()=>kO,createIslandRegistry:()=>zG});function zG(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let J=$.get(Z);if(!J||J.hydrated)return;if(J.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:J.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((J)=>!J.hydrated).map((J)=>this.hydrate(J.id));await Promise.all(Z)}}}function NO($){return`
|
|
12862
12862
|
<script data-hydrate="${$}">
|
|
12863
12863
|
(function() {
|
|
12864
12864
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -12869,7 +12869,7 @@ else {
|
|
|
12869
12869
|
island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
12870
12870
|
})();
|
|
12871
12871
|
</script>
|
|
12872
|
-
`}function
|
|
12872
|
+
`}function RO($,Z){let J=Z.timeout||2000,Y=Z.priority||"low";return`
|
|
12873
12873
|
<script data-hydrate="${$}">
|
|
12874
12874
|
(function() {
|
|
12875
12875
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -12905,7 +12905,7 @@ else {
|
|
|
12905
12905
|
}
|
|
12906
12906
|
})();
|
|
12907
12907
|
</script>
|
|
12908
|
-
`}function
|
|
12908
|
+
`}function AO($,Z){let J=Z.rootMargin||"0px",Y=Z.threshold||0;return`
|
|
12909
12909
|
<script data-hydrate="${$}">
|
|
12910
12910
|
(function() {
|
|
12911
12911
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -12938,7 +12938,7 @@ else {
|
|
|
12938
12938
|
}
|
|
12939
12939
|
})();
|
|
12940
12940
|
</script>
|
|
12941
|
-
`}function
|
|
12941
|
+
`}function MO($,Z){let J=Z.media||"(min-width: 768px)";return`
|
|
12942
12942
|
<script data-hydrate="${$}">
|
|
12943
12943
|
(function() {
|
|
12944
12944
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -12967,7 +12967,7 @@ else {
|
|
|
12967
12967
|
}
|
|
12968
12968
|
})();
|
|
12969
12969
|
</script>
|
|
12970
|
-
`}function
|
|
12970
|
+
`}function TO($){return`
|
|
12971
12971
|
<script data-hydrate="${$}">
|
|
12972
12972
|
(function() {
|
|
12973
12973
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -12989,7 +12989,7 @@ else {
|
|
|
12989
12989
|
events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
|
|
12990
12990
|
})();
|
|
12991
12991
|
</script>
|
|
12992
|
-
`}function
|
|
12992
|
+
`}function IO($,Z){let J=Z.event||"stx:activate";return`
|
|
12993
12993
|
<script data-hydrate="${$}">
|
|
12994
12994
|
(function() {
|
|
12995
12995
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -13010,9 +13010,9 @@ else {
|
|
|
13010
13010
|
});
|
|
13011
13011
|
})();
|
|
13012
13012
|
</script>
|
|
13013
|
-
`}function
|
|
13014
|
-
`+
|
|
13015
|
-
<script type="application/json" data-island-props="${W}">${JSON.stringify(z)}</script>`:"",B="";switch(Z){case"load":B=
|
|
13013
|
+
`}function UG($,Z={},J){let Y=$,X=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(Y=d5(Y,"load",Z),Y=d5(Y,"idle",Z),Y=d5(Y,"visible",Z),Y=d5(Y,"media",Z),Y=DO(Y),Y=d5(Y,"hover",Z),Y=d5(Y,"event",Z),X=Q&&Y!==$,X)Y+=`
|
|
13014
|
+
`+KG();return Y}function d5($,Z,J){let Y=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(Y,(X,Q,G)=>{let K={strategy:Z};if(Q)try{let _=Q.split(",").map((O)=>O.trim());for(let O of _){let[V,F]=O.split(":").map((L)=>L.trim());if(V&&F){let L=F.replace(/^['"]|['"]$/g,"");K[V]=L}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,q=WG(G.trim()),z=qG(G.trim(),J),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(q)U.push(`data-component="${q}"`);let H=Object.keys(z).length>0?`
|
|
13015
|
+
<script type="application/json" data-island-props="${W}">${JSON.stringify(z)}</script>`:"",B="";switch(Z){case"load":B=NO(W);break;case"idle":B=RO(W,K);break;case"visible":B=AO(W,K);break;case"media":B=MO(W,K);break;case"hover":B=TO(W);break;case"event":B=IO(W,K);break}return`
|
|
13016
13016
|
<div data-island="${W}"
|
|
13017
13017
|
data-strategy="${Z}"
|
|
13018
13018
|
${U.join(`
|
|
@@ -13022,7 +13022,7 @@ else {
|
|
|
13022
13022
|
${G.trim()}${H}
|
|
13023
13023
|
</div>
|
|
13024
13024
|
${B}
|
|
13025
|
-
`})}function
|
|
13025
|
+
`})}function DO($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(J,Y)=>{let X=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
|
|
13026
13026
|
<div data-island="${X}"
|
|
13027
13027
|
data-strategy="only"
|
|
13028
13028
|
class="stx-island stx-client-only">
|
|
@@ -13041,7 +13041,7 @@ else {
|
|
|
13041
13041
|
}
|
|
13042
13042
|
})();
|
|
13043
13043
|
</script>
|
|
13044
|
-
`})}function
|
|
13044
|
+
`})}function jG(){return`
|
|
13045
13045
|
/* Island base styles */
|
|
13046
13046
|
.stx-island {
|
|
13047
13047
|
display: contents;
|
|
@@ -13082,11 +13082,11 @@ else {
|
|
|
13082
13082
|
.stx-island.hydrated {
|
|
13083
13083
|
opacity: 1;
|
|
13084
13084
|
}
|
|
13085
|
-
`}function
|
|
13085
|
+
`}function BG($){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 HG($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((J)=>{J.classList.add("hydrated"),J.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function _G(){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 OG($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function FG($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let J=document.querySelector(`[data-island="${$}"]`);if(!J){Z();return}if(J.classList.contains("hydrated")){Z();return}J.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function VG($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,J)=>{return`<div class="stx-static">${J.trim()}</div>`})}function LG($){let Z=$.map((J)=>({id:J.id,component:J.component,strategy:J.options.strategy,props:J.props}));return`
|
|
13086
13086
|
<script type="application/json" id="stx-island-manifest">
|
|
13087
13087
|
${JSON.stringify(Z)}
|
|
13088
13088
|
</script>
|
|
13089
|
-
`}var
|
|
13089
|
+
`}var kO;var NG=b(()=>{kO={processPartialHydrationDirectives:UG,processStaticDirectives:VG,generatePartialHydrationCSS:jG,generateIslandManifest:LG,createIslandRegistry:zG,hydrateIsland:BG,hydrateByStrategy:HG,hydrateAll:_G,isHydrated:OG,onHydrated:FG}});var yG={};t(yG,{watchMultiple:()=>IG,watchEffect:()=>DG,watch:()=>TG,unref:()=>RG,toRefs:()=>AG,throttledComputed:()=>SG,stxWatchMultiple:()=>IG,stxWatchEffect:()=>DG,stxWatch:()=>TG,stxUnref:()=>RG,stxToRefs:()=>AG,stxThrottledComputed:()=>SG,stxShallowRef:()=>MG,stxRef:()=>p5,stxIsRef:()=>m1,stxDebouncedComputed:()=>bG,stxComputed:()=>x$,shallowRef:()=>MG,ref:()=>p5,processWatchDirectives:()=>EG,processComputedDirectives:()=>kG,isRef:()=>m1,default:()=>EO,debouncedComputed:()=>bG,computed:()=>x$});function p5($){let Z=$,J=new Set,Y={get value(){if(B1){let X=v$.get(Y);if(!X)X=new Set,v$.set(Y,X);X.add(B1)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,J.forEach((G)=>G(X));let Q=v$.get(Y);if(Q)Q.forEach((G)=>G())}},subscribe(X){return J.add(X),()=>J.delete(X)},peek(){return Z}};return Y}function m1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function RG($){return m1($)?$.value:$}function AG($){let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=p5($[J]);return Z}function MG($){return p5($)}function x$($){let Z=typeof $==="function",J=Z?$:$.get,Y=Z?void 0:$.set,X=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,W=new Set,q=()=>{if(G=!0,W.size>0){let j=U.value;W.forEach((H)=>H(j))}};function z(){K.clear();let j=B1;B1=q,C7.push(q);try{return J()}finally{C7.pop(),B1=j}}let U={get value(){if(B1){let j=v$.get(U);if(!j)j=new Set,v$.set(U,j);j.add(B1)}if(G){let j=z();if(!X(Q,j))Q=j;G=!1}return Q},set value(j){if(Y)Y(j);else console.warn("Computed property is readonly")},subscribe(j){return W.add(j),()=>W.delete(j)},peek(){if(G)Q=J(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function TG($,Z,J={}){let{immediate:Y=!1,deep:X=!1,flush:Q="pre",once:G=!1}=J,K,W=!0,q=!1,z=()=>{if(m1($))return X?q5($.value):$.value;return $()},U=()=>{if(!W||q)return;let B=z();if(K!==void 0&&Object.is(K,B)&&!X)return;let _=()=>{if(Z(B,K),K=X?q5(B):B,G)H()};if(Q==="sync")_();else if(Q==="post")queueMicrotask(_);else Promise.resolve().then(_)},j=null;if(m1($))j=$.subscribe(()=>U());else j=x$($).subscribe(()=>U());if(Y)K=void 0,U();else K=z();let H=()=>{if(W=!1,j)j(),j=null};return H.pause=()=>{q=!0},H.resume=()=>{q=!1},H}function IG($,Z,J={}){let{immediate:Y=!1,once:X=!1}=J,Q=$.map((U)=>m1(U)?U.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let U=$.map((j)=>m1(j)?j.value:void 0);if(Z(U,Q),Q=[...U],X)z()},q=$.map((U)=>{if(m1(U))return U.subscribe(()=>W());return()=>{}});if(Y)W();let z=()=>{G=!1,q.forEach((U)=>U())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function DG($,Z={}){let{flush:J="pre"}=Z,Y,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(Y)Y();let W=B1;B1=G,C7.push(G);try{Y=$()}finally{C7.pop(),B1=W}};if(J==="sync")G();else if(J==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(X=!1,Y)Y()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function kG($,Z={},J){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(Y,(X,Q,G)=>{try{let W=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=W,`<!-- computed: ${Q} = ${W} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function EG($,Z={},J){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(Y,(X,Q,G)=>{return`
|
|
13090
13090
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
13091
13091
|
(function() {
|
|
13092
13092
|
// Watch implementation for ${Q}
|
|
@@ -13098,9 +13098,9 @@ else {
|
|
|
13098
13098
|
}
|
|
13099
13099
|
})();
|
|
13100
13100
|
</script>
|
|
13101
|
-
`})}function q5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>q5(J));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let J=new Map;return $.forEach((Y,X)=>J.set(q5(X),q5(Y))),J}if($ instanceof Set){let J=new Set;return $.forEach((Y)=>J.add(q5(Y))),J}let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=q5($[J]);return Z}function
|
|
13102
|
-
`)}catch{return""}})}function
|
|
13103
|
-
`)}catch{return""}})}function
|
|
13101
|
+
`})}function q5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>q5(J));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let J=new Map;return $.forEach((Y,X)=>J.set(q5(X),q5(Y))),J}if($ instanceof Set){let J=new Set;return $.forEach((Y)=>J.add(q5(Y))),J}let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=q5($[J]);return Z}function bG($,Z=100){let J=p5($()),Y=null,X=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{J.value=$()},Z)};return x$($).subscribe(()=>X()),{get value(){return J.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}function SG($,Z=100){let J=p5($()),Y=0,X=()=>{let G=Date.now();if(G-Y>=Z)Y=G,J.value=$()};return x$($).subscribe(()=>X()),{get value(){return J.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}var B1=null,C7,v$,EO;var PG=b(()=>{C7=[],v$=new WeakMap;EO={ref:p5,computed:x$,watch:TG,watchMultiple:IG,watchEffect:DG,isRef:m1,unref:RG,toRefs:AG,shallowRef:MG,debouncedComputed:bG,throttledComputed:SG,processComputedDirectives:kG,processWatchDirectives:EG}});function f$($,Z){let J={};for(let Y of $)J[Y]=C1(Z(Y));return new Proxy({},{get:(Y,X)=>J[X]?.(),set:(Y,X,Q)=>{if(J[X])J[X].set(Q);else J[X]=C1(Q);return!0},has:(Y,X)=>(X in J),deleteProperty:(Y,X)=>{return delete J[X],!0},ownKeys:()=>Reflect.ownKeys(J),getOwnPropertyDescriptor:(Y,X)=>(X in J)?{enumerable:!0,configurable:!0,writable:!0,value:J[X]()}:void 0})}function bO($,Z){let J={};for(let Y of Z)J[Y]=$[Y];return J}function o9($,Z){let J=Object.keys($),Y=f$(J,(F)=>Z?.[F]??$[F].getDefaultValue()),X=f$(J,()=>[]),Q=f$(J,()=>!1),G=f$(J,()=>!1),K=f$(J,()=>!1),W=C1(!1);async function q(F){K[F]=!0;let L=await $[F].validate(Y[F],Y);return X[F]=L,K[F]=!1,L.length===0}async function z(){W.set(!0);let F=await Promise.all(J.map(q));return W.set(!1),F.every(Boolean)}function U(){for(let F of J)Y[F]=Z?.[F]??$[F].getDefaultValue(),X[F]=[],Q[F]=!1,G[F]=!1}function j(F){for(let L of J)if(L in F)Y[L]=F[L],G[L]=!0}function H(F,L){Y[F]=L,G[F]=!0}function B(F,L=!0){if(Q[F]=L,L)q(F)}function _(F){return{value:Y[F],errors:X[F],touched:Q[F],dirty:G[F],valid:X[F].length===0,validating:K[F]}}function O(F){return async(L)=>{L?.preventDefault?.();for(let N of J)Q[N]=!0;if(await z())await F(bO(Y,J))}}return{values:Y,errors:X,touched:Q,dirty:G,get isValid(){return J.every((F)=>X[F].length===0)},get isValidating(){return W()||J.some((F)=>K[F])},get isDirty(){return J.some((F)=>G[F])},validate:z,validateField:q,reset:U,setValues:j,setFieldValue:H,setFieldTouched:B,getFieldState:_,handleSubmit:O}}var CG;var vG=b(()=>{B4();CG=o9});var hG={};t(hG,{v:()=>SO,useForm:()=>o9,processHasErrorsDirective:()=>gG,processFormValidationDirectives:()=>yO,processErrorsDirective:()=>fG,processErrorDirective:()=>xG,defineForm:()=>CG,Validator:()=>l5});class l5{rules=[];defaultValue="";addRule($){let Z=new l5;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 J=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=$||J}})}max($,Z){let J=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=$||J}})}length($,Z,J){let Y=J||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:Y,validate:(X)=>{if(!X)return!0;let Q=String(X).length;return Q>=$&&Q<=Z||Y}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(J)=>{if(!J)return!0;return $.test(String(J))||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:(J)=>{if(!J&&J!==0)return!0;return!Number.isNaN(Number(J))||$}});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 J=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=$||J}})}maxValue($,Z){let J=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=$||J}})}between($,Z,J){let Y=J||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;let Q=Number(X);return Q>=$&&Q<=Z||Y}})}matches($,Z){let J=Z||`Must match ${$}`;return this.addRule({name:"matches",message:J,validate:(Y,X)=>{if(!X)return!0;return Y===X[$]||J}})}oneOf($,Z){let J=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:J,validate:(Y)=>{if(!Y)return!0;return $.includes(Y)||J}})}notOneOf($,Z){let J=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:J,validate:(Y)=>{if(!Y)return!0;return!$.includes(Y)||J}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let J=new Date(String(Z));return!Number.isNaN(J.getTime())||$}})}before($,Z){let J=new Date($),Y=Z||`Must be before ${J.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(X)=>{if(!X)return!0;return new Date(String(X))<J||Y}})}after($,Z){let J=new Date($),Y=Z||`Must be after ${J.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(X)=>{if(!X)return!0;return new Date(String(X))>J||Y}})}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 J=new l5;J.rules=[...this.rules],J.defaultValue=this.defaultValue;for(let Y of Z.getRules())J.rules.push({...Y,validate:(X,Q)=>{if(!$(X,Q||{}))return!0;return Y.validate(X,Q)}});return J}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new l5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let J=[];for(let Y of this.rules){let X=await Y.validate($,Z);if(X!==!0)J.push(X)}return J}validateSync($,Z){let J=[];for(let Y of this.rules){if(Y.async)continue;let X=Y.validate($,Z);if(X!==!0)J.push(X)}return J}}function xG($,Z,J){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(Y,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
|
|
13102
|
+
`)}catch{return""}})}function fG($,Z,J){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(Y,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((z)=>G.replace(/\{\{\s*message\s*\}\}/g,z)).join(`
|
|
13103
|
+
`)}catch{return""}})}function gG($,Z,J){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(Y,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return G}catch{return""}})}function yO($,Z,J){let Y=$;return Y=xG(Y,Z,J),Y=fG(Y,Z,J),Y=gG(Y,Z,J),Y}var SO;var uG=b(()=>{vG();SO=new l5});var pG={};t(pG,{processXElementDirectives:()=>PO,hasXElementDirectives:()=>dG,generateXElementRuntime:()=>mG});function mG(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
|
|
13104
13104
|
(function() {
|
|
13105
13105
|
'use strict';
|
|
13106
13106
|
|
|
@@ -13384,9 +13384,9 @@ else {
|
|
|
13384
13384
|
// Expose for manual initialization
|
|
13385
13385
|
window.XElement = XElement;
|
|
13386
13386
|
})();
|
|
13387
|
-
</script>`}function
|
|
13387
|
+
</script>`}function dG($){return/\bx-data(?:\s|=)/.test($)}function PO($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,J=$.match(Z)||[],Y=J.length>0?$.replace(Z,""):$;if(!dG(Y))return Y;let X=J[0]?.trim()||mG(),Q=Y.lastIndexOf("</body>");if(Q!==-1)return Y.slice(0,Q)+X+`
|
|
13388
13388
|
`+Y.slice(Q);return Y+`
|
|
13389
|
-
`+X}var
|
|
13389
|
+
`+X}var lG={};t(lG,{rewriteImagesWithSiblings:()=>xO});import A1 from"path";async function xO($,Z){let J=Z.formats??vO;if(!Z.publicDir)return $;let Y=hO($),X=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let U=K[0],j=U.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(uO(K.index,Y))continue;G.push({idx:K.index,length:U.length,src:j[1],raw:U})}if(G.length===0)return $;let W=await Promise.all(G.map(async(U)=>{let j=await fO(U.src,Z.publicDir,J);return{match:U,sources:j}}));for(let{match:U,sources:j}of W){if(j.length===0)continue;let B=`<picture>${j.map((_)=>`<source type="${_.mime}" srcset="${mO(_.url)}">`).join("")}${U.raw}</picture>`;X.push({start:U.idx,end:U.idx+U.length,replacement:B})}if(X.length===0)return $;let q="",z=0;for(let U of X)q+=$.slice(z,U.start),q+=U.replacement,z=U.end;return q+=$.slice(z),q}async function fO($,Z,J){if(!gO($))return[];let Y=A1.extname($).toLowerCase();if(!CO.has(Y))return[];if(!$.startsWith("/"))return[];let X=A1.join(Z,$.slice(1)),Q=A1.dirname(X),G=A1.basename(X,Y),K=A1.resolve(Q),W=A1.resolve(Z);if(!K.startsWith(W))return[];let q=A1.posix.dirname($),z=J.map(async(j)=>{let H=A1.join(Q,`${G}${j.ext}`);if(!await Bun.file(H).exists())return null;return{url:A1.posix.join(q,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(z)).filter((j)=>j!==null)}function gO($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function hO($){let Z=[],J=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,Y;while((Y=J.exec($))!==null)Z.push([Y.index,Y.index+Y[0].length]);return Z}function uO($,Z){for(let[J,Y]of Z)if($>=J&&$<Y)return!0;return!1}function mO($){return $.replace(/&/g,"&").replace(/"/g,""")}var CO,vO;var cG=b(()=>{CO=new Set([".jpg",".jpeg",".png",".gif"]),vO=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var iG=()=>{};function s9($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var nG=b(()=>{iG()});var oG={};t(oG,{injectPwaTags:()=>dO,generateThemeColorMeta:()=>cO,generateSwRegistrationScript:()=>pO,generatePwaTags:()=>v7,generateManifestLink:()=>lO});function v7($){let Z=$.pwa;if(!Z?.enabled)return"";let J=Z.manifest,Y=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=s9($),Q=`
|
|
13390
13390
|
<!-- stx PWA Meta Tags -->
|
|
13391
13391
|
<link rel="manifest" href="/manifest.json">
|
|
13392
13392
|
<meta name="theme-color" content="${r9(J?.themeColor||"#000000")}">
|
|
@@ -13430,9 +13430,9 @@ if ('serviceWorker' in navigator) {
|
|
|
13430
13430
|
});
|
|
13431
13431
|
}
|
|
13432
13432
|
</script>
|
|
13433
|
-
<!-- End stx PWA -->`,Q}function
|
|
13433
|
+
<!-- End stx PWA -->`,Q}function dO($,Z){let J=Z.pwa;if(!J?.enabled||J.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1){let Q=v7(Z);return $.slice(0,X)+Q+`
|
|
13434
13434
|
`+$.slice(X)}return $+v7(Z)}let Y=v7(Z);return $.replace("</head>",`${Y}
|
|
13435
|
-
</head>`)}function
|
|
13435
|
+
</head>`)}function pO($){if(!$.pwa?.enabled)return"";return`<script>
|
|
13436
13436
|
if ('serviceWorker' in navigator) {
|
|
13437
13437
|
window.addEventListener('load', function() {
|
|
13438
13438
|
navigator.serviceWorker.register('/${s9($)}')
|
|
@@ -13444,53 +13444,53 @@ if ('serviceWorker' in navigator) {
|
|
|
13444
13444
|
});
|
|
13445
13445
|
});
|
|
13446
13446
|
}
|
|
13447
|
-
</script>`}function
|
|
13447
|
+
</script>`}function lO(){return'<link rel="manifest" href="/manifest.json">'}function cO($){return`<meta name="theme-color" content="${r9($)}">`}function r9($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var sG=b(()=>{nG()});import iO from"fs";import y0 from"path";import{deriveLayoutGroup as nO}from"stx-router/layout-metadata";function rG($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function oO($,Z){let J=$.length,Y=Z,X=!0,Q=[],G=(K)=>K+9<=J&&$[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(Y<J){let K=$[Y];if(G(Y))return Y;if(K==="/"&&$[Y+1]==="/"){if(Y=$.indexOf(`
|
|
13448
13448
|
`,Y+2),Y===-1)return-1;Y+=1,X=!0;continue}if(K==="/"&&$[Y+1]==="*"){let W=$.indexOf("*/",Y+2);if(W===-1)return-1;Y=W+2,X=!0;continue}if(K==="/"&&X){let W=Y+1,q=!1;while(W<J){let z=$[W];if(z==="\\"){W+=2;continue}if(z==="[")q=!0;else if(z==="]")q=!1;else if(z==="/"&&!q){W++;break}else if(z===`
|
|
13449
13449
|
`){W=-1;break}W++}if(W===-1){Y++,X=!1;continue}while(W<J&&/[a-z]/.test($[W]))W++;Y=W,X=!1;continue}if(K==="'"||K==='"'){let W=K;Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]===W){Y++;break}if($[Y]===`
|
|
13450
|
-
`)break;Y++}X=!1;continue}if(K==="`"){Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;break}if($[Y]==="$"&&$[Y+1]==="{"){Q.push(!0),Y+=2,X=!0;break}Y++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++,X=!1;break}if($[Y]==="$"&&$[Y+1]==="{"){Q.push(!0),Y+=2,X=!0;break}Y++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;Y++}return-1}function c5($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!Y)return null;let X=Y.index+Y[0].length,Q=$.indexOf("</script>",X);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:Y.index,end:G+1}}function
|
|
13450
|
+
`)break;Y++}X=!1;continue}if(K==="`"){Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;break}if($[Y]==="$"&&$[Y+1]==="{"){Q.push(!0),Y+=2,X=!0;break}Y++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++,X=!1;break}if($[Y]==="$"&&$[Y+1]==="{"){Q.push(!0),Y+=2,X=!0;break}Y++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;Y++}return-1}function c5($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!Y)return null;let X=Y.index+Y[0].length,Q=$.indexOf("</script>",X);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:Y.index,end:G+1}}function aG($){let Z=0;while(Z<$.length){let J=$.indexOf("<",Z);if(J===-1)return-1;if($.startsWith("<!--",J)){let Q=$.indexOf("-->",J+4);Z=Q===-1?$.length:Q+3;continue}let Y=$.slice(J),X=/^<style\b[^>]*>/i.exec(Y);if(X){let Q=$.toLowerCase().indexOf("</style>",J+X[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(Y))return J;Z=J+1}return-1}function sO($){let Z=c5($,"data-stx-runtime");if(!Z)return $;let J=aG($);if(J===-1||J===Z.start)return $;let Y=$.slice(Z.start,Z.end),X=$.slice(0,Z.start)+$.slice(Z.end),Q=aG(X);if(Q===-1)return Y+`
|
|
13451
13451
|
`+X;return X.slice(0,Q)+Y+`
|
|
13452
|
-
`+X.slice(Q)}async function F0($,Z,J,Y,X){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=L1($);let Q=!Z.__stxProcessingDepth;if(Q)YZ(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((Y.debug||!L$()&&!r4())&&J&&J.endsWith(".stx"))c6($,J);try{return await
|
|
13453
|
-
`),...q.htmlAttrs&&{htmlAttrs:
|
|
13454
|
-
<meta name="stx-layout" content="${
|
|
13455
|
-
<meta name="stx-layout-group" content="${
|
|
13456
|
-
`+z+G.slice(U.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:K}=await e("stx/framework-composables",()=>Promise.resolve().then(() => (
|
|
13457
|
-
`+W+G.slice(q.end)}}catch{}if(Q)try{let{getComposableScript:K}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (
|
|
13458
|
-
`+z+G.slice(U.end)}}catch{}if(Q)G=
|
|
13452
|
+
`+X.slice(Q)}async function F0($,Z,J,Y,X){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=L1($);let Q=!Z.__stxProcessingDepth;if(Q)YZ(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((Y.debug||!L$()&&!r4())&&J&&J.endsWith(".stx"))c6($,J);try{return await IZ.timeAsync("template-processing",async()=>{let G=await rO($,Z,J,Y,X);if(Q)G=g9(G);if(Q&&Y.autoShell&&Y.buildMode!=="compile"){let K=Y.app?.head||{},q=(Z.__stx_runtime_head||null)??U3(),z=(Z.__stx_head_raw||"").trim(),U,j=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)U=j[1].trim(),z=z.replace(j[0],"").trim();let H=Z.__sections?.title,B=q.title||U||H,_=!q.title&&(!!U||!!H),O={...K,...B&&{title:B},meta:[...K.meta||[],...q.meta||[]],link:[...K.link||[],...q.link||[]],script:[...K.script||[],...q.script||[]],headRaw:[K.headRaw,z].filter(Boolean).join(`
|
|
13453
|
+
`),...q.htmlAttrs&&{htmlAttrs:_Q(K.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...q.bodyAttrs}}},V=v9(G);if(G=LQ(G,O,{..._&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),V)G=VQ(G,K),G=OQ(G,O.htmlAttrs);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let N=F[1],R=nO(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
|
|
13454
|
+
<meta name="stx-layout" content="${rG(N)}">
|
|
13455
|
+
<meta name="stx-layout-group" content="${rG(R)}">`)}let L=G.match(/function (__stx_setup_\d+_\d+)\(/),w=L?X4(G):null;if(L&&w&&!/\bdata-stx=/.test(w.tag)){G=L3(G,(R,A)=>`<body${A} data-stx="${L[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${L[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=FQ(G);let K=Y.app?.colorMode;if(K)G=zQ(G,K);G=jQ(G),G=sO(G)}if(Q)try{let{getStoreScript:K}=await e("stx/store-loader",()=>Promise.resolve().then(() => (EQ(),kQ))),W=Y.storesDir,q=await K(W);if(q){let z=`<script data-stx-stores>${q}</script>`,U=c5(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
|
|
13456
|
+
`+z+G.slice(U.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:K}=await e("stx/framework-composables",()=>Promise.resolve().then(() => (CQ(),PQ))),W=await K(G);if(W){let q=c5(G,"data-stx-stores")||c5(G,"data-stx-runtime");if(q)G=G.slice(0,q.end)+`
|
|
13457
|
+
`+W+G.slice(q.end)}}catch{}if(Q)try{let{getComposableScript:K}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (fQ(),xQ))),W=Y.composablesDir,q=await K(W);if(q){let z=`<script data-stx-composables>${q}</script>`,U=c5(G,"data-stx-stores")||c5(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
|
|
13458
|
+
`+z+G.slice(U.end)}}catch{}if(Q)G=UQ(G);if(Q&&Z.__stx_inject_css!==!1)G=await A$(G,void 0,Y.buildMode==="serve");if(Q)G=SZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof $7)throw G;let K=G instanceof Error?G.message:String(G),W=new J5(`Template processing failed: ${K}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(Z1.log(W,{filePath:J,context:Z}),w6.logDetailedError(W,{filePath:J,template:$.substring(0,500)}),Y.debug)throw W;return V6.createFallbackContent("Template Processing",W)}}async function rO($,Z,J,Y,X){let Q=process.cwd(),G={...Y,partialsDir:Y.partialsDir&&!y0.isAbsolute(Y.partialsDir)?y0.resolve(Q,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!y0.isAbsolute(Y.componentsDir)?y0.resolve(Q,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!y0.isAbsolute(Y.layoutsDir)?y0.resolve(Q,Y.layoutsDir):Y.layoutsDir},K=G,W=$;await eO(J,Z),tO(Z,K),W=await k5(()=>iX(W,Z,J,K),W,(L)=>{Z1.log(L,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${L.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=W1(W,G$,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);W=q.output;let z=q.tokens,U=(L)=>z.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,N)=>z[Number(N)]??""),j="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,j),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),W=YQ(W),W=await AQ(W,J,X);let H={};W=T9(W,H);let B={...Z.__sections||{}},_="",O=jY(q7($)),V=/@nolayout\b/.test(W)||O===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let F=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)_=F[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(W))W=`@section('content')
|
|
13459
13459
|
${W.trim()}
|
|
13460
13460
|
@endsection`}if(!_&&!V&&K.defaultLayout){let L=C9(W),w=/@section\s*\(/.test(W);if(!L||w){let N="",R=y0.dirname(J),A=K.layoutsDir?y0.dirname(K.layoutsDir):process.cwd();for(let M=0;M<20;M++){let T=y0.join(R,"_layout.stx");if(await c(T)){N=T;break}let I=y0.dirname(R);if(I===R||I.length<A.length)break;R=I}if(N)_=N;else if(K.layoutsDir){let M=y0.isAbsolute(K.layoutsDir)?K.layoutsDir:y0.resolve(process.cwd(),K.layoutsDir),T=y0.join(M,`${K.defaultLayout}.stx`);if(await c(T))_=T}if(_&&!w)W=`@section('content')
|
|
13461
13461
|
${W.trim()}
|
|
13462
13462
|
@endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,N)=>{return B[w]=N,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,N)=>{if(/^(['"]).*\1$/.test(N.trim()))return L;try{let R=Y0(N.trim(),Z);if(R===void 0)return L;return B[w]=String(R??""),""}catch{return L}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,N)=>{if(N.includes("@parent"))B[w]=N.replace("@parent",z5);else B[w]=N.trim();return""}),Z.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,N)=>{return B[w]||N||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=I9(W,H),_){let L=[],w=E1(W),N=W1(w.output,L5,(R,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(W=N.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,A,M)=>{let T=A==="SCRIPT"?w.scripts[Number(M)]:N.tokens[Number(M)];if(T)L.push(T);return""}),L.length>0){let R=L.join(`
|
|
13463
13463
|
`);B.content=B.content?`${B.content}
|
|
13464
|
-
${R}`:R,Z.__sections=B}}if(_)try{let L;if(y0.isAbsolute(_))L=_,X.add(_);else L=await k5(()=>f3(_,J,G,X),null,()=>{throw new J5(`Failed to resolve layout path: ${_}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let T=[];try{let E=G.layoutsDir;if(E){let D=y0.isAbsolute(E)?E:y0.resolve(process.cwd(),E);T=
|
|
13465
|
-
${W}`,U(W)}catch(L){return Z1.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return U(await
|
|
13466
|
-
`;if(Q=T(Q,Z),Q=I(Q,Z),Q=
|
|
13464
|
+
${R}`:R,Z.__sections=B}}if(_)try{let L;if(y0.isAbsolute(_))L=_,X.add(_);else L=await k5(()=>f3(_,J,G,X),null,()=>{throw new J5(`Failed to resolve layout path: ${_}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let T=[];try{let E=G.layoutsDir;if(E){let D=y0.isAbsolute(E)?E:y0.resolve(process.cwd(),E);T=iO.readdirSync(D).filter((y)=>y.endsWith(".stx")).map((y)=>y.replace(/\.stx$/,"")).sort()}}catch{}let I=`Layout not found: ${_} (referenced from ${J})`+(T.length>0?`. Available layouts: ${T.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(Z1.log(Error(I),{layoutPath:_,filePath:J,available:T},"error"),console.error(`[stx] ${I}`),G.debug)throw new J5(I,J);return W}let w=await k5(()=>Bun.file(L).text(),"",()=>{throw new J5(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")}),N=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(N){if(G.debug)console.log(`Found nested layout: ${N[1]} in ${L}`);let T={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,S,P)=>{return T[S]=P.trim(),""});for(let[y,S]of Object.entries(T))if(B[y]&&B[y].includes(z5)){let P=B[y].indexOf(z5);B[y]=B[y].slice(0,P)+S+B[y].slice(P+z5.length)}else if(!B[y])B[y]=S;let E={...Z,__sections:B},D=`@layout('${N[1]}')${I}`;return await F0(D,E,L,G,X)}let R=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=T9(R,H),M={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,I,E)=>{return M[I]=E.trim(),`@slot('${I}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,I,E)=>{if(B[I]){let D=B[I];if(D.includes(z5)){let y=M[I]||"",S=D.indexOf(z5);D=D.slice(0,S)+y+D.slice(S+z5.length)}return D}return E||""}),A=aO(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=I9(A,H),Z.__originalFilePath=J,W=await tG(A,Z,L,G,X),W=`<!-- stx-layout: ${_} -->
|
|
13465
|
+
${W}`,U(W)}catch(L){return Z1.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return U(await tG(W,Z,J,G,X))}function aO($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,Y,X)=>{let Q=Z[Y];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function tO($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",Y={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(J)&&Q!==void 0)Y[X]=Q;$.$env=Y}async function eO($,Z){await k5(()=>aX($,Z),void 0,(J)=>{Z1.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}async function $F($,Z,J){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null){let Q=X[1],G=X[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (j$(),Z4)));await W(G,Z,J,{preserveExisting:!0})}catch(W){let q=W instanceof Error?W:Error(String(W));Z1.log(q,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${q.message}`)}}}async function ZF($,Z,J){try{let{interpolateScriptsInTemplate:Y}=await e("stx/expressions",()=>Promise.resolve().then(() => (q1(),AZ)));return Y($,Z,{skipServer:!0})}catch(Y){let X=Y instanceof Error?Y:Error(String(Y));return Z1.log(X,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${X.message}`),$}}async function tG($,Z,J,Y,X){let Q=$,G=Y;if(await $F(Q,Z,J),Q=await ZF(Q,Z,J),Q=await uX(Q,Z,J),Q=await mX(Q,Z,J),Q=await yY(Q,Z,J,G),L1(Q))Q=S3(Q,Z),Q=P3(Q,Z);Q=y3(Q);let{processStreamDirectives:K}=await e("stx/streaming",()=>Promise.resolve().then(() => (l6(),p6)));Q=K(Q,Z),Q=N9(Q,Z,J,G),Q=await WQ(Q,Z,J,G,X),Q=await A7(Q,Z,J,G,X),Q=F8(Q,Z,J,G);let{processDeferDirectives:W}=await e("stx/defer",()=>Promise.resolve().then(() => hQ));Q=W(Q,Z,J);let{processTeleportDirectives:q}=await e("stx/teleport",()=>Promise.resolve().then(() => mQ));Q=q(Q,Z,J);let{processTransitionDirectives:z,processTransitionAttributes:U}=await e("stx/transitions",()=>Promise.resolve().then(() => cQ));Q=z(Q,Z,J),Q=U(Q);let{processErrorBoundaryDirectives:j}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => nQ));Q=j(Q,Z,J);let{processSuspenseDirectives:H}=await e("stx/suspense",()=>Promise.resolve().then(() => oQ));Q=H(Q,Z,J);let{processAsyncDirectives:B}=await e("stx/async-components",()=>Promise.resolve().then(() => tQ));Q=B(Q,Z,J);let{processKeepAliveDirectives:_}=await e("stx/keep-alive",()=>Promise.resolve().then(() => $G));Q=_(Q,Z,J);let{processVirtualListDirectives:O,processVirtualGridDirectives:V,processInfiniteListDirectives:F}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (GG(),QG)));Q=O(Q,Z,J),Q=V(Q,Z,J),Q=F(Q,Z,J);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (NG(),wG)));Q=L(Q,Z,J),Q=w(Q);let{processComputedDirectives:N,processWatchDirectives:R}=await e("stx/computed",()=>Promise.resolve().then(() => (PG(),yG)));Q=N(Q,Z,J),Q=R(Q,Z,J);let{processFormValidationDirectives:A}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (uG(),hG)));Q=A(Q,Z,J);let{processHeadDirective:M,processTitleDirective:T,processMetaDirective:I,resetHead:E}=await e("stx/head",()=>Promise.resolve().then(() => (U$(),B3)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=M(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
|
|
13466
|
+
`;if(Q=T(Q,Z),Q=I(Q,Z),Q=sX(Q),Q=E6(Q,Z),Q=bY(Q),Q=lX(Q),Q=await M9(Q,Z,J,G,X),Q=await A7(Q,Z,J,G,X),Z.__stxProcessingDepth===1)Q=QZ(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=g9(Q),Q=X5(Q,Z,J),Q=b6(Q,Z),Q=S6(Q,Z),Q=H7(Q,Z),Q=mY(Q,Z),Q=dY(Q,Z),Q=await VY(Q,Z,J,G),Q=await E2(Q,Z,J),Q=await nY(Q,Z,J,G),Q=z8(Q,Z,J,G),Q=fJ(Q,Z,J,G),Q=gJ(Q,Z,J),Q=hJ(Q,Z,J,G),Q=DY(Q,Z,J,G),Q=x9(Q,Z),Q=f9(Q),Q=TQ(Q),!G.skipEventDirectives)Q=f8(Q,Z,J);if(Q=OY(Q,Z,J),G.debug){let n=/\bx-data\s*=/.test(Q),s=w4($);if(n&&s)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
13467
13467
|
Both work on the same page, but they manage separate scopes.
|
|
13468
|
-
Prefer signals (state/derived/effect) for new components.`)}Q
|
|
13468
|
+
Prefer signals (state/derived/effect) for new components.`)}Q=$Q(Q,Z),Q=await b1(Q,Z,J),Q=IQ(Q),Q=DQ(Q),Q=WY(Q);let{processXElementDirectives:y}=await e("stx/x-element",()=>Promise.resolve().then(() => pG));Q=y(Q);let S=Z.__originalFilePath||J,P=Y$(Z);if(Q=await C3(Q,G,S,P),Q=fY(Q,Z),Q=await nX(Q,Z,J,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:s}=await e("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (cG(),lG)));Q=await s(Q,{publicDir:n})}if(G.seo?.enabled)Q=uJ(Q,Z,G);let C=(n,s,z0=!0)=>{if(!s)return n;let D0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),K0=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(D0&&K0){if(z0)n=n.replace(K0[0],D0[0]);if(s=s.replace(D0[0],"").trim(),!s)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${s}
|
|
13469
13469
|
</head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
|
|
13470
13470
|
${s}`);if(/<html\b[^>]*>/i.test(n))return n.replace(/(<html\b[^>]*>)/i,`$1
|
|
13471
13471
|
<head>
|
|
13472
13472
|
${s}
|
|
13473
|
-
</head>`);return n},{renderHead:x,getHead:f}=await e("stx/head",()=>Promise.resolve().then(() => (U$(),B3))),$0=Z.__stx_runtime_head??f();if($0.title||$0.meta?.length||$0.link?.length){let n=x($0);if(n)Q=C(Q,n)}if(D.headContent)Q=C(Q,D.headContent,!$0.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=
|
|
13474
|
-
${
|
|
13473
|
+
</head>`);return n},{renderHead:x,getHead:f}=await e("stx/head",()=>Promise.resolve().then(() => (U$(),B3))),$0=Z.__stx_runtime_head??f();if($0.title||$0.meta?.length||$0.link?.length){let n=x($0);if(n)Q=C(Q,n)}if(D.headContent)Q=C(Q,D.headContent,!$0.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=TY(Q,G.csp,Z);if(G.analytics?.enabled)Q=zY(Q,G);if(G.heatmap?.enabled)Q=R8(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await e("stx/pwa/inject",()=>Promise.resolve().then(() => (sG(),oG)));Q=n(Q,G)}let P0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),B0=/\bSTX\.\w+/.test(Q),N0=/window\.STX\s*=/.test(Q);if(P0&&B0&&!N0){let s=`<script data-stx-scoped data-stx-run="once">
|
|
13474
|
+
${XY()}
|
|
13475
13475
|
</script>`;if(Q.includes("</head>")){let z0=Q.indexOf("</head>"),K0=Q.slice(0,z0).indexOf("<script");if(K0!==-1){let k=Q.slice(0,K0),v=Q.slice(K0);Q=k+s+`
|
|
13476
13476
|
`+v}else Q=Q.replace("</head>",`${s}
|
|
13477
13477
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
13478
13478
|
${s}`);else Q=s+`
|
|
13479
|
-
`+Q}{let{scanScriptTags:n}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (O$(),N4))),s=[];for(let z0 of n(Q)){if(!/\bserver\b/i.test(z0.attrs))continue;let D0=z0.start+z0.fullMatch.indexOf(">")+1,K0=
|
|
13480
|
-
`+Q.slice(z0)}Z.__stx_event_bindings=[]}}if(!
|
|
13479
|
+
`+Q}{let{scanScriptTags:n}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (O$(),N4))),s=[];for(let z0 of n(Q)){if(!/\bserver\b/i.test(z0.attrs))continue;let D0=z0.start+z0.fullMatch.indexOf(">")+1,K0=oO(Q,D0);if(K0===-1)continue;let k=K0+9;while(k<Q.length&&/\s/.test(Q[k]))k++;s.push({start:z0.start,end:k})}for(let z0=s.length-1;z0>=0;z0--){let{start:D0,end:K0}=s[z0];Q=Q.substring(0,D0)+Q.substring(K0)}}let u=a$(Q,J);if(u.hasScoped)Q=u.html;let a=Z.__stx_event_bindings||[],R0=!1,C0=[],U5=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:j5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (O$(),N4)));for(let n of j5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))C0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:s,content:z0}of C0){R0=!0;let D0=z0;u9(z0,J,Y.strict,Z.__originalFilePath);let K0=await X$(z0,{eventBindings:a,attrs:s,hasColonDirectives:U5,templateContent:$,filePath:J,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:P});Q=Q.replace(n,()=>K0)}if(R0)Z.__stx_event_bindings=[];if(!R0&&Z.__stxProcessingDepth===1){let n=Z.__stx_event_bindings||[];if(n.length>0){let s=s7(n);if(s){let z0=Q.lastIndexOf("</body>");Q=z0===-1?Q+s:Q.slice(0,z0)+s+`
|
|
13480
|
+
`+Q.slice(z0)}Z.__stx_event_bindings=[]}}if(!H2(Q)&&_2(Q))Q=await O4(Q,G);if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=IY(Q,Z.cspNonce);return Q}var z5="<!--PARENT_CONTENT_PLACEHOLDER-->";var T4=b(()=>{W7();w3();n1();d7();QY();qY();UY();c7();p7();r7();Q$();FY();LY();U7();kY();SY();CY();gY();w1();U$();q1();pY();oY();hX();pX();R9();g3();oX();R5();rX();J7();I0();tX();ZQ();XQ();qQ();q3();S9();wQ();O$();L9();MQ();h9();m9();M0();i6();Y3();t5();F4();F4();h9();m9()});import w0 from"fs";import Q0 from"path";import $8 from"fs";import VK from"path";var g7="resources/assets",Z8="assets";function J8($=process.cwd()){let Z=VK.resolve($,g7);return $8.existsSync(Z)&&$8.statSync(Z).isDirectory()?Z:null}import H5 from"fs";import h7 from"path";var Y8="_stx";function LK($){return Bun.hash($).toString(16).slice(0,8)}function wK($){let Z=[],J=(Y)=>{for(let X of H5.readdirSync(Y,{withFileTypes:!0})){let Q=h7.join(Y,X.name);if(X.isDirectory())J(Q);else if(X.isFile()&&Q.endsWith(".html"))Z.push(Q)}};if(H5.existsSync($))J($);return Z}var NK=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-runtime src="${$}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-router src="${$}"></script>`},{pattern:/<style\b([^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"crosswind",extension:"css",contentType:"text/css; charset=utf-8",replace:($)=>`<link data-crosswind="generated" rel="stylesheet" href="${$}">`}];function RK($,Z=`/${Y8}`){let J=[],Y=new Set,X=0,Q=$;for(let G of NK)Q=Q.replace(G.pattern,(K,W,q)=>{if(/\b(?:src|href)\s*=/.test(W)||!q.trim())return K;let z=`${G.prefix}.${LK(q)}.${G.extension}`;if(!Y.has(z))Y.add(z),J.push({filename:z,contents:q,contentType:G.contentType});return X+=q.length,G.replace(`${Z}/${z}`)});return{html:Q,assets:J,bytesInlined:X}}function X8($){let Z={pages:0,assets:0,bytesInlined:0},J=h7.join($,Y8),Y=new Set;for(let X of wK($)){let Q=H5.readFileSync(X,"utf8"),{html:G,assets:K,bytesInlined:W}=RK(Q);if(G===Q)continue;for(let q of K){if(Y.has(q.filename))continue;Y.add(q.filename),H5.mkdirSync(J,{recursive:!0}),H5.writeFileSync(h7.join(J,q.filename),q.contents),Z.assets++}H5.writeFileSync(X,G),Z.bytesInlined+=W,Z.pages++}return Z}u7();T4();import{createHash as JF}from"crypto";function YF($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var XF=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function QF($){return Bun.hash($).toString(16)}function eG($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let J=new Map,Y=$.replace(XF,(Q,G,K,W)=>{let q=W.trim();if(!q)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)q=YF(q);let z=QF(q);if(!J.has(z))J.set(z,q);let U=Z.integrity?` data-stx-integrity="sha384-${JF("sha384").update(q).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${z}.js"${U}${K}></script>`}),X=Array.from(J,([Q,G])=>({hash:Q,code:G}));return{html:Y,chunks:X}}var GF=new Set(["visible","idle"]);function $K($){if(!$.includes("data-stx-src="))return $;let Z=new Map,J=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,Y;while((Y=J.exec($))!==null)Z.set(Y[1],Y[2]);let X=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(GF.has(Z.get(G[1])||""))X.add(G[2]);let K=$.lastIndexOf("</head>");if(X.size===0||K===-1)return $;let W=Array.from(X).filter((q)=>!$.includes(`rel="prefetch" href="${q}"`)).map((q)=>`<link rel="prefetch" href="${q}" as="script">`).join("");if(!W)return $;return $.slice(0,K)+W+$.slice(K)}V1();import g$ from"fs";import x7 from"path";var KF="layout-types.d.ts";function WF($){let Z=[],J=(Y,X)=>{let Q;try{Q=g$.readdirSync(Y,{withFileTypes:!0})}catch{return}for(let G of Q){if(G.name.startsWith("."))continue;let K=x7.join(Y,G.name);if(G.isDirectory())J(K,X?`${X}/${G.name}`:G.name);else if(G.isFile()&&G.name.endsWith(".stx")&&G.name!=="_layout.stx"){let W=G.name.slice(0,-4);Z.push(X?`${X}/${W}`:W)}}};return J($,""),Z.sort()}function qF($){let Z=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if($.length===0)return Z.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),Z.join(`
|
|
13481
13481
|
`);return Z.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...$.map((J)=>` '${J}': true`)," }","}","","export {}",""),Z.join(`
|
|
13482
|
-
`)}function
|
|
13483
|
-
`)}J7();r5();W7();import{abortNavigation as
|
|
13482
|
+
`)}function ZK($,Z){if(!$)return[];let J=x7.isAbsolute($)?$:x7.resolve(process.cwd(),$),Y=WF(J),X=qF(Y),Q=x7.join(Z,KF);try{if(g$.existsSync(Q)&&g$.readFileSync(Q,"utf8")===X)return Y;g$.mkdirSync(Z,{recursive:!0}),g$.writeFileSync(Q,X)}catch{}return Y}var zF=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function a9($){let Z=$.trim();if(!Z)return null;let J=/^https?:\/\//i.test(Z)?Z:`https://${Z}`;try{return new URL(J).origin+new URL(J).pathname.replace(/\/$/,"")}catch{return null}}function UF($){for(let Z of zF){let J=$[Z];if(!J)continue;let Y=a9(J);if(Y)return{url:Y,source:"env",via:Z}}return null}function JK($){if(!$||typeof $!=="object")return null;let Z=$,J=Z.site?.url??Z.url??Z.app?.url;return typeof J==="string"?a9(J):null}async function jF($){let{existsSync:Z}=await import("fs"),J=await import("path");for(let Y of["site.config.ts","site.config.js",".config/site.config.ts"]){let X=J.resolve($,Y);if(!Z(X))continue;try{let Q=await import(X),G=JK(Q.default??Q);if(G)return G}catch{}}return null}async function YK($={}){let Z=$.cwd??process.cwd(),J=$.env??process.env;if($.explicit){let G=a9($.explicit);if(G)return{url:G,source:"option"}}let Y=JK($.stxConfig);if(Y)return{url:Y,source:"stx.config",via:"site.url"};let X=await jF(Z);if(X)return{url:X,source:"site.config",via:"url"};let Q=UF(J);if(Q)return Q;return{url:"http://localhost",source:"fallback"}}function XK(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
|
|
13483
|
+
`)}J7();r5();W7();import{abortNavigation as DD,clearMiddleware as QK,createClientCookieManager as kD,createMiddlewareContext as GK,createRouteLocation as KK,createServerCookieManager as ED,createStorageManager as bD,defineMiddleware as SD,getMiddleware as yD,getMiddlewareNames as WK,hasMiddleware as PD,loadMiddlewareFromDirectory as qK,navigateTo as CD,registerMiddleware as vD,runMiddleware as zK}from"stx-router";class UK{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=Q0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[J,Y]of Object.entries(Z))this.cache.set(J,Y)}catch{}this.loaded=!0}async save(){await w0.promises.mkdir(this.cacheDir,{recursive:!0});let $=Q0.join(this.cacheDir,"build-cache.json"),Z={};for(let[J,Y]of this.cache)Z[J]=Y;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let J=w0.statSync($),Y=`${$}:${J.mtimeMs}`;for(let Q of Z)if(w0.existsSync(Q)){let G=w0.statSync(Q);Y+=`:${Q}:${G.mtimeMs}`}let X=0;for(let Q=0;Q<Y.length;Q++){let G=Y.charCodeAt(Q);X=(X<<5)-X+G,X=X&X}return Math.abs(X).toString(36)}get($,Z){let J=this.cache.get($);if(!J)return null;let Y=this.getHash(Z,J.dependencies??[]);if(J.hash!==Y)return this.cache.delete($),null;return J.html}set($,Z,J,Y){let X=this.getHash(Z,J);this.cache.set($,{hash:X,html:Y,generatedAt:Date.now(),dependencies:J})}}class jK{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return Q0.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 J=this.getFilePath($);await w0.promises.mkdir(Q0.dirname(J),{recursive:!0}),await Bun.write(J,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await w0.promises.unlink(Z)}async invalidatePattern($){let Z=Q0.join(this.cacheDir,"isr");if(!w0.existsSync(Z))return;let J=await w0.promises.readdir(Z);for(let Y of J){let X=Y.replace(/_/g,"/").replace(".json","");if($.test(X))await w0.promises.unlink(Q0.join(Z,Y))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function BF($){try{let J=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let Y=J[1];if(!Y.includes("getStaticPaths"))return null;let X=Y.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!X)return null;return await Function(`
|
|
13484
13484
|
return (async function getStaticPaths() {
|
|
13485
13485
|
${X[1]}
|
|
13486
13486
|
})()
|
|
13487
|
-
`)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function
|
|
13487
|
+
`)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function HF($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let J=await BF($.filePath);if(!J||J.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let Y of J.paths){let X=$.pattern;for(let[Q,G]of Object.entries(Y.params))X=X.replace(`:${Q}`,G).replace(`:${Q}*`,G);Z.push({url:X,params:Y.params,props:Y.props,revalidate:Y.revalidate})}}return Z}async function _F($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let J of Z)if(await Bun.file(J).exists())try{let Y=await import(J);if(typeof Y.default==="function")return await Y.default();else if(typeof Y.default==="object")return Y.default;else if(typeof Y.getData==="function")return await Y.getData();else{let{default:X,...Q}=Y;return Q}}catch(Y){console.error(`Error loading data file ${J}:`,Y)}return null}async function OF($,Z,J){let Y=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let X=Y[1];if(!X.includes("getStaticProps"))return null;try{let Q=X.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!Q)return null;return await Function("params",`
|
|
13488
13488
|
return (async function getStaticProps() {
|
|
13489
13489
|
${Q[1]}
|
|
13490
13490
|
})()
|
|
13491
|
-
`)(Z)}catch(Q){return console.error(`Error executing getStaticProps in ${J}:`,Q),null}}async function
|
|
13491
|
+
`)(Z)}catch(Q){return console.error(`Error executing getStaticProps in ${J}:`,Q),null}}async function BK($,Z,J={},Y,X){let Q=await Bun.file($.filePath).text(),G=await _F($.filePath),K=await OF(Q,Z,$.filePath),W={...G||{},...K||{},...J,params:Z,$route:{path:$.pattern,params:Z}},q=new Set,z={...X,debug:!1,cache:!1,autoShell:!0},U=await F0(Q,W,$.filePath,z,q);if(Object.keys(Z).length>0){let j=`<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>",`${j}
|
|
13492
13492
|
</head>`);else U=`${j}
|
|
13493
|
-
${U}`}if(U=await E3(U,{router:Y.router}),U=await A$(U),Y.minify!==!1)return{html:
|
|
13493
|
+
${U}`}if(U=await E3(U,{router:Y.router}),U=await A$(U),Y.minify!==!1)return{html:FF(U),dependencies:Array.from(q)};return{html:U,dependencies:Array.from(q)}}function FF($){let Z=[],J=0,Y=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,X;while((X=Y.exec($))!==null){let G=$.slice(J,X.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=X[1],W=X[2],q=X[3];W=W.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+W+q),J=X.index+X[0].length}let Q=$.slice(J);return Z.push(Q.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function VF($){let Z=0;for(let J=0;J<$.length;J++){let Y=$.charCodeAt(J);Z=(Z<<5)-Z+Y,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function LF($,Z,J,Y){if(J?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(Z))return!0;return Y.some((X)=>{if(X instanceof RegExp)return X.test($);return X.endsWith("/")?$===X.slice(0,-1)||$.startsWith(X):$===X})}function wF($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
13494
13494
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
13495
13495
|
${$.map((Y)=>{let X=new URL(Y.loc,Z).href,Q=` <url>
|
|
13496
13496
|
<loc>${X1(X)}</loc>`;if(Y.lastmod)Q+=`
|
|
@@ -13499,7 +13499,7 @@ ${$.map((Y)=>{let X=new URL(Y.loc,Z).href,Q=` <url>
|
|
|
13499
13499
|
<priority>${Y.priority}</priority>`;return Q+=`
|
|
13500
13500
|
</url>`,Q}).join(`
|
|
13501
13501
|
`)}
|
|
13502
|
-
</urlset>`}function X1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function
|
|
13502
|
+
</urlset>`}function X1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function NF($,Z){let J=Z.map((Y)=>{let X=" <item>";if(X+=`
|
|
13503
13503
|
<title>${X1(Y.title)}</title>`,X+=`
|
|
13504
13504
|
<link>${X1(Y.link)}</link>`,Y.description)X+=`
|
|
13505
13505
|
<description>${X1(Y.description)}</description>`;if(Y.pubDate)X+=`
|
|
@@ -13520,10 +13520,10 @@ ${$.map((Y)=>{let X=new URL(Y.loc,Z).href,Q=` <url>
|
|
|
13520
13520
|
${J.join(`
|
|
13521
13521
|
`)}
|
|
13522
13522
|
</channel>
|
|
13523
|
-
</rss>`}async function
|
|
13523
|
+
</rss>`}async function RF($={}){let Z=Date.now(),J=await e0(),Y=await YK({explicit:$.domain,stxConfig:J});if(Y.source==="fallback"&&($.sitemap??!0))console.warn(XK());let X={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:Y.url,revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,sitemapExclude:$.sitemapExclude||[],robots:$.robots??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||_1(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:[]},G=new Set,K=0,W={},q={};await X.hooks.onBuildStart?.();try{if(X.cleanOutput&&w0.existsSync(X.outputDir))await w0.promises.rm(X.outputDir,{recursive:!0});await w0.promises.mkdir(X.outputDir,{recursive:!0});let U=new UK(X.cacheDir);if(X.cache)await U.load();try{let{generateCrosswindCSS:R}=await Promise.resolve().then(() => (W7(),YY));await R('<div class="bg-black"></div>')}catch{}QK();let j=J?.routeMiddleware?.dir||"middleware";await qK(process.cwd(),j);let H=WK();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let B=J?.routeMiddleware?.global||[];ZK(J?.layoutsDir,_1(process.cwd()));let _=i5(".",{pagesDir:X.pagesDir});console.log(`Found ${_.length} routes`);let O=[];for(let R of _){let A=await HF(R);for(let M of A)O.push({route:R,url:M.url,params:M.params,props:M.props,revalidate:M.revalidate??X.revalidate})}Q.totalPages=O.length,console.log(`Generating ${Q.totalPages} pages...`);let V=[],F=[];for(let R=0;R<O.length;R+=X.concurrency)F.push(O.slice(R,R+X.concurrency));for(let R of F)await Promise.all(R.map(async(A)=>{let{route:M,url:T,params:I,props:E,revalidate:D}=A;try{await X.hooks.onPageStart?.(T);let y=await Bun.file(M.filePath).text(),S=IF(y),P=S?.middleware?Array.isArray(S.middleware)?S.middleware:[S.middleware]:[],C=[...B,...P];if(C.length>0){let B0=KK(T,I,S||{}),N0=GK(B0,null,void 0,{isServer:!0}),u=await zK(C,N0);if(u.redirect){let a=typeof u.redirect==="string"?u.redirect:u.redirect.path||u.redirect,R0=DF(String(a),T),C0=kF(T,X);await w0.promises.mkdir(Q0.dirname(C0),{recursive:!0}),await Bun.write(C0,R0),Q.successCount++,Q.pages.push({route:T,outputPath:C0,size:Buffer.byteLength(R0),cached:!1}),V.push({loc:T,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${T} \u2192 redirect to ${a}`);return}if(u.abort){let a=typeof u.abort==="string"?u.abort:u.abort?.error?.message||"aborted";console.warn(` \u21B3 ${T} \u2014 middleware aborted: ${a}`);return}}let x=y.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(x)try{if(!await Function("route",`
|
|
13524
13524
|
const validate = ${x[1]};
|
|
13525
13525
|
return validate(route);
|
|
13526
|
-
`)({params:I})){console.warn(`Validation failed for ${T}, skipping...`);return}}catch{}let f=null,d=!1;if(X.cache){if(f=U.get(T,M.filePath),f)d=!0,Q.cachedCount++}if(!f){let B0=await
|
|
13526
|
+
`)({params:I})){console.warn(`Validation failed for ${T}, skipping...`);return}}catch{}let f=null,d=!1;if(X.cache){if(f=U.get(T,M.filePath),f)d=!0,Q.cachedCount++}if(!f){let B0=await BK(M,I,E,X,J);if(f=B0.html,X.cache)U.set(T,M.filePath,B0.dependencies,f)}let $0;if(X.trailingSlash)$0=Q0.join(X.outputDir,T,"index.html");else $0=T==="/"?Q0.join(X.outputDir,"index.html"):Q0.join(X.outputDir,`${T}.html`);if(X.chunkIslands){let{html:B0,chunks:N0}=eG(f,{integrity:X.integrityIslands,minify:X.minify});if(N0.length>0){let u=Q0.join(X.outputDir,"_stx","islands");await w0.promises.mkdir(u,{recursive:!0});for(let a of N0){let R0=Q0.join(u,`${a.hash}.js`);if(!await Bun.file(R0).exists())await Bun.write(R0,a.code);if(!G.has(a.hash)){G.add(a.hash);let C0=Buffer.byteLength(a.code,"utf8");K+=C0,W[a.hash]={bytes:C0,file:`/_stx/islands/${a.hash}.js`}}}if(q[T]=N0.map((a)=>a.hash),f=B0,X.prefetchIslands)f=$K(f)}}if(await w0.promises.mkdir(Q0.dirname($0),{recursive:!0}),await Bun.write($0,f),!LF(T,f,S,X.sitemapExclude))V.push({loc:T,lastmod:new Date().toISOString().split("T")[0],priority:T==="/"?1:0.8});let P0={route:T,outputPath:$0,size:Buffer.byteLength(f,"utf8"),cached:d};if(D!==!1)P0.revalidateAt=Date.now()+D*1000;Q.pages.push(P0),Q.successCount++,await X.hooks.onPageEnd?.(T,f)}catch(y){Q.failedCount++,Q.errors.push({route:T,error:y}),await X.hooks.onError?.(y,T),console.error(`Error generating ${T}:`,y)}}));if(X.cache)await U.save();if(X.generate404){let R=Q0.join(X.pagesDir,"404.stx");if(await Bun.file(R).exists()){let A=new Set,M={...J,debug:!1,cache:!1},T=await F0(await Bun.file(R).text(),{},R,M,A);await Bun.write(Q0.join(X.outputDir,"404.html"),T)}else await Bun.write(Q0.join(X.outputDir,"404.html"),`<!DOCTYPE html>
|
|
13527
13527
|
<html lang="en">
|
|
13528
13528
|
<head>
|
|
13529
13529
|
<meta charset="UTF-8">
|
|
@@ -13544,7 +13544,7 @@ ${J.join(`
|
|
|
13544
13544
|
<a href="/">Go home</a>
|
|
13545
13545
|
</div>
|
|
13546
13546
|
</body>
|
|
13547
|
-
</html>`)}for(let R of[500]){let A=Q0.join(X.pagesDir,`${R}.stx`);if(await Bun.file(A).exists()){let M=new Set,T={...J,debug:!1,cache:!1},I=await F0(await Bun.file(A).text(),{},A,T,M);await Bun.write(Q0.join(X.outputDir,`${R}.html`),I)}}let L=Q0.join(X.pagesDir,"error.stx");if(await Bun.file(L).exists()){let R=new Set,A={...J,debug:!1,cache:!1},M=await F0(await Bun.file(L).text(),{},L,A,R);await Bun.write(Q0.join(X.outputDir,"error.html"),M)}if(X.sitemap&&V.length>0){let R=
|
|
13547
|
+
</html>`)}for(let R of[500]){let A=Q0.join(X.pagesDir,`${R}.stx`);if(await Bun.file(A).exists()){let M=new Set,T={...J,debug:!1,cache:!1},I=await F0(await Bun.file(A).text(),{},A,T,M);await Bun.write(Q0.join(X.outputDir,`${R}.html`),I)}}let L=Q0.join(X.pagesDir,"error.stx");if(await Bun.file(L).exists()){let R=new Set,A={...J,debug:!1,cache:!1},M=await F0(await Bun.file(L).text(),{},L,A,R);await Bun.write(Q0.join(X.outputDir,"error.html"),M)}if(X.sitemap&&V.length>0){let R=wF(V,X.domain),A=Q0.join(X.outputDir,"sitemap.xml");await Bun.write(A,R),Q.sitemapPath=A,console.log(`Generated sitemap.xml with ${V.length} URLs`)}if(X.robots!==!1){let R=typeof X.robots==="object"?X.robots:{},A=[...X.sitemapExclude.filter((T)=>typeof T==="string"),...R.disallow||[]],M=pJ({rules:[{userAgent:R.userAgent||"*",allow:R.allow||["/"],...A.length>0?{disallow:A}:{}}],...R.sitemap!==!1&&Q.sitemapPath?{sitemap:new URL("/sitemap.xml",X.domain).href}:{}});await Bun.write(Q0.join(X.outputDir,"robots.txt"),M),console.log("Generated robots.txt")}if(X.rss){let R=typeof X.rss==="object"?X.rss:{title:"Site Feed",description:"Latest updates",link:X.domain},A=[];if(R.getItems)A=await R.getItems();let M=NF(R,A),T=Q0.join(X.outputDir,"rss.xml");await Bun.write(T,M),Q.rssPath=T,console.log(`Generated rss.xml with ${A.length} items`)}let w=X8(X.outputDir);if(w.assets>0)console.log(`Externalized ${w.assets} asset(s) from ${w.pages} page(s) (${(w.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(X.publicDir&&w0.existsSync(X.publicDir))await t9(X.publicDir,X.outputDir),console.log(`Copied public assets from ${X.publicDir}`);let N=J8();if(N)await t9(N,Q0.join(X.outputDir,Z8)),console.log(`Copied assets from ${g7}`)}catch(U){throw await X.hooks.onError?.(U),U}if(Q.buildTime=Date.now()-Z,G.size>0){Q.islandChunks={count:G.size,totalBytes:K};let U={generatedChunks:G.size,totalBytes:K,chunks:W,pages:q};await Bun.write(Q0.join(X.outputDir,"_stx","islands-manifest.json"),JSON.stringify(U,null,2))}await X.hooks.onBuildEnd?.(Q);let z=Q.islandChunks?`
|
|
13548
13548
|
Island chunks: ${Q.islandChunks.count} (${(Q.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
|
|
13549
13549
|
Build complete!
|
|
13550
13550
|
Total: ${Q.totalPages} pages
|
|
@@ -13552,8 +13552,8 @@ Build complete!
|
|
|
13552
13552
|
Cached: ${Q.cachedCount}
|
|
13553
13553
|
Failed: ${Q.failedCount}
|
|
13554
13554
|
Time: ${Q.buildTime}ms${z}
|
|
13555
|
-
`),Q}async function t9($,Z){let J=await w0.promises.readdir($,{withFileTypes:!0});for(let Y of J){let X=Q0.join($,Y.name),Q=Q0.join(Z,Y.name);if(Y.isDirectory())await w0.promises.mkdir(Q,{recursive:!0}),await t9(X,Q);else await w0.promises.copyFile(X,Q)}}function
|
|
13556
|
-
`)){let U=z.indexOf(":");if(U>0){let j=z.slice(0,U).trim(),H=z.slice(U+1).trim();if(H==="true")H=!0;else if(H==="false")H=!1;else if(/^\d+$/.test(H))H=parseInt(H,10);else if(/^\d+\.\d+$/.test(H))H=parseFloat(H);else if(H.startsWith("[")&&H.endsWith("]"))H=H.slice(1,-1).split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,""));Y[j]=H}}}let Q=X.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,W;while((W=K.exec(Q))!==null){let q=parseInt(W[1],10),z=W[2],U=z.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:z,level:q})}return{content:Q,data:Y,toc:G}}}}function
|
|
13555
|
+
`),Q}async function t9($,Z){let J=await w0.promises.readdir($,{withFileTypes:!0});for(let Y of J){let X=Q0.join($,Y.name),Q=Q0.join(Z,Y.name);if(Y.isDirectory())await w0.promises.mkdir(Q,{recursive:!0}),await t9(X,Q);else await w0.promises.copyFile(X,Q)}}function AF($={}){let Z=$.cacheDir||_1(process.cwd(),"ssg-cache"),J=new jK(Z),Y=$.revalidate||3600;return{async get(X){let Q=await J.get(X);if(!Q)return null;if(Date.now()>Q.revalidateAfter)this.revalidate(X).catch(console.error);return{html:Q.html,headers:{"Cache-Control":`public, max-age=${Y}, stale-while-revalidate=${Y*2}`,ETag:Q.etag,"X-ISR-Generated":new Date(Q.generatedAt).toISOString(),...Q.headers}}},async revalidate(X){let G=i5(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return X.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${X}`);return}let K=X.match(G.regex),W={};if(K)G.params.forEach((U,j)=>{W[U]=K[j+1]});let q=await e0(),{html:z}=await BK(G,W,{},$,q);await J.set(X,{html:z,generatedAt:Date.now(),revalidateAfter:Date.now()+Y*1000,etag:VF(z)}),console.log(`Revalidated: ${X}`)},async invalidate(X){if(typeof X==="string")await J.invalidate(X);else await J.invalidatePattern(X)}}}function MF($){return async()=>{return{paths:await $(),fallback:!1}}}function TF(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),J=Z.match(/^---\n([\s\S]*?)\n---/),Y={},X=Z;if(J){let q=J[1];X=Z.slice(J[0].length).trim();for(let z of q.split(`
|
|
13556
|
+
`)){let U=z.indexOf(":");if(U>0){let j=z.slice(0,U).trim(),H=z.slice(U+1).trim();if(H==="true")H=!0;else if(H==="false")H=!1;else if(/^\d+$/.test(H))H=parseInt(H,10);else if(/^\d+\.\d+$/.test(H))H=parseFloat(H);else if(H.startsWith("[")&&H.endsWith("]"))H=H.slice(1,-1).split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,""));Y[j]=H}}}let Q=X.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,W;while((W=K.exec(Q))!==null){let q=parseInt(W[1],10),z=W[2],U=z.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:z,level:q})}return{content:Q,data:Y,toc:G}}}}function IF($){return q7($)}function DF($,Z){return`<!DOCTYPE html>
|
|
13557
13557
|
<html>
|
|
13558
13558
|
<head>
|
|
13559
13559
|
<meta charset="utf-8">
|
|
@@ -13565,4 +13565,4 @@ Build complete!
|
|
|
13565
13565
|
<p>Redirecting to <a href="${$}">${$}</a>...</p>
|
|
13566
13566
|
<script>window.location.replace('${$}')</script>
|
|
13567
13567
|
</body>
|
|
13568
|
-
</html>`}function
|
|
13568
|
+
</html>`}function kF($,Z){if($==="/"||$==="")return Q0.join(Z.outputDir,"index.html");let J=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return Q0.join(Z.outputDir,J,"index.html");return Q0.join(Z.outputDir,`${J}.html`)}var aD={generateStaticSite:RF,createISRHandler:AF,defineStaticPaths:MF,createMarkdownLoader:TF};export{LF as isExcludedFromSitemap,RF as generateStaticSite,MF as defineStaticPaths,aD as default,TF as createMarkdownLoader,AF as createISRHandler};
|