@stacksjs/stx 0.2.133 → 0.2.135

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/ssg.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var XQ=Object.defineProperty;var QQ=($)=>$;function GQ($,Z){this[$]=QQ.bind(null,Z)}var a=($,Z)=>{for(var Y in Z)XQ($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:GQ.bind(Z,Y)})};var S=($,Z)=>()=>($&&(Z=$($=0)),Z);var j0=import.meta.require;import k5 from"path";function a6($){r6=$?.trim()||null}function b5(){return process.env[WQ]?.trim()||r6||$5}function B1($=process.cwd(),...Z){let Y=b5();return k5.isAbsolute(Y)?k5.join(Y,...Z):k5.join($,Y,...Z)}function S5($){if(!$||k5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==$5&&!Z.startsWith(`${$5}/`))return $;let Y=Z.slice($5.length+1);return Y?k5.join(b5(),Y):b5()}var $5=".stx",WQ="STX_DIR",r6=null;var y5=()=>{};var H0;var t6=S(()=>{H0={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 e6($,Z,Y,J){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let q={"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||q} -->`});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 $9,Z9;var Q7=S(()=>{$9={name:"a11y",handler:($,Z,Y,J)=>{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},Z9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function zQ($,Z={}){let{duration:Y,delay:J,ease:X,direction:Q,custom:G}={...K1,...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);"}
2
+ var GQ=Object.defineProperty;var KQ=($)=>$;function WQ($,Z){this[$]=KQ.bind(null,Z)}var a=($,Z)=>{for(var Y in Z)GQ($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:WQ.bind(Z,Y)})};var S=($,Z)=>()=>($&&(Z=$($=0)),Z);var j0=import.meta.require;import b5 from"path";function t6($){a6=$?.trim()||null}function S5(){return process.env[qQ]?.trim()||a6||Z5}function H1($=process.cwd(),...Z){let Y=S5();return b5.isAbsolute(Y)?b5.join(Y,...Z):b5.join($,Y,...Z)}function y5($){if(!$||b5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==Z5&&!Z.startsWith(`${Z5}/`))return $;let Y=Z.slice(Z5.length+1);return Y?b5.join(S5(),Y):S5()}var Z5=".stx",qQ="STX_DIR",a6=null;var P5=()=>{};var H0;var e6=S(()=>{H0={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 $9($,Z,Y,J){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let q={"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||q} -->`});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 Z9,Y9;var K7=S(()=>{Z9={name:"a11y",handler:($,Z,Y,J)=>{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},Y9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function UQ($,Z={}){let{duration:Y,delay:J,ease:X,direction:Q,custom:G}={...W1,...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 XQ=Object.defineProperty;var QQ=($)=>$;function GQ($,Z){this[$]=QQ.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 qQ(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function jQ(){return`
13
13
  <script data-stx-scoped>
14
14
  // Motion preferences handling
15
15
  (function() {
@@ -37,7 +37,7 @@ else {
37
37
  });
38
38
  })();
39
39
  </script>
40
- `}function UQ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function jQ($=0.1,Z="0px"){return`
40
+ `}function _Q($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function BQ($=0.1,Z="0px"){return`
41
41
  <script data-stx-scoped>
42
42
  // Intersection Observer for scroll animations
43
43
  (function() {
@@ -80,7 +80,7 @@ else {
80
80
  }
81
81
  })();
82
82
  </script>
83
- `}function _Q(){return`
83
+ `}function HQ(){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 BQ($,Z,Y={}){let{staggerDelay:J=50,sequence:X=!1}=Y;return`
198
+ `}function OQ($,Z,Y={}){let{staggerDelay:J=50,sequence:X=!1}=Y;return`
199
199
  <script data-stx-scoped>
200
200
  // Animation Group: ${$}
201
201
  (function() {
@@ -232,11 +232,11 @@ else {
232
232
  }
233
233
  })();
234
234
  </script>
235
- `}function G9($,Z,Y,J){let X=$;if(J.animation?.enabled===!1)return X;let Q=Y.includes("test")&&Y.includes("animation");if(!UQ(X)&&!Q)return X;if(!X.includes('<style id="stx-animation-base">')){let K=_Q();X=X.replace("</head>",`${K}
236
- </head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let W=jQ(),z=X.lastIndexOf("</body>");if(z!==-1)X=X.slice(0,z)+W+`
237
- `+X.slice(z)}}return X}var K1,Y9,J9,X9,Q9;var G7=S(()=>{K1={duration:300,delay:0,ease:"ease",direction:"both"};Y9={name:"transition",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||K1.duration:K1.duration,G=Z.length>2?Z[2]||K1.ease:K1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||K1.delay:K1.delay,W=Z.length>4?Z[4]||K1.direction:K1.direction,z=`stx-transition-${Math.random().toString(36).substr(2,9)}`,q=zQ(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="${z}" 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"},J9={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let 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,z=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,q=`--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="${z}" class="${U}" style="${q}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},X9={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let X=Z[0],Q=Z.slice(1).map((z)=>z.startsWith("#")||z.startsWith(".")?z:`#${z}`),G=Y.staggerDelay||50,K=Y.sequence||!0,W=BQ(X,Q,{staggerDelay:G,sequence:K});return`${$}
239
- ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Q9={name:"motion",handler:($,Z,Y,J)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=qQ();return`<div data-animate="${X?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as K9}from"stx-router";var W9=S(()=>{K7()});async function HQ($,Z,Y,J){let X=Z[0]?.replace(/['"]/g,"")||"main",Q=K9();if(X!=="main")Q=Q.replace("container:'main'",`container:'${X}'`);return`<script data-stx-router>${Q}</script>`}var z9;var K7=S(()=>{W9();z9={name:"stxRouter",handler:HQ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function q9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...OQ,...Z};return`
235
+ `}function K9($,Z,Y,J){let X=$;if(J.animation?.enabled===!1)return X;let Q=Y.includes("test")&&Y.includes("animation");if(!_Q(X)&&!Q)return X;if(!X.includes('<style id="stx-animation-base">')){let K=HQ();X=X.replace("</head>",`${K}
236
+ </head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let W=BQ(),z=X.lastIndexOf("</body>");if(z!==-1)X=X.slice(0,z)+W+`
237
+ `+X.slice(z)}}return X}var W1,J9,X9,Q9,G9;var W7=S(()=>{W1={duration:300,delay:0,ease:"ease",direction:"both"};J9={name:"transition",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||W1.duration:W1.duration,G=Z.length>2?Z[2]||W1.ease:W1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||W1.delay:W1.delay,W=Z.length>4?Z[4]||W1.direction:W1.direction,z=`stx-transition-${Math.random().toString(36).substr(2,9)}`,q=UQ(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="${z}" 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"},X9={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let 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,z=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,q=`--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="${z}" class="${U}" style="${q}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Q9={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let X=Z[0],Q=Z.slice(1).map((z)=>z.startsWith("#")||z.startsWith(".")?z:`#${z}`),G=Y.staggerDelay||50,K=Y.sequence||!0,W=OQ(X,Q,{staggerDelay:G,sequence:K});return`${$}
239
+ ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},G9={name:"motion",handler:($,Z,Y,J)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=jQ();return`<div data-animate="${X?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as W9}from"stx-router";var z9=S(()=>{z7()});async function LQ($,Z,Y,J){let X=Z[0]?.replace(/['"]/g,"")||"main",Q=W9();if(X!=="main")Q=Q.replace("container:'main'",`container:'${X}'`);return`<script data-stx-router>${Q}</script>`}var q9;var z7=S(()=>{z9();q9={name:"stxRouter",handler:LQ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function U9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...FQ,...Z};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
241
241
  <script>
242
242
  (function() {
@@ -619,10 +619,10 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function U9($,Z){let Y=q9(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function LQ($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[X,Q]=J.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 OQ,j9;var W7=S(()=>{OQ={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};j9={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let X=Y.__stx_config||{};if(Z.length>0){let Q=LQ(Z.join(" "));X.heatmap={...X.heatmap,...Q,enabled:!0}}return q9(X)}}});function H1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function _9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function B9($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],X=$.slice(Y[0].length),Q={};for(let G of J.split(`
623
- `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let W=K.indexOf(":");if(W===-1)continue;let z=K.slice(0,W).trim(),q=K.slice(W+1).trim();if(typeof q==="string"){if(q.startsWith('"')&&q.endsWith('"')||q.startsWith("'")&&q.endsWith("'"))q=q.slice(1,-1);else if(q.startsWith("[")&&q.endsWith("]"))try{q=JSON.parse(q)}catch{}else if(q==="true")q=!0;else if(q==="false")q=!1;else if(/^-?\d+(?:\.\d+)?$/.test(q))q=Number(q)}Q[z]=q}return{data:Q,content:X.trim()}}function P5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,X=$,Q=[];if(X=X.replace(/```(\w*)\n([\s\S]*?)```/g,(q,U,j)=>{let _=Q.length,B=U?` class="language-${H1(U)}"`:"";return Q.push(`<pre><code${B}>${H1(j.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),X=X.replace(/`([^`]*)`/g,(q,U)=>`<code>${H1(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>"),Y)X=X.replace(/~~(.+?)~~/g,"<del>$1</del>");if(X=X.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(q,U,j)=>{return`<img src="${_9(j)?H1(j):""}" alt="${H1(U)}" />`}),X=X.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(q,U,j)=>{return`<a href="${_9(j)?H1(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
- `),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>"),Y)X=X.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(q,U,j)=>{let B=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${H1(L)}</th>`).join("")}</tr>`,H=j.trim().split(`
625
- `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${H1(O)}</td>`).join("")}</tr>`}).join(`
622
+ `}function j9($,Z){let Y=U9(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function VQ($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[X,Q]=J.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 FQ,_9;var q7=S(()=>{FQ={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};_9={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let X=Y.__stx_config||{};if(Z.length>0){let Q=VQ(Z.join(" "));X.heatmap={...X.heatmap,...Q,enabled:!0}}return U9(X)}}});function O1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function B9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function H9($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],X=$.slice(Y[0].length),Q={};for(let G of J.split(`
623
+ `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let W=K.indexOf(":");if(W===-1)continue;let z=K.slice(0,W).trim(),q=K.slice(W+1).trim();if(typeof q==="string"){if(q.startsWith('"')&&q.endsWith('"')||q.startsWith("'")&&q.endsWith("'"))q=q.slice(1,-1);else if(q.startsWith("[")&&q.endsWith("]"))try{q=JSON.parse(q)}catch{}else if(q==="true")q=!0;else if(q==="false")q=!1;else if(/^-?\d+(?:\.\d+)?$/.test(q))q=Number(q)}Q[z]=q}return{data:Q,content:X.trim()}}function C5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,X=$,Q=[];if(X=X.replace(/```(\w*)\n([\s\S]*?)```/g,(q,U,j)=>{let _=Q.length,B=U?` class="language-${O1(U)}"`:"";return Q.push(`<pre><code${B}>${O1(j.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),X=X.replace(/`([^`]*)`/g,(q,U)=>`<code>${O1(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>"),Y)X=X.replace(/~~(.+?)~~/g,"<del>$1</del>");if(X=X.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(q,U,j)=>{return`<img src="${B9(j)?O1(j):""}" alt="${O1(U)}" />`}),X=X.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(q,U,j)=>{return`<a href="${B9(j)?O1(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
+ `),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>"),Y)X=X.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(q,U,j)=>{let B=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${O1(L)}</th>`).join("")}</tr>`,H=j.trim().split(`
625
+ `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${O1(O)}</td>`).join("")}</tr>`}).join(`
626
626
  `);return`<table>
627
627
  <thead>
628
628
  ${B}
@@ -639,8 +639,8 @@ ${H}
639
639
  `),J)X=X.replace(/\n/g,`<br />
640
640
  `);for(let q=0;q<Q.length;q++)X=X.replace(`\x00CODEBLOCK${q}\x00`,Q[q]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function s0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
641
641
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
642
- `}),$}import FQ from"process";function l0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(FQ.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var b1=()=>{};var C5={};a(C5,{queueClientBundleBuild:()=>F9,hasUserImports:()=>wQ,bundleClientScript:()=>RQ});import L0 from"path";import v0 from"fs";function wQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(!H9.some((G)=>G.test(X)))return console.log("[stx:bundler] detected user import:",X),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=J.exec($))!==null){let X=Y[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!H9.some((G)=>G.test(X)))return console.log("[stx:bundler] detected side-effect import:",X),!0}return!1}function AQ($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:L0.dirname(Q),W=L0.resolve(K,G),z=[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 q of z)try{if(v0.existsSync(q)&&v0.statSync(q,{throwIfNoEntry:!1})?.isFile())return q}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(v0.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 J.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 z of W)if(v0.existsSync(z)&&v0.statSync(z,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",z),J.add(z),{path:z};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),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!==Y)J.add(G.path);return{contents:v0.readFileSync(G.path,"utf8"),loader:W}})}}}function F9($){let Z=globalThis,J=(Z[O9]??Promise.resolve()).then($,$);return Z[O9]=J.then(()=>{return},()=>{return}),J}async function RQ($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||B1(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${VQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=L0.join(Q,`${K}.js`),z=L0.join(Q,`${K}.deps.json`),q=Bun.file(W);if(await q.exists()){let _=Bun.file(z),B=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==L9||!Array.isArray(H.files))B=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(v0.statSync(L.path).mtimeMs!==L.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return console.log("[stx:bundler] cache hit:",K),await q.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=z7.get(K);if(U)return await U;let j=F9(()=>NQ($,Z,{projectRoot:J,minify:X,cacheDir:Q,hash:K,cachePath:W,depsPath:z}));z7.set(K,j);try{return await j}finally{z7.delete(K)}}async function NQ($,Z,Y){let{projectRoot:J,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=Y,z=B1(J,"bundle-tmp"),q=L0.join(z,`${G}.ts`),U=L0.join(z,"out",G);v0.mkdirSync(z,{recursive:!0}),v0.mkdirSync(U,{recursive:!0});let j=L0.dirname(Z),_=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=B.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((F)=>{let w=F.split(":")[0].trim();if(w)_.push(w)});else if(L[3])_.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;_.push(L[2])}let V=_.length>0?`
643
- export { ${_.join(", ")} }`:"";await Bun.write(q,$+V),console.log("[stx:bundler] bundling:",G,"from:",L0.basename(Z));let O=new Set;try{let F=await Bun.build({entrypoints:[q],outdir:U,target:"browser",format:"esm",minify:X,plugins:[AQ(J,j,q,O)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...l0()},root:J});if(!F.success){let D=F.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 F.outputs){w=await D.text();break}let A=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of D[1].split(",")){let b=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(b){A.push([b[2],b[1]]);continue}let k=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(k))A.push([k,k])}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 N=`__stxBundle_${G}`,M=A.map(([D,y])=>`${JSON.stringify(D)}: ${y}`).join(", "),T=A.map(([D])=>`var ${D} = undefined;`).join(`
642
+ `}),$}import wQ from"process";function l0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(wQ.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var S1=()=>{};var v5={};a(v5,{queueClientBundleBuild:()=>V9,hasUserImports:()=>RQ,bundleClientScript:()=>MQ});import L0 from"path";import v0 from"fs";function RQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(!O9.some((G)=>G.test(X)))return console.log("[stx:bundler] detected user import:",X),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=J.exec($))!==null){let X=Y[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!O9.some((G)=>G.test(X)))return console.log("[stx:bundler] detected side-effect import:",X),!0}return!1}function NQ($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:L0.dirname(Q),W=L0.resolve(K,G),z=[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 q of z)try{if(v0.existsSync(q)&&v0.statSync(q,{throwIfNoEntry:!1})?.isFile())return q}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(v0.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 J.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 z of W)if(v0.existsSync(z)&&v0.statSync(z,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",z),J.add(z),{path:z};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),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!==Y)J.add(G.path);return{contents:v0.readFileSync(G.path,"utf8"),loader:W}})}}}function V9($){let Z=globalThis,J=(Z[L9]??Promise.resolve()).then($,$);return Z[L9]=J.then(()=>{return},()=>{return}),J}async function MQ($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||H1(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${AQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=L0.join(Q,`${K}.js`),z=L0.join(Q,`${K}.deps.json`),q=Bun.file(W);if(await q.exists()){let _=Bun.file(z),B=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==F9||!Array.isArray(H.files))B=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(v0.statSync(L.path).mtimeMs!==L.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return console.log("[stx:bundler] cache hit:",K),await q.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=U7.get(K);if(U)return await U;let j=V9(()=>TQ($,Z,{projectRoot:J,minify:X,cacheDir:Q,hash:K,cachePath:W,depsPath:z}));U7.set(K,j);try{return await j}finally{U7.delete(K)}}async function TQ($,Z,Y){let{projectRoot:J,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=Y,z=H1(J,"bundle-tmp"),q=L0.join(z,`${G}.ts`),U=L0.join(z,"out",G);v0.mkdirSync(z,{recursive:!0}),v0.mkdirSync(U,{recursive:!0});let j=L0.dirname(Z),_=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=B.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((F)=>{let w=F.split(":")[0].trim();if(w)_.push(w)});else if(L[3])_.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;_.push(L[2])}let V=_.length>0?`
643
+ export { ${_.join(", ")} }`:"";await Bun.write(q,$+V),console.log("[stx:bundler] bundling:",G,"from:",L0.basename(Z));let O=new Set;try{let F=await Bun.build({entrypoints:[q],outdir:U,target:"browser",format:"esm",minify:X,plugins:[NQ(J,j,q,O)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...l0()},root:J});if(!F.success){let D=F.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 F.outputs){w=await D.text();break}let A=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of D[1].split(",")){let b=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(b){A.push([b[2],b[1]]);continue}let k=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(k))A.push([k,k])}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 N=`__stxBundle_${G}`,M=A.map(([D,y])=>`${JSON.stringify(D)}: ${y}`).join(", "),T=A.map(([D])=>`var ${D} = undefined;`).join(`
644
644
  `),I=A.map(([D])=>`${D} = ${N}[${JSON.stringify(D)}];`).join(`
645
645
  `);if(w=`${R.join(`
646
646
  `)}
@@ -649,19 +649,19 @@ var ${N} = (function() {
649
649
  ${w}
650
650
  return { ${M} };
651
651
  })();
652
- ${I}`.trim(),console.log("[stx:bundler] bundled:",G,"output:",w.length,"bytes"),_.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${L0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;v0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let E=Array.from(O).map((D)=>{try{return{path:D,mtimeMs:v0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({metadataVersion:L9,files:E})),w}catch(F){let w=F instanceof Error?F.message:String(F),A=F?.errors,R=Array.isArray(A)&&A.length>0?`
652
+ ${I}`.trim(),console.log("[stx:bundler] bundled:",G,"output:",w.length,"bytes"),_.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${L0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;v0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let E=Array.from(O).map((D)=>{try{return{path:D,mtimeMs:v0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({metadataVersion:F9,files:E})),w}catch(F){let w=F instanceof Error?F.message:String(F),A=F?.errors,R=Array.isArray(A)&&A.length>0?`
653
653
  ${A.map((N)=>`- ${N?.message??N}`).join(`
654
- `)}`:"";return console.warn(`[stx:bundler] error: ${w}${R}`),$}finally{try{v0.rmSync(q,{force:!0}),v0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var VQ=5,L9=1,H9,z7,O9;var v5=S(()=>{b1();y5();H9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];z7=new Map,O9=Symbol.for("stx.client-bundle-build-queue")});var N9={};a(N9,{renderVendorStyleTags:()=>A$,processClientScript:()=>g5,injectBrowserCoreAutoImports:()=>Z5,generateServerDataBridge:()=>R$,generateBrowserAutoImportDestructuring:()=>PQ,generateAutoImportDestructuring:()=>q7,extractBridgeData:()=>f5,extractAndStripCssImports:()=>w$});import S1 from"path";import x5 from"fs";function TQ($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function IQ($,Z){let Y=Z;while(!0){let J=S1.join(Y,"node_modules",$,"package.json");if(x5.existsSync(J))return S1.dirname(J);let X=S1.dirname(Y);if(X===Y)return null;Y=X}}function DQ($,Z){if(!$||typeof $!=="object")return null;let Y=(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 Y(X.import);if(typeof X.default==="object")return Y(X.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=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(!J||G.length>J.prefix.length)J={pattern:X,prefix:G,suffix:K}}if(J){let X=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=Y($[J.pattern]);if(Q)return Q.replace("*",X)}return null}function EQ($,Z){let Y=TQ($);if(!Y||!Y.subpath)return null;let J=IQ(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(x5.readFileSync(S1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=DQ(X.exports,Q);if(!G)return null;let K=S1.resolve(J,G);return x5.existsSync(K)?K:null}function w$($,Z){let Y=Z.filePath?S1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(MQ,(K,W)=>{let z;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(z=W.startsWith("/")?W:S1.resolve(Y,W),!x5.existsSync(z))throw Error(`file not found: ${z}`)}else{let q=null;try{q=Bun.resolveSync(W,J)}catch{q=EQ(W,J)}if(!q)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);z=q}}catch(q){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${Z.filePath||"<unknown>"}): ${q?.message||q}`),""}if(X.has(z))return"";X.add(z);try{let q=x5.readFileSync(z,"utf8");Q.push({source:W,resolvedPath:z,contents:q})}catch(q){console.warn(`[stx:vendor-css] could not read ${z}: ${q?.message||q}`)}return""}),styles:Q}}function kQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${kQ(Z.source)}" data-stx-layer="vendor">
654
+ `)}`:"";return console.warn(`[stx:bundler] error: ${w}${R}`),$}finally{try{v0.rmSync(q,{force:!0}),v0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var AQ=5,F9=1,O9,U7,L9;var x5=S(()=>{S1();P5();O9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];U7=new Map,L9=Symbol.for("stx.client-bundle-build-queue")});var M9={};a(M9,{renderVendorStyleTags:()=>R$,processClientScript:()=>h5,injectBrowserCoreAutoImports:()=>Y5,generateServerDataBridge:()=>N$,generateBrowserAutoImportDestructuring:()=>vQ,generateAutoImportDestructuring:()=>j7,extractBridgeData:()=>g5,extractAndStripCssImports:()=>A$});import y1 from"path";import f5 from"fs";function DQ($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function EQ($,Z){let Y=Z;while(!0){let J=y1.join(Y,"node_modules",$,"package.json");if(f5.existsSync(J))return y1.dirname(J);let X=y1.dirname(Y);if(X===Y)return null;Y=X}}function kQ($,Z){if(!$||typeof $!=="object")return null;let Y=(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 Y(X.import);if(typeof X.default==="object")return Y(X.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=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(!J||G.length>J.prefix.length)J={pattern:X,prefix:G,suffix:K}}if(J){let X=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=Y($[J.pattern]);if(Q)return Q.replace("*",X)}return null}function bQ($,Z){let Y=DQ($);if(!Y||!Y.subpath)return null;let J=EQ(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(f5.readFileSync(y1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=kQ(X.exports,Q);if(!G)return null;let K=y1.resolve(J,G);return f5.existsSync(K)?K:null}function A$($,Z){let Y=Z.filePath?y1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(IQ,(K,W)=>{let z;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(z=W.startsWith("/")?W:y1.resolve(Y,W),!f5.existsSync(z))throw Error(`file not found: ${z}`)}else{let q=null;try{q=Bun.resolveSync(W,J)}catch{q=bQ(W,J)}if(!q)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);z=q}}catch(q){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${Z.filePath||"<unknown>"}): ${q?.message||q}`),""}if(X.has(z))return"";X.add(z);try{let q=f5.readFileSync(z,"utf8");Q.push({source:W,resolvedPath:z,contents:q})}catch(q){console.warn(`[stx:vendor-css] could not read ${z}: ${q?.message||q}`)}return""}),styles:Q}}function SQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function R$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${SQ(Z.source)}" data-stx-layer="vendor">
655
655
  @layer vendor {
656
656
  ${Z.contents}
657
657
  }
658
658
  </style>`}).join(`
659
659
  `)}
660
- `}function Z5($){let Z=new Set;for(let X of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let Q of X[1].split(",")){let G=Q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(G)Z.add(G)}let Y=new Set;for(let X of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(X[1]);for(let X of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Q of X[1].split(",")){let G=Q.trim().split(/[:=]/).pop()?.trim();if(G)Y.add(G)}let J=A9.filter((X)=>{if(Z.has(X)||Y.has(X))return!1;return new RegExp(`\\b${X}\\b`).test($)});if(J.length===0)return{code:$,imports:J};return{code:`import { ${J.join(", ")} } from '@stacksjs/browser'
661
- ${$}`,imports:J}}function yQ($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=Y.exec($))!==null)if(!SQ.has(J[1]))Z.add(J[1]);return Array.from(Z)}function R9($){let Z=new Set,Y=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let 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 W=G[1],z=G[2];if(G[0].includes("import type"))continue;W.split(",").map((U)=>U.trim().split(/\s+as\s+/)[0]).filter((U)=>U.length>0).forEach((U)=>{if(X.add(U),z==="stx"||z==="@stacksjs/stx")Z.add(U);else Y.add(U)}),J=J.replace(G[0],"// [auto-import processed]")}for(let W of bQ){if(X.has(W))continue;if(new RegExp(`\\b${W}\\s*\\(`,"g").test(J))Z.add(W)}for(let W of A9){if(X.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(J))Y.add(W)}let K=yQ(J);for(let W of K)if(!X.has(W))Y.add(W);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function q7($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
660
+ `}function Y5($){let Z=new Set;for(let X of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let Q of X[1].split(",")){let G=Q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(G)Z.add(G)}let Y=new Set;for(let X of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(X[1]);for(let X of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Q of X[1].split(",")){let G=Q.trim().split(/[:=]/).pop()?.trim();if(G)Y.add(G)}let J=R9.filter((X)=>{if(Z.has(X)||Y.has(X))return!1;return new RegExp(`\\b${X}\\b`).test($)});if(J.length===0)return{code:$,imports:J};return{code:`import { ${J.join(", ")} } from '@stacksjs/browser'
661
+ ${$}`,imports:J}}function CQ($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=Y.exec($))!==null)if(!PQ.has(J[1]))Z.add(J[1]);return Array.from(Z)}function N9($){let Z=new Set,Y=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let 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 W=G[1],z=G[2];if(G[0].includes("import type"))continue;W.split(",").map((U)=>U.trim().split(/\s+as\s+/)[0]).filter((U)=>U.length>0).forEach((U)=>{if(X.add(U),z==="stx"||z==="@stacksjs/stx")Z.add(U);else Y.add(U)}),J=J.replace(G[0],"// [auto-import processed]")}for(let W of yQ){if(X.has(W))continue;if(new RegExp(`\\b${W}\\s*\\(`,"g").test(J))Z.add(W)}for(let W of R9){if(X.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(J))Y.add(W)}let K=CQ(J);for(let W of K)if(!X.has(W))Y.add(W);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function j7($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
662
662
  ${Y.join(`
663
663
  `)}
664
- ${CQ($,Z)}`;return""}function PQ($,Z=[]){let{browserImports:Y}=R9($),J=new Set(Z);return q7([],Y.filter((X)=>!J.has(X)))}function CQ($,Z){let Y=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
664
+ ${xQ($,Z)}`;return""}function vQ($,Z=[]){let{browserImports:Y}=N9($),J=new Set(Z);return j7([],Y.filter((X)=>!J.has(X)))}function xQ($,Z){let Y=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
665
665
  [${Y.join(", ")}].forEach(function (e) {
666
666
  if (e[1] !== 'undefined') return;
667
667
  console.error(
@@ -670,10 +670,10 @@ ${CQ($,Z)}`;return""}function PQ($,Z=[]){let{browserImports:Y}=R9($),J=new Set(Z
670
670
  + 'or it should be imported from a relative path so the bundler includes it.'
671
671
  );
672
672
  });
673
- `}function f5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function V9($,Z){let Y=new Set;for(let J of $.split(",")){let X=J.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))Y.add(X)}return Y}function vQ($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(V9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(V9(Y[1],!1).has(Z))return!0;return!1}function R$($,Z){if(!Z)return"";let Y=[];for(let[J,X]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(J))continue;if(!new RegExp(`\\b${J}\\b`).test($))continue;if(vQ($,J))continue;let Q;try{Q=JSON.stringify(X)}catch{continue}if(Q===void 0)continue;Y.push(` var ${J} = ${Q.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
673
+ `}function g5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function w9($,Z){let Y=new Set;for(let J of $.split(",")){let X=J.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))Y.add(X)}return Y}function fQ($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(w9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(w9(Y[1],!1).has(Z))return!0;return!1}function N$($,Z){if(!Z)return"";let Y=[];for(let[J,X]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(J))continue;if(!new RegExp(`\\b${J}\\b`).test($))continue;if(fQ($,J))continue;let Q;try{Q=JSON.stringify(X)}catch{continue}if(Q===void 0)continue;Y.push(` var ${J} = ${Q.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
674
674
  ${Y.join(`
675
675
  `)}
676
- `}function fQ($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=xQ[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function gQ($,Z){let{elementId:Y,event:J,handler:X,modifiers:Q}=$,G=fQ(Q),K=[];if(Q.once)K.push("once: true");if(Q.capture)K.push("capture: true");if(Q.passive)K.push("passive: true");let W=K.length>0?`, { ${K.join(", ")} }`:"",z="";if(G)z+=`${G}; `;let q=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
676
+ `}function hQ($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=gQ[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function dQ($,Z){let{elementId:Y,event:J,handler:X,modifiers:Q}=$,G=hQ(Q),K=[];if(Q.once)K.push("once: true");if(Q.capture)K.push("capture: true");if(Q.passive)K.push("passive: true");let W=K.length>0?`, { ${K.join(", ")} }`:"",z="";if(G)z+=`${G}; `;let q=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
677
677
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
678
678
  };`;function j(_){if(/\$emit\s*\(/.test(_))return`${U}
679
679
  ${_}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -716,11 +716,11 @@ else {
716
716
  else {
717
717
  ${X}
718
718
  }
719
- }${W})`}function hQ($){if($.length===0)return"";return`
719
+ }${W})`}function uQ($){if($.length===0)return"";return`
720
720
  // STX: auto-generated event bindings
721
- ${$.map((Y,J)=>gQ(Y,J)).join(`
722
- `)}`}function w9($){let Z=[],Y=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),X=0,Q=J.length,G=0;while(G<Q){let K=J[G];if(K==="'"||K==='"'||K==="`"){let W=K;if(G++,W==="`"){let z=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&z===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){z++,G+=2;continue}if(J[G]==="}"&&z>0){z--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===W){G++;break}G++}continue}if(K==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
723
- `)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let W=J.slice(G),z=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(z){let j=z[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=z[0].length;continue}let q=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(q){q[1].split(",").forEach((j)=>{let _=j.trim(),B=_.indexOf(":"),H=B>=0?_.slice(B+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=q[0].length;continue}let U=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let j=U[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=U[0].length;continue}}G++}return Z}function uQ($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(j){let _;while((_=Y.exec(j))!==null){let B=_[0];if(!dQ.has(B))Z.add(B)}}let X=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=X.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let z=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)J(Q[1]);let q=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);return Z}async function g5($,Z={}){let Y=$,J="",X=!1,Q=[],G=w$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=A$(G.styles),W=Z5(Y);Y=W.code,Q=W.imports;let{hasUserImports:z,bundleClientScript:q}=await Promise.resolve().then(() => (v5(),C5));if(z(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let O=R9(Y);Y=O.code,J=q7(O.stxImports,O.browserImports.filter((F)=>!Q.includes(F)))}if(J=`${R$(Y,Z.serverData)}${J}`,Y=s0(Y),!X&&y1(Z.attrs||""))Y=P1(Y);let U=hQ(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let O=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${F}>
721
+ ${$.map((Y,J)=>dQ(Y,J)).join(`
722
+ `)}`}function A9($){let Z=[],Y=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),X=0,Q=J.length,G=0;while(G<Q){let K=J[G];if(K==="'"||K==='"'||K==="`"){let W=K;if(G++,W==="`"){let z=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&z===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){z++,G+=2;continue}if(J[G]==="}"&&z>0){z--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===W){G++;break}G++}continue}if(K==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
723
+ `)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let W=J.slice(G),z=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(z){let j=z[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=z[0].length;continue}let q=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(q){q[1].split(",").forEach((j)=>{let _=j.trim(),B=_.indexOf(":"),H=B>=0?_.slice(B+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=q[0].length;continue}let U=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let j=U[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=U[0].length;continue}}G++}return Z}function pQ($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(j){let _;while((_=Y.exec(j))!==null){let B=_[0];if(!mQ.has(B))Z.add(B)}}let X=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=X.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let z=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)J(Q[1]);let q=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);return Z}async function h5($,Z={}){let Y=$,J="",X=!1,Q=[],G=A$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=R$(G.styles),W=Y5(Y);Y=W.code,Q=W.imports;let{hasUserImports:z,bundleClientScript:q}=await Promise.resolve().then(() => (x5(),v5));if(z(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let O=N9(Y);Y=O.code,J=j7(O.stxImports,O.browserImports.filter((F)=>!Q.includes(F)))}if(J=`${N$(Y,Z.serverData)}${J}`,Y=s0(Y),!X&&P1(Z.attrs||""))Y=C1(Y);let U=uQ(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let O=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${F}>
724
724
  ${J}${Y}
725
725
  ${U}
726
726
  </script>`}let B=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|onMounted|onBeforeUnmount|onUnmounted|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),H=/function __stx_setup_/.test(Y),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(O){let F=O.length>0?`
@@ -729,12 +729,12 @@ window.stx.mount(function() {
729
729
  'use strict';
730
730
  ${J}${Y}
731
731
  ${U}${F}
732
- })</script>`}if(!L&&!H){if(B)return V(w9($));if(Z.templateContent){let O=w9($);if(O.length>0){let F=uQ(Z.templateContent);if(O.some((A)=>F.has(A)))return V(O)}}}return`${K}<script data-stx-scoped>
732
+ })</script>`}if(!L&&!H){if(B)return V(A9($));if(Z.templateContent){let O=A9($);if(O.length>0){let F=pQ(Z.templateContent);if(O.some((A)=>F.has(A)))return V(O)}}}return`${K}<script data-stx-scoped>
733
733
  ;(function() {
734
734
  'use strict';
735
735
  ${J}${Y}
736
736
  ${U}
737
- })()</script>`}var MQ,bQ,A9,SQ,xQ,dQ;var h5=S(()=>{M0();MQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;bQ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],A9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];SQ=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"]);xQ={left:0,middle:1,right:2};dQ=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function cQ($){let Z="",Y=null,J=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(J){J=!1;continue}if(Q==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&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===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function iQ($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(pQ.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&D9.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function nQ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!D9.has(J))continue;let X=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function N$($){let Z=$.trim(),Y=cQ(Z);iQ(Y,Z),nQ(Z);for(let J of I9)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!T9.allowBracketNotation&&lQ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function oQ($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||I9.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=U7(J);else Z[Y]=J}return Z}function U7($,Z=0){if(Z>=T9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>U7(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,X]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(X&&typeof X==="object")Y[J]=U7(X,Z+1);else Y[J]=X}return Y}function $0($,Z){try{let Y=oQ(Z),J=Object.keys(Y),X=Object.values(Y);return W0($,J)(...X)}catch{return}}function K0($){try{return N$($),!0}catch{return!1}}function T0($,Z){try{let Y=$0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function W0($,Z){let Y=N$($),J=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let z=0;z<Z.length;z++){let q=Z[z];if(!J.test(q))continue;if(E9.has(q))continue;X.push(z),Q.push(q)}let G=(z)=>Function(...Q,...z,`
737
+ })()</script>`}var IQ,yQ,R9,PQ,gQ,mQ;var d5=S(()=>{M0();IQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;yQ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],R9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];PQ=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"]);gQ={left:0,middle:1,right:2};mQ=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function nQ($){let Z="",Y=null,J=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(J){J=!1;continue}if(Q==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&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===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function oQ($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(cQ.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&E9.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function sQ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!E9.has(J))continue;let X=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function M$($){let Z=$.trim(),Y=nQ(Z);oQ(Y,Z),sQ(Z);for(let J of D9)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!I9.allowBracketNotation&&iQ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function rQ($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||D9.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=_7(J);else Z[Y]=J}return Z}function _7($,Z=0){if(Z>=I9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>_7(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,X]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(X&&typeof X==="object")Y[J]=_7(X,Z+1);else Y[J]=X}return Y}function $0($,Z){try{let Y=rQ(Z),J=Object.keys(Y),X=Object.values(Y);return W0($,J)(...X)}catch{return}}function K0($){try{return M$($),!0}catch{return!1}}function T0($,Z){try{let Y=$0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function W0($,Z){let Y=M$($),J=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let z=0;z<Z.length;z++){let q=Z[z];if(!J.test(q))continue;if(k9.has(q))continue;X.push(z),Q.push(q)}let G=(z)=>Function(...Q,...z,`
738
738
  'use strict';
739
739
  try {
740
740
  return ${Y};
@@ -745,7 +745,7 @@ catch (e) {
745
745
  }
746
746
  throw e;
747
747
  }
748
- `),K=G([]);if(Q.length===Z.length)return M9(K,Q,G);return M9((...z)=>{let q=Array(X.length);for(let U=0;U<X.length;U++)q[U]=z[X[U]];return K(...q)},Q,G,(z)=>{K=G(z)})}function M9($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...z)=>{for(let q=0;q<=8;q++)try{return G(...z)}catch(U){let j=U instanceof Error?U.message:"",_=Q.exec(j);if(!(U instanceof ReferenceError)||!_)return;let B=_[1];if(W.has(B)||E9.has(B))return;W.add(B),K.push(B),G=Y(K),J?.(K)}return}}function M$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var mQ,T9,I9,pQ,D9,lQ,E9;var w0=S(()=>{mQ={maxSanitizeDepth:10,allowBracketNotation:!1},T9={...mQ},I9=[/\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/],pQ=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"]),D9=new Set(["__proto__","constructor","prototype"]),lQ=/[\w)\]]\s*\[\s*['"]/;E9=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 T$($,Z){let Y=sQ++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return rQ.set(J,{type:$,expression:Z}),J}var sQ=0,rQ;var k9=S(()=>{rQ=new Map});function C9($,Z,Y,J){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)return-1;J.lastIndex=Y.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function O1($,Z){return C9($,Z,b9,S9)}function Y5($,Z){return C9($,Z,y9,P9)}function d5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function aQ($,Z){if($.startsWith("<!--",Z)){let Y=d5($,Z);return Y===-1?$.length:Y}for(let[Y,J]of[[b9,S9],[y9,P9]]){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)continue;J.lastIndex=Y.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function j7($,Z){let Y=[],J=0,X=$.length,Q=!1,G=null;while(J<X){let K=$[J];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;J++;continue}if(K!=="<"){J++;continue}let W=Z($,J);if(W>J){Y.push({start:J,end:W,token:$.slice(J,W)}),J=W;continue}let z=aQ($,J);if(z>J){J=z;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return Y}function Z1($,Z,Y){let J=j7($,Z);if(J.length===0)return{output:$,tokens:[]};let X=J.map((K)=>K.token),Q="",G=0;for(let K=0;K<J.length;K++){let W=J[K];Q+=$.slice(G,W.start),Q+=Y(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function L1($){let{output:Z,tokens:Y}=Z1($,O1,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function u5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var b9,S9,y9,P9;var C1=S(()=>{b9=/<script\b[^>]*>/iy,S9=/<\/script\s*>/ig,y9=/<style\b[^>]*>/iy,P9=/<\/style\s*>/ig});var d9={};a(d9,{usesSignalsInScript:()=>J5,unescapeHtml:()=>_7,registerFilters:()=>eQ,registerFilter:()=>f9,processExpressions:()=>F1,interpolateScriptsInTemplate:()=>ZG,interpolateScriptExpressions:()=>I$,getAllFilters:()=>g9,evaluateExpression:()=>c0,escapeHtml:()=>r0,defaultFilters:()=>p5,clearCustomFilters:()=>$G,applyFilters:()=>h9});function tQ($){let Z=v9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),v9.set($,Z)}return Z.lastIndex=0,Z}function f9($,Z){if($ in p5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);m5[$]=Z}function eQ($){for(let[Z,Y]of Object.entries($))f9(Z,Y)}function g9(){return{...p5,...m5}}function $G(){for(let $ of Object.keys(m5))delete m5[$]}function r0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function J5($){let{scripts:Z}=L1($);for(let Y of Z){let J=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let X=J[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 x9($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let z=0;z<J.length;z++){let q=J[z];if(!Q&&q==="`"){Q=!0,G=0;continue}if(Q){if(q==="`"&&G===0){Q=!1;continue}if(q==="$"&&J[z+1]==="{"){G++,z++,X+=" ";continue}if(q==="}"&&G>0){G--;continue}if(G>0){X+=q;continue}continue}X+=q}J=X;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,W;while((W=K.exec(J))!==null){let z=W[1];if(!J.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(z)&&!(z in Z))return!1}}return!0}function I$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=c0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=c0(X,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function ZG($,Z,Y={}){let{output:J,scripts:X}=L1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),z=G.search(/<\/script\s*>$/i);if(!K||!W||z===-1)return G;let q=K[1],U=K[2];if(/\bsrc\s*=/.test(q))return G;if(/\bdata-raw\b/.test(q))return G;if(/\btype\s*=\s*["']application\/json["']/.test(q))return G;if(Y.skipServer&&/\bserver\b/.test(q))return G;let j=I$(U,Z);return W[0]+j+G.slice(z)});return u5(J,Q)}function F1($,Z,Y,J){let X=$,Q=(j,_)=>{let B=Y5(j,_);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(j.slice(_,B))?-1:B},G=(j,_,B,H)=>{let L=B.length,{output:V,tokens:O}=Z1(j,_,(F,w)=>H(L+w));return B.push(...O),V},K=[];X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`);let W=[];X=G(X,O1,W,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`);let z=J?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||J5($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(j,_,B)=>{try{let H=c0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,B,j)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(j,_,B)=>{try{let H=c0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return T$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return T$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,B,j)}}),X=G(X,O1,W,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`),X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(j,_,B)=>{let H=_.trim();if(U.has(H))return j;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=H.match(V)?.[1],w=F&&((F in Z)||L.includes(F)),A=Boolean(F&&q.has(F)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(R),M=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let T=c0(_,Z);if(A)return j;if(z&&!x9(H,Z))return j;if(T===void 0&&Z.__stx_buildMode==="compile"&&!z)return T$("expr",H);return T!==void 0&&T!==null?r0(String(T)):""}catch(T){if(A)return j;if(z&&!x9(H,Z))return j;if(M)return j;let I=T instanceof Error?T.message:String(T);return q0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,B,j)}});for(let j=0;j<W.length;j++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${j}__-->`,()=>W[j]);for(let j=0;j<K.length;j++)X=X.replace(`<!--__STX_STYLE_${j}__-->`,()=>K[j]);return X}function h9($,Z,Y){if(!Z.trim())return $;let J=$,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=m5[G]||p5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(g9()).join(", ")}`);let W=[];if(X.startsWith(":")){let z=X.match(/^:([^|\s]+)/);if(z){let q=z[1].trim();try{let U=Number(q);W=[Number.isNaN(U)?q:U]}catch{W=[q]}X=X.substring(z[0].length).trim()}}else if(X.startsWith("(")){let z=1,q=1;while(z>0&&q<X.length){if(X[q]==="(")z++;if(X[q]===")")z--;q++}if(z===0){let U=X.substring(1,q-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[c0(`(${U})`,Y,!0)];else{let j=[],_="",B=null,H=0,L=0,V=0,O=!1;for(let F=0;F<U.length;F++){let w=U[F];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(B){if(_+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&H===0&&L===0&&V===0){j.push(_),_="";continue}_+=w}if(_)j.push(_);W=j.map((F)=>{let w=F.trim();return c0(w,Y,!0)})}}catch{W=[U]}X=X.substring(q).trim()}}try{J=K(J,Y,...W)}catch(z){let q=z instanceof Error?z.message:String(z);throw Error(`Error applying filter '${G}': ${q}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function YG($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],z=$[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,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&z==="{"){let q=1;K+=2;while(K<$.length&&q>0){if($[K]==="{")q++;else if($[K]==="}")q--;if(q>0)K++}continue}if(Z)continue;if(W==="(")J++;else if(W===")")J--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&J===0&&X===0&&Q===0){if(z==="|"){K++;continue}if(z==="="){K++;continue}return K}}return-1}function c0($,Z,Y=!1){try{let J=$.trim(),X=YG(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=c0(Q,Z,!0);return h9(K,G,Z)}if(!K0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return $0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return W0(J,Q)(...G)}catch{return $0(J,Z)}}catch(J){if(J instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(J.message);if(X){let Q=X[1],G=JG(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function JG($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=XG($,X);if(Y===null||Q<Y.dist)Y={key:X,dist:Q}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function XG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],X=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)X[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function _7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var m5,v9,p5;var Y1=S(()=>{w0();M0();k9();C1();m5={},v9=new Map;p5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return r0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;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(Y).forEach(([W,z])=>{K=K.replace(tQ(W),String(z))}),K},t:($,Z,Y={})=>{return p5.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=Y)return X;if(Y<=J.length)return J.substring(0,Y);return X.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="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(Y==="iso")return X.toISOString();return new Intl.DateTimeFormat(J,Q[Y]||Q.short).format(X)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(X)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let X=Number($);if(Number.isNaN(X))return Y;let Q=J||`${Y}s`;return X===1?Y: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 Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let X=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let X=10**Y;return Math.round(J*X)/X}}});function X5($="const",Z=[],Y){let J=Z.length?D$.filter((X)=>!Z.includes(X)):D$;if(Y!==void 0)J=J.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${J.join(", ")} } = window.stx;`}var D$,u9;var l5=S(()=>{D$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","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","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],u9=["onMount","onDestroy"]});class v1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function G5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!Q5.has(Y)){if(Q5.size>=QG){let J=Q5.keys().next().value;if(J)Q5.delete(J)}Q5.set(Y,new RegExp($,Z))}return Q5.get(Y)}class m9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let z=`${Y}:${W}`,q=X.get(z);if(!q){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}q=Function(...Z,`
748
+ `),K=G([]);if(Q.length===Z.length)return T9(K,Q,G);return T9((...z)=>{let q=Array(X.length);for(let U=0;U<X.length;U++)q[U]=z[X[U]];return K(...q)},Q,G,(z)=>{K=G(z)})}function T9($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...z)=>{for(let q=0;q<=8;q++)try{return G(...z)}catch(U){let j=U instanceof Error?U.message:"",_=Q.exec(j);if(!(U instanceof ReferenceError)||!_)return;let B=_[1];if(W.has(B)||k9.has(B))return;W.add(B),K.push(B),G=Y(K),J?.(K)}return}}function T$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var lQ,I9,D9,cQ,E9,iQ,k9;var w0=S(()=>{lQ={maxSanitizeDepth:10,allowBracketNotation:!1},I9={...lQ},D9=[/\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/],cQ=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"]),E9=new Set(["__proto__","constructor","prototype"]),iQ=/[\w)\]]\s*\[\s*['"]/;k9=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 I$($,Z){let Y=aQ++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return tQ.set(J,{type:$,expression:Z}),J}var aQ=0,tQ;var b9=S(()=>{tQ=new Map});function v9($,Z,Y,J){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)return-1;J.lastIndex=Y.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function L1($,Z){return v9($,Z,S9,y9)}function J5($,Z){return v9($,Z,P9,C9)}function u5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function eQ($,Z){if($.startsWith("<!--",Z)){let Y=u5($,Z);return Y===-1?$.length:Y}for(let[Y,J]of[[S9,y9],[P9,C9]]){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)continue;J.lastIndex=Y.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function B7($,Z){let Y=[],J=0,X=$.length,Q=!1,G=null;while(J<X){let K=$[J];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;J++;continue}if(K!=="<"){J++;continue}let W=Z($,J);if(W>J){Y.push({start:J,end:W,token:$.slice(J,W)}),J=W;continue}let z=eQ($,J);if(z>J){J=z;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return Y}function Y1($,Z,Y){let J=B7($,Z);if(J.length===0)return{output:$,tokens:[]};let X=J.map((K)=>K.token),Q="",G=0;for(let K=0;K<J.length;K++){let W=J[K];Q+=$.slice(G,W.start),Q+=Y(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function F1($){let{output:Z,tokens:Y}=Y1($,L1,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function m5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var S9,y9,P9,C9;var v1=S(()=>{S9=/<script\b[^>]*>/iy,y9=/<\/script\s*>/ig,P9=/<style\b[^>]*>/iy,C9=/<\/style\s*>/ig});var u9={};a(u9,{usesSignalsInScript:()=>X5,unescapeHtml:()=>H7,registerFilters:()=>ZG,registerFilter:()=>g9,processExpressions:()=>V1,interpolateScriptsInTemplate:()=>JG,interpolateScriptExpressions:()=>D$,getAllFilters:()=>h9,evaluateExpression:()=>c0,escapeHtml:()=>r0,defaultFilters:()=>l5,clearCustomFilters:()=>YG,applyFilters:()=>d9});function $G($){let Z=x9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),x9.set($,Z)}return Z.lastIndex=0,Z}function g9($,Z){if($ in l5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);p5[$]=Z}function ZG($){for(let[Z,Y]of Object.entries($))g9(Z,Y)}function h9(){return{...l5,...p5}}function YG(){for(let $ of Object.keys(p5))delete p5[$]}function r0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function X5($){let{scripts:Z}=F1($);for(let Y of Z){let J=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let X=J[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 f9($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let z=0;z<J.length;z++){let q=J[z];if(!Q&&q==="`"){Q=!0,G=0;continue}if(Q){if(q==="`"&&G===0){Q=!1;continue}if(q==="$"&&J[z+1]==="{"){G++,z++,X+=" ";continue}if(q==="}"&&G>0){G--;continue}if(G>0){X+=q;continue}continue}X+=q}J=X;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,W;while((W=K.exec(J))!==null){let z=W[1];if(!J.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(z)&&!(z in Z))return!1}}return!0}function D$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=c0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=c0(X,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function JG($,Z,Y={}){let{output:J,scripts:X}=F1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),z=G.search(/<\/script\s*>$/i);if(!K||!W||z===-1)return G;let q=K[1],U=K[2];if(/\bsrc\s*=/.test(q))return G;if(/\bdata-raw\b/.test(q))return G;if(/\btype\s*=\s*["']application\/json["']/.test(q))return G;if(Y.skipServer&&/\bserver\b/.test(q))return G;let j=D$(U,Z);return W[0]+j+G.slice(z)});return m5(J,Q)}function V1($,Z,Y,J){let X=$,Q=(j,_)=>{let B=J5(j,_);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(j.slice(_,B))?-1:B},G=(j,_,B,H)=>{let L=B.length,{output:V,tokens:O}=Y1(j,_,(F,w)=>H(L+w));return B.push(...O),V},K=[];X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`);let W=[];X=G(X,L1,W,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`);let z=J?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||X5($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(j,_,B)=>{try{let H=c0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,B,j)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(j,_,B)=>{try{let H=c0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return I$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return I$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,B,j)}}),X=G(X,L1,W,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`),X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(j,_,B)=>{let H=_.trim();if(U.has(H))return j;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=H.match(V)?.[1],w=F&&((F in Z)||L.includes(F)),A=Boolean(F&&q.has(F)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(R),M=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let T=c0(_,Z);if(A)return j;if(z&&!f9(H,Z))return j;if(T===void 0&&Z.__stx_buildMode==="compile"&&!z)return I$("expr",H);return T!==void 0&&T!==null?r0(String(T)):""}catch(T){if(A)return j;if(z&&!f9(H,Z))return j;if(M)return j;let I=T instanceof Error?T.message:String(T);return q0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,B,j)}});for(let j=0;j<W.length;j++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${j}__-->`,()=>W[j]);for(let j=0;j<K.length;j++)X=X.replace(`<!--__STX_STYLE_${j}__-->`,()=>K[j]);return X}function d9($,Z,Y){if(!Z.trim())return $;let J=$,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=p5[G]||l5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(h9()).join(", ")}`);let W=[];if(X.startsWith(":")){let z=X.match(/^:([^|\s]+)/);if(z){let q=z[1].trim();try{let U=Number(q);W=[Number.isNaN(U)?q:U]}catch{W=[q]}X=X.substring(z[0].length).trim()}}else if(X.startsWith("(")){let z=1,q=1;while(z>0&&q<X.length){if(X[q]==="(")z++;if(X[q]===")")z--;q++}if(z===0){let U=X.substring(1,q-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[c0(`(${U})`,Y,!0)];else{let j=[],_="",B=null,H=0,L=0,V=0,O=!1;for(let F=0;F<U.length;F++){let w=U[F];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(B){if(_+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&H===0&&L===0&&V===0){j.push(_),_="";continue}_+=w}if(_)j.push(_);W=j.map((F)=>{let w=F.trim();return c0(w,Y,!0)})}}catch{W=[U]}X=X.substring(q).trim()}}try{J=K(J,Y,...W)}catch(z){let q=z instanceof Error?z.message:String(z);throw Error(`Error applying filter '${G}': ${q}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function XG($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],z=$[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,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&z==="{"){let q=1;K+=2;while(K<$.length&&q>0){if($[K]==="{")q++;else if($[K]==="}")q--;if(q>0)K++}continue}if(Z)continue;if(W==="(")J++;else if(W===")")J--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&J===0&&X===0&&Q===0){if(z==="|"){K++;continue}if(z==="="){K++;continue}return K}}return-1}function c0($,Z,Y=!1){try{let J=$.trim(),X=XG(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=c0(Q,Z,!0);return d9(K,G,Z)}if(!K0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return $0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return W0(J,Q)(...G)}catch{return $0(J,Z)}}catch(J){if(J instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(J.message);if(X){let Q=X[1],G=QG(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function QG($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=GG($,X);if(Y===null||Q<Y.dist)Y={key:X,dist:Q}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function GG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],X=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)X[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function H7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var p5,x9,l5;var J1=S(()=>{w0();M0();b9();v1();p5={},x9=new Map;l5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return r0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;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(Y).forEach(([W,z])=>{K=K.replace($G(W),String(z))}),K},t:($,Z,Y={})=>{return l5.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=Y)return X;if(Y<=J.length)return J.substring(0,Y);return X.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="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(Y==="iso")return X.toISOString();return new Intl.DateTimeFormat(J,Q[Y]||Q.short).format(X)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(X)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let X=Number($);if(Number.isNaN(X))return Y;let Q=J||`${Y}s`;return X===1?Y: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 Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let X=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let X=10**Y;return Math.round(J*X)/X}}});function Q5($="const",Z=[],Y){let J=Z.length?E$.filter((X)=>!Z.includes(X)):E$;if(Y!==void 0)J=J.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${J.join(", ")} } = window.stx;`}var E$,m9;var c5=S(()=>{E$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","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","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],m9=["onMount","onDestroy"]});class x1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function K5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!G5.has(Y)){if(G5.size>=KG){let J=G5.keys().next().value;if(J)G5.delete(J)}G5.set(Y,new RegExp($,Z))}return G5.get(Y)}class p9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let z=`${Y}:${W}`,q=X.get(z);if(!q){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}q=Function(...Z,`
749
749
  'use strict';
750
750
  try {
751
751
  return ${W};
@@ -756,33 +756,33 @@ catch (e) {
756
756
  }
757
757
  throw e;
758
758
  }
759
- `),X.set(z,q)}return q(...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 p9{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,X=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,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 (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let Z={};for(let[Y,J]of this.metrics.entries()){let X=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:X?.maxTime,budgetUtilization:X?J.totalTime/J.count/X.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function GG(){if(!B7)B7=new p9;return B7}var Q5,QG=500,aB,B7=null,l9;var K5=S(()=>{Q5=new Map;aB=new m9;l9=new Proxy({},{get($,Z){return GG()[Z]}})});function c9($,Z=""){let Y=`${$}${Z}`,J=0;for(let X=0;X<Y.length;X++){let Q=Y.charCodeAt(X);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function i9($,Z,Y={}){let{prefix:J="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=H7($),W=[],z=new Map;if(Q)for(let q of K){let U=q.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let j=U[1],_=`${Z}_${j}`;z.set(j,_)}}for(let q of K){let U=n9(q,Z,J,X,z,G);W.push(U)}return W.join(`
759
+ `),X.set(z,q)}return q(...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 l9{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,X=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,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 (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let Z={};for(let[Y,J]of this.metrics.entries()){let X=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:X?.maxTime,budgetUtilization:X?J.totalTime/J.count/X.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function WG(){if(!O7)O7=new l9;return O7}var G5,KG=500,$H,O7=null,c9;var W5=S(()=>{G5=new Map;$H=new p9;c9=new Proxy({},{get($,Z){return WG()[Z]}})});function i9($,Z=""){let Y=`${$}${Z}`,J=0;for(let X=0;X<Y.length;X++){let Q=Y.charCodeAt(X);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function n9($,Z,Y={}){let{prefix:J="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=L7($),W=[],z=new Map;if(Q)for(let q of K){let U=q.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let j=U[1],_=`${Z}_${j}`;z.set(j,_)}}for(let q of K){let U=o9(q,Z,J,X,z,G);W.push(U)}return W.join(`
760
760
 
761
- `)}function H7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,X="",Q=!1,G="";for(let K=0;K<Y.length;K++){let W=Y[K];if(W==="@"&&J===0)Q=!0;if(W==="{")J++;else if(W==="}"){if(J--,J===0){if(Q){G+=W;let z=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(z){let[,q,U,j]=z;if(q==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:j.trim()});else if(q==="media"||q==="supports"||q==="container"){let _=H7(j);Z.push({selector:`@${q} ${U.trim()}`,declarations:_.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
762
- `)})}else Z.push({selector:`@${q} ${U.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(X.trim()){X+=W;let z=X.match(/([^{]+)\{([^}]*)\}/);if(z)Z.push({selector:z[1].trim(),declarations:z[2].trim()});X=""}continue}}if(Q)G+=W;else X+=W}return Z}function n9($,Z,Y,J,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let q=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(q)||q} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=H7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>n9(j,Z,Y,J,X,Q)).join(`
761
+ `)}function L7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,X="",Q=!1,G="";for(let K=0;K<Y.length;K++){let W=Y[K];if(W==="@"&&J===0)Q=!0;if(W==="{")J++;else if(W==="}"){if(J--,J===0){if(Q){G+=W;let z=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(z){let[,q,U,j]=z;if(q==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:j.trim()});else if(q==="media"||q==="supports"||q==="container"){let _=L7(j);Z.push({selector:`@${q} ${U.trim()}`,declarations:_.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
762
+ `)})}else Z.push({selector:`@${q} ${U.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(X.trim()){X+=W;let z=X.match(/([^{]+)\{([^}]*)\}/);if(z)Z.push({selector:z[1].trim(),declarations:z[2].trim()});X=""}continue}}if(Q)G+=W;else X+=W}return Z}function o9($,Z,Y,J,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let q=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(q)||q} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=L7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>o9(j,Z,Y,J,X,Q)).join(`
763
763
  `);return`${G} {
764
764
  ${U}
765
- }`}return`${G} { ${K} }`}let W=KG(G,Z,Y,J),z=K;for(let[q,U]of X)z=z.replace(new RegExp(`\\b${q}\\b`,"g"),U);if(Q)z=z.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${z} }`}function KG($,Z,Y,J){let X=$.split(",").map((G)=>G.trim()),Q=[];for(let G of X){if(G.startsWith(":host")){if(J)Q.push(G);else{let z=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(z)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let W=WG(G,Z);if(W)Q.push(Y?`${Y} ${W}`:W)}return Q.join(", ")}function WG($,Z){let Y=0,J=$.length;for(let W=0;W<$.length;W++){let z=$[W];if(z==="["||z==="(")Y++;else if(z==="]"||z===")")Y--;else if(Y===0&&(z===" "||z===">"||z==="+"||z==="~")){J=W;break}}let X=$.slice(0,J),Q=$.slice(J);if(!X)return"";let G=X.length,K=0;for(let W=0;W<X.length;W++){let z=X[W];if(z==="["||z==="(")K++;else if(z==="]"||z===")")K--;else if(Y===0&&K===0&&z===":"){G=W;break}}return`${X.slice(0,G)}.${Z}${X.slice(G)}${Q}`}function s9($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let J=Y.trim();if(Z.has(J))return"";return Z.add(J),Y})}function E$($,Z){if(!zG.test($))return{html:$,hasScoped:!1};let Y=c9(Z),J=`data-v-${Y}`,X=$,Q=new RegExp(`<style\\s+([^>]*${O7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,W,z)=>{G=!0;let q=qG(z,J),U=W.replace(new RegExp(O7,"gi"),"").trim(),j=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${j}>${q}</style>`}),!G)return{html:$,hasScoped:!1};return X=jG(X,J),{html:X,hasScoped:!0}}function qG($,Z){return i9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function jG($,Z){let Y=Z1($,(X,Q)=>{let G=O1(X,Q);return G>Q?G:Y5(X,Q)},(X,Q)=>UG(Q)),J=_G(Y.output,Z);return o9.lastIndex=0,J.replace(o9,(X,Q)=>Y.tokens[Number(Q)])}function _G($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,X,Q)=>{if(Y.has(X.toLowerCase()))return J;if(J.includes(Z))return J;if(X.toLowerCase()==="style"||X.toLowerCase()==="script")return J;if(Q)return J.replace(`<${X}${Q}`,`<${X} ${Z}${Q}`);if(J.endsWith("/>"))return`<${X} ${Z} />`;return`<${X} ${Z}>`})}var O7,zG,UG=($)=>`\x00stx-scope-mask-${$}\x00`,o9;var L7=S(()=>{C1();O7=String.raw`(?<![\w-])scoped(?![\w-])`,zG=new RegExp(`<style\\s+[^>]*${O7}`,"i");o9=/\u0000stx-scope-mask-(\d+)\u0000/g});function HG($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return BG.test(Z)}function k$($){c5.lastIndex=0;let Z;while((Z=c5.exec($))!==null){if(Z[0].startsWith("</")||HG(Z[0]))continue;let Y=Z.index,J=c5.lastIndex,X=1,Q;while((Q=c5.exec($))!==null)if(Q[0].startsWith("</")){if(X--,X===0){let G=Q.index;return{start:Y,openEnd:J,closeStart:G,end:c5.lastIndex,content:$.slice(J,G)}}}else X++;return null}return null}var c5,BG;var F7=S(()=>{c5=/<\/?template\b[^>]*>/gi,BG=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var r9=()=>{};function x0($,Z,Y,J=0){let X=0,Q=J,G=null,K=0,W=!1;while(Q<$.length){let z=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&z==="\\"){W=!0,Q++;continue}if(W=!1,(z==='"'||z==="'"||z==="`")&&!G){G=z,Q++;continue}if(z===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&z==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&z==="}"){K--,Q++;continue}if(z==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(z===Z)X++;else if(z===Y){if(X--,X===0)return Q}Q++}return-1}var A7={};a(A7,{useTitle:()=>wG,useSeoMeta:()=>a9,usePageTitle:()=>wG,useHead:()=>w7,seoMetaToHeadConfig:()=>S$,resetHead:()=>FG,renderHtmlAttrs:()=>RG,renderHead:()=>AG,renderBodyAttrs:()=>NG,processTitleDirective:()=>IG,processMetaDirective:()=>DG,processHeadDirective:()=>TG,mergeHeadConfigs:()=>W5,getPageMeta:()=>LG,getHead:()=>V7,definePageMeta:()=>VG,applyHead:()=>MG});function V7(){return V1}function LG(){return b$}function FG(){V1={},OG.length=0,b$={}}function w7($){V1=W5(V1,$)}function W5($,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 a9($){w7(S$($))}function S$($){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 Y=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(J)Z.push({property:"og:description",content:J});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let 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 VG($){if(b$={...b$,...$},$.title||$.description)a9({title:$.title,description:$.description})}function wG($){let Z=typeof $==="function"?$():$;w7({title:Z})}function AG($=V1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${x1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,X])=>`${J}="${x1(X)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>{return`${X==="httpEquiv"?"http-equiv":X}="${x1(String(Q))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>`${X}="${x1(String(Q))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...X}=Y,Q=Object.entries(X).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${x1(String(K))}"`}).filter(Boolean).join(" ");if(J)Z.push(`<script ${Q}>${J}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let J=Y.type?` type="${Y.type}"`:"";Z.push(`<style${J}>${Y.content}</style>`)}return Z.join(`
766
- `)}function RG($=V1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${x1(Y)}"`).join(" ")}function NG($=V1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${x1(Y)}"`).join(" ")}function x1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function MG($=V1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),Z.name)J.setAttribute("name",Z.name);if(Z.property)J.setAttribute("property",Z.property);document.head.appendChild(J)}J.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[X,Q]of Object.entries(Z))if(Q!==void 0)J.setAttribute(X,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function TG($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,X)=>{return Z+=X.trim()+`
767
- `,""}),headContent:Z.trim()}}function IG($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,X,Q)=>{let G=J?X:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=W5(K,{title:G}),""})}function DG($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,X,Q,G,K)=>{let W=Q?G:K,z=Q?W:Z[(W||"").trim()]??W,U=X.includes(":")?{property:X,content:z}:{name:X,content:z},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=W5(j,{meta:[U]}),""})}var V1,OG,b$;var i5=S(()=>{V1={},OG=[],b$={}});var y$={};a(y$,{stripTypeScript:()=>Y8,splitDeclaration:()=>G8,isCompleteImport:()=>J8,hasVariables:()=>z8,extractVariables:()=>f1,extractScriptFromTemplate:()=>W8,convertToCommonJS:()=>N7});import z5 from"path";import n5 from"process";function EG($){let Z=[],Y=0,J=$.split(`
768
- `);for(let X of J){let Q=Y,G=null,K=!1;for(let W=0;W<X.length;W++){let z=X[W];if(K){K=!1;continue}if(z==="\\"){K=!0;continue}if(G){if(z===G)G=null;continue}if(z==="'"||z==='"'||z==="`"){G=z;continue}if(z==="/"&&W+1<X.length&&X[W+1]==="/")break;if(z==="{")Y++;else if(z==="}")Y--}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 z=X.match(/(?:const|let|var)\s+(\w+)/);if(z)Z.push(z[1])}else{let z=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(z){let U=z[1].slice(1,-1).split(",").map((j)=>{let _=j.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...U)}}}}return[...new Set(Z)]}function Y8($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(J){if(!J.includes(":"))return J;let X=[],Q="",G=0,K=0,W=null;for(let z=0;z<J.length;z++){let q=J[z];if(W){if(Q+=q,q===W)W=null;continue}if(q==='"'||q==="'"||q==="`"){W=q,Q+=q;continue}if(q==="<")G++;else if(q===">"&&G>0)G--;else if(q==="(")K++;else if(q===")")K--;if(q===","&&G===0&&K===0){X.push(Q),Q="";continue}Q+=q}if(Q)X.push(Q);return X.map((z)=>{let q=z.trim(),U=q.startsWith("..."),j=U?q.slice(3):q,_=-1,B=0;for(let A=0;A<j.length;A++)if(j[A]==="<")B++;else if(j[A]===">")B--;else if(j[A]===":"&&B===0){_=A;break}if(_===-1)return z;let L=j.substring(0,_).trim().replace(/\?$/,""),V=j.substring(_+1),O=-1,F=0;for(let A=0;A<V.length;A++)if(V[A]==="<")F++;else if(V[A]===">")F--;else if(V[A]==="="&&F===0){O=A;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${V.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,X,Q)=>{if(!Q.includes(":"))return J;return`${X}(${Y(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,X,Q=[];while((X=J.exec(Z))!==null){let G=X.index+X[0].length-1,K=1,W=G+1,z=0,q=null;while(W<Z.length&&K>0){let _=Z[W];if(q){if(_===q)q=null;W++;continue}if(_==='"'||_==="'"||_==="`"){q=_,W++;continue}if(_==="<")z++;else if(_===">"&&z>0)z--;else if(z===0){if(_==="(")K++;else if(_===")")K--}if(K>0)W++}if(K!==0)continue;let U=Z.substring(G+1,W);if(!U.includes(":"))continue;let j=Y(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:z}=Q[G];Z=Z.substring(0,K)+z+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,X)=>{if(!X.includes(":"))return J;if(X.includes("{")||X.includes("}"))return J;return`(${X.split(",").map((G)=>{let[K,...W]=G.split("="),z=K.split(":")[0].trim();if(W.length>0)return`${z} = ${W.join("=").trim()}`;return z}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
765
+ }`}return`${G} { ${K} }`}let W=zG(G,Z,Y,J),z=K;for(let[q,U]of X)z=z.replace(new RegExp(`\\b${q}\\b`,"g"),U);if(Q)z=z.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${z} }`}function zG($,Z,Y,J){let X=$.split(",").map((G)=>G.trim()),Q=[];for(let G of X){if(G.startsWith(":host")){if(J)Q.push(G);else{let z=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(z)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let W=qG(G,Z);if(W)Q.push(Y?`${Y} ${W}`:W)}return Q.join(", ")}function qG($,Z){let Y=0,J=$.length;for(let W=0;W<$.length;W++){let z=$[W];if(z==="["||z==="(")Y++;else if(z==="]"||z===")")Y--;else if(Y===0&&(z===" "||z===">"||z==="+"||z==="~")){J=W;break}}let X=$.slice(0,J),Q=$.slice(J);if(!X)return"";let G=X.length,K=0;for(let W=0;W<X.length;W++){let z=X[W];if(z==="["||z==="(")K++;else if(z==="]"||z===")")K--;else if(Y===0&&K===0&&z===":"){G=W;break}}return`${X.slice(0,G)}.${Z}${X.slice(G)}${Q}`}function r9($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let J=Y.trim();if(Z.has(J))return"";return Z.add(J),Y})}function k$($,Z){if(!UG.test($))return{html:$,hasScoped:!1};let Y=i9(Z),J=`data-v-${Y}`,X=$,Q=new RegExp(`<style\\s+([^>]*${F7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,W,z)=>{G=!0;let q=jG(z,J),U=W.replace(new RegExp(F7,"gi"),"").trim(),j=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${j}>${q}</style>`}),!G)return{html:$,hasScoped:!1};return X=BG(X,J),{html:X,hasScoped:!0}}function jG($,Z){return n9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function BG($,Z){let Y=Y1($,(X,Q)=>{let G=L1(X,Q);return G>Q?G:J5(X,Q)},(X,Q)=>_G(Q)),J=HG(Y.output,Z);return s9.lastIndex=0,J.replace(s9,(X,Q)=>Y.tokens[Number(Q)])}function HG($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,X,Q)=>{if(Y.has(X.toLowerCase()))return J;if(J.includes(Z))return J;if(X.toLowerCase()==="style"||X.toLowerCase()==="script")return J;if(Q)return J.replace(`<${X}${Q}`,`<${X} ${Z}${Q}`);if(J.endsWith("/>"))return`<${X} ${Z} />`;return`<${X} ${Z}>`})}var F7,UG,_G=($)=>`\x00stx-scope-mask-${$}\x00`,s9;var V7=S(()=>{v1();F7=String.raw`(?<![\w-])scoped(?![\w-])`,UG=new RegExp(`<style\\s+[^>]*${F7}`,"i");s9=/\u0000stx-scope-mask-(\d+)\u0000/g});function LG($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return OG.test(Z)}function b$($){i5.lastIndex=0;let Z;while((Z=i5.exec($))!==null){if(Z[0].startsWith("</")||LG(Z[0]))continue;let Y=Z.index,J=i5.lastIndex,X=1,Q;while((Q=i5.exec($))!==null)if(Q[0].startsWith("</")){if(X--,X===0){let G=Q.index;return{start:Y,openEnd:J,closeStart:G,end:i5.lastIndex,content:$.slice(J,G)}}}else X++;return null}return null}var i5,OG;var w7=S(()=>{i5=/<\/?template\b[^>]*>/gi,OG=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var a9=()=>{};function x0($,Z,Y,J=0){let X=0,Q=J,G=null,K=0,W=!1;while(Q<$.length){let z=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&z==="\\"){W=!0,Q++;continue}if(W=!1,(z==='"'||z==="'"||z==="`")&&!G){G=z,Q++;continue}if(z===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&z==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&z==="}"){K--,Q++;continue}if(z==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(z===Z)X++;else if(z===Y){if(X--,X===0)return Q}Q++}return-1}var N7={};a(N7,{useTitle:()=>RG,useSeoMeta:()=>t9,usePageTitle:()=>RG,useHead:()=>R7,seoMetaToHeadConfig:()=>y$,resetHead:()=>wG,renderHtmlAttrs:()=>MG,renderHead:()=>NG,renderBodyAttrs:()=>TG,processTitleDirective:()=>EG,processMetaDirective:()=>kG,processHeadDirective:()=>DG,mergeHeadConfigs:()=>z5,getPageMeta:()=>VG,getHead:()=>A7,definePageMeta:()=>AG,applyHead:()=>IG});function A7(){return w1}function VG(){return S$}function wG(){w1={},FG.length=0,S$={}}function R7($){w1=z5(w1,$)}function z5($,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 t9($){R7(y$($))}function y$($){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 Y=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(J)Z.push({property:"og:description",content:J});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let 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 AG($){if(S$={...S$,...$},$.title||$.description)t9({title:$.title,description:$.description})}function RG($){let Z=typeof $==="function"?$():$;R7({title:Z})}function NG($=w1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${f1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,X])=>`${J}="${f1(X)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>{return`${X==="httpEquiv"?"http-equiv":X}="${f1(String(Q))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>`${X}="${f1(String(Q))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...X}=Y,Q=Object.entries(X).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${f1(String(K))}"`}).filter(Boolean).join(" ");if(J)Z.push(`<script ${Q}>${J}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let J=Y.type?` type="${Y.type}"`:"";Z.push(`<style${J}>${Y.content}</style>`)}return Z.join(`
766
+ `)}function MG($=w1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${f1(Y)}"`).join(" ")}function TG($=w1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${f1(Y)}"`).join(" ")}function f1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function IG($=w1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),Z.name)J.setAttribute("name",Z.name);if(Z.property)J.setAttribute("property",Z.property);document.head.appendChild(J)}J.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[X,Q]of Object.entries(Z))if(Q!==void 0)J.setAttribute(X,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function DG($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,X)=>{return Z+=X.trim()+`
767
+ `,""}),headContent:Z.trim()}}function EG($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,X,Q)=>{let G=J?X:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=z5(K,{title:G}),""})}function kG($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,X,Q,G,K)=>{let W=Q?G:K,z=Q?W:Z[(W||"").trim()]??W,U=X.includes(":")?{property:X,content:z}:{name:X,content:z},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=z5(j,{meta:[U]}),""})}var w1,FG,S$;var n5=S(()=>{w1={},FG=[],S$={}});var P$={};a(P$,{stripTypeScript:()=>J8,splitDeclaration:()=>K8,isCompleteImport:()=>X8,hasVariables:()=>q8,extractVariables:()=>g1,extractScriptFromTemplate:()=>z8,convertToCommonJS:()=>T7});import q5 from"path";import o5 from"process";function bG($){let Z=[],Y=0,J=$.split(`
768
+ `);for(let X of J){let Q=Y,G=null,K=!1;for(let W=0;W<X.length;W++){let z=X[W];if(K){K=!1;continue}if(z==="\\"){K=!0;continue}if(G){if(z===G)G=null;continue}if(z==="'"||z==='"'||z==="`"){G=z;continue}if(z==="/"&&W+1<X.length&&X[W+1]==="/")break;if(z==="{")Y++;else if(z==="}")Y--}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 z=X.match(/(?:const|let|var)\s+(\w+)/);if(z)Z.push(z[1])}else{let z=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(z){let U=z[1].slice(1,-1).split(",").map((j)=>{let _=j.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...U)}}}}return[...new Set(Z)]}function J8($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(J){if(!J.includes(":"))return J;let X=[],Q="",G=0,K=0,W=null;for(let z=0;z<J.length;z++){let q=J[z];if(W){if(Q+=q,q===W)W=null;continue}if(q==='"'||q==="'"||q==="`"){W=q,Q+=q;continue}if(q==="<")G++;else if(q===">"&&G>0)G--;else if(q==="(")K++;else if(q===")")K--;if(q===","&&G===0&&K===0){X.push(Q),Q="";continue}Q+=q}if(Q)X.push(Q);return X.map((z)=>{let q=z.trim(),U=q.startsWith("..."),j=U?q.slice(3):q,_=-1,B=0;for(let A=0;A<j.length;A++)if(j[A]==="<")B++;else if(j[A]===">")B--;else if(j[A]===":"&&B===0){_=A;break}if(_===-1)return z;let L=j.substring(0,_).trim().replace(/\?$/,""),V=j.substring(_+1),O=-1,F=0;for(let A=0;A<V.length;A++)if(V[A]==="<")F++;else if(V[A]===">")F--;else if(V[A]==="="&&F===0){O=A;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${V.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,X,Q)=>{if(!Q.includes(":"))return J;return`${X}(${Y(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,X,Q=[];while((X=J.exec(Z))!==null){let G=X.index+X[0].length-1,K=1,W=G+1,z=0,q=null;while(W<Z.length&&K>0){let _=Z[W];if(q){if(_===q)q=null;W++;continue}if(_==='"'||_==="'"||_==="`"){q=_,W++;continue}if(_==="<")z++;else if(_===">"&&z>0)z--;else if(z===0){if(_==="(")K++;else if(_===")")K--}if(K>0)W++}if(K!==0)continue;let U=Z.substring(G+1,W);if(!U.includes(":"))continue;let j=Y(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:z}=Q[G];Z=Z.substring(0,K)+z+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,X)=>{if(!X.includes(":"))return J;if(X.includes("{")||X.includes("}"))return J;return`(${X.split(",").map((G)=>{let[K,...W]=G.split("="),z=K.split(":")[0].trim();if(W.length>0)return`${z} = ${W.join("=").trim()}`;return z}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
769
769
 
770
- `),Z}async function f1($,Z,Y,J={}){if(!$.trim())return;let X;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),P=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");P=P.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=C.transformSync(P)}catch{X=Y8($)}let Q={exports:{}},G=Q.exports,K=n5.cwd(),W={},z=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of z)try{let P=z5.resolve(K,"node_modules",C),x=z5.join(P,"package.json"),m=JSON.parse(j0("fs").readFileSync(x,"utf8")),u=m.main||"index.js";if(m.exports){let U0=typeof m.exports==="string"?m.exports:m.exports["."];if(typeof U0==="string")u=U0;else if(U0?.bun)u=U0.bun;else if(U0?.import)u=U0.import;else if(U0?.default)u=U0.default}W[C]=await import(z5.resolve(P,u))}catch{}let q=(C)=>{if(W[C])return W[C];return j0(C)},U=Z.props||{},j=(C)=>{if(!C)return U;let P={};for(let[x,m]of Object.entries(C)){let u=U[x];if(u!==void 0)P[x]=u;else if(typeof m==="function")P[x]=m();else P[x]=m}return P};for(let[C,P]of Object.entries(U))Object.defineProperty(j,C,{value:P,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,C))continue;try{Object.defineProperty(j,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(C)=>{if(!C)return U;let P={...U};for(let[x,m]of Object.entries(C)){let u=m&&typeof m==="object"&&!Array.isArray(m)?m:{type:m};if(P[x]===void 0&&u.default!==void 0)P[x]=typeof u.default==="function"?u.default():u.default}return P},B=()=>Z.slots||{},H=(C,P)=>{let x={...C};for(let[m,u]of Object.entries(P))if(x[m]===void 0)if(typeof u==="function")x[m]=u();else x[m]=u;return x},L=(C)=>{let P=()=>C;return P.set=(x)=>{},P.update=(x)=>{},P},V=(C)=>{let P,x=!1;return()=>{if(!x)try{P=C(),x=!0}catch{P=void 0}return P}},O=(C)=>{},F=(C)=>C(),w=(C)=>{},A=(C)=>{},R=(C)=>{},N=()=>{let C=Z.__stxServeContext,P=Z.__stxServeSearch??C?.search??"",x=C?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(P)),path:x,name:"",fullPath:x+P,hash:"",matched:[]}},M=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),T=(C)=>{let P=Z.__stx_runtime_head||{};Z.__stx_runtime_head=W5(P,C||{})},I=(C)=>{T(S$(C||{}))},E=(C)=>({value:C}),D=(C)=>C,y=(C)=>({value:typeof C==="function"?C():C}),b=(C,P)=>{},k=(C)=>{},v=(C)=>{},g=(C)=>C?C():Promise.resolve(),f=(C)=>(P,...x)=>{},d=(C)=>{},p=(C,P)=>{},X0=(C,P)=>P,Z0=()=>({value:"light"}),V0=()=>L(!1),r=(C)=>L(!1),Q0=()=>L(!1),k0=()=>r("(prefers-color-scheme: dark)"),n0=()=>r("(prefers-color-scheme: light)"),j1=()=>r("(prefers-reduced-motion: reduce)"),t1=()=>r("(prefers-contrast: more)"),n={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:{}},J0=new Proxy(n,{get(C,P){if(P in C)return C[P];return},set(C,P,x){return C[P]=x,!0}}),B0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},R0=console;try{let C=N7(X,Y),P=new Set(Object.keys(U)),x=(i)=>/^[a-z_$][\w$]*$/i.test(i),m=Object.keys(Z).filter((i)=>!P.has(i)&&i!=="props"&&x(i)),u=m.map((i)=>Z[i]),U0=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"]),N0=[],G1=[];for(let[i,h0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(U0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(C))continue;N0.push(i),G1.push(h0)}let C0=EG(C).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
771
- `),o0=Z.params??{},E1=[],_1=[];for(let i=0;i<m.length;i++){if(m[i]==="params")continue;E1.push(m[i]),_1.push(u[i])}let z0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...N0,...E1,`return (async () => {
770
+ `),Z}async function g1($,Z,Y,J={}){if(!$.trim())return;let X;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),P=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");P=P.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=C.transformSync(P)}catch{X=J8($)}let Q={exports:{}},G=Q.exports,K=o5.cwd(),W={},z=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of z)try{let P=q5.resolve(K,"node_modules",C),x=q5.join(P,"package.json"),m=JSON.parse(j0("fs").readFileSync(x,"utf8")),u=m.main||"index.js";if(m.exports){let U0=typeof m.exports==="string"?m.exports:m.exports["."];if(typeof U0==="string")u=U0;else if(U0?.bun)u=U0.bun;else if(U0?.import)u=U0.import;else if(U0?.default)u=U0.default}W[C]=await import(q5.resolve(P,u))}catch{}let q=(C)=>{if(W[C])return W[C];return j0(C)},U=Z.props||{},j=(C)=>{if(!C)return U;let P={};for(let[x,m]of Object.entries(C)){let u=U[x];if(u!==void 0)P[x]=u;else if(typeof m==="function")P[x]=m();else P[x]=m}return P};for(let[C,P]of Object.entries(U))Object.defineProperty(j,C,{value:P,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,C))continue;try{Object.defineProperty(j,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(C)=>{if(!C)return U;let P={...U};for(let[x,m]of Object.entries(C)){let u=m&&typeof m==="object"&&!Array.isArray(m)?m:{type:m};if(P[x]===void 0&&u.default!==void 0)P[x]=typeof u.default==="function"?u.default():u.default}return P},B=()=>Z.slots||{},H=(C,P)=>{let x={...C};for(let[m,u]of Object.entries(P))if(x[m]===void 0)if(typeof u==="function")x[m]=u();else x[m]=u;return x},L=(C)=>{let P=()=>C;return P.set=(x)=>{},P.update=(x)=>{},P},V=(C)=>{let P,x=!1;return()=>{if(!x)try{P=C(),x=!0}catch{P=void 0}return P}},O=(C)=>{},F=(C)=>C(),w=(C)=>{},A=(C)=>{},R=(C)=>{},N=()=>{let C=Z.__stxServeContext,P=Z.__stxServeSearch??C?.search??"",x=C?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(P)),path:x,name:"",fullPath:x+P,hash:"",matched:[]}},M=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),T=(C)=>{let P=Z.__stx_runtime_head||{};Z.__stx_runtime_head=z5(P,C||{})},I=(C)=>{T(y$(C||{}))},E=(C)=>({value:C}),D=(C)=>C,y=(C)=>({value:typeof C==="function"?C():C}),b=(C,P)=>{},k=(C)=>{},v=(C)=>{},g=(C)=>C?C():Promise.resolve(),f=(C)=>(P,...x)=>{},d=(C)=>{},p=(C,P)=>{},X0=(C,P)=>P,Z0=()=>({value:"light"}),V0=()=>L(!1),r=(C)=>L(!1),Q0=()=>L(!1),k0=()=>r("(prefers-color-scheme: dark)"),n0=()=>r("(prefers-color-scheme: light)"),_1=()=>r("(prefers-reduced-motion: reduce)"),e1=()=>r("(prefers-contrast: more)"),n={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:{}},J0=new Proxy(n,{get(C,P){if(P in C)return C[P];return},set(C,P,x){return C[P]=x,!0}}),B0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},R0=console;try{let C=T7(X,Y),P=new Set(Object.keys(U)),x=(i)=>/^[a-z_$][\w$]*$/i.test(i),m=Object.keys(Z).filter((i)=>!P.has(i)&&i!=="props"&&x(i)),u=m.map((i)=>Z[i]),U0=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"]),N0=[],K1=[];for(let[i,h0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(U0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(C))continue;N0.push(i),K1.push(h0)}let C0=bG(C).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
771
+ `),o0=Z.params??{},k1=[],B1=[];for(let i=0;i<m.length;i++){if(m[i]==="params")continue;k1.push(m[i]),B1.push(u[i])}let z0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...N0,...k1,`return (async () => {
772
772
  ${C}
773
773
  ${C0}
774
774
  return module.exports
775
- })()`)(Q,G,q,U,j,_,H,L,V,O,F,w,A,R,N,M,T,I,E,D,y,b,k,v,g,f,d,B,p,X0,Z0,V0,r,Q0,k0,n0,j1,t1,J0,B0,R0,n.confirm,n.alert,n.fetch,o0,...G1,..._1);if(J.preserveExisting){for(let[i,h0]of Object.entries(z0))if(!(i in Z)||Z[i]===void 0)Z[i]=h0}else Object.assign(Z,z0);for(let[i,h0]of Object.entries(U))if(!(i in Z))Z[i]=h0}catch(C){if(n5.env.STX_DEBUG){let P=C instanceof Error?C.message:String(C);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${P}`)}try{await PG(X,Z,Y)}catch(P){if(n5.env.STX_DEBUG){let x=P instanceof Error?P.message:String(P);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function J8($){let Z=0,Y=null,J=!1,X=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G===Y){if(Y=null,J||Z===0)X=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return Y===null&&Z===0&&X}function N7($,Z){let Y=Z?z5.dirname(Z):n5.cwd(),J=$.split(`
776
- `),X=[],Q=0;while(Q<J.length){let G=J[Q].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;Q<J.length;Q++){for(let W of J[Q])if(W==="{")K++;else if(W==="}")K--;if(K<=0)break}}Q++;continue}if(G.startsWith("definePageMeta(")){let K=0,W=!1;for(let z=Q;z<J.length&&!W;z++){let q=null,U=!1,j=J[z];for(let _=0;_<j.length;_++){let B=j[_];if(U){U=!1;continue}if(B==="\\"){U=!0;continue}if(q){if(B===q)q=null;continue}if(B==='"'||B==="'"||B==="`"){q=B;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0){Q=z+1,W=!0;break}}}}if(!W)Q=J.length;continue}if(G.startsWith("import ")||G==="import"||G.startsWith("import{")){let K=G,W=0;while(!J8(K)&&Q+W+1<J.length)W++,K=`${K} ${J[Q+W].trim()}`;Q+=W;let z=K.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),q=K.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=K.match(/^import\s+['"](.+?)['"]/),j=K,_=(B)=>{if(B.startsWith("."))return z5.resolve(Y,B);return B};if(z){let[,B,H]=z,L=_(H);X.push(`const ${B} = await import('${L}')`),X.push(`module.exports.${B} = ${B};`)}else if(q){let[,B,H]=q,L=B.trim(),V=_(H);X.push(`const { ${L} } = await import('${V}')`);for(let O of L.split(",")){let F=O.trim().split(/\s+as\s+/).pop()?.trim();if(F)X.push(`module.exports.${F} = ${F};`)}}else if(U){let B=_(U[1]);X.push(`await import('${B}')`)}else X.push(j);Q++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))X.push(J[Q]),Q++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=t9(J,Q),{type:W,name:z,value:q}=K;X.push(`${W} ${z} = ${q};`),X.push(`module.exports.${z} = ${z};`),Q=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=R7(J,Q);X.push(K.functionCode),X.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=t9(J,Q),{type:W,name:z,value:q}=K;X.push(`${W} ${z} = ${q};`),X.push(`module.exports.${z} = ${z};`),Q=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=R7(J,Q);X.push(K.functionCode),X.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...J];W[Q]=K;let z=R7(W,Q);if(X.push(z.functionCode),z.name)X.push(`module.exports.default = ${z.name};`);Q=z.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");X.push(`module.exports.default = ${K};`),Q++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let W=K[1],z=J[Q].replace(/^export\s+/,""),q=0,U=Q;for(;U<J.length;U++){let j=J[U];for(let _ of j)if(_==="{")q++;else if(_==="}")q--;if(U>Q)z+=`
777
- `+j;if(q<=0&&U>=Q)break}X.push(z),X.push(`module.exports.${W} = ${W};`),Q=U+1}else X.push(G),Q++}else if(G.includes("module.exports"))X.push(G),Q++;else if(G.trim()&&!G.startsWith("//"))X.push(G),Q++;else Q++}return kG(X.join(`
778
- `),Y)}function kG($,Z){let Y=$.length,J="",X=0,Q=null,G=!1,K=!1,W=0;while(X<Y){let z=$[X],q=$[X+1];if(G){if(J+=z,z===`
779
- `)G=!1;X++;continue}if(K){if(J+=z,z==="*"&&q==="/"){J+=q,X+=2,K=!1;continue}X++;continue}if(!Q&&z==="/"&&q==="/"){G=!0,J+=z,X++;continue}if(!Q&&z==="/"&&q==="*"){K=!0,J+=z,X++;continue}if(Q){if(J+=z,z==="\\"){J+=q,X+=2;continue}if(z===Q&&Q!=="`"){Q=null,X++;continue}if(Q==="`"){if(z==="$"&&q==="{"){W++,J+=q,X+=2;continue}if(z==="`"){Q=null,X++;continue}}X++;continue}if(W>0){if(z==="{")W++;else if(z==="}")W--}if(z==='"'||z==="'"||z==="`"){Q=z,J+=z,X++;continue}if(z==="a"&&$.startsWith("await",X)){let U=bG($,X);if(U){let{quote:j,path:_,end:B}=U;if(_.startsWith(".")){let H=z5.resolve(Z,_);J+=`await import(${j}${H}${j})`,X=B;continue}}}J+=z,X++}return J}function bG($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let J=$[Y];if(J!=="'"&&J!=='"')return null;Y++;let X=Y;while(Y<$.length&&$[Y]!==J)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let Q=$.slice(X,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:J,path:Q,end:Y+1}}function X8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let X=x0($,Y,Y==="{"?"}":"]",Z);if(X===-1)return null;return{pattern:$.slice(Z,X+1),endPos:X+1}}function Q8($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,X=0,Q="";while(J<Y.length){let G=Y[J];if(G==="{"||G==="["){if(X++,X===1){let K=X8(Y,J);if(K){let W=Q8(K.pattern);Z.push(...W),J=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")X--;if(X>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<Y.length&&Y[J]!==","&&X===0){if(Y[J]==="{"||Y[J]==="[")X++;else if(Y[J]==="}"||Y[J]==="]")X--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function G8($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,J=(X)=>X===" "||X==="\t";while(Y<$.length&&J($[Y]))Y++;if($[Y]===":"){let X=0,Q=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;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=$[Y+1],W=$[Y-1];if(K!=="="&&K!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&J($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function t9($,Z){let Y=$[Z].trim(),J=G8(Y),X=J?[Y,J.type,J.name,J.value]:null;if(!X){let q=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(q){let U=Y.slice(q[0].length),j=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let B=U.startsWith("{")?"}":"]",H=U;for(let L=Z+1;L<$.length;L++)if(H+=" "+$[L].trim(),j=L,$[L].includes(B))break;U=H}let _=X8(U,0);if(_){let B=q[1],H=_.pattern,L=U.slice(_.endPos).trim();if(L.startsWith("=")){let V=L.slice(1).trim(),O=V,F=Math.max(j,Z);if(e9(V)){let N=$8($,F,V);O=N.value,F=N.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let w=Q8(H),A=`__stx_src_${Z}`,R=w.map((N)=>`module.exports.${N} = ${N};`).join(`
775
+ })()`)(Q,G,q,U,j,_,H,L,V,O,F,w,A,R,N,M,T,I,E,D,y,b,k,v,g,f,d,B,p,X0,Z0,V0,r,Q0,k0,n0,_1,e1,J0,B0,R0,n.confirm,n.alert,n.fetch,o0,...K1,...B1);if(J.preserveExisting){for(let[i,h0]of Object.entries(z0))if(!(i in Z)||Z[i]===void 0)Z[i]=h0}else Object.assign(Z,z0);for(let[i,h0]of Object.entries(U))if(!(i in Z))Z[i]=h0}catch(C){if(o5.env.STX_DEBUG){let P=C instanceof Error?C.message:String(C);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${P}`)}try{await vG(X,Z,Y)}catch(P){if(o5.env.STX_DEBUG){let x=P instanceof Error?P.message:String(P);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function X8($){let Z=0,Y=null,J=!1,X=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G===Y){if(Y=null,J||Z===0)X=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return Y===null&&Z===0&&X}function T7($,Z){let Y=Z?q5.dirname(Z):o5.cwd(),J=$.split(`
776
+ `),X=[],Q=0;while(Q<J.length){let G=J[Q].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;Q<J.length;Q++){for(let W of J[Q])if(W==="{")K++;else if(W==="}")K--;if(K<=0)break}}Q++;continue}if(G.startsWith("definePageMeta(")){let K=0,W=!1;for(let z=Q;z<J.length&&!W;z++){let q=null,U=!1,j=J[z];for(let _=0;_<j.length;_++){let B=j[_];if(U){U=!1;continue}if(B==="\\"){U=!0;continue}if(q){if(B===q)q=null;continue}if(B==='"'||B==="'"||B==="`"){q=B;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0){Q=z+1,W=!0;break}}}}if(!W)Q=J.length;continue}if(G.startsWith("import ")||G==="import"||G.startsWith("import{")){let K=G,W=0;while(!X8(K)&&Q+W+1<J.length)W++,K=`${K} ${J[Q+W].trim()}`;Q+=W;let z=K.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),q=K.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=K.match(/^import\s+['"](.+?)['"]/),j=K,_=(B)=>{if(B.startsWith("."))return q5.resolve(Y,B);return B};if(z){let[,B,H]=z,L=_(H);X.push(`const ${B} = await import('${L}')`),X.push(`module.exports.${B} = ${B};`)}else if(q){let[,B,H]=q,L=B.trim(),V=_(H);X.push(`const { ${L} } = await import('${V}')`);for(let O of L.split(",")){let F=O.trim().split(/\s+as\s+/).pop()?.trim();if(F)X.push(`module.exports.${F} = ${F};`)}}else if(U){let B=_(U[1]);X.push(`await import('${B}')`)}else X.push(j);Q++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))X.push(J[Q]),Q++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=e9(J,Q),{type:W,name:z,value:q}=K;X.push(`${W} ${z} = ${q};`),X.push(`module.exports.${z} = ${z};`),Q=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=M7(J,Q);X.push(K.functionCode),X.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=e9(J,Q),{type:W,name:z,value:q}=K;X.push(`${W} ${z} = ${q};`),X.push(`module.exports.${z} = ${z};`),Q=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=M7(J,Q);X.push(K.functionCode),X.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...J];W[Q]=K;let z=M7(W,Q);if(X.push(z.functionCode),z.name)X.push(`module.exports.default = ${z.name};`);Q=z.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");X.push(`module.exports.default = ${K};`),Q++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let W=K[1],z=J[Q].replace(/^export\s+/,""),q=0,U=Q;for(;U<J.length;U++){let j=J[U];for(let _ of j)if(_==="{")q++;else if(_==="}")q--;if(U>Q)z+=`
777
+ `+j;if(q<=0&&U>=Q)break}X.push(z),X.push(`module.exports.${W} = ${W};`),Q=U+1}else X.push(G),Q++}else if(G.includes("module.exports"))X.push(G),Q++;else if(G.trim()&&!G.startsWith("//"))X.push(G),Q++;else Q++}return SG(X.join(`
778
+ `),Y)}function SG($,Z){let Y=$.length,J="",X=0,Q=null,G=!1,K=!1,W=0;while(X<Y){let z=$[X],q=$[X+1];if(G){if(J+=z,z===`
779
+ `)G=!1;X++;continue}if(K){if(J+=z,z==="*"&&q==="/"){J+=q,X+=2,K=!1;continue}X++;continue}if(!Q&&z==="/"&&q==="/"){G=!0,J+=z,X++;continue}if(!Q&&z==="/"&&q==="*"){K=!0,J+=z,X++;continue}if(Q){if(J+=z,z==="\\"){J+=q,X+=2;continue}if(z===Q&&Q!=="`"){Q=null,X++;continue}if(Q==="`"){if(z==="$"&&q==="{"){W++,J+=q,X+=2;continue}if(z==="`"){Q=null,X++;continue}}X++;continue}if(W>0){if(z==="{")W++;else if(z==="}")W--}if(z==='"'||z==="'"||z==="`"){Q=z,J+=z,X++;continue}if(z==="a"&&$.startsWith("await",X)){let U=yG($,X);if(U){let{quote:j,path:_,end:B}=U;if(_.startsWith(".")){let H=q5.resolve(Z,_);J+=`await import(${j}${H}${j})`,X=B;continue}}}J+=z,X++}return J}function yG($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let J=$[Y];if(J!=="'"&&J!=='"')return null;Y++;let X=Y;while(Y<$.length&&$[Y]!==J)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let Q=$.slice(X,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:J,path:Q,end:Y+1}}function Q8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let X=x0($,Y,Y==="{"?"}":"]",Z);if(X===-1)return null;return{pattern:$.slice(Z,X+1),endPos:X+1}}function G8($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,X=0,Q="";while(J<Y.length){let G=Y[J];if(G==="{"||G==="["){if(X++,X===1){let K=Q8(Y,J);if(K){let W=G8(K.pattern);Z.push(...W),J=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")X--;if(X>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<Y.length&&Y[J]!==","&&X===0){if(Y[J]==="{"||Y[J]==="[")X++;else if(Y[J]==="}"||Y[J]==="]")X--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function K8($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,J=(X)=>X===" "||X==="\t";while(Y<$.length&&J($[Y]))Y++;if($[Y]===":"){let X=0,Q=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;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=$[Y+1],W=$[Y-1];if(K!=="="&&K!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&J($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function e9($,Z){let Y=$[Z].trim(),J=K8(Y),X=J?[Y,J.type,J.name,J.value]:null;if(!X){let q=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(q){let U=Y.slice(q[0].length),j=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let B=U.startsWith("{")?"}":"]",H=U;for(let L=Z+1;L<$.length;L++)if(H+=" "+$[L].trim(),j=L,$[L].includes(B))break;U=H}let _=Q8(U,0);if(_){let B=q[1],H=_.pattern,L=U.slice(_.endPos).trim();if(L.startsWith("=")){let V=L.slice(1).trim(),O=V,F=Math.max(j,Z);if($8(V)){let N=Z8($,F,V);O=N.value,F=N.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let w=G8(H),A=`__stx_src_${Z}`,R=w.map((N)=>`module.exports.${N} = ${N};`).join(`
780
780
  `);return{type:B,name:A,value:`${O}; ${B} ${H} = ${A};
781
- ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,G,K]=X,W=K,z=Z;if(e9(K)){let q=$8($,Z,K);W=q.value,z=q.nextIndex}else z=Z+1;while(z<$.length){let q=$[z].trim();if(q.startsWith(".")||q.startsWith("?."))W+=`
782
- ${$[z]}`,z++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:z}}function R7($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,X]=J,Q=Y.replace(/^export\s+/,""),G=Z;if(SG(Y)){let K=yG($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function e9($){let Z=$.trim();if(Z.startsWith("{"))return x0(Z,"{","}",0)===-1;if(Z.startsWith("["))return x0(Z,"[","]",0)===-1;return!K8(Z)}function K8($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let X=0;X<$.length;X++){let Q=$[X];if((X>0?$[X-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[X+1]==="{"){J++,X++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(Y)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&&Y===null}function SG($){let Z=$.indexOf("{");if(Z===-1)return!0;return x0($,"{","}",Z)===-1}function $8($,Z,Y){let J=Y,X=Z+1;while(X<$.length&&!K8(J)){let Q=$[X];J+=`
781
+ ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,G,K]=X,W=K,z=Z;if($8(K)){let q=Z8($,Z,K);W=q.value,z=q.nextIndex}else z=Z+1;while(z<$.length){let q=$[z].trim();if(q.startsWith(".")||q.startsWith("?."))W+=`
782
+ ${$[z]}`,z++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:z}}function M7($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,X]=J,Q=Y.replace(/^export\s+/,""),G=Z;if(PG(Y)){let K=CG($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function $8($){let Z=$.trim();if(Z.startsWith("{"))return x0(Z,"{","}",0)===-1;if(Z.startsWith("["))return x0(Z,"[","]",0)===-1;return!W8(Z)}function W8($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let X=0;X<$.length;X++){let Q=$[X];if((X>0?$[X-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[X+1]==="{"){J++,X++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(Y)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&&Y===null}function PG($){let Z=$.indexOf("{");if(Z===-1)return!0;return x0($,"{","}",Z)===-1}function Z8($,Z,Y){let J=Y,X=Z+1;while(X<$.length&&!W8(J)){let Q=$[X];J+=`
783
783
  ${Q}`,X++}while(X<$.length){let Q=$[X].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
784
- ${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function yG($,Z,Y){let J=Y,X=Z+1;while(X<$.length){let Q=J.indexOf("{");if(Q!==-1){if(x0(J,"{","}",Q)!==-1)break}let G=$[X];J+=`
785
- ${G}`,X++}return{functionCode:J,nextIndex:X}}function Z8($,Z){let Y=$0($,Z)??$0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...n5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function PG($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),z=Z8(W,Z);if(z!==void 0)Z[G]=z}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(/;$/,""),z=Z8(W,Z);if(z!==void 0)Z[G]=z}catch{}}}function W8($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function z8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var o5=S(()=>{i5();b1();w0()});var M7={};a(M7,{renderSlot:()=>U8,processSlots:()=>_8,parseSlots:()=>q8,parseSlotElement:()=>gG,extractSlotContent:()=>uG,applySlots:()=>mG});function CG($,Z){let Y=1,J=Z,X="<template",Q="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(X,J)&&(J+X.length>=$.length||/[\s>\/]/.test($[J+X.length]))){Y++,J+=X.length;continue}if($.startsWith(Q,J)){let K=$.indexOf(">",J+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function xG($,Z){let Y=null;for(let J=Z;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"){Y=X;continue}if(X===">")return J+1}return-1}function fG($){let Z=[],Y=[],J=/^<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=xG($,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 z=W[1]==="/",q=W[2].toLowerCase();if(z){let j=Y.lastIndexOf(q);if(j!==-1)Y.splice(j);X=G;continue}if(q==="template"&&Y.length===0){let j=K.match(J);if(j){let _=CG($,G);if(_!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:_,slotName:B,content:$.slice(G,_-11).trim(),propsBinding:j[4]||void 0}),X=_;continue}}}if(!/\/\s*>$/.test(K)&&!vG.has(q)){if(Y.push(q),q==="script"||q==="style"){let j=$.toLowerCase().indexOf(`</${q}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function q8($){let Z={default:"",named:new Map},Y=$,J=fG($);for(let W of J)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});J.sort((W,z)=>z.start-W.start);for(let W of J)Y=Y.slice(0,W.start)+Y.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[W,z,q,U,j,_]=G,B=q.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(B+H).trim(),V=`<${z}${L?" "+L:""}>${_}</${z}>`;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(Y))!==null){let[W,z,q,U,j]=G,_=q.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+B).trim(),L=`<${z}${H?" "+H:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:L})}X.sort((W,z)=>z.start-W.start);for(let W of X){let z=Z.named.get(W.slotName);if(z)z.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function gG($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)J[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function U8($,Z,Y,J){if(!$)return Y;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...J};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[z,q]=W.split(":").map((j)=>j.trim()),U=q||z;if(Z[z]!==void 0)G[U]=Z[z]}}else G[Q]=Z;X=hG(X,G)}return X}function hG($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=j8(X,Z);return r0(String(Q??""))}catch{return`{{ ${J} }}`}})}function j8($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),X=Z;for(let Q of J)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,X,Q]=Y,G=Z[J],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(!K0($))return;return W0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function _8($,Z,Y){let J=$;J=await dG(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,z)=>{let q=Z.named.get(K),U=z?.trim()||"",j=W||"",_={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=B.exec(j))!==null){let L=H[1],V=H[2];_[L]=j8(V,Y)}return await U8(q,_,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),J}async function dG($,Z,Y){let J=[],X=[];$.replace(Z,(K,...W)=>{let z=W[W.length-2];return X.push({match:K,index:z}),J.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:z}=X[K];G=G.slice(0,z)+Q[K]+G.slice(z+W.length)}return G}function uG($){let Z=q8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function mG($,Z,Y,J){return await _8($,{default:Z,named:Y},J)}var vG;var T7=S(()=>{Y1();w0();vG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function w1($,Z){let Y=pG($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function pG($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=x0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function lG($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function g1($,Z,Y,J){let X=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),z=K.exec($),q=W?W.index:1/0,U=z?z.index:1/0;if(q<U)X++,Q=q+W[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+z[0].length}else break}return-1}function B8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=w1($,J);if(!X)return null;let Q=X.endPos,G=g1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],z=0,q="if",U=X.expression,j=0,_=0;while(z<K.length){let B=K.indexOf("@",z);if(B===-1)break;z=B;let H=K.substring(B);if(lG(K,B)){z++;continue}if(/^@if\s*\(/.test(H)){_++,z++;continue}if(/^@endif(?![a-z])/.test(H)){_--,z+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){W.push({type:q,condition:U,content:K.substring(j,z),start:Q+j,end:Q+z});let V=z+L[0].length,O=w1(K,V);if(!O){z++;continue}q="elseif",U=O.expression,z=O.endPos,j=z;continue}else if(/^@else(?![a-z])/.test(H)){W.push({type:q,condition:U,content:K.substring(j,z),start:Q+j,end:Q+z}),q="else",U=void 0,z+=5,j=z;continue}}z++}return W.push({type:q,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 s5($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let Q=B8($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function P$($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,z=x0($,"(",")",W);if(z===-1){Q=X.exec($);continue}let q=$.slice(W+1,z),U=z+1,j=g1($,Z,Y,U);if(j===-1){Q=X.exec($);continue}let _=$.slice(U,j),B=j+`@${Y}`.length;J.push({fullMatch:$.slice(K,B),name:Z,params:q,content:_,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return J}function I7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=w1($,J);if(!X)return null;let Q=X.endPos,G=g1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],z=0,q=null,U=0;while(z<K.length){let j=K.slice(z),_=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(_){if(U++,q)q.content+=_[0];z+=_[0].length;continue}if(B){if(U--,q)q.content+=B[0];z+=B[0].length;continue}if(U>0){if(q)q.content+=K[z];z++;continue}let H=j.match(/^@case\s*/),L=j.match(/^@default(?![a-z])/),V=j.match(/^@break(?![a-z])/);if(H&&j.startsWith("@case")){if(q)W.push(q);let O=z+H[0].length,F=w1(K,O);if(!F){z++;continue}q={type:"case",value:F.expression,content:""},z=F.endPos}else if(L&&j.startsWith("@default")){if(q)W.push(q);q={type:"default",content:""},z+=L[0].length}else if(V&&j.startsWith("@break"))z+=V[0].length;else{if(q)q.content+=K[z];z++}}if(q)W.push(q);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var H8=()=>{};var O8=()=>{};var C$=S(()=>{H8();O8()});function f$($){let Z=$,Y=new Set,J=new Set,X=()=>{if(d0)J.add(d0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),r5)J.forEach((K)=>x$.add(K));else J.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return Y.add(Q),()=>Y.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 g$($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,r5)J.forEach((G)=>x$.add(G));else J.forEach((G)=>G())},Q=()=>{if(d0)J.add(d0);if(Y){let G=d0;d0=X,v$.push(X);try{Z=$()}finally{v$.pop(),d0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function h$($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=d0;d0=X,v$.push(X);try{Y=$()}finally{v$.pop(),d0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function D7($){if(r5){$();return}r5=!0;try{$()}finally{r5=!1,x$.forEach((Z)=>Z()),x$.clear()}}function E7($){oG.push($)}function k7($){sG.push($)}function d$($){return typeof $==="function"&&$._isSignal===!0}function u$($){return typeof $==="function"&&$._isDerived===!0}function b7($){if(d$($)||u$($))return $();return $}function m$($){let Z=d0;d0=null;try{return $()}finally{d0=Z}}function rG($,Z){let Y=typeof $==="function"?$:()=>$,J=f$([]),X=g$(()=>J().reduce((K,W)=>Z(K,W.action),Y())),Q=!1;return h$(()=>{if(Y(),!Q){Q=!0;return}if(m$(()=>J().length))J.set([])}),[X,(K,W)=>{let z={action:K};J.set([...J(),z]);let q=()=>{let U=J().filter((j)=>j!==z);if(U.length!==J().length)J.set(U)};if(W&&typeof W.then==="function")Promise.resolve(W).then(q,q);return q}]}var d0=null,v$,r5=!1,x$,oG,sG;var S7=S(()=>{v$=[],x$=new Set,oG=[],sG=[]});var F8={};a(F8,{useOptimistic:()=>rG,untrack:()=>b7,state:()=>f$,peek:()=>m$,onMount:()=>E7,onDestroy:()=>k7,isSignal:()=>d$,isDerived:()=>u$,generateSignalsRuntimeDev:()=>p$,generateSignalsRuntime:()=>L8,effect:()=>h$,derived:()=>g$,default:()=>tG,batch:()=>D7});function L8(){try{let $=aG(p$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return p$()}}function aG($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let X=$.indexOf(J,Y);if(X===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,X));let Q=1,G=X+J.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"),Y=G}return Z.join("")}function p$(){return`
784
+ ${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function CG($,Z,Y){let J=Y,X=Z+1;while(X<$.length){let Q=J.indexOf("{");if(Q!==-1){if(x0(J,"{","}",Q)!==-1)break}let G=$[X];J+=`
785
+ ${G}`,X++}return{functionCode:J,nextIndex:X}}function Y8($,Z){let Y=$0($,Z)??$0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...o5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function vG($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),z=Y8(W,Z);if(z!==void 0)Z[G]=z}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(/;$/,""),z=Y8(W,Z);if(z!==void 0)Z[G]=z}catch{}}}function z8($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function q8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var s5=S(()=>{n5();S1();w0()});var I7={};a(I7,{renderSlot:()=>j8,processSlots:()=>B8,parseSlots:()=>U8,parseSlotElement:()=>dG,extractSlotContent:()=>pG,applySlots:()=>lG});function xG($,Z){let Y=1,J=Z,X="<template",Q="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(X,J)&&(J+X.length>=$.length||/[\s>\/]/.test($[J+X.length]))){Y++,J+=X.length;continue}if($.startsWith(Q,J)){let K=$.indexOf(">",J+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function gG($,Z){let Y=null;for(let J=Z;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"){Y=X;continue}if(X===">")return J+1}return-1}function hG($){let Z=[],Y=[],J=/^<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=gG($,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 z=W[1]==="/",q=W[2].toLowerCase();if(z){let j=Y.lastIndexOf(q);if(j!==-1)Y.splice(j);X=G;continue}if(q==="template"&&Y.length===0){let j=K.match(J);if(j){let _=xG($,G);if(_!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:_,slotName:B,content:$.slice(G,_-11).trim(),propsBinding:j[4]||void 0}),X=_;continue}}}if(!/\/\s*>$/.test(K)&&!fG.has(q)){if(Y.push(q),q==="script"||q==="style"){let j=$.toLowerCase().indexOf(`</${q}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function U8($){let Z={default:"",named:new Map},Y=$,J=hG($);for(let W of J)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});J.sort((W,z)=>z.start-W.start);for(let W of J)Y=Y.slice(0,W.start)+Y.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[W,z,q,U,j,_]=G,B=q.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(B+H).trim(),V=`<${z}${L?" "+L:""}>${_}</${z}>`;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(Y))!==null){let[W,z,q,U,j]=G,_=q.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+B).trim(),L=`<${z}${H?" "+H:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:L})}X.sort((W,z)=>z.start-W.start);for(let W of X){let z=Z.named.get(W.slotName);if(z)z.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function dG($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)J[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function j8($,Z,Y,J){if(!$)return Y;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...J};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[z,q]=W.split(":").map((j)=>j.trim()),U=q||z;if(Z[z]!==void 0)G[U]=Z[z]}}else G[Q]=Z;X=uG(X,G)}return X}function uG($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=_8(X,Z);return r0(String(Q??""))}catch{return`{{ ${J} }}`}})}function _8($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),X=Z;for(let Q of J)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,X,Q]=Y,G=Z[J],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(!K0($))return;return W0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function B8($,Z,Y){let J=$;J=await mG(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,z)=>{let q=Z.named.get(K),U=z?.trim()||"",j=W||"",_={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=B.exec(j))!==null){let L=H[1],V=H[2];_[L]=_8(V,Y)}return await j8(q,_,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),J}async function mG($,Z,Y){let J=[],X=[];$.replace(Z,(K,...W)=>{let z=W[W.length-2];return X.push({match:K,index:z}),J.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:z}=X[K];G=G.slice(0,z)+Q[K]+G.slice(z+W.length)}return G}function pG($){let Z=U8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function lG($,Z,Y,J){return await B8($,{default:Z,named:Y},J)}var fG;var D7=S(()=>{J1();w0();fG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function A1($,Z){let Y=cG($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function cG($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=x0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function iG($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function h1($,Z,Y,J){let X=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),z=K.exec($),q=W?W.index:1/0,U=z?z.index:1/0;if(q<U)X++,Q=q+W[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+z[0].length}else break}return-1}function H8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=A1($,J);if(!X)return null;let Q=X.endPos,G=h1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],z=0,q="if",U=X.expression,j=0,_=0;while(z<K.length){let B=K.indexOf("@",z);if(B===-1)break;z=B;let H=K.substring(B);if(iG(K,B)){z++;continue}if(/^@if\s*\(/.test(H)){_++,z++;continue}if(/^@endif(?![a-z])/.test(H)){_--,z+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){W.push({type:q,condition:U,content:K.substring(j,z),start:Q+j,end:Q+z});let V=z+L[0].length,O=A1(K,V);if(!O){z++;continue}q="elseif",U=O.expression,z=O.endPos,j=z;continue}else if(/^@else(?![a-z])/.test(H)){W.push({type:q,condition:U,content:K.substring(j,z),start:Q+j,end:Q+z}),q="else",U=void 0,z+=5,j=z;continue}}z++}return W.push({type:q,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 r5($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let Q=H8($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function C$($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,z=x0($,"(",")",W);if(z===-1){Q=X.exec($);continue}let q=$.slice(W+1,z),U=z+1,j=h1($,Z,Y,U);if(j===-1){Q=X.exec($);continue}let _=$.slice(U,j),B=j+`@${Y}`.length;J.push({fullMatch:$.slice(K,B),name:Z,params:q,content:_,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return J}function E7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=A1($,J);if(!X)return null;let Q=X.endPos,G=h1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],z=0,q=null,U=0;while(z<K.length){let j=K.slice(z),_=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(_){if(U++,q)q.content+=_[0];z+=_[0].length;continue}if(B){if(U--,q)q.content+=B[0];z+=B[0].length;continue}if(U>0){if(q)q.content+=K[z];z++;continue}let H=j.match(/^@case\s*/),L=j.match(/^@default(?![a-z])/),V=j.match(/^@break(?![a-z])/);if(H&&j.startsWith("@case")){if(q)W.push(q);let O=z+H[0].length,F=A1(K,O);if(!F){z++;continue}q={type:"case",value:F.expression,content:""},z=F.endPos}else if(L&&j.startsWith("@default")){if(q)W.push(q);q={type:"default",content:""},z+=L[0].length}else if(V&&j.startsWith("@break"))z+=V[0].length;else{if(q)q.content+=K[z];z++}}if(q)W.push(q);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var O8=()=>{};var L8=()=>{};var v$=S(()=>{O8();L8()});function g$($){let Z=$,Y=new Set,J=new Set,X=()=>{if(d0)J.add(d0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),a5)J.forEach((K)=>f$.add(K));else J.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return Y.add(Q),()=>Y.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 h$($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,a5)J.forEach((G)=>f$.add(G));else J.forEach((G)=>G())},Q=()=>{if(d0)J.add(d0);if(Y){let G=d0;d0=X,x$.push(X);try{Z=$()}finally{x$.pop(),d0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function d$($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=d0;d0=X,x$.push(X);try{Y=$()}finally{x$.pop(),d0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function k7($){if(a5){$();return}a5=!0;try{$()}finally{a5=!1,f$.forEach((Z)=>Z()),f$.clear()}}function b7($){rG.push($)}function S7($){aG.push($)}function u$($){return typeof $==="function"&&$._isSignal===!0}function m$($){return typeof $==="function"&&$._isDerived===!0}function y7($){if(u$($)||m$($))return $();return $}function p$($){let Z=d0;d0=null;try{return $()}finally{d0=Z}}function tG($,Z){let Y=typeof $==="function"?$:()=>$,J=g$([]),X=h$(()=>J().reduce((K,W)=>Z(K,W.action),Y())),Q=!1;return d$(()=>{if(Y(),!Q){Q=!0;return}if(p$(()=>J().length))J.set([])}),[X,(K,W)=>{let z={action:K};J.set([...J(),z]);let q=()=>{let U=J().filter((j)=>j!==z);if(U.length!==J().length)J.set(U)};if(W&&typeof W.then==="function")Promise.resolve(W).then(q,q);return q}]}var d0=null,x$,a5=!1,f$,rG,aG;var P7=S(()=>{x$=[],f$=new Set,rG=[],aG=[]});var V8={};a(V8,{useOptimistic:()=>tG,untrack:()=>y7,state:()=>g$,peek:()=>p$,onMount:()=>b7,onDestroy:()=>S7,isSignal:()=>u$,isDerived:()=>m$,generateSignalsRuntimeDev:()=>l$,generateSignalsRuntime:()=>F8,effect:()=>d$,derived:()=>h$,default:()=>$K,batch:()=>k7});function F8(){try{let $=eG(l$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return l$()}}function eG($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let X=$.indexOf(J,Y);if(X===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,X));let Q=1,G=X+J.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"),Y=G}return Z.join("")}function l$(){return`
786
786
  // STX Signals Runtime (Development Build)
787
787
  console.log('[stx] signals runtime loading');
788
788
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -7324,7 +7324,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
7324
7324
  }
7325
7325
  }
7326
7326
  })();
7327
- `}var tG;var V8=S(()=>{S7();S7();tG={state:f$,derived:g$,effect:h$,batch:D7,onMount:E7,onDestroy:k7,isSignal:d$,isDerived:u$,untrack:b7,peek:m$,generateSignalsRuntime:L8,generateSignalsRuntimeDev:p$}});var y7={};a(y7,{templateCache:()=>w8,readFileCached:()=>eG,invalidateFileCacheByDir:()=>ZK,invalidateFileCache:()=>$K,hashFilePath:()=>a5,getCachedSignalsRuntime:()=>XK,getCachedRouterScript:()=>QK,clearDevCaches:()=>GK,checkCache:()=>KK,cacheTemplate:()=>WK,__setSignalsGeneratorsForTest:()=>JK});import A1 from"fs";import q5 from"path";async function eG($){let Y;for(let J=0;J<3;J++)try{let Q=(await A1.promises.stat($)).mtime.getTime(),G=h1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),z=(await A1.promises.stat($)).mtime.getTime();if(z!==Q)continue;return h1.set($,{content:K,mtime:z}),K}catch(X){Y=X;break}throw h1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function $K($){h1.delete($)}function ZK($){for(let Z of h1.keys())if(Z.startsWith($))h1.delete(Z)}function JK($){A8=$}async function XK($=!1){let Z=A8??await Promise.resolve().then(() => (V8(),F8));if($)return Z.generateSignalsRuntimeDev();if(l$===null)l$=Z.generateSignalsRuntime();return l$}async function QK(){if(c$===null){let{getRouterScript:$}=await import("stx-router");c$=$()}return c$}function GK(){h1.clear(),N8(),l$=null,YK=null,c$=null}function R8($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function KK($,Z){try{if(!Z.cachePath)return null;let Y=q5.resolve(Z.cachePath),J=q5.join(Y,`${a5($)}.html`),X=q5.join(Y,`${a5($)}.meta.json`);if(!await c(J)||!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!==R8(Z))return null;if((await A1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await c(W)){if((await A1.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function WK($,Z,Y,J){try{if(!J.cachePath)return;let X=q5.resolve(J.cachePath);await A1.promises.mkdir(X,{recursive:!0});let Q=q5.join(X,`${a5($)}.html`),G=q5.join(X,`${a5($)}.meta.json`),K=await A1.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:R8(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),w8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function a5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,zK)}var w8,h1,l$=null,YK=null,A8=null,c$=null,zK=16;var P7=S(()=>{M0();w8=new Map,h1=new Map});function M8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",J;while((J=Z.exec($))!==null)Y+=J[1]+`
7327
+ `}var $K;var w8=S(()=>{P7();P7();$K={state:g$,derived:h$,effect:d$,batch:k7,onMount:b7,onDestroy:S7,isSignal:u$,isDerived:m$,untrack:y7,peek:p$,generateSignalsRuntime:F8,generateSignalsRuntimeDev:l$}});var C7={};a(C7,{templateCache:()=>A8,readFileCached:()=>ZK,invalidateFileCacheByDir:()=>JK,invalidateFileCache:()=>YK,hashFilePath:()=>t5,getCachedSignalsRuntime:()=>GK,getCachedRouterScript:()=>KK,clearDevCaches:()=>WK,checkCache:()=>zK,cacheTemplate:()=>qK,__setSignalsGeneratorsForTest:()=>QK});import R1 from"fs";import U5 from"path";async function ZK($){let Y;for(let J=0;J<3;J++)try{let Q=(await R1.promises.stat($)).mtime.getTime(),G=d1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),z=(await R1.promises.stat($)).mtime.getTime();if(z!==Q)continue;return d1.set($,{content:K,mtime:z}),K}catch(X){Y=X;break}throw d1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function YK($){d1.delete($)}function JK($){for(let Z of d1.keys())if(Z.startsWith($))d1.delete(Z)}function QK($){R8=$}async function GK($=!1){let Z=R8??await Promise.resolve().then(() => (w8(),V8));if($)return Z.generateSignalsRuntimeDev();if(c$===null)c$=Z.generateSignalsRuntime();return c$}async function KK(){if(i$===null){let{getRouterScript:$}=await import("stx-router");i$=$()}return i$}function WK(){d1.clear(),M8(),c$=null,XK=null,i$=null}function N8($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function zK($,Z){try{if(!Z.cachePath)return null;let Y=U5.resolve(Z.cachePath),J=U5.join(Y,`${t5($)}.html`),X=U5.join(Y,`${t5($)}.meta.json`);if(!await c(J)||!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!==N8(Z))return null;if((await R1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await c(W)){if((await R1.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function qK($,Z,Y,J){try{if(!J.cachePath)return;let X=U5.resolve(J.cachePath);await R1.promises.mkdir(X,{recursive:!0});let Q=U5.join(X,`${t5($)}.html`),G=U5.join(X,`${t5($)}.meta.json`),K=await R1.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:N8(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),A8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function t5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,UK)}var A8,d1,c$=null,XK=null,R8=null,i$=null,UK=16;var v7=S(()=>{M0();A8=new Map,d1=new Map});function T8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",J;while((J=Z.exec($))!==null)Y+=J[1]+`
7328
7328
  `;let X=/\{\{([\s\S]*?)\}\}/g;while((J=X.exec($))!==null)Y+=J[1]+`
7329
7329
  `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"].some((j)=>{return new RegExp(`\\b${j}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),W=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,z,q=!1;while((z=W.exec(Y))!==null)if(!K.has(z[1])){q=!0;break}if(!G&&!q)return $;let U=`<script type="module">
7330
7330
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -7333,46 +7333,46 @@ import '@stacksjs/browser'
7333
7333
  `+$.slice(B);return $.replace("</head>",`${U}
7334
7334
  </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
7335
7335
  ${U}`);return U+`
7336
- `+$}async function T8($,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>
7336
+ `+$}async function I8($,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>
7337
7337
  `+$.slice(K);if($.includes("</head>")){let W=$.indexOf("</head>");return $.slice(0,W)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
7338
7338
  `+$.slice(W)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
7339
7339
  `+$}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>
7340
7340
  `+$.slice(K);if($.includes("</head>")){let W=$.indexOf("</head>");return $.slice(0,W)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
7341
7341
  `+$.slice(W)}return`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
7342
- `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (P7(),y7)),X=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,Q=$.indexOf("<script");if(Q!==-1)return $.slice(0,Q)+X+`
7342
+ `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (v7(),C7)),X=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,Q=$.indexOf("<script");if(Q!==-1)return $.slice(0,Q)+X+`
7343
7343
  `+$.slice(Q);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+X+`
7344
7344
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
7345
7345
  `+X+$.slice(K+1)}return X+`
7346
- `+$}async function C7($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
7347
- `}let{getCachedRouterScript:X}=await Promise.resolve().then(() => (P7(),y7)),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)+J+Q+`
7348
- </body>`+$.slice(G+7)}var s$={};a(s$,{scanScriptTags:()=>y8,rewriteStxImportSpecifiers:()=>x8,processSignals:()=>h7,processScriptSetup:()=>C8,preEvalLiteralReactiveIfs:()=>f7,parseLoopExpression:()=>P8,hasSignalsSyntax:()=>o$,findMarkupIndexOutsideScripts:()=>n$,extractExports:()=>v8,convertSignalLoopsToAttributes:()=>g7,convertSignalDirectivesToAttributes:()=>x7});function y8($,Z={}){let Y=[];for(let J of j7($,O1)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.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=J.token.length-Q[0].length;Y.push({fullMatch:J.token,attrs:G,body:J.token.slice(K,W),start:J.start,end:J.end})}return Y}function P8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=D8(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=D8(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function D8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let 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 o$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function UK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let X=J[1];if(X.startsWith("if"))Y++;else if(X==="endif")Y--;else if(Y===0)return!0}return!1}function jK($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,X;while((X=Y.exec($))!==null){let Q=X[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function _K($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function k8($,Z,Y){if(!$)return!1;let J=_K($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,W;while((W=K.exec(J))!==null){let j=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(E8.has(j))continue;if(Z.has(j))X=!0;else if(Y&&j in Y)Q=!0}let z=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,q;while((q=z.exec(J))!==null){let j=q[1];if(J.slice(0,q.index).trimEnd().endsWith("."))continue;if(E8.has(j)||Y&&j in Y)continue;G=!0}return(X||G)&&!Q}function i$($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,X=$.trim(),Q=X.match(S8);if(Q&&BK(Q[3],Q[1])){let[,G,K,W]=Q;return`<${G}${K}${J}>${W}</${G}>`}return`<template${J}>${X}</template>`}function BK($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,X;while((X=Y.exec($))!==null)if(X[1]){if(J--,J<0)return!1}else J++;return!0}function x7($,Z){let Y=jK($);function J(X){let Q=X,G=/@if\s*\(/g,K,W=[];while((K=G.exec(Q))!==null){let z=K.index,q=z+K[0].length,U=1,j=q;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")")U--;j++}if(U!==0)continue;let _=Q.substring(q,j-1).trim(),B=j,H=1,L=B,V=/@(if\s*\(|endif)/g;V.lastIndex=B;let O;while((O=V.exec(Q))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let F=Q.substring(B,L-6).trim(),w;if(UK(F)){let A=s5(Q.substring(z,L));if(A.length===0)continue;let R=A[0].branches.filter((T)=>T.type!=="else");if(!(R.length>0&&R.every((T)=>k8(T.condition,Y,Z))))continue;w=A[0].branches.map((T)=>{let I=J(T.content);if(T.type==="elseif")return i$(I,"@else-if",T.condition??"");if(T.type==="else")return i$(I,"@else");return i$(I,"@if",T.condition??"")}).join(`
7349
- `)}else{if(!k8(_,Y,Z))continue;w=i$(J(F),"@if",_)}W.push({start:z,end:L,replacement:w}),G.lastIndex=L}for(let z=W.length-1;z>=0;z--){let{start:q,end:U,replacement:j}=W[z];Q=Q.substring(0,q)+j+Q.substring(U)}return Q}return J($)}function HK($){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 Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function OK($,Z,Y,J){if(v7.has(Y.toLowerCase()))return J;let X=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,W=J;while(W<G){let z=$.indexOf("<",W);if(z===-1)return-1;if(W=z,$.startsWith("<!--",W)){let _=$.indexOf("-->",W+4);if(_===-1)return-1;W=_+3;continue}let q=/^<(script|style)\b/i.exec($.slice(W,W+8));if(q){let _=$.indexOf(">",W);if(_===-1)return-1;if($[_-1]==="/"){W=_+1;continue}let B=Q.indexOf(`</${q[1].toLowerCase()}`,W);if(B===-1)return-1;let H=$.indexOf(">",B);if(H===-1)return-1;W=H+1;continue}if($[W+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!_){W++;continue}if(_[1].toLowerCase()===X){if(K--,W+=_[0].length,K===0)return W;continue}W+=_[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 _=$.slice(W,j+1);if(!(/\/\s*>$/.test(_)||v7.has(X)))K++}W=j+1}return-1}function FK($,Z){let Y=Z,J=$.length;for(;;){while(Y<J&&$[Y]!=="<")Y++;if(Y>=J)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let X=$.indexOf(">",Y);if(X===-1)return!1;let Q=$.slice(Y,X+1);return LK.test(Q)}function f7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let X=(U)=>Z.some(([j,_])=>U>=j&&U<_),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,_,B,H,L,V]=K,O=HK(H);if(O===void 0)continue;let F=K.index,w=F+U.length,N=!!V||/\/\s*>$/.test(U)||v7.has(j.toLowerCase())?w:OK($,F,j,w);if(N===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&FK($,N)){Q.lastIndex=w;continue}if(O===!0){let T=`<${j}${_}${L}${V}>`;G.push({start:F,end:w,replacement:T});continue}G.push({start:F,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((U,j)=>U.start-j.start);let W=[],z=-1;for(let U of G){if(U.start<z)continue;W.push(U),z=U.end}let q=$;for(let U=W.length-1;U>=0;U--){let{start:j,end:_,replacement:B}=W[U];q=q.substring(0,j)+B+q.substring(_)}return q}function g7($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,X,Q=[];while((X=J.exec(Y))!==null){let G=X[1],K=X.index,W=K+X[0].length,z=1,q=W;while(q<Y.length&&z>0){if(Y[q]==="(")z++;else if(Y[q]===")")z--;q++}if(z!==0)continue;let U=Y.substring(W,q-1).trim(),j=q,_=P8(U);if(_.iterable){let R=_.iterable.trim();if(R.startsWith("[")||R.startsWith("{")||R.startsWith("'")||R.startsWith('"')||R.startsWith("`")||/^-?\d/.test(R))continue;if(Z){let N=R.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(_.style==="as")U=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let B=G==="for"?"@endfor":"@endforeach",H=1,L=j,V=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");V.lastIndex=j;let O;while((O=V.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let F=Y.substring(j,L-B.length).trim(),w=F.match(S8),A;if(w){let[,R,N,M]=w;A=`<${R}${N} @for="${U}">${M}</${R}>`}else A=`<template @for="${U}">${F}</template>`;Q.push({start:K,end:L,replacement:A})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:z}=Q[G];Y=Y.substring(0,K)+z+Y.substring(W)}return Y}function VK($){let Z=new Set,Y=[],J=0,X=0,Q=$.length,G=(q)=>{let U=J+1;while(U<Q){let j=$[U];if(j==="\\"){U+=2;continue}if(j===q)return U+1;U++}return Q},K=()=>{let q=J+2;while(q<Q&&$[q]!==`
7346
+ `+$}async function x7($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
7347
+ `}let{getCachedRouterScript:X}=await Promise.resolve().then(() => (v7(),C7)),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)+J+Q+`
7348
+ </body>`+$.slice(G+7)}var r$={};a(r$,{scanScriptTags:()=>P8,rewriteStxImportSpecifiers:()=>f8,processSignals:()=>u7,processScriptSetup:()=>v8,preEvalLiteralReactiveIfs:()=>h7,parseLoopExpression:()=>C8,hasSignalsSyntax:()=>s$,findMarkupIndexOutsideScripts:()=>o$,extractExports:()=>x8,convertSignalLoopsToAttributes:()=>d7,convertSignalDirectivesToAttributes:()=>g7});function P8($,Z={}){let Y=[];for(let J of B7($,L1)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.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=J.token.length-Q[0].length;Y.push({fullMatch:J.token,attrs:G,body:J.token.slice(K,W),start:J.start,end:J.end})}return Y}function C8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=E8(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=E8(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function E8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let 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 s$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function _K($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let X=J[1];if(X.startsWith("if"))Y++;else if(X==="endif")Y--;else if(Y===0)return!0}return!1}function BK($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,X;while((X=Y.exec($))!==null){let Q=X[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function HK($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function b8($,Z,Y){if(!$)return!1;let J=HK($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,W;while((W=K.exec(J))!==null){let j=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(k8.has(j))continue;if(Z.has(j))X=!0;else if(Y&&j in Y)Q=!0}let z=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,q;while((q=z.exec(J))!==null){let j=q[1];if(J.slice(0,q.index).trimEnd().endsWith("."))continue;if(k8.has(j)||Y&&j in Y)continue;G=!0}return(X||G)&&!Q}function n$($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,X=$.trim(),Q=X.match(y8);if(Q&&OK(Q[3],Q[1])){let[,G,K,W]=Q;return`<${G}${K}${J}>${W}</${G}>`}return`<template${J}>${X}</template>`}function OK($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,X;while((X=Y.exec($))!==null)if(X[1]){if(J--,J<0)return!1}else J++;return!0}function g7($,Z){let Y=BK($);function J(X){let Q=X,G=/@if\s*\(/g,K,W=[];while((K=G.exec(Q))!==null){let z=K.index,q=z+K[0].length,U=1,j=q;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")")U--;j++}if(U!==0)continue;let _=Q.substring(q,j-1).trim(),B=j,H=1,L=B,V=/@(if\s*\(|endif)/g;V.lastIndex=B;let O;while((O=V.exec(Q))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let F=Q.substring(B,L-6).trim(),w;if(_K(F)){let A=r5(Q.substring(z,L));if(A.length===0)continue;let R=A[0].branches.filter((T)=>T.type!=="else");if(!(R.length>0&&R.every((T)=>b8(T.condition,Y,Z))))continue;w=A[0].branches.map((T)=>{let I=J(T.content);if(T.type==="elseif")return n$(I,"@else-if",T.condition??"");if(T.type==="else")return n$(I,"@else");return n$(I,"@if",T.condition??"")}).join(`
7349
+ `)}else{if(!b8(_,Y,Z))continue;w=n$(J(F),"@if",_)}W.push({start:z,end:L,replacement:w}),G.lastIndex=L}for(let z=W.length-1;z>=0;z--){let{start:q,end:U,replacement:j}=W[z];Q=Q.substring(0,q)+j+Q.substring(U)}return Q}return J($)}function LK($){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 Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function FK($,Z,Y,J){if(f7.has(Y.toLowerCase()))return J;let X=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,W=J;while(W<G){let z=$.indexOf("<",W);if(z===-1)return-1;if(W=z,$.startsWith("<!--",W)){let _=$.indexOf("-->",W+4);if(_===-1)return-1;W=_+3;continue}let q=/^<(script|style)\b/i.exec($.slice(W,W+8));if(q){let _=$.indexOf(">",W);if(_===-1)return-1;if($[_-1]==="/"){W=_+1;continue}let B=Q.indexOf(`</${q[1].toLowerCase()}`,W);if(B===-1)return-1;let H=$.indexOf(">",B);if(H===-1)return-1;W=H+1;continue}if($[W+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!_){W++;continue}if(_[1].toLowerCase()===X){if(K--,W+=_[0].length,K===0)return W;continue}W+=_[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 _=$.slice(W,j+1);if(!(/\/\s*>$/.test(_)||f7.has(X)))K++}W=j+1}return-1}function wK($,Z){let Y=Z,J=$.length;for(;;){while(Y<J&&$[Y]!=="<")Y++;if(Y>=J)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let X=$.indexOf(">",Y);if(X===-1)return!1;let Q=$.slice(Y,X+1);return VK.test(Q)}function h7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let X=(U)=>Z.some(([j,_])=>U>=j&&U<_),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,_,B,H,L,V]=K,O=LK(H);if(O===void 0)continue;let F=K.index,w=F+U.length,N=!!V||/\/\s*>$/.test(U)||f7.has(j.toLowerCase())?w:FK($,F,j,w);if(N===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&wK($,N)){Q.lastIndex=w;continue}if(O===!0){let T=`<${j}${_}${L}${V}>`;G.push({start:F,end:w,replacement:T});continue}G.push({start:F,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((U,j)=>U.start-j.start);let W=[],z=-1;for(let U of G){if(U.start<z)continue;W.push(U),z=U.end}let q=$;for(let U=W.length-1;U>=0;U--){let{start:j,end:_,replacement:B}=W[U];q=q.substring(0,j)+B+q.substring(_)}return q}function d7($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,X,Q=[];while((X=J.exec(Y))!==null){let G=X[1],K=X.index,W=K+X[0].length,z=1,q=W;while(q<Y.length&&z>0){if(Y[q]==="(")z++;else if(Y[q]===")")z--;q++}if(z!==0)continue;let U=Y.substring(W,q-1).trim(),j=q,_=C8(U);if(_.iterable){let R=_.iterable.trim();if(R.startsWith("[")||R.startsWith("{")||R.startsWith("'")||R.startsWith('"')||R.startsWith("`")||/^-?\d/.test(R))continue;if(Z){let N=R.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(_.style==="as")U=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let B=G==="for"?"@endfor":"@endforeach",H=1,L=j,V=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");V.lastIndex=j;let O;while((O=V.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let F=Y.substring(j,L-B.length).trim(),w=F.match(y8),A;if(w){let[,R,N,M]=w;A=`<${R}${N} @for="${U}">${M}</${R}>`}else A=`<template @for="${U}">${F}</template>`;Q.push({start:K,end:L,replacement:A})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:z}=Q[G];Y=Y.substring(0,K)+z+Y.substring(W)}return Y}function AK($){let Z=new Set,Y=[],J=0,X=0,Q=$.length,G=(q)=>{let U=J+1;while(U<Q){let j=$[U];if(j==="\\"){U+=2;continue}if(j===q)return U+1;U++}return Q},K=()=>{let q=J+2;while(q<Q&&$[q]!==`
7350
7350
  `)q++;return q},W=()=>{let q=J+2;while(q<Q-1){if($[q]==="*"&&$[q+1]==="/")return q+2;q++}return Q},z=(q)=>{let U=q,j=0;while(U<Q){let _=$[U];if(_==="/"&&$[U+1]==="/"){let B=U+2;while(B<Q&&$[B]!==`
7351
- `)B++;U=B;continue}if(_==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(_==='"'||_==="'"||_==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===_){B++;break}B++}U=B;continue}if(_==="("||_==="["||_==="{"){j++,U++;continue}if(_===")"||_==="]"||_==="}"){j--,U++;continue}if(_===";"&&j===0)return U+1;U++}return Q};while(J<Q){let q=$[J];if(q==="/"&&$[J+1]==="/"){let U=K();Y.push($.slice(J,U)),J=U;continue}if(q==="/"&&$[J+1]==="*"){let U=W();Y.push($.slice(J,U)),J=U;continue}if(q==='"'||q==="'"||q==="`"){let U=G(q);Y.push($.slice(J,U)),J=U;continue}if(q==="{"){X++,Y.push(q),J++;continue}if(q==="}"){X--,Y.push(q),J++;continue}if(X===0){let U=J>0?$[J-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let _=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let B=_[2],H=z(J+_[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),J=H;continue}Z.add(B),Y.push($.slice(J,H)),J=H;continue}}}Y.push(q),J++}return Y.join("")}async function C8($,Z,Y){let J=y8($,{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 L of J){let V=L.body;if(y1(L.attrs))V=P1(V);if(X.test(V))Q.push({fullMatch:L.fullMatch,attrs:L.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${qK++}`,{hasUserImports:K,bundleClientScript:W}=await Promise.resolve().then(() => (v5(),C5)),z=[];for(let L=0;L<Q.length;L++){let V=Q[L].content;if(V=Z5(V).code,K(V))console.log("[stx:bundler] bundling signal script imports"),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,(F,w)=>x8(w));let O=s0(V);z.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
7351
+ `)B++;U=B;continue}if(_==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(_==='"'||_==="'"||_==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===_){B++;break}B++}U=B;continue}if(_==="("||_==="["||_==="{"){j++,U++;continue}if(_===")"||_==="]"||_==="}"){j--,U++;continue}if(_===";"&&j===0)return U+1;U++}return Q};while(J<Q){let q=$[J];if(q==="/"&&$[J+1]==="/"){let U=K();Y.push($.slice(J,U)),J=U;continue}if(q==="/"&&$[J+1]==="*"){let U=W();Y.push($.slice(J,U)),J=U;continue}if(q==='"'||q==="'"||q==="`"){let U=G(q);Y.push($.slice(J,U)),J=U;continue}if(q==="{"){X++,Y.push(q),J++;continue}if(q==="}"){X--,Y.push(q),J++;continue}if(X===0){let U=J>0?$[J-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let _=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let B=_[2],H=z(J+_[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),J=H;continue}Z.add(B),Y.push($.slice(J,H)),J=H;continue}}}Y.push(q),J++}return Y.join("")}async function v8($,Z,Y){let J=P8($,{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 L of J){let V=L.body;if(P1(L.attrs))V=C1(V);if(X.test(V))Q.push({fullMatch:L.fullMatch,attrs:L.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${jK++}`,{hasUserImports:K,bundleClientScript:W}=await Promise.resolve().then(() => (x5(),v5)),z=[];for(let L=0;L<Q.length;L++){let V=Q[L].content;if(V=Y5(V).code,K(V))console.log("[stx:bundler] bundling signal script imports"),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,(F,w)=>f8(w));let O=s0(V);z.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
7352
7352
  ${O}`)}let q=z.join(`
7353
7353
 
7354
- `);q=VK(q);let U=v8(q),j=U.split(",").map((L)=>L.trim()).filter(Boolean),_=R$(q,Y),B=`
7354
+ `);q=AK(q);let U=x8(q),j=U.split(",").map((L)=>L.trim()).filter(Boolean),_=N$(q,Y),B=`
7355
7355
  <script data-stx-scoped>
7356
7356
  function ${G}() {
7357
- ${X5("const",j)}
7357
+ ${Q5("const",j)}
7358
7358
  ${_}${q}
7359
7359
  return { ${U} };
7360
7360
  }
7361
7361
  window.__stx_latestSetup=${G};
7362
7362
  if(window.stx)window.stx._latestSetup=${G};
7363
- </script>`,H=$;for(let L of Q)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${I8})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],V=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${I8})>`,"gi"),(O,F,w)=>{if(V||L.includes(F.toLowerCase()))return O;return V=!0,`<${F}${w} data-stx="${G}">`})}return{output:H,setupCode:B}}function v8($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K="",W=()=>{Q++;let B=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!B){B=!0,Q++;continue}if(H==="]"&&B){B=!1,Q++;continue}if(H==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
7363
+ </script>`,H=$;for(let L of Q)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${D8})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],V=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${D8})>`,"gi"),(O,F,w)=>{if(V||L.includes(F.toLowerCase()))return O;return V=!0,`<${F}${w} data-stx="${G}">`})}return{output:H,setupCode:B}}function x8($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K="",W=()=>{Q++;let B=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!B){B=!0,Q++;continue}if(H==="]"&&B){B=!1,Q++;continue}if(H==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
7364
7364
  `)return;Q++}},z=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},q=(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]==='"')q(Z[Q]);else if(Z[Q]==="`")U();else Q++;continue}Q++}},j=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
7365
- `)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},_=()=>{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 F=B[2];if(!J.has(F))Y.push(F),J.add(F);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((F)=>{let w=F.trim();if(!w)return;let A=w.indexOf(":"),N=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(N&&!J.has(N))Y.push(N),J.add(N)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((F)=>{let w=F.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!J.has(A))Y.push(A),J.add(A)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let F=V[1];if(!J.has(F))Y.push(F),J.add(F);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!J.has(F))Y.push(F),J.add(F)}};while(Q<G){if(j())continue;if(Z[Q]==="'"||Z[Q]==='"'){q(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){U(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&z()){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])))_();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function h7($,Z,Y,J){if(!o$($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await C8(X,Y,J);if(X=Q,X=await T8(X,Z),X=M8(X),G){let q=n$(X,/<\/head>/i),U=q===-1?n$(X,/<body[^>]*>/i):-1;if(q!==-1)X=`${X.slice(0,q)}${G}
7365
+ `)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},_=()=>{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 F=B[2];if(!J.has(F))Y.push(F),J.add(F);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((F)=>{let w=F.trim();if(!w)return;let A=w.indexOf(":"),N=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(N&&!J.has(N))Y.push(N),J.add(N)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((F)=>{let w=F.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!J.has(A))Y.push(A),J.add(A)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let F=V[1];if(!J.has(F))Y.push(F),J.add(F);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!J.has(F))Y.push(F),J.add(F)}};while(Q<G){if(j())continue;if(Z[Q]==="'"||Z[Q]==='"'){q(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){U(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&z()){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])))_();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function u7($,Z,Y,J){if(!s$($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await v8(X,Y,J);if(X=Q,X=await I8(X,Z),X=T8(X),G){let q=o$(X,/<\/head>/i),U=q===-1?o$(X,/<body[^>]*>/i):-1;if(q!==-1)X=`${X.slice(0,q)}${G}
7366
7366
  ${X.slice(q)}`;else if(U!==-1){let j=/<body[^>]*>/i.exec(X.slice(U))[0],_=U+j.length;X=`${X.slice(0,_)}
7367
7367
  ${G}${X.slice(_)}`}else X=`${X}
7368
- ${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),z=W&&/data-stx/.test(W[1]);if(!G&&!z&&W&&!/data-stx-auto/.test(W[1])){let q=/<body[^>]*>/i,U=n$(X,q);if(U!==-1){let j=X.slice(0,U),_=X.slice(U).replace(q,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+_}}return X}function n$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],X;while((X=Y.exec($))!==null)J.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(!J.some(([q,U])=>W>=q&&W<U))return W;G=W+Math.max(K[0].length,1)}return-1}function x8($){let Z=[];for(let Y of $.split(",")){let J=Y.trim();if(!J||J.startsWith("type "))continue;let X=J.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 b8;return`var ${Z.join(", ")}; ${b8}`}var qK=0,I8=`(?:"[^"]*"|'[^']*'|[^>"'])*`,S8,E8,v7,LK,b8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var t5=S(()=>{h5();C$();l5();M0();C1();S8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;E8=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"]);v7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);LK=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import wK from"fs";import h from"path";function RK($){let Z=new WeakSet;try{let Y=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(Y);let X={};for(let Q of Object.keys(J).sort())X[Q]=Y(J[Q]);return X};return JSON.stringify(Y($))}catch{return null}}function f8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function NK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function y1($){return!NK($)}function P1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let X=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)X=X.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),X=X.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return X}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function MK($){let Z=[],Y=new Set,J=0,X=0,Q=$.length,G=(q)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let q=1;while(X<Q&&q>0)if($[X]==="{")q++,X++;else if($[X]==="}")q--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},W=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
7369
- `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},z=()=>{if(J!==0)return;let q=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(q){let B=q[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of B)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);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(!Y.has(B))Z.push(B),Y.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(!Y.has(B))Z.push(B),Y.add(B);return}let _=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){J++,X++;continue}if($[X]==="}"){J--,X++;continue}if(J===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))z();X++}return Z}function TK($){let Z=[],Y=0,J=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==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function IK($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function DK($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let X=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of TK(K)){let z=W.trim();if(!z||z.startsWith("..."))continue;let q=IK(z);if(q===-1)continue;let U=z.slice(0,q).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=z.slice(q+1).trim();if(!j)continue;try{let _=Object.keys(Z),B=Function(..._,`"use strict"; return (${j});`);Z[U]=B(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function t$($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let L of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(L))return!0}let z=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],q=typeof X.root==="string"?h.resolve(X.root):void 0,U=q??h.dirname(J),j=[],_=(L)=>{if(L&&!j.includes(L))j.push(L)},B=Y.__originalFilePath;if(B)_(h.join(h.dirname(B),"components"));_(Z),_(X._rootComponentsDir),_(h.join(h.dirname(J),"components")),_(X.componentsDir);let H=X._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(q)_(h.resolve(q,"resources/views/components")),_(h.resolve(q,"resources/components")),_(h.resolve(q,"src/components")),_(h.resolve(q,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(h.resolve(h.dirname(J),`${Q}.stx`));for(let L of j){let V=h.isAbsolute(L)?L:h.resolve(U,L);for(let O of z)if(await c(h.join(V,O)))return!0}return!1}function EK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function kK($){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 bK($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let X;while((X=Y.exec(J))!==null)Z.add(X[1]);Y.lastIndex=0}return[...Z]}async function d1($,Z,Y,J,X,Q,G,K=new Set,W){let{extractVariables:z}=await Promise.resolve().then(() => (o5(),y$)),q=K??new Set;if(q.has($))return`[Circular component reference: ${$}]`;let U=new Set(q);U.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=j&&j!=="load"&&EK(j)?j:"";try{let B=(P)=>P.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=X.__importedComponents;if(O){let P=[L,L.toLowerCase(),B(L),H(L)];for(let x of P)if(O.has(x)){V=O.get(x);break}}let F=[];if(!V){let P=[`${L}.stx`,`${B(L)}.stx`,`${H(L)}.stx`],x=[...new Set(P)],m=X.__originalFilePath,u=[];if(m){let z0=h.join(h.dirname(m),"components");u.push(z0)}if(J)u.push(J);let U0=G._rootComponentsDir;if(typeof U0==="string"&&!u.includes(U0))u.push(U0);let N0=h.join(h.dirname(Q),"components");if(!u.includes(N0))u.push(N0);if(G.componentsDir&&G.componentsDir!==J&&!u.includes(G.componentsDir))u.push(G.componentsDir);let G1=G._pluginComponentDirs;if(Array.isArray(G1)){for(let z0 of G1)if(typeof z0==="string"&&!u.includes(z0))u.push(z0)}let p0=typeof G.root==="string"?h.resolve(G.root):void 0,C0=p0??h.dirname(Q),o0=[];if(p0)o0.push(h.resolve(p0,"resources/views/components")),o0.push(h.resolve(p0,"resources/components")),o0.push(h.resolve(p0,"src/components")),o0.push(h.resolve(p0,"components"));o0.push(h.resolve(import.meta.dir,"components"));for(let z0 of o0)if(!u.includes(z0))u.push(z0);let E1=[...new Set(u.map((z0)=>{if(!z0)return z0;return h.isAbsolute(z0)?z0:h.resolve(C0,z0)}))];u.length=0,u.push(...E1);let _1=`${L}\x00${Q}\x00${E1.join("\x00")}`,e1=a$.get(_1);if(e1)if(await c(e1))V=e1;else a$.delete(_1);if(!V&&(L.startsWith("./")||L.startsWith("../")))V=h.resolve(h.dirname(Q),`${L}.stx`),F.push(V);else if(!V)for(let z0 of u){if(!z0)continue;for(let i of x){let h0=h.join(z0,i);if(F.push(h0),await c(h0)){V=h0;break}}if(V)break;if(!V)try{let i=await import("fs");if(!i.statSync(z0,{throwIfNoEntry:!1})?.isDirectory())continue;let k1=8,E5=[{path:z0,depth:0}];while(E5.length>0&&!V){let F$=E5.pop();if(F$.depth>=k1)continue;let o6;try{o6=i.readdirSync(F$.path,{withFileTypes:!0})}catch{continue}for(let V$ of o6){if(!V$.isDirectory())continue;if(V$.name==="node_modules"||V$.name.startsWith("."))continue;let s6=h.join(F$.path,V$.name);for(let JQ of x){let J7=h.join(s6,JQ);if(F.push(J7),await c(J7)){V=J7;break}}if(V)break;E5.push({path:s6,depth:F$.depth+1})}}}catch{}if(V)break}if(V)a$.set(_1,V)}if(!V||!await c(V)){let P=F.length>0?`
7368
+ ${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),z=W&&/data-stx/.test(W[1]);if(!G&&!z&&W&&!/data-stx-auto/.test(W[1])){let q=/<body[^>]*>/i,U=o$(X,q);if(U!==-1){let j=X.slice(0,U),_=X.slice(U).replace(q,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+_}}return X}function o$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],X;while((X=Y.exec($))!==null)J.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(!J.some(([q,U])=>W>=q&&W<U))return W;G=W+Math.max(K[0].length,1)}return-1}function f8($){let Z=[];for(let Y of $.split(",")){let J=Y.trim();if(!J||J.startsWith("type "))continue;let X=J.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 S8;return`var ${Z.join(", ")}; ${S8}`}var jK=0,D8=`(?:"[^"]*"|'[^']*'|[^>"'])*`,y8,k8,f7,VK,S8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var e5=S(()=>{d5();v$();c5();M0();v1();y8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;k8=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"]);f7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);VK=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import RK from"fs";import h from"path";function MK($){let Z=new WeakSet;try{let Y=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(Y);let X={};for(let Q of Object.keys(J).sort())X[Q]=Y(J[Q]);return X};return JSON.stringify(Y($))}catch{return null}}function g8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function TK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function P1($){return!TK($)}function C1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let X=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)X=X.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),X=X.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return X}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function IK($){let Z=[],Y=new Set,J=0,X=0,Q=$.length,G=(q)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let q=1;while(X<Q&&q>0)if($[X]==="{")q++,X++;else if($[X]==="}")q--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},W=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
7369
+ `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},z=()=>{if(J!==0)return;let q=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(q){let B=q[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of B)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);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(!Y.has(B))Z.push(B),Y.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(!Y.has(B))Z.push(B),Y.add(B);return}let _=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){J++,X++;continue}if($[X]==="}"){J--,X++;continue}if(J===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))z();X++}return Z}function DK($){let Z=[],Y=0,J=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==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function EK($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function kK($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let X=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of DK(K)){let z=W.trim();if(!z||z.startsWith("..."))continue;let q=EK(z);if(q===-1)continue;let U=z.slice(0,q).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=z.slice(q+1).trim();if(!j)continue;try{let _=Object.keys(Z),B=Function(..._,`"use strict"; return (${j});`);Z[U]=B(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function e$($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let L of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(L))return!0}let z=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],q=typeof X.root==="string"?h.resolve(X.root):void 0,U=q??h.dirname(J),j=[],_=(L)=>{if(L&&!j.includes(L))j.push(L)},B=Y.__originalFilePath;if(B)_(h.join(h.dirname(B),"components"));_(Z),_(X._rootComponentsDir),_(h.join(h.dirname(J),"components")),_(X.componentsDir);let H=X._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(q)_(h.resolve(q,"resources/views/components")),_(h.resolve(q,"resources/components")),_(h.resolve(q,"src/components")),_(h.resolve(q,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(h.resolve(h.dirname(J),`${Q}.stx`));for(let L of j){let V=h.isAbsolute(L)?L:h.resolve(U,L);for(let O of z)if(await c(h.join(V,O)))return!0}return!1}function bK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function SK($){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 yK($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let X;while((X=Y.exec(J))!==null)Z.add(X[1]);Y.lastIndex=0}return[...Z]}async function u1($,Z,Y,J,X,Q,G,K=new Set,W){let{extractVariables:z}=await Promise.resolve().then(() => (s5(),P$)),q=K??new Set;if(q.has($))return`[Circular component reference: ${$}]`;let U=new Set(q);U.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=j&&j!=="load"&&bK(j)?j:"";try{let B=(P)=>P.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=X.__importedComponents;if(O){let P=[L,L.toLowerCase(),B(L),H(L)];for(let x of P)if(O.has(x)){V=O.get(x);break}}let F=[];if(!V){let P=[`${L}.stx`,`${B(L)}.stx`,`${H(L)}.stx`],x=[...new Set(P)],m=X.__originalFilePath,u=[];if(m){let z0=h.join(h.dirname(m),"components");u.push(z0)}if(J)u.push(J);let U0=G._rootComponentsDir;if(typeof U0==="string"&&!u.includes(U0))u.push(U0);let N0=h.join(h.dirname(Q),"components");if(!u.includes(N0))u.push(N0);if(G.componentsDir&&G.componentsDir!==J&&!u.includes(G.componentsDir))u.push(G.componentsDir);let K1=G._pluginComponentDirs;if(Array.isArray(K1)){for(let z0 of K1)if(typeof z0==="string"&&!u.includes(z0))u.push(z0)}let p0=typeof G.root==="string"?h.resolve(G.root):void 0,C0=p0??h.dirname(Q),o0=[];if(p0)o0.push(h.resolve(p0,"resources/views/components")),o0.push(h.resolve(p0,"resources/components")),o0.push(h.resolve(p0,"src/components")),o0.push(h.resolve(p0,"components"));o0.push(h.resolve(import.meta.dir,"components"));for(let z0 of o0)if(!u.includes(z0))u.push(z0);let k1=[...new Set(u.map((z0)=>{if(!z0)return z0;return h.isAbsolute(z0)?z0:h.resolve(C0,z0)}))];u.length=0,u.push(...k1);let B1=`${L}\x00${Q}\x00${k1.join("\x00")}`,$5=t$.get(B1);if($5)if(await c($5))V=$5;else t$.delete(B1);if(!V&&(L.startsWith("./")||L.startsWith("../")))V=h.resolve(h.dirname(Q),`${L}.stx`),F.push(V);else if(!V)for(let z0 of u){if(!z0)continue;for(let i of x){let h0=h.join(z0,i);if(F.push(h0),await c(h0)){V=h0;break}}if(V)break;if(!V)try{let i=await import("fs");if(!i.statSync(z0,{throwIfNoEntry:!1})?.isDirectory())continue;let b1=8,k5=[{path:z0,depth:0}];while(k5.length>0&&!V){let V$=k5.pop();if(V$.depth>=b1)continue;let s6;try{s6=i.readdirSync(V$.path,{withFileTypes:!0})}catch{continue}for(let w$ of s6){if(!w$.isDirectory())continue;if(w$.name==="node_modules"||w$.name.startsWith("."))continue;let r6=h.join(V$.path,w$.name);for(let QQ of x){let Q7=h.join(r6,QQ);if(F.push(Q7),await c(Q7)){V=Q7;break}}if(V)break;k5.push({path:r6,depth:V$.depth+1})}}}catch{}if(V)break}if(V)t$.set(B1,V)}if(!V||!await c(V)){let P=F.length>0?`
7370
7370
  Searched paths:
7371
7371
  ${F.map((x)=>` - ${x}`).join(`
7372
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}W.add(V);let w;if(r$.has(V))w=r$.get(V);else try{w=await Bun.file(V).text(),r$.set(V,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),R={};for(let[P,x]of Object.entries(X))if(!P.startsWith("__")||A.has(P))R[P]=x;let{extractSlotContent:N}=await Promise.resolve().then(() => (T7(),M7)),M=N(Y),T={};if(M.defaultSlot?.trim())T.default=M.defaultSlot;for(let[P,x]of M.namedSlots)T[P]=x.content;let I={...R,...Z,props:Z,slot:Y,$slots:T,__processedComponents:U,__sections:{},...kK(Y)&&{__stx_force_signals:!0}};DK(w,I);let E=w,D=k$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...w.matchAll(y)],k=[],v=b.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&b.every((P)=>/\bserver\b/.test(P[1]||"")),g=null,f=null;if(v){let P=RK({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){g=`${V}\x00${P}`;let x=d7.get(g);if(x){for(let m of x.dependencies)W.add(m);return x.output}f=new Set(W)}}for(let P of b){let x=P[1]||"",m=P[2]||"",u=x.includes("server");if(y1(x)&&m.trim())m=P1(m);if(u&&m)try{await z(m,I,V)}catch(N0){}if(!u){let N0=m.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),G1=N0.includes("{{")&&N0.includes("}}"),p0=N0.includes("{!!")&&N0.includes("!!}");if(G1||p0)N0=I$(N0,I);let C0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${C0}>${N0}</script>`)}}let d=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),p=d?d[1]:"",X0=d?d[2]:"",Z0="",V0=p&&/\bscoped\b/i.test(p);if(d)Z0=`<style${p}>${X0}</style>`;let r=E;if(r=r.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),d)r=r.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(r=r.replace(P,(m,u)=>{let U0=u.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(U0)x.push(`<style${U0[1]}>${U0[2]}</style>`);return""}),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)Z0=`${Z0}${x.join(`
7373
- `)}`}if(Y&&r.includes("{{ text || slot }}"))r=r.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:Q0}=await Promise.resolve().then(() => (T7(),M7)),{defaultSlot:k0,namedSlots:n0}=M;r=await Q0(r,k0,n0,I);for(let[P,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let m=_7(x);I[P]=m}}let j1=k.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),t1=bK(k);if(t1.length>0)I.__stx_client_signal_names=t1;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:j1||k.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let J0=await O0(r,I,V,n,W),B0=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let P of J0.matchAll(/\{\{([\s\S]*?)\}\}/g))B0.add(P[1].trim());if(B0.size>0)X.__stx_preserved_client_expressions=[...B0];let R0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++AK}_${Math.random().toString(36).slice(2,8)}`,C=J0;if(j1){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${f8(JSON.stringify(Z))}"`}catch{}let x=_?` stx-hydrate="${f8(_)}"`:"";C=`<div data-stx-scope="${R0}"${P}${x}>${J0}</div>`;let m=await Promise.all(k.map(async(u)=>{let U0=u.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!U0)return u;let[,N0,G1]=U0,p0=w$(G1,{filePath:V,projectRoot:process.cwd()}),C0=p0.code,o0=A$(p0.styles);C0=Z5(C0).code;let{hasUserImports:E1,bundleClientScript:_1}=await Promise.resolve().then(() => (v5(),C5));if(E1(C0))C0=await _1(C0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:e1}=await Promise.resolve().then(() => (t5(),s$));C0=C0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(k1,E5)=>e1(E5));let z0=s0(C0),i=MK(z0),h0=`
7372
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}W.add(V);let w;if(a$.has(V))w=a$.get(V);else try{w=await Bun.file(V).text(),a$.set(V,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),R={};for(let[P,x]of Object.entries(X))if(!P.startsWith("__")||A.has(P))R[P]=x;let{extractSlotContent:N}=await Promise.resolve().then(() => (D7(),I7)),M=N(Y),T={};if(M.defaultSlot?.trim())T.default=M.defaultSlot;for(let[P,x]of M.namedSlots)T[P]=x.content;let I={...R,...Z,props:Z,slot:Y,$slots:T,__processedComponents:U,__sections:{},...SK(Y)&&{__stx_force_signals:!0}};kK(w,I);let E=w,D=b$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...w.matchAll(y)],k=[],v=b.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&b.every((P)=>/\bserver\b/.test(P[1]||"")),g=null,f=null;if(v){let P=MK({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){g=`${V}\x00${P}`;let x=m7.get(g);if(x){for(let m of x.dependencies)W.add(m);return x.output}f=new Set(W)}}for(let P of b){let x=P[1]||"",m=P[2]||"",u=x.includes("server");if(P1(x)&&m.trim())m=C1(m);if(u&&m)try{await z(m,I,V)}catch(N0){}if(!u){let N0=m.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),K1=N0.includes("{{")&&N0.includes("}}"),p0=N0.includes("{!!")&&N0.includes("!!}");if(K1||p0)N0=D$(N0,I);let C0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${C0}>${N0}</script>`)}}let d=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),p=d?d[1]:"",X0=d?d[2]:"",Z0="",V0=p&&/\bscoped\b/i.test(p);if(d)Z0=`<style${p}>${X0}</style>`;let r=E;if(r=r.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),d)r=r.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(r=r.replace(P,(m,u)=>{let U0=u.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(U0)x.push(`<style${U0[1]}>${U0[2]}</style>`);return""}),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)Z0=`${Z0}${x.join(`
7373
+ `)}`}if(Y&&r.includes("{{ text || slot }}"))r=r.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:Q0}=await Promise.resolve().then(() => (D7(),I7)),{defaultSlot:k0,namedSlots:n0}=M;r=await Q0(r,k0,n0,I);for(let[P,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let m=H7(x);I[P]=m}}let _1=k.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),e1=yK(k);if(e1.length>0)I.__stx_client_signal_names=e1;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:_1||k.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let J0=await O0(r,I,V,n,W),B0=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let P of J0.matchAll(/\{\{([\s\S]*?)\}\}/g))B0.add(P[1].trim());if(B0.size>0)X.__stx_preserved_client_expressions=[...B0];let R0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++NK}_${Math.random().toString(36).slice(2,8)}`,C=J0;if(_1){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${g8(JSON.stringify(Z))}"`}catch{}let x=_?` stx-hydrate="${g8(_)}"`:"";C=`<div data-stx-scope="${R0}"${P}${x}>${J0}</div>`;let m=await Promise.all(k.map(async(u)=>{let U0=u.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!U0)return u;let[,N0,K1]=U0,p0=A$(K1,{filePath:V,projectRoot:process.cwd()}),C0=p0.code,o0=R$(p0.styles);C0=Y5(C0).code;let{hasUserImports:k1,bundleClientScript:B1}=await Promise.resolve().then(() => (x5(),v5));if(k1(C0))C0=await B1(C0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:$5}=await Promise.resolve().then(() => (e5(),r$));C0=C0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(b1,k5)=>$5(k5));let z0=s0(C0),i=IK(z0),h0=`
7374
7374
  (function() {
7375
- ${X5("const",[...u9,...i],z0)}
7375
+ ${Q5("const",[...m9,...i],z0)}
7376
7376
  const __scope = window.stx._scopes = window.stx._scopes || {};
7377
7377
  const __scopeVars = __scope['${R0}'] = __scope['${R0}'] || {};
7378
7378
  const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
@@ -7390,7 +7390,7 @@ ${z0}
7390
7390
  // Register all defined signals and functions in this scope
7391
7391
  const __localVars = {};
7392
7392
  try {
7393
- ${i.map((k1)=>`if (typeof ${k1} !== 'undefined') __localVars['${k1}'] = ${k1};`).join(`
7393
+ ${i.map((b1)=>`if (typeof ${b1} !== 'undefined') __localVars['${b1}'] = ${b1};`).join(`
7394
7394
  `)}
7395
7395
  }
7396
7396
  catch (e) {}
@@ -7403,11 +7403,11 @@ finally {
7403
7403
  `+m.join(`
7404
7404
  `),Z0)C+=`
7405
7405
  `+Z0}else{if(Z0)C+=`
7406
- `+Z0;if(k.length>0){let P=I.__stx_event_bindings||[],x=f5(I),m=await Promise.all(k.map(async(u)=>{let U0=u.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!U0)return u;return await g5(U0[1],{eventBindings:P,templateContent:C,filePath:V,projectRoot:process.cwd(),serverData:x})}));C+=`
7406
+ `+Z0;if(k.length>0){let P=I.__stx_event_bindings||[],x=g5(I),m=await Promise.all(k.map(async(u)=>{let U0=u.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!U0)return u;return await h5(U0[1],{eventBindings:P,templateContent:C,filePath:V,projectRoot:process.cwd(),serverData:x})}));C+=`
7407
7407
  `+m.join(`
7408
- `),I.__stx_event_bindings=[]}}if(V0){let P=E$(C,V);if(P.hasScoped)C=P.html}if(g&&f)d7.set(g,{output:C,dependencies:[...W].filter((P)=>!f.has(P))});return C}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{q.delete($)}}async function c($){return Bun.file($).exists()}function u7($,Z){let Y=h.resolve(Z),J=h.resolve($),X=Y.endsWith(h.sep)?Y:Y+h.sep;if(J===Y||J.startsWith(X))return J;return null}async function m7($,Z,Y,J){let X=await SK($,Z,Y,J);if(X===null)return null;let Q=u7(X,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(u7(X,W))return h.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function SK($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=h.join(Q,$),_=u7(j,Q);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await c(_)&&J)J.add(_);return _}let G=h.join(X,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let _=`${G}${j}`;if(await c(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(J)J.add(_);return _}}let K="",W=h.resolve(X),z=process.cwd();for(let j=0;j<10;j++){let _=h.join(W,"layouts"),B=!1;try{B=wK.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=_;break}let H=h.dirname(W);if(H===W||H.length<z.length)break;W=H}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,_=h.join(K,j);if(await c(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(J)J.add(_);return _}if(!j.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.layoutsDir){let j=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,B=h.join(j,_);if(await c(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let H=`${B}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(J)J.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),_=h.join(Y.partialsDir||X,"layouts",j[1]);if(await c(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(J)J.add(_);return _}if(!_.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await c(K)){let j=h.join(K,$);if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}}let q=Y.partialsDir||h.join(process.cwd(),"views"),U=h.join(q,$);if(await c(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(J)J.add(j);return j}}if(X.includes("temp")){let j=h.join(h.dirname(X),"layouts",$);if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function g8($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
7408
+ `),I.__stx_event_bindings=[]}}if(V0){let P=k$(C,V);if(P.hasScoped)C=P.html}if(g&&f)m7.set(g,{output:C,dependencies:[...W].filter((P)=>!f.has(P))});return C}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{q.delete($)}}async function c($){return Bun.file($).exists()}function p7($,Z){let Y=h.resolve(Z),J=h.resolve($),X=Y.endsWith(h.sep)?Y:Y+h.sep;if(J===Y||J.startsWith(X))return J;return null}async function l7($,Z,Y,J){let X=await PK($,Z,Y,J);if(X===null)return null;let Q=p7(X,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(p7(X,W))return h.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function PK($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=h.join(Q,$),_=p7(j,Q);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await c(_)&&J)J.add(_);return _}let G=h.join(X,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let _=`${G}${j}`;if(await c(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(J)J.add(_);return _}}let K="",W=h.resolve(X),z=process.cwd();for(let j=0;j<10;j++){let _=h.join(W,"layouts"),B=!1;try{B=RK.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=_;break}let H=h.dirname(W);if(H===W||H.length<z.length)break;W=H}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,_=h.join(K,j);if(await c(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(J)J.add(_);return _}if(!j.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.layoutsDir){let j=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,B=h.join(j,_);if(await c(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let H=`${B}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(J)J.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),_=h.join(Y.partialsDir||X,"layouts",j[1]);if(await c(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(J)J.add(_);return _}if(!_.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await c(K)){let j=h.join(K,$);if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}}let q=Y.partialsDir||h.join(process.cwd(),"views"),U=h.join(q,$);if(await c(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(J)J.add(j);return j}}if(X.includes("temp")){let j=h.join(h.dirname(X),"layouts",$);if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function h8($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
7409
7409
  `),K=0;for(let W=0;W<G.length;W++)if(K+=G[W].length+1,K>=Z){J=W+1,X=G[W].trim();let z=Math.max(0,W-2),q=Math.min(G.length,W+3);Q=G.slice(z,q).map((U,j)=>{let _=z+j+1;return`${_===J?"> ":" "}${_}: ${U}`}).join(`
7410
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return g8($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function q0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=g8(J,X,Q),W=Y.split("/").pop(),z=0;if(typeof X==="number"&&X>=0&&J){let U=J.lastIndexOf(`
7410
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return h8($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function q0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=h8(J,X,Q),W=Y.split("/").pop(),z=0;if(typeof X==="number"&&X>=0&&J){let U=J.lastIndexOf(`
7411
7411
  `,Math.max(0,X-1));z=X-(U+1)+1}let q="";if(G>0)q+=`
7412
7412
  ${Y}:${G}${z>0?`:${z}`:""}: ${$.toLowerCase()} error: ${Z}
7413
7413
  `;if(q+=`
@@ -7420,8 +7420,8 @@ ${t.yellow}${t.bold}Message:${t.reset} ${Z}
7420
7420
  `,K)q+=`
7421
7421
  ${t.blue}${t.bold}Context:${t.reset}
7422
7422
  ${t.dim}${K}${t.reset}
7423
- `;return q}function N8(){r$.clear(),a$.clear(),d7.clear()}var r$,a$,d7,AK=0,t;var M0=S(()=>{h5();Y1();l5();K5();e$();b1();L7();F7();r9();o5();r$=new v1(500),a$=new v1(1000),d7=new v1(2000);t={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function h8($,Z,Y=""){let J=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),z=W?W[1]:"",q=K+G[0].length,U=1,j=q,_=-1;while(U>0&&j<$.length){let L=$.indexOf("@markdown",j),V=$.indexOf("@endmarkdown",j);if(V===-1)break;if(L!==-1&&L<V&&L!==K){let O=$[L+9];if(O==="("||O===`
7424
- `||O==="\r"||O===" "||O===void 0)U++;j=L+9}else{if(U--,U===0){_=V;break}j=V+12}}if(_===-1)continue;let B=$.slice(q,_),H=$.slice(K,_+12);X.push({fullMatch:H,options:z,content:B,index:K}),Q.lastIndex=_+12}for(let{fullMatch:K,options:W,content:z,index:q}of X)try{let U={};if(W)W.split(",").forEach((B)=>{let H=B.trim();if(H)U[H]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},_=P5(z.trim(),j);J=J.split(K).join(_)}catch(U){let j=U instanceof Error?U.message:String(U),_=q0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,q,K);J=J.split(K).join(_)}return J}async function d8($,Z,Y,J){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}),P5($.trim(),X)}var p7=S(()=>{M0()});function CK($){if(yK.set($.name,$),$.client)PK.set($.name,$.client)}function $4($){return CK($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=vK(J,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let z=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(z)}}let K=Y;if($.transform)K=await $.transform(Y,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 vK($,Z){let Y={...Z};for(let J of $){let X=J.indexOf(":"),Q=J.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=J.slice(0,G).trim(),W=J.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{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var yK,PK;var l7=S(()=>{yK=new Map,PK=new Map});function c7($,Z=U5,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${$$($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function u8($,Z,Y=xK,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${$$($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function i7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=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 J.push(Z),J.join(", ")}function $$($,Z={}){let Y=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(Y.length===0)return $;let J=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${J}`}function n7($){return fK[$]||"application/octet-stream"}var U5,xK,e5,fK;var o7=S(()=>{U5=[320,480,640,768,1024,1280,1536,1920,2560],xK=[1,1.5,2,3],e5=["avif","webp","jpeg"],fK={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function hK(){try{return await import("ts-images")}catch{return null}}async function dK($,Z={}){let Y={...gK,...Z},J=await hK();if(J)try{return await uK($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return mK($,Y)}async function uK($,Z,Y){let{generatePlaceholder:J,generateThumbHash:X}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await X($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function mK($,Z){let Y=Z.width||20,J=Z.height||Y,X="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function m8($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
7423
+ `;return q}function M8(){a$.clear(),t$.clear(),m7.clear()}var a$,t$,m7,NK=0,t;var M0=S(()=>{d5();J1();c5();W5();$4();S1();V7();w7();a9();s5();a$=new x1(500),t$=new x1(1000),m7=new x1(2000);t={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function d8($,Z,Y=""){let J=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),z=W?W[1]:"",q=K+G[0].length,U=1,j=q,_=-1;while(U>0&&j<$.length){let L=$.indexOf("@markdown",j),V=$.indexOf("@endmarkdown",j);if(V===-1)break;if(L!==-1&&L<V&&L!==K){let O=$[L+9];if(O==="("||O===`
7424
+ `||O==="\r"||O===" "||O===void 0)U++;j=L+9}else{if(U--,U===0){_=V;break}j=V+12}}if(_===-1)continue;let B=$.slice(q,_),H=$.slice(K,_+12);X.push({fullMatch:H,options:z,content:B,index:K}),Q.lastIndex=_+12}for(let{fullMatch:K,options:W,content:z,index:q}of X)try{let U={};if(W)W.split(",").forEach((B)=>{let H=B.trim();if(H)U[H]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},_=C5(z.trim(),j);J=J.split(K).join(_)}catch(U){let j=U instanceof Error?U.message:String(U),_=q0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,q,K);J=J.split(K).join(_)}return J}async function u8($,Z,Y,J){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}),C5($.trim(),X)}var c7=S(()=>{M0()});function xK($){if(CK.set($.name,$),$.client)vK.set($.name,$.client)}function Z4($){return xK($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=fK(J,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let z=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(z)}}let K=Y;if($.transform)K=await $.transform(Y,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 fK($,Z){let Y={...Z};for(let J of $){let X=J.indexOf(":"),Q=J.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=J.slice(0,G).trim(),W=J.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{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var CK,vK;var i7=S(()=>{CK=new Map,vK=new Map});function n7($,Z=j5,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${Z$($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function m8($,Z,Y=gK,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${Z$($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function o7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=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 J.push(Z),J.join(", ")}function Z$($,Z={}){let Y=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(Y.length===0)return $;let J=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${J}`}function s7($){return hK[$]||"application/octet-stream"}var j5,gK,$$,hK;var r7=S(()=>{j5=[320,480,640,768,1024,1280,1536,1920,2560],gK=[1,1.5,2,3],$$=["avif","webp","jpeg"],hK={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function uK(){try{return await import("ts-images")}catch{return null}}async function mK($,Z={}){let Y={...dK,...Z},J=await uK();if(J)try{return await pK($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return lK($,Y)}async function pK($,Z,Y){let{generatePlaceholder:J,generateThumbHash:X}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await X($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function lK($,Z){let Y=Z.width||20,J=Z.height||Y,X="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function p8($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
7425
7425
  #${$} {
7426
7426
  --stx-img-transition-duration: ${J}ms;
7427
7427
  --stx-img-transition-easing: ${X};
@@ -7438,7 +7438,7 @@ ${t.dim}${K}${t.reset}
7438
7438
  #${$}.stx-img-loaded img {
7439
7439
  opacity: 1;
7440
7440
  }
7441
- `.trim()}async function p8($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(s7.has(Y))return s7.get(Y);let J=await dK($,Z);return s7.set(Y,J),J}var gK,r7,s7;var l8=S(()=>{gK={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},r7=`
7441
+ `.trim()}async function l8($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(a7.has(Y))return a7.get(Y);let J=await mK($,Z);return a7.set(Y,J),J}var dK,t7,a7;var c8=S(()=>{dK={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},t7=`
7442
7442
  .stx-img-placeholder {
7443
7443
  position: relative;
7444
7444
  overflow: hidden;
@@ -7467,8 +7467,8 @@ ${t.dim}${K}${t.reset}
7467
7467
  filter: blur(0);
7468
7468
  transform: scale(1);
7469
7469
  }
7470
- `.trim();s7=new Map});import{createHash as i8}from"crypto";import{readFile as pK,stat as n8}from"fs/promises";async function b0($){try{let Z=await pK($);return i8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function c8($){return i8("sha256").update($).digest("hex").slice(0,16)}function Z4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${c8($)}-${c8(Y)}`}async function a7($){try{return(await n8($)).mtimeMs}catch{return 0}}async function D0($){try{return await n8($),!0}catch{return!1}}var u1=()=>{};import{mkdir as lK,readFile as cK,writeFile as iK,readdir as VO,rm as nK,stat as wO}from"fs/promises";import{join as s8,dirname as oK}from"path";async function sK($){try{await lK($,{recursive:!0})}catch{}}function r8($,Z,Y){return s8($,Y,`${Z}.json`)}async function o8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await a7(Z)!==$.srcMtime)return!1;return!0}async function Y4($,Z,Y,J=t7){if(!J.enabled)return null;let X=Z4($,Z),Q=j5.get(X);if(Q){if(await o8(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;j5.delete(X)}let G=r8(J.directory,X,Y);if(await D0(G))try{let K=await cK(G,"utf-8"),W=JSON.parse(K);if(await o8(W,$,J.maxAge))return W.lastAccessedAt=Date.now(),j5.set(X,W),W.data}catch{}return null}async function J4($,Z,Y,J,X=t7){if(!X.enabled)return;let Q=Z4($,Z),G=await b0($),K=await a7($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:Z4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};j5.set(Q,W);let z=r8(X.directory,Q,J);try{await sK(oK(z)),await iK(z,JSON.stringify(W,null,2))}catch(q){console.warn(`[stx-media] Failed to write cache: ${q}`)}}async function X4($,Z=t7){if($==="all")j5.clear();else j5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=s8(Z.directory,J);try{await nK(X,{recursive:!0,force:!0})}catch{}}}var j5,t7;var e7=S(()=>{u1();j5=new Map,t7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class G4{config;constructor($={}){this.config={...rK,...$}}async get($,Z){return Y4($,Z,"image",this.config)}async set($,Z,Y){return J4($,Z,Y,"image",this.config)}async clear(){return X4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function $3($){if(!Q4)Q4=new G4($);else if($)Q4.updateConfig($);return Q4}async function K4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return $3(J).get($,Z)}async function W4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return $3(X).set($,Z,Y)}async function a8(){return $3().clear()}var rK,Q4=null;var Z3=S(()=>{e7();rK={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as aK,basename as tK,extname as eK,join as $W}from"path";import{mkdir as ZW}from"fs/promises";async function Y3(){try{return await import("ts-images")}catch{return null}}function t8($){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 YW($,Z){let Y=Z?t8(Z):t8("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function e8($,Z,Y){let J=await Y3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await K4($,Z,Y);if(X)return X;try{let Q=aK($);if(!await D0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=YW(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await ZW(K,{recursive:!0});let z=await b0(Q),q=tK($,eK($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:z},_=null;if(Z.transformations&&Z.transformations.length>0)_=await J3(Q,Z.transformations,J);for(let B of U){let H=G[B]||{},L=`${q}-${z}.${B}`,V=$W(K,L);try{let O=await J.optimizeImage({input:_||Q,output:V,format:B,quality:H.quality,progressive:H.progressive});if(O){if(j.variants.push({path:V,url:`${W}/${L}`,width:O.width||0,height:O.height||0,format:B,size:O.outputSize||0}),!j.originalWidth&&O.width)j.originalWidth=O.width,j.originalHeight=O.height}}catch(O){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await J.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 J.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 W4($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function $Z($,Z,Y,J){let X=await Y3();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function J3($,Z,Y){let J=Y||await Y3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await J.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await J.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await J.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await J.sharpen(X,G.amount);break;case"grayscale":X=await J.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await J.rotate(X,G.angle);break;case"flip":X=await J.flip(X);break;case"flop":X=await J.flop(X);break;case"brightness":if(G.value!==void 0)X=await J.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await J.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await J.saturation(X,G.value);break}}return await J.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var ZZ=S(()=>{u1();Z3()});import{resolve as JW,basename as XW,extname as QW,join as GW}from"path";import{mkdir as KW}from"fs/promises";async function WW(){try{return await import("ts-images")}catch{return null}}async function YZ($,Z,Y){let J=await WW();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=JW($);if(!await D0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||zW,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await KW(K,{recursive:!0});let z=await b0(X),q=XW($,QW($)),U=Y.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 H=[];for(let L of Q){let V=`${q}-${L}w-${z}.${B}`,O=GW(K,V),F=`${W}/${V}`;try{let w=U[B]?.quality||80;if(await D0(O)){j.byFormat[B].push({path:O,url:F,width:L,height:0,format:B,size:0}),H.push(`${F} ${L}w`);continue}let A=await J.processImage({input:X,output:O,format:B,quality:w,resize:{width:L}});if(A)j.byFormat[B].push({path:O,url:F,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),H.push(`${F} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${L}w: ${w}`)}}j.srcsets[B]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let B=await J.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await J.generatePlaceholder(X,{strategy:_,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:_}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||qW(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function qW($){let Z=[...$].sort((J,X)=>J-X),Y=[];for(let J=0;J<Z.length-1;J++){let X=Z[J];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function JZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var zW;var XZ=S(()=>{u1();zW=[320,480,640,768,1024,1280,1536,1920]});var QZ={};a(QZ,{setCachedImageResult:()=>W4,processImage:()=>e8,optimizeImage:()=>$Z,getCachedImageResult:()=>K4,generateSrcset:()=>JZ,generateResponsiveVariants:()=>YZ,clearImageCache:()=>a8,applyTransformations:()=>J3,ImageProcessorCache:()=>G4});var GZ=S(()=>{ZZ();XZ();Z3()});async function UW(){try{return await Promise.resolve().then(() => (GZ(),QZ))}catch($){if(!KZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),KZ=!0;return null}}async function z4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return HW(J,Y)}if(Y.processedResult?.processed)return K3($,Y.processedResult,Z);if(Y.responsiveVariants)return UZ($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:z=U5,dpr:q,formats:U=e5,quality:j=X3,params:_={},placeholder:B="none",placeholderOptions:H={},lazy:L=!0,priority:V=!1,loading:O=V?"eager":U4,decoding:F=q4,fetchpriority:w,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:M}=$,T=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:b=""}=Z;if(y&&!Z.optimize)return BW($);let k,v,g=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!V)try{k=await p8(X,{strategy:B,...H}),v=m8(g,k,H)}catch{}let f=q!==void 0&&G!==void 0,d;if(f)d=_W($,g,k,Z);else d=await jW($,g,k,Z);let p;if(V){let V0=U.includes("webp")?"webp":U[0],r=c7(X,z,{..._,q:j},V0),Q0=typeof W==="object"?i7(W):W||"100vw";p=`<link rel="preload" as="image" imagesrcset="${r}" imagesizes="${Q0}" />`}let X0=[];if(!WZ&&B!=="none")X0.push(r7),WZ=!0;if(v)X0.push(v);let Z0=L?qZ(g):void 0;return{html:d,preloadLink:p,css:X0.length>0?X0.join(`
7471
- `):void 0,script:Z0}}async function jW($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,sizes:W,widths:z=U5,formats:q=e5,quality:U=X3,params:j={},lazy:_=!0,priority:B=!1,loading:H=B?"eager":U4,decoding:L=q4,fetchpriority:V,objectFit:O,objectPosition:F,crossorigin:w,referrerpolicy:A}=$,R=$.class,N=$.style,M=$.data||{},T=typeof W==="object"?i7(W):W||"100vw",I=[];for(let y of q){let b=c7(X,z,{...j,q:U},y),k=n7(y);if(_&&!B)I.push(` <source type="${k}" data-srcset="${b}" data-sizes="${T}" />`);else I.push(` <source type="${k}" srcset="${b}" sizes="${T}" />`)}let E=Q3({src:$$(X,{...j,q:U}),alt:Q,width:G,height:K,loading:B?void 0:H,decoding:L,fetchpriority:B?"high":V,objectFit:O,objectPosition:F,crossorigin:w,referrerpolicy:A,className:zZ(R,Y),style:G3(N,O,F,Y),lazy:_&&!B,data:M}),D;if(Y){let y=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
7470
+ `.trim();a7=new Map});import{createHash as n8}from"crypto";import{readFile as cK,stat as o8}from"fs/promises";async function b0($){try{let Z=await cK($);return n8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function i8($){return n8("sha256").update($).digest("hex").slice(0,16)}function Y4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${i8($)}-${i8(Y)}`}async function e7($){try{return(await o8($)).mtimeMs}catch{return 0}}async function D0($){try{return await o8($),!0}catch{return!1}}var m1=()=>{};import{mkdir as iK,readFile as nK,writeFile as oK,readdir as RO,rm as sK,stat as NO}from"fs/promises";import{join as r8,dirname as rK}from"path";async function aK($){try{await iK($,{recursive:!0})}catch{}}function a8($,Z,Y){return r8($,Y,`${Z}.json`)}async function s8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await e7(Z)!==$.srcMtime)return!1;return!0}async function J4($,Z,Y,J=$3){if(!J.enabled)return null;let X=Y4($,Z),Q=_5.get(X);if(Q){if(await s8(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;_5.delete(X)}let G=a8(J.directory,X,Y);if(await D0(G))try{let K=await nK(G,"utf-8"),W=JSON.parse(K);if(await s8(W,$,J.maxAge))return W.lastAccessedAt=Date.now(),_5.set(X,W),W.data}catch{}return null}async function X4($,Z,Y,J,X=$3){if(!X.enabled)return;let Q=Y4($,Z),G=await b0($),K=await e7($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:Y4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};_5.set(Q,W);let z=a8(X.directory,Q,J);try{await aK(rK(z)),await oK(z,JSON.stringify(W,null,2))}catch(q){console.warn(`[stx-media] Failed to write cache: ${q}`)}}async function Q4($,Z=$3){if($==="all")_5.clear();else _5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=r8(Z.directory,J);try{await sK(X,{recursive:!0,force:!0})}catch{}}}var _5,$3;var Z3=S(()=>{m1();_5=new Map,$3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class K4{config;constructor($={}){this.config={...tK,...$}}async get($,Z){return J4($,Z,"image",this.config)}async set($,Z,Y){return X4($,Z,Y,"image",this.config)}async clear(){return Q4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function Y3($){if(!G4)G4=new K4($);else if($)G4.updateConfig($);return G4}async function W4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return Y3(J).get($,Z)}async function z4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return Y3(X).set($,Z,Y)}async function t8(){return Y3().clear()}var tK,G4=null;var J3=S(()=>{Z3();tK={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as eK,basename as $W,extname as ZW,join as YW}from"path";import{mkdir as JW}from"fs/promises";async function X3(){try{return await import("ts-images")}catch{return null}}function e8($){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 XW($,Z){let Y=Z?e8(Z):e8("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function $Z($,Z,Y){let J=await X3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await W4($,Z,Y);if(X)return X;try{let Q=eK($);if(!await D0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=XW(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await JW(K,{recursive:!0});let z=await b0(Q),q=$W($,ZW($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:z},_=null;if(Z.transformations&&Z.transformations.length>0)_=await Q3(Q,Z.transformations,J);for(let B of U){let H=G[B]||{},L=`${q}-${z}.${B}`,V=YW(K,L);try{let O=await J.optimizeImage({input:_||Q,output:V,format:B,quality:H.quality,progressive:H.progressive});if(O){if(j.variants.push({path:V,url:`${W}/${L}`,width:O.width||0,height:O.height||0,format:B,size:O.outputSize||0}),!j.originalWidth&&O.width)j.originalWidth=O.width,j.originalHeight=O.height}}catch(O){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await J.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 J.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 z4($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function ZZ($,Z,Y,J){let X=await X3();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function Q3($,Z,Y){let J=Y||await X3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await J.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await J.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await J.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await J.sharpen(X,G.amount);break;case"grayscale":X=await J.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await J.rotate(X,G.angle);break;case"flip":X=await J.flip(X);break;case"flop":X=await J.flop(X);break;case"brightness":if(G.value!==void 0)X=await J.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await J.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await J.saturation(X,G.value);break}}return await J.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var YZ=S(()=>{m1();J3()});import{resolve as QW,basename as GW,extname as KW,join as WW}from"path";import{mkdir as zW}from"fs/promises";async function qW(){try{return await import("ts-images")}catch{return null}}async function JZ($,Z,Y){let J=await qW();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=QW($);if(!await D0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||UW,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await zW(K,{recursive:!0});let z=await b0(X),q=GW($,KW($)),U=Y.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 H=[];for(let L of Q){let V=`${q}-${L}w-${z}.${B}`,O=WW(K,V),F=`${W}/${V}`;try{let w=U[B]?.quality||80;if(await D0(O)){j.byFormat[B].push({path:O,url:F,width:L,height:0,format:B,size:0}),H.push(`${F} ${L}w`);continue}let A=await J.processImage({input:X,output:O,format:B,quality:w,resize:{width:L}});if(A)j.byFormat[B].push({path:O,url:F,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),H.push(`${F} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${L}w: ${w}`)}}j.srcsets[B]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let B=await J.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await J.generatePlaceholder(X,{strategy:_,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:_}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||jW(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function jW($){let Z=[...$].sort((J,X)=>J-X),Y=[];for(let J=0;J<Z.length-1;J++){let X=Z[J];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function XZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var UW;var QZ=S(()=>{m1();UW=[320,480,640,768,1024,1280,1536,1920]});var GZ={};a(GZ,{setCachedImageResult:()=>z4,processImage:()=>$Z,optimizeImage:()=>ZZ,getCachedImageResult:()=>W4,generateSrcset:()=>XZ,generateResponsiveVariants:()=>JZ,clearImageCache:()=>t8,applyTransformations:()=>Q3,ImageProcessorCache:()=>K4});var KZ=S(()=>{YZ();QZ();J3()});async function _W(){try{return await Promise.resolve().then(() => (KZ(),GZ))}catch($){if(!WZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),WZ=!0;return null}}async function q4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return LW(J,Y)}if(Y.processedResult?.processed)return z3($,Y.processedResult,Z);if(Y.responsiveVariants)return jZ($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:z=j5,dpr:q,formats:U=$$,quality:j=G3,params:_={},placeholder:B="none",placeholderOptions:H={},lazy:L=!0,priority:V=!1,loading:O=V?"eager":j4,decoding:F=U4,fetchpriority:w,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:M}=$,T=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:b=""}=Z;if(y&&!Z.optimize)return OW($);let k,v,g=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!V)try{k=await l8(X,{strategy:B,...H}),v=p8(g,k,H)}catch{}let f=q!==void 0&&G!==void 0,d;if(f)d=HW($,g,k,Z);else d=await BW($,g,k,Z);let p;if(V){let V0=U.includes("webp")?"webp":U[0],r=n7(X,z,{..._,q:j},V0),Q0=typeof W==="object"?o7(W):W||"100vw";p=`<link rel="preload" as="image" imagesrcset="${r}" imagesizes="${Q0}" />`}let X0=[];if(!zZ&&B!=="none")X0.push(t7),zZ=!0;if(v)X0.push(v);let Z0=L?UZ(g):void 0;return{html:d,preloadLink:p,css:X0.length>0?X0.join(`
7471
+ `):void 0,script:Z0}}async function BW($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,sizes:W,widths:z=j5,formats:q=$$,quality:U=G3,params:j={},lazy:_=!0,priority:B=!1,loading:H=B?"eager":j4,decoding:L=U4,fetchpriority:V,objectFit:O,objectPosition:F,crossorigin:w,referrerpolicy:A}=$,R=$.class,N=$.style,M=$.data||{},T=typeof W==="object"?o7(W):W||"100vw",I=[];for(let y of q){let b=n7(X,z,{...j,q:U},y),k=s7(y);if(_&&!B)I.push(` <source type="${k}" data-srcset="${b}" data-sizes="${T}" />`);else I.push(` <source type="${k}" srcset="${b}" sizes="${T}" />`)}let E=K3({src:Z$(X,{...j,q:U}),alt:Q,width:G,height:K,loading:B?void 0:H,decoding:L,fetchpriority:B?"high":V,objectFit:O,objectPosition:F,crossorigin:w,referrerpolicy:A,className:qZ(R,Y),style:W3(N,O,F,Y),lazy:_&&!B,data:M}),D;if(Y){let y=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
7472
7472
  <picture>
7473
7473
  ${I.join(`
7474
7474
  `)}
@@ -7478,9 +7478,9 @@ ${I.join(`
7478
7478
  ${I.join(`
7479
7479
  `)}
7480
7480
  <img ${E} />
7481
- </picture>`;return D}function _W($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,dpr:W=[1,2,3],quality:z=X3,params:q={},lazy:U=!0,priority:j=!1,loading:_=j?"eager":U4,decoding:B=q4,fetchpriority:H,objectFit:L,objectPosition:V,crossorigin:O,referrerpolicy:F}=$,w=$.class,A=$.style,R=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),M=u8(X,N,W,{...q,q:z}),T=Q3({src:$$(X,{...q,w:N,q:z}),alt:Q,width:G,height:K,loading:j?void 0:_,decoding:B,fetchpriority:j?"high":H,objectFit:L,objectPosition:V,crossorigin:O,referrerpolicy:F,className:zZ(w,Y),style:G3(A,L,V,Y),lazy:U&&!j,data:R}),I=U&&!j?`data-srcset="${M}"`:`srcset="${M}"`;if(Y){let E=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
7481
+ </picture>`;return D}function HW($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,dpr:W=[1,2,3],quality:z=G3,params:q={},lazy:U=!0,priority:j=!1,loading:_=j?"eager":j4,decoding:B=U4,fetchpriority:H,objectFit:L,objectPosition:V,crossorigin:O,referrerpolicy:F}=$,w=$.class,A=$.style,R=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),M=m8(X,N,W,{...q,q:z}),T=K3({src:Z$(X,{...q,w:N,q:z}),alt:Q,width:G,height:K,loading:j?void 0:_,decoding:B,fetchpriority:j?"high":H,objectFit:L,objectPosition:V,crossorigin:O,referrerpolicy:F,className:qZ(w,Y),style:W3(A,L,V,Y),lazy:U&&!j,data:R}),I=U&&!j?`data-srcset="${M}"`:`srcset="${M}"`;if(Y){let E=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
7482
7482
  <img ${T} ${I} />
7483
- </div>`}return`<img ${Z?`id="${Z}" `:""}${T} ${I} />`}function BW($){let{src:Z,alt:Y,width:J,height:X,loading:Q=U4,decoding:G=q4,fetchpriority:K,objectFit:W,objectPosition:z,crossorigin:q,referrerpolicy:U,priority:j=!1}=$,_=$.class,B=$.style,H=$.id,L=$.data||{};return{html:`<img ${Q3({src:Z,alt:Y,width:J,height:X,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:W,objectPosition:z,crossorigin:q,referrerpolicy:U,className:_,style:G3(B,W,z),id:H,data:L})} />`}}function Q3($){let Z=[];if($.lazy)Z.push(`data-src="${a0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${a0($.src)}"`);if(Z.push(`alt="${a0($.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="${a0($.className)}"`);if($.style)Z.push(`style="${a0($.style)}"`);if($.id)Z.push(`id="${a0($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${a0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function zZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function G3($,Z,Y,J){let X=[];if(Z)X.push(`object-fit: ${Z}`);if(Y)X.push(`object-position: ${Y}`);if(J)X.push("opacity: 0; transition: opacity 300ms ease-out");if($)X.push($);return X.join("; ")}function a0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qZ($){return`
7483
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${T} ${I} />`}function OW($){let{src:Z,alt:Y,width:J,height:X,loading:Q=j4,decoding:G=U4,fetchpriority:K,objectFit:W,objectPosition:z,crossorigin:q,referrerpolicy:U,priority:j=!1}=$,_=$.class,B=$.style,H=$.id,L=$.data||{};return{html:`<img ${K3({src:Z,alt:Y,width:J,height:X,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:W,objectPosition:z,crossorigin:q,referrerpolicy:U,className:_,style:W3(B,W,z),id:H,data:L})} />`}}function K3($){let Z=[];if($.lazy)Z.push(`data-src="${a0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${a0($.src)}"`);if(Z.push(`alt="${a0($.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="${a0($.className)}"`);if($.style)Z.push(`style="${a0($.style)}"`);if($.id)Z.push(`id="${a0($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${a0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function qZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function W3($,Z,Y,J){let X=[];if(Z)X.push(`object-fit: ${Z}`);if(Y)X.push(`object-position: ${Y}`);if(J)X.push("opacity: 0; transition: opacity 300ms ease-out");if($)X.push($);return X.join("; ")}function a0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function UZ($){return`
7484
7484
  (function() {
7485
7485
  const container = document.getElementById('${$}');
7486
7486
  if (!container) return;
@@ -7517,7 +7517,7 @@ ${I.join(`
7517
7517
 
7518
7518
  observer.observe(container);
7519
7519
  })();
7520
- `.trim()}async function HW($,Z){let Y=await UW();if(!Y)return z4({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,J);if(Q)return UZ($,Q,Z)}else{let Q=await Y.processImage($.src,$,J);if(Q.processed)return K3($,Q,Z)}return z4({...$,process:!1},Z)}async function K3($,Z,Y){let{alt:J,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:z,crossorigin:q,referrerpolicy:U}=$,j=$.class,_=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],V=L.find((v)=>v.format==="jpeg")||L.find((v)=>v.format==="webp")||L[0],O=V?.url||$.src,F=L.filter((v)=>v.format===(V?.format||"jpeg")).map((v)=>`${v.url} ${v.width}w`).join(", "),w=new Map;for(let v of L){if(!w.has(v.format))w.set(v.format,[]);w.get(v.format).push(v)}let A=[],R=["avif","webp","jpeg","png"];for(let v of R){let g=w.get(v);if(g&&g.length>0){let f=g.map((p)=>`${p.url} ${p.width}w`).join(", "),d=n7(v);if(G&&!K)A.push(` <source type="${d}" data-srcset="${f}" />`);else A.push(` <source type="${d}" srcset="${f}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${a0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${a0(O)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${a0(J)}"`);let M=X||Z.originalWidth,T=Q||Z.originalHeight;if(M)N.push(`width="${M}"`);if(T)N.push(`height="${T}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(q)N.push(`crossorigin="${q}"`);if(U)N.push(`referrerpolicy="${U}"`);let I=[];if(W)I.push(`object-fit: ${W}`);if(z)I.push(`object-position: ${z}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)N.push(`style="${I.join("; ")}"`);let E=[];if(j)E.push(j);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)N.push(`class="${E.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[v,g]of Object.entries(H))N.push(`data-${v}="${a0(g)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let v=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="${v}">
7520
+ `.trim()}async function LW($,Z){let Y=await _W();if(!Y)return q4({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,J);if(Q)return jZ($,Q,Z)}else{let Q=await Y.processImage($.src,$,J);if(Q.processed)return z3($,Q,Z)}return q4({...$,process:!1},Z)}async function z3($,Z,Y){let{alt:J,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:z,crossorigin:q,referrerpolicy:U}=$,j=$.class,_=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],V=L.find((v)=>v.format==="jpeg")||L.find((v)=>v.format==="webp")||L[0],O=V?.url||$.src,F=L.filter((v)=>v.format===(V?.format||"jpeg")).map((v)=>`${v.url} ${v.width}w`).join(", "),w=new Map;for(let v of L){if(!w.has(v.format))w.set(v.format,[]);w.get(v.format).push(v)}let A=[],R=["avif","webp","jpeg","png"];for(let v of R){let g=w.get(v);if(g&&g.length>0){let f=g.map((p)=>`${p.url} ${p.width}w`).join(", "),d=s7(v);if(G&&!K)A.push(` <source type="${d}" data-srcset="${f}" />`);else A.push(` <source type="${d}" srcset="${f}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${a0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${a0(O)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${a0(J)}"`);let M=X||Z.originalWidth,T=Q||Z.originalHeight;if(M)N.push(`width="${M}"`);if(T)N.push(`height="${T}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(q)N.push(`crossorigin="${q}"`);if(U)N.push(`referrerpolicy="${U}"`);let I=[];if(W)I.push(`object-fit: ${W}`);if(z)I.push(`object-position: ${z}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)N.push(`style="${I.join("; ")}"`);let E=[];if(j)E.push(j);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)N.push(`class="${E.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[v,g]of Object.entries(H))N.push(`data-${v}="${a0(g)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let v=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="${v}">
7521
7521
  <picture>
7522
7522
  ${A.join(`
7523
7523
  `)}
@@ -7527,12 +7527,12 @@ ${A.join(`
7527
7527
  ${A.join(`
7528
7528
  `)}
7529
7529
  <img ${N.join(" ")} />
7530
- </picture>`;let y=[];if(Z.placeholder)y.push(r7);let b=G?qZ(B):void 0,k;if(K&&F)k=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:D,preloadLink:k,css:y.length>0?y.join(`
7531
- `):void 0,script:b}}async function UZ($,Z,Y){let J={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)J.variants.push(...Q);return K3($,J,Y)}var KZ=!1,X3=80,q4="async",U4="lazy",WZ=!1;var jZ=S(()=>{o7();l8()});function OW(){return $4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:X,alt:Q,options:G}=LW($,Z,Y);if(!X)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:X,alt:Q||"",widths:G.widths||U5,formats:G.formats||e5,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=Y.__isDev||!1,z=await z4(K,{isDev:W}),q=z.html;if(z.preloadLink)q=z.preloadLink+`
7530
+ </picture>`;let y=[];if(Z.placeholder)y.push(t7);let b=G?UZ(B):void 0,k;if(K&&F)k=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:D,preloadLink:k,css:y.length>0?y.join(`
7531
+ `):void 0,script:b}}async function jZ($,Z,Y){let J={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)J.variants.push(...Q);return z3($,J,Y)}var WZ=!1,G3=80,U4="async",j4="lazy",zZ=!1;var _Z=S(()=>{r7();c8()});function FW(){return Z4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:X,alt:Q,options:G}=VW($,Z,Y);if(!X)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:X,alt:Q||"",widths:G.widths||j5,formats:G.formats||$$,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=Y.__isDev||!1,z=await q4(K,{isDev:W}),q=z.html;if(z.preloadLink)q=z.preloadLink+`
7532
7532
  `+q;if(z.css)q+=`
7533
7533
  <style>${z.css}</style>`;if(z.script)q+=`
7534
- <script>${z.script}</script>`;return q},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function LW($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=FW(J),Q=W3(X[0],Y)||"",G=W3(X[1],Y)||"",K={};if(X[2]){let W=W3(X[2],Y);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 FW($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],z=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&z!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function W3($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var _Z;var BZ=S(()=>{l7();jZ();o7();_Z=OW()});class _4{config;constructor($={}){this.config={...VW,...$}}async get($,Z){return Y4($,Z,"video",this.config)}async set($,Z,Y){return J4($,Z,Y,"video",this.config)}async clear(){return X4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function z3($){if(!j4)j4=new _4($);else if($)j4.updateConfig($);return j4}async function B4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return z3(J).get($,Z)}async function H4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return z3(X).set($,Z,Y)}async function HZ(){return z3().clear()}var VW,j4=null;var q3=S(()=>{e7();VW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as U3,basename as j3,extname as _3,join as O4}from"path";import{mkdir as B3}from"fs/promises";async function H3(){try{return await import("ts-videos")}catch{return null}}async function L4($,Z,Y,J){let X=await H3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=U3($);if(!await D0(Q))return null;await B3(Y,{recursive:!0});let G=await b0(Q),K=j3($,_3($)),W=Z.format||"webp",z=Z.timestamp||0,q=`${K}-poster-${G}.${W}`,U=O4(Y,q),j=await X.extractThumbnails(Q,{timestamps:[z],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:Y,outputPattern:q.replace(`.${W}`,"")});if(j&&j.length>0){let _=j[0];return{path:U,url:`${J}/${q}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:z,size:_.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function F4($,Z,Y,J){let X=await H3();if(!X)return[];try{let Q=U3($);if(!await D0(Q))return[];await B3(Y,{recursive:!0});let G=await b0(Q),K=j3($,_3($)),W=Z.format||"webp",U=(await new X.Input(Q).getInfo()).duration||60,j=Z.count||10,_=Z.interval||U/j,B=[];for(let L=0;L<j&&L*_<U;L++)B.push(L*_);let H=await X.extractThumbnails(Q,{timestamps:B,width:Z.width||320,format:W,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,V)=>({path:L.path||O4(Y,`${K}-thumb-${G}-${V}.${W}`),url:`${J}/${K}-thumb-${G}-${V}.${W}`,width:L.width||Z.width||320,height:L.height||180,timestamp:B[V],size:L.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function OZ($,Z,Y,J){let X=await H3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=U3($);if(!await D0(Q))return null;await B3(Y,{recursive:!0});let G=await b0(Q),K=j3($,_3($)),q=(await new X.Input(Q).getInfo()).duration||60,U=Z.columns||10,j=Z.interval||5,_=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(q/j),V=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,F=O4(Y,O),w=[];for(let R=0;R<L;R++)w.push(R*j);let A=await X.extractThumbnails(Q,{timestamps:w,width:_,height:B,format:H,quality:Z.quality||70,outputDir:O4(Y,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=U*_,M=V*B,T=await R.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:F,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:F,columns:U,rows:V,thumbnailWidth:_,thumbnailHeight:B,interval:j,totalFrames:L}}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 O3=S(()=>{u1()});import{resolve as FZ,basename as VZ,extname as wZ,join as m1}from"path";import{mkdir as V4,writeFile as AZ}from"fs/promises";async function RZ(){try{return await import("ts-videos")}catch{return null}}async function w4($,Z,Y,J,X){let Q=await RZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=FZ($);if(!await D0(G))return null;let K=await b0(G),W=VZ($,wZ($)),z=m1(Y,`${W}-${K}-hls`);await V4(z,{recursive:!0});let q=Z.length>0?Z:NZ,U=X?.segmentDuration||6,B=(await new Q.Input(G).getInfo()).duration||0,H=[],L=0;for(let F of q){let w=m1(z,F.label);await V4(w,{recursive:!0});let A=`${F.label}.m3u8`,R=m1(w,A);try{let N=await Q.generateHLS(G,{outputDir:w,segmentDuration:U,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(N)H.push({quality:F,url:`${J}/${W}-${K}-hls/${F.label}/${A}`,path:R}),L+=N.segmentCount||Math.ceil(B/U)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${N}`)}}if(H.length===0)return null;let V=m1(z,"master.m3u8"),O=wW(H,J,W,K);return await AZ(V,O),{manifestUrl:`${J}/${W}-${K}-hls/master.m3u8`,manifestPath:V,playlists:H,segmentCount:L,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function wW($,Z,Y,J){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(`
7535
- `)}async function A4($,Z,Y,J,X){let Q=await RZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=FZ($);if(!await D0(G))return null;let K=await b0(G),W=VZ($,wZ($)),z=m1(Y,`${W}-${K}-dash`);await V4(z,{recursive:!0});let q=Z.length>0?Z:NZ,U=X?.segmentDuration||4,j=X?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,L=[],V=[];for(let A of q){let R=m1(z,A.label);await V4(R,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:R,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${W}-${K}-dash/${A.label}/video`}),A.audioBitrate)V.push({bandwidth:A.audioBitrate,url:`${J}/${W}-${K}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(L.length===0)return null;let O=m1(z,"manifest.mpd"),F=AW(L,V,H,U,j);await AZ(O,F);let w=[{type:"video",representations:L}];if(V.length>0)w.push({type:"audio",representations:V});return{manifestUrl:`${J}/${W}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function AW($,Z,Y,J,X){let Q=LZ(Y),G=LZ(X),K=`<?xml version="1.0" encoding="UTF-8"?>
7534
+ <script>${z.script}</script>`;return q},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function VW($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=wW(J),Q=q3(X[0],Y)||"",G=q3(X[1],Y)||"",K={};if(X[2]){let W=q3(X[2],Y);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 wW($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],z=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&z!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function q3($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var BZ;var HZ=S(()=>{i7();_Z();r7();BZ=FW()});class B4{config;constructor($={}){this.config={...AW,...$}}async get($,Z){return J4($,Z,"video",this.config)}async set($,Z,Y){return X4($,Z,Y,"video",this.config)}async clear(){return Q4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function U3($){if(!_4)_4=new B4($);else if($)_4.updateConfig($);return _4}async function H4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return U3(J).get($,Z)}async function O4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return U3(X).set($,Z,Y)}async function OZ(){return U3().clear()}var AW,_4=null;var j3=S(()=>{Z3();AW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as _3,basename as B3,extname as H3,join as L4}from"path";import{mkdir as O3}from"fs/promises";async function L3(){try{return await import("ts-videos")}catch{return null}}async function F4($,Z,Y,J){let X=await L3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=_3($);if(!await D0(Q))return null;await O3(Y,{recursive:!0});let G=await b0(Q),K=B3($,H3($)),W=Z.format||"webp",z=Z.timestamp||0,q=`${K}-poster-${G}.${W}`,U=L4(Y,q),j=await X.extractThumbnails(Q,{timestamps:[z],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:Y,outputPattern:q.replace(`.${W}`,"")});if(j&&j.length>0){let _=j[0];return{path:U,url:`${J}/${q}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:z,size:_.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function V4($,Z,Y,J){let X=await L3();if(!X)return[];try{let Q=_3($);if(!await D0(Q))return[];await O3(Y,{recursive:!0});let G=await b0(Q),K=B3($,H3($)),W=Z.format||"webp",U=(await new X.Input(Q).getInfo()).duration||60,j=Z.count||10,_=Z.interval||U/j,B=[];for(let L=0;L<j&&L*_<U;L++)B.push(L*_);let H=await X.extractThumbnails(Q,{timestamps:B,width:Z.width||320,format:W,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,V)=>({path:L.path||L4(Y,`${K}-thumb-${G}-${V}.${W}`),url:`${J}/${K}-thumb-${G}-${V}.${W}`,width:L.width||Z.width||320,height:L.height||180,timestamp:B[V],size:L.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function LZ($,Z,Y,J){let X=await L3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=_3($);if(!await D0(Q))return null;await O3(Y,{recursive:!0});let G=await b0(Q),K=B3($,H3($)),q=(await new X.Input(Q).getInfo()).duration||60,U=Z.columns||10,j=Z.interval||5,_=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(q/j),V=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,F=L4(Y,O),w=[];for(let R=0;R<L;R++)w.push(R*j);let A=await X.extractThumbnails(Q,{timestamps:w,width:_,height:B,format:H,quality:Z.quality||70,outputDir:L4(Y,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=U*_,M=V*B,T=await R.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:F,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:F,columns:U,rows:V,thumbnailWidth:_,thumbnailHeight:B,interval:j,totalFrames:L}}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 F3=S(()=>{m1()});import{resolve as VZ,basename as wZ,extname as AZ,join as p1}from"path";import{mkdir as w4,writeFile as RZ}from"fs/promises";async function NZ(){try{return await import("ts-videos")}catch{return null}}async function A4($,Z,Y,J,X){let Q=await NZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=VZ($);if(!await D0(G))return null;let K=await b0(G),W=wZ($,AZ($)),z=p1(Y,`${W}-${K}-hls`);await w4(z,{recursive:!0});let q=Z.length>0?Z:MZ,U=X?.segmentDuration||6,B=(await new Q.Input(G).getInfo()).duration||0,H=[],L=0;for(let F of q){let w=p1(z,F.label);await w4(w,{recursive:!0});let A=`${F.label}.m3u8`,R=p1(w,A);try{let N=await Q.generateHLS(G,{outputDir:w,segmentDuration:U,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(N)H.push({quality:F,url:`${J}/${W}-${K}-hls/${F.label}/${A}`,path:R}),L+=N.segmentCount||Math.ceil(B/U)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${N}`)}}if(H.length===0)return null;let V=p1(z,"master.m3u8"),O=RW(H,J,W,K);return await RZ(V,O),{manifestUrl:`${J}/${W}-${K}-hls/master.m3u8`,manifestPath:V,playlists:H,segmentCount:L,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function RW($,Z,Y,J){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(`
7535
+ `)}async function R4($,Z,Y,J,X){let Q=await NZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=VZ($);if(!await D0(G))return null;let K=await b0(G),W=wZ($,AZ($)),z=p1(Y,`${W}-${K}-dash`);await w4(z,{recursive:!0});let q=Z.length>0?Z:MZ,U=X?.segmentDuration||4,j=X?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,L=[],V=[];for(let A of q){let R=p1(z,A.label);await w4(R,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:R,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${W}-${K}-dash/${A.label}/video`}),A.audioBitrate)V.push({bandwidth:A.audioBitrate,url:`${J}/${W}-${K}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(L.length===0)return null;let O=p1(z,"manifest.mpd"),F=NW(L,V,H,U,j);await RZ(O,F);let w=[{type:"video",representations:L}];if(V.length>0)w.push({type:"audio",representations:V});return{manifestUrl:`${J}/${W}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function NW($,Z,Y,J,X){let Q=FZ(Y),G=FZ(X),K=`<?xml version="1.0" encoding="UTF-8"?>
7536
7536
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
7537
7537
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7538
7538
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -7558,7 +7558,7 @@ ${A.join(`
7558
7558
  </Representation>
7559
7559
  `}K+=` </AdaptationSet>
7560
7560
  `}return K+=` </Period>
7561
- </MPD>`,K}function LZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(Y>0)X+=`${Y}M`;return X+=`${J}S`,X}var NZ;var L3=S(()=>{u1();NZ=[{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 MZ,basename as RW,extname as NW,join as MW}from"path";import{mkdir as TW}from"fs/promises";async function TZ(){try{return await import("ts-videos")}catch{return null}}function IW($){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 DW($){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 F3($){let Z=await TZ();if(!Z)return null;try{let Y=MZ($),X=await new Z.Input(Y).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(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function IZ($,Z,Y,J){let X=await TZ();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await B4($,Z,Y);if(Q)return Q;try{let G=MZ($);if(!await D0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await TW(K,{recursive:!0});let z=await b0(G),q=RW($,NW($)),U={src:$,processed:!0,hash:z};J?.({percentage:5,stage:"analyzing"}),U.metadata=await F3(G)||void 0;let j={};if(Z.quality)j.bitrate=IW(Z.quality);if(Z.platform)Object.assign(j,DW(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let _=`${q}-${z}.mp4`,B=MW(K,_);try{let H=await EW(G,B,j,X,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:B,url:`${W}/${_}`,duration:H.duration,size:H.size,video:{codec:j.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await L4(G,_,K,W);if(B)U.poster=B}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let _=await F4(G,Y.thumbnails,K,W);if(_.length>0)U.thumbnails=_}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let B=await w4(G,_.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,hls:B}}if(_.format==="dash"){let B=await A4(G,_.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,dash:B}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await H4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function EW($,Z,Y,J,X){try{let G=await new J.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{X?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var DZ=S(()=>{u1();q3();O3();L3()});var EZ={};a(EZ,{setCachedVideoResult:()=>H4,processVideo:()=>IZ,getCachedVideoResult:()=>B4,generateThumbnails:()=>F4,generateSpriteSheet:()=>OZ,generatePoster:()=>L4,generateHLSManifest:()=>w4,generateDASHManifest:()=>A4,clearVideoCache:()=>HZ,analyzeVideo:()=>F3,VideoProcessorCache:()=>_4});var kZ=S(()=>{DZ();O3();L3();q3()});async function SZ(){try{return await Promise.resolve().then(() => (kZ(),EZ))}catch($){if(!bZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),bZ=!0;return null}}async function R4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return CW(J,Y)}if(Y.processedResult?.processed)return vZ($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await vW(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:z=yZ,autoplay:q=!1,muted:U=!1,loop:j=!1,preload:_=PZ,playsinline:B=!0,lazy:H=!0,player:L="native",type:V,width:O,height:F,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=X||K,M=$.class,T=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return SW($,Z);if(V&&V!=="video")return bW(Q||"",V,$);let E=G.length>0?G:Q?[{src:Q,type:CZ(Q)}]:[],D=[`id="${I}"`];if(z)D.push("controls");if(q)D.push("autoplay");if(U)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(A)D.push("disablepictureinpicture");if(R)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(H){if(D.push(`data-preload="${_}"`),D.push('preload="none"'),N)D.push(`data-poster="${A0(N)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${_}"`),N)D.push(`poster="${A0(N)}"`);if(O)D.push(`width="${O}"`);if(F)D.push(`height="${F}"`);if(M)D.push(`class="${A0(M)}"`);if(T)D.push(`style="${A0(T)}"`);let y=E.map((v)=>{return` <source ${H?`data-src="${A0(v.src)}"`:`src="${A0(v.src)}"`} type="${v.type}"${v.media?` media="${v.media}"`:""} />`}).join(`
7561
+ </MPD>`,K}function FZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(Y>0)X+=`${Y}M`;return X+=`${J}S`,X}var MZ;var V3=S(()=>{m1();MZ=[{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 TZ,basename as MW,extname as TW,join as IW}from"path";import{mkdir as DW}from"fs/promises";async function IZ(){try{return await import("ts-videos")}catch{return null}}function EW($){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 kW($){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 w3($){let Z=await IZ();if(!Z)return null;try{let Y=TZ($),X=await new Z.Input(Y).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(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function DZ($,Z,Y,J){let X=await IZ();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await H4($,Z,Y);if(Q)return Q;try{let G=TZ($);if(!await D0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await DW(K,{recursive:!0});let z=await b0(G),q=MW($,TW($)),U={src:$,processed:!0,hash:z};J?.({percentage:5,stage:"analyzing"}),U.metadata=await w3(G)||void 0;let j={};if(Z.quality)j.bitrate=EW(Z.quality);if(Z.platform)Object.assign(j,kW(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let _=`${q}-${z}.mp4`,B=IW(K,_);try{let H=await bW(G,B,j,X,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:B,url:`${W}/${_}`,duration:H.duration,size:H.size,video:{codec:j.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await F4(G,_,K,W);if(B)U.poster=B}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let _=await V4(G,Y.thumbnails,K,W);if(_.length>0)U.thumbnails=_}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let B=await A4(G,_.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,hls:B}}if(_.format==="dash"){let B=await R4(G,_.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,dash:B}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await O4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function bW($,Z,Y,J,X){try{let G=await new J.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{X?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var EZ=S(()=>{m1();j3();F3();V3()});var kZ={};a(kZ,{setCachedVideoResult:()=>O4,processVideo:()=>DZ,getCachedVideoResult:()=>H4,generateThumbnails:()=>V4,generateSpriteSheet:()=>LZ,generatePoster:()=>F4,generateHLSManifest:()=>A4,generateDASHManifest:()=>R4,clearVideoCache:()=>OZ,analyzeVideo:()=>w3,VideoProcessorCache:()=>B4});var bZ=S(()=>{EZ();F3();V3();j3()});async function yZ(){try{return await Promise.resolve().then(() => (bZ(),kZ))}catch($){if(!SZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),SZ=!0;return null}}async function N4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return xW(J,Y)}if(Y.processedResult?.processed)return xZ($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await fW(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:z=PZ,autoplay:q=!1,muted:U=!1,loop:j=!1,preload:_=CZ,playsinline:B=!0,lazy:H=!0,player:L="native",type:V,width:O,height:F,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=X||K,M=$.class,T=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return PW($,Z);if(V&&V!=="video")return yW(Q||"",V,$);let E=G.length>0?G:Q?[{src:Q,type:vZ(Q)}]:[],D=[`id="${I}"`];if(z)D.push("controls");if(q)D.push("autoplay");if(U)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(A)D.push("disablepictureinpicture");if(R)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(H){if(D.push(`data-preload="${_}"`),D.push('preload="none"'),N)D.push(`data-poster="${A0(N)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${_}"`),N)D.push(`poster="${A0(N)}"`);if(O)D.push(`width="${O}"`);if(F)D.push(`height="${F}"`);if(M)D.push(`class="${A0(M)}"`);if(T)D.push(`style="${A0(T)}"`);let y=E.map((v)=>{return` <source ${H?`data-src="${A0(v.src)}"`:`src="${A0(v.src)}"`} type="${v.type}"${v.media?` media="${v.media}"`:""} />`}).join(`
7562
7562
  `),b=`<video ${D.join(" ")}>
7563
7563
  ${y}
7564
7564
  Your browser does not support the video tag.
@@ -7597,9 +7597,9 @@ ${y}
7597
7597
 
7598
7598
  observer.observe(video);
7599
7599
  })();
7600
- `.trim();return{html:b,script:k}}function bW($,Z,Y){let{width:J=640,height:X=360}=Y,Q=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,z=null;switch(Z){case"youtube":z=yW($),W=z?`https://www.youtube-nocookie.com/embed/${z}`:$;break;case"vimeo":z=PW($),W=z?`https://player.vimeo.com/video/${z}`:$;break;case"dailymotion":z=$.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${z}`;break;case"twitch":z=$.split("/").pop()||"",W=`https://player.twitch.tv/?video=${z}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=$}let q=[`id="${K}"`,`src="${A0(W)}"`,`width="${J}"`,`height="${X}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)q.push(`class="${A0(Q)}"`);if(G)q.push(`style="${A0(G)}"`);if(Y.lazy)q.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
7600
+ `.trim();return{html:b,script:k}}function yW($,Z,Y){let{width:J=640,height:X=360}=Y,Q=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,z=null;switch(Z){case"youtube":z=CW($),W=z?`https://www.youtube-nocookie.com/embed/${z}`:$;break;case"vimeo":z=vW($),W=z?`https://player.vimeo.com/video/${z}`:$;break;case"dailymotion":z=$.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${z}`;break;case"twitch":z=$.split("/").pop()||"",W=`https://player.twitch.tv/?video=${z}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=$}let q=[`id="${K}"`,`src="${A0(W)}"`,`width="${J}"`,`height="${X}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)q.push(`class="${A0(Q)}"`);if(G)q.push(`style="${A0(G)}"`);if(Y.lazy)q.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
7601
7601
  <iframe ${q.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
7602
- </div>`}}function SW($,Z={}){let{src:Y,sources:J=[],poster:X,controls:Q=!0,autoplay:G=!1,muted:K=!1,loop:W=!1,preload:z="metadata",playsinline:q=!0,lazy:U=!0,width:j,height:_}=$,B=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,V={src:J.length>0?J:Y,autoplay:G,loop:W,muted:K,playsinline:q,preload:z,poster:X,controls:Q,title:$.title},O=["position: relative",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),F=`
7602
+ </div>`}}function PW($,Z={}){let{src:Y,sources:J=[],poster:X,controls:Q=!0,autoplay:G=!1,muted:K=!1,loop:W=!1,preload:z="metadata",playsinline:q=!0,lazy:U=!0,width:j,height:_}=$,B=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,V={src:J.length>0?J:Y,autoplay:G,loop:W,muted:K,playsinline:q,preload:z,poster:X,controls:Q,title:$.title},O=["position: relative",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),F=`
7603
7603
  <div
7604
7604
  id="${L}"
7605
7605
  class="ts-video-player${B?" "+A0(B):""}"
@@ -7636,7 +7636,7 @@ ${y}
7636
7636
 
7637
7637
  // Load ts-video-player from CDN
7638
7638
  var script = document.createElement('script');
7639
- script.src = '${kW}';
7639
+ script.src = '${SW}';
7640
7640
  script.onload = initPlayer;
7641
7641
  script.onerror = function() {
7642
7642
  console.error('[stx] Failed to load ts-video-player');
@@ -7766,7 +7766,7 @@ else {
7766
7766
  .ts-video-player__play-button svg {
7767
7767
  margin-left: 4px;
7768
7768
  }
7769
- `.trim();return{html:F,script:w,css:A}}function CZ($){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 yW($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let J=$.match(Y);if(J)return J[1]}return null}function PW($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function A0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function CW($,Z){let Y=await SZ();if(!Y)return R4({...$,process:!1},Z);let J=Z.tsVideosConfig,X=await Y.processVideo($.src,$,J,$.onProcessProgress);if(X.processed)return vZ($,X,Z);return R4({...$,process:!1},Z)}async function vW($,Z){let Y=await SZ();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},X=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,X.outputDir,X.baseUrl||"/videos"))?.url}function vZ($,Z,Y){let{controls:J=yZ,autoplay:X=!1,muted:Q=!1,loop:G=!1,preload:K=PZ,playsinline:W=!0,lazy:z=!0,width:q,height:U,crossorigin:j,disablePictureInPicture:_=!1,disableRemotePlayback:B=!1}=$,H=$.class,L=$.style,V=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,F=CZ(O);if(Z.transcoded)O=Z.transcoded.url,F="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,F="application/dash+xml"}let A=Z.poster?.url||$.poster,R=[`id="${V}"`];if(J)R.push("controls");if(X)R.push("autoplay");if(Q)R.push("muted");if(G)R.push("loop");if(W)R.push("playsinline");if(_)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(j)R.push(`crossorigin="${j}"`);if(z){if(R.push(`data-preload="${K}"`),R.push('preload="none"'),A)R.push(`data-poster="${A0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${K}"`),A)R.push(`poster="${A0(A)}"`);let N=q||Z.metadata?.width,M=U||Z.metadata?.height;if(N)R.push(`width="${N}"`);if(M)R.push(`height="${M}"`);if(H)R.push(`class="${A0(H)}"`);if(L)R.push(`style="${A0(L)}"`);let I=` <source ${z?`data-src="${A0(O)}"`:`src="${A0(O)}"`} type="${F}" />`,E=`<video ${R.join(" ")}>
7769
+ `.trim();return{html:F,script:w,css:A}}function vZ($){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 CW($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let J=$.match(Y);if(J)return J[1]}return null}function vW($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function A0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function xW($,Z){let Y=await yZ();if(!Y)return N4({...$,process:!1},Z);let J=Z.tsVideosConfig,X=await Y.processVideo($.src,$,J,$.onProcessProgress);if(X.processed)return xZ($,X,Z);return N4({...$,process:!1},Z)}async function fW($,Z){let Y=await yZ();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},X=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,X.outputDir,X.baseUrl||"/videos"))?.url}function xZ($,Z,Y){let{controls:J=PZ,autoplay:X=!1,muted:Q=!1,loop:G=!1,preload:K=CZ,playsinline:W=!0,lazy:z=!0,width:q,height:U,crossorigin:j,disablePictureInPicture:_=!1,disableRemotePlayback:B=!1}=$,H=$.class,L=$.style,V=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,F=vZ(O);if(Z.transcoded)O=Z.transcoded.url,F="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,F="application/dash+xml"}let A=Z.poster?.url||$.poster,R=[`id="${V}"`];if(J)R.push("controls");if(X)R.push("autoplay");if(Q)R.push("muted");if(G)R.push("loop");if(W)R.push("playsinline");if(_)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(j)R.push(`crossorigin="${j}"`);if(z){if(R.push(`data-preload="${K}"`),R.push('preload="none"'),A)R.push(`data-poster="${A0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${K}"`),A)R.push(`poster="${A0(A)}"`);let N=q||Z.metadata?.width,M=U||Z.metadata?.height;if(N)R.push(`width="${N}"`);if(M)R.push(`height="${M}"`);if(H)R.push(`class="${A0(H)}"`);if(L)R.push(`style="${A0(L)}"`);let I=` <source ${z?`data-src="${A0(O)}"`:`src="${A0(O)}"`} type="${F}" />`,E=`<video ${R.join(" ")}>
7770
7770
  ${I}
7771
7771
  Your browser does not support the video tag.
7772
7772
  </video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${A0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -7815,9 +7815,9 @@ ${E}
7815
7815
  width: 100%;
7816
7816
  height: auto;
7817
7817
  }
7818
- `.trim();return{html:E,script:D,css:y}}var bZ=!1,yZ=!0,PZ="metadata",kW="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var xZ=S(()=>{w3()});function fZ(){return $4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:X,options:Q}=xW($,Z,Y);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:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},z=await R4(G,W),q=z.html;if(z.css)q+=`
7818
+ `.trim();return{html:E,script:D,css:y}}var SZ=!1,PZ=!0,CZ="metadata",SW="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var fZ=S(()=>{R3()});function gZ(){return Z4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:X,options:Q}=gW($,Z,Y);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:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},z=await N4(G,W),q=z.html;if(z.css)q+=`
7819
7819
  <style>${z.css}</style>`;if(z.script)q+=`
7820
- <script>${z.script}</script>`;return q},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function xW($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=fW(J),Q=gZ(X[0],Y)||"",G={};if(X[1]){let K=gZ(X[1],Y);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 fW($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],z=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&z!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function gZ($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var V3;var w3=S(()=>{l7();xZ();V3=fZ()});function gW($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
7820
+ <script>${z.script}</script>`;return q},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function gW($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=hW(J),Q=hZ(X[0],Y)||"",G={};if(X[1]){let K=hZ(X[1],Y);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 hW($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],z=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&z!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function hZ($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var A3;var R3=S(()=>{i7();fZ();A3=gZ()});function dW($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
7821
7821
  ${$}
7822
7822
  </div>
7823
7823
  <script>
@@ -7862,7 +7862,7 @@ ${E}
7862
7862
  }
7863
7863
  }
7864
7864
  })();
7865
- </script>`}function hW($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",X=Y?.autoReload||!1,Q=$.trim().length>0,G=`
7865
+ </script>`}function uW($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",X=Y?.autoReload||!1,Q=$.trim().length>0,G=`
7866
7866
  <div class="stx-pwa-update-banner" style="
7867
7867
  position: fixed;
7868
7868
  bottom: 0;
@@ -7973,7 +7973,7 @@ else {
7973
7973
  // Also listen for custom event
7974
7974
  window.addEventListener('pwa-update-available', showUpdate);
7975
7975
  })();
7976
- </script>`}function dW($,Z){let Y=$.trim().length>0,J=`
7976
+ </script>`}function mW($,Z){let Y=$.trim().length>0,J=`
7977
7977
  <div class="stx-offline-indicator" style="
7978
7978
  position: fixed;
7979
7979
  top: 16px;
@@ -8034,7 +8034,7 @@ else {
8034
8034
  window.addEventListener('offline', updateStatus);
8035
8035
  updateStatus();
8036
8036
  })();
8037
- </script>`}function uW($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",X=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
8037
+ </script>`}function pW($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",X=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
8038
8038
  ${$}
8039
8039
  </div>
8040
8040
  <script>
@@ -8116,33 +8116,33 @@ catch (error) {
8116
8116
  init();
8117
8117
  }
8118
8118
  })();
8119
- </script>`}var mW,pW,lW,cW,hZ;var dZ=S(()=>{mW={name:"pwa.installButton",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return gW($,X)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},pW={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return hW($,X)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},lW={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return dW($,X)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},cW={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return uW($,X)},hasEndTag:!0,description:"Renders a push notification subscription button"},hZ=[mW,pW,lW,cW]});function A3($){for(let[Z,Y]of Object.entries(s))if(Y===$)return Z;return}var s;var N4=S(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function Z$(){return!1}function Y$(){return!Z$()||process.env.STX_DEBUG==="true"}function M4(){return!1}import iW from"path";function T4(){return{...R3}}function I4($){if(!R3.showRelativePaths||!$)return $;let Z=R3.baseDir||process.cwd();try{let Y=iW.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var nW,R3,D4,p1,E4;var k4=S(()=>{N4();nW={showRelativePaths:!1,enableAutoRecovery:Y$(),logRecoveryWarnings:!0},R3={...nW};D4=class D4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,X,Q,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=X;this.context=Q;if(this.name="StxError",this.numericCode=G||s.EVALUATION_ERROR,this.filePath)this.filePath=I4(this.filePath)}};p1=class p1 extends D4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};E4=class E4 extends D4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function mZ($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:W,snippet:z,suggestion:q,format:U="text"}=$,j=Q,_=G;if(!j&&K&&W!==void 0){let O=eW(K,W);j=O.line,_=O.column}let B=X?I4(X):void 0,H=J?A3(J):void 0,L={type:Z,code:J,codeName:H,message:Y,filePath:B,line:j,column:_,snippet:z,suggestion:q,timestamp:new Date().toISOString()},V;switch(U){case"html":V=sW(L);break;case"json":V=JSON.stringify(L,null,2);break;case"console":V=rW(L,K,W);break;case"text":default:V=oW(L,K,W);break}return{formatted:V,data:L}}function oW($,Z,Y){let J=[],X=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${X}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
8120
- ${$.message}`),Z&&$.line){let Q=aW(Z,$.line,2);if(Q)J.push(`
8119
+ </script>`}var lW,cW,iW,nW,dZ;var uZ=S(()=>{lW={name:"pwa.installButton",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return dW($,X)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},cW={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return uW($,X)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},iW={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return mW($,X)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},nW={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return pW($,X)},hasEndTag:!0,description:"Renders a push notification subscription button"},dZ=[lW,cW,iW,nW]});function N3($){for(let[Z,Y]of Object.entries(s))if(Y===$)return Z;return}var s;var M4=S(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function Y$(){return!1}function J$(){return!Y$()||process.env.STX_DEBUG==="true"}function T4(){return!1}import oW from"path";function I4(){return{...M3}}function D4($){if(!M3.showRelativePaths||!$)return $;let Z=M3.baseDir||process.cwd();try{let Y=oW.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var sW,M3,E4,l1,k4;var b4=S(()=>{M4();sW={showRelativePaths:!1,enableAutoRecovery:J$(),logRecoveryWarnings:!0},M3={...sW};E4=class E4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,X,Q,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=X;this.context=Q;if(this.name="StxError",this.numericCode=G||s.EVALUATION_ERROR,this.filePath)this.filePath=D4(this.filePath)}};l1=class l1 extends E4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};k4=class k4 extends E4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function pZ($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:W,snippet:z,suggestion:q,format:U="text"}=$,j=Q,_=G;if(!j&&K&&W!==void 0){let O=Zz(K,W);j=O.line,_=O.column}let B=X?D4(X):void 0,H=J?N3(J):void 0,L={type:Z,code:J,codeName:H,message:Y,filePath:B,line:j,column:_,snippet:z,suggestion:q,timestamp:new Date().toISOString()},V;switch(U){case"html":V=aW(L);break;case"json":V=JSON.stringify(L,null,2);break;case"console":V=tW(L,K,W);break;case"text":default:V=rW(L,K,W);break}return{formatted:V,data:L}}function rW($,Z,Y){let J=[],X=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${X}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
8120
+ ${$.message}`),Z&&$.line){let Q=eW(Z,$.line,2);if(Q)J.push(`
8121
8121
  ${Q}`)}if($.snippet)J.push(`
8122
8122
  Snippet: ${$.snippet}`);if($.suggestion)J.push(`
8123
- Suggestion: ${$.suggestion}`);return J.join(" ")}function sW($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${uZ($.message)}`;if($.suggestion)J+=` | Suggestion: ${uZ($.suggestion)}`;return J+=" -->",J}function rW($,Z,Y){let z=[],q=$.code?` [${$.codeName||$.code}]`:"";if(z.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${q} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let U=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(U+=`\x1B[90m:${$.line}\x1B[0m`,$.column)U+=`\x1B[90m:${$.column}\x1B[0m`}z.push(`
8123
+ Suggestion: ${$.suggestion}`);return J.join(" ")}function aW($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${mZ($.message)}`;if($.suggestion)J+=` | Suggestion: ${mZ($.suggestion)}`;return J+=" -->",J}function tW($,Z,Y){let z=[],q=$.code?` [${$.codeName||$.code}]`:"";if(z.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${q} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let U=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(U+=`\x1B[90m:${$.line}\x1B[0m`,$.column)U+=`\x1B[90m:${$.column}\x1B[0m`}z.push(`
8124
8124
  \x1B[90mat\x1B[0m ${U}`)}if(z.push(`
8125
8125
 
8126
- ${$.message}`),Z&&$.line){let U=tW(Z,$.line,2);if(U)z.push(`
8126
+ ${$.message}`),Z&&$.line){let U=$z(Z,$.line,2);if(U)z.push(`
8127
8127
 
8128
8128
  \x1B[90mContext:\x1B[0m
8129
8129
  ${U}`)}if($.suggestion)z.push(`
8130
8130
 
8131
8131
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return z.push(`
8132
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),z.join("")}function aW($,Z,Y){let J=$.split(`
8132
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),z.join("")}function eW($,Z,Y){let J=$.split(`
8133
8133
  `),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G=[];for(let K=X;K<=Q;K++){let W=(K+1).toString().padStart(4),z=K===Z-1?">":" ";G.push(`${z}${W} | ${J[K]}`)}return G.join(`
8134
- `)}function tW($,Z,Y){let J=$.split(`
8134
+ `)}function $z($,Z,Y){let J=$.split(`
8135
8135
  `),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",W="\x1B[0m",z=[];for(let q=X;q<=Q;q++){let U=(q+1).toString().padStart(4),j=q===Z-1,_=j?"\x1B[31m>\x1B[0m":" ",B=j?`\x1B[31m${J[q]}\x1B[0m`:`\x1B[90m${J[q]}\x1B[0m`;z.push(`${_}\x1B[90m${U}\x1B[0m | ${B}`)}return z.join(`
8136
- `)}function uZ($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function eW($,Z){let J=$.substring(0,Z).split(`
8137
- `);return{line:J.length,column:J[J.length-1].length}}function e($,Z,Y){return mZ({type:$,message:Z,code:Y,format:"html"}).formatted}async function _5($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var pZ=S(()=>{N4();k4()});class M3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let J={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
8136
+ `)}function mZ($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Zz($,Z){let J=$.substring(0,Z).split(`
8137
+ `);return{line:J.length,column:J[J.length-1].length}}function e($,Z,Y){return pZ({type:$,message:Z,code:Y,format:"html"}).formatted}async function B5($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var lZ=S(()=>{M4();b4()});class I3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let J={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
8138
8138
  `).slice(1).join(`
8139
8139
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
8140
8140
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),J=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});await this.rotateIfNeeded(Z);let X=`${this.formatEntry($)}
8141
8141
  `;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 Y=this.maxLogFiles-1;Y>=1;Y--){let J=`${this.logFilePath}.${Y}`,X=`${this.logFilePath}.${Y+1}`;if($.existsSync(J))if(Y>=this.maxLogFiles-1)$.unlinkSync(J);else $.renameSync(J,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 Y of this.errors){let J=Y.error.constructor.name;$[J]=($[J]||0)+1;let X=Y.level||"error";Z[X]=(Z[X]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),X=(await import("path")).dirname($);if(!Y.existsSync(X))Y.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}));Y.writeFileSync($,JSON.stringify(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,Q.join(`
8142
8142
 
8143
- `),"utf-8")}}async flush(){await this.writeQueue}}var N3,t0,T3;var lZ=S(()=>{k4();N3={isEnabled(){return T4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=T4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],X=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(X>Q){let K=X-Q;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let W=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,z=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(W>z){let q=W-z;for(let U=0;U<q;U++)Y+=`
8144
- @end${K}`;J.push(`Added ${q} missing @end${K}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent($,Z){if(Y$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};t0=new M3,T3={isDevelopment(){return Y$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
8145
- `)}}});var cZ=()=>{};var iZ=S(()=>{N4();pZ();lZ();cZ();k4()});var W1=S(()=>{iZ()});function nZ($,Z,Y,J){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,z)=>{if(!z&&W.includes(":")){let q=W.split(":"),U=W,j=q.length>1?q[1]:"";if(j&&Z[j])z=Z[j];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[q[1]])z=Z.openGraph[q[1]];else z="";return z?`<meta property="${l(U)}" content="${l(z)}">`:""}return z?`<meta name="${l(W)}" content="${l(z)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,W=K+G[0].length-1,z=1,q=W+1;while(q<X.length&&z>0){if(X[q]==="(")z++;else if(X[q]===")"){if(z--,z===0)break}q++}if(z!==0)break;let U=X.substring(W+1,q).trim(),j=q+1,_=(()=>{try{let B=T0(U,Z);if(!B)return"";let H="<meta";if(B.name)H+=` name="${l(String(B.name))}"`;if(B.property)H+=` property="${l(String(B.property))}"`;if(B.httpEquiv)H+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)H+=` content="${l(String(B.content))}"`;return H+=">",H}catch(B){let H=B instanceof Error?B.message:String(B);return e("MetaTag",H,s.EVALUATION_ERROR)}})();X=X.substring(0,K)+_+X.substring(j),Q.lastIndex=0}return X}function oZ($,Z,Y){let J=$,X=/@structuredData\s*\(/g,Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,z=K+1;while(z<J.length&&W>0){if(J[z]==="(")W++;else if(J[z]===")"){if(W--,W===0)break}z++}if(W!==0)break;let q=J.substring(K+1,z).trim(),U=z+1,j=(()=>{try{let _=T0(q,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let B=_ instanceof Error?_.message:String(_);return e("StructuredData",B,s.EVALUATION_ERROR)}})();J=J.substring(0,G)+j+J.substring(U),X.lastIndex=0}return J}function sZ($,Z,Y,J){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),W=1,z=K+1,q=null,U=!1;while(z<X.length&&W>0){let V=X[z];if(U){U=!1,z++;continue}if(V==="\\"&&q){U=!0,z++;continue}if(q){if(V===q)q=null;z++;continue}if(V==='"'||V==="'"||V==="`"){q=V,z++;continue}if(V==="{")W++;else if(V==="}")W--;z++}if(W!==0)break;let j=X.substring(z).match(/^\s*\)/);if(!j)break;let _=z+j[0].length,B=X.substring(K,z),H=X.substring(G.index,_),L=((V)=>{try{let O=T0(V,Z);if(!O)return"";let F="";if(O.title)F+=`<title>${l(O.title)}</title>
8143
+ `),"utf-8")}}async flush(){await this.writeQueue}}var T3,t0,D3;var cZ=S(()=>{b4();T3={isEnabled(){return I4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=I4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],X=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(X>Q){let K=X-Q;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let W=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,z=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(W>z){let q=W-z;for(let U=0;U<q;U++)Y+=`
8144
+ @end${K}`;J.push(`Added ${q} missing @end${K}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent($,Z){if(J$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};t0=new I3,D3={isDevelopment(){return J$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
8145
+ `)}}});var iZ=()=>{};var nZ=S(()=>{M4();lZ();cZ();iZ();b4()});var z1=S(()=>{nZ()});function oZ($,Z,Y,J){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,z)=>{if(!z&&W.includes(":")){let q=W.split(":"),U=W,j=q.length>1?q[1]:"";if(j&&Z[j])z=Z[j];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[q[1]])z=Z.openGraph[q[1]];else z="";return z?`<meta property="${l(U)}" content="${l(z)}">`:""}return z?`<meta name="${l(W)}" content="${l(z)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,W=K+G[0].length-1,z=1,q=W+1;while(q<X.length&&z>0){if(X[q]==="(")z++;else if(X[q]===")"){if(z--,z===0)break}q++}if(z!==0)break;let U=X.substring(W+1,q).trim(),j=q+1,_=(()=>{try{let B=T0(U,Z);if(!B)return"";let H="<meta";if(B.name)H+=` name="${l(String(B.name))}"`;if(B.property)H+=` property="${l(String(B.property))}"`;if(B.httpEquiv)H+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)H+=` content="${l(String(B.content))}"`;return H+=">",H}catch(B){let H=B instanceof Error?B.message:String(B);return e("MetaTag",H,s.EVALUATION_ERROR)}})();X=X.substring(0,K)+_+X.substring(j),Q.lastIndex=0}return X}function sZ($,Z,Y){let J=$,X=/@structuredData\s*\(/g,Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,z=K+1;while(z<J.length&&W>0){if(J[z]==="(")W++;else if(J[z]===")"){if(W--,W===0)break}z++}if(W!==0)break;let q=J.substring(K+1,z).trim(),U=z+1,j=(()=>{try{let _=T0(q,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let B=_ instanceof Error?_.message:String(_);return e("StructuredData",B,s.EVALUATION_ERROR)}})();J=J.substring(0,G)+j+J.substring(U),X.lastIndex=0}return J}function rZ($,Z,Y,J){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),W=1,z=K+1,q=null,U=!1;while(z<X.length&&W>0){let V=X[z];if(U){U=!1,z++;continue}if(V==="\\"&&q){U=!0,z++;continue}if(q){if(V===q)q=null;z++;continue}if(V==='"'||V==="'"||V==="`"){q=V,z++;continue}if(V==="{")W++;else if(V==="}")W--;z++}if(W!==0)break;let j=X.substring(z).match(/^\s*\)/);if(!j)break;let _=z+j[0].length,B=X.substring(K,z),H=X.substring(G.index,_),L=((V)=>{try{let O=T0(V,Z);if(!O)return"";let F="";if(O.title)F+=`<title>${l(O.title)}</title>
8146
8146
  `,F+=`<meta name="title" content="${l(O.title)}">
8147
8147
  `;if(O.description)F+=`<meta name="description" content="${l(O.description)}">
8148
8148
  `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;F+=`<meta name="keywords" content="${l(w)}">
@@ -8164,7 +8164,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
8164
8164
  `}if(w.site)F+=`<meta name="twitter:site" content="${l(w.site)}">
8165
8165
  `;if(w.creator)F+=`<meta name="twitter:creator" content="${l(w.creator)}">
8166
8166
  `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${w}</script>
8167
- `}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return e("SEO",`Error processing @seo directive: ${F}`,s.EVALUATION_ERROR)}})(B);X=X.substring(0,G.index)+L+X.substring(_),Q.lastIndex=G.index+L.length}return X}function rZ($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let 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(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let 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(Y.seo?.defaultImage)W=Y.seo.defaultImage;else if(Y.defaultImage)W=Y.defaultImage;let z=`
8167
+ `}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return e("SEO",`Error processing @seo directive: ${F}`,s.EVALUATION_ERROR)}})(B);X=X.substring(0,G.index)+L+X.substring(_),Q.lastIndex=G.index+L.length}return X}function aZ($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let 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(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let 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(Y.seo?.defaultImage)W=Y.seo.defaultImage;else if(Y.defaultImage)W=Y.defaultImage;let z=`
8168
8168
  <!-- stx SEO Tags -->
8169
8169
  <meta name="title" content="${l(G)}">
8170
8170
  <meta name="description" content="${l(K)}">
@@ -8180,7 +8180,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
8180
8180
  `;let q=$;if(!Q)q=q.replace(/<head[^>]*>/,`$&
8181
8181
  <title>${l(G)}</title>`);return q.replace(/<head[^>]*>/,`$&
8182
8182
  ${z}
8183
- `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var aZ,tZ;var I3=S(()=>{W1();w0();aZ={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return e("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(X)}" content="${l(Q)}">`},hasEndTag:!1},tZ={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return e("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let X=JSON.parse($);if(!X["@context"])X["@context"]="https://schema.org";if(!X["@type"])return e("StructuredData","structuredData requires @type property",s.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 e("StructuredData",Q,s.EVALUATION_ERROR)}},hasEndTag:!0}});import J$ from"path";function $z($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",X=Z,Q=[],G=!0;if(J){let U=J.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let j=U[1],_=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)X=_[1];let B=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=j.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),W=K?K[1].trim():"",z=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),q=z?z[1].trim():"";return{tag:X,props:Q,template:W,styles:q,script:J,shadowDOM:G}}function Zz($){let{tag:Z,props:Y,template:J,styles:X,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),W=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),z=Y.map((U)=>`'${U}'`).join(", "),q=Y.map((U)=>`
8183
+ `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var tZ,eZ;var E3=S(()=>{z1();w0();tZ={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return e("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(X)}" content="${l(Q)}">`},hasEndTag:!1},eZ={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return e("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let X=JSON.parse($);if(!X["@context"])X["@context"]="https://schema.org";if(!X["@type"])return e("StructuredData","structuredData requires @type property",s.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 e("StructuredData",Q,s.EVALUATION_ERROR)}},hasEndTag:!0}});import X$ from"path";function Yz($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",X=Z,Q=[],G=!0;if(J){let U=J.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let j=U[1],_=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)X=_[1];let B=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=j.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),W=K?K[1].trim():"",z=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),q=z?z[1].trim():"";return{tag:X,props:Q,template:W,styles:q,script:J,shadowDOM:G}}function Jz($){let{tag:Z,props:Y,template:J,styles:X,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),W=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),z=Y.map((U)=>`'${U}'`).join(", "),q=Y.map((U)=>`
8184
8184
  get ${U}() {
8185
8185
  return this.getAttribute('${U}') || '';
8186
8186
  }
@@ -8231,16 +8231,16 @@ ${q}
8231
8231
  }
8232
8232
 
8233
8233
  customElements.define('${Z}', ${G});
8234
- `}async function eZ($,Z,Y,J){if(Z.length<1)return e("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[J$.join(J$.dirname(J),G,`${X}.stx`),J$.join(process.cwd(),G,`${X}.stx`),J$.join(J$.dirname(J),`${X}.stx`)],W=null;for(let U of K)if(await c(U)){W=await Bun.file(U).text();break}if(!W)return e("WebComponent",`Component file not found: ${X}.stx`,s.FILE_NOT_FOUND);let z=$z(W,X);return`<script type="module">
8235
- ${Zz(z)}
8236
- </script>`}var $2=S(()=>{W1();M0()});var Z2={};a(Z2,{timingPlugin:()=>Gz,pluginManager:()=>Yz,definePlugin:()=>b4,debugPlugin:()=>Qz,createVariablesPlugin:()=>Kz,createFilterPlugin:()=>Xz,createDirectivePlugin:()=>Jz,PluginManager:()=>D3});function b4($){return $}class D3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let X=J[$];if(X)try{let Q=await X(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return J}}function Jz($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function Xz($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function Kz($){return b4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var Yz,Qz,Gz;var Y2=S(()=>{Yz=new D3;Qz=b4({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)}}),Gz=b4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var X2={};a(X2,{validateConfig:()=>jz,loadStxConfig:()=>z1,defineStxConfig:()=>Uz,defaultConfig:()=>l1,config:()=>k3});import E3 from"fs";import S0 from"path";import{loadConfigWithResult as Wz}from"bunfig";function zz($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=S0.join(process.cwd(),"resources","views"),X=S0.join(process.cwd(),"resources","layouts");if(E3.existsSync(J)&&E3.existsSync(X))return{root:"resources",pagesDir:"views"};let Q=S0.join(process.cwd(),"resources","views","pages");if(E3.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function qz($){if(a6($.stateDir),$.stateDir=b5(),$.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 z1($){if(!$){if(B5)return B5;if(S4)return S4}let Z=$?S0.resolve($):process.cwd(),Y=J2.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await Wz({name:"stx",alias:"ui",cwd:Z,defaultConfig:l1,verbose:!1})).config;qz(Q);let G=zz(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!S0.isAbsolute(Q.partialsDir))Q.partialsDir=S0.join(K,Q.partialsDir);if(Q.componentsDir&&!S0.isAbsolute(Q.componentsDir))Q.componentsDir=S0.join(K,Q.componentsDir);if(Q.layoutsDir&&!S0.isAbsolute(Q.layoutsDir))Q.layoutsDir=S0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (Y2(),Z2)),W=[],z=[];for(let q of Q.plugins){let U=typeof q==="string"?q:q[0],j=typeof q==="string"?{}:q[1]||{};try{let _,B;try{_=await import(U),B=S0.dirname(j0.resolve(U))}catch{let L=S0.resolve(process.cwd(),U);_=await import(L),B=S0.dirname(L)}let H=_.default||_;if(K.register(H,Q),H.components){let L=S0.resolve(B,H.components);W.push(L)}if(H.pages){let L=S0.resolve(B,H.pages),V=j.path||"/";z.push({dir:L,prefix:V})}if(H.setup){let L={addDirective:(V)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(V)},addRoute:(V,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[V]=O},addMiddleware:(V)=>{Q.middleware=Q.middleware||[],Q.middleware.push(V)},pluginDir:B,config:Q};await H.setup(j,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(_){console.warn(`[stx] Failed to load plugin ${U}:`,_.message)}}Q._pluginComponentDirs=W,Q._pluginPageDirs=z}return Q})();if(J2.set(Z,J),!$)S4=J,J.then((X)=>{B5=X}).catch(()=>{});return J}function Uz($){return $}function jz($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.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((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((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(!J.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.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 J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var l1,B5=null,J2,S4=null,k3;var c1=S(()=>{Q7();G7();K7();W7();p7();BZ();w3();dZ();I3();y5();$2();l1={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:d8,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:eZ,hasEndTag:!1,description:"Include a web component in the template"},$9,Z9,aZ,tZ,Y9,X9,Q9,J9,z9,j9,_Z,V3,...hZ],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};J2=new Map;k3=new Proxy(l1,{get($,Z){if(B5&&Z in B5)return B5[Z];if(!S4)z1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var z2={};a(z2,{resetCssCache:()=>Vz,resetCrosswindCache:()=>wz,rebuildCrosswindCSS:()=>Az,loadCrosswindConfig:()=>C3,loadCrosswind:()=>P3,injectCrosswindCSS:()=>Q$,getCachedCSS:()=>Rz,generateCrosswindCSS:()=>W2,extractClassNames:()=>K2,buildCrosswindCSS:()=>G2});import Y0 from"path";import{hasLocalConfig as _z}from"bunfig/discovery";function y3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function b3($,Z){if(q1.has($))q1.delete($);else if(q1.size>=Bz)q1.delete(q1.keys().next().value);q1.set($,Z)}async function Hz($){if(!R1)return null;try{let Z=Bun.file(Y0.join(R1,`cw-${y3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function Oz($,Z){if(!R1)return;try{if(!fs.existsSync(R1))fs.mkdirSync(R1,{recursive:!0});await Bun.write(Y0.join(R1,`cw-${y3($)}.css`),Z)}catch{}}async function Q2($){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 Lz(){let $=[],Z=process.cwd();while(Z!==Y0.dirname(Z))$.push(Y0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Y0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=Y0.dirname(Z);return $}function Fz(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function P3(){if(S3)return J1;S3=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await Q2(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=Y0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return J1=Q,J1}let Z=await $(Lz());if(Z)return J1=Z,J1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of Y){let Q=await Q2(X);if(Q){if(J1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded`);return J1}}let J=await $(Fz());if(J)return J1=J,J1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${H0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${H0.reset}`),console.warn(`${H0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${H0.reset}`),null}}function Vz(){q1.clear()}function wz(){J1=null,S3=!1,e0=null,X$="",q1.clear(),y4=null}async function C3($){try{if(!_z({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=Y0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${H0.yellow}[Crosswind]${H0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function G2($){if(H5)return X$;H5=!0;try{let Z=await P3();if(!Z||!Z.build)return H5=!1,"";if(!e0)e0=await C3($);if(!e0)return H5=!1,"";let Y=Z.defaultConfig?.theme||{},J=e0.theme||{},X={...Z.defaultConfig,...e0,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(X$=G.css,console.log(`${H0.cyan}[Crosswind]${H0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let W=Y0.isAbsolute(X.output)?X.output:Y0.join($,X.output),z=Y0.dirname(W);if(!fs.existsSync(z))fs.mkdirSync(z,{recursive:!0});await Bun.write(W,G.css)}return H5=!1,G.css}catch(Z){return console.error(`${H0.red}[Crosswind]${H0.reset} Build error:`,Z),H5=!1,X$}}async function Az($){e0=null,await G2($)}function Rz(){return X$}function K2($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let 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 W2($,Z){try{let Y=await P3();if(!Y)return"";let J=typeof Y.extractClasses==="function"?Y.extractClasses($):K2($);if(J.size===0)return"";let X=Z?Y0.resolve(Z):process.cwd();if(!R1)R1=B1(X,"cache");let Q=[...J].sort().join(" "),G=`${y4||"default"}::${Q}`,K=q1.get(G);if(K!==void 0)return b3(G,K),K;let W=await Hz(G);if(W!==null)return b3(G,W),W;if(!e0){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (c1(),X2)),N=await R(X);if(N.css)if(typeof N.css==="string"){let M=Y0.isAbsolute(N.css)?N.css:Y0.resolve(X,N.css);if(await Bun.file(M).exists()){let T=await import(M);A=T.default||T,console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(A={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let M=Y0.isAbsolute(N.css.config)?N.css.config:Y0.resolve(X,N.css.config);if(await Bun.file(M).exists()){let T=await import(M);A={...T.default||T,...A}}}console.log(`${H0.green}[Crosswind]${H0.reset} Using inline CSS config from stx.config.ts`)}}catch{}e0=A||await C3(X);try{y4=y3(JSON.stringify(e0??{}))}catch{y4="unhashable"}}let z=Y.defaultConfig||Y.config,q=e0||{},U=z.theme||{},_=(q.theme||{}).extend||{},B={...U};if(Object.keys(_).length>0)B.extend=_;let H=[...z.safelist||[],...q.safelist||[]],L={...z,...q,content:[],output:"",preflight:!0,minify:!1,theme:B,safelist:H},V=new Y.CSSGenerator(L);for(let A of H)V.generate(A);for(let A of J)V.generate(A);let O=V.toCSS(!0,!1),F=L.shortcuts||q.shortcuts||{};for(let[A,R]of Object.entries(F)){if(!J.has(A)&&!H.includes(A))continue;let N=R.split(/\s+/).filter(Boolean);for(let M of N)V.generate(M)}O=V.toCSS(!0,!1);let w=O.split(`
8234
+ `}async function $2($,Z,Y,J){if(Z.length<1)return e("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[X$.join(X$.dirname(J),G,`${X}.stx`),X$.join(process.cwd(),G,`${X}.stx`),X$.join(X$.dirname(J),`${X}.stx`)],W=null;for(let U of K)if(await c(U)){W=await Bun.file(U).text();break}if(!W)return e("WebComponent",`Component file not found: ${X}.stx`,s.FILE_NOT_FOUND);let z=Yz(W,X);return`<script type="module">
8235
+ ${Jz(z)}
8236
+ </script>`}var Z2=S(()=>{z1();M0()});var Y2={};a(Y2,{timingPlugin:()=>Wz,pluginManager:()=>Xz,definePlugin:()=>S4,debugPlugin:()=>Kz,createVariablesPlugin:()=>zz,createFilterPlugin:()=>Gz,createDirectivePlugin:()=>Qz,PluginManager:()=>k3});function S4($){return $}class k3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let X=J[$];if(X)try{let Q=await X(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return J}}function Qz($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function Gz($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function zz($){return S4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var Xz,Kz,Wz;var J2=S(()=>{Xz=new k3;Kz=S4({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)}}),Wz=S4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var Q2={};a(Q2,{validateConfig:()=>Bz,loadStxConfig:()=>q1,defineStxConfig:()=>_z,defaultConfig:()=>c1,config:()=>S3});import b3 from"fs";import S0 from"path";import{loadConfigWithResult as qz}from"bunfig";function Uz($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=S0.join(process.cwd(),"resources","views"),X=S0.join(process.cwd(),"resources","layouts");if(b3.existsSync(J)&&b3.existsSync(X))return{root:"resources",pagesDir:"views"};let Q=S0.join(process.cwd(),"resources","views","pages");if(b3.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function jz($){if(t6($.stateDir),$.stateDir=S5(),$.cachePath=y5($.cachePath),$.build)$.build.cacheDir=y5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=y5($.media.cache.directory);if($.story)$.story.outDir=y5($.story.outDir)}async function q1($){if(!$){if(H5)return H5;if(y4)return y4}let Z=$?S0.resolve($):process.cwd(),Y=X2.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await qz({name:"stx",alias:"ui",cwd:Z,defaultConfig:c1,verbose:!1})).config;jz(Q);let G=Uz(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!S0.isAbsolute(Q.partialsDir))Q.partialsDir=S0.join(K,Q.partialsDir);if(Q.componentsDir&&!S0.isAbsolute(Q.componentsDir))Q.componentsDir=S0.join(K,Q.componentsDir);if(Q.layoutsDir&&!S0.isAbsolute(Q.layoutsDir))Q.layoutsDir=S0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (J2(),Y2)),W=[],z=[];for(let q of Q.plugins){let U=typeof q==="string"?q:q[0],j=typeof q==="string"?{}:q[1]||{};try{let _,B;try{_=await import(U),B=S0.dirname(j0.resolve(U))}catch{let L=S0.resolve(process.cwd(),U);_=await import(L),B=S0.dirname(L)}let H=_.default||_;if(K.register(H,Q),H.components){let L=S0.resolve(B,H.components);W.push(L)}if(H.pages){let L=S0.resolve(B,H.pages),V=j.path||"/";z.push({dir:L,prefix:V})}if(H.setup){let L={addDirective:(V)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(V)},addRoute:(V,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[V]=O},addMiddleware:(V)=>{Q.middleware=Q.middleware||[],Q.middleware.push(V)},pluginDir:B,config:Q};await H.setup(j,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(_){console.warn(`[stx] Failed to load plugin ${U}:`,_.message)}}Q._pluginComponentDirs=W,Q._pluginPageDirs=z}return Q})();if(X2.set(Z,J),!$)y4=J,J.then((X)=>{H5=X}).catch(()=>{});return J}function _z($){return $}function Bz($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.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((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((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(!J.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.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 J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var c1,H5=null,X2,y4=null,S3;var i1=S(()=>{K7();W7();z7();q7();c7();HZ();R3();uZ();E3();P5();Z2();c1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Z5,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:u8,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:$2,hasEndTag:!1,description:"Include a web component in the template"},Z9,Y9,tZ,eZ,J9,Q9,G9,X9,q9,_9,BZ,A3,...dZ],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};X2=new Map;S3=new Proxy(c1,{get($,Z){if(H5&&Z in H5)return H5[Z];if(!y4)q1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var U2={};a(U2,{resetCssCache:()=>Rz,resetCrosswindCache:()=>Nz,rebuildCrosswindCSS:()=>Mz,loadCrosswindConfig:()=>v3,loadCrosswind:()=>C3,injectCrosswindCSS:()=>G$,getCrosswindServeAsset:()=>Lz,getCachedCSS:()=>Tz,generateCrosswindCSS:()=>q2,extractClassNames:()=>z2,buildCrosswindCSS:()=>W2});import Y0 from"path";import{hasLocalConfig as Hz}from"bunfig/discovery";function C4($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function y3($,Z){if(U1.has($))U1.delete($);else if(U1.size>=K2)U1.delete(U1.keys().next().value);U1.set($,Z)}function Oz($){let Z=C4($);if(e0.has(Z))e0.delete(Z);else if(e0.size>=K2)e0.delete(e0.keys().next().value);return e0.set(Z,$),Z}function Lz($){let Z=e0.get($);if(Z===void 0)return;return e0.delete($),e0.set($,Z),Z}async function Fz($){if(!N1)return null;try{let Z=Bun.file(Y0.join(N1,`cw-${C4($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function Vz($,Z){if(!N1)return;try{if(!fs.existsSync(N1))fs.mkdirSync(N1,{recursive:!0});await Bun.write(Y0.join(N1,`cw-${C4($)}.css`),Z)}catch{}}async function G2($){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 wz(){let $=[],Z=process.cwd();while(Z!==Y0.dirname(Z))$.push(Y0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Y0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=Y0.dirname(Z);return $}function Az(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function C3(){if(P3)return X1;P3=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await G2(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=Y0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return X1=Q,X1}let Z=await $(wz());if(Z)return X1=Z,X1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of Y){let Q=await G2(X);if(Q){if(X1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded`);return X1}}let J=await $(Az());if(J)return X1=J,X1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${H0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${H0.reset}`),console.warn(`${H0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${H0.reset}`),null}}function Rz(){U1.clear(),e0.clear()}function Nz(){X1=null,P3=!1,$1=null,Q$="",U1.clear(),e0.clear(),P4=null}async function v3($){try{if(!Hz({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=Y0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${H0.yellow}[Crosswind]${H0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function W2($){if(O5)return Q$;O5=!0;try{let Z=await C3();if(!Z||!Z.build)return O5=!1,"";if(!$1)$1=await v3($);if(!$1)return O5=!1,"";let Y=Z.defaultConfig?.theme||{},J=$1.theme||{},X={...Z.defaultConfig,...$1,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(Q$=G.css,console.log(`${H0.cyan}[Crosswind]${H0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let W=Y0.isAbsolute(X.output)?X.output:Y0.join($,X.output),z=Y0.dirname(W);if(!fs.existsSync(z))fs.mkdirSync(z,{recursive:!0});await Bun.write(W,G.css)}return O5=!1,G.css}catch(Z){return console.error(`${H0.red}[Crosswind]${H0.reset} Build error:`,Z),O5=!1,Q$}}async function Mz($){$1=null,await W2($)}function Tz(){return Q$}function z2($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let 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 q2($,Z){try{let Y=await C3();if(!Y)return"";let J=typeof Y.extractClasses==="function"?Y.extractClasses($):z2($);if(J.size===0)return"";let X=Z?Y0.resolve(Z):process.cwd();if(!N1)N1=H1(X,"cache");let Q=[...J].sort().join(" "),G=`${P4||"default"}::${Q}`,K=U1.get(G);if(K!==void 0)return y3(G,K),K;let W=await Fz(G);if(W!==null)return y3(G,W),W;if(!$1){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (i1(),Q2)),N=await R(X);if(N.css)if(typeof N.css==="string"){let M=Y0.isAbsolute(N.css)?N.css:Y0.resolve(X,N.css);if(await Bun.file(M).exists()){let T=await import(M);A=T.default||T,console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(A={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let M=Y0.isAbsolute(N.css.config)?N.css.config:Y0.resolve(X,N.css.config);if(await Bun.file(M).exists()){let T=await import(M);A={...T.default||T,...A}}}console.log(`${H0.green}[Crosswind]${H0.reset} Using inline CSS config from stx.config.ts`)}}catch{}$1=A||await v3(X);try{P4=C4(JSON.stringify($1??{}))}catch{P4="unhashable"}}let z=Y.defaultConfig||Y.config,q=$1||{},U=z.theme||{},_=(q.theme||{}).extend||{},B={...U};if(Object.keys(_).length>0)B.extend=_;let H=[...z.safelist||[],...q.safelist||[]],L={...z,...q,content:[],output:"",preflight:!0,minify:!1,theme:B,safelist:H},V=new Y.CSSGenerator(L);for(let A of H)V.generate(A);for(let A of J)V.generate(A);let O=V.toCSS(!0,!1),F=L.shortcuts||q.shortcuts||{};for(let[A,R]of Object.entries(F)){if(!J.has(A)&&!H.includes(A))continue;let N=R.split(/\s+/).filter(Boolean);for(let M of N)V.generate(M)}O=V.toCSS(!0,!1);let w=O.split(`
8237
8237
  `);for(let[A,R]of Object.entries(F)){if(!J.has(A)&&!H.includes(A))continue;let N=R.split(/\s+/).filter(Boolean),M=[],T=[];for(let I of N){let E=I.startsWith("dark:"),b=`.${(E?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<w.length;k++){let v=w[k].trim();if(v===`${b} {`||v.startsWith(`${b} {`)){let g=k,f="";while(g<w.length){if(f+=w[g],w[g].includes("}"))break;g++}let d=f.match(/\{([^}]+)\}/);if(d)if(E)T.push(d[1].trim());else M.push(d[1].trim());break}}}if(M.length)O+=`
8238
8238
  .${A} { ${M.join(" ")} }`;if(T.length)O+=`
8239
- @media (prefers-color-scheme: dark) { .dark .${A} { ${T.join(" ")} } }`}return b3(G,O),Oz(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function Q$($,Z){let Y=await W2($,Z);if(!Y)return $;let J=`<style data-crosswind="generated">
8240
- ${Y}
8241
- </style>`,X=/<style data-crosswind="generated">[\s\S]*?<\/style>/g;if(X.test($)){let Q=!1;return $.replace(X,()=>{if(Q)return"";return Q=!0,J})}if($.includes("</head>"))return $.replace("</head>",`${J}
8239
+ @media (prefers-color-scheme: dark) { .dark .${A} { ${T.join(" ")} } }`}return y3(G,O),Vz(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function G$($,Z,Y=!1){let J=await q2($,Z);if(!J)return $;let X=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${Oz(J)}.css">`:`<style data-crosswind="generated">
8240
+ ${J}
8241
+ </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}
8242
8242
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
8243
- ${J}`);return J+$}var J1=null,S3=!1,e0=null,X$="",H5=!1,Bz=256,q1,R1=null,y4=null;var P4=S(()=>{y5();t6();q1=new Map});function q2(){return`
8243
+ ${X}`);return X+$}var X1=null,P3=!1,$1=null,Q$="",O5=!1,K2=256,U1,e0,N1=null,P4=null;var v4=S(()=>{P5();e6();U1=new Map,e0=new Map});function j2(){return`
8244
8244
  // STX Lifecycle Runtime
8245
8245
  (function() {
8246
8246
  if (typeof window === 'undefined') return;
@@ -8585,7 +8585,7 @@ else {
8585
8585
 
8586
8586
  console.log('[stx] Lifecycle runtime initialized');
8587
8587
  })();
8588
- `}function v3($){return Symbol($)}var PF,CF,vF;var U2=S(()=>{PF=v3("theme"),CF=v3("router"),vF=v3("i18n")});import*as _2 from"crypto";function j2($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function Nz(){return`stx-${_2.randomBytes(4).toString("hex")}`}function Mz($){return/\$\w+\./.test($)}function Tz($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,X=$;return X=X.replace(J,(Q,G,K,W)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let z=[],q=!1,U=K,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(j)];for(let L of _){let V=L[0],O=L[1],F=L[2];if(Mz(F)){q=!0;let w=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(z.push({attr:O,expr:A,fullMatch:V,originalAttr:O}),j2(A).forEach((N)=>Y.add(N)),O==="text")U=U.replace(V,"");else if(O==="class")U=U.replace(V,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(V,"");else U=U.replace(V,`${O}=""`)}}}if(!q)return Q;let B=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(B)H=B[1];else H=Nz(),U=` id="${H}"${U}`;for(let L of z)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:j2(L.expr)});return`<${G}${U}${W}`}),{html:X,bindings:Z,stores:Y}}function Iz($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
8588
+ `}function x3($){return Symbol($)}var xF,fF,gF;var _2=S(()=>{xF=x3("theme"),fF=x3("router"),gF=x3("i18n")});import*as H2 from"crypto";function B2($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function Iz(){return`stx-${H2.randomBytes(4).toString("hex")}`}function Dz($){return/\$\w+\./.test($)}function Ez($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,X=$;return X=X.replace(J,(Q,G,K,W)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let z=[],q=!1,U=K,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(j)];for(let L of _){let V=L[0],O=L[1],F=L[2];if(Dz(F)){q=!0;let w=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(z.push({attr:O,expr:A,fullMatch:V,originalAttr:O}),B2(A).forEach((N)=>Y.add(N)),O==="text")U=U.replace(V,"");else if(O==="class")U=U.replace(V,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(V,"");else U=U.replace(V,`${O}=""`)}}}if(!q)return Q;let B=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(B)H=B[1];else H=Iz(),U=` id="${H}"${U}`;for(let L of z)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:B2(L.expr)});return`<${G}${U}${W}`}),{html:X,bindings:Z,stores:Y}}function kz($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
8589
8589
  <script>
8590
8590
  (function() {
8591
8591
  'use strict';
@@ -8743,10 +8743,10 @@ else {
8743
8743
  }
8744
8744
  })();
8745
8745
  </script>
8746
- `,J}function B2($){let{html:Z,bindings:Y,stores:J}=Tz($);if(Y.length===0)return $;let X=Iz(Y,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var H2=()=>{};function Dz($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return Ez(Z);case"google-analytics":return kz(Z);case"plausible":return bz(Z);case"self-hosted":return Sz(Z);case"custom":return yz(Z);default:return""}}function Ez($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",X=[`data-site="${u0(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="${u0(Z.canonical)}"`);if(Z.auto===!1)X.push('data-auto="false"');return`
8746
+ `,J}function O2($){let{html:Z,bindings:Y,stores:J}=Ez($);if(Y.length===0)return $;let X=kz(Y,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var L2=()=>{};function bz($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return Sz(Z);case"google-analytics":return yz(Z);case"plausible":return Pz(Z);case"self-hosted":return Cz(Z);case"custom":return vz(Z);default:return""}}function Sz($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",X=[`data-site="${u0(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="${u0(Z.canonical)}"`);if(Z.auto===!1)X.push('data-auto="false"');return`
8747
8747
  <!-- Fathom Analytics -->
8748
8748
  <script src="${u0(Y)}" ${X.join(" ")}${J}></script>
8749
- `}function kz($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=u0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
8749
+ `}function yz($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=u0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
8750
8750
  <!-- Google Analytics -->
8751
8751
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
8752
8752
  <script>
@@ -8756,10 +8756,10 @@ else {
8756
8756
  gtag('config', '${Y}');
8757
8757
  ${J}
8758
8758
  </script>
8759
- `}function bz($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${u0(Z.domain)}"`],X=Y,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&Y==="https://plausible.io/js/script.js")X=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
8759
+ `}function Pz($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${u0(Z.domain)}"`],X=Y,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&Y==="https://plausible.io/js/script.js")X=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
8760
8760
  <!-- Plausible Analytics -->
8761
8761
  <script defer data-domain="${u0(Z.domain)}" src="${u0(X)}"></script>
8762
- `}function Sz($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=u0(Z.siteId),J=u0(Z.apiEndpoint),X=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
8762
+ `}function Cz($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=u0(Z.siteId),J=u0(Z.apiEndpoint),X=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
8763
8763
  d.addEventListener('click',function(e){
8764
8764
  var a=e.target.closest('a');
8765
8765
  if(a&&a.hostname!==location.hostname){
@@ -8792,7 +8792,7 @@ else {
8792
8792
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
8793
8793
  })();
8794
8794
  </script>
8795
- `}function yz($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
8795
+ `}function vz($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
8796
8796
  <!-- Custom Analytics -->
8797
8797
  <script>
8798
8798
  ${Z.inlineScript}
@@ -8800,7 +8800,7 @@ ${Z.inlineScript}
8800
8800
  `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${u0(Z.scriptId)}"`);if(Z.attributes)for(let[X,Q]of Object.entries(Z.attributes))Y.push(`${u0(X)}="${u0(Q)}"`);return`
8801
8801
  <!-- Custom Analytics -->
8802
8802
  <script${Y.length>0?` ${Y.join(" ")}`:""} src="${u0(Z.scriptUrl)}" defer></script>
8803
- `}function O2($,Z){let Y=Dz(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function u0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var L2=()=>{};function w2($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let J=Y.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(Pz.has(J))Z.systemKeys.push(J);else if(J in A2)Z.mouse=J;else if(J in V2||/^[a-z]$/.test(J))Z.keys.push(V2[J]||J.toUpperCase());else if(J.startsWith("debounce")){let X=J.match(/debounce(?:\.(\d+))?/);Z.debounce=X?.[1]?Number.parseInt(X[1],10):300}else if(J.startsWith("throttle")){let X=J.match(/throttle(?:\.(\d+))?/);Z.throttle=X?.[1]?Number.parseInt(X[1],10):300}}return Z}function R2($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,X;while((X=J.exec($))!==null){let[Q,G,K]=X,W=X.index,z=W+Q.length,q=`__stx_evt_${Y++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=j.exec(K))!==null){let[,H,L]=_,V=H.split("."),O=V[0];if(!F2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:w2(V.slice(1)),elementId:q})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=B.exec(K))!==null){let[,H,L]=_,V=H.split("."),O=V[0];if(!F2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:w2(V.slice(1)),elementId:q})}if(U.length>0)Z.push({originalTag:Q,elementId:q,events:U,startIndex:W,endIndex:z})}return Z}function Cz($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=A2[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function vz($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function xz($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=Cz($),X=vz($.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`
8803
+ `}function F2($,Z){let Y=bz(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function u0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var V2=()=>{};function R2($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let J=Y.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(xz.has(J))Z.systemKeys.push(J);else if(J in N2)Z.mouse=J;else if(J in A2||/^[a-z]$/.test(J))Z.keys.push(A2[J]||J.toUpperCase());else if(J.startsWith("debounce")){let X=J.match(/debounce(?:\.(\d+))?/);Z.debounce=X?.[1]?Number.parseInt(X[1],10):300}else if(J.startsWith("throttle")){let X=J.match(/throttle(?:\.(\d+))?/);Z.throttle=X?.[1]?Number.parseInt(X[1],10):300}}return Z}function M2($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,X;while((X=J.exec($))!==null){let[Q,G,K]=X,W=X.index,z=W+Q.length,q=`__stx_evt_${Y++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=j.exec(K))!==null){let[,H,L]=_,V=H.split("."),O=V[0];if(!w2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:R2(V.slice(1)),elementId:q})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=B.exec(K))!==null){let[,H,L]=_,V=H.split("."),O=V[0];if(!w2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:R2(V.slice(1)),elementId:q})}if(U.length>0)Z.push({originalTag:Q,elementId:q,events:U,startIndex:W,endIndex:z})}return Z}function fz($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=N2[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function gz($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function hz($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=fz($),X=gz($.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`
8804
8804
  (function() {
8805
8805
  var $el = document.getElementById('${Y}');
8806
8806
  if (!$el) return;
@@ -8854,7 +8854,7 @@ else {
8854
8854
  __stx_runHandler('${K}', $event, $el);
8855
8855
  }
8856
8856
  }${G});
8857
- })();`}function fz($){if($.length===0)return"";return`
8857
+ })();`}function dz($){if($.length===0)return"";return`
8858
8858
  <script data-stx-events>
8859
8859
  (function() {
8860
8860
  'use strict';
@@ -8902,11 +8902,11 @@ else {
8902
8902
  }
8903
8903
 
8904
8904
  // Event listeners
8905
- ${$.flatMap((Y)=>Y.events).map(xz).join(`
8905
+ ${$.flatMap((Y)=>Y.events).map(hz).join(`
8906
8906
  `)}
8907
8907
  })();
8908
- </script>`}function gz($){let Z=R2($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];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,"\\$&"),z=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),q=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(z,""),G=G.replace(q,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),J.push(...Q.events)}return{template:Y,bindings:J}}function N2($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:W,bindings:z}=gz($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...z],W}let X=R2($);if(X.length===0)return $;let Q=$;for(let W=X.length-1;W>=0;W--){let z=X[W],q=z.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let U=q.match(/id=["']([^"']+)["']/);if(U)for(let j of z.events)j.elementId=U[1]}for(let U of z.events){let j=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");q=q.replace(_,""),q=q.replace(B,"")}Q=Q.slice(0,z.startIndex)+q+Q.slice(z.endIndex)}let G=fz(X),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+G+`
8909
- `+Q.slice(K);else Q+=G;return Q}var F2,V2,Pz,A2;var M2=S(()=>{F2=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"]),V2={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"},Pz=new Set(["ctrl","alt","shift","meta"]),A2={left:0,middle:1,right:2}});function C4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function T2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function dz($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[X,Q,G]=J,K=J.index,W=T2(G,"x-data");if(!W)continue;let z=`__stx_scope_${D2++}`,q=T2(G,"x-init"),U=uz($,Q,K+X.length),j=$.slice(K,U.endIndex),_=mz(j);Z.push({id:z,selector:`[data-stx-scope="${z}"]`,stateExpr:W,initExpr:q,bindings:[],refs:_})}return Z}function uz($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X,K.lastIndex=X;let W=Q.exec($),z=G.exec($),q=K.exec($);if(q&&q.index<(W?.index??1/0)){X=q.index+q[0].length;continue}if(!z)return{endIndex:$.length};if(W&&W.index<z.index)J++,X=W.index+W[0].length;else{if(J--,J===0)return{endIndex:z.index+z[0].length};X=z.index+z[0].length}}return{endIndex:$.length}}function mz($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,X;while((X=J.exec(Y))!==null){let[,Q,G]=X,K=pz(Q);Z.set(G,K)}return Z}function pz($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${hz++}`}function lz(){return`
8908
+ </script>`}function uz($){let Z=M2($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];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,"\\$&"),z=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),q=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(z,""),G=G.replace(q,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),J.push(...Q.events)}return{template:Y,bindings:J}}function T2($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:W,bindings:z}=uz($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...z],W}let X=M2($);if(X.length===0)return $;let Q=$;for(let W=X.length-1;W>=0;W--){let z=X[W],q=z.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let U=q.match(/id=["']([^"']+)["']/);if(U)for(let j of z.events)j.elementId=U[1]}for(let U of z.events){let j=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");q=q.replace(_,""),q=q.replace(B,"")}Q=Q.slice(0,z.startIndex)+q+Q.slice(z.endIndex)}let G=dz(X),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+G+`
8909
+ `+Q.slice(K);else Q+=G;return Q}var w2,A2,xz,N2;var I2=S(()=>{w2=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"]),A2={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"},xz=new Set(["ctrl","alt","shift","meta"]),N2={left:0,middle:1,right:2}});function x4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function D2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function pz($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[X,Q,G]=J,K=J.index,W=D2(G,"x-data");if(!W)continue;let z=`__stx_scope_${k2++}`,q=D2(G,"x-init"),U=lz($,Q,K+X.length),j=$.slice(K,U.endIndex),_=cz(j);Z.push({id:z,selector:`[data-stx-scope="${z}"]`,stateExpr:W,initExpr:q,bindings:[],refs:_})}return Z}function lz($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X,K.lastIndex=X;let W=Q.exec($),z=G.exec($),q=K.exec($);if(q&&q.index<(W?.index??1/0)){X=q.index+q[0].length;continue}if(!z)return{endIndex:$.length};if(W&&W.index<z.index)J++,X=W.index+W[0].length;else{if(J--,J===0)return{endIndex:z.index+z[0].length};X=z.index+z[0].length}}return{endIndex:$.length}}function cz($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,X;while((X=J.exec(Y))!==null){let[,Q,G]=X,K=iz(Q);Z.set(G,K)}return Z}function iz($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${mz++}`}function nz(){return`
8910
8910
  // STX Reactive Runtime - x-cloak and transition CSS
8911
8911
  (function() {
8912
8912
  var style = document.createElement('style');
@@ -9113,7 +9113,7 @@ window.__stx_reactive = (function() {
9113
9113
 
9114
9114
  return { initScope: initScope, reactive: reactive };
9115
9115
  })();
9116
- `}function I2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=c0(X,Z,!0);if(Q===void 0)return J;return String(Q)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{try{let Q=c0(X,Z,!0);if(Q===void 0)return J;if(typeof Q==="string"){let G=Q.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(Q)}catch{return J}}),Y}function cz($,Z){if($.length===0)return"";let Y=$.map((J)=>{let X=JSON.stringify(Object.fromEntries(J.refs)),Q=I2(J.stateExpr,Z),G=J.initExpr?I2(J.initExpr,Z):null,K=JSON.stringify(Q),W=G?JSON.stringify(G):"null";return`
9116
+ `}function E2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=c0(X,Z,!0);if(Q===void 0)return J;return String(Q)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{try{let Q=c0(X,Z,!0);if(Q===void 0)return J;if(typeof Q==="string"){let G=Q.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(Q)}catch{return J}}),Y}function oz($,Z){if($.length===0)return"";let Y=$.map((J)=>{let X=JSON.stringify(Object.fromEntries(J.refs)),Q=E2(J.stateExpr,Z),G=J.initExpr?E2(J.initExpr,Z):null,K=JSON.stringify(Q),W=G?JSON.stringify(G):"null";return`
9117
9117
  (function() {
9118
9118
  var scopeEl = document.querySelector('${J.selector}');
9119
9119
  if (!scopeEl) return;
@@ -9122,14 +9122,14 @@ window.__stx_reactive = (function() {
9122
9122
  })();`}).join(`
9123
9123
  `);return`
9124
9124
  <script data-stx-scoped data-stx-reactive>
9125
- ${lz()}
9125
+ ${nz()}
9126
9126
  ${Y}
9127
- </script>`}function E2($,Z,Y){if(D2=0,!nz($))return $;let J=dz($);if(J.length===0)return $;let X=iz($,J),Q=cz(J,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
9128
- `+X.slice(G);else X+=Q;return X}function iz($,Z){let Y=$;for(let J of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${C4(J.stateExpr)}["']`,"gi").exec(Y);if(Q)J.id=Q[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${C4(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)J.id=K[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${C4(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${C4(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function nz($){return/x-data\s*=\s*["']/.test($)}var D2=0,hz=0;var k2=S(()=>{Y1()});import oz from"fs";import x3 from"path";import{createHighlighter as sz}from"ts-syntax-highlighter";async function rz($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let J=(await oz.promises.stat($)).mtime.getTime();if(Z.cache&&f3.has($)){let U=f3.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=B9(X),K=Z.markdown||k3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},z=P5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)z=await az(z,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let q={content:z,data:Q||{}};if(Z.cache)f3.set($,{...q,updatedAt:J});return q}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:q0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function az($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!v4)try{v4=await sz({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,z,q)=>{let U=q.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=z||(Y?"text":"");if(!j)return K;try{if(!v4.getSupportedLanguages().includes(j))return K;return(await v4.highlight(U,j,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${z}:`,_)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[W,z,q,U]=K,j=await X(W,z,q,U);Q=Q.replace(W,j)}return Q}async function b2($,Z,Y="",J={}){return await tz($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,z)=>{try{let q=K;if(!x3.isAbsolute(K))q=x3.resolve(x3.dirname(Y),K);let U={};if(W)try{try{U=JSON.parse(W)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let w=F.indexOf(":");if(w>0){let A=F.substring(0,w).trim(),R=F.substring(w+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),M=R.startsWith("'")&&R.endsWith("'");if(N||M)R=R.substring(1,R.length-1);U[A]=R}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:j,data:_}=await rz(q,J),B={...Z,..._,...U},H=j,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(V,O)=>{let F=O.trim();return B[F]!==void 0?String(B[F]):V}),H}catch(q){let U=q instanceof Error?q.message:String(q);return q0("Markdown File",`Error including markdown file: ${U}`,Y,$,z,G)}})}async function tz($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,z=X;J.push(Y(...z).then((q)=>({match:K,replacement:q,index:W})))}let Q=await Promise.all(J);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 f3,v4=null;var S2=S(()=>{c1();M0();f3=new Map});function N1($,Z){try{let Y=$.trim();if(K0(Y))return W0(Y,Object.keys(Z))(...Object.values(Z));else return $0(Y,Z)}catch{return!1}}var y2=S(()=>{w0()});function ez($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=I7(J,G);if(!K)break;try{let W;if(K0(K.expression))W=W0(K.expression,Object.keys(Z))(...Object.values(Z));else W=$0(K.expression,Z);let z="",q=!1;for(let U of K.cases)if(U.type==="default"){if(!q)z=U.content.trim()}else try{let j;if(U.value&&K0(U.value))j=W0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=$0(U.value,Z);if(W===j){z=U.content.trim(),q=!0;break}}catch{continue}J=J.substring(0,G)+z+J.substring(K.end),X=!0}catch(W){let z=W instanceof Error?W.message:String(W),q=e("Switch",`Error evaluating @switch expression: ${z}`,s.EVALUATION_ERROR);J=J.substring(0,G)+q+J.substring(K.end);break}}return J}function i1($,Z,Y){let J=$;J=ez(J,Z,Y);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=w1(J,K+7);if(!W)break;let z=W.endPos,q=g1(J,"unless","endunless",z);if(q===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=J.slice(z,q),j=W.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],w;while((w=L.exec(U))!==null)F.push({pos:w.index,type:"open"});while((w=V.exec(U))!==null)F.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)F.push({pos:w.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let B;if(_!==-1){let H=U.slice(0,_),L=U.slice(_+5);B=`@if (${j})${L}@else ${H}@endif`}else B=`@if (!(${j}))${U}@endif`;J=J.substring(0,K)+B+J.substring(q+10),Q=!0}}J=h3(J,Z,Y),J=d3(J,Z,Y),J=g3(J,Z);let X=()=>{let Q=s5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",z=!1;for(let q of K.branches){if(z)break;if(q.type==="else")W=q.content,z=!0;else try{let U;if(q.condition&&K0(q.condition))U=W0(q.condition,Object.keys(Z))(...Object.values(Z));else if(q.condition)U=$0(q.condition,Z);if(U)W=q.content,z=!0}catch(U){W=e(q.type==="if"?"If":"Elseif",`Error in @${q.type}(${q.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),z=!0}}J=J.substring(0,K.start)+W+J.substring(K.end)}catch(W){let z=W instanceof Error?W.message:String(W),q=e("If",`Error processing @if block: ${z}`,s.EVALUATION_ERROR);J=J.substring(0,K.start)+q+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function P2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(X===Y){Z++;break}J.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function g3($,Z){let Y=$;function J(K,W,z,q){let U=1,j=q,_=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${z}(?![a-z])`,"g");while(j<K.length&&U>0){_.lastIndex=j,B.lastIndex=j;let H=_.exec(K),L=B.exec(K),V=H?H.index:1/0,O=L?L.index:1/0;if(V<O)U++,j=V+H[0].length;else if(O<1/0){if(U--,U===0)return O;j=O+L[0].length}else break}return-1}function X(K,W,z){let q=0,U=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${z}(?![a-z])`,"g"),_=/@else(?![a-z])/g,B=[],H;while((H=U.exec(K))!==null)B.push({pos:H.index,type:"open"});while((H=j.exec(K))!==null)B.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)B.push({pos:H.index,type:"else"});B.sort((L,V)=>L.pos-V.pos);for(let L of B)if(L.type==="open")q++;else if(L.type==="close")q--;else if(L.type==="else"&&q===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let z=W.index,q,U,j=Y.slice(z+5),_=P2(j);if(_)q=_.value,U=z+5+_.consumed;else U=z+5;let B=J(Y,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${z} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,B),L=X(H,"auth","endauth"),V;if(!Z.auth)V=!1;else V=q?N1(`auth?.check && auth?.user?.[${q}]`,Z):N1("auth?.check",Z);let O;if(L!==-1){let F=H.slice(0,L),w=H.slice(L+5);O=V?F:w}else O=V?H:"";Y=Y.substring(0,z)+O+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let z=W.index,q,U,j=Y.slice(z+6),_=P2(j);if(_)q=_.value,U=z+6+_.consumed;else U=z+6;let B=J(Y,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${z} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,B),L=X(H,"guest","endguest"),V;if(!Z.auth)V=!0;else V=q?N1(`!auth?.check || !auth?.user?.[${q}]`,Z):N1("!auth?.check",Z);let O;if(L!==-1){let F=H.slice(0,L),w=H.slice(L+5);O=V?F:w}else O=V?H:"";Y=Y.substring(0,z)+O+Y.substring(B+9),K=!0}}function Q(K,W,z){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let q=[K];if(W)q.push(W);if(z){let U=N1(z,Z);q.push(U)}return Z.permissions.check(...q)}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}`,z=K==="can"?"elsecan":"elsecannot",q=!0;while(q){q=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,_=Y.slice(j+`@${K}`.length),B=G(_);if(!B)break;let H=j+`@${K}`.length+B.paramsEnd,L=J(Y,K,W,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let V=Y.slice(H,L),O=[],F=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${W}(?![a-z])`,"g"),R=new RegExp(`@${z}\\s*\\(`,"g"),N=/@else(?![a-z])/g,M=[],T;while((T=w.exec(V))!==null)M.push({pos:T.index,type:"open"});while((T=A.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=N.exec(V))!==null)M.push({pos:T.index,type:"else"});M.sort((k,v)=>k.pos-v.pos);for(let k of M){if(k.type==="open"){F++;continue}if(k.type==="close"){F--;continue}if(F===0)O.push(k)}let I=[],E=0;for(let k=0;k<O.length;k++){let v=O[k];if(I.push({content:V.slice(E,v.pos),ability:void 0}),v.type==="elseDirective"){let g=V.slice(v.pos+`@${z}`.length),f=G(g);if(f){I[I.length-1]={content:V.slice(E,v.pos)},E=v.pos+`@${z}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let d=O[k+1],p=d?d.pos:V.length;I.push({content:V.slice(E,p),ability:f.ability,type:f.type,id:f.id}),E=p}}else E=v.pos+5}if(E<V.length){let k=I[I.length-1];if(O.length>0&&O[O.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,b="";if(y)b=I[0]?.content||"";else{let k=!1;for(let v=1;v<I.length;v++){let g=I[v];if(g.isFinalElse){b=g.content,k=!0;break}if(g.ability){let f=Q(g.ability,g.type,g.id);if(K==="can"?f:!f){b=g.content,k=!0;break}}}if(!k&&I.length>0){let v=I[I.length-1];if(v.isFinalElse)b=v.content}}Y=Y.substring(0,j)+b+Y.substring(L+`@${W}`.length),q=!0}}return Y}function h3($,Z,Y){let J=$;function X(Q,G,K,W,z){let q=!0;while(q){q=!1;let U=new RegExp(`@${G}\\s*\\(`),j=Q.match(U);if(!j||j.index===void 0)break;let _=j.index,B=w1(Q,_+`@${G}`.length);if(!B)break;let H=B.endPos,L=g1(Q,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let V=Q.slice(H,L),O=B.expression,F=-1,w=0,A=0;while(A<V.length){let R=V.indexOf("@",A);if(R===-1)break;let N=V.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,A=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=W(O.trim()),N;if(F!==-1){let M=V.slice(0,F),T=V.slice(F+5);N=R?M:T}else N=R?V:"";Q=Q.substring(0,_)+N+Q.substring(L+`@${K}`.length),q=!0}catch(R){let N=R instanceof Error?R.message:String(R),M=e(z,`Error processing @${G} directive: ${N}`,s.EVALUATION_ERROR);Q=Q.substring(0,_)+M+Q.substring(L+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=N1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=N1(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"),J}function d3($,Z,Y){let J=$,X="development";function Q(G,K,W,z){let q=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${W}(?![a-z])`),B=G,H=!0;while(H){H=!1,q.lastIndex=0;let L=q.exec(B);if(!L)break;let V=L.index,O=V+L[0].length;if(K==="env"){let D=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,z=X===D[2]}let F=1,w=O,A=-1;while(F>0&&w<B.length){q.lastIndex=w,U.lastIndex=w;let D=q.exec(B),y=U.exec(B),b=D?D.index:1/0,k=y?y.index:1/0;if(b<k)F++,w=b+D[0].length;else if(k<1/0){if(F--,F===0){A=k;break}w=k+y[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${V} has no matching @${W} \u2014 the block was skipped.`);break}let R=B.substring(O,A),N=-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(_.test(y)){M--,T=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(y)){N=D;break}T=D+1}let I;if(N!==-1){let D=R.slice(0,N),y=R.slice(N+5);I=z?D:y}else I=z?R:"";let E=`@${W}`.length;B=B.substring(0,V)+I+B.substring(A+E),H=!0}return B}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",X==="production"),J=Q(J,"development","enddevelopment",X==="development"),J=Q(J,"staging","endstaging",X==="staging"),J=Q(J,"testing","endtesting",X==="testing"),J}var x4=S(()=>{y2();W1();C$();w0()});function v2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function f4($,Z){if(!$)return Z?.nonceGenerator?.()??v2();let Y=C2.get($);if(!Y)Y=Z?.nonceGenerator?.()??v2(),C2.set($,Y);return Y}function $q($,Z){let Y=[];for(let[J,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)Y.push(J);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${J} ${Q.join(" ")}`)}}return Y.join("; ")}function x2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${$q($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function f2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?f4(Y,Z):void 0,X=x2(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
9129
- ${X}`)}function g2($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<script nonce="${Z}"${X}>`}),Y=Y.replace(/<style([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<style nonce="${Z}"${X}>`}),Y}function h2($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?f4(Z,Q):void 0;return x2(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return f4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=f4(Z,Q);return X}var C2;var d2=S(()=>{C2=new WeakMap});import Zq from"crypto";function Jq($=Yq){let Z=Zq.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return u3=Z,Z}function Xq(){if(!u3)Jq();return u3}function Qq($=u2){let Z=Xq();return`<input type="hidden" name="${$}" value="${Z}">`}function m2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return Qq(J||u2)})}var Yq=40,u2="_token",u3=null;var p2=()=>{};async function l2($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let X=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)X=await Gq(X,Q,Z,Y,J);else X=await Kq(X,Q,Z,Y,J)}return X}async function Gq($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,z=$,q=G5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),U=[],j=q.exec(z);while(j!==null){let[_,B="",H=""]=j,L=j.index||0;try{let V=B?c2(B):[],O=H.trim(),F=await G(O,V,Y,J);U.push({original:_,processed:F,startIndex:L})}catch(V){let O=V instanceof Error?V.message:String(V);if(X.debug)console.error(`Error processing custom directive @${Q}:`,V);U.push({original:_,processed:e("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:L})}j=q.exec(z)}for(let _=U.length-1;_>=0;_--){let{original:B,processed:H}=U[_];z=z.replace(B,H)}return z}async function Kq($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,W=G5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),z=[],q=W.exec(K);while(q!==null){let[_,B=""]=q,H=q.index||0;try{let L=c2(B),V=await G("",L,Y,J);z.push({original:_,processed:V,startIndex:H})}catch(L){let V=L instanceof Error?L.message:String(L);if(X.debug)console.error(`Error processing custom directive @${Q}:`,L);z.push({original:_,processed:e("CustomDirective",`Error in @${Q}(${B}): ${V}`,s.EVALUATION_ERROR),startIndex:H})}q=W.exec(K)}let U=G5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=U.exec(K);while(j!==null){let[_]=j,B=j.index||0;try{let H=await G("",[],Y,J);z.push({original:_,processed:H,startIndex:B})}catch(H){let L=H instanceof Error?H.message:String(H);if(X.debug)console.error(`Error processing custom directive @${Q}:`,H);z.push({original:_,processed:e("CustomDirective",`Error in @${Q}: ${L}`,s.EVALUATION_ERROR),startIndex:B})}j=U.exec(K)}for(let _=z.length-1;_>=0;_--){let{original:B,processed:H}=z[_];K=K.replace(B,H)}return K}function c2($){if(!$.trim())return[];let Z=[],Y="",J=!1,X="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,X=G;else if(G===X)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var i2=S(()=>{W1();K5()});function n1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function zq($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,J=Z.colorMode;if(n1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(n1(Y.key,"appearance.key"),n1(Y.attribute,"appearance.attribute"),n1(Y.default,"appearance.default"),n1(J.key,"colorMode.key"),n1(J.attribute,"colorMode.attribute"),n1(J.default,"colorMode.default"),!o2.test(Y.key)||!o2.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!n2.test(Y.attribute)||!n2.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((X)=>typeof X!=="string"||X.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!Wq.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function qq($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Uq($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${qq($)};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 jq($,Z){let Y=1,J=null,X=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(X){X=!1;continue}if(J){if(G==="\\")X=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function s2($,Z){let Y=$,J=/@appearanceBootstrap\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index+X[0].length-1,G=jq(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),W=$0(`(${K})`,Z),z=Uq(zq(W));Y=Y.slice(0,X.index)+z+Y.slice(G+1),J.lastIndex=X.index+z.length}return Y}var n2,o2,Wq;var r2=S(()=>{w0();n2=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,o2=/^[A-Za-z_$][\w$]*$/,Wq=new Set(["light","dark","system"])});import _q from"crypto";function I0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function g4($,Z,Y,J){let X=$||Z;return Y?`${X} ${J}`:X}function Bq(){return _q.randomUUID()}function h4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=Bq();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${I0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,X)=>{let Q=X.toUpperCase();if(X&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${I0(Q)}">`;return J}),Y}function e2($,Z,Y=t2){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,W,z="")=>{let q=Q||G||"POST",U=K||W||"",j=M1(z),_=q.toUpperCase(),B=["GET","POST"].includes(_)?_:"POST",H=`<form method="${I0(B)}" action="${I0(U)}"${j?` ${j}`:""}>`;if(H+=`
9130
- ${h4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
9131
- ${h4(`@method('${_}')`,Z)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,z="")=>{let q=Q||G||"",U=K||W||"",j=M1(z),_=G$(q,Z),B=_!==void 0&&_!==null?_:U||"",H=j.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",V=K$(q,Z),O=j.match(/class=['"]([^'"]+)['"]/i),F=g4(O?O[1]:"",Y.input,V,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${I0(L)}" name="${I0(q)}" value="${I0(B)}" class="${F}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=M1(G),z=G$(Q,Z)||K.trim(),q=K$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=g4(U?U[1]:"",Y.input,q,Y.inputError),_=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${I0(Q)}" class="${j}"${_?` ${_}`:""}>${I0(z)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=M1(G),z=G$(Q,Z),q=K$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=g4(U?U[1]:"",Y.input,q,Y.inputError),_=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(z!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,V)=>{if((Array.isArray(z)?z.some((F)=>String(F)===V):String(z)===V)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${I0(Q)}" class="${j}"${_?` ${_}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="1",K="")=>{let W=M1(K),z=G$(Q,Z),q=z!==void 0&&(Array.isArray(z)?z.some((B)=>String(B)===G):z===!0||String(z)===G),U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${I0(Q)}" value="${I0(G)}" class="${j}"${q?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=M1(K),z=G$(Q,Z),q=z!==void 0&&z===G,U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${I0(Q)}" value="${I0(G)}" class="${j}"${q?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=M1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),z=W?W[1]:"",q=K.includes("multiple"),U=K$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),_=g4(j?j[1]:"",Y.input,U,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${I0(Q)}"`,`class="${_}"`];if(z)H.push(`accept="${I0(z)}"`);if(q)H.push("multiple");if(B)H.push(B);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=M1(G),z=W.match(/class=['"]([^'"]+)['"]/i),q=z?z[1]:Y.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${I0(Q)}" class="${q}"${U?` ${U}`:""}>${K}</label>`}),J}function $Y($,Z,Y=t2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(K$(X,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return a2(X,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return a2(X,Z)}let W=K.trim();if(K0(W)){let z=$0(W,Z);return z!==void 0?String(z):W}return W}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function K$($,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 a2($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function G$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function M1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=J.exec(Y))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var t2;var ZY=S(()=>{w0();t2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import l3 from"path";async function Hq(){if(W$!==void 0)return W$;try{W$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{W$=null}return W$}function Oq($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function Lq($,Z){if({...n3,...Z.i18n}.cache&&c3[$]){let X=c3[$],Q=Z.i18n?.cacheMaxAge??0;if(!Oq(X,Q))return X.translations}if(z$[$]?.state==="loading")return z$[$].promise;m3[$]="loading";let J=i3($,Z).then((X)=>{return m3[$]="loaded",delete z$[$],X}).catch((X)=>{throw m3[$]="error",z$[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return z$[$]={promise:J,state:"loading"},J}async function i3($,Z){let Y={...n3,...Z.i18n},J=l3.isAbsolute(Y.translationsDir)?Y.translationsDir:l3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await Hq(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:Rq(Y.format)}):await Fq($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return i3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)c3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(X){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,X);if($!==Y.defaultLocale)return i3(Y.defaultLocale,Z);return{}}}async function Fq($,Z,Y){let J=l3.join(Y,`${$}${Vq(Z.format)}`);try{let X=await import(J);return X.default||X}catch(X){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return wq(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function Vq($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function wq($){let Z={},Y=$.split(`
9132
- `),J=[{obj:Z,indent:-1}];for(let X of Y){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,z,q]=W,U=z.trim(),j=q.trim();if(j==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=Aq(j)}}return Z}function Aq($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function Rq($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function Nq($,Z){return Lq($,Z)}function Mq($,Z){for(let Y of $){let J=Y.trim(),X=J.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=J.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 Tq($,Z={}){return XY($,Z)}function XY($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=Iq($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=Dq(Q,Z),J=X+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function Iq($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function Dq($,Z){let Y=Eq($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),X=Z[J];if(Y.length===1)return X!==void 0?String(X):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return kq(X,Y.slice(2).join(","),Z);case"select":return Sq(X,Y.slice(2).join(","));case"selectordinal":return yq(X,Y.slice(2).join(","));case"number":return Cq(X,Y[2]?.trim());case"date":return vq(X,Y[2]?.trim());case"time":return xq(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function Eq($){let Z=[],Y="",J=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")J++,Y+=Q;else if(Q==="}")J--,Y+=Q;else if(Q===","&&J===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function kq($,Z,Y){let J=Number($)||0,X=o3(Z),Q=`=${J}`;if(X[Q])return p3(X[Q],J,Y);let G=bq(J);if(X[G])return p3(X[G],J,Y);if(X.other)return p3(X.other,J,Y);return String(J)}function p3($,Z,Y){let J=$.replace(/#/g,String(Z));return XY(J,Y)}function bq($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function Sq($,Z){let Y=String($||""),J=o3(Z);if(J[Y])return J[Y];return J.other||String($)}function yq($,Z){let Y=Number($)||0,J=o3(Z),X=Pq(Y);if(J[X])return J[X].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function Pq($){let Z=Math.abs($),Y=Z%10,J=Z%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function o3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function Cq($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function vq($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function xq($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function fq($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function YY($,Z,Y=!0,J={}){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 Y?$:"";let G=String(Q);if(fq(G))return Tq(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),W=G.split("|");G=Mq(W,K)}for(let[K,W]of Object.entries(J)){let z=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${z}`,"g"),String(W))}return G}async function QY($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...n3,...J.i18n},K=await Nq(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await JY(X,Q,async(q,U,j,_,B)=>{try{let H={};if(j)try{let V=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return T0(j,Z)}];for(let O of V)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(V){if(J.debug)console.error("Error parsing parameters for @translate directive:",V)}return YY(U,K,G.fallbackToKey,H)||_.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return e("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let q=[...X.matchAll(W)];console.warn(`Found ${q.length} @translate matches`),q.forEach((U,j)=>console.warn(`Match ${j}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return X=await JY(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(q,U,j,_)=>{try{let B={};if(j)try{let H=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return T0(j,Z)}];for(let L of H)try{if(B=L(),Object.keys(B).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return YY(U,K,G.fallbackToKey,B)}catch(B){if(J.debug)console.error("Error processing @translate directive:",B);return e("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR)}}),X}async function JY($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var W$,n3,c3,z$,m3;var GY=S(()=>{W1();w0();n3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},c3={},z$={},m3={}});var a3={};a(a3,{streamingSuspenseDirective:()=>zY,streamToResponse:()=>sq,streamTemplateSimple:()=>cq,streamTemplate:()=>hq,renderStreamingPage:()=>uq,registerStreamingDirectives:()=>nq,processStreamDirectives:()=>pq,processSectionDirectives:()=>oq,islandDirective:()=>qY,generateHydrationRuntime:()=>rq,extractStreamBoundaries:()=>lq,createStreamRenderer:()=>iq,buildSuspenseResolveScript:()=>r3,SUSPENSE_RESOLVER_RUNTIME:()=>WY});import d4 from"path";function gq($){let Z=[],Y=0,J;KY.lastIndex=0;while((J=KY.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let X=J[1],Q=J[2];Z.push({type:"suspense",name:X,content:Q}),Y=J.index+J[0].length}if(Y<$.length){let X=$.slice(Y);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 hq($,Z={},Y={}){let J={...l1,...Y,streaming:{...s3,...Y.streaming}},X=J.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]:"",z=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q={...Z,__filename:$,__dirname:d4.dirname($)};if(W.trim())await f1(W,q,$);let U=gq(z),j=new Set;if(!U.some((B)=>B.type==="suspense")){let B=J.streaming?.strategy||"auto",H=new RegExp(o1.source,"g");if(!(B!=="manual"&&H.test(z))){let V=await O0(z,q,$,J,j);for(let O=0;O<V.length;O+=X)Q.enqueue(V.slice(O,O+X)),await new Promise((F)=>setTimeout(F,0))}else{let V=[],O=new RegExp(o1.source,"g"),F;while((F=O.exec(z))!==null)V.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let w=0;for(let A of V){if(A.start>w){let N=z.slice(w,A.start);if(N.trim()){let M=await O0(N,q,$,J,j);Q.enqueue(M),await new Promise((T)=>setTimeout(T,0))}}let R=await O0(A.content,q,$,J,j);Q.enqueue(R),await new Promise((N)=>setTimeout(N,0)),w=A.end}if(w<z.length){let A=z.slice(w);if(A.trim()){let R=await O0(A,q,$,J,j);Q.enqueue(R)}}}}else{let B=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let V=await O0(L.content,q,$,J,j);Q.enqueue(V)}else if(L.type==="suspense"&&L.name){let V=`stx-suspense-${L.name}`;Q.enqueue(`<div id="${V}" data-suspense="${L.name}" style="display:contents;">
9127
+ </script>`}function b2($,Z,Y){if(k2=0,!rz($))return $;let J=pz($);if(J.length===0)return $;let X=sz($,J),Q=oz(J,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
9128
+ `+X.slice(G);else X+=Q;return X}function sz($,Z){let Y=$;for(let J of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${x4(J.stateExpr)}["']`,"gi").exec(Y);if(Q)J.id=Q[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${x4(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)J.id=K[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${x4(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${x4(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function rz($){return/x-data\s*=\s*["']/.test($)}var k2=0,mz=0;var S2=S(()=>{J1()});import az from"fs";import f3 from"path";import{createHighlighter as tz}from"ts-syntax-highlighter";async function ez($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let J=(await az.promises.stat($)).mtime.getTime();if(Z.cache&&g3.has($)){let U=g3.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=H9(X),K=Z.markdown||S3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},z=C5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)z=await $q(z,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let q={content:z,data:Q||{}};if(Z.cache)g3.set($,{...q,updatedAt:J});return q}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:q0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function $q($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!f4)try{f4=await tz({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,z,q)=>{let U=q.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=z||(Y?"text":"");if(!j)return K;try{if(!f4.getSupportedLanguages().includes(j))return K;return(await f4.highlight(U,j,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${z}:`,_)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[W,z,q,U]=K,j=await X(W,z,q,U);Q=Q.replace(W,j)}return Q}async function y2($,Z,Y="",J={}){return await Zq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,z)=>{try{let q=K;if(!f3.isAbsolute(K))q=f3.resolve(f3.dirname(Y),K);let U={};if(W)try{try{U=JSON.parse(W)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let w=F.indexOf(":");if(w>0){let A=F.substring(0,w).trim(),R=F.substring(w+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),M=R.startsWith("'")&&R.endsWith("'");if(N||M)R=R.substring(1,R.length-1);U[A]=R}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:j,data:_}=await ez(q,J),B={...Z,..._,...U},H=j,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(V,O)=>{let F=O.trim();return B[F]!==void 0?String(B[F]):V}),H}catch(q){let U=q instanceof Error?q.message:String(q);return q0("Markdown File",`Error including markdown file: ${U}`,Y,$,z,G)}})}async function Zq($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,z=X;J.push(Y(...z).then((q)=>({match:K,replacement:q,index:W})))}let Q=await Promise.all(J);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 g3,f4=null;var P2=S(()=>{i1();M0();g3=new Map});function M1($,Z){try{let Y=$.trim();if(K0(Y))return W0(Y,Object.keys(Z))(...Object.values(Z));else return $0(Y,Z)}catch{return!1}}var C2=S(()=>{w0()});function Yq($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=E7(J,G);if(!K)break;try{let W;if(K0(K.expression))W=W0(K.expression,Object.keys(Z))(...Object.values(Z));else W=$0(K.expression,Z);let z="",q=!1;for(let U of K.cases)if(U.type==="default"){if(!q)z=U.content.trim()}else try{let j;if(U.value&&K0(U.value))j=W0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=$0(U.value,Z);if(W===j){z=U.content.trim(),q=!0;break}}catch{continue}J=J.substring(0,G)+z+J.substring(K.end),X=!0}catch(W){let z=W instanceof Error?W.message:String(W),q=e("Switch",`Error evaluating @switch expression: ${z}`,s.EVALUATION_ERROR);J=J.substring(0,G)+q+J.substring(K.end);break}}return J}function n1($,Z,Y){let J=$;J=Yq(J,Z,Y);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=A1(J,K+7);if(!W)break;let z=W.endPos,q=h1(J,"unless","endunless",z);if(q===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=J.slice(z,q),j=W.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],w;while((w=L.exec(U))!==null)F.push({pos:w.index,type:"open"});while((w=V.exec(U))!==null)F.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)F.push({pos:w.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let B;if(_!==-1){let H=U.slice(0,_),L=U.slice(_+5);B=`@if (${j})${L}@else ${H}@endif`}else B=`@if (!(${j}))${U}@endif`;J=J.substring(0,K)+B+J.substring(q+10),Q=!0}}J=d3(J,Z,Y),J=u3(J,Z,Y),J=h3(J,Z);let X=()=>{let Q=r5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",z=!1;for(let q of K.branches){if(z)break;if(q.type==="else")W=q.content,z=!0;else try{let U;if(q.condition&&K0(q.condition))U=W0(q.condition,Object.keys(Z))(...Object.values(Z));else if(q.condition)U=$0(q.condition,Z);if(U)W=q.content,z=!0}catch(U){W=e(q.type==="if"?"If":"Elseif",`Error in @${q.type}(${q.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),z=!0}}J=J.substring(0,K.start)+W+J.substring(K.end)}catch(W){let z=W instanceof Error?W.message:String(W),q=e("If",`Error processing @if block: ${z}`,s.EVALUATION_ERROR);J=J.substring(0,K.start)+q+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function v2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(X===Y){Z++;break}J.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function h3($,Z){let Y=$;function J(K,W,z,q){let U=1,j=q,_=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${z}(?![a-z])`,"g");while(j<K.length&&U>0){_.lastIndex=j,B.lastIndex=j;let H=_.exec(K),L=B.exec(K),V=H?H.index:1/0,O=L?L.index:1/0;if(V<O)U++,j=V+H[0].length;else if(O<1/0){if(U--,U===0)return O;j=O+L[0].length}else break}return-1}function X(K,W,z){let q=0,U=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${z}(?![a-z])`,"g"),_=/@else(?![a-z])/g,B=[],H;while((H=U.exec(K))!==null)B.push({pos:H.index,type:"open"});while((H=j.exec(K))!==null)B.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)B.push({pos:H.index,type:"else"});B.sort((L,V)=>L.pos-V.pos);for(let L of B)if(L.type==="open")q++;else if(L.type==="close")q--;else if(L.type==="else"&&q===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let z=W.index,q,U,j=Y.slice(z+5),_=v2(j);if(_)q=_.value,U=z+5+_.consumed;else U=z+5;let B=J(Y,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${z} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,B),L=X(H,"auth","endauth"),V;if(!Z.auth)V=!1;else V=q?M1(`auth?.check && auth?.user?.[${q}]`,Z):M1("auth?.check",Z);let O;if(L!==-1){let F=H.slice(0,L),w=H.slice(L+5);O=V?F:w}else O=V?H:"";Y=Y.substring(0,z)+O+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let z=W.index,q,U,j=Y.slice(z+6),_=v2(j);if(_)q=_.value,U=z+6+_.consumed;else U=z+6;let B=J(Y,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${z} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,B),L=X(H,"guest","endguest"),V;if(!Z.auth)V=!0;else V=q?M1(`!auth?.check || !auth?.user?.[${q}]`,Z):M1("!auth?.check",Z);let O;if(L!==-1){let F=H.slice(0,L),w=H.slice(L+5);O=V?F:w}else O=V?H:"";Y=Y.substring(0,z)+O+Y.substring(B+9),K=!0}}function Q(K,W,z){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let q=[K];if(W)q.push(W);if(z){let U=M1(z,Z);q.push(U)}return Z.permissions.check(...q)}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}`,z=K==="can"?"elsecan":"elsecannot",q=!0;while(q){q=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,_=Y.slice(j+`@${K}`.length),B=G(_);if(!B)break;let H=j+`@${K}`.length+B.paramsEnd,L=J(Y,K,W,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let V=Y.slice(H,L),O=[],F=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${W}(?![a-z])`,"g"),R=new RegExp(`@${z}\\s*\\(`,"g"),N=/@else(?![a-z])/g,M=[],T;while((T=w.exec(V))!==null)M.push({pos:T.index,type:"open"});while((T=A.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=N.exec(V))!==null)M.push({pos:T.index,type:"else"});M.sort((k,v)=>k.pos-v.pos);for(let k of M){if(k.type==="open"){F++;continue}if(k.type==="close"){F--;continue}if(F===0)O.push(k)}let I=[],E=0;for(let k=0;k<O.length;k++){let v=O[k];if(I.push({content:V.slice(E,v.pos),ability:void 0}),v.type==="elseDirective"){let g=V.slice(v.pos+`@${z}`.length),f=G(g);if(f){I[I.length-1]={content:V.slice(E,v.pos)},E=v.pos+`@${z}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let d=O[k+1],p=d?d.pos:V.length;I.push({content:V.slice(E,p),ability:f.ability,type:f.type,id:f.id}),E=p}}else E=v.pos+5}if(E<V.length){let k=I[I.length-1];if(O.length>0&&O[O.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,b="";if(y)b=I[0]?.content||"";else{let k=!1;for(let v=1;v<I.length;v++){let g=I[v];if(g.isFinalElse){b=g.content,k=!0;break}if(g.ability){let f=Q(g.ability,g.type,g.id);if(K==="can"?f:!f){b=g.content,k=!0;break}}}if(!k&&I.length>0){let v=I[I.length-1];if(v.isFinalElse)b=v.content}}Y=Y.substring(0,j)+b+Y.substring(L+`@${W}`.length),q=!0}}return Y}function d3($,Z,Y){let J=$;function X(Q,G,K,W,z){let q=!0;while(q){q=!1;let U=new RegExp(`@${G}\\s*\\(`),j=Q.match(U);if(!j||j.index===void 0)break;let _=j.index,B=A1(Q,_+`@${G}`.length);if(!B)break;let H=B.endPos,L=h1(Q,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let V=Q.slice(H,L),O=B.expression,F=-1,w=0,A=0;while(A<V.length){let R=V.indexOf("@",A);if(R===-1)break;let N=V.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,A=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=W(O.trim()),N;if(F!==-1){let M=V.slice(0,F),T=V.slice(F+5);N=R?M:T}else N=R?V:"";Q=Q.substring(0,_)+N+Q.substring(L+`@${K}`.length),q=!0}catch(R){let N=R instanceof Error?R.message:String(R),M=e(z,`Error processing @${G} directive: ${N}`,s.EVALUATION_ERROR);Q=Q.substring(0,_)+M+Q.substring(L+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=M1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=M1(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"),J}function u3($,Z,Y){let J=$,X="development";function Q(G,K,W,z){let q=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${W}(?![a-z])`),B=G,H=!0;while(H){H=!1,q.lastIndex=0;let L=q.exec(B);if(!L)break;let V=L.index,O=V+L[0].length;if(K==="env"){let D=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,z=X===D[2]}let F=1,w=O,A=-1;while(F>0&&w<B.length){q.lastIndex=w,U.lastIndex=w;let D=q.exec(B),y=U.exec(B),b=D?D.index:1/0,k=y?y.index:1/0;if(b<k)F++,w=b+D[0].length;else if(k<1/0){if(F--,F===0){A=k;break}w=k+y[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${V} has no matching @${W} \u2014 the block was skipped.`);break}let R=B.substring(O,A),N=-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(_.test(y)){M--,T=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(y)){N=D;break}T=D+1}let I;if(N!==-1){let D=R.slice(0,N),y=R.slice(N+5);I=z?D:y}else I=z?R:"";let E=`@${W}`.length;B=B.substring(0,V)+I+B.substring(A+E),H=!0}return B}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",X==="production"),J=Q(J,"development","enddevelopment",X==="development"),J=Q(J,"staging","endstaging",X==="staging"),J=Q(J,"testing","endtesting",X==="testing"),J}var g4=S(()=>{C2();z1();v$();w0()});function f2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function h4($,Z){if(!$)return Z?.nonceGenerator?.()??f2();let Y=x2.get($);if(!Y)Y=Z?.nonceGenerator?.()??f2(),x2.set($,Y);return Y}function Jq($,Z){let Y=[];for(let[J,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)Y.push(J);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${J} ${Q.join(" ")}`)}}return Y.join("; ")}function g2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Jq($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function h2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?h4(Y,Z):void 0,X=g2(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
9129
+ ${X}`)}function d2($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<script nonce="${Z}"${X}>`}),Y=Y.replace(/<style([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<style nonce="${Z}"${X}>`}),Y}function u2($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?h4(Z,Q):void 0;return g2(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return h4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=h4(Z,Q);return X}var x2;var m2=S(()=>{x2=new WeakMap});import Xq from"crypto";function Gq($=Qq){let Z=Xq.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return m3=Z,Z}function Kq(){if(!m3)Gq();return m3}function Wq($=p2){let Z=Kq();return`<input type="hidden" name="${$}" value="${Z}">`}function l2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return Wq(J||p2)})}var Qq=40,p2="_token",m3=null;var c2=()=>{};async function i2($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let X=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)X=await zq(X,Q,Z,Y,J);else X=await qq(X,Q,Z,Y,J)}return X}async function zq($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,z=$,q=K5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),U=[],j=q.exec(z);while(j!==null){let[_,B="",H=""]=j,L=j.index||0;try{let V=B?n2(B):[],O=H.trim(),F=await G(O,V,Y,J);U.push({original:_,processed:F,startIndex:L})}catch(V){let O=V instanceof Error?V.message:String(V);if(X.debug)console.error(`Error processing custom directive @${Q}:`,V);U.push({original:_,processed:e("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:L})}j=q.exec(z)}for(let _=U.length-1;_>=0;_--){let{original:B,processed:H}=U[_];z=z.replace(B,H)}return z}async function qq($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,W=K5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),z=[],q=W.exec(K);while(q!==null){let[_,B=""]=q,H=q.index||0;try{let L=n2(B),V=await G("",L,Y,J);z.push({original:_,processed:V,startIndex:H})}catch(L){let V=L instanceof Error?L.message:String(L);if(X.debug)console.error(`Error processing custom directive @${Q}:`,L);z.push({original:_,processed:e("CustomDirective",`Error in @${Q}(${B}): ${V}`,s.EVALUATION_ERROR),startIndex:H})}q=W.exec(K)}let U=K5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=U.exec(K);while(j!==null){let[_]=j,B=j.index||0;try{let H=await G("",[],Y,J);z.push({original:_,processed:H,startIndex:B})}catch(H){let L=H instanceof Error?H.message:String(H);if(X.debug)console.error(`Error processing custom directive @${Q}:`,H);z.push({original:_,processed:e("CustomDirective",`Error in @${Q}: ${L}`,s.EVALUATION_ERROR),startIndex:B})}j=U.exec(K)}for(let _=z.length-1;_>=0;_--){let{original:B,processed:H}=z[_];K=K.replace(B,H)}return K}function n2($){if(!$.trim())return[];let Z=[],Y="",J=!1,X="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,X=G;else if(G===X)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var o2=S(()=>{z1();W5()});function o1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function jq($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,J=Z.colorMode;if(o1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(o1(Y.key,"appearance.key"),o1(Y.attribute,"appearance.attribute"),o1(Y.default,"appearance.default"),o1(J.key,"colorMode.key"),o1(J.attribute,"colorMode.attribute"),o1(J.default,"colorMode.default"),!r2.test(Y.key)||!r2.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!s2.test(Y.attribute)||!s2.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((X)=>typeof X!=="string"||X.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!Uq.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function _q($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Bq($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${_q($)};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 Hq($,Z){let Y=1,J=null,X=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(X){X=!1;continue}if(J){if(G==="\\")X=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function a2($,Z){let Y=$,J=/@appearanceBootstrap\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index+X[0].length-1,G=Hq(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),W=$0(`(${K})`,Z),z=Bq(jq(W));Y=Y.slice(0,X.index)+z+Y.slice(G+1),J.lastIndex=X.index+z.length}return Y}var s2,r2,Uq;var t2=S(()=>{w0();s2=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,r2=/^[A-Za-z_$][\w$]*$/,Uq=new Set(["light","dark","system"])});import Oq from"crypto";function I0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function d4($,Z,Y,J){let X=$||Z;return Y?`${X} ${J}`:X}function Lq(){return Oq.randomUUID()}function u4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=Lq();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${I0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,X)=>{let Q=X.toUpperCase();if(X&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${I0(Q)}">`;return J}),Y}function ZY($,Z,Y=$Y){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,W,z="")=>{let q=Q||G||"POST",U=K||W||"",j=T1(z),_=q.toUpperCase(),B=["GET","POST"].includes(_)?_:"POST",H=`<form method="${I0(B)}" action="${I0(U)}"${j?` ${j}`:""}>`;if(H+=`
9130
+ ${u4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
9131
+ ${u4(`@method('${_}')`,Z)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,z="")=>{let q=Q||G||"",U=K||W||"",j=T1(z),_=K$(q,Z),B=_!==void 0&&_!==null?_:U||"",H=j.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",V=W$(q,Z),O=j.match(/class=['"]([^'"]+)['"]/i),F=d4(O?O[1]:"",Y.input,V,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${I0(L)}" name="${I0(q)}" value="${I0(B)}" class="${F}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=T1(G),z=K$(Q,Z)||K.trim(),q=W$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=d4(U?U[1]:"",Y.input,q,Y.inputError),_=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${I0(Q)}" class="${j}"${_?` ${_}`:""}>${I0(z)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=T1(G),z=K$(Q,Z),q=W$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=d4(U?U[1]:"",Y.input,q,Y.inputError),_=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(z!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,V)=>{if((Array.isArray(z)?z.some((F)=>String(F)===V):String(z)===V)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${I0(Q)}" class="${j}"${_?` ${_}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="1",K="")=>{let W=T1(K),z=K$(Q,Z),q=z!==void 0&&(Array.isArray(z)?z.some((B)=>String(B)===G):z===!0||String(z)===G),U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${I0(Q)}" value="${I0(G)}" class="${j}"${q?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=T1(K),z=K$(Q,Z),q=z!==void 0&&z===G,U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${I0(Q)}" value="${I0(G)}" class="${j}"${q?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=T1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),z=W?W[1]:"",q=K.includes("multiple"),U=W$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),_=d4(j?j[1]:"",Y.input,U,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${I0(Q)}"`,`class="${_}"`];if(z)H.push(`accept="${I0(z)}"`);if(q)H.push("multiple");if(B)H.push(B);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=T1(G),z=W.match(/class=['"]([^'"]+)['"]/i),q=z?z[1]:Y.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${I0(Q)}" class="${q}"${U?` ${U}`:""}>${K}</label>`}),J}function YY($,Z,Y=$Y){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(W$(X,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return e2(X,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return e2(X,Z)}let W=K.trim();if(K0(W)){let z=$0(W,Z);return z!==void 0?String(z):W}return W}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function W$($,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 e2($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function K$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function T1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=J.exec(Y))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var $Y;var JY=S(()=>{w0();$Y={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import c3 from"path";async function Fq(){if(z$!==void 0)return z$;try{z$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{z$=null}return z$}function Vq($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function wq($,Z){if({...o3,...Z.i18n}.cache&&i3[$]){let X=i3[$],Q=Z.i18n?.cacheMaxAge??0;if(!Vq(X,Q))return X.translations}if(q$[$]?.state==="loading")return q$[$].promise;p3[$]="loading";let J=n3($,Z).then((X)=>{return p3[$]="loaded",delete q$[$],X}).catch((X)=>{throw p3[$]="error",q$[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return q$[$]={promise:J,state:"loading"},J}async function n3($,Z){let Y={...o3,...Z.i18n},J=c3.isAbsolute(Y.translationsDir)?Y.translationsDir:c3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await Fq(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:Tq(Y.format)}):await Aq($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return n3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)i3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(X){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,X);if($!==Y.defaultLocale)return n3(Y.defaultLocale,Z);return{}}}async function Aq($,Z,Y){let J=c3.join(Y,`${$}${Rq(Z.format)}`);try{let X=await import(J);return X.default||X}catch(X){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return Nq(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function Rq($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Nq($){let Z={},Y=$.split(`
9132
+ `),J=[{obj:Z,indent:-1}];for(let X of Y){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,z,q]=W,U=z.trim(),j=q.trim();if(j==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=Mq(j)}}return Z}function Mq($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function Tq($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function Iq($,Z){return wq($,Z)}function Dq($,Z){for(let Y of $){let J=Y.trim(),X=J.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=J.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 Eq($,Z={}){return GY($,Z)}function GY($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=kq($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=bq(Q,Z),J=X+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function kq($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function bq($,Z){let Y=Sq($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),X=Z[J];if(Y.length===1)return X!==void 0?String(X):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return yq(X,Y.slice(2).join(","),Z);case"select":return Cq(X,Y.slice(2).join(","));case"selectordinal":return vq(X,Y.slice(2).join(","));case"number":return fq(X,Y[2]?.trim());case"date":return gq(X,Y[2]?.trim());case"time":return hq(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function Sq($){let Z=[],Y="",J=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")J++,Y+=Q;else if(Q==="}")J--,Y+=Q;else if(Q===","&&J===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function yq($,Z,Y){let J=Number($)||0,X=s3(Z),Q=`=${J}`;if(X[Q])return l3(X[Q],J,Y);let G=Pq(J);if(X[G])return l3(X[G],J,Y);if(X.other)return l3(X.other,J,Y);return String(J)}function l3($,Z,Y){let J=$.replace(/#/g,String(Z));return GY(J,Y)}function Pq($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function Cq($,Z){let Y=String($||""),J=s3(Z);if(J[Y])return J[Y];return J.other||String($)}function vq($,Z){let Y=Number($)||0,J=s3(Z),X=xq(Y);if(J[X])return J[X].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function xq($){let Z=Math.abs($),Y=Z%10,J=Z%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function s3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function fq($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function gq($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function hq($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function dq($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function XY($,Z,Y=!0,J={}){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 Y?$:"";let G=String(Q);if(dq(G))return Eq(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),W=G.split("|");G=Dq(W,K)}for(let[K,W]of Object.entries(J)){let z=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${z}`,"g"),String(W))}return G}async function KY($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...o3,...J.i18n},K=await Iq(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await QY(X,Q,async(q,U,j,_,B)=>{try{let H={};if(j)try{let V=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return T0(j,Z)}];for(let O of V)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(V){if(J.debug)console.error("Error parsing parameters for @translate directive:",V)}return XY(U,K,G.fallbackToKey,H)||_.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return e("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let q=[...X.matchAll(W)];console.warn(`Found ${q.length} @translate matches`),q.forEach((U,j)=>console.warn(`Match ${j}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return X=await QY(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(q,U,j,_)=>{try{let B={};if(j)try{let H=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return T0(j,Z)}];for(let L of H)try{if(B=L(),Object.keys(B).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return XY(U,K,G.fallbackToKey,B)}catch(B){if(J.debug)console.error("Error processing @translate directive:",B);return e("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR)}}),X}async function QY($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var z$,o3,i3,q$,p3;var WY=S(()=>{z1();w0();o3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},i3={},q$={},p3={}});var t3={};a(t3,{streamingSuspenseDirective:()=>UY,streamToResponse:()=>tq,streamTemplateSimple:()=>oq,streamTemplate:()=>mq,renderStreamingPage:()=>lq,registerStreamingDirectives:()=>rq,processStreamDirectives:()=>iq,processSectionDirectives:()=>aq,islandDirective:()=>jY,generateHydrationRuntime:()=>eq,extractStreamBoundaries:()=>nq,createStreamRenderer:()=>sq,buildSuspenseResolveScript:()=>a3,SUSPENSE_RESOLVER_RUNTIME:()=>qY});import m4 from"path";function uq($){let Z=[],Y=0,J;zY.lastIndex=0;while((J=zY.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let X=J[1],Q=J[2];Z.push({type:"suspense",name:X,content:Q}),Y=J.index+J[0].length}if(Y<$.length){let X=$.slice(Y);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 mq($,Z={},Y={}){let J={...c1,...Y,streaming:{...r3,...Y.streaming}},X=J.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]:"",z=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q={...Z,__filename:$,__dirname:m4.dirname($)};if(W.trim())await g1(W,q,$);let U=uq(z),j=new Set;if(!U.some((B)=>B.type==="suspense")){let B=J.streaming?.strategy||"auto",H=new RegExp(s1.source,"g");if(!(B!=="manual"&&H.test(z))){let V=await O0(z,q,$,J,j);for(let O=0;O<V.length;O+=X)Q.enqueue(V.slice(O,O+X)),await new Promise((F)=>setTimeout(F,0))}else{let V=[],O=new RegExp(s1.source,"g"),F;while((F=O.exec(z))!==null)V.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let w=0;for(let A of V){if(A.start>w){let N=z.slice(w,A.start);if(N.trim()){let M=await O0(N,q,$,J,j);Q.enqueue(M),await new Promise((T)=>setTimeout(T,0))}}let R=await O0(A.content,q,$,J,j);Q.enqueue(R),await new Promise((N)=>setTimeout(N,0)),w=A.end}if(w<z.length){let A=z.slice(w);if(A.trim()){let R=await O0(A,q,$,J,j);Q.enqueue(R)}}}}else{let B=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let V=await O0(L.content,q,$,J,j);Q.enqueue(V)}else if(L.type==="suspense"&&L.name){let V=`stx-suspense-${L.name}`;Q.enqueue(`<div id="${V}" data-suspense="${L.name}" style="display:contents;">
9133
9133
  <template data-suspense-fallback>Loading...</template>
9134
9134
  </div>`),B.set(L.name,O0(L.content,q,$,J,j))}Q.enqueue(`
9135
9135
  <script>
@@ -9147,13 +9147,13 @@ ${X}`)}function g2($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*
9147
9147
  }
9148
9148
  };
9149
9149
  })();
9150
- </script>`);let H=Array.from(B.entries()).map(async([L,V])=>{Q.enqueue(await r3(L,V))});await Promise.all(H)}Q.close()}catch(G){Q.error(G)}}})}async function r3($,Z){try{let J=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
9150
+ </script>`);let H=Array.from(B.entries()).map(async([L,V])=>{Q.enqueue(await a3(L,V))});await Promise.all(H)}Q.close()}catch(G){Q.error(G)}}})}async function a3($,Z){try{let J=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
9151
9151
  <script>
9152
9152
  window.__stxSuspense.resolve('${$}', \`${J}\`);
9153
9153
  </script>`}catch(Y){let J=Y instanceof Error?Y.message:String(Y);return`
9154
9154
  <script>
9155
9155
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${r0(J)}</div>');
9156
- </script>`}}function dq($,Z,Y){if(!Z||Z<=0)return $;let J,X=new Promise((Q,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(J))}function uq($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(WY),await Promise.all(Z.map(async(Q)=>{let G=dq(Q.render(),J,Q.id);X.enqueue(await r3(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function pq($,Z){return $.replace(mq,(Y,J,X)=>{let Q=J.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 lq($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,X])=>({id:J,render:X})):void 0}async function cq($,Z={},Y={}){let J={...l1,...Y,streaming:{...s3,...Y.streaming}},X=J.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]:"",z=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q={...Z,__filename:$,__dirname:d4.dirname($)};if(W.trim())await f1(W,q,$);let U=new Set,j=J.streaming?.strategy||"auto",_=new RegExp(o1.source,"g");if(!(j!=="manual"&&_.test(z))){let H=await O0(z,q,$,J,U);for(let L=0;L<H.length;L+=X)Q.enqueue(H.slice(L,L+X))}else{let H=[],L=new RegExp(o1.source,"g"),V;while((V=L.exec(z))!==null)H.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let O=0;for(let F of H){if(F.start>O){let A=z.slice(O,F.start);if(A.trim()){let R=await O0(A,q,$,J,U);Q.enqueue(R)}}let w=await O0(F.content,q,$,J,U);Q.enqueue(w),O=F.end}if(O<z.length){let F=z.slice(O);if(F.trim()){let w=await O0(F,q,$,J,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function iq($,Z={}){let Y={...l1,...Z,streaming:{...s3,...Z.streaming}},J=await Bun.file($).text(),X=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},z;o1.lastIndex=0;while((z=o1.exec(G))!==null){let j=z[1],_=z[2];W[j]=_}let q=G.replace(o1,"");return{renderShell:async(j={})=>{let _={...j,__filename:$,__dirname:d4.dirname($)};return await f1(Q,_,$),O0(q,_,$,Y,new Set)},renderSection:async(j,_={})=>{try{if(!W[j])return`<div class="error-message">Section "${r0(j)}" not found in template "${r0($)}"</div>`;let B={..._,__filename:$,__dirname:d4.dirname($)};await f1(Q,B,$);let H=new Set;return await O0(W[j],B,$,Y,H)}catch(B){let H=B instanceof Error?B.message:String(B);return q0("Expression",H,$,W[j]||"",0,W[j]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function nq($={}){let Z=[];if($.streaming?.enabled)Z.push(zY);if($.hydration?.enabled)Z.push(qY);return Z}async function oq($,Z,Y,J={}){return $}function sq($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.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(J,{...Z,headers:X})}function rq($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
9156
+ </script>`}}function pq($,Z,Y){if(!Z||Z<=0)return $;let J,X=new Promise((Q,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(J))}function lq($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(qY),await Promise.all(Z.map(async(Q)=>{let G=pq(Q.render(),J,Q.id);X.enqueue(await a3(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function iq($,Z){return $.replace(cq,(Y,J,X)=>{let Q=J.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 nq($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,X])=>({id:J,render:X})):void 0}async function oq($,Z={},Y={}){let J={...c1,...Y,streaming:{...r3,...Y.streaming}},X=J.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]:"",z=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q={...Z,__filename:$,__dirname:m4.dirname($)};if(W.trim())await g1(W,q,$);let U=new Set,j=J.streaming?.strategy||"auto",_=new RegExp(s1.source,"g");if(!(j!=="manual"&&_.test(z))){let H=await O0(z,q,$,J,U);for(let L=0;L<H.length;L+=X)Q.enqueue(H.slice(L,L+X))}else{let H=[],L=new RegExp(s1.source,"g"),V;while((V=L.exec(z))!==null)H.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let O=0;for(let F of H){if(F.start>O){let A=z.slice(O,F.start);if(A.trim()){let R=await O0(A,q,$,J,U);Q.enqueue(R)}}let w=await O0(F.content,q,$,J,U);Q.enqueue(w),O=F.end}if(O<z.length){let F=z.slice(O);if(F.trim()){let w=await O0(F,q,$,J,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function sq($,Z={}){let Y={...c1,...Z,streaming:{...r3,...Z.streaming}},J=await Bun.file($).text(),X=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},z;s1.lastIndex=0;while((z=s1.exec(G))!==null){let j=z[1],_=z[2];W[j]=_}let q=G.replace(s1,"");return{renderShell:async(j={})=>{let _={...j,__filename:$,__dirname:m4.dirname($)};return await g1(Q,_,$),O0(q,_,$,Y,new Set)},renderSection:async(j,_={})=>{try{if(!W[j])return`<div class="error-message">Section "${r0(j)}" not found in template "${r0($)}"</div>`;let B={..._,__filename:$,__dirname:m4.dirname($)};await g1(Q,B,$);let H=new Set;return await O0(W[j],B,$,Y,H)}catch(B){let H=B instanceof Error?B.message:String(B);return q0("Expression",H,$,W[j]||"",0,W[j]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function rq($={}){let Z=[];if($.streaming?.enabled)Z.push(UY);if($.hydration?.enabled)Z.push(jY);return Z}async function aq($,Z,Y,J={}){return $}function tq($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.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(J,{...Z,headers:X})}function eq($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
9157
9157
  `);if(Z==="loader")return`
9158
9158
  (function() {
9159
9159
  window.__stx = window.__stx || {};
@@ -9295,7 +9295,7 @@ else {
9295
9295
  else {
9296
9296
  stx.hydrate();
9297
9297
  }
9298
- })();`}var s3,o1,KY,WY=`
9298
+ })();`}var r3,s1,zY,qY=`
9299
9299
  <script>
9300
9300
  (function(){
9301
9301
  window.__stxSuspense = window.__stxSuspense || {
@@ -9315,25 +9315,25 @@ else {
9315
9315
  }
9316
9316
  };
9317
9317
  })();
9318
- </script>`,mq,zY,qY;var t3=S(()=>{c1();Y1();e$();M0();s3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},o1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,KY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;mq=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;zY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let X=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${X} -->${$}<!-- @endsuspense:${X} -->`}},qY={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{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():"",z=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
9318
+ </script>`,cq,UY,jY;var e3=S(()=>{i1();J1();$4();M0();r3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},s1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,zY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;cq=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;UY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let X=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${X} -->${$}<!-- @endsuspense:${X} -->`}},jY={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{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():"",z=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
9319
9319
  ${z}
9320
9320
  <script type="application/json" data-island-props="${G}">
9321
9321
  ${W?`{${W}}`:"{}"}
9322
9322
  </script>
9323
- </div>`}}});var _Y={};a(_Y,{warnUnbalancedTags:()=>e3,findUnbalancedTags:()=>jY});function O5($){return $.replace(/[^\n]/g," ")}function jY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,O5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,O5).replace(/<!--[\s\S]*?-->/g,O5).replace(/\{\{\{[\s\S]*?\}\}\}/g,O5).replace(/\{\{[\s\S]*?\}\}/g,O5).replace(/\{!![\s\S]*?!!\}/g,O5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",W=Q[2],z=Q[3]==="/";if(aq.has(W.toLowerCase()))continue;if(z)continue;if(K)J.set(W,(J.get(W)??0)+1);else{let q=Y.get(W);if(q)q.count++;else{let U=Z.slice(0,Q.index).split(`
9324
- `).length;Y.set(W,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(tq.has(K.toLowerCase()))continue;let W=Y.get(K)?.count??0,z=J.get(K)??0;if(W!==z)G.push({tag:K,opened:W,closed:z,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function e3($,Z){let Y;try{Y=jY($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(UY.has(J))return;UY.add(J);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:W}of Y)if(G>K){let z=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${z} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var aq,tq,UY;var $6=S(()=>{aq=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),tq=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);UY=new Set});import i0 from"path";import Z6 from"fs";function BY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function HY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class OY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,J){let X=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let _=[X,X.toLowerCase(),BY(X),HY(X)];for(let B of _)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${X}.stx`,`${BY(X)}.stx`,`${HY(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let _=i0.resolve(i0.dirname(Z),`${X}.stx`);if(await c(_))return _;return null}let K=[],W=Y.componentsDir||"",z=J?.__originalFilePath;if(z)K.push(i0.join(i0.dirname(z),"components"));if(W)K.push(W);let q=i0.join(i0.dirname(Z),"components");if(!K.includes(q))K.push(q);let U=process.cwd(),j=[i0.resolve(U,"src/components"),i0.resolve(U,"components"),i0.resolve(import.meta.dir,"components")];for(let _ of j)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let B of G){let H=i0.join(_,B);if(await c(H))return H}try{if(!Z6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=Z6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let V=i0.join(_,L.name);for(let O of G){let F=i0.join(V,O);if(await c(F))return F}}}catch{}}return null}}var f0;var Y6=S(()=>{M0();f0=new OY});function y0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function L5($,Z){let Y=[];for(let[J,X]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof X==="boolean"){if(X)Y.push(y0(Q));continue}Y.push(`${y0(Q)}="${y0(X)}"`)}return Y}var u4=()=>{};function q$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function eq($){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 J6;var X6=S(()=>{u4();J6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=eq($),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(J.reactive)W.push(`:href="${q$(J.value)}"`);else W.push(`href="${q$(J.value)}"`);if(X)W.push(`class="${q$(X)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${q$(Q)}"`),W.push(`data-stx-exact-active-class="${q$(G)}"`),K)W.push("data-stx-prefetch");let z=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...L5($,z)),`<a ${W.join(" ")}>${Z}</a>`}}});function E0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function P0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function G6($,Z,Y=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let X=$.static[Z];if(X!==void 0)return X!=="false"&&X!==!1;return Y}function LY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[X,Q]=J.split(":"),G=$U[X];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(X);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(J);return Y.join(", ")}function K6($,Z,Y,J){return Z.map((X)=>`${U$($,X,void 0,Y,J)} ${X}w`).join(", ")}function ZU($,Z,Y,J,X){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${U$($,G,void 0,J,X)} ${Q}x`}).join(", ")}function U$($,Z,Y,J,X){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(X)Q.push(`f_${X}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(X)Q.set("fm",X);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(X)Q.set("format",X);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function YU($,Z,Y="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var $U,Q6,W6;var z6=S(()=>{u4();$U={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Q6=[320,640,768,1024,1280,1536,1920];W6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=P0($,"src")||"",X=P0($,"alt")||"",Q=P0($,"width"),G=P0($,"height"),K=P0($,"sizes"),W=P0($,"srcset"),z=P0($,"densities"),q=P0($,"format"),U=P0($,"placeholder"),j=P0($,"placeholderColor")||"#e5e7eb",_=P0($,"provider"),B=P0($,"class")||P0($,"className")||"",H=P0($,"style")||"",L=P0($,"quality"),V=G6($,"lazy",!0),O=G6($,"preload",!1),F=G6($,"picture",!1)||!!q,w=Q?Number.parseInt(Q):void 0,A=G?Number.parseInt(G):void 0,R=W||"",N="";if(!R&&K)R=K6(J,Q6,_,q),N=LY(K);else if(!R&&z){let b=z.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));R=ZU(J,b,w,_,q)}else if(K)N=LY(K);let M=[];if(H)M.push(H);if(w&&A)M.push(`aspect-ratio:${w}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let b=YU(w||16,A||9,j);M.push(`background-image:url(${b})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")M.push(`background-image:url(${E0(U)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let T=U$(J,w,A,_,q),I=[];if(I.push(`src="${E0(T)}"`),I.push(`alt="${E0(X)}"`),Q)I.push(`width="${E0(Q)}"`);if(G)I.push(`height="${E0(G)}"`);if(V)I.push('loading="lazy"');if(I.push('decoding="async"'),B)I.push(`class="${E0(B)}"`);if(M.length>0)I.push(`style="${E0(M.join(";"))}"`);if(R)I.push(`srcset="${E0(R)}"`);if(N)I.push(`sizes="${E0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...L5($,E));let D=`<img ${I.join(" ")} />`,y="";if(O){let k=q==="webp"?"image/webp":q==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${E0(T)}"${k?` type="${k}"`:""}${R?` imagesrcset="${E0(R)}"`:""}${N?` imagesizes="${E0(N)}"`:""} />
9325
- `}if(F){let b=[];if(q==="avif"||q==="auto"){let k=U$(J,w,A,_,"avif"),v=R?K6(J,Q6,_,"avif"):`${k}`;b.push(`<source type="image/avif" srcset="${E0(v)}"${N?` sizes="${E0(N)}"`:""} />`)}if(q==="webp"||q==="auto"){let k=U$(J,w,A,_,"webp"),v=R?K6(J,Q6,_,"webp"):`${k}`;b.push(`<source type="image/webp" srcset="${E0(v)}"${N?` sizes="${E0(N)}"`:""} />`)}return`${y}<picture>
9323
+ </div>`}}});var HY={};a(HY,{warnUnbalancedTags:()=>$6,findUnbalancedTags:()=>BY});function L5($){return $.replace(/[^\n]/g," ")}function BY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,L5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,L5).replace(/<!--[\s\S]*?-->/g,L5).replace(/\{\{\{[\s\S]*?\}\}\}/g,L5).replace(/\{\{[\s\S]*?\}\}/g,L5).replace(/\{!![\s\S]*?!!\}/g,L5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",W=Q[2],z=Q[3]==="/";if($U.has(W.toLowerCase()))continue;if(z)continue;if(K)J.set(W,(J.get(W)??0)+1);else{let q=Y.get(W);if(q)q.count++;else{let U=Z.slice(0,Q.index).split(`
9324
+ `).length;Y.set(W,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(ZU.has(K.toLowerCase()))continue;let W=Y.get(K)?.count??0,z=J.get(K)??0;if(W!==z)G.push({tag:K,opened:W,closed:z,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function $6($,Z){let Y;try{Y=BY($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(_Y.has(J))return;_Y.add(J);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:W}of Y)if(G>K){let z=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${z} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var $U,ZU,_Y;var Z6=S(()=>{$U=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ZU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);_Y=new Set});import i0 from"path";import Y6 from"fs";function OY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function LY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class FY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,J){let X=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let _=[X,X.toLowerCase(),OY(X),LY(X)];for(let B of _)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${X}.stx`,`${OY(X)}.stx`,`${LY(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let _=i0.resolve(i0.dirname(Z),`${X}.stx`);if(await c(_))return _;return null}let K=[],W=Y.componentsDir||"",z=J?.__originalFilePath;if(z)K.push(i0.join(i0.dirname(z),"components"));if(W)K.push(W);let q=i0.join(i0.dirname(Z),"components");if(!K.includes(q))K.push(q);let U=process.cwd(),j=[i0.resolve(U,"src/components"),i0.resolve(U,"components"),i0.resolve(import.meta.dir,"components")];for(let _ of j)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let B of G){let H=i0.join(_,B);if(await c(H))return H}try{if(!Y6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=Y6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let V=i0.join(_,L.name);for(let O of G){let F=i0.join(V,O);if(await c(F))return F}}}catch{}}return null}}var f0;var J6=S(()=>{M0();f0=new FY});function y0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function F5($,Z){let Y=[];for(let[J,X]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof X==="boolean"){if(X)Y.push(y0(Q));continue}Y.push(`${y0(Q)}="${y0(X)}"`)}return Y}var p4=()=>{};function U$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function YU($){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 X6;var Q6=S(()=>{p4();X6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=YU($),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(J.reactive)W.push(`:href="${U$(J.value)}"`);else W.push(`href="${U$(J.value)}"`);if(X)W.push(`class="${U$(X)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${U$(Q)}"`),W.push(`data-stx-exact-active-class="${U$(G)}"`),K)W.push("data-stx-prefetch");let z=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...F5($,z)),`<a ${W.join(" ")}>${Z}</a>`}}});function E0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function P0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function K6($,Z,Y=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let X=$.static[Z];if(X!==void 0)return X!=="false"&&X!==!1;return Y}function VY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[X,Q]=J.split(":"),G=JU[X];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(X);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(J);return Y.join(", ")}function W6($,Z,Y,J){return Z.map((X)=>`${j$($,X,void 0,Y,J)} ${X}w`).join(", ")}function XU($,Z,Y,J,X){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${j$($,G,void 0,J,X)} ${Q}x`}).join(", ")}function j$($,Z,Y,J,X){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(X)Q.push(`f_${X}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(X)Q.set("fm",X);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(X)Q.set("format",X);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function QU($,Z,Y="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var JU,G6,z6;var q6=S(()=>{p4();JU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},G6=[320,640,768,1024,1280,1536,1920];z6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=P0($,"src")||"",X=P0($,"alt")||"",Q=P0($,"width"),G=P0($,"height"),K=P0($,"sizes"),W=P0($,"srcset"),z=P0($,"densities"),q=P0($,"format"),U=P0($,"placeholder"),j=P0($,"placeholderColor")||"#e5e7eb",_=P0($,"provider"),B=P0($,"class")||P0($,"className")||"",H=P0($,"style")||"",L=P0($,"quality"),V=K6($,"lazy",!0),O=K6($,"preload",!1),F=K6($,"picture",!1)||!!q,w=Q?Number.parseInt(Q):void 0,A=G?Number.parseInt(G):void 0,R=W||"",N="";if(!R&&K)R=W6(J,G6,_,q),N=VY(K);else if(!R&&z){let b=z.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));R=XU(J,b,w,_,q)}else if(K)N=VY(K);let M=[];if(H)M.push(H);if(w&&A)M.push(`aspect-ratio:${w}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let b=QU(w||16,A||9,j);M.push(`background-image:url(${b})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")M.push(`background-image:url(${E0(U)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let T=j$(J,w,A,_,q),I=[];if(I.push(`src="${E0(T)}"`),I.push(`alt="${E0(X)}"`),Q)I.push(`width="${E0(Q)}"`);if(G)I.push(`height="${E0(G)}"`);if(V)I.push('loading="lazy"');if(I.push('decoding="async"'),B)I.push(`class="${E0(B)}"`);if(M.length>0)I.push(`style="${E0(M.join(";"))}"`);if(R)I.push(`srcset="${E0(R)}"`);if(N)I.push(`sizes="${E0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...F5($,E));let D=`<img ${I.join(" ")} />`,y="";if(O){let k=q==="webp"?"image/webp":q==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${E0(T)}"${k?` type="${k}"`:""}${R?` imagesrcset="${E0(R)}"`:""}${N?` imagesizes="${E0(N)}"`:""} />
9325
+ `}if(F){let b=[];if(q==="avif"||q==="auto"){let k=j$(J,w,A,_,"avif"),v=R?W6(J,G6,_,"avif"):`${k}`;b.push(`<source type="image/avif" srcset="${E0(v)}"${N?` sizes="${E0(N)}"`:""} />`)}if(q==="webp"||q==="auto"){let k=j$(J,w,A,_,"webp"),v=R?W6(J,G6,_,"webp"):`${k}`;b.push(`<source type="image/webp" srcset="${E0(v)}"${N?` sizes="${E0(N)}"`:""} />`)}return`${y}<picture>
9326
9326
  ${b.join(`
9327
9327
  `)}
9328
9328
  ${D}
9329
- </picture>`}return`${y}${D}`}}});function j$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function F5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var FY="/images/safe-image-default.svg",JU,q6;var U6=S(()=>{u4();JU=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${FY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,q6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=F5($,"src")||"",X=F5($,"alt")||"",Q=F5($,"fallback")||FY,G=F5($,"class")||F5($,"className")||"",K=F5($,"fallbackClassName")||"",W=[];if(W.push(`src="${j$(J)}"`),W.push(`alt="${j$(X)}"`),G)W.push(`class="${j$(G)}"`);if(W.push(`data-fallback="${j$(Q)}"`),K)W.push(`data-fallback-class="${j$(K)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let z=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...L5($,z));let q=`<img ${W.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${JU}${q}`;return q}}});function j6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function _$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function m4($,Z,Y){let J=_$($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var _6;var B6=S(()=>{_6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=j6(_$($,"color")||"#6366f1"),X=j6(_$($,"initialColor")||_$($,"initial-color")||""),Q=j6(_$($,"height")||"3px"),G=m4($,"duration",2000),K=m4($,"throttle",200),W=m4($,"zIndex",999999)||m4($,"z-index",999999),z=X?`linear-gradient(to right, ${X}, ${J})`:J;return`
9329
+ </picture>`}return`${y}${D}`}}});function _$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function V5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var wY="/images/safe-image-default.svg",GU,U6;var j6=S(()=>{p4();GU=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${wY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,U6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=V5($,"src")||"",X=V5($,"alt")||"",Q=V5($,"fallback")||wY,G=V5($,"class")||V5($,"className")||"",K=V5($,"fallbackClassName")||"",W=[];if(W.push(`src="${_$(J)}"`),W.push(`alt="${_$(X)}"`),G)W.push(`class="${_$(G)}"`);if(W.push(`data-fallback="${_$(Q)}"`),K)W.push(`data-fallback-class="${_$(K)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let z=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...F5($,z));let q=`<img ${W.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${GU}${q}`;return q}}});function _6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function B$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function l4($,Z,Y){let J=B$($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var B6;var H6=S(()=>{B6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=_6(B$($,"color")||"#6366f1"),X=_6(B$($,"initialColor")||B$($,"initial-color")||""),Q=_6(B$($,"height")||"3px"),G=l4($,"duration",2000),K=l4($,"throttle",200),W=l4($,"zIndex",999999)||l4($,"z-index",999999),z=X?`linear-gradient(to right, ${X}, ${J})`:J;return`
9330
9330
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${z};z-index:${W};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
9331
9331
  <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>
9332
9332
  </div>
9333
9333
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
9334
9334
  <script>
9335
9335
  (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()})})();
9336
- </script>`}}});function wY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function XU($,Z,Y){let J=wY($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var VY,H6;var O6=S(()=>{VY={"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%)"},H6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=y0(wY($,"position")||"top-right"),X=XU($,"max",5),Q=VY[J]||VY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" 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>
9336
+ </script>`}}});function RY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function KU($,Z,Y){let J=RY($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var AY,O6;var L6=S(()=>{AY={"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%)"},O6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=y0(RY($,"position")||"top-right"),X=KU($,"max",5),Q=AY[J]||AY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" 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>
9337
9337
  <style>
9338
9338
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
9339
9339
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -9341,7 +9341,7 @@ ${D}
9341
9341
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
9342
9342
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
9343
9343
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
9344
- </style>`}}});function p4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var AY,L6;var F6=S(()=>{AY={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)"},L6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=p4($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let X=y0(J),Q=p4($,"size")||"md",G=p4($,"closeOnBackdrop")!=="false",K=p4($,"closeOnEscape")!=="false",W=AY[Q]||AY.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">
9344
+ </style>`}}});function c4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var NY,F6;var V6=S(()=>{NY={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)"},F6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=c4($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let X=y0(J),Q=c4($,"size")||"md",G=c4($,"closeOnBackdrop")!=="false",K=c4($,"closeOnEscape")!=="false",W=NY[Q]||NY.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">
9345
9345
  <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)">
9346
9346
  <div style="padding:1.5rem">${Z}</div>
9347
9347
  </div>
@@ -9350,7 +9350,7 @@ ${D}
9350
9350
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
9351
9351
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
9352
9352
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
9353
- </style>`}}});function V5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var RY,V6;var w6=S(()=>{RY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},V6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=V5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let X=y0(J),Q=V5($,"side")||"right",G=V5($,"size")||"md",K=V5($,"closeOnBackdrop")!=="false",W=V5($,"closeOnEscape")!=="false",z=V5($,"overlay")!=="false",q=RY[G]||RY.md,U=Q==="left",j=U?"left:0":"right:0",_=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;${z?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
9353
+ </style>`}}});function w5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var MY,w6;var A6=S(()=>{MY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},w6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=w5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let X=y0(J),Q=w5($,"side")||"right",G=w5($,"size")||"md",K=w5($,"closeOnBackdrop")!=="false",W=w5($,"closeOnEscape")!=="false",z=w5($,"overlay")!=="false",q=MY[G]||MY.md,U=Q==="left",j=U?"left:0":"right:0",_=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;${z?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
9354
9354
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${j};width:${q};max-width:100vw;transform:${_};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
9355
9355
  <div style="padding:1.5rem">${Z}</div>
9356
9356
  </div>
@@ -9359,18 +9359,18 @@ ${D}
9359
9359
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
9360
9360
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
9361
9361
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
9362
- </style>`}}});import{existsSync as QU,readFileSync as GU}from"fs";function KU($){if(NY.has($))return;NY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function WU($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(QU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return j0.resolve(Y)}catch{}return null}function zU($){if(l4.has($))return l4.get($);let Z=WU($);if(!Z)return KU($),null;try{let Y=JSON.parse(GU(Z,"utf8"));return l4.set($,Y.icons),Y.icons}catch{return null}}function w5($,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 l4,NY,A6;var R6=S(()=>{l4=new Map,NY=new Set;A6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=w5($,"name")??w5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=J;if(J.includes(":")){let O=J.split(":");X=O[0],Q=O[1]}let G=y0(w5($,"size")||"24"),K=y0(w5($,"color")||"currentColor"),W=y0(w5($,"class")||""),z=y0(w5($,"style")||""),q=l4.get(X)??zU(X);if(!q)return`<!-- Icon: collection "${X}" not loaded -->`;let U=q[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${X} -->`;let j=U.width||24,_=U.height||24,B=`0 0 ${j} ${_}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=W?` class="${W}"`:"",V=z?` style="${z}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${L}${V}>${H}</svg>`}}});function MY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function TY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var N6;var M6=S(()=>{N6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=TY(Z,"fallback"),X=J.rest,Q=TY(X,"error"),G=Q.rest,K=J.region??MY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??MY($,"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 c4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var T6;var I6=S(()=>{T6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(c4($,"name")||"v").replace(/["'<>]/g,""),X=(c4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=c4($,"class"),G=c4($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function IY(){f0.registerBuiltin(J6),f0.registerBuiltin(W6),f0.registerBuiltin(q6),f0.registerBuiltin(_6),f0.registerBuiltin(H6),f0.registerBuiltin(L6),f0.registerBuiltin(V6),f0.registerBuiltin(A6),f0.registerBuiltin(N6),f0.registerBuiltin(T6)}var DY=S(()=>{X6();z6();U6();B6();O6();F6();w6();R6();M6();I6();Y6();X6();z6();U6();B6();O6();F6();w6();R6();M6();I6()});function i4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function EY($,Z,Y){let J=[],X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})`));if(!K){X=Q+1;continue}let W=K[1];if(Y&&Y.has(W.toLowerCase())){let H=Q+1+W.length;while(H<$.length&&$[H]!==">")H++;X=H+1;continue}let z=Q+1+W.length,q=null,U=z,j=-1,_=!1;while(z<$.length){let H=$[z];if(q){if(H==="\\"&&z+1<$.length){z+=2;continue}if(H===q)q=null;z++;continue}if(H==='"'||H==="'"){q=H,z++;continue}if(H==="/"&&z+1<$.length&&$[z+1]===">"){j=z+2,_=!0;break}if(H===">"){j=z+1;break}z++}if(j===-1){X=Q+1;continue}let B=$.slice(U,_?j-2:j-1).trim();if(_)J.push({fullMatch:$.slice(Q,j),tagName:W,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),X=j;else{let H=`<${W}`,L=`</${W}>`,V=1,O=j,F=-1;while(V>0&&O<$.length){let R=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(R!==-1&&R<N){let M=$[R+H.length];if(M===" "||M===">"||M==="/"||M===`
9363
- `||M==="\t")V++;O=R+H.length}else{if(V--,V===0){F=N;break}O=N+L.length}}if(F===-1){X=j;continue}let w=$.slice(j,F),A=F+L.length;J.push({fullMatch:$.slice(Q,A),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:A,isSelfClosing:!1}),X=A}}return J}function kY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var bY=S(()=>{w0();M0();C1()});var fY={};a(fY,{processESImports:()=>vY,processComponents:()=>o4});import n4 from"fs";import m0 from"path";function UU($,Z,Y){let J={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),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,z)=>z.toUpperCase())},G=(K,W)=>{let z=Q(K);if(J.static[z]=W,z!==K)J.staticNames[z]=K};for(let[K,W]of Object.entries($)){let z=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(z.startsWith("@")){J.events[z]=W;continue}if(z.startsWith("__stx_")){let q=Q(z.slice(6));J.serverDynamic[q]=kY(W,Y);continue}if(z.startsWith(":")){let q=Q(z.slice(1)),U=W===D6?q:W;if(q==="if"||q==="for"||q==="show"){J.clientReactive[q]=U;continue}try{if(!K0(U)){if(Y.debug)console.error(`Unsafe expression in :${q} binding: ${U}`);J.clientReactive[q]=U;continue}let j=Object.keys(Z),B=W0(U,j)(...Object.values(Z));if(B===void 0){let H=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!j.includes(O))){J.clientReactive[q]=U;continue}}J.serverDynamic[q]=B}catch{J.clientReactive[q]=U}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let q=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(q)try{let U=q[1];if(K0(U)){let _=W0(U,Object.keys(Z))(...Object.values(Z));G(z,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${z}: ${U}`);G(z,W)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${z}:`,U);G(z,W)}else{let U=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(W))!==null)try{let B=_[1];if(!K0(B)){if(Y.debug)console.error(`Unsafe expression in ${z}: ${B}`);continue}let L=W0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(_[0],String(L??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${z}:`,B)}G(z,U)}continue}G(z,W===D6?"true":W)}return J}function jU($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let X="";while(Y<J&&!/[\s=]/.test($[Y]))X+=$[Y],Y++;if(!X)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let Q="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[X]=Q}else Z[X]=D6}return Z}function yY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _U($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let X=J[1];if(f0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function BU($){let Z=PY.get($);if(Z)return Z;let Y=new Map,J=[m0.join($,"src"),m0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=n4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let z=m0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(z,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let q=W.name.slice(0,-4);if(!Y.has(q))Y.set(q,z);let U=q.toLowerCase();if(!Y.has(U))Y.set(U,z);let j=q.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,z)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return PY.set($,Y),Y}function HU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=m0.join(Y,"node_modules",$);try{if(n4.statSync(J).isDirectory())return J}catch{}let X=m0.dirname(Y);if(X===Y)return null;Y=X}}async function vY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=m0.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(z,q,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=U,B,H=[];while((B=j.exec(U))!==null){let[L,V,O,F]=B,w=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let M=m0.resolve(G,F);if(M.endsWith(".stx"))A=M;else{let T=`${M}.stx`;try{if(n4.statSync(T).isFile())A=T}catch{try{if(n4.statSync(M).isDirectory())w=M}catch{}}}}else w=HU(F,G);if(!w&&!A)continue;let R=!1,N=(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(O&&A)N(O,A),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?BU(w):null;for(let{source:I,local:E}of M){let D=null;if(A)D=A;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)N(E,D),R=!0}}if(R)H.push({start:B.index,end:B.index+L.length})}if(H.length===0)return z;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${q}>${_}</script>`}),K}async function OU($,Z,Y,J,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[z,q]=W,U=q.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let _=j.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),V=null,O=[m0.resolve(m0.dirname(Y),`${j}.stx`),m0.resolve(m0.dirname(Y),j),m0.resolve(J.componentsDir||"components",`${j}.stx`),m0.resolve(J.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(L,V),G.set(H,V),G.set(H.toLowerCase(),V);let F=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),X.add(V),J.debug)console.log(`Imported component: ${L} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(z,""),K.lastIndex=0}return Q}async function LU($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,z;while((z=W.exec(Q))!==null){let q=z.index,U=q+z[0].length-1,j=1,_=U+1;while(_<Q.length&&j>0){if(Q[_]==="(")j++;else if(Q[_]===")"){if(j--,j===0)break}_++}if(j!==0)break;let B=Q.substring(U+1,_),H=_+1,L=B.match(/^\s*['"]([^'"]+)['"]/);if(!L){W.lastIndex=0;continue}let V=L[1],O,F=B.slice(L[0].length),w=F.match(/^\s*,\s*/);if(w)O=F.slice(w[0].length).trim();let A={};if(O)try{A=T0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(q,H),`[Error parsing component props: ${D}]`);continue}let R="",N=H,T=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)R=T[1].trim(),N=H+T[0].length;let I=await d1(V,A,R,G,Z,Y,J,K,X);Q=Q.substring(0,q)+I+Q.substring(N),W.lastIndex=0}return Q}async function FU($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=L1(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,qU),Q=u5(Q,W.scripts),Q;async function j(_,B,H,L){if(!_)return _;let V=_,O=EY(V,B,L);for(let F=O.length-1;F>=0;F--){let w=O[F],A=H?i4(w.tagName):w.tagName,R=jU(w.attributes),N=UU(R,Z,J),M=f0.getBuiltin(w.tagName),T=M?await t$(A,G,Z,Y,J):!1;if(M&&!T){let y={context:Z,filePath:Y,options:J,dependencies:X},b=M.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)b=CY(b,N.clientReactive);if(Object.keys(N.events).length>0){let k=Object.entries(N.events).map(([v,g])=>`${v}="${yY(g)}"`).join(" ");b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}V=V.substring(0,w.startIndex)+b+V.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await t$(A,G,Z,Y,J))continue;let I={};for(let[y,b]of Object.entries(N.static))I[y]=b;for(let[y,b]of Object.entries(N.serverDynamic))I[y]=b;let D=await d1(A,I,w.content,G,Z,Y,J,K,X);if(Object.keys(N.clientReactive).length>0)D=CY(D,N.clientReactive);if(Object.keys(N.events).length>0){let y=xY(D);if(y){let b=Object.entries(N.events).map(([v,g])=>`${v}="${yY(g)}"`).join(" "),k=Object.keys(N.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${k}" ${b}`+D.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+D+V.substring(w.endIndex)}return V}}function CY($,Z){let Y=new Set(["if","for"]),J=new Set(["show"]),X=Object.entries(Z).filter(([q])=>!Y.has(q)),Q=X.filter(([q])=>!J.has(q)).map(([q])=>i4(q)).join(" "),G=$,K=X.length>0?xY(G):null;if(K){let q=X.map(([j,_])=>`:${i4(j)}="${_.replace(/"/g,"&quot;")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${q}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,"&quot;")}">${G}</template>`;let z=Z.for;if(z)G=`<template :for="${z.replace(/"/g,"&quot;")}">${G}</template>`;return G}function xY($){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 Y=0;while(Y<$.length){let J=$.slice(Y),X=J.match(/^\s+/);if(X){Y+=X[0].length;continue}if(J.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,Y+Q[0].length);if(W===-1)return null;Y=W+K.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function o4($,Z,Y,J,X){if(!SY)IY(),SY=!0;let Q=await vY($,Z,Y,J,X);Q=await OU(Q,Z,Y,J,X),Q=await LU(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let W=Z1(Q,d5,(q,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...W.tokens);let z=Q;if(Q=await FU(W.output,Z,Y,J,X),Q===z)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(J.debug){let K=_U(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var SY=!1,D6="\x00stx-boolean-attribute",qU,PY;var E6=S(()=>{Y6();DY();bY();C1();M0();w0();qU=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);PY=new Map});var lY={};a(lY,{processLoops:()=>k6});function AU($,Z){let Y=/@component\s*\(/g,J=$,X,Q=[];while((X=Y.exec(J))!==null){let G=X.index,K=G+X[0].length-1,W=1,z=K+1;while(z<J.length&&W>0){if(J[z]==="(")W++;else if(J[z]===")"){if(W--,W===0)break}z++}if(W!==0)continue;let q=J.substring(K+1,z),U=z+1,j=q.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let _=j[1],B=q.slice(j[0].length),H=B.match(/^\s*,\s*/);if(!H)continue;let L=B.slice(H[0].length).trim();if(!L)continue;try{let V=T0(L,Z),O=JSON.stringify(V),F=`@component('${_}', ${O})`;Q.push({start:G,end:U,replacement:F})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:z}=Q[G];J=J.substring(0,K)+z+J.substring(W)}return J}function s4($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,z=K+1,q=null,U=!1;while(z<J.length&&W>0){let B=J[z];if(U){U=!1,z++;continue}if(B==="\\"&&q){U=!0,z++;continue}if(q){if(B===q)q=null;z++;continue}if(B==='"'||B==="'"||B==="`"){q=B,z++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}z++}if(W!==0)break;let j=J.substring(K+1,z),_=Y(j);J=J.substring(0,G)+_+J.substring(z+1)}return J}function RU($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,X)=>{if(X in Z)return`:${X}="${X}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);N$(Q);let z=W0(Q,G)(...K),q=JSON.stringify(z),U=Buffer.from(q,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return J}}),Y}function NU($,Z){let Y=$;return Y=s4(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(K0(Q)){let K=W0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(Q,Z));return G?r4:""}catch{return""}}),Y=s4(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(K0(Q)){let K=W0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(Q,Z));return G?a4:""}catch{return""}}),Y}function MU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,r4),Z=Z.replace(/@continue(?!\()/g,a4),Z}function gY($){let Z=$.includes(r4),Y=Z?$.substring(0,$.indexOf(r4)):$;return{hasBreak:Z,content:Y}}function hY($){let Z=$.includes(a4),Y=Z?$.substring(0,$.indexOf(a4)):$;return{hasContinue:Z,content:Y}}function uY($){let Z=$;return Z=s4(Z,"@break",(Y)=>{let J=Y.trim();if(!M$(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=s4(Z,"@continue",(Y)=>{let J=Y.trim();if(!M$(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function TU($){let Z=/@forelse\s*\(/g,Y,J=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((q,U)=>q.pos-U.pos);let K=[],W=0;for(let q of J)W+=q.delta,K.push({pos:q.pos,depth:W});function z(q){let U=0,j=K.length-1,_=0;while(U<=j){let B=U+j>>1;if(K[B].pos<=q)_=K[B].depth,U=B+1;else j=B-1}return _}while((Y=Z.exec($))!==null){if(z(Y.index)>0)continue;let q=Y.index,U=Y.index+Y[0].length-1,j=1,_=U+1,B=-1;while(_<$.length&&j>0){if($[_]==="(")j++;else if($[_]===")"){if(j--,j===0){B=_;break}}_++}if(B===-1)continue;let H=$.substring(U+1,B),L=H.indexOf(" as ");if(L===-1)continue;let V=H.substring(0,L).trim(),O=H.substring(L+4).trim(),F=B+1,w=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,M=-1;while(w>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec($),k=N.exec($);if(!k)break;if(b&&b.index<k.index)w++,A=b.index+b[0].length;else{if(w--,w===0){M=k.index;break}A=k.index+11}}if(M===-1)continue;let T=$.substring(F,M),I=M+11,E=-1,D=0,y=0;while(y<T.length){let b=T.indexOf("@",y);if(b===-1)break;let k=T.substring(b);if(/^@forelse\s*\(/.test(k))D++,y=b+1;else if(k.startsWith("@endforelse"))D--,y=b+11;else if(D===0&&k.startsWith("@empty")){if(T.length<=b+6||!/[a-z]/i.test(T[b+6])){E=b;break}y=b+1}else y=b+1}if(E===-1)continue;return{start:q,end:I,arrayExpr:V,itemVar:O,foreachContent:T.substring(0,E),emptyContent:T.substring(E+6)}}return null}function dY($,Z){let Y=$;while(!0){let J=TU(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:z}=J;try{let q;if(K0(G))q=W0(G,Object.keys(Z))(...Object.values(Z));else q=$0(G,Z);let U;if(!Array.isArray(q)||q.length===0)U=z;else U=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,X)+U+Y.substring(Q)}catch(q){let U=q instanceof Error?q.message:String(q),j=e("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,X)+j+Y.substring(Q)}}return Y}function k6($,Z,Y,J){let X=$;X=dY(X,Z);function Q(W){let z=/@foreach\s*\(/g,q;while((q=z.exec(W))!==null){let U=q.index,j=q.index+q[0].length-1,_=1,B=j+1,H=-1;while(B<W.length&&_>0){if(W[B]==="(")_++;else if(W[B]===")"){if(_--,_===0){H=B;break}}B++}if(H===-1)continue;let L=W.substring(j+1,H),V=L.indexOf(" as ");if(V===-1)continue;let O=U,F=L.substring(0,V),w=L.substring(V+4),A=H+1,R=1,N=A,M=/@foreach\s*\(/g,T=/@endforeach/g;while(R>0&&N<W.length){M.lastIndex=N,T.lastIndex=N;let I=M.exec(W),E=T.exec(W);if(!E)break;if(I&&I.index<E.index)R++,N=I.index+I[0].length;else{if(R--,R===0){let D=W.substring(A,E.index),y=E.index+11;return{start:O,end:y,arrayExpr:F,itemVar:w,content:D}}N=E.index+11}}}return null}function G(W,z){let q=W;while(!0){let U=Q(q);if(!U)break;let{start:j,end:_,arrayExpr:B,itemVar:H,content:L}=U;try{let V=B.trim(),O;if(K0(V))O=W0(V,Object.keys(z))(...Object.values(z));else O=$0(V,z);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{let E=e("Foreach",`Error in @foreach: ${V} is not iterable`,s.TYPE_ERROR);q=q.substring(0,j)+E+q.substring(_);continue}let w=J?.loops?.useAltLoopVariable??wU,A=H.trim(),R=null,N,M=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1],M=!0;else N=A}else N=A;let T="",I=O;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},b={...z,loop:y,$loop:y};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(D))f.forEach((d,p)=>{if(d)b[d]=D[p]});else b[N]=D}else b[N]=D;if(R)if(!M&&F&&Array.isArray(D)&&D.length===2)b[R]=D[0],b[N]=D[1];else b[R]=E;let k=NU(L,b),v=hY(k);if(v.hasContinue){T+=v.content;continue}let g=gY(k);if(g.hasBreak){T+=g.content;break}if(k=dY(k,b),k=G(k,b),k=i1(k,b,Y),k=MU(k),g=gY(k),g.hasBreak){T+=g.content;break}if(v=hY(k),v.hasContinue){T+=v.content;continue}k=F1(k,b,Y),k=RU(k,b),k=AU(k,b),T+=k}q=q.substring(0,j)+T+q.substring(_)}catch(V){let O=e("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${V instanceof Error?V.message:String(V)}`,s.EVALUATION_ERROR);q=q.substring(0,j)+O+q.substring(_)}}return q}X=G(X,Z),X=pY(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??VU;return X=EU(X,Z,K),X}function mY($){return M$($)}function pY($,Z,Y,J){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,z=x0(X,"(",")",W);if(z===-1)break;let q=X.slice(W+1,z),U=z+1,j=P$(X.slice(K),"for","endfor");if(j.length===0)break;let _=j[0].content,B=K+j[0].end;if(!mY(q)){let H=e("For",`Unsafe expression in @for: ${q}`,s.UNSAFE_EXPRESSION);X=X.substring(0,K)+H+X.substring(B),Q=!0;continue}try{let H=IU(q),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let R=DU({forExpr:q,content:_,iterVarNames:H,context:Z,filePath:Y,options:J});X=X.substring(0,K)+R+X.substring(B),Q=!0;continue}let V=Object.keys(Z),O=Object.values(Z),F=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=uY(F);let A=Function(...V,`
9362
+ </style>`}}});import{existsSync as WU,readFileSync as zU}from"fs";function qU($){if(TY.has($))return;TY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function UU($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(WU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return j0.resolve(Y)}catch{}return null}function jU($){if(i4.has($))return i4.get($);let Z=UU($);if(!Z)return qU($),null;try{let Y=JSON.parse(zU(Z,"utf8"));return i4.set($,Y.icons),Y.icons}catch{return null}}function A5($,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 i4,TY,R6;var N6=S(()=>{i4=new Map,TY=new Set;R6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=A5($,"name")??A5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=J;if(J.includes(":")){let O=J.split(":");X=O[0],Q=O[1]}let G=y0(A5($,"size")||"24"),K=y0(A5($,"color")||"currentColor"),W=y0(A5($,"class")||""),z=y0(A5($,"style")||""),q=i4.get(X)??jU(X);if(!q)return`<!-- Icon: collection "${X}" not loaded -->`;let U=q[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${X} -->`;let j=U.width||24,_=U.height||24,B=`0 0 ${j} ${_}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=W?` class="${W}"`:"",V=z?` style="${z}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${L}${V}>${H}</svg>`}}});function IY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function DY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var M6;var T6=S(()=>{M6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=DY(Z,"fallback"),X=J.rest,Q=DY(X,"error"),G=Q.rest,K=J.region??IY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??IY($,"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 n4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var I6;var D6=S(()=>{I6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(n4($,"name")||"v").replace(/["'<>]/g,""),X=(n4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=n4($,"class"),G=n4($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function EY(){f0.registerBuiltin(X6),f0.registerBuiltin(z6),f0.registerBuiltin(U6),f0.registerBuiltin(B6),f0.registerBuiltin(O6),f0.registerBuiltin(F6),f0.registerBuiltin(w6),f0.registerBuiltin(R6),f0.registerBuiltin(M6),f0.registerBuiltin(I6)}var kY=S(()=>{Q6();q6();j6();H6();L6();V6();A6();N6();T6();D6();J6();Q6();q6();j6();H6();L6();V6();A6();N6();T6();D6()});function o4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function bY($,Z,Y){let J=[],X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})`));if(!K){X=Q+1;continue}let W=K[1];if(Y&&Y.has(W.toLowerCase())){let H=Q+1+W.length;while(H<$.length&&$[H]!==">")H++;X=H+1;continue}let z=Q+1+W.length,q=null,U=z,j=-1,_=!1;while(z<$.length){let H=$[z];if(q){if(H==="\\"&&z+1<$.length){z+=2;continue}if(H===q)q=null;z++;continue}if(H==='"'||H==="'"){q=H,z++;continue}if(H==="/"&&z+1<$.length&&$[z+1]===">"){j=z+2,_=!0;break}if(H===">"){j=z+1;break}z++}if(j===-1){X=Q+1;continue}let B=$.slice(U,_?j-2:j-1).trim();if(_)J.push({fullMatch:$.slice(Q,j),tagName:W,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),X=j;else{let H=`<${W}`,L=`</${W}>`,V=1,O=j,F=-1;while(V>0&&O<$.length){let R=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(R!==-1&&R<N){let M=$[R+H.length];if(M===" "||M===">"||M==="/"||M===`
9363
+ `||M==="\t")V++;O=R+H.length}else{if(V--,V===0){F=N;break}O=N+L.length}}if(F===-1){X=j;continue}let w=$.slice(j,F),A=F+L.length;J.push({fullMatch:$.slice(Q,A),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:A,isSelfClosing:!1}),X=A}}return J}function SY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var yY=S(()=>{w0();M0();v1()});var hY={};a(hY,{processESImports:()=>fY,processComponents:()=>r4});import s4 from"fs";import m0 from"path";function BU($,Z,Y){let J={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),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,z)=>z.toUpperCase())},G=(K,W)=>{let z=Q(K);if(J.static[z]=W,z!==K)J.staticNames[z]=K};for(let[K,W]of Object.entries($)){let z=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(z.startsWith("@")){J.events[z]=W;continue}if(z.startsWith("__stx_")){let q=Q(z.slice(6));J.serverDynamic[q]=SY(W,Y);continue}if(z.startsWith(":")){let q=Q(z.slice(1)),U=W===E6?q:W;if(q==="if"||q==="for"||q==="show"){J.clientReactive[q]=U;continue}try{if(!K0(U)){if(Y.debug)console.error(`Unsafe expression in :${q} binding: ${U}`);J.clientReactive[q]=U;continue}let j=Object.keys(Z),B=W0(U,j)(...Object.values(Z));if(B===void 0){let H=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!j.includes(O))){J.clientReactive[q]=U;continue}}J.serverDynamic[q]=B}catch{J.clientReactive[q]=U}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let q=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(q)try{let U=q[1];if(K0(U)){let _=W0(U,Object.keys(Z))(...Object.values(Z));G(z,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${z}: ${U}`);G(z,W)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${z}:`,U);G(z,W)}else{let U=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(W))!==null)try{let B=_[1];if(!K0(B)){if(Y.debug)console.error(`Unsafe expression in ${z}: ${B}`);continue}let L=W0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(_[0],String(L??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${z}:`,B)}G(z,U)}continue}G(z,W===E6?"true":W)}return J}function HU($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let X="";while(Y<J&&!/[\s=]/.test($[Y]))X+=$[Y],Y++;if(!X)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let Q="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[X]=Q}else Z[X]=E6}return Z}function CY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function OU($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let X=J[1];if(f0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function LU($){let Z=vY.get($);if(Z)return Z;let Y=new Map,J=[m0.join($,"src"),m0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=s4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let z=m0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(z,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let q=W.name.slice(0,-4);if(!Y.has(q))Y.set(q,z);let U=q.toLowerCase();if(!Y.has(U))Y.set(U,z);let j=q.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,z)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return vY.set($,Y),Y}function FU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=m0.join(Y,"node_modules",$);try{if(s4.statSync(J).isDirectory())return J}catch{}let X=m0.dirname(Y);if(X===Y)return null;Y=X}}async function fY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=m0.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(z,q,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=U,B,H=[];while((B=j.exec(U))!==null){let[L,V,O,F]=B,w=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let M=m0.resolve(G,F);if(M.endsWith(".stx"))A=M;else{let T=`${M}.stx`;try{if(s4.statSync(T).isFile())A=T}catch{try{if(s4.statSync(M).isDirectory())w=M}catch{}}}}else w=FU(F,G);if(!w&&!A)continue;let R=!1,N=(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(O&&A)N(O,A),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?LU(w):null;for(let{source:I,local:E}of M){let D=null;if(A)D=A;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)N(E,D),R=!0}}if(R)H.push({start:B.index,end:B.index+L.length})}if(H.length===0)return z;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${q}>${_}</script>`}),K}async function VU($,Z,Y,J,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[z,q]=W,U=q.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let _=j.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),V=null,O=[m0.resolve(m0.dirname(Y),`${j}.stx`),m0.resolve(m0.dirname(Y),j),m0.resolve(J.componentsDir||"components",`${j}.stx`),m0.resolve(J.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(L,V),G.set(H,V),G.set(H.toLowerCase(),V);let F=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),X.add(V),J.debug)console.log(`Imported component: ${L} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(z,""),K.lastIndex=0}return Q}async function wU($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,z;while((z=W.exec(Q))!==null){let q=z.index,U=q+z[0].length-1,j=1,_=U+1;while(_<Q.length&&j>0){if(Q[_]==="(")j++;else if(Q[_]===")"){if(j--,j===0)break}_++}if(j!==0)break;let B=Q.substring(U+1,_),H=_+1,L=B.match(/^\s*['"]([^'"]+)['"]/);if(!L){W.lastIndex=0;continue}let V=L[1],O,F=B.slice(L[0].length),w=F.match(/^\s*,\s*/);if(w)O=F.slice(w[0].length).trim();let A={};if(O)try{A=T0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(q,H),`[Error parsing component props: ${D}]`);continue}let R="",N=H,T=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)R=T[1].trim(),N=H+T[0].length;let I=await u1(V,A,R,G,Z,Y,J,K,X);Q=Q.substring(0,q)+I+Q.substring(N),W.lastIndex=0}return Q}async function AU($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=F1(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,_U),Q=m5(Q,W.scripts),Q;async function j(_,B,H,L){if(!_)return _;let V=_,O=bY(V,B,L);for(let F=O.length-1;F>=0;F--){let w=O[F],A=H?o4(w.tagName):w.tagName,R=HU(w.attributes),N=BU(R,Z,J),M=f0.getBuiltin(w.tagName),T=M?await e$(A,G,Z,Y,J):!1;if(M&&!T){let y={context:Z,filePath:Y,options:J,dependencies:X},b=M.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)b=xY(b,N.clientReactive);if(Object.keys(N.events).length>0){let k=Object.entries(N.events).map(([v,g])=>`${v}="${CY(g)}"`).join(" ");b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}V=V.substring(0,w.startIndex)+b+V.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await e$(A,G,Z,Y,J))continue;let I={};for(let[y,b]of Object.entries(N.static))I[y]=b;for(let[y,b]of Object.entries(N.serverDynamic))I[y]=b;let D=await u1(A,I,w.content,G,Z,Y,J,K,X);if(Object.keys(N.clientReactive).length>0)D=xY(D,N.clientReactive);if(Object.keys(N.events).length>0){let y=gY(D);if(y){let b=Object.entries(N.events).map(([v,g])=>`${v}="${CY(g)}"`).join(" "),k=Object.keys(N.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${k}" ${b}`+D.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+D+V.substring(w.endIndex)}return V}}function xY($,Z){let Y=new Set(["if","for"]),J=new Set(["show"]),X=Object.entries(Z).filter(([q])=>!Y.has(q)),Q=X.filter(([q])=>!J.has(q)).map(([q])=>o4(q)).join(" "),G=$,K=X.length>0?gY(G):null;if(K){let q=X.map(([j,_])=>`:${o4(j)}="${_.replace(/"/g,"&quot;")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${q}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,"&quot;")}">${G}</template>`;let z=Z.for;if(z)G=`<template :for="${z.replace(/"/g,"&quot;")}">${G}</template>`;return G}function gY($){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 Y=0;while(Y<$.length){let J=$.slice(Y),X=J.match(/^\s+/);if(X){Y+=X[0].length;continue}if(J.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,Y+Q[0].length);if(W===-1)return null;Y=W+K.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function r4($,Z,Y,J,X){if(!PY)EY(),PY=!0;let Q=await fY($,Z,Y,J,X);Q=await VU(Q,Z,Y,J,X),Q=await wU(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let W=Y1(Q,u5,(q,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...W.tokens);let z=Q;if(Q=await AU(W.output,Z,Y,J,X),Q===z)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(J.debug){let K=OU(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var PY=!1,E6="\x00stx-boolean-attribute",_U,vY;var k6=S(()=>{J6();kY();yY();v1();M0();w0();_U=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);vY=new Map});var iY={};a(iY,{processLoops:()=>b6});function MU($,Z){let Y=/@component\s*\(/g,J=$,X,Q=[];while((X=Y.exec(J))!==null){let G=X.index,K=G+X[0].length-1,W=1,z=K+1;while(z<J.length&&W>0){if(J[z]==="(")W++;else if(J[z]===")"){if(W--,W===0)break}z++}if(W!==0)continue;let q=J.substring(K+1,z),U=z+1,j=q.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let _=j[1],B=q.slice(j[0].length),H=B.match(/^\s*,\s*/);if(!H)continue;let L=B.slice(H[0].length).trim();if(!L)continue;try{let V=T0(L,Z),O=JSON.stringify(V),F=`@component('${_}', ${O})`;Q.push({start:G,end:U,replacement:F})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:z}=Q[G];J=J.substring(0,K)+z+J.substring(W)}return J}function a4($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,z=K+1,q=null,U=!1;while(z<J.length&&W>0){let B=J[z];if(U){U=!1,z++;continue}if(B==="\\"&&q){U=!0,z++;continue}if(q){if(B===q)q=null;z++;continue}if(B==='"'||B==="'"||B==="`"){q=B,z++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}z++}if(W!==0)break;let j=J.substring(K+1,z),_=Y(j);J=J.substring(0,G)+_+J.substring(z+1)}return J}function TU($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,X)=>{if(X in Z)return`:${X}="${X}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);M$(Q);let z=W0(Q,G)(...K),q=JSON.stringify(z),U=Buffer.from(q,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return J}}),Y}function IU($,Z){let Y=$;return Y=a4(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(K0(Q)){let K=W0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(Q,Z));return G?t4:""}catch{return""}}),Y=a4(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(K0(Q)){let K=W0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(Q,Z));return G?e4:""}catch{return""}}),Y}function DU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,t4),Z=Z.replace(/@continue(?!\()/g,e4),Z}function dY($){let Z=$.includes(t4),Y=Z?$.substring(0,$.indexOf(t4)):$;return{hasBreak:Z,content:Y}}function uY($){let Z=$.includes(e4),Y=Z?$.substring(0,$.indexOf(e4)):$;return{hasContinue:Z,content:Y}}function pY($){let Z=$;return Z=a4(Z,"@break",(Y)=>{let J=Y.trim();if(!T$(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=a4(Z,"@continue",(Y)=>{let J=Y.trim();if(!T$(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function EU($){let Z=/@forelse\s*\(/g,Y,J=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((q,U)=>q.pos-U.pos);let K=[],W=0;for(let q of J)W+=q.delta,K.push({pos:q.pos,depth:W});function z(q){let U=0,j=K.length-1,_=0;while(U<=j){let B=U+j>>1;if(K[B].pos<=q)_=K[B].depth,U=B+1;else j=B-1}return _}while((Y=Z.exec($))!==null){if(z(Y.index)>0)continue;let q=Y.index,U=Y.index+Y[0].length-1,j=1,_=U+1,B=-1;while(_<$.length&&j>0){if($[_]==="(")j++;else if($[_]===")"){if(j--,j===0){B=_;break}}_++}if(B===-1)continue;let H=$.substring(U+1,B),L=H.indexOf(" as ");if(L===-1)continue;let V=H.substring(0,L).trim(),O=H.substring(L+4).trim(),F=B+1,w=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,M=-1;while(w>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec($),k=N.exec($);if(!k)break;if(b&&b.index<k.index)w++,A=b.index+b[0].length;else{if(w--,w===0){M=k.index;break}A=k.index+11}}if(M===-1)continue;let T=$.substring(F,M),I=M+11,E=-1,D=0,y=0;while(y<T.length){let b=T.indexOf("@",y);if(b===-1)break;let k=T.substring(b);if(/^@forelse\s*\(/.test(k))D++,y=b+1;else if(k.startsWith("@endforelse"))D--,y=b+11;else if(D===0&&k.startsWith("@empty")){if(T.length<=b+6||!/[a-z]/i.test(T[b+6])){E=b;break}y=b+1}else y=b+1}if(E===-1)continue;return{start:q,end:I,arrayExpr:V,itemVar:O,foreachContent:T.substring(0,E),emptyContent:T.substring(E+6)}}return null}function mY($,Z){let Y=$;while(!0){let J=EU(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:z}=J;try{let q;if(K0(G))q=W0(G,Object.keys(Z))(...Object.values(Z));else q=$0(G,Z);let U;if(!Array.isArray(q)||q.length===0)U=z;else U=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,X)+U+Y.substring(Q)}catch(q){let U=q instanceof Error?q.message:String(q),j=e("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,X)+j+Y.substring(Q)}}return Y}function b6($,Z,Y,J){let X=$;X=mY(X,Z);function Q(W){let z=/@foreach\s*\(/g,q;while((q=z.exec(W))!==null){let U=q.index,j=q.index+q[0].length-1,_=1,B=j+1,H=-1;while(B<W.length&&_>0){if(W[B]==="(")_++;else if(W[B]===")"){if(_--,_===0){H=B;break}}B++}if(H===-1)continue;let L=W.substring(j+1,H),V=L.indexOf(" as ");if(V===-1)continue;let O=U,F=L.substring(0,V),w=L.substring(V+4),A=H+1,R=1,N=A,M=/@foreach\s*\(/g,T=/@endforeach/g;while(R>0&&N<W.length){M.lastIndex=N,T.lastIndex=N;let I=M.exec(W),E=T.exec(W);if(!E)break;if(I&&I.index<E.index)R++,N=I.index+I[0].length;else{if(R--,R===0){let D=W.substring(A,E.index),y=E.index+11;return{start:O,end:y,arrayExpr:F,itemVar:w,content:D}}N=E.index+11}}}return null}function G(W,z){let q=W;while(!0){let U=Q(q);if(!U)break;let{start:j,end:_,arrayExpr:B,itemVar:H,content:L}=U;try{let V=B.trim(),O;if(K0(V))O=W0(V,Object.keys(z))(...Object.values(z));else O=$0(V,z);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{let E=e("Foreach",`Error in @foreach: ${V} is not iterable`,s.TYPE_ERROR);q=q.substring(0,j)+E+q.substring(_);continue}let w=J?.loops?.useAltLoopVariable??NU,A=H.trim(),R=null,N,M=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1],M=!0;else N=A}else N=A;let T="",I=O;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},b={...z,loop:y,$loop:y};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(D))f.forEach((d,p)=>{if(d)b[d]=D[p]});else b[N]=D}else b[N]=D;if(R)if(!M&&F&&Array.isArray(D)&&D.length===2)b[R]=D[0],b[N]=D[1];else b[R]=E;let k=IU(L,b),v=uY(k);if(v.hasContinue){T+=v.content;continue}let g=dY(k);if(g.hasBreak){T+=g.content;break}if(k=mY(k,b),k=G(k,b),k=n1(k,b,Y),k=DU(k),g=dY(k),g.hasBreak){T+=g.content;break}if(v=uY(k),v.hasContinue){T+=v.content;continue}k=V1(k,b,Y),k=TU(k,b),k=MU(k,b),T+=k}q=q.substring(0,j)+T+q.substring(_)}catch(V){let O=e("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${V instanceof Error?V.message:String(V)}`,s.EVALUATION_ERROR);q=q.substring(0,j)+O+q.substring(_)}}return q}X=G(X,Z),X=cY(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??RU;return X=SU(X,Z,K),X}function lY($){return T$($)}function cY($,Z,Y,J){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,z=x0(X,"(",")",W);if(z===-1)break;let q=X.slice(W+1,z),U=z+1,j=C$(X.slice(K),"for","endfor");if(j.length===0)break;let _=j[0].content,B=K+j[0].end;if(!lY(q)){let H=e("For",`Unsafe expression in @for: ${q}`,s.UNSAFE_EXPRESSION);X=X.substring(0,K)+H+X.substring(B),Q=!0;continue}try{let H=kU(q),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let R=bU({forExpr:q,content:_,iterVarNames:H,context:Z,filePath:Y,options:J});X=X.substring(0,K)+R+X.substring(B),Q=!0;continue}let V=Object.keys(Z),O=Object.values(Z),F=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=pY(F);let A=Function(...V,`
9364
9364
  let result = '';
9365
9365
  for (${q}) {
9366
9366
  result += \`${F}\`;
9367
9367
  }
9368
9368
  return result;
9369
- `)(...O);X=X.substring(0,K)+A+X.substring(B),Q=!0}catch(H){let L=e("For",`Error in @for(${q}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);X=X.substring(0,K)+L+X.substring(B),Q=!0}}return X}function IU($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let Q=Y[1];return Q.slice(1,-1).split(",").map((K)=>{let W=K.trim();if(!W)return"";let z=W.indexOf(":");if(z>=0&&Q.startsWith("{")){let j=W.slice(z+1).trim(),_=j.indexOf("=");return(_>=0?j.slice(0,_):j).trim()}let q=W.indexOf("="),U=(q>=0?W.slice(0,q):W).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(X)return[X[1]];return[]}function DU($){let{forExpr:Z,content:Y,iterVarNames:J,context:X,filePath:Q,options:G}=$,K=Object.keys(X),W=Object.values(X),z=Function(...K,"__pushIter",`
9369
+ `)(...O);X=X.substring(0,K)+A+X.substring(B),Q=!0}catch(H){let L=e("For",`Error in @for(${q}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);X=X.substring(0,K)+L+X.substring(B),Q=!0}}return X}function kU($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let Q=Y[1];return Q.slice(1,-1).split(",").map((K)=>{let W=K.trim();if(!W)return"";let z=W.indexOf(":");if(z>=0&&Q.startsWith("{")){let j=W.slice(z+1).trim(),_=j.indexOf("=");return(_>=0?j.slice(0,_):j).trim()}let q=W.indexOf("="),U=(q>=0?W.slice(0,q):W).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(X)return[X[1]];return[]}function bU($){let{forExpr:Z,content:Y,iterVarNames:J,context:X,filePath:Q,options:G}=$,K=Object.keys(X),W=Object.values(X),z=Function(...K,"__pushIter",`
9370
9370
  for (${Z}) {
9371
9371
  __pushIter([${J.join(", ")}])
9372
9372
  }
9373
- `),q=[];z(...W,(_)=>{q.push(_)});let U=Q??"inline.stx",j="";for(let _ of q){let B={...X};J.forEach((L,V)=>{B[L]=_[V]});let H=pY(Y,B,Q,G);H=i1(H,B,U),H=F1(H,B,U),j+=H}return j}function EU($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,W=x0(J,"(",")",K);if(W===-1)break;let z=J.slice(K+1,W),q=P$(J.slice(G),"while","endwhile");if(q.length===0)break;let U=q[0].content,j=G+q[0].end;if(!mY(z)){let _=e("While",`Unsafe expression in @while: ${z}`,s.UNSAFE_EXPRESSION);J=J.substring(0,G)+_+J.substring(j),X=!0;continue}try{let _=Object.keys(Z),B=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});H=uY(H);let V=Function(..._,`
9373
+ `),q=[];z(...W,(_)=>{q.push(_)});let U=Q??"inline.stx",j="";for(let _ of q){let B={...X};J.forEach((L,V)=>{B[L]=_[V]});let H=cY(Y,B,Q,G);H=n1(H,B,U),H=V1(H,B,U),j+=H}return j}function SU($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,W=x0(J,"(",")",K);if(W===-1)break;let z=J.slice(K+1,W),q=C$(J.slice(G),"while","endwhile");if(q.length===0)break;let U=q[0].content,j=G+q[0].end;if(!lY(z)){let _=e("While",`Unsafe expression in @while: ${z}`,s.UNSAFE_EXPRESSION);J=J.substring(0,G)+_+J.substring(j),X=!0;continue}try{let _=Object.keys(Z),B=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});H=pY(H);let V=Function(..._,`
9374
9374
  let result = '';
9375
9375
  let maxIterations = ${Y}; // Configurable safety limit
9376
9376
  let counter = 0;
@@ -9382,21 +9382,21 @@ ${D}
9382
9382
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
9383
9383
  }
9384
9384
  return result;
9385
- `)(...B);J=J.substring(0,G)+V+J.substring(j),X=!0}catch(_){let B=e("While",`Error in @while(${z}): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR);J=J.substring(0,G)+B+J.substring(j),X=!0}}return J}var VU=1000,wU=!1,r4="<!--__STX_BREAK__-->",a4="<!--__STX_CONTINUE__-->";var b6=S(()=>{x4();W1();Y1();C$();w0()});import _0 from"path";function S6($,Z){let Y=0;for(let J=Z;J<$.length;J++){let X=$[J];if(X==="("||X==="["||X==="{")Y++;else if(X===")"||X==="]"||X==="}")Y--;else if(X===","&&Y===0)return J}return-1}function kU($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=X.exec(J);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,z=K+1;while(z<J.length&&W>0){if(J[z]==="(")W++;else if(J[z]===")")W--;z++}if(W!==0)break;let q=J.substring(K+1,z-1),U=`${Y}(${q})`;J=J.substring(0,G)+U+J.substring(z),X.lastIndex=G+U.length,Q=X.exec(J)}return J}function bU($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function iY($){let Z=$,Y=[],J=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++}},z=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
9386
- `)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},q=()=>{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(!J.has(B))Y.push(B),J.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(!J.has(B))Y.push(B),J.add(B);return}let _=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!J.has(B))Y.push(B),J.add(B)}};while(Q<G){if(z())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])))q();Q++}return Y.join(", ")}function nY($,Z=""){let Y=iY($).split(",").map((J)=>J.trim()).filter(Boolean);return`
9385
+ `)(...B);J=J.substring(0,G)+V+J.substring(j),X=!0}catch(_){let B=e("While",`Error in @while(${z}): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR);J=J.substring(0,G)+B+J.substring(j),X=!0}}return J}var RU=1000,NU=!1,t4="<!--__STX_BREAK__-->",e4="<!--__STX_CONTINUE__-->";var S6=S(()=>{g4();z1();J1();v$();w0()});import _0 from"path";function y6($,Z){let Y=0;for(let J=Z;J<$.length;J++){let X=$[J];if(X==="("||X==="["||X==="{")Y++;else if(X===")"||X==="]"||X==="}")Y--;else if(X===","&&Y===0)return J}return-1}function yU($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=X.exec(J);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,z=K+1;while(z<J.length&&W>0){if(J[z]==="(")W++;else if(J[z]===")")W--;z++}if(W!==0)break;let q=J.substring(K+1,z-1),U=`${Y}(${q})`;J=J.substring(0,G)+U+J.substring(z),X.lastIndex=G+U.length,Q=X.exec(J)}return J}function PU($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function oY($){let Z=$,Y=[],J=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++}},z=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
9386
+ `)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},q=()=>{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(!J.has(B))Y.push(B),J.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(!J.has(B))Y.push(B),J.add(B);return}let _=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!J.has(B))Y.push(B),J.add(B)}};while(Q<G){if(z())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])))q();Q++}return Y.join(", ")}function sY($,Z=""){let Y=oY($).split(",").map((J)=>J.trim()).filter(Boolean);return`
9387
9387
  (function() {
9388
- ${X5("var",Y)}
9388
+ ${Q5("var",Y)}
9389
9389
  var __destroyHooks = [];
9390
9390
  var __origOnDestroy = onDestroy;
9391
9391
  onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
9392
9392
 
9393
9393
  ${$}
9394
9394
  ${Z}})();
9395
- `}function oY($,Z){return`
9395
+ `}function rY($,Z){return`
9396
9396
  // Register scope variables for STX runtime
9397
9397
  if (!window.stx._scopes) window.stx._scopes = {};
9398
9398
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
9399
- ${iY($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
9399
+ ${oY($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
9400
9400
  `)}
9401
9401
  // #1767: when the bundler renamed a component const that collided with an
9402
9402
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -9404,7 +9404,7 @@ ${iY($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
9404
9404
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
9405
9405
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
9406
9406
  window.stx._scopes['${Z}'] = __scopeRegistration;
9407
- `}function SU($,Z){let Y=oY($,Z),J=`
9407
+ `}function CU($,Z){let Y=rY($,Z),J=`
9408
9408
  (function() {
9409
9409
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
9410
9410
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -9413,33 +9413,33 @@ ${iY($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
9413
9413
  } finally {
9414
9414
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
9415
9415
  }
9416
- })();`;return J+nY($,Y)+`
9416
+ })();`;return J+sY($,Y)+`
9417
9417
  } finally {
9418
9418
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
9419
9419
  }
9420
- })();`}function yU($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let X=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function CU($){if($.__onceStore instanceof Set)return $.__onceStore;return PU}async function y6($,Z,Y,J,X,Q=new Set){let G=J.partialsDir||_0.join(_0.dirname(Y),"partials");if(G&&!_0.isAbsolute(G))G=_0.resolve(process.cwd(),G);let K=kU($,"@partial","@include"),W=CU(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,H,L)=>{let V=H.trim(),O=`${Y}:${V}`;if(W.has(O))return"";return W.add(O),H});{let B=/@includeIf\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,V=L+H[0].length-1,O=1,F=V+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let w=K.substring(V+1,F-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){B.lastIndex=F;continue}let R=A[1],N=z(R,G,Y),M="";if(N&&await Bun.file(N).exists())X.add(N),M=`@include(${w})`;K=K.substring(0,L)+M+K.substring(F),B.lastIndex=0}}for(let[B,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),V;while((V=L.exec(K))!==null){let O=V.index,F=O+V[0].length-1,w=1,A=F+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let R=K.substring(F+1,A-1),N=S6(R,0);if(N===-1){L.lastIndex=A;continue}let M=R.substring(0,N).trim(),T=R.substring(N+1).trim(),I=T.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let E=I[1],D=T.substring(I[0].length),y,b=S6(D,0);if(b!==-1)y=D.substring(b+1).trim();try{let k=`Boolean(${M})`,v;if(K0(k)){let d=W0(k,Object.keys(Z));v=Boolean(d(...Object.values(Z)))}else v=Boolean($0(k,Z));let g=H?!v:v,f="";if(g){let d=z(E,G,Y);if(d&&await Bun.file(d).exists())X.add(d);f=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,O)+f+K.substring(A),L.lastIndex=0}catch(k){let v=k instanceof Error?k.message:String(k),g=q0("Include",`Error evaluating ${B} condition: ${v}`,Y,$,O);K=K.substring(0,O)+g+K.substring(A),L.lastIndex=0}}}{let B=/@each\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,V=L+H[0].length-1,O=1,F=V+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let w=K.substring(V+1,F),A=K.substring(L,F+1),R=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){B.lastIndex=0,K=K.replace(A,"");continue}let[,N,M,T,I]=R;try{let E,D=M.trim();if(K0(D))E=W0(D,Object.keys(Z))(...Object.values(Z));else E=$0(D,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let b of E){let k={...Z,[T]:b},v=await U(N,k,$,L);y+=v}else if(I)y=await U(I,{},$,L);K=K.substring(0,L)+y+K.substring(F+1),B.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+q0("Each",`Error in @each: ${D}`,Y,$,L)+K.substring(F+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,V=L+H[0].length-1,O=1,F=V+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let w=K.substring(V+1,F),A=K.substring(L,F+1),R=w.match(/^\s*(\[[^\]]+\])/);if(!R){B.lastIndex=0,K=K.replace(A,"");continue}let N=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,b=1;while(b<M.length&&y>0){if(M[b]==="{")y++;else if(M[b]==="}"){if(y--,y===0)break}b++}T=M.substring(0,b+1),M=M.slice(b+1)}let E,D=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let y=JSON.parse(N.replace(/'/g,'"')),b={};if(T)try{b=T0(T,Z)}catch(v){let g=v instanceof Error?v.message:String(v);if(J.debug){let f=q0("Include",`Error parsing includeFirst variables: ${g}`,Y,$,L,A);K=K.replace(A,()=>f)}else K=K.replace(A,()=>E||"");continue}let k=!1;for(let v of y){let g=z(v,G,Y);if(!g)continue;if(await c(g)){let f=await U(v,b,$,L);K=K.replace(A,()=>f),k=!0;break}}if(!k)if(E!==void 0)K=K.replace(A,()=>E);else if(J.debug){let v=q0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,A);K=K.replace(A,()=>v)}else K=K.replace(A,"")}catch(y){let b=y instanceof Error?y.message:String(y),k=q0("Include",`Error processing @includeFirst: ${b}`,Y,$,L,A);K=K.replace(A,()=>k)}B.lastIndex=0}}function z(B,H,L){try{let V=B;if(!B.endsWith(".stx"))V=`${B}.stx`;let O=_0.resolve(H),F=_0.resolve(_0.dirname(L)),w;if(!V.startsWith("./")&&!V.startsWith("../"))w=_0.resolve(H,V);else w=_0.resolve(F,V);let A=_0.normalize(w),R=A.startsWith(O+_0.sep)||A===O,N=A.startsWith(F+_0.sep)||A===F,M=!1,T=_0.dirname(F);if(A.startsWith(T+_0.sep)){if(!_0.relative(T,A).split(_0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))M=!0}if(!R&&!N&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${F}`),null;return A}catch(V){return console.error(`Error resolving path ${B}: ${V}`),null}}let q=_0.resolve(Y);Q.add(q);async function U(B,H={},L,V){let O=z(B,G,Y);if(!O)return q0("Include",`Could not resolve path for include: ${B}`,Y,L,V);let F=_0.resolve(O);if(Q.has(F)){let w=[...Q,F].map((A)=>_0.basename(A)).join(" -> ");return q0("Include",`Circular include detected: ${w}`,Y,L,V)}try{X.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(f){let d=f instanceof Error?f.message:String(f);return q0("Include",`Error loading include file ${B}: ${d}`,Y,L,V)}if(w&&w.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (t3(),a3));w=f(w,Z)}if(w&&(J.debug||!Z$()&&!M4()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => ($6(),_Y));f(w,O)}catch{}let A=w;try{let{processESImports:f}=await Promise.resolve().then(() => (E6(),fY));await f(w,Z,O,J,X)}catch(f){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let R=k$(A);if(R)A=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>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[f,d]of Object.entries(H))I[f]=d;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(E)],y="",b=null;for(let f of D){let d=f[1]||"",p=f[2]||"",X0=d.includes("server"),Z0=y1(d),V0="";try{let{extractAndStripCssImports:Q0,renderVendorStyleTags:k0}=await Promise.resolve().then(() => (h5(),N9)),n0=Q0(p,{filePath:O,projectRoot:process.cwd()});p=n0.code,V0=k0(n0.styles)}catch(Q0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,Q0 instanceof Error?Q0.message:Q0)}if(Z0&&p.trim())p=P1(p);if(!X0)try{let{hasUserImports:Q0,bundleClientScript:k0}=await Promise.resolve().then(() => (v5(),C5));if(Q0(p))p=await k0(p,O,{projectRoot:process.cwd()})}catch(Q0){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,Q0 instanceof Error?Q0.message:Q0)}let r=bU(p);if(r&&!X0){b=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++cY}`;let Q0=s0(p),k0=SU(Q0,b);y+=`${V0}<script data-stx-scoped>${k0}</script>
9421
- `;continue}if(X0)try{let{extractVariables:Q0}=await Promise.resolve().then(() => (o5(),y$));await Q0(p,I,O)}catch(Q0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Q0)}if(!X0&&!r){let Q0=d.replace(/\bclient\b/i,"").trim();b=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++cY}`;let k0=s0(p),n0=oY(k0,b),j1=nY(k0,n0);y+=`${V0}<script data-stx-scoped${Q0?` ${Q0}`:""}>${j1}</script>
9422
- `}}if(b){let f=yU(A,b);if(A=f.html,f.mergedIntoExisting)y=y.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await y6(A,I,O,J,X,Q);let{processLoops:k}=await Promise.resolve().then(() => (b6(),lY)),v=k(A,I,O);v=i1(v,I,O);let g=J5(w);if(v=F1(v,I,O,{forceSignals:g}),T)v+=`
9420
+ })();`}function vU($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let X=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function fU($){if($.__onceStore instanceof Set)return $.__onceStore;return xU}async function P6($,Z,Y,J,X,Q=new Set){let G=J.partialsDir||_0.join(_0.dirname(Y),"partials");if(G&&!_0.isAbsolute(G))G=_0.resolve(process.cwd(),G);let K=yU($,"@partial","@include"),W=fU(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,H,L)=>{let V=H.trim(),O=`${Y}:${V}`;if(W.has(O))return"";return W.add(O),H});{let B=/@includeIf\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,V=L+H[0].length-1,O=1,F=V+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let w=K.substring(V+1,F-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){B.lastIndex=F;continue}let R=A[1],N=z(R,G,Y),M="";if(N&&await Bun.file(N).exists())X.add(N),M=`@include(${w})`;K=K.substring(0,L)+M+K.substring(F),B.lastIndex=0}}for(let[B,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),V;while((V=L.exec(K))!==null){let O=V.index,F=O+V[0].length-1,w=1,A=F+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let R=K.substring(F+1,A-1),N=y6(R,0);if(N===-1){L.lastIndex=A;continue}let M=R.substring(0,N).trim(),T=R.substring(N+1).trim(),I=T.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let E=I[1],D=T.substring(I[0].length),y,b=y6(D,0);if(b!==-1)y=D.substring(b+1).trim();try{let k=`Boolean(${M})`,v;if(K0(k)){let d=W0(k,Object.keys(Z));v=Boolean(d(...Object.values(Z)))}else v=Boolean($0(k,Z));let g=H?!v:v,f="";if(g){let d=z(E,G,Y);if(d&&await Bun.file(d).exists())X.add(d);f=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,O)+f+K.substring(A),L.lastIndex=0}catch(k){let v=k instanceof Error?k.message:String(k),g=q0("Include",`Error evaluating ${B} condition: ${v}`,Y,$,O);K=K.substring(0,O)+g+K.substring(A),L.lastIndex=0}}}{let B=/@each\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,V=L+H[0].length-1,O=1,F=V+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let w=K.substring(V+1,F),A=K.substring(L,F+1),R=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){B.lastIndex=0,K=K.replace(A,"");continue}let[,N,M,T,I]=R;try{let E,D=M.trim();if(K0(D))E=W0(D,Object.keys(Z))(...Object.values(Z));else E=$0(D,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let b of E){let k={...Z,[T]:b},v=await U(N,k,$,L);y+=v}else if(I)y=await U(I,{},$,L);K=K.substring(0,L)+y+K.substring(F+1),B.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+q0("Each",`Error in @each: ${D}`,Y,$,L)+K.substring(F+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,V=L+H[0].length-1,O=1,F=V+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let w=K.substring(V+1,F),A=K.substring(L,F+1),R=w.match(/^\s*(\[[^\]]+\])/);if(!R){B.lastIndex=0,K=K.replace(A,"");continue}let N=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,b=1;while(b<M.length&&y>0){if(M[b]==="{")y++;else if(M[b]==="}"){if(y--,y===0)break}b++}T=M.substring(0,b+1),M=M.slice(b+1)}let E,D=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let y=JSON.parse(N.replace(/'/g,'"')),b={};if(T)try{b=T0(T,Z)}catch(v){let g=v instanceof Error?v.message:String(v);if(J.debug){let f=q0("Include",`Error parsing includeFirst variables: ${g}`,Y,$,L,A);K=K.replace(A,()=>f)}else K=K.replace(A,()=>E||"");continue}let k=!1;for(let v of y){let g=z(v,G,Y);if(!g)continue;if(await c(g)){let f=await U(v,b,$,L);K=K.replace(A,()=>f),k=!0;break}}if(!k)if(E!==void 0)K=K.replace(A,()=>E);else if(J.debug){let v=q0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,A);K=K.replace(A,()=>v)}else K=K.replace(A,"")}catch(y){let b=y instanceof Error?y.message:String(y),k=q0("Include",`Error processing @includeFirst: ${b}`,Y,$,L,A);K=K.replace(A,()=>k)}B.lastIndex=0}}function z(B,H,L){try{let V=B;if(!B.endsWith(".stx"))V=`${B}.stx`;let O=_0.resolve(H),F=_0.resolve(_0.dirname(L)),w;if(!V.startsWith("./")&&!V.startsWith("../"))w=_0.resolve(H,V);else w=_0.resolve(F,V);let A=_0.normalize(w),R=A.startsWith(O+_0.sep)||A===O,N=A.startsWith(F+_0.sep)||A===F,M=!1,T=_0.dirname(F);if(A.startsWith(T+_0.sep)){if(!_0.relative(T,A).split(_0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))M=!0}if(!R&&!N&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${F}`),null;return A}catch(V){return console.error(`Error resolving path ${B}: ${V}`),null}}let q=_0.resolve(Y);Q.add(q);async function U(B,H={},L,V){let O=z(B,G,Y);if(!O)return q0("Include",`Could not resolve path for include: ${B}`,Y,L,V);let F=_0.resolve(O);if(Q.has(F)){let w=[...Q,F].map((A)=>_0.basename(A)).join(" -> ");return q0("Include",`Circular include detected: ${w}`,Y,L,V)}try{X.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(f){let d=f instanceof Error?f.message:String(f);return q0("Include",`Error loading include file ${B}: ${d}`,Y,L,V)}if(w&&w.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (e3(),t3));w=f(w,Z)}if(w&&(J.debug||!Y$()&&!T4()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (Z6(),HY));f(w,O)}catch{}let A=w;try{let{processESImports:f}=await Promise.resolve().then(() => (k6(),hY));await f(w,Z,O,J,X)}catch(f){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let R=b$(A);if(R)A=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>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[f,d]of Object.entries(H))I[f]=d;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(E)],y="",b=null;for(let f of D){let d=f[1]||"",p=f[2]||"",X0=d.includes("server"),Z0=P1(d),V0="";try{let{extractAndStripCssImports:Q0,renderVendorStyleTags:k0}=await Promise.resolve().then(() => (d5(),M9)),n0=Q0(p,{filePath:O,projectRoot:process.cwd()});p=n0.code,V0=k0(n0.styles)}catch(Q0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,Q0 instanceof Error?Q0.message:Q0)}if(Z0&&p.trim())p=C1(p);if(!X0)try{let{hasUserImports:Q0,bundleClientScript:k0}=await Promise.resolve().then(() => (x5(),v5));if(Q0(p))p=await k0(p,O,{projectRoot:process.cwd()})}catch(Q0){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,Q0 instanceof Error?Q0.message:Q0)}let r=PU(p);if(r&&!X0){b=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++nY}`;let Q0=s0(p),k0=CU(Q0,b);y+=`${V0}<script data-stx-scoped>${k0}</script>
9421
+ `;continue}if(X0)try{let{extractVariables:Q0}=await Promise.resolve().then(() => (s5(),P$));await Q0(p,I,O)}catch(Q0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Q0)}if(!X0&&!r){let Q0=d.replace(/\bclient\b/i,"").trim();b=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++nY}`;let k0=s0(p),n0=rY(k0,b),_1=sY(k0,n0);y+=`${V0}<script data-stx-scoped${Q0?` ${Q0}`:""}>${_1}</script>
9422
+ `}}if(b){let f=vU(A,b);if(A=f.html,f.mergedIntoExisting)y=y.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await P6(A,I,O,J,X,Q);let{processLoops:k}=await Promise.resolve().then(() => (S6(),iY)),v=k(A,I,O);v=n1(v,I,O);let g=X5(w);if(v=V1(v,I,O,{forceSignals:g}),T)v+=`
9423
9423
  `+T;if(y)v+=`
9424
- `+y;return v}catch(w){let A=w instanceof Error?w.message:String(w);return q0("Include",`Error processing include ${B}: ${A}`,Y,L,V)}}let j=/@include\s*\(/g,_;while((_=j.exec(K))!==null){let B=_.index,H=B+_[0].length-1,L=1,V=H+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let O=K.substring(B,V),F=K.substring(H+1,V-1),w=F.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=V;continue}let A=w[1],R,N=F.substring(w[0].length),M=S6(N,0);if(M!==-1)R=N.substring(M+1).trim();let T={};if(R)try{T=T0(R,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(O,q0("Include",`Error parsing include variables for ${A}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let I=await U(A,T,$,B);K=K.substring(0,B)+I+K.substring(V),j.lastIndex=0}return K}function P6($,Z){let Y=$;function J(X,Q,G,K){let W=X,z=!0;while(z){z=!1;let q=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=W.match(q);if(!U||U.index===void 0)break;let j=U.index,_=U[1],B=j+U[0].length,H=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),V=1,O=B,F=-1;while(V>0&&O<W.length){let A=W.slice(O),R=A.match(H),N=A.match(L),M=R?O+R.index:1/0,T=N?O+N.index:1/0;if(M<T)V++,O=M+(R[0].length||1);else if(T<1/0){if(V--,V===0){F=T;break}O=T+G.length+1}else break}if(F===-1)break;let w=W.slice(B,F);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(w);else Z[_].push(w);W=W.substring(0,j)+W.substring(F+`@${G}`.length),z=!0}return W}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function C6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
9425
- `)})}var cY=0,ow,PU;var sY=S(()=>{F7();x4();Y1();l5();K5();w0();M0();ow=new v1(500),PU=new Set});import*as v6 from"path";async function rY($,Z,Y=""){if(v6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return tY($,Z,Y,"@js","@endjs")}async function aY($,Z,Y=""){if(v6.basename(Y)==="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 tY($,Z,Y,"@ts","@endts")}async function tY($,Z,Y,J,X){let Q=$,G=G5(`${J}([\\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:z,content:q,index:U}of K)try{let j=Object.keys(Z),_=Object.values(Z),B=q.trim();if(J==="@ts")B=B.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(B.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),V=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
9424
+ `+y;return v}catch(w){let A=w instanceof Error?w.message:String(w);return q0("Include",`Error processing include ${B}: ${A}`,Y,L,V)}}let j=/@include\s*\(/g,_;while((_=j.exec(K))!==null){let B=_.index,H=B+_[0].length-1,L=1,V=H+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let O=K.substring(B,V),F=K.substring(H+1,V-1),w=F.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=V;continue}let A=w[1],R,N=F.substring(w[0].length),M=y6(N,0);if(M!==-1)R=N.substring(M+1).trim();let T={};if(R)try{T=T0(R,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(O,q0("Include",`Error parsing include variables for ${A}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let I=await U(A,T,$,B);K=K.substring(0,B)+I+K.substring(V),j.lastIndex=0}return K}function C6($,Z){let Y=$;function J(X,Q,G,K){let W=X,z=!0;while(z){z=!1;let q=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=W.match(q);if(!U||U.index===void 0)break;let j=U.index,_=U[1],B=j+U[0].length,H=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),V=1,O=B,F=-1;while(V>0&&O<W.length){let A=W.slice(O),R=A.match(H),N=A.match(L),M=R?O+R.index:1/0,T=N?O+N.index:1/0;if(M<T)V++,O=M+(R[0].length||1);else if(T<1/0){if(V--,V===0){F=T;break}O=T+G.length+1}else break}if(F===-1)break;let w=W.slice(B,F);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(w);else Z[_].push(w);W=W.substring(0,j)+W.substring(F+`@${G}`.length),z=!0}return W}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function v6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
9425
+ `)})}var nY=0,aw,xU;var aY=S(()=>{w7();g4();J1();c5();W5();w0();M0();aw=new x1(500),xU=new Set});import*as x6 from"path";async function tY($,Z,Y=""){if(x6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return $J($,Z,Y,"@js","@endjs")}async function eY($,Z,Y=""){if(x6.basename(Y)==="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 $J($,Z,Y,"@ts","@endts")}async function $J($,Z,Y,J,X){let Q=$,G=K5(`${J}([\\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:z,content:q,index:U}of K)try{let j=Object.keys(Z),_=Object.values(Z),B=q.trim();if(J==="@ts")B=B.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(B.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),V=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
9426
9426
  ${B}
9427
9427
  ${V}
9428
- `,w=Function(...j,O)(..._);if(w&&typeof w==="object")Object.assign(Z,w);Q=Q.replace(z,"")}catch(j){console.error(`Error executing ${J} code block in ${Y}:`,j);let _=j instanceof Error?j.message:String(j),B=q0(`${J} Directive`,`Error executing code: ${_}`,Y,$,U,z);console.error(B),Q=Q.replace(z,"")}return Q}var eY=S(()=>{K5();M0()});function vU($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function $J($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return vU(J,Q||"_method")})}async function ZJ($,Z,Y,J,X){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.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(J.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,J);if(typeof W==="string")Q=W;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(J.debug)console.error(`Error in middleware ${K.name}:`,W);if(J.debug){let z=q0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
9428
+ `,w=Function(...j,O)(..._);if(w&&typeof w==="object")Object.assign(Z,w);Q=Q.replace(z,"")}catch(j){console.error(`Error executing ${J} code block in ${Y}:`,j);let _=j instanceof Error?j.message:String(j),B=q0(`${J} Directive`,`Error executing code: ${_}`,Y,$,U,z);console.error(B),Q=Q.replace(z,"")}return Q}var ZJ=S(()=>{W5();M0()});function gU($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function YJ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return gU(J,Q||"_method")})}async function JJ($,Z,Y,J,X){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.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(J.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,J);if(typeof W==="string")Q=W;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(J.debug)console.error(`Error in middleware ${K.name}:`,W);if(J.debug){let z=q0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
9429
9429
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${r0(z)}</div>
9430
- `)}}}return Q}async function YJ($,Z,Y,J){return ZJ($,Z,Y,J,"before")}async function JJ($,Z,Y,J){return ZJ($,Z,Y,J,"after")}var XJ=S(()=>{Y1();M0()});import{defineRoute as KA,defineRoutes as WA,resetRoutes as zA,route as qA,setAppUrl as UA}from"stx-router";import{route as xU}from"stx-router";function QJ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?T0(X,{}):{};return xU(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var GJ=S(()=>{w0()});async function KJ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(B$.exact[$])for(let J of B$.exact[$])await Promise.resolve(J(Z,$));if(B$.exact[Y])for(let J of B$.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of B$.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var B$;var WJ=S(()=>{B$={patterns:[],exact:{}}});function zJ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>zJ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function qJ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(z){return X.some(([q,U])=>z>=q&&z<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let z=Q[0],q=Q[2];if(!q||!q.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,_=q,B=!1;while((j=U.exec(q))!==null){let H=j[1],L=j[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let V=Object.keys(Z),O=Object.values(Z),F=L.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!V.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...V,`return (${L})`)(...O);if(H==="class"){let R=zJ(A);if(R){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${R}"`);else _=_.replace(j[0],` class="${R}"`)}else _=_.replace(j[0],"");B=!0;continue}if(fU.has(H)){if(A)_=_.replace(j[0],` ${H}`);else _=_.replace(j[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(j[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(j[0],` ${H}="${R}"`)}B=!0}catch{continue}}if(B){let H=z.endsWith("/>")?" /":"",V=`<${Q[1]}${_}${H}>`;W.push({start:Q.index,end:Q.index+z.length,replacement:V})}}for(let z=W.length-1;z>=0;z--){let{start:q,end:U,replacement:j}=W[z];Y=Y.slice(0,q)+j+Y.slice(U)}return Y}var fU;var UJ=S(()=>{fU=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function s1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;let X=/\/\s*>$/.test(J[0])||gU.has(J[1].toLowerCase()),Q=X?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:X,start:J.index,end:J.index+J[0].length}}function dU($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>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)J++,X=K.index+K[0].length;else{if(J--,J===0)return W.index+W[0].length;X=W.index+W[0].length}}return-1}function X1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=dU($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function jJ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function A5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function T1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function I1($,Z,Y){let J=Z.selfClosing?" /":"",X=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function uU($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function mU($){let Z=$,Y=0;while(Y<Z.length){let J=s1(Z,Y);if(!J)break;let X=A5(J.attrs,"v-for");if(X===null){Y=J.end;continue}let Q=X.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=J.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let L=G.split(",").map((F)=>F.trim()),V=L[0],O=L[1];W=`${K} as ${O} => ${V}`}else W=`${K} as ${G}`;let z=T1(J.attrs,"v-for"),q=T1(z,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=X1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),_=I1(j,{...J,start:0,end:J.end-J.start},q),B=`@foreach(${W})
9430
+ `)}}}return Q}async function XJ($,Z,Y,J){return JJ($,Z,Y,J,"before")}async function QJ($,Z,Y,J){return JJ($,Z,Y,J,"after")}var GJ=S(()=>{J1();M0()});import{defineRoute as qA,defineRoutes as UA,resetRoutes as jA,route as _A,setAppUrl as BA}from"stx-router";import{route as hU}from"stx-router";function KJ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?T0(X,{}):{};return hU(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var WJ=S(()=>{w0()});async function zJ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(H$.exact[$])for(let J of H$.exact[$])await Promise.resolve(J(Z,$));if(H$.exact[Y])for(let J of H$.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of H$.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var H$;var qJ=S(()=>{H$={patterns:[],exact:{}}});function UJ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>UJ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function jJ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(z){return X.some(([q,U])=>z>=q&&z<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let z=Q[0],q=Q[2];if(!q||!q.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,_=q,B=!1;while((j=U.exec(q))!==null){let H=j[1],L=j[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let V=Object.keys(Z),O=Object.values(Z),F=L.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!V.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...V,`return (${L})`)(...O);if(H==="class"){let R=UJ(A);if(R){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${R}"`);else _=_.replace(j[0],` class="${R}"`)}else _=_.replace(j[0],"");B=!0;continue}if(dU.has(H)){if(A)_=_.replace(j[0],` ${H}`);else _=_.replace(j[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(j[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(j[0],` ${H}="${R}"`)}B=!0}catch{continue}}if(B){let H=z.endsWith("/>")?" /":"",V=`<${Q[1]}${_}${H}>`;W.push({start:Q.index,end:Q.index+z.length,replacement:V})}}for(let z=W.length-1;z>=0;z--){let{start:q,end:U,replacement:j}=W[z];Y=Y.slice(0,q)+j+Y.slice(U)}return Y}var dU;var _J=S(()=>{dU=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function r1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;let X=/\/\s*>$/.test(J[0])||uU.has(J[1].toLowerCase()),Q=X?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:X,start:J.index,end:J.index+J[0].length}}function pU($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>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)J++,X=K.index+K[0].length;else{if(J--,J===0)return W.index+W[0].length;X=W.index+W[0].length}}return-1}function Q1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=pU($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function BJ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function R5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function I1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function D1($,Z,Y){let J=Z.selfClosing?" /":"",X=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function lU($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function cU($){let Z=$,Y=0;while(Y<Z.length){let J=r1(Z,Y);if(!J)break;let X=R5(J.attrs,"v-for");if(X===null){Y=J.end;continue}let Q=X.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=J.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let L=G.split(",").map((F)=>F.trim()),V=L[0],O=L[1];W=`${K} as ${O} => ${V}`}else W=`${K} as ${G}`;let z=I1(J.attrs,"v-for"),q=I1(z,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=Q1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),_=D1(j,{...J,start:0,end:J.end-J.start},q),B=`@foreach(${W})
9431
9431
  `,H=`${B}${_}
9432
- @endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+B.length}return Z}function pU($){let Z=$,Y=0;while(Y<Z.length){let J=s1(Z,Y);if(!J)break;let X=A5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=X1(Z,J),K=T1(J.attrs,"v-if"),W=I1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},K);Q.push({type:"if",expr:X,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:J});let z=G.outerEnd,q=!0;while(q){let H=Z.slice(z).match(/^\s*/),L=H?H[0].length:0,V=s1(Z,z+L);if(!V){q=!1;break}let O=A5(V.attrs,"v-else-if"),F=jJ(V.attrs,"v-else");if(O!==null){let w=X1(Z,V),A=T1(V.attrs,"v-else-if"),R=I1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},A);Q.push({type:"else-if",expr:O,outerStart:z,outerEnd:w.outerEnd,element:R,parsedTag:V}),z=w.outerEnd}else if(F){let w=X1(Z,V),A=T1(V.attrs,"v-else"),R=I1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},A);Q.push({type:"else",outerStart:z,outerEnd:w.outerEnd,element:R,parsedTag:V}),q=!1}else q=!1}let U=[];for(let H of Q)if(H.type==="if")U.push(`@if(${H.expr})
9432
+ @endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+B.length}return Z}function iU($){let Z=$,Y=0;while(Y<Z.length){let J=r1(Z,Y);if(!J)break;let X=R5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=Q1(Z,J),K=I1(J.attrs,"v-if"),W=D1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},K);Q.push({type:"if",expr:X,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:J});let z=G.outerEnd,q=!0;while(q){let H=Z.slice(z).match(/^\s*/),L=H?H[0].length:0,V=r1(Z,z+L);if(!V){q=!1;break}let O=R5(V.attrs,"v-else-if"),F=BJ(V.attrs,"v-else");if(O!==null){let w=Q1(Z,V),A=I1(V.attrs,"v-else-if"),R=D1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},A);Q.push({type:"else-if",expr:O,outerStart:z,outerEnd:w.outerEnd,element:R,parsedTag:V}),z=w.outerEnd}else if(F){let w=Q1(Z,V),A=I1(V.attrs,"v-else"),R=D1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},A);Q.push({type:"else",outerStart:z,outerEnd:w.outerEnd,element:R,parsedTag:V}),q=!1}else q=!1}let U=[];for(let H of Q)if(H.type==="if")U.push(`@if(${H.expr})
9433
9433
  ${H.element}`);else if(H.type==="else-if")U.push(`@elseif(${H.expr})
9434
9434
  ${H.element}`);else U.push(`@else
9435
9435
  ${H.element}`);U.push("@endif");let j=U.join(`
9436
- `),_=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,_)+j+Z.slice(B),Y=_+j.length}return Z}function lU($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function cU($){let Z=$,Y=0;while(Y<Z.length){let J=s1(Z,Y);if(!J)break;let X=J.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 q=K[1],U=K[2],j=K[3];X=X.replace(K[0],""),X+=` :${q}="${j}" @update:${q}="${j} = $event"`,K=X.match(G)}if(Q){let q=X1(Z,J),U=Z.slice(q.outerStart,q.outerEnd),j=I1(U,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,q.outerStart)+j+Z.slice(q.outerEnd),Y=q.outerStart+j.length;continue}let W=A5(J.attrs,"v-model");if(W===null){Y=J.end;continue}if(hU.has(J.tag.toLowerCase())){let q=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,U=X1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),_=I1(j,{...J,start:0,end:J.end-J.start},q);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}else{let q=J.attrs.replace(/\s*v-model="[^"]*"/g,"");q+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let U=X1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),_=I1(j,{...J,start:0,end:J.end-J.start},q);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}}return Z}function iU($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function nU($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function oU($){let Z=$,Y=0;while(Y<Z.length){let J=s1(Z,Y);if(!J)break;let X=A5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=X1(Z,J),G=T1(J.attrs,"v-html"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{!! ${X} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function sU($){let Z=$,Y=0;while(Y<Z.length){let J=s1(Z,Y);if(!J)break;let X=A5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=X1(Z,J),G=T1(J.attrs,"v-text"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{{ ${X} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function rU($){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 aU($){let Z=$,Y=0;while(Y<Z.length){let J=s1(Z,Y);if(!J)break;if(!jJ(J.attrs,"v-once")){Y=J.end;continue}let X=T1(J.attrs,"v-once"),Q=X1(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
9437
- ${I1(G,{...J,start:0,end:J.end-J.start},X)}
9438
- @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function tU($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function eU($){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 _J($){if(!uU($))return $;let Z=$;return Z=mU(Z),Z=pU(Z),Z=aU(Z),Z=iU(Z),Z=nU(Z),Z=cU(Z),Z=lU(Z),Z=eU(Z),Z=oU(Z),Z=sU(Z),Z=rU(Z),Z=tU(Z),Z}var gU,hU;var BJ=S(()=>{gU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),hU=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 t4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function HJ($,Z,Y,J,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 z=K.length-1;z>=0;z--){let q=K[z];try{let U=$0(q.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${t4(q.expr)}" -->`;Q=Q.slice(0,q.index)+O+Q.slice(q.index+q.full.length);continue}let j=q.attrs.trim(),_={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=B.exec(j))!==null){let O=H[1]||H[2],F=H[3];if(H[1])try{_[O]=$0(F,Z)}catch{_[O]=F}else _[O]=F}let L=J.componentsDir||"components",V=await d1(U,_,q.slotContent,L,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,q.index)+V+Q.slice(q.index+q.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${t4(j)} -->`;Q=Q.slice(0,q.index)+_+Q.slice(q.index+q.full.length)}}return Q=await $j(Q,Z,Y,J,X),Q}async function $j($,Z,Y,J,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 z=K.length-1;z>=0;z--){let q=K[z];try{let U=$0(q.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${t4(q.expr)}" -->`;Q=Q.slice(0,q.index)+B+Q.slice(q.index+q.full.length);continue}let j=J.componentsDir||"components",_=await d1(U,{},"",j,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,q.index)+_+Q.slice(q.index+q.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${t4(j)} -->`;Q=Q.slice(0,q.index)+_+Q.slice(q.index+q.full.length)}}return Q}var OJ=S(()=>{M0();w0()});function LJ($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
9439
- ${$.slice(Z)}`}function Zj($){let Z=[],Y=0;while(Y<$.length){let Q=$.slice(Y),G=Q.match(/^\s+/);if(G){Y+=G[0].length;continue}if(Q.startsWith("<!--")){let U=$.indexOf("-->",Y);if(U===-1)break;Y=U+3;continue}let K=Q.match(/^<script\b[^>]*>/i);if(K){let U=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(U===-1)break;Y=U+9;continue}let W=Q.match(/^<link\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let z=Q.match(/^<meta\b[^>]*>/i);if(z){Z.push(z[0]),Y+=z[0].length;continue}let q=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",X=0;while(X<$.length&&X<Y){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}J+=$[X],X++}return J+=$.slice(Y),{body:J,hoisted:Z}}function Yj($,Z={},Y={}){let{title:J="stx App",lang:X="en",meta:Q=[],link:G=[],script:K=[],headRaw:W="",bodyClass:z="",bodyAttrs:q={}}=Z,U=Y.title||J,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...Q].map((N)=>{return` <meta ${Object.entries(N).map(([T,I])=>`${T}="${I}"`).join(" ")}>`}).join(`
9436
+ `),_=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,_)+j+Z.slice(B),Y=_+j.length}return Z}function nU($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function oU($){let Z=$,Y=0;while(Y<Z.length){let J=r1(Z,Y);if(!J)break;let X=J.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 q=K[1],U=K[2],j=K[3];X=X.replace(K[0],""),X+=` :${q}="${j}" @update:${q}="${j} = $event"`,K=X.match(G)}if(Q){let q=Q1(Z,J),U=Z.slice(q.outerStart,q.outerEnd),j=D1(U,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,q.outerStart)+j+Z.slice(q.outerEnd),Y=q.outerStart+j.length;continue}let W=R5(J.attrs,"v-model");if(W===null){Y=J.end;continue}if(mU.has(J.tag.toLowerCase())){let q=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,U=Q1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),_=D1(j,{...J,start:0,end:J.end-J.start},q);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}else{let q=J.attrs.replace(/\s*v-model="[^"]*"/g,"");q+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let U=Q1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),_=D1(j,{...J,start:0,end:J.end-J.start},q);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}}return Z}function sU($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function rU($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function aU($){let Z=$,Y=0;while(Y<Z.length){let J=r1(Z,Y);if(!J)break;let X=R5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=Q1(Z,J),G=I1(J.attrs,"v-html"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{!! ${X} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function tU($){let Z=$,Y=0;while(Y<Z.length){let J=r1(Z,Y);if(!J)break;let X=R5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=Q1(Z,J),G=I1(J.attrs,"v-text"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{{ ${X} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function eU($){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 $j($){let Z=$,Y=0;while(Y<Z.length){let J=r1(Z,Y);if(!J)break;if(!BJ(J.attrs,"v-once")){Y=J.end;continue}let X=I1(J.attrs,"v-once"),Q=Q1(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
9437
+ ${D1(G,{...J,start:0,end:J.end-J.start},X)}
9438
+ @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function Zj($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Yj($){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 HJ($){if(!lU($))return $;let Z=$;return Z=cU(Z),Z=iU(Z),Z=$j(Z),Z=sU(Z),Z=rU(Z),Z=oU(Z),Z=nU(Z),Z=Yj(Z),Z=aU(Z),Z=tU(Z),Z=eU(Z),Z=Zj(Z),Z}var uU,mU;var OJ=S(()=>{uU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),mU=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 $7($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function LJ($,Z,Y,J,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 z=K.length-1;z>=0;z--){let q=K[z];try{let U=$0(q.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${$7(q.expr)}" -->`;Q=Q.slice(0,q.index)+O+Q.slice(q.index+q.full.length);continue}let j=q.attrs.trim(),_={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=B.exec(j))!==null){let O=H[1]||H[2],F=H[3];if(H[1])try{_[O]=$0(F,Z)}catch{_[O]=F}else _[O]=F}let L=J.componentsDir||"components",V=await u1(U,_,q.slotContent,L,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,q.index)+V+Q.slice(q.index+q.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${$7(j)} -->`;Q=Q.slice(0,q.index)+_+Q.slice(q.index+q.full.length)}}return Q=await Jj(Q,Z,Y,J,X),Q}async function Jj($,Z,Y,J,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 z=K.length-1;z>=0;z--){let q=K[z];try{let U=$0(q.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${$7(q.expr)}" -->`;Q=Q.slice(0,q.index)+B+Q.slice(q.index+q.full.length);continue}let j=J.componentsDir||"components",_=await u1(U,{},"",j,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,q.index)+_+Q.slice(q.index+q.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${$7(j)} -->`;Q=Q.slice(0,q.index)+_+Q.slice(q.index+q.full.length)}}return Q}var FJ=S(()=>{M0();w0()});function VJ($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
9439
+ ${$.slice(Z)}`}function Xj($){let Z=[],Y=0;while(Y<$.length){let Q=$.slice(Y),G=Q.match(/^\s+/);if(G){Y+=G[0].length;continue}if(Q.startsWith("<!--")){let U=$.indexOf("-->",Y);if(U===-1)break;Y=U+3;continue}let K=Q.match(/^<script\b[^>]*>/i);if(K){let U=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(U===-1)break;Y=U+9;continue}let W=Q.match(/^<link\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let z=Q.match(/^<meta\b[^>]*>/i);if(z){Z.push(z[0]),Y+=z[0].length;continue}let q=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",X=0;while(X<$.length&&X<Y){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}J+=$[X],X++}return J+=$.slice(Y),{body:J,hoisted:Z}}function Qj($,Z={},Y={}){let{title:J="stx App",lang:X="en",meta:Q=[],link:G=[],script:K=[],headRaw:W="",bodyClass:z="",bodyAttrs:q={}}=Z,U=Y.title||J,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...Q].map((N)=>{return` <meta ${Object.entries(N).map(([T,I])=>`${T}="${I}"`).join(" ")}>`}).join(`
9440
9440
  `),H=G.map((N)=>{return` <link ${Object.entries(N).map(([T,I])=>`${T}="${I}"`).join(" ")}>`}).join(`
9441
9441
  `),L=K.map((N)=>{if(N.src)return` <script ${Object.entries(N).filter(([T])=>T!=="content").map(([T,I])=>`${T}="${I}"`).join(" ")}></script>`;if(N.content)return` <script>${N.content}</script>`;return""}).filter(Boolean).join(`
9442
- `),V=Object.entries(q).map(([N,M])=>` ${N}="${M}"`).join(""),O=z?` class="${z}"`:"",{body:F,hoisted:w}=Zj($),A=[B,` <title>${U}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,W?` ${W}`:"",...(Y.styles||[]).map((N)=>` ${N}`),...w.map((N)=>` ${N}`),...(Y.headScripts||[]).map((N)=>` ${N}`),Y.headStack||""].filter(Boolean),R=[F,...(Y.bodyScripts||[]).map((N)=>N),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
9442
+ `),V=Object.entries(q).map(([N,M])=>` ${N}="${M}"`).join(""),O=z?` class="${z}"`:"",{body:F,hoisted:w}=Xj($),A=[B,` <title>${U}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,W?` ${W}`:"",...(Y.styles||[]).map((N)=>` ${N}`),...w.map((N)=>` ${N}`),...(Y.headScripts||[]).map((N)=>` ${N}`),Y.headStack||""].filter(Boolean),R=[F,...(Y.bodyScripts||[]).map((N)=>N),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
9443
9443
  <html lang="${X}">
9444
9444
  <head>
9445
9445
  ${A.join(`
@@ -9449,33 +9449,33 @@ ${A.join(`
9449
9449
  ${R.join(`
9450
9450
  `)}
9451
9451
  </body>
9452
- </html>`}function x6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function FJ($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:X=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),W=[];for(let z of J){let q=z.name?`name="${z.name}"`:z.property?`property="${z.property}"`:z.charset!=null?"charset=":z["http-equiv"]?`http-equiv="${z["http-equiv"]}"`:"";if(q&&K.includes(q))continue;W.push(` <meta ${Object.entries(z).map(([U,j])=>`${U}="${j}"`).join(" ")}>`)}for(let z of X){if(z.href&&K.includes(`href="${z.href}"`))continue;W.push(` <link ${Object.entries(z).map(([q,U])=>`${q}="${U}"`).join(" ")}>`)}for(let z of Q)if(z.src){if(K.includes(`src="${z.src}"`))continue;W.push(` <script ${Object.entries(z).filter(([q])=>q!=="content").map(([q,U])=>`${q}="${U}"`).join(" ")}></script>`)}else if(z.content){if(K.includes(z.content))continue;W.push(` <script>${z.content}</script>`)}if(G&&!K.includes(G))W.push(` ${G}`);if(W.length===0)return $;return`${$.slice(0,Y)}${W.join(`
9452
+ </html>`}function f6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function wJ($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:X=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),W=[];for(let z of J){let q=z.name?`name="${z.name}"`:z.property?`property="${z.property}"`:z.charset!=null?"charset=":z["http-equiv"]?`http-equiv="${z["http-equiv"]}"`:"";if(q&&K.includes(q))continue;W.push(` <meta ${Object.entries(z).map(([U,j])=>`${U}="${j}"`).join(" ")}>`)}for(let z of X){if(z.href&&K.includes(`href="${z.href}"`))continue;W.push(` <link ${Object.entries(z).map(([q,U])=>`${q}="${U}"`).join(" ")}>`)}for(let z of Q)if(z.src){if(K.includes(`src="${z.src}"`))continue;W.push(` <script ${Object.entries(z).filter(([q])=>q!=="content").map(([q,U])=>`${q}="${U}"`).join(" ")}></script>`)}else if(z.content){if(K.includes(z.content))continue;W.push(` <script>${z.content}</script>`)}if(G&&!K.includes(G))W.push(` ${G}`);if(W.length===0)return $;return`${$.slice(0,Y)}${W.join(`
9453
9453
  `)}
9454
- ${$.slice(Y)}`}function VJ($,Z={},Y={}){if(x6($))return $;return Yj($,Z,Y)}import R5 from"path";function wJ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function AJ($,Z,Y){try{let J;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=R5.join(X,$);if(await Bun.file(G).exists())return G;X=R5.dirname(X)}J=R5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=R5.resolve(Z,$);else J=R5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function RJ($,Z,Y){let J=$,X=R5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[z,q,U,j]=G;if(wJ(U))continue;let _=await AJ(U,X,Z);if(_)try{let B=await Bun.file(_).text();if(Y.add(_),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:l0()});if(L.outputs.length>0)B=await L.outputs[0].text()}let H=`<script>
9454
+ ${$.slice(Y)}`}function AJ($,Z={},Y={}){if(f6($))return $;return Qj($,Z,Y)}import N5 from"path";function RJ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function NJ($,Z,Y){try{let J;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=N5.join(X,$);if(await Bun.file(G).exists())return G;X=N5.dirname(X)}J=N5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=N5.resolve(Z,$);else J=N5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function MJ($,Z,Y){let J=$,X=N5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[z,q,U,j]=G;if(RJ(U))continue;let _=await NJ(U,X,Z);if(_)try{let B=await Bun.file(_).text();if(Y.add(_),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:l0()});if(L.outputs.length>0)B=await L.outputs[0].text()}let H=`<script>
9455
9455
  // Source: ${U}
9456
9456
  ${B}
9457
- </script>`;J=J.replace(z,H),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(J))!==null){let[z,q,U,j]=W,_=q+j;if(wJ(U))continue;if(/rel=["']stylesheet["']/.test(_)||U.endsWith(".css")){let H=await AJ(U,X,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let V=`<style>
9457
+ </script>`;J=J.replace(z,H),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(J))!==null){let[z,q,U,j]=W,_=q+j;if(RJ(U))continue;if(/rel=["']stylesheet["']/.test(_)||U.endsWith(".css")){let H=await NJ(U,X,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let V=`<style>
9458
9458
  /* Source: ${U} */
9459
9459
  ${L}
9460
- </style>`;J=J.replace(z,V),K.lastIndex=0}catch(L){}}}return J}var NJ=S(()=>{b1()});function f6($,Z){let Y=$,J=/@json\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,z=null,q=!1;while(W<Y.length&&K>0){let F=Y[W];if(q){q=!1,W++;continue}if(F==="\\"&&z){q=!0,W++;continue}if(z){if(F===z)z=null;W++;continue}if(F==='"'||F==="'"||F==="`"){z=F,W++;continue}if(F==="(")K++;else if(F===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=Y.substring(G+1,W).trim(),j=Y.substring(Q,W+1),_=-1,B=0,H=null,L=!1;for(let F=0;F<U.length;F++){let w=U[F];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){_=F;break}}let V=_>=0?U.substring(0,_).trim():U,O=_>=0?U.substring(_+1).trim():void 0;try{let F=V.trim(),w;if(K0(F))w=W0(F,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+R+Y.substring(W+1),J.lastIndex=Q+R.length}catch(F){t0.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=Q+j.length}}return Y}function g6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function MJ($){let Z=$,Y=/@memo\s*\(/g,J,X=[];while((J=Y.exec(Z))!==null){let Q=J.index,G=Q+J[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 z=Z.slice(G,W-1).trim(),q=W,U=Z.slice(q),j=U.indexOf("@endmemo");if(j===-1)continue;let _=U.slice(0,j),B=q+j+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,V=_.slice(L),O=_.match(/(\s*)$/),F=O?O[0].length:0,w=V.slice(0,V.length-F),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,M,T="",I]=A,E=`<${M}${T} data-stx-memo="${z}"${I}>`;R=_.slice(0,L)+E+w.slice(N.length)+_.slice(L+w.length)}else R=`${_.slice(0,L)}<div data-stx-memo="${z}">${w}</div>${_.slice(L+w.length)}`;X.push({start:Q,end:B,replacement:R}),Y.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 h6($){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 TJ($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,z=!1,q=-1;while(K<$.length){let H=$[K];if(W){if(H==="'")W=!1}else if(z){if(H==='"')z=!1}else if(H==="'")W=!0;else if(H==='"')z=!0;else if(H===">"){q=K;break}K++}if(q===-1)continue;if($.slice(G,q+1).includes("x-cloak"))continue;let j=$.slice(q+1),_=j.indexOf("</"),B=_>=0?j.slice(0,_):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))J+=$.slice(X,q)+" x-cloak>",X=q+1}return J+=$.slice(X),J}function IJ($){let Z=/<[a-z][\w-]*/gi,Y="",J=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}>`,H=$.toLowerCase().indexOf(B,Q);if(H!==-1)Z.lastIndex=H+B.length;continue}let K=Q+X[0].length,W=!1,z=!1,q=-1;while(K<$.length){let B=$[K];if(W){if(B==="'")W=!1}else if(z){if(B==='"')z=!1}else if(B==="'")W=!0;else if(B==='"')z=!0;else if(B===">"){q=K;break}K++}if(q===-1)continue;let U=$.slice(Q+X[0].length,q);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!Jj.test(U))continue;let j=$[q-1]==="/",_=j?q-1:q;Y+=`${$.slice(J,_)} x-cloak${j?" ":""}`,J=_}return Y+=$.slice(J),Y}var Jj;var d6=S(()=>{W1();w0();Jj=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function u6($,Z,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},X=J.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:W}of Xj){if(X.some((q)=>K.includes(q)||G.source.includes(q)))continue;G.lastIndex=0;let z=$.match(G);if(z&&z.length>0){let q=$.split(`
9460
+ </style>`;J=J.replace(z,V),K.lastIndex=0}catch(L){}}}return J}var TJ=S(()=>{S1()});function g6($,Z){let Y=$,J=/@json\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,z=null,q=!1;while(W<Y.length&&K>0){let F=Y[W];if(q){q=!1,W++;continue}if(F==="\\"&&z){q=!0,W++;continue}if(z){if(F===z)z=null;W++;continue}if(F==='"'||F==="'"||F==="`"){z=F,W++;continue}if(F==="(")K++;else if(F===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=Y.substring(G+1,W).trim(),j=Y.substring(Q,W+1),_=-1,B=0,H=null,L=!1;for(let F=0;F<U.length;F++){let w=U[F];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){_=F;break}}let V=_>=0?U.substring(0,_).trim():U,O=_>=0?U.substring(_+1).trim():void 0;try{let F=V.trim(),w;if(K0(F))w=W0(F,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+R+Y.substring(W+1),J.lastIndex=Q+R.length}catch(F){t0.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=Q+j.length}}return Y}function h6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function IJ($){let Z=$,Y=/@memo\s*\(/g,J,X=[];while((J=Y.exec(Z))!==null){let Q=J.index,G=Q+J[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 z=Z.slice(G,W-1).trim(),q=W,U=Z.slice(q),j=U.indexOf("@endmemo");if(j===-1)continue;let _=U.slice(0,j),B=q+j+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,V=_.slice(L),O=_.match(/(\s*)$/),F=O?O[0].length:0,w=V.slice(0,V.length-F),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,M,T="",I]=A,E=`<${M}${T} data-stx-memo="${z}"${I}>`;R=_.slice(0,L)+E+w.slice(N.length)+_.slice(L+w.length)}else R=`${_.slice(0,L)}<div data-stx-memo="${z}">${w}</div>${_.slice(L+w.length)}`;X.push({start:Q,end:B,replacement:R}),Y.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 d6($){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 DJ($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,z=!1,q=-1;while(K<$.length){let H=$[K];if(W){if(H==="'")W=!1}else if(z){if(H==='"')z=!1}else if(H==="'")W=!0;else if(H==='"')z=!0;else if(H===">"){q=K;break}K++}if(q===-1)continue;if($.slice(G,q+1).includes("x-cloak"))continue;let j=$.slice(q+1),_=j.indexOf("</"),B=_>=0?j.slice(0,_):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))J+=$.slice(X,q)+" x-cloak>",X=q+1}return J+=$.slice(X),J}function EJ($){let Z=/<[a-z][\w-]*/gi,Y="",J=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}>`,H=$.toLowerCase().indexOf(B,Q);if(H!==-1)Z.lastIndex=H+B.length;continue}let K=Q+X[0].length,W=!1,z=!1,q=-1;while(K<$.length){let B=$[K];if(W){if(B==="'")W=!1}else if(z){if(B==='"')z=!1}else if(B==="'")W=!0;else if(B==='"')z=!0;else if(B===">"){q=K;break}K++}if(q===-1)continue;let U=$.slice(Q+X[0].length,q);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!Gj.test(U))continue;let j=$[q-1]==="/",_=j?q-1:q;Y+=`${$.slice(J,_)} x-cloak${j?" ":""}`,J=_}return Y+=$.slice(J),Y}var Gj;var u6=S(()=>{z1();w0();Gj=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function m6($,Z,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},X=J.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:W}of Kj){if(X.some((q)=>K.includes(q)||G.source.includes(q)))continue;G.lastIndex=0;let z=$.match(G);if(z&&z.length>0){let q=$.split(`
9461
9461
  `),U=[];q.forEach((_,B)=>{if(G.lastIndex=0,G.test(_))U.push(B+1)});let j=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";Q.push(` \u2717 ${K}${j}
9462
9462
  \u2192 ${W}`)}}if(Q.length>0&&J.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
9463
9463
  ${Q.join(`
9464
9464
  `)}
9465
- Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var Xj;var m6=S(()=>{Xj=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var DJ={};a(DJ,{getStoreScript:()=>Qj,clearStoreCache:()=>Gj});import e4 from"path";async function Qj($){let Z;if($)Z=e4.resolve($);else{let q=await z1();Z=e4.resolve(q.root||process.cwd(),q.storesDir||"stores")}let Y=N5.get(Z);if(Y!==void 0)return Y||null;let J=new Bun.Glob("*.ts"),X=[];try{for await(let q of J.scan({cwd:Z,absolute:!0})){let U=e4.basename(q,".ts");if(["index","types"].includes(U))continue;if(q.includes(".d.ts"))continue;X.push(q)}}catch{return N5.set(Z,""),null}if(X.length===0)return N5.set(Z,""),null;let Q=[];for(let q of X){let U=await Bun.file(q).text();Q.push({file:q,hasUseStore:/useStore\s*\(/.test(U)})}Q.sort((q,U)=>{if(q.hasUseStore===U.hasUseStore)return 0;return q.hasUseStore?1:-1});let G=Q.map((q)=>q.file),K=[],W=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()});for(let q of G)try{let U=await Bun.file(q).text(),j=e4.basename(q,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=W.transformSync(U),K.push(`// Store: ${j}
9466
- ${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${q}:`,U)}if(K.length===0)return N5.set(Z,""),null;let z=`;(function(){
9465
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var Kj;var p6=S(()=>{Kj=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var kJ={};a(kJ,{getStoreScript:()=>Wj,clearStoreCache:()=>zj});import Z7 from"path";async function Wj($){let Z;if($)Z=Z7.resolve($);else{let q=await q1();Z=Z7.resolve(q.root||process.cwd(),q.storesDir||"stores")}let Y=M5.get(Z);if(Y!==void 0)return Y||null;let J=new Bun.Glob("*.ts"),X=[];try{for await(let q of J.scan({cwd:Z,absolute:!0})){let U=Z7.basename(q,".ts");if(["index","types"].includes(U))continue;if(q.includes(".d.ts"))continue;X.push(q)}}catch{return M5.set(Z,""),null}if(X.length===0)return M5.set(Z,""),null;let Q=[];for(let q of X){let U=await Bun.file(q).text();Q.push({file:q,hasUseStore:/useStore\s*\(/.test(U)})}Q.sort((q,U)=>{if(q.hasUseStore===U.hasUseStore)return 0;return q.hasUseStore?1:-1});let G=Q.map((q)=>q.file),K=[],W=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()});for(let q of G)try{let U=await Bun.file(q).text(),j=Z7.basename(q,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=W.transformSync(U),K.push(`// Store: ${j}
9466
+ ${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${q}:`,U)}if(K.length===0)return M5.set(Z,""),null;let z=`;(function(){
9467
9467
  ${K.join(`
9468
9468
 
9469
9469
  `)}
9470
- })();`;return N5.set(Z,z),z}function Gj(){N5.clear()}var N5;var EJ=S(()=>{c1();b1();N5=new Map});var bJ={};a(bJ,{getComposableScript:()=>qj,clearComposableCache:()=>Uj});import H$ from"path";function kJ($){let Z=H$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function Wj($){if($)return H$.resolve($);let Z=`<default>:${process.cwd()}`,Y=p6.get(Z);if(Y!==void 0)return Y;let J=await zj();return p6.set(Z,J),J}async function zj(){let $=await z1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return H$.resolve(Z,Y);for(let J of Kj){let X=H$.resolve(Z,J);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:X,absolute:!0}))if(!kJ(G))return X}catch{}}return null}async function qj($){let Z=await Wj($);if(!Z)return null;let Y=M5.get(Z);if(Y!==void 0)return Y||null;let J=[];try{let _=new Bun.Glob("**/*.ts");for await(let B of _.scan({cwd:Z,absolute:!0})){if(kJ(B))continue;J.push(B)}}catch{return M5.set(Z,""),null}if(J.length===0)return M5.set(Z,""),null;J.sort();let X=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),Q=[],G=new Set,K=new Set;for(let _ of J)try{let B=await Bun.file(_).text(),H=H$.basename(_,".ts");for(let L of B.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of X.scan(B).exports)if(L!=="default")G.add(L)}catch{}B=s0(B),B=B.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),B=B.replace(/^export\s+(default\s+)?/gm,""),B=X.transformSync(B),Q.push(`// Composable: ${H}
9471
- ${B.trim()}`)}catch(B){console.warn(`[stx] Failed to load composable ${_}:`,B)}if(Q.length===0||G.size===0)return M5.set(Z,""),null;let W=[...G].map((_)=>` try { __c[${JSON.stringify(_)}] = ${_}; } catch (e) {}`).join(`
9470
+ })();`;return M5.set(Z,z),z}function zj(){M5.clear()}var M5;var bJ=S(()=>{i1();S1();M5=new Map});var yJ={};a(yJ,{getComposableScript:()=>_j,clearComposableCache:()=>Bj});import O$ from"path";function SJ($){let Z=O$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function Uj($){if($)return O$.resolve($);let Z=`<default>:${process.cwd()}`,Y=l6.get(Z);if(Y!==void 0)return Y;let J=await jj();return l6.set(Z,J),J}async function jj(){let $=await q1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return O$.resolve(Z,Y);for(let J of qj){let X=O$.resolve(Z,J);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:X,absolute:!0}))if(!SJ(G))return X}catch{}}return null}async function _j($){let Z=await Uj($);if(!Z)return null;let Y=T5.get(Z);if(Y!==void 0)return Y||null;let J=[];try{let _=new Bun.Glob("**/*.ts");for await(let B of _.scan({cwd:Z,absolute:!0})){if(SJ(B))continue;J.push(B)}}catch{return T5.set(Z,""),null}if(J.length===0)return T5.set(Z,""),null;J.sort();let X=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),Q=[],G=new Set,K=new Set;for(let _ of J)try{let B=await Bun.file(_).text(),H=O$.basename(_,".ts");for(let L of B.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of X.scan(B).exports)if(L!=="default")G.add(L)}catch{}B=s0(B),B=B.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),B=B.replace(/^export\s+(default\s+)?/gm,""),B=X.transformSync(B),Q.push(`// Composable: ${H}
9471
+ ${B.trim()}`)}catch(B){console.warn(`[stx] Failed to load composable ${_}:`,B)}if(Q.length===0||G.size===0)return T5.set(Z,""),null;let W=[...G].map((_)=>` try { __c[${JSON.stringify(_)}] = ${_}; } catch (e) {}`).join(`
9472
9472
  `),z=JSON.stringify([...G]),q=Q.join(`
9473
9473
 
9474
9474
  `),j=`;(function(){
9475
9475
  window.__composables = window.__composables || {};
9476
9476
  var __c = window.__composables;
9477
9477
  var __stx = window.stx || {};
9478
- ${D$.filter((_)=>!K.has(_)&&new RegExp(`\\b${_}\\b`).test(q)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
9478
+ ${E$.filter((_)=>!K.has(_)&&new RegExp(`\\b${_}\\b`).test(q)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
9479
9479
  `)}
9480
9480
  ${q}
9481
9481
  ${W}
@@ -9492,7 +9492,7 @@ ${W}
9492
9492
  }
9493
9493
  window[__n] = __c[__n];
9494
9494
  }
9495
- })();`;return M5.set(Z,j),j}function Uj(){M5.clear(),p6.clear()}var M5,p6,Kj;var SJ=S(()=>{c1();b1();l5();M5=new Map,p6=new Map,Kj=["composables","functions"]});var PJ={};a(PJ,{processDeferDirectives:()=>Oj});function jj(){return`stx-defer-${++yJ}`}function _j($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function Bj($,Z,Y){let{trigger:J,value:X}=_j(Z),Q=Y,G,K,W,z=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(z)G=z[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let q=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(q)K=q[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.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:J,triggerValue:X,content:Q,placeholder:G,loading:K,error:W}}function Hj($,Z){let{trigger:Y,triggerValue:J}=Z,X;switch(Y){case"visible":X=`
9495
+ })();`;return T5.set(Z,j),j}function Bj(){T5.clear(),l6.clear()}var T5,l6,qj;var PJ=S(()=>{i1();S1();c5();T5=new Map,l6=new Map,qj=["composables","functions"]});var vJ={};a(vJ,{processDeferDirectives:()=>Vj});function Hj(){return`stx-defer-${++CJ}`}function Oj($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function Lj($,Z,Y){let{trigger:J,value:X}=Oj(Z),Q=Y,G,K,W,z=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(z)G=z[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let q=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(q)K=q[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.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:J,triggerValue:X,content:Q,placeholder:G,loading:K,error:W}}function Fj($,Z){let{trigger:Y,triggerValue:J}=Z,X;switch(Y){case"visible":X=`
9496
9496
  const observer = new IntersectionObserver((entries) => {
9497
9497
  if (entries[0].isIntersecting) {
9498
9498
  observer.disconnect();
@@ -9565,7 +9565,7 @@ else {
9565
9565
  ${X}
9566
9566
  })();
9567
9567
  </script>
9568
- `}function Oj($,Z,Y){yJ=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(X,Q,G)=>{let K=jj(),W=Bj(X,Q,G),z=W.placeholder?`<div data-defer-placeholder>${W.placeholder}</div>`:"",q=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>`,_=Hj(K,W);return`
9568
+ `}function Vj($,Z,Y){CJ=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(X,Q,G)=>{let K=Hj(),W=Lj(X,Q,G),z=W.placeholder?`<div data-defer-placeholder>${W.placeholder}</div>`:"",q=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>`,_=Fj(K,W);return`
9569
9569
  <div id="${K}" class="stx-defer" data-defer-trigger="${W.trigger}">
9570
9570
  ${z}
9571
9571
  ${q}
@@ -9573,7 +9573,7 @@ else {
9573
9573
  ${U}
9574
9574
  </div>
9575
9575
  ${_}
9576
- `})}var yJ=0;var vJ={};a(vJ,{processTeleportDirectives:()=>wj,ensureTeleportTargets:()=>Aj});function Lj(){return`stx-teleport-${++CJ}`}function Fj($){let Z=$.split(",").map((X)=>X.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let X=1;X<Z.length;X++){let Q=Z[X].match(/disabled:\s*(.+)/);if(Q)J=Q[1].trim()}return{target:Y,disabled:J}}function Vj($,Z){return`
9576
+ `})}var CJ=0;var fJ={};a(fJ,{processTeleportDirectives:()=>Nj,ensureTeleportTargets:()=>Mj});function wj(){return`stx-teleport-${++xJ}`}function Aj($){let Z=$.split(",").map((X)=>X.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let X=1;X<Z.length;X++){let Q=Z[X].match(/disabled:\s*(.+)/);if(Q)J=Q[1].trim()}return{target:Y,disabled:J}}function Rj($,Z){return`
9577
9577
  <script>
9578
9578
  (function() {
9579
9579
  const source = document.getElementById('${$}');
@@ -9619,12 +9619,12 @@ else {
9619
9619
  });
9620
9620
  })();
9621
9621
  </script>
9622
- `}function wj($,Z,Y){CJ=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(X,Q,G)=>{let K=Lj(),{target:W,disabled:z}=Fj(Q),q=G.trim();if(z)try{let j=!1;if(z==="true")j=!0;else if(z==="false")j=!1;else if(z in Z)j=Boolean(Z[z]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${q}</div>`}catch{}let U=Vj(K,W);return`
9622
+ `}function Nj($,Z,Y){xJ=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(X,Q,G)=>{let K=wj(),{target:W,disabled:z}=Aj(Q),q=G.trim();if(z)try{let j=!1;if(z==="true")j=!0;else if(z==="false")j=!1;else if(z in Z)j=Boolean(Z[z]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${q}</div>`}catch{}let U=Rj(K,W);return`
9623
9623
  <div id="${K}" class="stx-teleport-source" style="display: none;">
9624
9624
  <template>${q}</template>
9625
9625
  </div>
9626
9626
  ${U}
9627
- `})}function Aj(){return`
9627
+ `})}function Mj(){return`
9628
9628
  <script>
9629
9629
  (function() {
9630
9630
  // Common teleport targets
@@ -9641,7 +9641,7 @@ else {
9641
9641
  });
9642
9642
  })();
9643
9643
  </script>
9644
- `}var CJ=0;var hJ={};a(hJ,{processTransitionDirectives:()=>Tj,processTransitionAttributes:()=>kj,performLeave:()=>Mj,performEnter:()=>Nj,generateTransitionRuntime:()=>Ej,generateTransitionCSS:()=>Dj});function xJ($,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 Rj($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=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(Y),X(J))}function fJ($,Z){return new Promise((Y)=>{let J=Z??Rj($);if(J===0){Y();return}let X=!1,Q=()=>{if(X)return;X=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,J+50)})}function gJ($){$.offsetHeight}async function Nj($,Z={}){let Y=Z.name||"stx",J=xJ(Y,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),gJ($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await fJ($,X);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function Mj($,Z={}){let Y=Z.name||"stx",J=xJ(Y,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),gJ($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await fJ($,X);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function Tj($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(X,Q,G)=>{let K=Ij(Q),W=K.name||"stx",z=K.duration||300,q=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
9644
+ `}var xJ=0;var uJ={};a(uJ,{processTransitionDirectives:()=>Ej,processTransitionAttributes:()=>yj,performLeave:()=>Dj,performEnter:()=>Ij,generateTransitionRuntime:()=>Sj,generateTransitionCSS:()=>bj});function gJ($,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 Tj($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=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(Y),X(J))}function hJ($,Z){return new Promise((Y)=>{let J=Z??Tj($);if(J===0){Y();return}let X=!1,Q=()=>{if(X)return;X=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,J+50)})}function dJ($){$.offsetHeight}async function Ij($,Z={}){let Y=Z.name||"stx",J=gJ(Y,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),dJ($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await hJ($,X);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function Dj($,Z={}){let Y=Z.name||"stx",J=gJ(Y,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),dJ($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await hJ($,X);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function Ej($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(X,Q,G)=>{let K=kj(Q),W=K.name||"stx",z=K.duration||300,q=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
9645
9645
  <div
9646
9646
  class="stx-transition-wrapper"
9647
9647
  data-transition="${W}"
@@ -9683,7 +9683,7 @@ else {
9683
9683
  });
9684
9684
  })();
9685
9685
  </script>
9686
- `})}function Ij($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4]||J[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 Dj(){return`
9686
+ `})}function kj($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4]||J[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 bj(){return`
9687
9687
  /* STX Transition Presets */
9688
9688
 
9689
9689
  /* Fade */
@@ -9870,7 +9870,7 @@ else {
9870
9870
  opacity: 1;
9871
9871
  max-height: 1000px;
9872
9872
  }
9873
- `}function Ej(){return`
9873
+ `}function Sj(){return`
9874
9874
  // STX Transition Runtime
9875
9875
  (function() {
9876
9876
  if (typeof window === 'undefined') return;
@@ -9959,7 +9959,7 @@ else {
9959
9959
 
9960
9960
  console.log('[stx] Transition runtime initialized');
9961
9961
  })();
9962
- `}function kj($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var uJ={};a(uJ,{withErrorBoundary:()=>dJ,processErrorBoundaryDirectives:()=>yj,generateErrorBoundaryRuntime:()=>fj,generateErrorBoundaryCSS:()=>xj,createErrorBoundary:()=>vj});function Sj(){return`eb-${++bj}-${Date.now().toString(36)}`}function yj($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(X,Q,G,K)=>{let W=Sj(),z=Pj(Q||"");return Cj(W,G.trim(),K.trim(),z)})}function Pj($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4];switch(X){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function Cj($,Z,Y,J){let X=J.logErrors!==!1;return`
9962
+ `}function yj($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var pJ={};a(pJ,{withErrorBoundary:()=>mJ,processErrorBoundaryDirectives:()=>vj,generateErrorBoundaryRuntime:()=>dj,generateErrorBoundaryCSS:()=>hj,createErrorBoundary:()=>gj});function Cj(){return`eb-${++Pj}-${Date.now().toString(36)}`}function vj($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(X,Q,G,K)=>{let W=Cj(),z=xj(Q||"");return fj(W,G.trim(),K.trim(),z)})}function xj($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4];switch(X){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function fj($,Z,Y,J){let X=J.logErrors!==!1;return`
9963
9963
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
9964
9964
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
9965
9965
  ${Z}
@@ -10079,7 +10079,7 @@ else {
10079
10079
  };
10080
10080
  })();
10081
10081
  </script>
10082
- `}async function dJ($,Z,Y){try{return await $()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return Z}}function vj($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>dJ(J,$,Y)}function xj(){return`
10082
+ `}async function mJ($,Z,Y){try{return await $()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return Z}}function gj($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>mJ(J,$,Y)}function hj(){return`
10083
10083
  /* STX Error Boundary Styles */
10084
10084
  .stx-error-boundary {
10085
10085
  position: relative;
@@ -10123,7 +10123,7 @@ else {
10123
10123
  color: #fecaca;
10124
10124
  }
10125
10125
  }
10126
- `}function fj(){return`
10126
+ `}function dj(){return`
10127
10127
  // STX Error Boundary Runtime
10128
10128
  (function() {
10129
10129
  if (typeof window === 'undefined') return;
@@ -10188,7 +10188,7 @@ else {
10188
10188
 
10189
10189
  console.log('[stx] Error boundary runtime initialized');
10190
10190
  })();
10191
- `}var bj=0;var mJ={};a(mJ,{renderSSRSuspense:()=>lj,processSuspenseDirectives:()=>dj,generateSuspenseRuntime:()=>ij,generateSuspenseCSS:()=>cj,createSSRSuspense:()=>pj});function hj(){return`suspense-${++gj}-${Date.now().toString(36)}`}function dj($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let W=hj(),z=uj(Q||"");return mj(W,G.trim(),K.trim(),z)})}function uj($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function mj($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
10191
+ `}var Pj=0;var lJ={};a(lJ,{renderSSRSuspense:()=>nj,processSuspenseDirectives:()=>pj,generateSuspenseRuntime:()=>sj,generateSuspenseCSS:()=>oj,createSSRSuspense:()=>ij});function mj(){return`suspense-${++uj}-${Date.now().toString(36)}`}function pj($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let W=mj(),z=lj(Q||"");return cj(W,G.trim(),K.trim(),z)})}function lj($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function cj($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
10192
10192
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${Q}" data-status="pending">
10193
10193
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
10194
10194
  ${Y}
@@ -10378,7 +10378,7 @@ else {
10378
10378
  }, 0);
10379
10379
  })();
10380
10380
  </script>
10381
- `}function pj($,Z,Y){return{id:$,fallback:Y,content:Z}}async function lj($){let Z=$.map((J)=>`
10381
+ `}function ij($,Z,Y){return{id:$,fallback:Y,content:Z}}async function nj($){let Z=$.map((J)=>`
10382
10382
  <div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
10383
10383
  ${J.fallback}
10384
10384
  </div>
@@ -10403,7 +10403,7 @@ else {
10403
10403
  }
10404
10404
  })();
10405
10405
  </script>
10406
- `}}return{initial:Z,streaming:Y()}}function cj(){return`
10406
+ `}}return{initial:Z,streaming:Y()}}function oj(){return`
10407
10407
  /* STX Suspense Styles */
10408
10408
  .stx-suspense {
10409
10409
  position: relative;
@@ -10459,7 +10459,7 @@ else {
10459
10459
  background-size: 200% 100%;
10460
10460
  }
10461
10461
  }
10462
- `}function ij(){return`
10462
+ `}function sj(){return`
10463
10463
  // STX Suspense Runtime
10464
10464
  (function() {
10465
10465
  if (typeof window === 'undefined') return;
@@ -10526,7 +10526,7 @@ else {
10526
10526
 
10527
10527
  console.log('[stx] Suspense runtime initialized');
10528
10528
  })();
10529
- `}var gj=0;var iJ={};a(iJ,{processAsyncDirectives:()=>oj,isAsyncComponent:()=>rj,generateAsyncComponentRuntime:()=>tj,generateAsyncComponentCSS:()=>aj,defineAsyncComponent:()=>sj});function pJ(){return`async-${++nj}-${Date.now().toString(36)}`}function oj($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(J,(G,K,W,z)=>{let q=pJ(),U=lJ(K);return cJ(q,U,W.trim(),z.trim())}),Q=Q.replace(X,(G,K,W)=>{let z=pJ(),q=lJ(K);return cJ(z,q,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function lJ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4],K=J[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 cJ($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:W}=Z;return`
10529
+ `}var uj=0;var oJ={};a(oJ,{processAsyncDirectives:()=>aj,isAsyncComponent:()=>ej,generateAsyncComponentRuntime:()=>Z_,generateAsyncComponentCSS:()=>$_,defineAsyncComponent:()=>tj});function cJ(){return`async-${++rj}-${Date.now().toString(36)}`}function aj($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(J,(G,K,W,z)=>{let q=cJ(),U=iJ(K);return nJ(q,U,W.trim(),z.trim())}),Q=Q.replace(X,(G,K,W)=>{let z=cJ(),q=iJ(K);return nJ(z,q,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function iJ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4],K=J[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 nJ($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:W}=Z;return`
10530
10530
  <div class="stx-async-component" data-async-id="${$}" data-component="${X}" data-status="pending">
10531
10531
  <div class="stx-async-loading" data-async-loading="${$}">
10532
10532
  ${Y}
@@ -10753,7 +10753,7 @@ catch (error) {
10753
10753
  loadComponent();
10754
10754
  })();
10755
10755
  </script>
10756
- `}function sj($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function rj($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function aj(){return`
10756
+ `}function tj($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function ej($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function $_(){return`
10757
10757
  /* STX Async Component Styles */
10758
10758
  .stx-async-component {
10759
10759
  position: relative;
@@ -10827,7 +10827,7 @@ catch (error) {
10827
10827
  background-size: 200% 100%;
10828
10828
  }
10829
10829
  }
10830
- `}function tj(){return`
10830
+ `}function Z_(){return`
10831
10831
  // STX Async Component Runtime
10832
10832
  (function() {
10833
10833
  if (typeof window === 'undefined') return;
@@ -10881,7 +10881,7 @@ catch (error) {
10881
10881
 
10882
10882
  console.log('[stx] Async component runtime initialized');
10883
10883
  })();
10884
- `}var nj=0;var oJ={};a(oJ,{shouldCacheComponent:()=>X_,processKeepAliveDirectives:()=>$_,onDeactivated:()=>W_,onActivated:()=>K_,generateKeepAliveRuntime:()=>G_,generateKeepAliveCSS:()=>Q_,createKeepAliveCache:()=>J_});function nJ(){return`keep-alive-${++ej}-${Date.now().toString(36)}`}function $_($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(X,Q,G)=>{let K=nJ(),W=Z_(Q||"");return Y_(K,G.trim(),W)})}function Z_($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[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 Y_($,Z,Y){let{max:J,include:X,exclude:Q}=Y,G=Y.id||$;return`
10884
+ `}var rj=0;var rJ={};a(rJ,{shouldCacheComponent:()=>K_,processKeepAliveDirectives:()=>J_,onDeactivated:()=>U_,onActivated:()=>q_,generateKeepAliveRuntime:()=>z_,generateKeepAliveCSS:()=>W_,createKeepAliveCache:()=>G_});function sJ(){return`keep-alive-${++Y_}-${Date.now().toString(36)}`}function J_($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(X,Q,G)=>{let K=sJ(),W=X_(Q||"");return Q_(K,G.trim(),W)})}function X_($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[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 Q_($,Z,Y){let{max:J,include:X,exclude:Q}=Y,G=Y.id||$;return`
10885
10885
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
10886
10886
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
10887
10887
  ${Z}
@@ -11168,7 +11168,7 @@ else {
11168
11168
  });
11169
11169
  })();
11170
11170
  </script>
11171
- `}function J_($={}){return{id:$.id||nJ(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function X_($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function Q_(){return`
11171
+ `}function G_($={}){return{id:$.id||sJ(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function K_($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function W_(){return`
11172
11172
  /* STX Keep-Alive Styles */
11173
11173
  .stx-keep-alive {
11174
11174
  position: relative;
@@ -11193,7 +11193,7 @@ else {
11193
11193
  .stx-keep-alive-content > [data-activated] {
11194
11194
  opacity: 1;
11195
11195
  }
11196
- `}function G_(){return`
11196
+ `}function z_(){return`
11197
11197
  // STX Keep-Alive Runtime
11198
11198
  (function() {
11199
11199
  if (typeof window === 'undefined') return;
@@ -11229,7 +11229,7 @@ else {
11229
11229
 
11230
11230
  console.log('[stx] Keep-alive runtime initialized');
11231
11231
  })();
11232
- `}function K_($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function W_($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var ej=0;var eJ={};a(eJ,{useVirtualList:()=>rJ,processVirtualListDirectives:()=>c6,processVirtualGridDirectives:()=>tJ,processInfiniteListDirectives:()=>aJ,generateVirtualListCSS:()=>sJ,default:()=>z_,createVirtualList:()=>l6});function l6($,Z){let{itemHeight:Y,containerHeight:J,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:W="vertical"}=Z,z=[...$],q=0,U=new Map;function j(){if(G)return _();let R=Math.max(0,Math.floor(q/Y)-X),N=Math.ceil(J/Y),M=Math.min(z.length-1,R+N+X*2);return{startIndex:R,endIndex:M}}function _(){let R=0,N=0,M=z.length-1;for(let T=0;T<z.length;T++){let I=U.get(T)||K;if(R+I>q){N=Math.max(0,T-X);break}R+=I}R=0;for(let T=0;T<z.length;T++){let I=U.get(T)||K;if(R+=I,R>q+J){M=Math.min(z.length-1,T+X);break}}return{startIndex:N,endIndex:M}}function B(){if(G){let R=0;for(let N=0;N<z.length;N++)R+=U.get(N)||K;return R}return z.length*Y}function H(R){if(G){let N=0;for(let M=0;M<R;M++)N+=U.get(M)||K;return N}return R*Y}function L(){let{startIndex:R,endIndex:N}=j();return{startIndex:R,endIndex:N,scrollTop:q,totalHeight:B(),visibleItems:z.slice(R,N+1),itemHeights:new Map(U)}}function V(R,N="auto"){let M=H(R);O(M,N)}function O(R,N="auto"){q=Math.max(0,Math.min(R,B()-J))}function F(){j()}function w(R){z=[...R],U.clear(),F()}function A(){z=[],U.clear()}return{scrollToIndex:V,scrollToOffset:O,getState:L,refresh:F,setItems:w,destroy:A}}function c6($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),z=Z[W];if(!z||!Array.isArray(z))return`<!-- virtualList: items "${W}" not found or not an array -->`;let q={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),F=Function(`return ${O}`)();q={...q,...F}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(q.containerHeight/q.itemHeight),_=q.overscan||3,B=0,H=Math.min(z.length-1,j+_),L="";for(let O=B;O<=H&&O<z.length;O++){let F=z[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
11232
+ `}function q_($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function U_($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var Y_=0;var ZX={};a(ZX,{useVirtualList:()=>tJ,processVirtualListDirectives:()=>i6,processVirtualGridDirectives:()=>$X,processInfiniteListDirectives:()=>eJ,generateVirtualListCSS:()=>aJ,default:()=>j_,createVirtualList:()=>c6});function c6($,Z){let{itemHeight:Y,containerHeight:J,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:W="vertical"}=Z,z=[...$],q=0,U=new Map;function j(){if(G)return _();let R=Math.max(0,Math.floor(q/Y)-X),N=Math.ceil(J/Y),M=Math.min(z.length-1,R+N+X*2);return{startIndex:R,endIndex:M}}function _(){let R=0,N=0,M=z.length-1;for(let T=0;T<z.length;T++){let I=U.get(T)||K;if(R+I>q){N=Math.max(0,T-X);break}R+=I}R=0;for(let T=0;T<z.length;T++){let I=U.get(T)||K;if(R+=I,R>q+J){M=Math.min(z.length-1,T+X);break}}return{startIndex:N,endIndex:M}}function B(){if(G){let R=0;for(let N=0;N<z.length;N++)R+=U.get(N)||K;return R}return z.length*Y}function H(R){if(G){let N=0;for(let M=0;M<R;M++)N+=U.get(M)||K;return N}return R*Y}function L(){let{startIndex:R,endIndex:N}=j();return{startIndex:R,endIndex:N,scrollTop:q,totalHeight:B(),visibleItems:z.slice(R,N+1),itemHeights:new Map(U)}}function V(R,N="auto"){let M=H(R);O(M,N)}function O(R,N="auto"){q=Math.max(0,Math.min(R,B()-J))}function F(){j()}function w(R){z=[...R],U.clear(),F()}function A(){z=[],U.clear()}return{scrollToIndex:V,scrollToOffset:O,getState:L,refresh:F,setItems:w,destroy:A}}function i6($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),z=Z[W];if(!z||!Array.isArray(z))return`<!-- virtualList: items "${W}" not found or not an array -->`;let q={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),F=Function(`return ${O}`)();q={...q,...F}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(q.containerHeight/q.itemHeight),_=q.overscan||3,B=0,H=Math.min(z.length-1,j+_),L="";for(let O=B;O<=H&&O<z.length;O++){let F=z[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
11233
11233
  <div class="virtual-item ${q.itemClass||""}"
11234
11234
  style="position: absolute; top: ${O*q.itemHeight}px; height: ${q.itemHeight}px; width: 100%;"
11235
11235
  data-index="${O}">
@@ -11306,7 +11306,7 @@ else {
11306
11306
  };
11307
11307
  })();
11308
11308
  </script>
11309
- `})}function sJ(){return`
11309
+ `})}function aJ(){return`
11310
11310
  .virtual-list-container {
11311
11311
  position: relative;
11312
11312
  overflow-y: auto;
@@ -11354,7 +11354,7 @@ else {
11354
11354
  0% { background-position: 200% 0; }
11355
11355
  100% { background-position: -200% 0; }
11356
11356
  }
11357
- `}function rJ($,Z){let Y=null,J=()=>{if(!Y)Y=l6($(),Z);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(X)=>{let Q=X.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(X)=>({style:{position:"absolute",top:`${X*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":X}),scrollToIndex:(X)=>{J().scrollToIndex(X)}}}function aJ($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(X,Q,G,K,W)=>{let z=Q.trim(),q=Z[z];if(!q||!Array.isArray(q))return`<!-- infiniteList: items "${z}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();U={...U,...B}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,_=c6(`@virtualList(${z}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
11357
+ `}function tJ($,Z){let Y=null,J=()=>{if(!Y)Y=c6($(),Z);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(X)=>{let Q=X.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(X)=>({style:{position:"absolute",top:`${X*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":X}),scrollToIndex:(X)=>{J().scrollToIndex(X)}}}function eJ($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(X,Q,G,K,W)=>{let z=Q.trim(),q=Z[z];if(!q||!Array.isArray(q))return`<!-- infiniteList: items "${z}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();U={...U,...B}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,_=i6(`@virtualList(${z}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
11358
11358
  // Infinite scroll detection
11359
11359
  container.addEventListener('scroll', function() {
11360
11360
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -11372,7 +11372,7 @@ else {
11372
11372
  ${W}
11373
11373
  </div>
11374
11374
  </div>
11375
- `})}function tJ($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),z=Z[W];if(!z||!Array.isArray(z))return`<!-- virtualGrid: items "${W}" not found or not an array -->`;let q={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let F=Function(`return ${G.trim()}`)();q={...q,...F}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(z.length/q.columns),_=j*(q.rowHeight+(q.gap||0)),B=Math.ceil(q.containerHeight/(q.rowHeight+(q.gap||0))),H=q.overscan||2,L=0,V=Math.min(j-1,B+H),O="";for(let F=L;F<=V;F++)for(let w=0;w<q.columns;w++){let A=F*q.columns+w;if(A>=z.length)break;let R=z[A],N=w*(100/q.columns),M=F*(q.rowHeight+(q.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(A));O+=`
11375
+ `})}function $X($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),z=Z[W];if(!z||!Array.isArray(z))return`<!-- virtualGrid: items "${W}" not found or not an array -->`;let q={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let F=Function(`return ${G.trim()}`)();q={...q,...F}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(z.length/q.columns),_=j*(q.rowHeight+(q.gap||0)),B=Math.ceil(q.containerHeight/(q.rowHeight+(q.gap||0))),H=q.overscan||2,L=0,V=Math.min(j-1,B+H),O="";for(let F=L;F<=V;F++)for(let w=0;w<q.columns;w++){let A=F*q.columns+w;if(A>=z.length)break;let R=z[A],N=w*(100/q.columns),M=F*(q.rowHeight+(q.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(A));O+=`
11376
11376
  <div class="virtual-grid-item"
11377
11377
  style="position: absolute; top: ${M}px; left: ${N}%; width: calc(${100/q.columns}% - ${q.gap||0}px); height: ${q.rowHeight}px;"
11378
11378
  data-index="${A}">
@@ -11442,7 +11442,7 @@ else {
11442
11442
  });
11443
11443
  })();
11444
11444
  </script>
11445
- `})}var z_;var $X=S(()=>{z_={createVirtualList:l6,processVirtualListDirectives:c6,processInfiniteListDirectives:aJ,processVirtualGridDirectives:tJ,generateVirtualListCSS:sJ,useVirtualList:rJ}});function ZX(){return`<script data-stx-hydration-runtime>
11445
+ `})}var j_;var YX=S(()=>{j_={createVirtualList:c6,processVirtualListDirectives:i6,processInfiniteListDirectives:eJ,processVirtualGridDirectives:$X,generateVirtualListCSS:aJ,useVirtualList:tJ}});function JX(){return`<script data-stx-hydration-runtime>
11446
11446
  (function() {
11447
11447
  'use strict';
11448
11448
 
@@ -11602,7 +11602,7 @@ else {
11602
11602
  stxIslands.initIslands();
11603
11603
  }
11604
11604
  })();
11605
- </script>`}function YX($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function JX($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var BX={};a(BX,{processStaticDirectives:()=>jX,processPartialHydrationDirectives:()=>QX,onHydrated:()=>UX,isHydrated:()=>qX,hydrateIsland:()=>KX,hydrateByStrategy:()=>WX,hydrateAll:()=>zX,generatePartialHydrationCSS:()=>GX,generateIslandManifest:()=>_X,default:()=>L_,createIslandRegistry:()=>XX});function XX(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function q_($){return`
11605
+ </script>`}function XX($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function QX($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var OX={};a(OX,{processStaticDirectives:()=>BX,processPartialHydrationDirectives:()=>KX,onHydrated:()=>_X,isHydrated:()=>jX,hydrateIsland:()=>zX,hydrateByStrategy:()=>qX,hydrateAll:()=>UX,generatePartialHydrationCSS:()=>WX,generateIslandManifest:()=>HX,default:()=>w_,createIslandRegistry:()=>GX});function GX(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function __($){return`
11606
11606
  <script data-hydrate="${$}">
11607
11607
  (function() {
11608
11608
  const island = document.querySelector('[data-island="${$}"]');
@@ -11613,7 +11613,7 @@ else {
11613
11613
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
11614
11614
  })();
11615
11615
  </script>
11616
- `}function U_($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
11616
+ `}function B_($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
11617
11617
  <script data-hydrate="${$}">
11618
11618
  (function() {
11619
11619
  const island = document.querySelector('[data-island="${$}"]');
@@ -11649,7 +11649,7 @@ else {
11649
11649
  }
11650
11650
  })();
11651
11651
  </script>
11652
- `}function j_($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
11652
+ `}function H_($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
11653
11653
  <script data-hydrate="${$}">
11654
11654
  (function() {
11655
11655
  const island = document.querySelector('[data-island="${$}"]');
@@ -11682,7 +11682,7 @@ else {
11682
11682
  }
11683
11683
  })();
11684
11684
  </script>
11685
- `}function __($,Z){let Y=Z.media||"(min-width: 768px)";return`
11685
+ `}function O_($,Z){let Y=Z.media||"(min-width: 768px)";return`
11686
11686
  <script data-hydrate="${$}">
11687
11687
  (function() {
11688
11688
  const island = document.querySelector('[data-island="${$}"]');
@@ -11711,7 +11711,7 @@ else {
11711
11711
  }
11712
11712
  })();
11713
11713
  </script>
11714
- `}function B_($){return`
11714
+ `}function L_($){return`
11715
11715
  <script data-hydrate="${$}">
11716
11716
  (function() {
11717
11717
  const island = document.querySelector('[data-island="${$}"]');
@@ -11733,7 +11733,7 @@ else {
11733
11733
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
11734
11734
  })();
11735
11735
  </script>
11736
- `}function H_($,Z){let Y=Z.event||"stx:activate";return`
11736
+ `}function F_($,Z){let Y=Z.event||"stx:activate";return`
11737
11737
  <script data-hydrate="${$}">
11738
11738
  (function() {
11739
11739
  const island = document.querySelector('[data-island="${$}"]');
@@ -11754,9 +11754,9 @@ else {
11754
11754
  });
11755
11755
  })();
11756
11756
  </script>
11757
- `}function QX($,Z={},Y){let J=$,X=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=T5(J,"load",Z),J=T5(J,"idle",Z),J=T5(J,"visible",Z),J=T5(J,"media",Z),J=O_(J),J=T5(J,"hover",Z),J=T5(J,"event",Z),X=Q&&J!==$,X)J+=`
11758
- `+ZX();return J}function T5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(X,Q,G)=>{let K={strategy:Z};if(Q)try{let H=Q.split(",").map((L)=>L.trim());for(let L of H){let[V,O]=L.split(":").map((F)=>F.trim());if(V&&O){let F=O.replace(/^['"]|['"]$/g,"");K[V]=F}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,z=YX(G.trim()),q=JX(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(z)U.push(`data-component="${z}"`);let _=Object.keys(q).length>0?`
11759
- <script type="application/json" data-island-props="${W}">${JSON.stringify(q)}</script>`:"",B="";switch(Z){case"load":B=q_(W);break;case"idle":B=U_(W,K);break;case"visible":B=j_(W,K);break;case"media":B=__(W,K);break;case"hover":B=B_(W);break;case"event":B=H_(W,K);break}return`
11757
+ `}function KX($,Z={},Y){let J=$,X=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=I5(J,"load",Z),J=I5(J,"idle",Z),J=I5(J,"visible",Z),J=I5(J,"media",Z),J=V_(J),J=I5(J,"hover",Z),J=I5(J,"event",Z),X=Q&&J!==$,X)J+=`
11758
+ `+JX();return J}function I5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(X,Q,G)=>{let K={strategy:Z};if(Q)try{let H=Q.split(",").map((L)=>L.trim());for(let L of H){let[V,O]=L.split(":").map((F)=>F.trim());if(V&&O){let F=O.replace(/^['"]|['"]$/g,"");K[V]=F}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,z=XX(G.trim()),q=QX(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(z)U.push(`data-component="${z}"`);let _=Object.keys(q).length>0?`
11759
+ <script type="application/json" data-island-props="${W}">${JSON.stringify(q)}</script>`:"",B="";switch(Z){case"load":B=__(W);break;case"idle":B=B_(W,K);break;case"visible":B=H_(W,K);break;case"media":B=O_(W,K);break;case"hover":B=L_(W);break;case"event":B=F_(W,K);break}return`
11760
11760
  <div data-island="${W}"
11761
11761
  data-strategy="${Z}"
11762
11762
  ${U.join(`
@@ -11766,7 +11766,7 @@ else {
11766
11766
  ${G.trim()}${_}
11767
11767
  </div>
11768
11768
  ${B}
11769
- `})}function O_($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let X=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
11769
+ `})}function V_($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let X=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
11770
11770
  <div data-island="${X}"
11771
11771
  data-strategy="only"
11772
11772
  class="stx-island stx-client-only">
@@ -11785,7 +11785,7 @@ else {
11785
11785
  }
11786
11786
  })();
11787
11787
  </script>
11788
- `})}function GX(){return`
11788
+ `})}function WX(){return`
11789
11789
  /* Island base styles */
11790
11790
  .stx-island {
11791
11791
  display: contents;
@@ -11826,11 +11826,11 @@ else {
11826
11826
  .stx-island.hydrated {
11827
11827
  opacity: 1;
11828
11828
  }
11829
- `}function KX($){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 WX($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function zX(){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 qX($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function UX($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function jX($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function _X($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
11829
+ `}function zX($){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 qX($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function UX(){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 jX($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function _X($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function BX($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function HX($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
11830
11830
  <script type="application/json" id="stx-island-manifest">
11831
11831
  ${JSON.stringify(Z)}
11832
11832
  </script>
11833
- `}var L_;var HX=S(()=>{L_={processPartialHydrationDirectives:QX,processStaticDirectives:jX,generatePartialHydrationCSS:GX,generateIslandManifest:_X,createIslandRegistry:XX,hydrateIsland:KX,hydrateByStrategy:WX,hydrateAll:zX,isHydrated:qX,onHydrated:UX}});var IX={};a(IX,{watchMultiple:()=>wX,watchEffect:()=>AX,watch:()=>VX,unref:()=>OX,toRefs:()=>LX,throttledComputed:()=>TX,stxWatchMultiple:()=>wX,stxWatchEffect:()=>AX,stxWatch:()=>VX,stxUnref:()=>OX,stxToRefs:()=>LX,stxThrottledComputed:()=>TX,stxShallowRef:()=>FX,stxRef:()=>I5,stxIsRef:()=>D1,stxDebouncedComputed:()=>MX,stxComputed:()=>L$,shallowRef:()=>FX,ref:()=>I5,processWatchDirectives:()=>NX,processComputedDirectives:()=>RX,isRef:()=>D1,default:()=>F_,debouncedComputed:()=>MX,computed:()=>L$});function I5($){let Z=$,Y=new Set,J={get value(){if(Q1){let X=O$.get(J);if(!X)X=new Set,O$.set(J,X);X.add(Q1)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,Y.forEach((G)=>G(X));let Q=O$.get(J);if(Q)Q.forEach((G)=>G())}},subscribe(X){return Y.add(X),()=>Y.delete(X)},peek(){return Z}};return J}function D1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function OX($){return D1($)?$.value:$}function LX($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=I5($[Y]);return Z}function FX($){return I5($)}function L$($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,X=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,W=new Set,z=()=>{if(G=!0,W.size>0){let j=U.value;W.forEach((_)=>_(j))}};function q(){K.clear();let j=Q1;Q1=z,$7.push(z);try{return Y()}finally{$7.pop(),Q1=j}}let U={get value(){if(Q1){let j=O$.get(U);if(!j)j=new Set,O$.set(U,j);j.add(Q1)}if(G){let j=q();if(!X(Q,j))Q=j;G=!1}return Q},set value(j){if(J)J(j);else console.warn("Computed property is readonly")},subscribe(j){return W.add(j),()=>W.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function VX($,Z,Y={}){let{immediate:J=!1,deep:X=!1,flush:Q="pre",once:G=!1}=Y,K,W=!0,z=!1,q=()=>{if(D1($))return X?r1($.value):$.value;return $()},U=()=>{if(!W||z)return;let B=q();if(K!==void 0&&Object.is(K,B)&&!X)return;let H=()=>{if(Z(B,K),K=X?r1(B):B,G)_()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},j=null;if(D1($))j=$.subscribe(()=>U());else j=L$($).subscribe(()=>U());if(J)K=void 0,U();else K=q();let _=()=>{if(W=!1,j)j(),j=null};return _.pause=()=>{z=!0},_.resume=()=>{z=!1},_}function wX($,Z,Y={}){let{immediate:J=!1,once:X=!1}=Y,Q=$.map((U)=>D1(U)?U.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let U=$.map((j)=>D1(j)?j.value:void 0);if(Z(U,Q),Q=[...U],X)q()},z=$.map((U)=>{if(D1(U))return U.subscribe(()=>W());return()=>{}});if(J)W();let q=()=>{G=!1,z.forEach((U)=>U())};return q.pause=()=>{K=!0},q.resume=()=>{K=!1},q}function AX($,Z={}){let{flush:Y="pre"}=Z,J,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(J)J();let W=Q1;Q1=G,$7.push(G);try{J=$()}finally{$7.pop(),Q1=W}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(X=!1,J)J()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function RX($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(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 NX($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(X,Q,G)=>{return`
11833
+ `}var w_;var LX=S(()=>{w_={processPartialHydrationDirectives:KX,processStaticDirectives:BX,generatePartialHydrationCSS:WX,generateIslandManifest:HX,createIslandRegistry:GX,hydrateIsland:zX,hydrateByStrategy:qX,hydrateAll:UX,isHydrated:jX,onHydrated:_X}});var EX={};a(EX,{watchMultiple:()=>RX,watchEffect:()=>NX,watch:()=>AX,unref:()=>FX,toRefs:()=>VX,throttledComputed:()=>DX,stxWatchMultiple:()=>RX,stxWatchEffect:()=>NX,stxWatch:()=>AX,stxUnref:()=>FX,stxToRefs:()=>VX,stxThrottledComputed:()=>DX,stxShallowRef:()=>wX,stxRef:()=>D5,stxIsRef:()=>E1,stxDebouncedComputed:()=>IX,stxComputed:()=>F$,shallowRef:()=>wX,ref:()=>D5,processWatchDirectives:()=>TX,processComputedDirectives:()=>MX,isRef:()=>E1,default:()=>A_,debouncedComputed:()=>IX,computed:()=>F$});function D5($){let Z=$,Y=new Set,J={get value(){if(G1){let X=L$.get(J);if(!X)X=new Set,L$.set(J,X);X.add(G1)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,Y.forEach((G)=>G(X));let Q=L$.get(J);if(Q)Q.forEach((G)=>G())}},subscribe(X){return Y.add(X),()=>Y.delete(X)},peek(){return Z}};return J}function E1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function FX($){return E1($)?$.value:$}function VX($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=D5($[Y]);return Z}function wX($){return D5($)}function F$($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,X=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,W=new Set,z=()=>{if(G=!0,W.size>0){let j=U.value;W.forEach((_)=>_(j))}};function q(){K.clear();let j=G1;G1=z,Y7.push(z);try{return Y()}finally{Y7.pop(),G1=j}}let U={get value(){if(G1){let j=L$.get(U);if(!j)j=new Set,L$.set(U,j);j.add(G1)}if(G){let j=q();if(!X(Q,j))Q=j;G=!1}return Q},set value(j){if(J)J(j);else console.warn("Computed property is readonly")},subscribe(j){return W.add(j),()=>W.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function AX($,Z,Y={}){let{immediate:J=!1,deep:X=!1,flush:Q="pre",once:G=!1}=Y,K,W=!0,z=!1,q=()=>{if(E1($))return X?a1($.value):$.value;return $()},U=()=>{if(!W||z)return;let B=q();if(K!==void 0&&Object.is(K,B)&&!X)return;let H=()=>{if(Z(B,K),K=X?a1(B):B,G)_()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},j=null;if(E1($))j=$.subscribe(()=>U());else j=F$($).subscribe(()=>U());if(J)K=void 0,U();else K=q();let _=()=>{if(W=!1,j)j(),j=null};return _.pause=()=>{z=!0},_.resume=()=>{z=!1},_}function RX($,Z,Y={}){let{immediate:J=!1,once:X=!1}=Y,Q=$.map((U)=>E1(U)?U.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let U=$.map((j)=>E1(j)?j.value:void 0);if(Z(U,Q),Q=[...U],X)q()},z=$.map((U)=>{if(E1(U))return U.subscribe(()=>W());return()=>{}});if(J)W();let q=()=>{G=!1,z.forEach((U)=>U())};return q.pause=()=>{K=!0},q.resume=()=>{K=!1},q}function NX($,Z={}){let{flush:Y="pre"}=Z,J,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(J)J();let W=G1;G1=G,Y7.push(G);try{J=$()}finally{Y7.pop(),G1=W}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(X=!1,J)J()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function MX($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(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 TX($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(X,Q,G)=>{return`
11834
11834
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
11835
11835
  (function() {
11836
11836
  // Watch implementation for ${Q}
@@ -11842,9 +11842,9 @@ else {
11842
11842
  }
11843
11843
  })();
11844
11844
  </script>
11845
- `})}function r1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>r1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set(r1(X),r1(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(r1(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=r1($[Y]);return Z}function MX($,Z=100){let Y=I5($()),J=null,X=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return L$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}function TX($,Z=100){let Y=I5($()),J=0,X=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return L$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}var Q1=null,$7,O$,F_;var DX=S(()=>{$7=[],O$=new WeakMap;F_={ref:I5,computed:L$,watch:VX,watchMultiple:wX,watchEffect:AX,isRef:D1,unref:OX,toRefs:LX,shallowRef:FX,debouncedComputed:MX,throttledComputed:TX,processComputedDirectives:RX,processWatchDirectives:NX}});var SX={};a(SX,{v:()=>V_,processHasErrorsDirective:()=>bX,processFormValidationDirectives:()=>A_,processErrorsDirective:()=>kX,processErrorDirective:()=>EX,defineForm:()=>w_,Validator:()=>D5});class D5{rules=[];defaultValue="";addRule($){let Z=new D5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Y}})}length($,Z,Y){let J=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:J,validate:(X)=>{if(!X)return!0;let Q=String(X).length;return Q>=$&&Q<=Z||J}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Y}})}between($,Z,Y){let J=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:J,validate:(X)=>{if(!X&&X!==0)return!0;let Q=Number(X);return Q>=$&&Q<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,X)=>{if(!X)return!0;return J===X[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return $.includes(J)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),J=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new D5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(X,Q)=>{if(!$(X,Q||{}))return!0;return J.validate(X,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new D5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let X=await J.validate($,Z);if(X!==!0)Y.push(X)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let X=J.validate($,Z);if(X!==!0)Y.push(X)}return Y}}function w_($,Z){let Y=Object.keys($),J={},X={},Q={},G={},K={};for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1,K[O]=!1;let W=!1;async function z(O){K[O]=!0;let F=await $[O].validate(J[O],J);return X[O]=F,K[O]=!1,F.length===0}async function q(){W=!0;let O=await Promise.all(Y.map(z));return W=!1,O.every(Boolean)}function U(){for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1}function j(O){for(let F of Y)if(F in O)J[F]=O[F],G[F]=!0}function _(O,F){J[O]=F,G[O]=!0}function B(O,F=!0){if(Q[O]=F,F)z(O)}function H(O){return{value:J[O],errors:X[O],touched:Q[O],dirty:G[O],valid:X[O].length===0,validating:K[O]}}function L(O){return async(F)=>{F?.preventDefault?.();for(let A of Y)Q[A]=!0;if(await q())await O(J)}}return{values:J,errors:X,touched:Q,dirty:G,get isValid(){return Y.every((O)=>X[O].length===0)},get isValidating(){return W||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:q,validateField:z,reset:U,setValues:j,setFieldValue:_,setFieldTouched:B,getFieldState:H,handleSubmit:L}}function EX($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let q of K)if(W&&typeof W==="object"&&q in W)W=W[q];else return"";let z=W;if(!z||!Array.isArray(z)||z.length===0)return"";return z.map((q)=>{return G.replace(/\{\{\s*message\s*\}\}/g,q)}).join(`
11846
- `)}catch{return""}})}function kX($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let q of K)if(W&&typeof W==="object"&&q in W)W=W[q];else return"";let z=W;if(!z||!Array.isArray(z)||z.length===0)return"";return z.map((q)=>G.replace(/\{\{\s*message\s*\}\}/g,q)).join(`
11847
- `)}catch{return""}})}function bX($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let q of K)if(W&&typeof W==="object"&&q in W)W=W[q];else return"";let z=W;if(!z||!Array.isArray(z)||z.length===0)return"";return G}catch{return""}})}function A_($,Z,Y){let J=$;return J=EX(J,Z,Y),J=kX(J,Z,Y),J=bX(J,Z,Y),J}var V_;var yX=S(()=>{V_=new D5});var vX={};a(vX,{processXElementDirectives:()=>R_,hasXElementDirectives:()=>CX,generateXElementRuntime:()=>PX});function PX(){return`<script data-stx-scoped data-stx-x-element-runtime>
11845
+ `})}function a1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>a1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set(a1(X),a1(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(a1(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=a1($[Y]);return Z}function IX($,Z=100){let Y=D5($()),J=null,X=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return F$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}function DX($,Z=100){let Y=D5($()),J=0,X=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return F$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}var G1=null,Y7,L$,A_;var kX=S(()=>{Y7=[],L$=new WeakMap;A_={ref:D5,computed:F$,watch:AX,watchMultiple:RX,watchEffect:NX,isRef:E1,unref:FX,toRefs:VX,shallowRef:wX,debouncedComputed:IX,throttledComputed:DX,processComputedDirectives:MX,processWatchDirectives:TX}});var PX={};a(PX,{v:()=>R_,processHasErrorsDirective:()=>yX,processFormValidationDirectives:()=>M_,processErrorsDirective:()=>SX,processErrorDirective:()=>bX,defineForm:()=>N_,Validator:()=>E5});class E5{rules=[];defaultValue="";addRule($){let Z=new E5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Y}})}length($,Z,Y){let J=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:J,validate:(X)=>{if(!X)return!0;let Q=String(X).length;return Q>=$&&Q<=Z||J}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Y}})}between($,Z,Y){let J=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:J,validate:(X)=>{if(!X&&X!==0)return!0;let Q=Number(X);return Q>=$&&Q<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,X)=>{if(!X)return!0;return J===X[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return $.includes(J)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),J=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new E5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(X,Q)=>{if(!$(X,Q||{}))return!0;return J.validate(X,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new E5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let X=await J.validate($,Z);if(X!==!0)Y.push(X)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let X=J.validate($,Z);if(X!==!0)Y.push(X)}return Y}}function N_($,Z){let Y=Object.keys($),J={},X={},Q={},G={},K={};for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1,K[O]=!1;let W=!1;async function z(O){K[O]=!0;let F=await $[O].validate(J[O],J);return X[O]=F,K[O]=!1,F.length===0}async function q(){W=!0;let O=await Promise.all(Y.map(z));return W=!1,O.every(Boolean)}function U(){for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1}function j(O){for(let F of Y)if(F in O)J[F]=O[F],G[F]=!0}function _(O,F){J[O]=F,G[O]=!0}function B(O,F=!0){if(Q[O]=F,F)z(O)}function H(O){return{value:J[O],errors:X[O],touched:Q[O],dirty:G[O],valid:X[O].length===0,validating:K[O]}}function L(O){return async(F)=>{F?.preventDefault?.();for(let A of Y)Q[A]=!0;if(await q())await O(J)}}return{values:J,errors:X,touched:Q,dirty:G,get isValid(){return Y.every((O)=>X[O].length===0)},get isValidating(){return W||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:q,validateField:z,reset:U,setValues:j,setFieldValue:_,setFieldTouched:B,getFieldState:H,handleSubmit:L}}function bX($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let q of K)if(W&&typeof W==="object"&&q in W)W=W[q];else return"";let z=W;if(!z||!Array.isArray(z)||z.length===0)return"";return z.map((q)=>{return G.replace(/\{\{\s*message\s*\}\}/g,q)}).join(`
11846
+ `)}catch{return""}})}function SX($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let q of K)if(W&&typeof W==="object"&&q in W)W=W[q];else return"";let z=W;if(!z||!Array.isArray(z)||z.length===0)return"";return z.map((q)=>G.replace(/\{\{\s*message\s*\}\}/g,q)).join(`
11847
+ `)}catch{return""}})}function yX($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let q of K)if(W&&typeof W==="object"&&q in W)W=W[q];else return"";let z=W;if(!z||!Array.isArray(z)||z.length===0)return"";return G}catch{return""}})}function M_($,Z,Y){let J=$;return J=bX(J,Z,Y),J=SX(J,Z,Y),J=yX(J,Z,Y),J}var R_;var CX=S(()=>{R_=new E5});var fX={};a(fX,{processXElementDirectives:()=>T_,hasXElementDirectives:()=>xX,generateXElementRuntime:()=>vX});function vX(){return`<script data-stx-scoped data-stx-x-element-runtime>
11848
11848
  (function() {
11849
11849
  'use strict';
11850
11850
 
@@ -12128,16 +12128,16 @@ else {
12128
12128
  // Expose for manual initialization
12129
12129
  window.XElement = XElement;
12130
12130
  })();
12131
- </script>`}function CX($){return/\bx-data(?:\s|=)/.test($)}function R_($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],J=Y.length>0?$.replace(Z,""):$;if(!CX(J))return J;let X=Y[0]?.trim()||PX(),Q=J.lastIndexOf("</body>");if(Q!==-1)return J.slice(0,Q)+X+`
12131
+ </script>`}function xX($){return/\bx-data(?:\s|=)/.test($)}function T_($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],J=Y.length>0?$.replace(Z,""):$;if(!xX(J))return J;let X=Y[0]?.trim()||vX(),Q=J.lastIndexOf("</body>");if(Q!==-1)return J.slice(0,Q)+X+`
12132
12132
  `+J.slice(Q);return J+`
12133
- `+X}var xX={};a(xX,{rewriteImagesWithSiblings:()=>T_});import U1 from"path";async function T_($,Z){let Y=Z.formats??M_;if(!Z.publicDir)return $;let J=E_($),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(k_(K.index,J))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 I_(U.src,Z.publicDir,Y);return{match:U,sources:j}}));for(let{match:U,sources:j}of W){if(j.length===0)continue;let B=`<picture>${j.map((H)=>`<source type="${H.mime}" srcset="${b_(H.url)}">`).join("")}${U.raw}</picture>`;X.push({start:U.idx,end:U.idx+U.length,replacement:B})}if(X.length===0)return $;let z="",q=0;for(let U of X)z+=$.slice(q,U.start),z+=U.replacement,q=U.end;return z+=$.slice(q),z}async function I_($,Z,Y){if(!D_($))return[];let J=U1.extname($).toLowerCase();if(!N_.has(J))return[];if(!$.startsWith("/"))return[];let X=U1.join(Z,$.slice(1)),Q=U1.dirname(X),G=U1.basename(X,J),K=U1.resolve(Q),W=U1.resolve(Z);if(!K.startsWith(W))return[];let z=U1.posix.dirname($),q=Y.map(async(j)=>{let _=U1.join(Q,`${G}${j.ext}`);if(!await Bun.file(_).exists())return null;return{url:U1.posix.join(z,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(q)).filter((j)=>j!==null)}function D_($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function E_($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);return Z}function k_($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function b_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var N_,M_;var fX=S(()=>{N_=new Set([".jpg",".jpeg",".png",".gif"]),M_=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var gX=()=>{};function i6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var hX=S(()=>{gX()});var dX={};a(dX,{injectPwaTags:()=>S_,generateThemeColorMeta:()=>C_,generateSwRegistrationScript:()=>y_,generatePwaTags:()=>Z7,generateManifestLink:()=>P_});function Z7($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=i6($),Q=`
12133
+ `+X}var gX={};a(gX,{rewriteImagesWithSiblings:()=>E_});import j1 from"path";async function E_($,Z){let Y=Z.formats??D_;if(!Z.publicDir)return $;let J=S_($),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(y_(K.index,J))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 k_(U.src,Z.publicDir,Y);return{match:U,sources:j}}));for(let{match:U,sources:j}of W){if(j.length===0)continue;let B=`<picture>${j.map((H)=>`<source type="${H.mime}" srcset="${P_(H.url)}">`).join("")}${U.raw}</picture>`;X.push({start:U.idx,end:U.idx+U.length,replacement:B})}if(X.length===0)return $;let z="",q=0;for(let U of X)z+=$.slice(q,U.start),z+=U.replacement,q=U.end;return z+=$.slice(q),z}async function k_($,Z,Y){if(!b_($))return[];let J=j1.extname($).toLowerCase();if(!I_.has(J))return[];if(!$.startsWith("/"))return[];let X=j1.join(Z,$.slice(1)),Q=j1.dirname(X),G=j1.basename(X,J),K=j1.resolve(Q),W=j1.resolve(Z);if(!K.startsWith(W))return[];let z=j1.posix.dirname($),q=Y.map(async(j)=>{let _=j1.join(Q,`${G}${j.ext}`);if(!await Bun.file(_).exists())return null;return{url:j1.posix.join(z,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(q)).filter((j)=>j!==null)}function b_($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function S_($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);return Z}function y_($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function P_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var I_,D_;var hX=S(()=>{I_=new Set([".jpg",".jpeg",".png",".gif"]),D_=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var dX=()=>{};function n6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var uX=S(()=>{dX()});var mX={};a(mX,{injectPwaTags:()=>C_,generateThemeColorMeta:()=>f_,generateSwRegistrationScript:()=>v_,generatePwaTags:()=>J7,generateManifestLink:()=>x_});function J7($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=n6($),Q=`
12134
12134
  <!-- stx PWA Meta Tags -->
12135
12135
  <link rel="manifest" href="/manifest.json">
12136
- <meta name="theme-color" content="${n6(Y?.themeColor||"#000000")}">
12136
+ <meta name="theme-color" content="${o6(Y?.themeColor||"#000000")}">
12137
12137
  <meta name="mobile-web-app-capable" content="yes">
12138
12138
  <meta name="apple-mobile-web-app-capable" content="yes">
12139
12139
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
12140
- <meta name="apple-mobile-web-app-title" content="${n6(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)Q+=`
12140
+ <meta name="apple-mobile-web-app-title" content="${o6(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)Q+=`
12141
12141
  <link rel="apple-touch-icon" href="${J}/apple-touch-icon.png">
12142
12142
  <link rel="apple-touch-icon" sizes="120x120" href="${J}/apple-touch-icon-120x120.png">
12143
12143
  <link rel="apple-touch-icon" sizes="152x152" href="${J}/apple-touch-icon-152x152.png">
@@ -12174,12 +12174,12 @@ if ('serviceWorker' in navigator) {
12174
12174
  });
12175
12175
  }
12176
12176
  </script>
12177
- <!-- End stx PWA -->`,Q}function S_($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1){let Q=Z7(Z);return $.slice(0,X)+Q+`
12178
- `+$.slice(X)}return $+Z7(Z)}let J=Z7(Z);return $.replace("</head>",`${J}
12179
- </head>`)}function y_($){if(!$.pwa?.enabled)return"";return`<script>
12177
+ <!-- End stx PWA -->`,Q}function C_($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1){let Q=J7(Z);return $.slice(0,X)+Q+`
12178
+ `+$.slice(X)}return $+J7(Z)}let J=J7(Z);return $.replace("</head>",`${J}
12179
+ </head>`)}function v_($){if(!$.pwa?.enabled)return"";return`<script>
12180
12180
  if ('serviceWorker' in navigator) {
12181
12181
  window.addEventListener('load', function() {
12182
- navigator.serviceWorker.register('/${i6($)}')
12182
+ navigator.serviceWorker.register('/${n6($)}')
12183
12183
  .then(function(registration) {
12184
12184
  console.log('[PWA] Service Worker registered:', registration.scope);
12185
12185
  })
@@ -12188,79 +12188,79 @@ if ('serviceWorker' in navigator) {
12188
12188
  });
12189
12189
  });
12190
12190
  }
12191
- </script>`}function P_(){return'<link rel="manifest" href="/manifest.json">'}function C_($){return`<meta name="theme-color" content="${n6($)}">`}function n6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var uX=S(()=>{hX()});import g0 from"path";import{deriveLayoutGroup as v_}from"stx-router/layout-metadata";function mX($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function x_($,Z){let Y=$.length,J=Z,X=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(J<Y){let K=$[J];if(G(J))return J;if(K==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
12191
+ </script>`}function x_(){return'<link rel="manifest" href="/manifest.json">'}function f_($){return`<meta name="theme-color" content="${o6($)}">`}function o6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var pX=S(()=>{uX()});import g0 from"path";import{deriveLayoutGroup as g_}from"stx-router/layout-metadata";function lX($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function h_($,Z){let Y=$.length,J=Z,X=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(J<Y){let K=$[J];if(G(J))return J;if(K==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
12192
12192
  `,J+2),J===-1)return-1;J+=1,X=!0;continue}if(K==="/"&&$[J+1]==="*"){let W=$.indexOf("*/",J+2);if(W===-1)return-1;J=W+2,X=!0;continue}if(K==="/"&&X){let W=J+1,z=!1;while(W<Y){let q=$[W];if(q==="\\"){W+=2;continue}if(q==="[")z=!0;else if(q==="]")z=!1;else if(q==="/"&&!z){W++;break}else if(q===`
12193
12193
  `){W=-1;break}W++}if(W===-1){J++,X=!1;continue}while(W<Y&&/[a-z]/.test($[W]))W++;J=W,X=!1;continue}if(K==="'"||K==='"'){let W=K;J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]===W){J++;break}if($[J]===`
12194
- `)break;J++}X=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,X=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;J++}return-1}function Y7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let X=J.index+J[0].length,Q=$.indexOf("</script>",X);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function pX($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let Q=$.indexOf("-->",Y+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(Y),X=/^<style\b[^>]*>/i.exec(J);if(X){let Q=$.toLowerCase().indexOf("</style>",Y+X[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return Y;Z=Y+1}return-1}function f_($){let Z=Y7($,"data-stx-runtime");if(!Z)return $;let Y=pX($);if(Y===-1||Y===Z.start)return $;let J=$.slice(Z.start,Z.end),X=$.slice(0,Z.start)+$.slice(Z.end),Q=pX(X);if(Q===-1)return J+`
12194
+ `)break;J++}X=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,X=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;J++}return-1}function X7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let X=J.index+J[0].length,Q=$.indexOf("</script>",X);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function cX($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let Q=$.indexOf("-->",Y+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(Y),X=/^<style\b[^>]*>/i.exec(J);if(X){let Q=$.toLowerCase().indexOf("</style>",Y+X[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return Y;Z=Y+1}return-1}function d_($){let Z=X7($,"data-stx-runtime");if(!Z)return $;let Y=cX($);if(Y===-1||Y===Z.start)return $;let J=$.slice(Z.start,Z.end),X=$.slice(0,Z.start)+$.slice(Z.end),Q=cX(X);if(Q===-1)return J+`
12195
12195
  `+X;return X.slice(0,Q)+J+`
12196
- `+X.slice(Q)}async function O0($,Z,Y,J,X){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;let Q=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!Z$()&&!M4())&&Y&&Y.endsWith(".stx"))e3($,Y);try{return await l9.timeAsync("template-processing",async()=>{let G=await g_($,Z,Y,J,X);if(Q)G=h6(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},z=(Z.__stx_runtime_head||null)??V7(),q=(Z.__stx_head_raw||"").trim(),U,j=q.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)U=j[1].trim(),q=q.replace(j[0],"").trim();let _=Z.__sections?.title,B=z.title||U||_,H={...K,...B&&{title:B},meta:[...K.meta||[],...z.meta||[]],link:[...K.link||[],...z.link||[]],script:[...K.script||[],...z.script||[]],headRaw:[K.headRaw,q].filter(Boolean).join(`
12197
- `),...z.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...z.htmlAttrs}},...z.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...z.bodyAttrs}}},L=x6(G);if(G=VJ(G,H),L)G=FJ(G,K);let V=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(V&&G.includes("<head")){let F=V[1],w=v_(F);G=G.replace("<head>",`<head>
12198
- <meta name="stx-layout" content="${mX(F)}">
12199
- <meta name="stx-layout-group" content="${mX(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let F=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(F,"$1")}}if(Q)G=LJ(G),G=f_(G);if(Q)try{let{getStoreScript:K}=await Promise.resolve().then(() => (EJ(),DJ)),W=J.storesDir,z=await K(W);if(z){let q=`<script data-stx-stores>${z}</script>`,U=Y7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
12200
- `+q+G.slice(U.end)}}catch{}if(Q)try{let{getComposableScript:K}=await Promise.resolve().then(() => (SJ(),bJ)),W=J.composablesDir,z=await K(W);if(z){let q=`<script data-stx-composables>${z}</script>`,U=Y7(G,"data-stx-stores")||Y7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
12201
- `+q+G.slice(U.end)}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await Q$(G);if(Q)G=s9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof E4)throw G;let K=G instanceof Error?G.message:String(G),W=new p1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(t0.log(W,{filePath:Y,context:Z}),T3.logDetailedError(W,{filePath:Y,template:$.substring(0,500)}),J.debug)throw W;return N3.createFallbackContent("Template Processing",W)}}async function g_($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!g0.isAbsolute(J.partialsDir)?g0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!g0.isAbsolute(J.componentsDir)?g0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!g0.isAbsolute(J.layoutsDir)?g0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,W=$;await u_(Y,Z),d_(Z,K),W=await _5(()=>YJ(W,Z,Y,K),W,(O)=>{t0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let z=Z1(W,d5,(O,F)=>`\x00STX_HTML_COMMENT_${F}\x00`);W=z.output;let q=z.tokens,U=(O)=>q.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(F,w)=>q[Number(w)]??""),j="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,j),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(O,F)=>{return`{{ ${F} }}`}),W=_J(W),W=await RJ(W,Y,X);let _={};W=P6(W,_);let B={...Z.__sections||{}},H="",L=/@nolayout\b/.test(W);if(L)W=W.replace(/@nolayout\b\s*/g,"");let V=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(V)H=V[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(W),F=/@section\s*\(/.test(W);if(!O||F){let w="",A=g0.dirname(Y),R=K.layoutsDir?g0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let M=g0.join(A,"_layout.stx");if(await c(M)){w=M;break}let T=g0.dirname(A);if(T===A||T.length<R.length)break;A=T}if(w)H=w;else if(K.layoutsDir){let N=g0.isAbsolute(K.layoutsDir)?K.layoutsDir:g0.resolve(process.cwd(),K.layoutsDir),M=g0.join(N,`${K.defaultLayout}.stx`);if(await c(M))H=M}if(H&&!F)W=`@section('content')
12196
+ `+X.slice(Q)}async function O0($,Z,Y,J,X){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;let Q=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!Y$()&&!T4())&&Y&&Y.endsWith(".stx"))$6($,Y);try{return await c9.timeAsync("template-processing",async()=>{let G=await u_($,Z,Y,J,X);if(Q)G=d6(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},z=(Z.__stx_runtime_head||null)??A7(),q=(Z.__stx_head_raw||"").trim(),U,j=q.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)U=j[1].trim(),q=q.replace(j[0],"").trim();let _=Z.__sections?.title,B=z.title||U||_,H={...K,...B&&{title:B},meta:[...K.meta||[],...z.meta||[]],link:[...K.link||[],...z.link||[]],script:[...K.script||[],...z.script||[]],headRaw:[K.headRaw,q].filter(Boolean).join(`
12197
+ `),...z.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...z.htmlAttrs}},...z.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...z.bodyAttrs}}},L=f6(G);if(G=AJ(G,H),L)G=wJ(G,K);let V=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(V&&G.includes("<head")){let F=V[1],w=g_(F);G=G.replace("<head>",`<head>
12198
+ <meta name="stx-layout" content="${lX(F)}">
12199
+ <meta name="stx-layout-group" content="${lX(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let F=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(F,"$1")}}if(Q)G=VJ(G),G=d_(G);if(Q)try{let{getStoreScript:K}=await Promise.resolve().then(() => (bJ(),kJ)),W=J.storesDir,z=await K(W);if(z){let q=`<script data-stx-stores>${z}</script>`,U=X7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
12200
+ `+q+G.slice(U.end)}}catch{}if(Q)try{let{getComposableScript:K}=await Promise.resolve().then(() => (PJ(),yJ)),W=J.composablesDir,z=await K(W);if(z){let q=`<script data-stx-composables>${z}</script>`,U=X7(G,"data-stx-stores")||X7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
12201
+ `+q+G.slice(U.end)}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await G$(G,void 0,J.buildMode==="serve");if(Q)G=r9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof k4)throw G;let K=G instanceof Error?G.message:String(G),W=new l1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(t0.log(W,{filePath:Y,context:Z}),D3.logDetailedError(W,{filePath:Y,template:$.substring(0,500)}),J.debug)throw W;return T3.createFallbackContent("Template Processing",W)}}async function u_($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!g0.isAbsolute(J.partialsDir)?g0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!g0.isAbsolute(J.componentsDir)?g0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!g0.isAbsolute(J.layoutsDir)?g0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,W=$;await l_(Y,Z),p_(Z,K),W=await B5(()=>XJ(W,Z,Y,K),W,(O)=>{t0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let z=Y1(W,u5,(O,F)=>`\x00STX_HTML_COMMENT_${F}\x00`);W=z.output;let q=z.tokens,U=(O)=>q.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(F,w)=>q[Number(w)]??""),j="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,j),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(O,F)=>{return`{{ ${F} }}`}),W=HJ(W),W=await MJ(W,Y,X);let _={};W=C6(W,_);let B={...Z.__sections||{}},H="",L=/@nolayout\b/.test(W);if(L)W=W.replace(/@nolayout\b\s*/g,"");let V=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(V)H=V[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(W),F=/@section\s*\(/.test(W);if(!O||F){let w="",A=g0.dirname(Y),R=K.layoutsDir?g0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let M=g0.join(A,"_layout.stx");if(await c(M)){w=M;break}let T=g0.dirname(A);if(T===A||T.length<R.length)break;A=T}if(w)H=w;else if(K.layoutsDir){let N=g0.isAbsolute(K.layoutsDir)?K.layoutsDir:g0.resolve(process.cwd(),K.layoutsDir),M=g0.join(N,`${K.defaultLayout}.stx`);if(await c(M))H=M}if(H&&!F)W=`@section('content')
12202
12202
  ${W.trim()}
12203
- @endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,F,w)=>{return B[F]=w,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,F,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=$0(w.trim(),Z);if(A===void 0)return O;return B[F]=String(A??""),""}catch{return O}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,F,w)=>{if(w.includes("@parent"))B[F]=w.replace("@parent",a1);else B[F]=w.trim();return""}),Z.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,F,w)=>{return B[F]||w||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=C6(W,_),H){let O=[],F=L1(W),w=Z1(F.output,Y5,(A,R)=>`\x00STX_ORPHAN_STYLE_${R}\x00`);if(W=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,R,N)=>{let M=R==="SCRIPT"?F.scripts[Number(N)]:w.tokens[Number(N)];if(M)O.push(M);return""}),O.length>0){let A=O.join(`
12203
+ @endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,F,w)=>{return B[F]=w,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,F,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=$0(w.trim(),Z);if(A===void 0)return O;return B[F]=String(A??""),""}catch{return O}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,F,w)=>{if(w.includes("@parent"))B[F]=w.replace("@parent",t1);else B[F]=w.trim();return""}),Z.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,F,w)=>{return B[F]||w||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=v6(W,_),H){let O=[],F=F1(W),w=Y1(F.output,J5,(A,R)=>`\x00STX_ORPHAN_STYLE_${R}\x00`);if(W=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,R,N)=>{let M=R==="SCRIPT"?F.scripts[Number(N)]:w.tokens[Number(N)];if(M)O.push(M);return""}),O.length>0){let A=O.join(`
12204
12204
  `);B.content=B.content?`${B.content}
12205
- ${A}`:A,Z.__sections=B}}if(H)try{let O;if(g0.isAbsolute(H))O=H,X.add(H);else O=await _5(()=>m7(H,Y,G,X),null,()=>{throw new p1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let M=`Layout not found: ${H} (referenced from ${Y})`;if(t0.log(Error(M),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new p1(M,Y);return W}let F=await _5(()=>Bun.file(O).text(),"",()=>{throw new p1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let M={},T=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,y,b)=>{return M[y]=b.trim(),""});for(let[D,y]of Object.entries(M))if(B[D]&&B[D].includes(a1)){let b=B[D].indexOf(a1);B[D]=B[D].slice(0,b)+y+B[D].slice(b+a1.length)}else if(!B[D])B[D]=y;let I={...Z,__sections:B},E=`@layout('${w[1]}')${T}`;return await O0(E,I,O,G,X)}let A=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),R=P6(A,_),N={};return R=R.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,T,I)=>{return N[T]=I.trim(),`@slot('${T}')`}),R=R.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,T,I)=>{if(B[T]){let E=B[T];if(E.includes(a1)){let D=N[T]||"",y=E.indexOf(a1);E=E.slice(0,y)+D+E.slice(y+a1.length)}return E}return I||""}),R=h_(R,B),R=R.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),R=C6(R,_),Z.__originalFilePath=Y,W=await lX(R,Z,O,G,X),W=`<!-- stx-layout: ${H} -->
12206
- ${W}`,U(W)}catch(O){return t0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await lX(W,Z,Y,G,X))}function h_($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,X)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function d_($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(Y)&&Q!==void 0)J[X]=Q;$.$env=J}async function u_($,Z){await _5(()=>KJ($,Z),void 0,(Y)=>{t0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function m_($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await Promise.resolve().then(() => (o5(),y$));await W(G,Z,Y,{preserveExisting:!0})}catch(W){let z=W instanceof Error?W:Error(String(W));t0.log(z,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${z.message}`)}}}async function p_($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await Promise.resolve().then(() => (Y1(),d9));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return t0.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function lX($,Z,Y,J,X){let Q=$,G=J;if(await m_(Q,Z,Y),Q=await p_(Q,Z,Y),Q=await rY(Q,Z,Y),Q=await aY(Q,Z,Y),Q=await l2(Q,Z,Y,G),J5(Q))Q=x7(Q,Z),Q=g7(Q,Z);Q=f7(Q);let{processStreamDirectives:K}=await Promise.resolve().then(() => (t3(),a3));Q=K(Q,Z),Q=k6(Q,Z,Y,G),Q=await o4(Q,Z,Y,G,X),Q=await HJ(Q,Z,Y,G,X),Q=G9(Q,Z,Y,G);let{processDeferDirectives:W}=await Promise.resolve().then(() => PJ);Q=W(Q,Z,Y);let{processTeleportDirectives:z}=await Promise.resolve().then(() => vJ);Q=z(Q,Z,Y);let{processTransitionDirectives:q,processTransitionAttributes:U}=await Promise.resolve().then(() => hJ);Q=q(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:j}=await Promise.resolve().then(() => uJ);Q=j(Q,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => mJ);Q=_(Q,Z,Y);let{processAsyncDirectives:B}=await Promise.resolve().then(() => iJ);Q=B(Q,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => oJ);Q=H(Q,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await Promise.resolve().then(() => ($X(),eJ));Q=L(Q,Z,Y),Q=V(Q,Z,Y),Q=O(Q,Z,Y);let{processPartialHydrationDirectives:F,processStaticDirectives:w}=await Promise.resolve().then(() => (HX(),BX));Q=F(Q,Z,Y),Q=w(Q);let{processComputedDirectives:A,processWatchDirectives:R}=await Promise.resolve().then(() => (DX(),IX));Q=A(Q,Z,Y),Q=R(Q,Z,Y);let{processFormValidationDirectives:N}=await Promise.resolve().then(() => (yX(),SX));Q=N(Q,Z,Y);let{processHeadDirective:M,processTitleDirective:T,processMetaDirective:I,resetHead:E}=await Promise.resolve().then(() => (i5(),A7));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}
12207
- `;if(Q=T(Q,Z),Q=I(Q,Z),Q=QJ(Q),Q=g3(Q,Z),Q=m2(Q),Q=$J(Q),Q=await y6(Q,Z,Y,G,X),Q=await o4(Q,Z,Y,G,X),Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=h6(Q),Q=i1(Q,Z,Y),Q=h3(Q,Z),Q=d3(Q,Z),Q=h4(Q,Z),Q=e2(Q,Z),Q=$Y(Q,Z),Q=await b2(Q,Z,Y,G),Q=await h8(Q,Z,Y),Q=await QY(Q,Z,Y,G),Q=e6(Q,Z,Y,G),Q=nZ(Q,Z,Y,G),Q=oZ(Q,Z,Y),Q=sZ(Q,Z,Y,G),Q=h2(Q,Z,Y,G),Q=f6(Q,Z),Q=g6(Q),Q=MJ(Q),!G.skipEventDirectives)Q=N2(Q,Z,Y);if(Q=E2(Q,Z,Y),G.debug){let n=/\bx-data\s*=/.test(Q),J0=o$($);if(n&&J0)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
12205
+ ${A}`:A,Z.__sections=B}}if(H)try{let O;if(g0.isAbsolute(H))O=H,X.add(H);else O=await B5(()=>l7(H,Y,G,X),null,()=>{throw new l1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let M=`Layout not found: ${H} (referenced from ${Y})`;if(t0.log(Error(M),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new l1(M,Y);return W}let F=await B5(()=>Bun.file(O).text(),"",()=>{throw new l1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let M={},T=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,y,b)=>{return M[y]=b.trim(),""});for(let[D,y]of Object.entries(M))if(B[D]&&B[D].includes(t1)){let b=B[D].indexOf(t1);B[D]=B[D].slice(0,b)+y+B[D].slice(b+t1.length)}else if(!B[D])B[D]=y;let I={...Z,__sections:B},E=`@layout('${w[1]}')${T}`;return await O0(E,I,O,G,X)}let A=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),R=C6(A,_),N={};return R=R.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,T,I)=>{return N[T]=I.trim(),`@slot('${T}')`}),R=R.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,T,I)=>{if(B[T]){let E=B[T];if(E.includes(t1)){let D=N[T]||"",y=E.indexOf(t1);E=E.slice(0,y)+D+E.slice(y+t1.length)}return E}return I||""}),R=m_(R,B),R=R.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),R=v6(R,_),Z.__originalFilePath=Y,W=await iX(R,Z,O,G,X),W=`<!-- stx-layout: ${H} -->
12206
+ ${W}`,U(W)}catch(O){return t0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await iX(W,Z,Y,G,X))}function m_($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,X)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function p_($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(Y)&&Q!==void 0)J[X]=Q;$.$env=J}async function l_($,Z){await B5(()=>zJ($,Z),void 0,(Y)=>{t0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function c_($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await Promise.resolve().then(() => (s5(),P$));await W(G,Z,Y,{preserveExisting:!0})}catch(W){let z=W instanceof Error?W:Error(String(W));t0.log(z,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${z.message}`)}}}async function i_($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await Promise.resolve().then(() => (J1(),u9));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return t0.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function iX($,Z,Y,J,X){let Q=$,G=J;if(await c_(Q,Z,Y),Q=await i_(Q,Z,Y),Q=await tY(Q,Z,Y),Q=await eY(Q,Z,Y),Q=await i2(Q,Z,Y,G),X5(Q))Q=g7(Q,Z),Q=d7(Q,Z);Q=h7(Q);let{processStreamDirectives:K}=await Promise.resolve().then(() => (e3(),t3));Q=K(Q,Z),Q=b6(Q,Z,Y,G),Q=await r4(Q,Z,Y,G,X),Q=await LJ(Q,Z,Y,G,X),Q=K9(Q,Z,Y,G);let{processDeferDirectives:W}=await Promise.resolve().then(() => vJ);Q=W(Q,Z,Y);let{processTeleportDirectives:z}=await Promise.resolve().then(() => fJ);Q=z(Q,Z,Y);let{processTransitionDirectives:q,processTransitionAttributes:U}=await Promise.resolve().then(() => uJ);Q=q(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:j}=await Promise.resolve().then(() => pJ);Q=j(Q,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => lJ);Q=_(Q,Z,Y);let{processAsyncDirectives:B}=await Promise.resolve().then(() => oJ);Q=B(Q,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => rJ);Q=H(Q,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (YX(),ZX));Q=L(Q,Z,Y),Q=V(Q,Z,Y),Q=O(Q,Z,Y);let{processPartialHydrationDirectives:F,processStaticDirectives:w}=await Promise.resolve().then(() => (LX(),OX));Q=F(Q,Z,Y),Q=w(Q);let{processComputedDirectives:A,processWatchDirectives:R}=await Promise.resolve().then(() => (kX(),EX));Q=A(Q,Z,Y),Q=R(Q,Z,Y);let{processFormValidationDirectives:N}=await Promise.resolve().then(() => (CX(),PX));Q=N(Q,Z,Y);let{processHeadDirective:M,processTitleDirective:T,processMetaDirective:I,resetHead:E}=await Promise.resolve().then(() => (n5(),N7));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}
12207
+ `;if(Q=T(Q,Z),Q=I(Q,Z),Q=KJ(Q),Q=h3(Q,Z),Q=l2(Q),Q=YJ(Q),Q=await P6(Q,Z,Y,G,X),Q=await r4(Q,Z,Y,G,X),Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=d6(Q),Q=n1(Q,Z,Y),Q=d3(Q,Z),Q=u3(Q,Z),Q=u4(Q,Z),Q=ZY(Q,Z),Q=YY(Q,Z),Q=await y2(Q,Z,Y,G),Q=await d8(Q,Z,Y),Q=await KY(Q,Z,Y,G),Q=$9(Q,Z,Y,G),Q=oZ(Q,Z,Y,G),Q=sZ(Q,Z,Y),Q=rZ(Q,Z,Y,G),Q=u2(Q,Z,Y,G),Q=g6(Q,Z),Q=h6(Q),Q=IJ(Q),!G.skipEventDirectives)Q=T2(Q,Z,Y);if(Q=b2(Q,Z,Y),G.debug){let n=/\bx-data\s*=/.test(Q),J0=s$($);if(n&&J0)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
12208
12208
  Both work on the same page, but they manage separate scopes.
12209
- Prefer signals (state/derived/effect) for new components.`)}Q=qJ(Q,Z),Q=await F1(Q,Z,Y),Q=TJ(Q),Q=IJ(Q),Q=B2(Q);let{processXElementDirectives:y}=await Promise.resolve().then(() => vX);Q=y(Q);let b=Z.__originalFilePath||Y,k=f5(Z);if(Q=await h7(Q,G,b,k),Q=s2(Q,Z),Q=await JJ(Q,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:J0}=await Promise.resolve().then(() => (fX(),xX));Q=await J0(Q,{publicDir:n})}if(G.seo?.enabled)Q=rZ(Q,Z,G);let v=(n,J0,B0=!0)=>{if(!J0)return n;let R0=J0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),C=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(R0&&C){if(B0)n=n.replace(C[0],R0[0]);if(J0=J0.replace(R0[0],"").trim(),!J0)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${J0}
12209
+ Prefer signals (state/derived/effect) for new components.`)}Q=jJ(Q,Z),Q=await V1(Q,Z,Y),Q=DJ(Q),Q=EJ(Q),Q=O2(Q);let{processXElementDirectives:y}=await Promise.resolve().then(() => fX);Q=y(Q);let b=Z.__originalFilePath||Y,k=g5(Z);if(Q=await u7(Q,G,b,k),Q=a2(Q,Z),Q=await QJ(Q,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:J0}=await Promise.resolve().then(() => (hX(),gX));Q=await J0(Q,{publicDir:n})}if(G.seo?.enabled)Q=aZ(Q,Z,G);let v=(n,J0,B0=!0)=>{if(!J0)return n;let R0=J0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),C=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(R0&&C){if(B0)n=n.replace(C[0],R0[0]);if(J0=J0.replace(R0[0],"").trim(),!J0)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${J0}
12210
12210
  </head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
12211
12211
  ${J0}`);if(/<html\b[^>]*>/i.test(n))return n.replace(/(<html\b[^>]*>)/i,`$1
12212
12212
  <head>
12213
12213
  ${J0}
12214
- </head>`);return n},{renderHead:g,getHead:f}=await Promise.resolve().then(() => (i5(),A7)),p=Z.__stx_runtime_head??f();if(p.title||p.meta?.length||p.link?.length){let n=g(p);if(n)Q=v(Q,n)}if(D.headContent)Q=v(Q,D.headContent,!p.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=f2(Q,G.csp,Z);if(G.analytics?.enabled)Q=O2(Q,G);if(G.heatmap?.enabled)Q=U9(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await Promise.resolve().then(() => (uX(),dX));Q=n(Q,G)}let X0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),Z0=/\bSTX\.\w+/.test(Q),V0=/window\.STX\s*=/.test(Q);if(X0&&Z0&&!V0){let J0=`<script data-stx-scoped>
12215
- ${q2()}
12214
+ </head>`);return n},{renderHead:g,getHead:f}=await Promise.resolve().then(() => (n5(),N7)),p=Z.__stx_runtime_head??f();if(p.title||p.meta?.length||p.link?.length){let n=g(p);if(n)Q=v(Q,n)}if(D.headContent)Q=v(Q,D.headContent,!p.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=h2(Q,G.csp,Z);if(G.analytics?.enabled)Q=F2(Q,G);if(G.heatmap?.enabled)Q=j9(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await Promise.resolve().then(() => (pX(),mX));Q=n(Q,G)}let X0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),Z0=/\bSTX\.\w+/.test(Q),V0=/window\.STX\s*=/.test(Q);if(X0&&Z0&&!V0){let J0=`<script data-stx-scoped>
12215
+ ${j2()}
12216
12216
  </script>`;if(Q.includes("</head>")){let B0=Q.indexOf("</head>"),C=Q.slice(0,B0).indexOf("<script");if(C!==-1){let P=Q.slice(0,C),x=Q.slice(C);Q=P+J0+`
12217
12217
  `+x}else Q=Q.replace("</head>",`${J0}
12218
12218
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
12219
12219
  ${J0}`);else Q=J0+`
12220
- `+Q}{let{scanScriptTags:n}=await Promise.resolve().then(() => (t5(),s$)),J0=[];for(let B0 of n(Q)){if(!/\bserver\b/i.test(B0.attrs))continue;let R0=B0.start+B0.fullMatch.indexOf(">")+1,C=x_(Q,R0);if(C===-1)continue;let P=C+9;while(P<Q.length&&/\s/.test(Q[P]))P++;J0.push({start:B0.start,end:P})}for(let B0=J0.length-1;B0>=0;B0--){let{start:R0,end:C}=J0[B0];Q=Q.substring(0,R0)+Q.substring(C)}}let r=E$(Q,Y);if(r.hasScoped)Q=r.html;let Q0=Z.__stx_event_bindings||[],k0=!1,n0=[],j1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:t1}=await Promise.resolve().then(() => (t5(),s$));for(let n of t1(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))n0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:J0,content:B0}of n0){k0=!0;let R0=B0;u6(B0,Y,J.strict);let C=await g5(B0,{eventBindings:Q0,attrs:J0,hasColonDirectives:j1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:k});Q=Q.replace(n,()=>C)}if(k0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=g2(Q,Z.cspNonce);return Q}var a1="<!--PARENT_CONTENT_PLACEHOLDER-->";var e$=S(()=>{P4();C1();Q7();U2();H2();L2();W7();G7();M2();h5();k2();S2();x4();d2();p2();i2();r2();W1();i5();Y1();ZY();GY();sY();eY();b6();p7();XJ();K5();GJ();I3();M0();WJ();UJ();BJ();OJ();L7();t5();E6();NJ();d6();m6();w0();$6();d6();m6()});import F0 from"fs";import G0 from"path";import{matchRoute as jB,Router as KQ}from"stx-router";import{findErrorPage as HB,formatRoutes as OB,generateRouteManifest as LB,generateRouteTypes as FB,matchRoute as VB}from"stx-router";function X7($,Z={}){return new KQ($,Z).routes}e$();import{createHash as l_}from"crypto";function c_($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var i_=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function n_($){return Bun.hash($).toString(16)}function cX($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,J=$.replace(i_,(Q,G,K,W)=>{let z=W.trim();if(!z)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)z=c_(z);let q=n_(z);if(!Y.has(q))Y.set(q,z);let U=Z.integrity?` data-stx-integrity="sha384-${l_("sha384").update(z).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${q}.js"${U}${K}></script>`}),X=Array.from(Y,([Q,G])=>({hash:Q,code:G}));return{html:J,chunks:X}}var o_=new Set(["visible","idle"]);function iX($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Y.exec($))!==null)Z.set(J[1],J[2]);let X=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(o_.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((z)=>!$.includes(`rel="prefetch" href="${z}"`)).map((z)=>`<link rel="prefetch" href="${z}" as="script">`).join("");if(!W)return $;return $.slice(0,K)+W+$.slice(K)}c1();y5();P4();import{abortNavigation as nR,clearMiddleware as nX,createClientCookieManager as oR,createMiddlewareContext as oX,createRouteLocation as sX,createServerCookieManager as sR,createStorageManager as rR,defineMiddleware as aR,getMiddleware as tR,getMiddlewareNames as rX,hasMiddleware as eR,loadMiddlewareFromDirectory as aX,navigateTo as $N,registerMiddleware as ZN,runMiddleware as tX}from"stx-router";class eX{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=G0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,J]of Object.entries(Z))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await F0.promises.mkdir(this.cacheDir,{recursive:!0});let $=G0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,J]of this.cache)Z[Y]=J;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=F0.statSync($),J=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(F0.existsSync(Q)){let G=F0.statSync(Q);J+=`:${Q}:${G.mtimeMs}`}let X=0;for(let Q=0;Q<J.length;Q++){let G=J.charCodeAt(Q);X=(X<<5)-X+G,X=X&X}return Math.abs(X).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let J=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==J)return this.cache.delete($),null;return Y.html}set($,Z,Y,J){let X=this.getHash(Z,Y);this.cache.set($,{hash:X,html:J,generatedAt:Date.now(),dependencies:Y})}}class $Q{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return G0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await F0.promises.mkdir(G0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await F0.promises.unlink(Z)}async invalidatePattern($){let Z=G0.join(this.cacheDir,"isr");if(!F0.existsSync(Z))return;let Y=await F0.promises.readdir(Z);for(let J of Y){let X=J.replace(/_/g,"/").replace(".json","");if($.test(X))await F0.promises.unlink(G0.join(Z,J))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function s_($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let J=Y[1];if(!J.includes("getStaticPaths"))return null;let X=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!X)return null;return await Function(`
12220
+ `+Q}{let{scanScriptTags:n}=await Promise.resolve().then(() => (e5(),r$)),J0=[];for(let B0 of n(Q)){if(!/\bserver\b/i.test(B0.attrs))continue;let R0=B0.start+B0.fullMatch.indexOf(">")+1,C=h_(Q,R0);if(C===-1)continue;let P=C+9;while(P<Q.length&&/\s/.test(Q[P]))P++;J0.push({start:B0.start,end:P})}for(let B0=J0.length-1;B0>=0;B0--){let{start:R0,end:C}=J0[B0];Q=Q.substring(0,R0)+Q.substring(C)}}let r=k$(Q,Y);if(r.hasScoped)Q=r.html;let Q0=Z.__stx_event_bindings||[],k0=!1,n0=[],_1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:e1}=await Promise.resolve().then(() => (e5(),r$));for(let n of e1(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))n0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:J0,content:B0}of n0){k0=!0;let R0=B0;m6(B0,Y,J.strict);let C=await h5(B0,{eventBindings:Q0,attrs:J0,hasColonDirectives:_1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:k});Q=Q.replace(n,()=>C)}if(k0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=d2(Q,Z.cspNonce);return Q}var t1="<!--PARENT_CONTENT_PLACEHOLDER-->";var $4=S(()=>{v4();v1();K7();_2();L2();V2();q7();W7();I2();d5();S2();P2();g4();m2();c2();o2();t2();z1();n5();J1();JY();WY();aY();ZJ();S6();c7();GJ();W5();WJ();E3();M0();qJ();_J();OJ();FJ();V7();e5();k6();TJ();u6();p6();w0();Z6();u6();p6()});import F0 from"fs";import G0 from"path";import{matchRoute as HB,Router as zQ}from"stx-router";import{findErrorPage as FB,formatRoutes as VB,generateRouteManifest as wB,generateRouteTypes as AB,matchRoute as RB}from"stx-router";function G7($,Z={}){return new zQ($,Z).routes}$4();import{createHash as n_}from"crypto";function o_($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var s_=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function r_($){return Bun.hash($).toString(16)}function nX($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,J=$.replace(s_,(Q,G,K,W)=>{let z=W.trim();if(!z)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)z=o_(z);let q=r_(z);if(!Y.has(q))Y.set(q,z);let U=Z.integrity?` data-stx-integrity="sha384-${n_("sha384").update(z).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${q}.js"${U}${K}></script>`}),X=Array.from(Y,([Q,G])=>({hash:Q,code:G}));return{html:J,chunks:X}}var a_=new Set(["visible","idle"]);function oX($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Y.exec($))!==null)Z.set(J[1],J[2]);let X=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(a_.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((z)=>!$.includes(`rel="prefetch" href="${z}"`)).map((z)=>`<link rel="prefetch" href="${z}" as="script">`).join("");if(!W)return $;return $.slice(0,K)+W+$.slice(K)}i1();P5();v4();import{abortNavigation as rR,clearMiddleware as sX,createClientCookieManager as aR,createMiddlewareContext as rX,createRouteLocation as aX,createServerCookieManager as tR,createStorageManager as eR,defineMiddleware as $N,getMiddleware as ZN,getMiddlewareNames as tX,hasMiddleware as YN,loadMiddlewareFromDirectory as eX,navigateTo as JN,registerMiddleware as XN,runMiddleware as $Q}from"stx-router";class ZQ{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=G0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,J]of Object.entries(Z))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await F0.promises.mkdir(this.cacheDir,{recursive:!0});let $=G0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,J]of this.cache)Z[Y]=J;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=F0.statSync($),J=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(F0.existsSync(Q)){let G=F0.statSync(Q);J+=`:${Q}:${G.mtimeMs}`}let X=0;for(let Q=0;Q<J.length;Q++){let G=J.charCodeAt(Q);X=(X<<5)-X+G,X=X&X}return Math.abs(X).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let J=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==J)return this.cache.delete($),null;return Y.html}set($,Z,Y,J){let X=this.getHash(Z,Y);this.cache.set($,{hash:X,html:J,generatedAt:Date.now(),dependencies:Y})}}class YQ{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return G0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await F0.promises.mkdir(G0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await F0.promises.unlink(Z)}async invalidatePattern($){let Z=G0.join(this.cacheDir,"isr");if(!F0.existsSync(Z))return;let Y=await F0.promises.readdir(Z);for(let J of Y){let X=J.replace(/_/g,"/").replace(".json","");if($.test(X))await F0.promises.unlink(G0.join(Z,J))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function t_($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let J=Y[1];if(!J.includes("getStaticPaths"))return null;let X=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!X)return null;return await Function(`
12221
12221
  return (async function getStaticPaths() {
12222
12222
  ${X[1]}
12223
12223
  })()
12224
- `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function r_($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let Y=await s_($.filePath);if(!Y||Y.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let J of Y.paths){let X=$.pattern;for(let[Q,G]of Object.entries(J.params))X=X.replace(`:${Q}`,G).replace(`:${Q}*`,G);Z.push({url:X,params:J.params,props:J.props,revalidate:J.revalidate})}}return Z}async function a_($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Y of Z)if(await Bun.file(Y).exists())try{let J=await import(Y);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:X,...Q}=J;return Q}}catch(J){console.error(`Error loading data file ${Y}:`,J)}return null}async function t_($,Z,Y){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let X=J[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",`
12224
+ `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function e_($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let Y=await t_($.filePath);if(!Y||Y.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let J of Y.paths){let X=$.pattern;for(let[Q,G]of Object.entries(J.params))X=X.replace(`:${Q}`,G).replace(`:${Q}*`,G);Z.push({url:X,params:J.params,props:J.props,revalidate:J.revalidate})}}return Z}async function $B($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Y of Z)if(await Bun.file(Y).exists())try{let J=await import(Y);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:X,...Q}=J;return Q}}catch(J){console.error(`Error loading data file ${Y}:`,J)}return null}async function ZB($,Z,Y){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let X=J[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",`
12225
12225
  return (async function getStaticProps() {
12226
12226
  ${Q[1]}
12227
12227
  })()
12228
- `)(Z)}catch(Q){return console.error(`Error executing getStaticProps in ${Y}:`,Q),null}}async function ZQ($,Z,Y={},J,X){let Q=await Bun.file($.filePath).text(),G=await a_($.filePath),K=await t_(Q,Z,$.filePath),W={...G||{},...K||{},...Y,params:Z,$route:{path:$.pattern,params:Z}},z=new Set,q={...X,debug:!1,cache:!1,autoShell:!0},U=await O0(Q,W,$.filePath,q,z);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}
12228
+ `)(Z)}catch(Q){return console.error(`Error executing getStaticProps in ${Y}:`,Q),null}}async function JQ($,Z,Y={},J,X){let Q=await Bun.file($.filePath).text(),G=await $B($.filePath),K=await ZB(Q,Z,$.filePath),W={...G||{},...K||{},...Y,params:Z,$route:{path:$.pattern,params:Z}},z=new Set,q={...X,debug:!1,cache:!1,autoShell:!0},U=await O0(Q,W,$.filePath,q,z);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}
12229
12229
  </head>`);else U=`${j}
12230
- ${U}`}if(U=await C7(U),U=await Q$(U),J.minify!==!1)return{html:e_(U),dependencies:Array.from(z)};return{html:U,dependencies:Array.from(z)}}function e_($){let Z=[],Y=0,J=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,X;while((X=J.exec($))!==null){let G=$.slice(Y,X.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=X[1],W=X[2],z=X[3];W=W.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+W+z),Y=X.index+X[0].length}let Q=$.slice(Y);return Z.push(Q.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function $B($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function ZB($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
12230
+ ${U}`}if(U=await x7(U),U=await G$(U),J.minify!==!1)return{html:YB(U),dependencies:Array.from(z)};return{html:U,dependencies:Array.from(z)}}function YB($){let Z=[],Y=0,J=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,X;while((X=J.exec($))!==null){let G=$.slice(Y,X.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=X[1],W=X[2],z=X[3];W=W.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+W+z),Y=X.index+X[0].length}let Q=$.slice(Y);return Z.push(Q.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function JB($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function XB($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
12231
12231
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
12232
12232
  ${$.map((J)=>{let X=new URL(J.loc,Z).href,Q=` <url>
12233
- <loc>${$1(X)}</loc>`;if(J.lastmod)Q+=`
12233
+ <loc>${Z1(X)}</loc>`;if(J.lastmod)Q+=`
12234
12234
  <lastmod>${J.lastmod}</lastmod>`;if(J.changefreq)Q+=`
12235
12235
  <changefreq>${J.changefreq}</changefreq>`;if(J.priority!==void 0)Q+=`
12236
12236
  <priority>${J.priority}</priority>`;return Q+=`
12237
12237
  </url>`,Q}).join(`
12238
12238
  `)}
12239
- </urlset>`}function $1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function YB($,Z){let Y=Z.map((J)=>{let X=" <item>";if(X+=`
12240
- <title>${$1(J.title)}</title>`,X+=`
12241
- <link>${$1(J.link)}</link>`,J.description)X+=`
12242
- <description>${$1(J.description)}</description>`;if(J.pubDate)X+=`
12239
+ </urlset>`}function Z1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function QB($,Z){let Y=Z.map((J)=>{let X=" <item>";if(X+=`
12240
+ <title>${Z1(J.title)}</title>`,X+=`
12241
+ <link>${Z1(J.link)}</link>`,J.description)X+=`
12242
+ <description>${Z1(J.description)}</description>`;if(J.pubDate)X+=`
12243
12243
  <pubDate>${J.pubDate.toUTCString()}</pubDate>`;if(J.author)X+=`
12244
- <author>${$1(J.author)}</author>`;if(J.categories)for(let Q of J.categories)X+=`
12245
- <category>${$1(Q)}</category>`;if(J.guid)X+=`
12246
- <guid>${$1(J.guid)}</guid>`;return X+=`
12244
+ <author>${Z1(J.author)}</author>`;if(J.categories)for(let Q of J.categories)X+=`
12245
+ <category>${Z1(Q)}</category>`;if(J.guid)X+=`
12246
+ <guid>${Z1(J.guid)}</guid>`;return X+=`
12247
12247
  </item>`,X});return`<?xml version="1.0" encoding="UTF-8"?>
12248
12248
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
12249
12249
  <channel>
12250
- <title>${$1($.title)}</title>
12251
- <link>${$1($.link)}</link>
12252
- <description>${$1($.description)}</description>
12250
+ <title>${Z1($.title)}</title>
12251
+ <link>${Z1($.link)}</link>
12252
+ <description>${Z1($.description)}</description>
12253
12253
  ${$.language?`<language>${$.language}</language>`:""}
12254
- ${$.copyright?`<copyright>${$1($.copyright)}</copyright>`:""}
12254
+ ${$.copyright?`<copyright>${Z1($.copyright)}</copyright>`:""}
12255
12255
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
12256
12256
  <atom:link href="${$.link}/rss.xml" rel="self" type="application/rss+xml"/>
12257
12257
  ${Y.join(`
12258
12258
  `)}
12259
12259
  </channel>
12260
- </rss>`}async function JB($={}){let Z=Date.now(),Y=await z1(),J={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:$.domain||"http://localhost",revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||B1(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},X={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,G=0,K={},W={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&F0.existsSync(J.outputDir))await F0.promises.rm(J.outputDir,{recursive:!0});await F0.promises.mkdir(J.outputDir,{recursive:!0});let q=new eX(J.cacheDir);if(J.cache)await q.load();try{let{generateCrosswindCSS:F}=await Promise.resolve().then(() => (P4(),z2));await F('<div class="bg-black"></div>')}catch{}nX();let U=Y?.routeMiddleware?.dir||"middleware";await aX(process.cwd(),U);let j=rX();if(j.length>0)console.log(`Loaded ${j.length} middleware: ${j.join(", ")}`);let _=Y?.routeMiddleware?.global||[],B=X7(".",{pagesDir:J.pagesDir});console.log(`Found ${B.length} routes`);let H=[];for(let F of B){let w=await r_(F);for(let A of w)H.push({route:F,url:A.url,params:A.params,props:A.props,revalidate:A.revalidate??J.revalidate})}X.totalPages=H.length,console.log(`Generating ${X.totalPages} pages...`);let L=[],V=[];for(let F=0;F<H.length;F+=J.concurrency)V.push(H.slice(F,F+J.concurrency));for(let F of V)await Promise.all(F.map(async(w)=>{let{route:A,url:R,params:N,props:M,revalidate:T}=w;try{await J.hooks.onPageStart?.(R);let I=await Bun.file(A.filePath).text(),E=KB(I),D=E?.middleware?Array.isArray(E.middleware)?E.middleware:[E.middleware]:[],y=[..._,...D];if(y.length>0){let d=sX(R,N,E||{}),p=oX(d,null),X0=await tX(y,p);if(X0.redirect){let Z0=typeof X0.redirect==="string"?X0.redirect:X0.redirect.path||X0.redirect,V0=WB(String(Z0),R),r=zB(R,J);await F0.promises.mkdir(G0.dirname(r),{recursive:!0}),await Bun.write(r,V0),X.successCount++,X.pages.push({route:R,outputPath:r,size:Buffer.byteLength(V0),cached:!1}),L.push({loc:R,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${R} \u2192 redirect to ${Z0}`);return}if(X0.abort){let Z0=typeof X0.abort==="string"?X0.abort:X0.abort?.error?.message||"aborted";console.warn(` \u21B3 ${R} \u2014 middleware aborted: ${Z0}`);return}}let b=I.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(b)try{if(!await Function("route",`
12260
+ </rss>`}async function GB($={}){let Z=Date.now(),Y=await q1(),J={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:$.domain||"http://localhost",revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||H1(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},X={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,G=0,K={},W={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&F0.existsSync(J.outputDir))await F0.promises.rm(J.outputDir,{recursive:!0});await F0.promises.mkdir(J.outputDir,{recursive:!0});let q=new ZQ(J.cacheDir);if(J.cache)await q.load();try{let{generateCrosswindCSS:F}=await Promise.resolve().then(() => (v4(),U2));await F('<div class="bg-black"></div>')}catch{}sX();let U=Y?.routeMiddleware?.dir||"middleware";await eX(process.cwd(),U);let j=tX();if(j.length>0)console.log(`Loaded ${j.length} middleware: ${j.join(", ")}`);let _=Y?.routeMiddleware?.global||[],B=G7(".",{pagesDir:J.pagesDir});console.log(`Found ${B.length} routes`);let H=[];for(let F of B){let w=await e_(F);for(let A of w)H.push({route:F,url:A.url,params:A.params,props:A.props,revalidate:A.revalidate??J.revalidate})}X.totalPages=H.length,console.log(`Generating ${X.totalPages} pages...`);let L=[],V=[];for(let F=0;F<H.length;F+=J.concurrency)V.push(H.slice(F,F+J.concurrency));for(let F of V)await Promise.all(F.map(async(w)=>{let{route:A,url:R,params:N,props:M,revalidate:T}=w;try{await J.hooks.onPageStart?.(R);let I=await Bun.file(A.filePath).text(),E=qB(I),D=E?.middleware?Array.isArray(E.middleware)?E.middleware:[E.middleware]:[],y=[..._,...D];if(y.length>0){let d=aX(R,N,E||{}),p=rX(d,null),X0=await $Q(y,p);if(X0.redirect){let Z0=typeof X0.redirect==="string"?X0.redirect:X0.redirect.path||X0.redirect,V0=UB(String(Z0),R),r=jB(R,J);await F0.promises.mkdir(G0.dirname(r),{recursive:!0}),await Bun.write(r,V0),X.successCount++,X.pages.push({route:R,outputPath:r,size:Buffer.byteLength(V0),cached:!1}),L.push({loc:R,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${R} \u2192 redirect to ${Z0}`);return}if(X0.abort){let Z0=typeof X0.abort==="string"?X0.abort:X0.abort?.error?.message||"aborted";console.warn(` \u21B3 ${R} \u2014 middleware aborted: ${Z0}`);return}}let b=I.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(b)try{if(!await Function("route",`
12261
12261
  const validate = ${b[1]};
12262
12262
  return validate(route);
12263
- `)({params:N})){console.warn(`Validation failed for ${R}, skipping...`);return}}catch{}let k=null,v=!1;if(J.cache){if(k=q.get(R,A.filePath),k)v=!0,X.cachedCount++}if(!k){let d=await ZQ(A,N,M,J,Y);if(k=d.html,J.cache)q.set(R,A.filePath,d.dependencies,k)}let g;if(J.trailingSlash)g=G0.join(J.outputDir,R,"index.html");else g=R==="/"?G0.join(J.outputDir,"index.html"):G0.join(J.outputDir,`${R}.html`);if(J.chunkIslands){let{html:d,chunks:p}=cX(k,{integrity:J.integrityIslands,minify:J.minify});if(p.length>0){let X0=G0.join(J.outputDir,"_stx","islands");await F0.promises.mkdir(X0,{recursive:!0});for(let Z0 of p){let V0=G0.join(X0,`${Z0.hash}.js`);if(!await Bun.file(V0).exists())await Bun.write(V0,Z0.code);if(!Q.has(Z0.hash)){Q.add(Z0.hash);let r=Buffer.byteLength(Z0.code,"utf8");G+=r,K[Z0.hash]={bytes:r,file:`/_stx/islands/${Z0.hash}.js`}}}if(W[R]=p.map((Z0)=>Z0.hash),k=d,J.prefetchIslands)k=iX(k)}}await F0.promises.mkdir(G0.dirname(g),{recursive:!0}),await Bun.write(g,k),L.push({loc:R,lastmod:new Date().toISOString().split("T")[0],priority:R==="/"?1:0.8});let f={route:R,outputPath:g,size:Buffer.byteLength(k,"utf8"),cached:v};if(T!==!1)f.revalidateAt=Date.now()+T*1000;X.pages.push(f),X.successCount++,await J.hooks.onPageEnd?.(R,k)}catch(I){X.failedCount++,X.errors.push({route:R,error:I}),await J.hooks.onError?.(I,R),console.error(`Error generating ${R}:`,I)}}));if(J.cache)await q.save();if(J.generate404){let F=G0.join(J.pagesDir,"404.stx");if(await Bun.file(F).exists()){let w=new Set,A={...Y,debug:!1,cache:!1},R=await O0(await Bun.file(F).text(),{},F,A,w);await Bun.write(G0.join(J.outputDir,"404.html"),R)}else await Bun.write(G0.join(J.outputDir,"404.html"),`<!DOCTYPE html>
12263
+ `)({params:N})){console.warn(`Validation failed for ${R}, skipping...`);return}}catch{}let k=null,v=!1;if(J.cache){if(k=q.get(R,A.filePath),k)v=!0,X.cachedCount++}if(!k){let d=await JQ(A,N,M,J,Y);if(k=d.html,J.cache)q.set(R,A.filePath,d.dependencies,k)}let g;if(J.trailingSlash)g=G0.join(J.outputDir,R,"index.html");else g=R==="/"?G0.join(J.outputDir,"index.html"):G0.join(J.outputDir,`${R}.html`);if(J.chunkIslands){let{html:d,chunks:p}=nX(k,{integrity:J.integrityIslands,minify:J.minify});if(p.length>0){let X0=G0.join(J.outputDir,"_stx","islands");await F0.promises.mkdir(X0,{recursive:!0});for(let Z0 of p){let V0=G0.join(X0,`${Z0.hash}.js`);if(!await Bun.file(V0).exists())await Bun.write(V0,Z0.code);if(!Q.has(Z0.hash)){Q.add(Z0.hash);let r=Buffer.byteLength(Z0.code,"utf8");G+=r,K[Z0.hash]={bytes:r,file:`/_stx/islands/${Z0.hash}.js`}}}if(W[R]=p.map((Z0)=>Z0.hash),k=d,J.prefetchIslands)k=oX(k)}}await F0.promises.mkdir(G0.dirname(g),{recursive:!0}),await Bun.write(g,k),L.push({loc:R,lastmod:new Date().toISOString().split("T")[0],priority:R==="/"?1:0.8});let f={route:R,outputPath:g,size:Buffer.byteLength(k,"utf8"),cached:v};if(T!==!1)f.revalidateAt=Date.now()+T*1000;X.pages.push(f),X.successCount++,await J.hooks.onPageEnd?.(R,k)}catch(I){X.failedCount++,X.errors.push({route:R,error:I}),await J.hooks.onError?.(I,R),console.error(`Error generating ${R}:`,I)}}));if(J.cache)await q.save();if(J.generate404){let F=G0.join(J.pagesDir,"404.stx");if(await Bun.file(F).exists()){let w=new Set,A={...Y,debug:!1,cache:!1},R=await O0(await Bun.file(F).text(),{},F,A,w);await Bun.write(G0.join(J.outputDir,"404.html"),R)}else await Bun.write(G0.join(J.outputDir,"404.html"),`<!DOCTYPE html>
12264
12264
  <html lang="en">
12265
12265
  <head>
12266
12266
  <meta charset="UTF-8">
@@ -12281,7 +12281,7 @@ ${Y.join(`
12281
12281
  <a href="/">Go home</a>
12282
12282
  </div>
12283
12283
  </body>
12284
- </html>`)}for(let F of[500]){let w=G0.join(J.pagesDir,`${F}.stx`);if(await Bun.file(w).exists()){let A=new Set,R={...Y,debug:!1,cache:!1},N=await O0(await Bun.file(w).text(),{},w,R,A);await Bun.write(G0.join(J.outputDir,`${F}.html`),N)}}let O=G0.join(J.pagesDir,"error.stx");if(await Bun.file(O).exists()){let F=new Set,w={...Y,debug:!1,cache:!1},A=await O0(await Bun.file(O).text(),{},O,w,F);await Bun.write(G0.join(J.outputDir,"error.html"),A)}if(J.sitemap&&L.length>0){let F=ZB(L,J.domain),w=G0.join(J.outputDir,"sitemap.xml");await Bun.write(w,F),X.sitemapPath=w,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(J.rss){let F=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},w=[];if(F.getItems)w=await F.getItems();let A=YB(F,w),R=G0.join(J.outputDir,"rss.xml");await Bun.write(R,A),X.rssPath=R,console.log(`Generated rss.xml with ${w.length} items`)}if(J.publicDir&&F0.existsSync(J.publicDir))await YQ(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`)}catch(q){throw await J.hooks.onError?.(q),q}if(X.buildTime=Date.now()-Z,Q.size>0){X.islandChunks={count:Q.size,totalBytes:G};let q={generatedChunks:Q.size,totalBytes:G,chunks:K,pages:W};await Bun.write(G0.join(J.outputDir,"_stx","islands-manifest.json"),JSON.stringify(q,null,2))}await J.hooks.onBuildEnd?.(X);let z=X.islandChunks?`
12284
+ </html>`)}for(let F of[500]){let w=G0.join(J.pagesDir,`${F}.stx`);if(await Bun.file(w).exists()){let A=new Set,R={...Y,debug:!1,cache:!1},N=await O0(await Bun.file(w).text(),{},w,R,A);await Bun.write(G0.join(J.outputDir,`${F}.html`),N)}}let O=G0.join(J.pagesDir,"error.stx");if(await Bun.file(O).exists()){let F=new Set,w={...Y,debug:!1,cache:!1},A=await O0(await Bun.file(O).text(),{},O,w,F);await Bun.write(G0.join(J.outputDir,"error.html"),A)}if(J.sitemap&&L.length>0){let F=XB(L,J.domain),w=G0.join(J.outputDir,"sitemap.xml");await Bun.write(w,F),X.sitemapPath=w,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(J.rss){let F=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},w=[];if(F.getItems)w=await F.getItems();let A=QB(F,w),R=G0.join(J.outputDir,"rss.xml");await Bun.write(R,A),X.rssPath=R,console.log(`Generated rss.xml with ${w.length} items`)}if(J.publicDir&&F0.existsSync(J.publicDir))await XQ(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`)}catch(q){throw await J.hooks.onError?.(q),q}if(X.buildTime=Date.now()-Z,Q.size>0){X.islandChunks={count:Q.size,totalBytes:G};let q={generatedChunks:Q.size,totalBytes:G,chunks:K,pages:W};await Bun.write(G0.join(J.outputDir,"_stx","islands-manifest.json"),JSON.stringify(q,null,2))}await J.hooks.onBuildEnd?.(X);let z=X.islandChunks?`
12285
12285
  Island chunks: ${X.islandChunks.count} (${(X.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
12286
12286
  Build complete!
12287
12287
  Total: ${X.totalPages} pages
@@ -12289,8 +12289,8 @@ Build complete!
12289
12289
  Cached: ${X.cachedCount}
12290
12290
  Failed: ${X.failedCount}
12291
12291
  Time: ${X.buildTime}ms${z}
12292
- `),X}async function YQ($,Z){let Y=await F0.promises.readdir($,{withFileTypes:!0});for(let J of Y){let X=G0.join($,J.name),Q=G0.join(Z,J.name);if(J.isDirectory())await F0.promises.mkdir(Q,{recursive:!0}),await YQ(X,Q);else await F0.promises.copyFile(X,Q)}}function XB($={}){let Z=$.cacheDir||B1(process.cwd(),"ssg-cache"),Y=new $Q(Z),J=$.revalidate||3600;return{async get(X){let Q=await Y.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=${J}, stale-while-revalidate=${J*2}`,ETag:Q.etag,"X-ISR-Generated":new Date(Q.generatedAt).toISOString(),...Q.headers}}},async revalidate(X){let G=X7(".",{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 z=await z1(),{html:q}=await ZQ(G,W,{},$,z);await Y.set(X,{html:q,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:$B(q)}),console.log(`Revalidated: ${X}`)},async invalidate(X){if(typeof X==="string")await Y.invalidate(X);else await Y.invalidatePattern(X)}}}function QB($){return async()=>{return{paths:await $(),fallback:!1}}}function GB(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),Y=Z.match(/^---\n([\s\S]*?)\n---/),J={},X=Z;if(Y){let z=Y[1];X=Z.slice(Y[0].length).trim();for(let q of z.split(`
12293
- `)){let U=q.indexOf(":");if(U>0){let j=q.slice(0,U).trim(),_=q.slice(U+1).trim();if(_==="true")_=!0;else if(_==="false")_=!1;else if(/^\d+$/.test(_))_=parseInt(_,10);else if(/^\d+\.\d+$/.test(_))_=parseFloat(_);else if(_.startsWith("[")&&_.endsWith("]"))_=_.slice(1,-1).split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,""));J[j]=_}}}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 z=parseInt(W[1],10),q=W[2],U=q.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:q,level:z})}return{content:Q,data:J,toc:G}}}}function KB($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function WB($,Z){return`<!DOCTYPE html>
12292
+ `),X}async function XQ($,Z){let Y=await F0.promises.readdir($,{withFileTypes:!0});for(let J of Y){let X=G0.join($,J.name),Q=G0.join(Z,J.name);if(J.isDirectory())await F0.promises.mkdir(Q,{recursive:!0}),await XQ(X,Q);else await F0.promises.copyFile(X,Q)}}function KB($={}){let Z=$.cacheDir||H1(process.cwd(),"ssg-cache"),Y=new YQ(Z),J=$.revalidate||3600;return{async get(X){let Q=await Y.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=${J}, stale-while-revalidate=${J*2}`,ETag:Q.etag,"X-ISR-Generated":new Date(Q.generatedAt).toISOString(),...Q.headers}}},async revalidate(X){let G=G7(".",{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 z=await q1(),{html:q}=await JQ(G,W,{},$,z);await Y.set(X,{html:q,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:JB(q)}),console.log(`Revalidated: ${X}`)},async invalidate(X){if(typeof X==="string")await Y.invalidate(X);else await Y.invalidatePattern(X)}}}function WB($){return async()=>{return{paths:await $(),fallback:!1}}}function zB(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),Y=Z.match(/^---\n([\s\S]*?)\n---/),J={},X=Z;if(Y){let z=Y[1];X=Z.slice(Y[0].length).trim();for(let q of z.split(`
12293
+ `)){let U=q.indexOf(":");if(U>0){let j=q.slice(0,U).trim(),_=q.slice(U+1).trim();if(_==="true")_=!0;else if(_==="false")_=!1;else if(/^\d+$/.test(_))_=parseInt(_,10);else if(/^\d+\.\d+$/.test(_))_=parseFloat(_);else if(_.startsWith("[")&&_.endsWith("]"))_=_.slice(1,-1).split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,""));J[j]=_}}}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 z=parseInt(W[1],10),q=W[2],U=q.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:q,level:z})}return{content:Q,data:J,toc:G}}}}function qB($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function UB($,Z){return`<!DOCTYPE html>
12294
12294
  <html>
12295
12295
  <head>
12296
12296
  <meta charset="utf-8">
@@ -12302,4 +12302,4 @@ Build complete!
12302
12302
  <p>Redirecting to <a href="${$}">${$}</a>...</p>
12303
12303
  <script>window.location.replace('${$}')</script>
12304
12304
  </body>
12305
- </html>`}function zB($,Z){if($==="/"||$==="")return G0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return G0.join(Z.outputDir,Y,"index.html");return G0.join(Z.outputDir,`${Y}.html`)}var UN={generateStaticSite:JB,createISRHandler:XB,defineStaticPaths:QB,createMarkdownLoader:GB};export{JB as generateStaticSite,QB as defineStaticPaths,UN as default,GB as createMarkdownLoader,XB as createISRHandler};
12305
+ </html>`}function jB($,Z){if($==="/"||$==="")return G0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return G0.join(Z.outputDir,Y,"index.html");return G0.join(Z.outputDir,`${Y}.html`)}var BN={generateStaticSite:GB,createISRHandler:KB,defineStaticPaths:WB,createMarkdownLoader:zB};export{GB as generateStaticSite,WB as defineStaticPaths,BN as default,zB as createMarkdownLoader,KB as createISRHandler};