@stacksjs/stx 0.2.42 → 0.2.44

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.
Files changed (5) hide show
  1. package/dist/cli.js +420 -415
  2. package/dist/index.js +539 -534
  3. package/dist/pwa.js +218 -213
  4. package/dist/ssg.js +235 -230
  5. package/package.json +1 -1
package/dist/ssg.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var JY=Object.defineProperty;var XY=($)=>$;function QY($,Z){this[$]=XY.bind(null,Z)}var r=($,Z)=>{for(var J in Z)JY($,J,{get:Z[J],enumerable:!0,configurable:!0,set:QY.bind(Z,J)})};var C=($,Z)=>()=>($&&(Z=$($=0)),Z);var J0=import.meta.require;var q0;var X7=C(()=>{q0={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 Q7($,Z,J,Y){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let W={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||W} -->`});let X=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(X,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var G7,K7;var C9=C(()=>{G7={name:"a11y",handler:($,Z,J,Y)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${X||K} -->${$}`},hasEndTag:!1},K7={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function KY($,Z={}){let{duration:J,delay:Y,ease:Q,direction:X,custom:G}={...p0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${X==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
2
+ var XY=Object.defineProperty;var QY=($)=>$;function GY($,Z){this[$]=QY.bind(null,Z)}var r=($,Z)=>{for(var J in Z)XY($,J,{get:Z[J],enumerable:!0,configurable:!0,set:GY.bind(Z,J)})};var C=($,Z)=>()=>($&&(Z=$($=0)),Z);var J0=import.meta.require;var q0;var X7=C(()=>{q0={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 Q7($,Z,J,Y){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let W={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||W} -->`});let X=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(X,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var G7,K7;var C9=C(()=>{G7={name:"a11y",handler:($,Z,J,Y)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${X||K} -->${$}`},hasEndTag:!1},K7={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function qY($,Z={}){let{duration:J,delay:Y,ease:Q,direction:X,custom:G}={...p0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${X==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
3
3
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4
4
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${X==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
5
5
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -9,7 +9,7 @@ var JY=Object.defineProperty;var XY=($)=>$;function QY($,Z){this[$]=XY.bind(null
9
9
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
10
10
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${X==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
11
11
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
12
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function qY(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function WY(){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 WY($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((J)=>J.test($))}function _Y($=0.1,Z="0px"){return`
40
+ `}function _Y($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((J)=>J.test($))}function zY($=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 zY(){return`
83
+ `}function UY(){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 UY($,Z,J={}){let{staggerDelay:Y=50,sequence:Q=!1}=J;return`
198
+ `}function BY($,Z,J={}){let{staggerDelay:Y=50,sequence:Q=!1}=J;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 U7($,Z,J,Y){let Q=$;if(Y.animation?.enabled===!1)return Q;let X=J.includes("test")&&J.includes("animation");if(!WY(Q)&&!X)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=zY();Q=Q.replace("</head>",`${K}
236
- </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=_Y(),_=Q.lastIndexOf("</body>");if(_!==-1)Q=Q.slice(0,_)+q+`
237
- `+Q.slice(_)}}return Q}var p0,q7,W7,_7,z7;var P9=C(()=>{p0={duration:300,delay:0,ease:"ease",direction:"both"};q7={name:"transition",handler:($,Z,J,Y)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||p0.duration:p0.duration,G=Z.length>2?Z[2]||p0.ease:p0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||p0.delay:p0.delay,q=Z.length>4?Z[4]||p0.direction:p0.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=KY(Q,{duration:X,delay:K,ease:G,direction:q}),z="stx-transition",U="";if(Q==="fade")U="stx-fade";else if(Q==="slide")U="stx-slide";else if(Q==="scale")U="stx-scale";else if(Q==="flip")U="stx-flip";else if(Q==="rotate")U="stx-rotate";return`<div id="${_}" class="${z} ${U} ${q==="out"?"stx-out":""}"
238
- style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},W7={name:"scrollAnimate",handler:($,Z,J,Y)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,_=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Q==="fade")z+=" stx-fade";else if(Q==="slide-up"||Q==="slide")z+=" stx-from-bottom";else if(Q==="slide-down")z+=" stx-from-top";else if(Q==="slide-left")z+=" stx-from-right";else if(Q==="slide-right")z+=" stx-from-left";else if(Q==="scale")z+=" stx-scale";else if(Q.includes("-"))z+=` stx-${Q}`;else z+=` stx-${Q}`;return`<div id="${_}" class="${z}" style="${W}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},_7={name:"animationGroup",handler:($,Z,J,Y)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],X=Z.slice(1).map((_)=>_.startsWith("#")||_.startsWith(".")?_:`#${_}`),G=J.staggerDelay||50,K=J.sequence||!0,q=UY(Q,X,{staggerDelay:G,sequence:K});return`${$}
239
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},z7={name:"motion",handler:($,Z,J,Y)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,X=qY();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as B7}from"stx-router";var j7=C(()=>{v9()});async function BY($,Z,J,Y){let Q=Z[0]?.replace(/['"]/g,"")||"main",X=B7();if(Q!=="main")X=X.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${X}</script>`}var O7;var v9=C(()=>{j7();O7={name:"stxRouter",handler:BY,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function H7($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...jY,...Z};return`
235
+ `}function U7($,Z,J,Y){let Q=$;if(Y.animation?.enabled===!1)return Q;let X=J.includes("test")&&J.includes("animation");if(!_Y(Q)&&!X)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=UY();Q=Q.replace("</head>",`${K}
236
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=zY(),_=Q.lastIndexOf("</body>");if(_!==-1)Q=Q.slice(0,_)+q+`
237
+ `+Q.slice(_)}}return Q}var p0,q7,W7,_7,z7;var P9=C(()=>{p0={duration:300,delay:0,ease:"ease",direction:"both"};q7={name:"transition",handler:($,Z,J,Y)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||p0.duration:p0.duration,G=Z.length>2?Z[2]||p0.ease:p0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||p0.delay:p0.delay,q=Z.length>4?Z[4]||p0.direction:p0.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=qY(Q,{duration:X,delay:K,ease:G,direction:q}),z="stx-transition",U="";if(Q==="fade")U="stx-fade";else if(Q==="slide")U="stx-slide";else if(Q==="scale")U="stx-scale";else if(Q==="flip")U="stx-flip";else if(Q==="rotate")U="stx-rotate";return`<div id="${_}" class="${z} ${U} ${q==="out"?"stx-out":""}"
238
+ style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},W7={name:"scrollAnimate",handler:($,Z,J,Y)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,_=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Q==="fade")z+=" stx-fade";else if(Q==="slide-up"||Q==="slide")z+=" stx-from-bottom";else if(Q==="slide-down")z+=" stx-from-top";else if(Q==="slide-left")z+=" stx-from-right";else if(Q==="slide-right")z+=" stx-from-left";else if(Q==="scale")z+=" stx-scale";else if(Q.includes("-"))z+=` stx-${Q}`;else z+=` stx-${Q}`;return`<div id="${_}" class="${z}" style="${W}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},_7={name:"animationGroup",handler:($,Z,J,Y)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],X=Z.slice(1).map((_)=>_.startsWith("#")||_.startsWith(".")?_:`#${_}`),G=J.staggerDelay||50,K=J.sequence||!0,q=BY(Q,X,{staggerDelay:G,sequence:K});return`${$}
239
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},z7={name:"motion",handler:($,Z,J,Y)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,X=WY();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as B7}from"stx-router";var j7=C(()=>{v9()});async function jY($,Z,J,Y){let Q=Z[0]?.replace(/['"]/g,"")||"main",X=B7();if(Q!=="main")X=X.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${X}</script>`}var O7;var v9=C(()=>{j7();O7={name:"stxRouter",handler:jY,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function H7($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...OY,...Z};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
241
241
  <script>
242
242
  (function() {
@@ -619,8 +619,8 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function L7($,Z){let J=H7(Z);if(!J)return $;let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+J+$.slice(Y);return $+J}function OY($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of J){let[Q,X]=Y.split("="),G=X?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var jY,F7;var x9=C(()=>{jY={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};F7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,Y)=>{let Q=J.__stx_config||{};if(Z.length>0){let X=OY(Z.join(" "));Q.heatmap={...Q.heatmap,...X,enabled:!0}}return H7(Q)}}});function i0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function V7($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function w7($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let Y=J[1],Q=$.slice(J[0].length),X={};for(let G of Y.split(`
623
- `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let _=K.slice(0,q).trim(),W=K.slice(q+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}X[_]=W}return{data:X,content:Q.trim()}}function l1($,Z={}){let{gfm:J=!0,breaks:Y=!1}=Z,Q=$,X=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(W,z,U)=>{let j=X.length,B=z?` class="language-${i0(z)}"`:"";return X.push(`<pre><code${B}>${i0(U.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Q=Q.replace(/`([^`]*)`/g,(W,z)=>`<code>${i0(z)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,z,U)=>{return`<img src="${V7(U)?i0(U):""}" alt="${i0(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,z,U)=>{return`<a href="${V7(U)?i0(U):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
622
+ `}function L7($,Z){let J=H7(Z);if(!J)return $;let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+J+$.slice(Y);return $+J}function HY($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of J){let[Q,X]=Y.split("="),G=X?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var OY,F7;var x9=C(()=>{OY={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};F7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,Y)=>{let Q=J.__stx_config||{};if(Z.length>0){let X=HY(Z.join(" "));Q.heatmap={...Q.heatmap,...X,enabled:!0}}return H7(Q)}}});function i0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function V7($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function w7($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let Y=J[1],Q=$.slice(J[0].length),X={};for(let G of Y.split(`
623
+ `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let _=K.slice(0,q).trim(),W=K.slice(q+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}X[_]=W}return{data:X,content:Q.trim()}}function c1($,Z={}){let{gfm:J=!0,breaks:Y=!1}=Z,Q=$,X=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(W,z,U)=>{let j=X.length,B=z?` class="language-${i0(z)}"`:"";return X.push(`<pre><code${B}>${i0(U.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Q=Q.replace(/`([^`]*)`/g,(W,z)=>`<code>${i0(z)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,z,U)=>{return`<img src="${V7(U)?i0(U):""}" alt="${i0(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,z,U)=>{return`<a href="${V7(U)?i0(U):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
624
624
  `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),J)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,z,U)=>{let B=`<tr>${z.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${i0(F)}</th>`).join("")}</tr>`,O=U.trim().split(`
625
625
  `).map((F)=>{return`<tr>${F.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<td>${i0(H)}</td>`).join("")}</tr>`}).join(`
626
626
  `);return`<table>
@@ -639,11 +639,11 @@ ${O}
639
639
  `),Y)Q=Q.replace(/\n/g,`<br />
640
640
  `);for(let W=0;W<X.length;W++)Q=Q.replace(`\x00CODEBLOCK${W}\x00`,X[W]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function n0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(Y,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
641
641
  `});let J=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(J,(Y,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
642
- `}),$}import HY from"process";function x0($="STX_PUBLIC_"){let Z={},J={};for(let[Y,Q]of Object.entries(HY.env)){if(!Y.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${Y}`]=JSON.stringify(Q),J[Y]=Q}return Z["import.meta.env"]=JSON.stringify(J),Z}var R1=()=>{};var f9={};r(f9,{hasUserImports:()=>LY,bundleClientScript:()=>VY});import f0 from"path";import X1 from"fs";function LY($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let Y=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=Y.exec($))!==null){let G=Q[1];if(!N7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let X=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=X.exec($))!==null){let G=Q[1];if(!N7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function FY($){return{name:"stx-client-bundle",setup(Z){Z.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(J)=>({path:J.path,external:!0})),Z.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(J)=>({path:J.path,external:!0})),Z.onResolve({filter:/^@\//},(J)=>{let Y=f0.resolve($,J.path.slice(2)),Q=[Y,`${Y}.ts`,`${Y}.js`,f0.join(Y,"index.ts"),f0.join(Y,"index.js")];for(let X of Q)if(X1.existsSync(X)&&X1.statSync(X,{throwIfNoEntry:!1})?.isFile())return console.log("[stx:bundler] resolved @/ import:",J.path,"\u2192",X),{path:X};return console.warn("[stx:bundler] could not resolve @/ import:",J.path),{path:Y}})}}}async function VY($,Z,J={}){let Y=J.projectRoot||process.cwd(),Q=J.minify??!1,X=J.cacheDir||f0.join(Y,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=f0.join(X,`${K}.js`),_=Bun.file(q);if(await _.exists())return console.log("[stx:bundler] cache hit:",K),await _.text();let W=f0.join(Y,".stx","bundle-tmp"),z=f0.join(W,`${K}.ts`),U=f0.join(W,"out",K);X1.mkdirSync(W,{recursive:!0}),X1.mkdirSync(U,{recursive:!0});let j=f0.dirname(Z),B=[],O=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=O.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let N=V.split(":")[0].trim();if(N)B.push(N)});else if(L[3])B.push(L[3])}while((L=F.exec($))!==null){if(L[1])continue;B.push(L[2])}let H=B.length>0?`
643
- export { ${B.join(", ")} }`:"";await Bun.write(z,$+H),console.log("[stx:bundler] bundling:",K,"from:",f0.basename(Z));try{let V=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:Q,plugins:[FY(Y)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...x0()},root:j});if(!V.success){let w=V.logs.filter((R)=>R.level==="error").map((R)=>R.message).join(", ");return console.warn("[stx:bundler] build failed:",w),$}let N="";for(let w of V.outputs){N=await w.text();break}return N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),X1.mkdirSync(X,{recursive:!0}),await Bun.write(q,N),N}catch(V){return console.warn("[stx:bundler] error:",V instanceof Error?V.message:V),$}finally{try{X1.rmSync(z,{force:!0}),X1.rmSync(U,{recursive:!0,force:!0})}catch{}}}var N7;var g9=C(()=>{R1();N7=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function AY($){let Z=new Set,J=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=J.exec($))!==null)if(!RY.has(Y[1]))Z.add(Y[1]);return Array.from(Z)}function TY($){let Z=new Set,J=new Set,Y=$;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,X=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=X.exec($))!==null){let q=G[1],_=G[2];if(G[0].includes("import type"))continue;q.split(",").map((z)=>z.trim().split(/\s+as\s+/)[0]).filter((z)=>z.length>0).forEach((z)=>{if(Q.add(z),_==="stx")Z.add(z);else J.add(z)}),Y=Y.replace(G[0],"// [auto-import processed]")}for(let q of wY){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(Y))Z.add(q)}for(let q of NY){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(Y))J.add(q)}let K=AY(Y);for(let q of K)if(!Q.has(q))J.add(q);return{code:Y,stxImports:Array.from(Z),browserImports:Array.from(J)}}function MY($,Z){let J=[];if($.length>0)J.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)J.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(J.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
642
+ `}),$}import LY from"process";function x0($="STX_PUBLIC_"){let Z={},J={};for(let[Y,Q]of Object.entries(LY.env)){if(!Y.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${Y}`]=JSON.stringify(Q),J[Y]=Q}return Z["import.meta.env"]=JSON.stringify(J),Z}var N1=()=>{};var f9={};r(f9,{hasUserImports:()=>FY,bundleClientScript:()=>wY});import f0 from"path";import Q1 from"fs";function FY($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let Y=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=Y.exec($))!==null){let G=Q[1];if(!A7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let X=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=X.exec($))!==null){let G=Q[1];if(!A7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function VY($){return{name:"stx-client-bundle",setup(Z){Z.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(J)=>({path:J.path,external:!0})),Z.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(J)=>({path:J.path,external:!0})),Z.onResolve({filter:/^@\//},(J)=>{let Y=f0.resolve($,J.path.slice(2)),Q=[Y,`${Y}.ts`,`${Y}.js`,f0.join(Y,"index.ts"),f0.join(Y,"index.js")];for(let X of Q)if(Q1.existsSync(X)&&Q1.statSync(X,{throwIfNoEntry:!1})?.isFile())return console.log("[stx:bundler] resolved @/ import:",J.path,"\u2192",X),{path:X};return console.warn("[stx:bundler] could not resolve @/ import:",J.path),{path:Y}})}}}async function wY($,Z,J={}){let Y=J.projectRoot||process.cwd(),Q=J.minify??!1,X=J.cacheDir||f0.join(Y,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=f0.join(X,`${K}.js`),_=Bun.file(q);if(await _.exists())return console.log("[stx:bundler] cache hit:",K),await _.text();let W=f0.join(Y,".stx","bundle-tmp"),z=f0.join(W,`${K}.ts`),U=f0.join(W,"out",K);Q1.mkdirSync(W,{recursive:!0}),Q1.mkdirSync(U,{recursive:!0});let j=f0.dirname(Z),B=[],O=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=O.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let A=V.split(":")[0].trim();if(A)B.push(A)});else if(L[3])B.push(L[3])}while((L=F.exec($))!==null){if(L[1])continue;B.push(L[2])}let H=B.length>0?`
643
+ export { ${B.join(", ")} }`:"";await Bun.write(z,$+H),console.log("[stx:bundler] bundling:",K,"from:",f0.basename(Z));try{let V=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:Q,plugins:[VY(Y)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...x0()},root:j});if(!V.success){let w=V.logs.filter((R)=>R.level==="error").map((R)=>R.message).join(", ");return console.warn("[stx:bundler] build failed:",w),$}let A="";for(let w of V.outputs){A=await w.text();break}return A=A.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),console.log("[stx:bundler] bundled:",K,"output:",A.length,"bytes"),Q1.mkdirSync(X,{recursive:!0}),await Bun.write(q,A),A}catch(V){return console.warn("[stx:bundler] error:",V instanceof Error?V.message:V),$}finally{try{Q1.rmSync(z,{force:!0}),Q1.rmSync(U,{recursive:!0,force:!0})}catch{}}}var A7;var g9=C(()=>{N1();A7=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function TY($){let Z=new Set,J=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=J.exec($))!==null)if(!NY.has(Y[1]))Z.add(Y[1]);return Array.from(Z)}function MY($){let Z=new Set,J=new Set,Y=$;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,X=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=X.exec($))!==null){let q=G[1],_=G[2];if(G[0].includes("import type"))continue;q.split(",").map((z)=>z.trim().split(/\s+as\s+/)[0]).filter((z)=>z.length>0).forEach((z)=>{if(Q.add(z),_==="stx")Z.add(z);else J.add(z)}),Y=Y.replace(G[0],"// [auto-import processed]")}for(let q of AY){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(Y))Z.add(q)}for(let q of RY){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(Y))J.add(q)}let K=TY(Y);for(let q of K)if(!Q.has(q))J.add(q);return{code:Y,stxImports:Array.from(Z),browserImports:Array.from(J)}}function IY($,Z){let J=[];if($.length>0)J.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)J.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(J.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
644
644
  ${J.join(`
645
645
  `)}
646
- `;return""}function DY($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let J of $.systemKeys)Z.push(`if (!$event.${J}Key) return`);if($.keys.length>0){let J=$.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if($.mouse!==null){let J=IY[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function EY($,Z){let{elementId:J,event:Y,handler:Q,modifiers:X}=$,G=DY(X),K=[];if(X.once)K.push("once: true");if(X.capture)K.push("capture: true");if(X.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",_="";if(G)_+=`${G}; `;let W=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function z(U){return`var scope = $el.closest('[data-stx-scope]');
646
+ `;return""}function EY($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let J of $.systemKeys)Z.push(`if (!$event.${J}Key) return`);if($.keys.length>0){let J=$.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if($.mouse!==null){let J=DY[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function kY($,Z){let{elementId:J,event:Y,handler:Q,modifiers:X}=$,G=EY(X),K=[];if(X.once)K.push("once: true");if(X.capture)K.push("capture: true");if(X.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",_="";if(G)_+=`${G}; `;let W=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function z(U){return`var scope = $el.closest('[data-stx-scope]');
647
647
  if (scope && scope.__stx_execute) {
648
648
  scope.__stx_execute('${W}', $event, $el);
649
649
  }
@@ -679,11 +679,11 @@ else {
679
679
  else {
680
680
  ${Q}
681
681
  }
682
- }${q})`}function kY($){if($.length===0)return"";return`
682
+ }${q})`}function bY($){if($.length===0)return"";return`
683
683
  // STX: auto-generated event bindings
684
- ${$.map((J,Y)=>EY(J,Y)).join(`
684
+ ${$.map((J,Y)=>kY(J,Y)).join(`
685
685
  `)}`}function R7($){let Z=[],J=new Set,Y=$.replace(/^\s*import\s+.*$/gm,""),Q=0,X=Y.length,G=0;while(G<X){let K=Y[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let _=0;while(G<X){if(Y[G]==="\\"){G+=2;continue}if(Y[G]==="`"&&_===0){G++;break}if(Y[G]==="$"&&Y[G+1]==="{"){_++,G+=2;continue}if(Y[G]==="}"&&_>0){_--,G++;continue}G++}}else while(G<X){if(Y[G]==="\\"){G+=2;continue}if(Y[G]===q){G++;break}G++}continue}if(K==="/"&&Y[G+1]==="/"){while(G<X&&Y[G]!==`
686
- `)G++;continue}if(K==="/"&&Y[G+1]==="*"){G+=2;while(G<X-1&&!(Y[G]==="*"&&Y[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=Y.slice(G),_=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(_){let U=_[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=_[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((U)=>{let j=U.trim(),B=j.indexOf(":"),O=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(O&&!O.startsWith("_")&&!J.has(O))Z.push(O),J.add(O)}),G+=W[0].length;continue}let z=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let U=z[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=z[0].length;continue}}G++}return Z}function SY($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(U){let j;while((j=J.exec(U))!==null){let B=j[0];if(!bY.has(B))Z.add(B)}}let Q=/\{\{([\s\S]*?)\}\}/g,X;while((X=Q.exec($))!==null)Y(X[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((X=G.exec($))!==null)Y(X[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((X=K.exec($))!==null)Y(X[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((X=q.exec($))!==null)Y(X[1]);let _=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((X=_.exec($))!==null)Y(X[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((X=W.exec($))!==null)Y(X[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((X=z.exec($))!==null)Y(X[1]);return Z}async function L5($,Z={}){let J=$,Y="",Q=!1,{hasUserImports:X,bundleClientScript:G}=await Promise.resolve().then(() => (g9(),f9));if(X(J))console.log("[stx:bundler] user imports detected, bundling..."),J=await G(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let B=TY(J);J=B.code,Y=MY(B.stxImports,B.browserImports)}if(J=n0(J),!Q&&Q1(Z.attrs||""))J=G1(J);let K=kY(Z.eventBindings||[]),q=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(q)){let B=q.replace(/\btype\s*=\s*["']module["']/i,"").trim();return`<script ${`type="module" data-stx-scoped${B?` ${B}`:""}`}>
686
+ `)G++;continue}if(K==="/"&&Y[G+1]==="*"){G+=2;while(G<X-1&&!(Y[G]==="*"&&Y[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=Y.slice(G),_=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(_){let U=_[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=_[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((U)=>{let j=U.trim(),B=j.indexOf(":"),O=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(O&&!O.startsWith("_")&&!J.has(O))Z.push(O),J.add(O)}),G+=W[0].length;continue}let z=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let U=z[1];if(!U.startsWith("_")&&!J.has(U))Z.push(U),J.add(U);G+=z[0].length;continue}}G++}return Z}function yY($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(U){let j;while((j=J.exec(U))!==null){let B=j[0];if(!SY.has(B))Z.add(B)}}let Q=/\{\{([\s\S]*?)\}\}/g,X;while((X=Q.exec($))!==null)Y(X[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((X=G.exec($))!==null)Y(X[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((X=K.exec($))!==null)Y(X[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((X=q.exec($))!==null)Y(X[1]);let _=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((X=_.exec($))!==null)Y(X[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((X=W.exec($))!==null)Y(X[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((X=z.exec($))!==null)Y(X[1]);return Z}async function L5($,Z={}){let J=$,Y="",Q=!1,{hasUserImports:X,bundleClientScript:G}=await Promise.resolve().then(() => (g9(),f9));if(X(J))console.log("[stx:bundler] user imports detected, bundling..."),J=await G(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let B=MY(J);J=B.code,Y=IY(B.stxImports,B.browserImports)}if(J=n0(J),!Q&&G1(Z.attrs||""))J=K1(J);let K=bY(Z.eventBindings||[]),q=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(q)){let B=q.replace(/\btype\s*=\s*["']module["']/i,"").trim();return`<script ${`type="module" data-stx-scoped${B?` ${B}`:""}`}>
687
687
  ${Y}${J}
688
688
  ${K}
689
689
  </script>`}let W=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),z=/function __stx_setup_/.test(J),U=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function j(B){let O=B.length>0?`
@@ -692,12 +692,12 @@ window.stx.mount(function() {
692
692
  'use strict';
693
693
  ${Y}${J}
694
694
  ${K}${O}
695
- })</script>`}if(!U&&!z){if(W)return j(R7($));if(Z.templateContent){let B=R7($);if(B.length>0){let O=SY(Z.templateContent);if(B.some((L)=>O.has(L)))return j(B)}}}return`<script data-stx-scoped>
695
+ })</script>`}if(!U&&!z){if(W)return j(R7($));if(Z.templateContent){let B=R7($);if(B.length>0){let O=yY(Z.templateContent);if(B.some((L)=>O.has(L)))return j(B)}}}return`<script data-stx-scoped>
696
696
  ;(function() {
697
697
  'use strict';
698
698
  ${Y}${J}
699
699
  ${K}
700
- })()</script>`}var wY,NY,RY,IY,bY;var h9=C(()=>{F0();wY=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useQuery","useMutation","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],NY=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],RY=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"]);IY={left:0,middle:1,right:2};bY=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 PY($){let Z="",J=null,Y=!1;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(Y){Y=!1;continue}if(X==="\\"&&J){Y=!0;continue}if(J){if(J==="`"&&X==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(X===J)J=null;continue}if(X==='"'||X==="'"||X==="`"){J=X;continue}Z+=X}return Z}function c1($){let Z=$.trim(),J=PY(Z);for(let Y of T7)if(Y.test(J))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${Z}`);if(!A7.allowBracketNotation&&CY.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function vY($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[J,Y]of Object.entries($)){if(J.startsWith("__")||T7.some((Q)=>Q.test(J)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))Z[J]=d9(Y);else Z[J]=Y}return Z}function d9($,Z=0){if(Z>=A7.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>d9(Y,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let J={};for(let[Y,Q]of Object.entries($)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(Q&&typeof Q==="object")J[Y]=d9(Q,Z+1);else J[Y]=Q}return J}function X0($,Z){try{let J=c1($),Y=vY(Z);return Function(...Object.keys(Y),`
700
+ })()</script>`}var AY,RY,NY,DY,SY;var h9=C(()=>{F0();AY=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useQuery","useMutation","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],RY=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],NY=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"]);DY={left:0,middle:1,right:2};SY=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 vY($){let Z="",J=null,Y=!1;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(Y){Y=!1;continue}if(X==="\\"&&J){Y=!0;continue}if(J){if(J==="`"&&X==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(X===J)J=null;continue}if(X==='"'||X==="'"||X==="`"){J=X;continue}Z+=X}return Z}function i1($){let Z=$.trim(),J=vY(Z);for(let Y of T7)if(Y.test(J))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${Z}`);if(!N7.allowBracketNotation&&PY.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function xY($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[J,Y]of Object.entries($)){if(J.startsWith("__")||T7.some((Q)=>Q.test(J)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))Z[J]=d9(Y);else Z[J]=Y}return Z}function d9($,Z=0){if(Z>=N7.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>d9(Y,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let J={};for(let[Y,Q]of Object.entries($)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(Q&&typeof Q==="object")J[Y]=d9(Q,Z+1);else J[Y]=Q}return J}function X0($,Z){try{let J=i1($),Y=xY(Z);return Function(...Object.keys(Y),`
701
701
  'use strict';
702
702
  try {
703
703
  return ${J};
@@ -708,7 +708,7 @@ catch (e) {
708
708
  }
709
709
  throw e;
710
710
  }
711
- `)(...Object.values(Y))}catch{return}}function e($){try{return c1($),!0}catch{return!1}}function O0($,Z){try{let J=X0($,Z);if(J&&typeof J==="object"&&!Array.isArray(J))return J;return{}}catch{return{}}}function $0($,Z){let J=c1($);return Function(...Z,`
711
+ `)(...Object.values(Y))}catch{return}}function e($){try{return i1($),!0}catch{return!1}}function O0($,Z){try{let J=X0($,Z);if(J&&typeof J==="object"&&!Array.isArray(J))return J;return{}}catch{return{}}}function $0($,Z){let J=i1($),Y=/^[A-Za-z_$][\w$]*$/,Q=[],X=[];for(let K=0;K<Z.length;K++)if(Y.test(Z[K]))Q.push(K),X.push(Z[K]);let G=Function(...X,`
712
712
  'use strict';
713
713
  try {
714
714
  return ${J};
@@ -719,7 +719,7 @@ catch (e) {
719
719
  }
720
720
  throw e;
721
721
  }
722
- `)}function F5($){let Z=$.trim(),J=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of J)if(Y.test(Z))return!1;return!0}var yY,A7,T7,CY;var N0=C(()=>{yY={maxSanitizeDepth:10,allowBracketNotation:!1},A7={...yY},T7=[/\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/],CY=/[\w)\]]\s*\[\s*['"]/});function V5($,Z){let J=xY++,Y=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return fY.set(Y,{type:$,expression:Z}),Y}var xY=0,fY;var M7=C(()=>{fY=new Map});var y7={};r(y7,{usesSignalsInScript:()=>w5,unescapeHtml:()=>m9,registerFilters:()=>hY,registerFilter:()=>E7,processExpressions:()=>q1,interpolateScriptsInTemplate:()=>mY,interpolateScriptExpressions:()=>b7,getAllFilters:()=>k7,evaluateExpression:()=>l0,escapeHtml:()=>K1,defaultFilters:()=>n1,clearCustomFilters:()=>dY,applyFilters:()=>S7});function gY($){let Z=I7.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),I7.set($,Z)}return Z.lastIndex=0,Z}function E7($,Z){if($ in n1)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);i1[$]=Z}function hY($){for(let[Z,J]of Object.entries($))E7(Z,J)}function k7(){return{...n1,...i1}}function dY(){for(let $ of Object.keys(i1))delete i1[$]}function K1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function w5($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Z.exec($))!==null){let Y=J[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;return!1}function D7($,Z){let J=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",X=!1,G=0;for(let _=0;_<Y.length;_++){let W=Y[_];if(!X&&W==="`"){X=!0,G=0;continue}if(X){if(W==="`"&&G===0){X=!1;continue}if(W==="$"&&Y[_+1]==="{"){G++,_++;continue}if(W==="}"&&G>0){G--;continue}continue}Q+=W}Y=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(Y))!==null){let _=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!J.includes(_)&&!(_ in Z))return!1}}return!0}function b7($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>{try{let X=l0(Q,Z);if(X===void 0)return Y;return X===null?"":String(X)}catch{return Y}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(Y,Q)=>{let X=Q.trim();if(/^__[A-Z_]+__$/.test(X))return Y;try{let G=l0(Q,Z);if(G===void 0)return Y;return JSON.stringify(G)}catch{return Y}}),J}function mY($,Z,J={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(Y,Q,X)=>{if(/\bsrc\s*=/.test(Q))return Y;if(/\bdata-raw\b/.test(Q))return Y;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return Y;if(J.skipServer&&/\bserver\b/.test(Q))return Y;let G=b7(X,Z);return`<script${Q}>${G}</script>`})}function q1($,Z,J){let Y=$,Q=[];Y=Y.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`});let X=[];Y=Y.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{let q=X.length;return X.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`});let G=w5($);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,q,_)=>{try{let W=l0(q,Z);return W!==void 0&&W!==null?String(W):""}catch(W){let z=W instanceof Error?W.message:String(W);return Q0("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${z}`,J,$,_,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,q,_)=>{try{let W=l0(q,Z);if(W===void 0&&Z.__stx_buildMode==="compile")return V5("raw",q.trim());return W!==void 0&&W!==null?String(W):""}catch(W){if(Z.__stx_buildMode==="compile")return V5("raw",q.trim());let z=W instanceof Error?W.message:String(W);return Q0("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${z}`,J,$,_,K)}}),Y=Y.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{if(K.startsWith("<!--__STX_SCRIPT_EXPR_"))return K;let q=X.length;return X.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`}),Y=Y.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(K.startsWith("<!--__STX_STYLE_"))return K;if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(K,q,_)=>{let W=q.trim(),z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],U=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,B=W.match(U)?.[1],O=B&&((B in Z)||z.includes(B)),F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,L=W.match(F),H=L&&!z.includes(L[1])&&!(L[1]in Z);if(/^__[A-Z_]+__$/.test(W))return"";try{let V=l0(q,Z);if(V===void 0&&G&&!D7(W,Z))return K;if(V===void 0&&Z.__stx_buildMode==="compile"&&!G)return V5("expr",W);return V!==void 0&&V!==null?K1(String(V)):""}catch(V){if(G&&!D7(W,Z))return K;if(H)return K;let N=V instanceof Error?V.message:String(V);return Q0("Expression",`Error evaluating: {{ ${W} }}: ${N}`,J,$,_,K)}});for(let K=0;K<X.length;K++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>X[K]);for(let K=0;K<Q.length;K++)Y=Y.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return Y}function S7($,Z,J){if(!Z.trim())return $;let Y=$,Q=Z.trim();while(Q.length>0){let X=Q.match(/^(\w+)/);if(!X)break;let G=X[1];Q=Q.substring(G.length).trim();let K=i1[G]||n1[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(k7()).join(", ")}`);let q=[];if(Q.startsWith(":")){let _=Q.match(/^:([^|\s]+)/);if(_){let W=_[1].trim();try{let z=Number(W);q=[Number.isNaN(z)?W:z]}catch{q=[W]}Q=Q.substring(_[0].length).trim()}}else if(Q.startsWith("(")){let _=1,W=1;while(_>0&&W<Q.length){if(Q[W]==="(")_++;if(Q[W]===")")_--;W++}if(_===0){let z=Q.substring(1,W-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[l0(`(${z})`,J,!0)];else{let U=[],j="",B=null,O=0,F=0,L=0,H=!1;for(let V=0;V<z.length;V++){let N=z[V];if(H){j+=N,H=!1;continue}if(N==="\\"){j+=N,H=!0;continue}if(B){if(j+=N,N===B)B=null;continue}if(N==='"'||N==="'"||N==="`"){B=N,j+=N;continue}if(N==="(")O++;else if(N===")")O--;else if(N==="[")F++;else if(N==="]")F--;else if(N==="{")L++;else if(N==="}")L--;if(N===","&&O===0&&F===0&&L===0){U.push(j),j="";continue}j+=N}if(j)U.push(j);q=U.map((V)=>{let N=V.trim();return l0(N,J,!0)})}}catch{q=[z]}Q=Q.substring(W).trim()}}try{Y=K(Y,J,...q)}catch(_){let W=_ instanceof Error?_.message:String(_);throw Error(`Error applying filter '${G}': ${W}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return Y}function uY($){let Z=!1,J="",Y=0,Q=0,X=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],_=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,J=q;else if(q===J)Z=!1,J="";continue}if(Z&&J==="`"&&q==="$"&&_==="{"){let W=1;K+=2;while(K<$.length&&W>0){if($[K]==="{")W++;else if($[K]==="}")W--;if(W>0)K++}continue}if(Z)continue;if(q==="(")Y++;else if(q===")")Y--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")X++;else if(q==="}")X--;if(q==="|"&&Y===0&&Q===0&&X===0){if(_==="|"){K++;continue}if(_==="="){K++;continue}return K}}return-1}function l0($,Z,J=!1){try{let Y=$.trim(),Q=uY(Y);if(Q>0){let X=Y.substring(0,Q).trim(),G=Y.substring(Q+1).trim(),K=l0(X,Z,!0);return S7(K,G,Z)}if(!e(Y)){if(!J)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return X0(Y,Z)}try{let X=Object.keys(Z),G=Object.values(Z);return $0(Y,X)(...G)}catch{return X0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(Y.message);if(Q){let X=Q[1],G=pY(X,Object.keys(Z));if(G&&G!==X)Y.message=`${Y.message} \u2014 did you mean '${G}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function pY($,Z){let J=null;for(let Q of Z){if(Q===$)continue;let X=lY($,Q);if(J===null||X<J.dist)J={key:Q,dist:X}}if(!J)return null;let Y=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/Y<=0.35)return J.key;return null}function lY($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,Y]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(J.length+1),X=Array(J.length+1);for(let G=0;G<=J.length;G++)Q[G]=G;for(let G=1;G<=Y.length;G++){X[0]=G;for(let K=1;K<=J.length;K++){let q=J[K-1]===Y[G-1]?0:1;X[K]=Math.min(X[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=J.length;K++)Q[K]=X[K]}return Q[J.length]}function m9($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var i1,I7,n1;var o0=C(()=>{N0();F0();M7();i1={},I7=new Map;n1={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let Y=Number($);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return Y.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return K1(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let Y=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,X=String($).split("."),G=Y;for(let q of X){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(J).forEach(([q,_])=>{K=K.replace(gY(q),String(_))}),K},t:($,Z,J={})=>{return n1.translate($,Z,J)},truncate:($,Z,J=50,Y="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=J)return Q;if(J<=Y.length)return Y.substring(0,J);return Q.substring(0,J-Y.length)+Y},date:($,Z,J="short",Y="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let X={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return Q.toISOString();return new Intl.DateTimeFormat(Y,X[J]||X.short).format(Q)}catch{return String($)}},currency:($,Z,J="USD",Y="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(Y,{style:"currency",currency:J}).format(Q)}catch{return String($)}},pluralize:($,Z,J,Y)=>{let Q=Number($);if(Number.isNaN(Q))return J;let X=Y||`${J}s`;return Q===1?J:X},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let J=String($);return J.charAt(J.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,Y);return $},replace:($,Z,J,Y="")=>{if($===void 0||$===null)return"";let Q=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>Y)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let Y=Number($);if(Number.isNaN(Y))return 0;let Q=10**J;return Math.round(Y*Q)/Q}}});class o1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let J=this.cache.keys().next().value;if(J!==void 0)this.cache.delete(J)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function T1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let J=`${$}:${Z||""}`;if(!A1.has(J)){if(A1.size>=cY){let Y=A1.keys().next().value;if(Y)A1.delete(Y)}A1.set(J,new RegExp($,Z))}return A1.get(J)}class C7{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),J=Z.sort().join(","),Y=this.pool.find((K)=>K.context.join(",")===J);if(Y)return Y.func;let Q=this.fnCache,X=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let _=`${J}:${q}`,W=Q.get(_);if(!W){if(Q.size>=X){let z=Q.keys().next().value;if(z)Q.delete(z)}W=Function(...Z,`
722
+ `);if(X.length===Z.length)return G;return(...K)=>{let q=Array(Q.length);for(let _=0;_<Q.length;_++)q[_]=K[Q[_]];return G(...q)}}function F5($){let Z=$.trim(),J=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of J)if(Y.test(Z))return!1;return!0}var CY,N7,T7,PY;var A0=C(()=>{CY={maxSanitizeDepth:10,allowBracketNotation:!1},N7={...CY},T7=[/\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/],PY=/[\w)\]]\s*\[\s*['"]/});function V5($,Z){let J=fY++,Y=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return gY.set(Y,{type:$,expression:Z}),Y}var fY=0,gY;var M7=C(()=>{gY=new Map});var y7={};r(y7,{usesSignalsInScript:()=>w5,unescapeHtml:()=>m9,registerFilters:()=>dY,registerFilter:()=>E7,processExpressions:()=>o0,interpolateScriptsInTemplate:()=>uY,interpolateScriptExpressions:()=>b7,getAllFilters:()=>k7,evaluateExpression:()=>l0,escapeHtml:()=>q1,defaultFilters:()=>o1,clearCustomFilters:()=>mY,applyFilters:()=>S7});function hY($){let Z=I7.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),I7.set($,Z)}return Z.lastIndex=0,Z}function E7($,Z){if($ in o1)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);n1[$]=Z}function dY($){for(let[Z,J]of Object.entries($))E7(Z,J)}function k7(){return{...o1,...n1}}function mY(){for(let $ of Object.keys(n1))delete n1[$]}function q1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function w5($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Z.exec($))!==null){let Y=J[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;return!1}function D7($,Z){let J=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",X=!1,G=0;for(let _=0;_<Y.length;_++){let W=Y[_];if(!X&&W==="`"){X=!0,G=0;continue}if(X){if(W==="`"&&G===0){X=!1;continue}if(W==="$"&&Y[_+1]==="{"){G++,_++;continue}if(W==="}"&&G>0){G--;continue}continue}Q+=W}Y=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(Y))!==null){let _=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!J.includes(_)&&!(_ in Z))return!1}}return!0}function b7($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>{try{let X=l0(Q,Z);if(X===void 0)return Y;return X===null?"":String(X)}catch{return Y}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(Y,Q)=>{let X=Q.trim();if(/^__[A-Z_]+__$/.test(X))return Y;try{let G=l0(Q,Z);if(G===void 0)return Y;return JSON.stringify(G)}catch{return Y}}),J}function uY($,Z,J={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(Y,Q,X)=>{if(/\bsrc\s*=/.test(Q))return Y;if(/\bdata-raw\b/.test(Q))return Y;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return Y;if(J.skipServer&&/\bserver\b/.test(Q))return Y;let G=b7(X,Z);return`<script${Q}>${G}</script>`})}function o0($,Z,J){let Y=$,Q=[];Y=Y.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`});let X=[];Y=Y.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{let q=X.length;return X.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`});let G=w5($);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,q,_)=>{try{let W=l0(q,Z);return W!==void 0&&W!==null?String(W):""}catch(W){let z=W instanceof Error?W.message:String(W);return Q0("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${z}`,J,$,_,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,q,_)=>{try{let W=l0(q,Z);if(W===void 0&&Z.__stx_buildMode==="compile")return V5("raw",q.trim());return W!==void 0&&W!==null?String(W):""}catch(W){if(Z.__stx_buildMode==="compile")return V5("raw",q.trim());let z=W instanceof Error?W.message:String(W);return Q0("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${z}`,J,$,_,K)}}),Y=Y.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{if(K.startsWith("<!--__STX_SCRIPT_EXPR_"))return K;let q=X.length;return X.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`}),Y=Y.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(K.startsWith("<!--__STX_STYLE_"))return K;if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(K,q,_)=>{let W=q.trim(),z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],U=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,B=W.match(U)?.[1],O=B&&((B in Z)||z.includes(B)),F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,L=W.match(F),H=L&&!z.includes(L[1])&&!(L[1]in Z);if(/^__[A-Z_]+__$/.test(W))return"";try{let V=l0(q,Z);if(V===void 0&&G&&!D7(W,Z))return K;if(V===void 0&&Z.__stx_buildMode==="compile"&&!G)return V5("expr",W);return V!==void 0&&V!==null?q1(String(V)):""}catch(V){if(G&&!D7(W,Z))return K;if(H)return K;let A=V instanceof Error?V.message:String(V);return Q0("Expression",`Error evaluating: {{ ${W} }}: ${A}`,J,$,_,K)}});for(let K=0;K<X.length;K++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>X[K]);for(let K=0;K<Q.length;K++)Y=Y.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return Y}function S7($,Z,J){if(!Z.trim())return $;let Y=$,Q=Z.trim();while(Q.length>0){let X=Q.match(/^(\w+)/);if(!X)break;let G=X[1];Q=Q.substring(G.length).trim();let K=n1[G]||o1[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(k7()).join(", ")}`);let q=[];if(Q.startsWith(":")){let _=Q.match(/^:([^|\s]+)/);if(_){let W=_[1].trim();try{let z=Number(W);q=[Number.isNaN(z)?W:z]}catch{q=[W]}Q=Q.substring(_[0].length).trim()}}else if(Q.startsWith("(")){let _=1,W=1;while(_>0&&W<Q.length){if(Q[W]==="(")_++;if(Q[W]===")")_--;W++}if(_===0){let z=Q.substring(1,W-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[l0(`(${z})`,J,!0)];else{let U=[],j="",B=null,O=0,F=0,L=0,H=!1;for(let V=0;V<z.length;V++){let A=z[V];if(H){j+=A,H=!1;continue}if(A==="\\"){j+=A,H=!0;continue}if(B){if(j+=A,A===B)B=null;continue}if(A==='"'||A==="'"||A==="`"){B=A,j+=A;continue}if(A==="(")O++;else if(A===")")O--;else if(A==="[")F++;else if(A==="]")F--;else if(A==="{")L++;else if(A==="}")L--;if(A===","&&O===0&&F===0&&L===0){U.push(j),j="";continue}j+=A}if(j)U.push(j);q=U.map((V)=>{let A=V.trim();return l0(A,J,!0)})}}catch{q=[z]}Q=Q.substring(W).trim()}}try{Y=K(Y,J,...q)}catch(_){let W=_ instanceof Error?_.message:String(_);throw Error(`Error applying filter '${G}': ${W}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return Y}function pY($){let Z=!1,J="",Y=0,Q=0,X=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],_=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,J=q;else if(q===J)Z=!1,J="";continue}if(Z&&J==="`"&&q==="$"&&_==="{"){let W=1;K+=2;while(K<$.length&&W>0){if($[K]==="{")W++;else if($[K]==="}")W--;if(W>0)K++}continue}if(Z)continue;if(q==="(")Y++;else if(q===")")Y--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")X++;else if(q==="}")X--;if(q==="|"&&Y===0&&Q===0&&X===0){if(_==="|"){K++;continue}if(_==="="){K++;continue}return K}}return-1}function l0($,Z,J=!1){try{let Y=$.trim(),Q=pY(Y);if(Q>0){let X=Y.substring(0,Q).trim(),G=Y.substring(Q+1).trim(),K=l0(X,Z,!0);return S7(K,G,Z)}if(!e(Y)){if(!J)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return X0(Y,Z)}try{let X=Object.keys(Z),G=Object.values(Z);return $0(Y,X)(...G)}catch{return X0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(Y.message);if(Q){let X=Q[1],G=lY(X,Object.keys(Z));if(G&&G!==X)Y.message=`${Y.message} \u2014 did you mean '${G}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function lY($,Z){let J=null;for(let Q of Z){if(Q===$)continue;let X=cY($,Q);if(J===null||X<J.dist)J={key:Q,dist:X}}if(!J)return null;let Y=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/Y<=0.35)return J.key;return null}function cY($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,Y]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(J.length+1),X=Array(J.length+1);for(let G=0;G<=J.length;G++)Q[G]=G;for(let G=1;G<=Y.length;G++){X[0]=G;for(let K=1;K<=J.length;K++){let q=J[K-1]===Y[G-1]?0:1;X[K]=Math.min(X[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=J.length;K++)Q[K]=X[K]}return Q[J.length]}function m9($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var n1,I7,o1;var s0=C(()=>{A0();F0();M7();n1={},I7=new Map;o1={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let Y=Number($);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return Y.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return q1(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let Y=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,X=String($).split("."),G=Y;for(let q of X){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(J).forEach(([q,_])=>{K=K.replace(hY(q),String(_))}),K},t:($,Z,J={})=>{return o1.translate($,Z,J)},truncate:($,Z,J=50,Y="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=J)return Q;if(J<=Y.length)return Y.substring(0,J);return Q.substring(0,J-Y.length)+Y},date:($,Z,J="short",Y="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let X={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return Q.toISOString();return new Intl.DateTimeFormat(Y,X[J]||X.short).format(Q)}catch{return String($)}},currency:($,Z,J="USD",Y="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(Y,{style:"currency",currency:J}).format(Q)}catch{return String($)}},pluralize:($,Z,J,Y)=>{let Q=Number($);if(Number.isNaN(Q))return J;let X=Y||`${J}s`;return Q===1?J:X},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let J=String($);return J.charAt(J.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,Y);return $},replace:($,Z,J,Y="")=>{if($===void 0||$===null)return"";let Q=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>Y)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let Y=Number($);if(Number.isNaN(Y))return 0;let Q=10**J;return Math.round(Y*Q)/Q}}});class s1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let J=this.cache.keys().next().value;if(J!==void 0)this.cache.delete(J)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function M1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let J=`${$}:${Z||""}`;if(!T1.has(J)){if(T1.size>=iY){let Y=T1.keys().next().value;if(Y)T1.delete(Y)}T1.set(J,new RegExp($,Z))}return T1.get(J)}class C7{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),J=Z.sort().join(","),Y=this.pool.find((K)=>K.context.join(",")===J);if(Y)return Y.func;let Q=this.fnCache,X=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let _=`${J}:${q}`,W=Q.get(_);if(!W){if(Q.size>=X){let z=Q.keys().next().value;if(z)Q.delete(z)}W=Function(...Z,`
723
723
  'use strict';
724
724
  try {
725
725
  return ${q};
@@ -730,42 +730,43 @@ catch (e) {
730
730
  }
731
731
  throw e;
732
732
  }
733
- `),Q.set(_,W)}return W(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class P7{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,J]of Object.entries($))this.setBudget(Z,J)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,J]of this.budgets.entries())$[Z]=J;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let J=performance.now(),Y=Z(),Q=performance.now()-J;return this.recordTime($,Q),this.checkBudget($,Q),Y}async timeAsync($,Z){if(!this.enabled)return Z();let J=performance.now(),Y=await Z(),Q=performance.now()-J;return this.recordTime($,Q),this.checkBudget($,Q),Y}checkBudget($,Z){let J=this.budgets.get($);if(!J)return;let Y=Z/J.maxTime*100,Q=J.warnThreshold!==void 0?Z>=J.maxTime*J.warnThreshold&&Z<J.maxTime:!1,X=Z>=J.maxTime;if(!Q&&!X)return;let G={label:$,actualTime:Z,budgetTime:J.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${Y.toFixed(1)}% of ${J.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${J.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(J.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(X)throw Error(K);else console.warn(K);break}}recordTime($,Z){let J=this.metrics.get($);if(J)J.count++,J.totalTime+=Z,J.maxTime=Math.max(J.maxTime,Z),J.minTime=Math.min(J.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let J=this.metrics.get($);if(!J)return{};let Y=this.budgets.get($);return{count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Y?.maxTime,budgetUtilization:Y?J.totalTime/J.count/Y.maxTime*100:void 0}}let Z={};for(let[J,Y]of this.metrics.entries()){let Q=this.budgets.get(J);Z[J]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:Q?.maxTime,budgetUtilization:Q?Y.totalTime/Y.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,J=0;for(let Y of this.violations)if($[Y.label]=($[Y.label]||0)+1,Y.isWarning)Z++;else J++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:J}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function iY(){if(!u9)u9=new P7;return u9}var A1,cY=500,rW,u9=null,v7;var M1=C(()=>{A1=new Map;rW=new C7;v7=new Proxy({},{get($,Z){return iY()[Z]}})});function x7($,Z=""){let J=`${$}${Z}`,Y=0;for(let Q=0;Q<J.length;Q++){let X=J.charCodeAt(Q);Y=(Y<<5)-Y+X,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function f7($,Z,J={}){let{prefix:Y="",preserveHost:Q=!0,scopeKeyframes:X=!0,scopeCustomProperties:G=!1}=J;if(!$.trim())return"";let K=p9($),q=[],_=new Map;if(X)for(let W of K){let z=W.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let U=z[1],j=`${Z}_${U}`;_.set(U,j)}}for(let W of K){let z=g7(W,Z,Y,Q,_,G);q.push(z)}return q.join(`
733
+ `),Q.set(_,W)}return W(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class P7{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,J]of Object.entries($))this.setBudget(Z,J)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,J]of this.budgets.entries())$[Z]=J;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let J=performance.now(),Y=Z(),Q=performance.now()-J;return this.recordTime($,Q),this.checkBudget($,Q),Y}async timeAsync($,Z){if(!this.enabled)return Z();let J=performance.now(),Y=await Z(),Q=performance.now()-J;return this.recordTime($,Q),this.checkBudget($,Q),Y}checkBudget($,Z){let J=this.budgets.get($);if(!J)return;let Y=Z/J.maxTime*100,Q=J.warnThreshold!==void 0?Z>=J.maxTime*J.warnThreshold&&Z<J.maxTime:!1,X=Z>=J.maxTime;if(!Q&&!X)return;let G={label:$,actualTime:Z,budgetTime:J.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${Y.toFixed(1)}% of ${J.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${J.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(J.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(X)throw Error(K);else console.warn(K);break}}recordTime($,Z){let J=this.metrics.get($);if(J)J.count++,J.totalTime+=Z,J.maxTime=Math.max(J.maxTime,Z),J.minTime=Math.min(J.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let J=this.metrics.get($);if(!J)return{};let Y=this.budgets.get($);return{count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Y?.maxTime,budgetUtilization:Y?J.totalTime/J.count/Y.maxTime*100:void 0}}let Z={};for(let[J,Y]of this.metrics.entries()){let Q=this.budgets.get(J);Z[J]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:Q?.maxTime,budgetUtilization:Q?Y.totalTime/Y.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,J=0;for(let Y of this.violations)if($[Y.label]=($[Y.label]||0)+1,Y.isWarning)Z++;else J++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:J}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function nY(){if(!u9)u9=new P7;return u9}var T1,iY=500,$_,u9=null,v7;var I1=C(()=>{T1=new Map;$_=new C7;v7=new Proxy({},{get($,Z){return nY()[Z]}})});function x7($,Z=""){let J=`${$}${Z}`,Y=0;for(let Q=0;Q<J.length;Q++){let X=J.charCodeAt(Q);Y=(Y<<5)-Y+X,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function f7($,Z,J={}){let{prefix:Y="",preserveHost:Q=!0,scopeKeyframes:X=!0,scopeCustomProperties:G=!1}=J;if(!$.trim())return"";let K=p9($),q=[],_=new Map;if(X)for(let W of K){let z=W.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let U=z[1],j=`${Z}_${U}`;_.set(U,j)}}for(let W of K){let z=g7(W,Z,Y,Q,_,G);q.push(z)}return q.join(`
734
734
 
735
735
  `)}function p9($){let Z=[],J=$.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,Q="",X=!1,G="";for(let K=0;K<J.length;K++){let q=J[K];if(q==="@"&&Y===0)X=!0;if(q==="{")Y++;else if(q==="}"){if(Y--,Y===0){if(X){G+=q;let _=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(_){let[,W,z,U]=_;if(W==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:U.trim()});else if(W==="media"||W==="supports"||W==="container"){let j=p9(U);Z.push({selector:`@${W} ${z.trim()}`,declarations:j.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
736
736
  `)})}else Z.push({selector:`@${W} ${z.trim()}`,declarations:U.trim()})}G="",X=!1}else if(Q.trim()){Q+=q;let _=Q.match(/([^{]+)\{([^}]*)\}/);if(_)Z.push({selector:_[1].trim(),declarations:_[2].trim()});Q=""}continue}}if(X)G+=q;else Q+=q}return Z}function g7($,Z,J,Y,Q,X){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let W=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(W)||W} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=p9(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((U)=>g7(U,Z,J,Y,Q,X)).join(`
737
737
  `);return`${G} {
738
738
  ${z}
739
- }`}return`${G} { ${K} }`}let q=nY(G,Z,J,Y),_=K;for(let[W,z]of Q)_=_.replace(new RegExp(`\\b${W}\\b`,"g"),z);if(X)_=_.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${_} }`}function nY($,Z,J,Y){let Q=$.split(",").map((G)=>G.trim()),X=[];for(let G of Q){if(G.startsWith(":host")){if(Y)X.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);X.push(q)}continue}if(G.includes("::slotted")){X.push(G);continue}if(G===":root"){X.push(`:root .${Z}`);continue}let K=J?`${J} .${Z}`:`.${Z}`;X.push(`${K} ${G}`)}return X.join(", ")}function N5($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let J=x7(Z),Y=`data-v-${J}`,Q=$,X=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(X,(K,q,_)=>{G=!0;let W=oY(_,Y),z=q.replace(/\bscoped\b/gi,"").trim(),U=z?` ${z}`:"";return`<style data-stx-scoped="${J}"${U}>${W}</style>`}),!G)return{html:$,hasScoped:!1};return Q=sY(Q,Y),{html:Q,hasScoped:!0}}function oY($,Z){return f7($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function sY($,Z){let J=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,Q,X)=>{if(J.has(Q.toLowerCase()))return Y;if(Y.includes(Z))return Y;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return Y;if(X)return Y.replace(`<${Q}${X}`,`<${Q} ${Z}${X}`);if(Y.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var l9=()=>{};var h7=()=>{};function I0($,Z,J,Y=0){let Q=0,X=Y,G=null,K=0,q=!1;while(X<$.length){let _=$[X];if(G&&q){q=!1,X++;continue}if(G&&_==="\\"){q=!0,X++;continue}if(q=!1,(_==='"'||_==="'"||_==="`")&&!G){G=_,X++;continue}if(_===G&&G!=="`"){G=null,X++;continue}if(G==="`"&&_==="$"&&$[X+1]==="{"){K++,X+=2;continue}if(K>0&&_==="}"){K--,X++;continue}if(_==="`"&&G==="`"&&K===0){G=null,X++;continue}if(G){X++;continue}if(_===Z)Q++;else if(_===J){if(Q--,Q===0)return X}X++}return-1}var c9={};r(c9,{useTitle:()=>ZJ,useSeoMeta:()=>A5,usePageTitle:()=>ZJ,useHead:()=>_1,resetHead:()=>tY,renderHtmlAttrs:()=>JJ,renderHead:()=>YJ,renderBodyAttrs:()=>XJ,processTitleDirective:()=>KJ,processMetaDirective:()=>qJ,processHeadDirective:()=>GJ,getPageMeta:()=>aY,getHead:()=>s1,definePageMeta:()=>$J,applyHead:()=>QJ});function s1(){return s0}function aY(){return R5}function tY(){s0={},rY.length=0,R5={}}function _1($){s0=eY(s0,$)}function eY($,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 A5($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let J=$.ogTitle??$.title,Y=$.ogDescription??$.description;if(J)Z.push({property:"og:title",content:J});if(Y)Z.push({property:"og:description",content:Y});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,X=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(X)Z.push({name:"twitter:description",content:X});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});_1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function $J($){if(R5={...R5,...$},$.title||$.description)A5({title:$.title,description:$.description})}function ZJ($){let Z=typeof $==="function"?$():$;_1({title:Z})}function YJ($=s0){let Z=[];if($.title){let J=$.title;if($.titleTemplate)J=typeof $.titleTemplate==="function"?$.titleTemplate(J):$.titleTemplate.replace("%s",J);Z.push(`<title>${W1(J)}</title>`)}if($.base){let J=Object.entries($.base).map(([Y,Q])=>`${Y}="${W1(Q)}"`).join(" ");Z.push(`<base ${J}>`)}for(let J of $.meta||[]){let Y=Object.entries(J).filter(([Q,X])=>X!==void 0).map(([Q,X])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${W1(String(X))}"`}).join(" ");Z.push(`<meta ${Y}>`)}for(let J of $.link||[]){let Y=Object.entries(J).filter(([Q,X])=>X!==void 0).map(([Q,X])=>`${Q}="${W1(String(X))}"`).join(" ");Z.push(`<link ${Y}>`)}for(let J of $.script||[]){let{content:Y,...Q}=J,X=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${W1(String(K))}"`}).filter(Boolean).join(" ");if(Y)Z.push(`<script ${X}>${Y}</script>`);else Z.push(`<script ${X}></script>`)}for(let J of $.style||[]){let Y=J.type?` type="${J.type}"`:"";Z.push(`<style${Y}>${J.content}</style>`)}return Z.join(`
740
- `)}function JJ($=s0){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,J])=>`${Z}="${W1(J)}"`).join(" ")}function XJ($=s0){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,J])=>`${Z}="${W1(J)}"`).join(" ")}function W1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function QJ($=s0){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let J=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(J){let Y=document.querySelector(J);if(!Y){if(Y=document.createElement("meta"),Z.name)Y.setAttribute("name",Z.name);if(Z.property)Y.setAttribute("property",Z.property);document.head.appendChild(Y)}Y.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let J=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,Y=document.querySelector(J);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[Q,X]of Object.entries(Z))if(X!==void 0)Y.setAttribute(Q,String(X))}if($.htmlAttrs)for(let[Z,J]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,J);if($.bodyAttrs)for(let[Z,J]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,J)}function GJ($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,Q)=>{return Z+=Q.trim()+`
741
- `,""}),headContent:Z.trim()}}function KJ($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(J,Y,Q,X)=>{let G=Y?Q:Z[(X||"").trim()]??X;return _1({title:G}),""})}function qJ($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(J,Y,Q,X,G,K)=>{let q=X?G:K,_=X?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:_}:{name:Q,content:_};return _1({meta:[z]}),""})}var s0,rY,R5;var r1=C(()=>{s0={},rY=[],R5={}});var T5={};r(T5,{stripTypeScript:()=>p7,hasVariables:()=>s7,extractVariables:()=>l7,extractScriptFromTemplate:()=>o7,convertToCommonJS:()=>n9});import a1 from"path";function WJ($){let Z=[],J=0,Y=$.split(`
742
- `);for(let Q of Y){let X=null,G=!1;for(let K=0;K<Q.length;K++){let q=Q[K];if(G){G=!1;continue}if(q==="\\"){G=!0;continue}if(X){if(q===X)X=null;continue}if(q==="'"||q==='"'||q==="`"){X=q;continue}if(q==="/"&&K+1<Q.length&&Q[K+1]==="/")break;if(q==="{")J++;else if(q==="}")J--}if(J===0){let K=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1]);else{let q=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let W=q[1].slice(1,-1).split(",").map((z)=>{let U=z.split(":");return(U.length>1?U[1]:U[0]).trim()}).filter((z)=>/^\w+$/.test(z));Z.push(...W)}}}}return[...new Set(Z)]}function p7($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function J(Y){if(!Y.includes(":"))return Y;let Q=[],X="",G=0,K=0,q=null;for(let _=0;_<Y.length;_++){let W=Y[_];if(q){if(X+=W,W===q)q=null;continue}if(W==='"'||W==="'"||W==="`"){q=W,X+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")K++;else if(W===")")K--;if(W===","&&G===0&&K===0){Q.push(X),X="";continue}X+=W}if(X)Q.push(X);return Q.map((_)=>{let W=_.trim(),z=W.startsWith("..."),U=z?W.slice(3):W,j=-1,B=0;for(let w=0;w<U.length;w++)if(U[w]==="<")B++;else if(U[w]===">")B--;else if(U[w]===":"&&B===0){j=w;break}if(j===-1)return _;let F=U.substring(0,j).trim().replace(/\?$/,""),L=U.substring(j+1),H=-1,V=0;for(let w=0;w<L.length;w++)if(L[w]==="<")V++;else if(L[w]===">")V--;else if(L[w]==="="&&V===0){H=w;break}let N=z?"...":"";if(H!==-1)return`${N}${F} = ${L.substring(H+1).trim()}`;return`${N}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,Q,X)=>{if(!X.includes(":"))return Y;return`${Q}(${J(X)})`});{let Y=/\b(function\s+\w*\s*)\(/g,Q,X=[];while((Q=Y.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,_=0,W=null;while(q<Z.length&&K>0){let j=Z[q];if(W){if(j===W)W=null;q++;continue}if(j==='"'||j==="'"||j==="`"){W=j,q++;continue}if(j==="<")_++;else if(j===">"&&_>0)_--;else if(_===0){if(j==="(")K++;else if(j===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let U=J(z);X.push({start:G+1,end:q,replacement:U})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=X[G];Z=Z.substring(0,K)+_+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,Q)=>{if(!Q.includes(":"))return Y;if(Q.includes("{")||Q.includes("}"))return Y;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),_=K.split(":")[0].trim();if(q.length>0)return`${_} = ${q.join("=").trim()}`;return _}).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|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,`
739
+ }`}return`${G} { ${K} }`}let q=oY(G,Z,J,Y),_=K;for(let[W,z]of Q)_=_.replace(new RegExp(`\\b${W}\\b`,"g"),z);if(X)_=_.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${_} }`}function oY($,Z,J,Y){let Q=$.split(",").map((G)=>G.trim()),X=[];for(let G of Q){if(G.startsWith(":host")){if(Y)X.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);X.push(q)}continue}if(G.includes("::slotted")){X.push(G);continue}if(G===":root"){X.push(`:root .${Z}`);continue}let K=J?`${J} .${Z}`:`.${Z}`;X.push(`${K} ${G}`)}return X.join(", ")}function A5($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let J=x7(Z),Y=`data-v-${J}`,Q=$,X=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(X,(K,q,_)=>{G=!0;let W=sY(_,Y),z=q.replace(/\bscoped\b/gi,"").trim(),U=z?` ${z}`:"";return`<style data-stx-scoped="${J}"${U}>${W}</style>`}),!G)return{html:$,hasScoped:!1};return Q=rY(Q,Y),{html:Q,hasScoped:!0}}function sY($,Z){return f7($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function rY($,Z){let J=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,Q,X)=>{if(J.has(Q.toLowerCase()))return Y;if(Y.includes(Z))return Y;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return Y;if(X)return Y.replace(`<${Q}${X}`,`<${Q} ${Z}${X}`);if(Y.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var l9=()=>{};var h7=()=>{};function I0($,Z,J,Y=0){let Q=0,X=Y,G=null,K=0,q=!1;while(X<$.length){let _=$[X];if(G&&q){q=!1,X++;continue}if(G&&_==="\\"){q=!0,X++;continue}if(q=!1,(_==='"'||_==="'"||_==="`")&&!G){G=_,X++;continue}if(_===G&&G!=="`"){G=null,X++;continue}if(G==="`"&&_==="$"&&$[X+1]==="{"){K++,X+=2;continue}if(K>0&&_==="}"){K--,X++;continue}if(_==="`"&&G==="`"&&K===0){G=null,X++;continue}if(G){X++;continue}if(_===Z)Q++;else if(_===J){if(Q--,Q===0)return X}X++}return-1}var c9={};r(c9,{useTitle:()=>YJ,useSeoMeta:()=>N5,usePageTitle:()=>YJ,useHead:()=>_1,resetHead:()=>eY,renderHtmlAttrs:()=>XJ,renderHead:()=>JJ,renderBodyAttrs:()=>QJ,processTitleDirective:()=>qJ,processMetaDirective:()=>WJ,processHeadDirective:()=>KJ,getPageMeta:()=>tY,getHead:()=>r1,definePageMeta:()=>ZJ,applyHead:()=>GJ});function r1(){return r0}function tY(){return R5}function eY(){r0={},aY.length=0,R5={}}function _1($){r0=$J(r0,$)}function $J($,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 N5($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let J=$.ogTitle??$.title,Y=$.ogDescription??$.description;if(J)Z.push({property:"og:title",content:J});if(Y)Z.push({property:"og:description",content:Y});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,X=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(X)Z.push({name:"twitter:description",content:X});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});_1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function ZJ($){if(R5={...R5,...$},$.title||$.description)N5({title:$.title,description:$.description})}function YJ($){let Z=typeof $==="function"?$():$;_1({title:Z})}function JJ($=r0){let Z=[];if($.title){let J=$.title;if($.titleTemplate)J=typeof $.titleTemplate==="function"?$.titleTemplate(J):$.titleTemplate.replace("%s",J);Z.push(`<title>${W1(J)}</title>`)}if($.base){let J=Object.entries($.base).map(([Y,Q])=>`${Y}="${W1(Q)}"`).join(" ");Z.push(`<base ${J}>`)}for(let J of $.meta||[]){let Y=Object.entries(J).filter(([Q,X])=>X!==void 0).map(([Q,X])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${W1(String(X))}"`}).join(" ");Z.push(`<meta ${Y}>`)}for(let J of $.link||[]){let Y=Object.entries(J).filter(([Q,X])=>X!==void 0).map(([Q,X])=>`${Q}="${W1(String(X))}"`).join(" ");Z.push(`<link ${Y}>`)}for(let J of $.script||[]){let{content:Y,...Q}=J,X=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${W1(String(K))}"`}).filter(Boolean).join(" ");if(Y)Z.push(`<script ${X}>${Y}</script>`);else Z.push(`<script ${X}></script>`)}for(let J of $.style||[]){let Y=J.type?` type="${J.type}"`:"";Z.push(`<style${Y}>${J.content}</style>`)}return Z.join(`
740
+ `)}function XJ($=r0){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,J])=>`${Z}="${W1(J)}"`).join(" ")}function QJ($=r0){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,J])=>`${Z}="${W1(J)}"`).join(" ")}function W1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function GJ($=r0){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let J=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(J){let Y=document.querySelector(J);if(!Y){if(Y=document.createElement("meta"),Z.name)Y.setAttribute("name",Z.name);if(Z.property)Y.setAttribute("property",Z.property);document.head.appendChild(Y)}Y.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let J=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,Y=document.querySelector(J);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[Q,X]of Object.entries(Z))if(X!==void 0)Y.setAttribute(Q,String(X))}if($.htmlAttrs)for(let[Z,J]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,J);if($.bodyAttrs)for(let[Z,J]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,J)}function KJ($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,Q)=>{return Z+=Q.trim()+`
741
+ `,""}),headContent:Z.trim()}}function qJ($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(J,Y,Q,X)=>{let G=Y?Q:Z[(X||"").trim()]??X;return _1({title:G}),""})}function WJ($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(J,Y,Q,X,G,K)=>{let q=X?G:K,_=X?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:_}:{name:Q,content:_};return _1({meta:[z]}),""})}var r0,aY,R5;var a1=C(()=>{r0={},aY=[],R5={}});var T5={};r(T5,{stripTypeScript:()=>p7,hasVariables:()=>s7,extractVariables:()=>l7,extractScriptFromTemplate:()=>o7,convertToCommonJS:()=>n9});import D1 from"path";function _J($){let Z=[],J=0,Y=$.split(`
742
+ `);for(let Q of Y){let X=null,G=!1;for(let K=0;K<Q.length;K++){let q=Q[K];if(G){G=!1;continue}if(q==="\\"){G=!0;continue}if(X){if(q===X)X=null;continue}if(q==="'"||q==='"'||q==="`"){X=q;continue}if(q==="/"&&K+1<Q.length&&Q[K+1]==="/")break;if(q==="{")J++;else if(q==="}")J--}if(J===0){let K=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1]);else{let q=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let W=q[1].slice(1,-1).split(",").map((z)=>{let U=z.split(":");return(U.length>1?U[1]:U[0]).trim()}).filter((z)=>/^\w+$/.test(z));Z.push(...W)}}}}return[...new Set(Z)]}function p7($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function J(Y){if(!Y.includes(":"))return Y;let Q=[],X="",G=0,K=0,q=null;for(let _=0;_<Y.length;_++){let W=Y[_];if(q){if(X+=W,W===q)q=null;continue}if(W==='"'||W==="'"||W==="`"){q=W,X+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")K++;else if(W===")")K--;if(W===","&&G===0&&K===0){Q.push(X),X="";continue}X+=W}if(X)Q.push(X);return Q.map((_)=>{let W=_.trim(),z=W.startsWith("..."),U=z?W.slice(3):W,j=-1,B=0;for(let w=0;w<U.length;w++)if(U[w]==="<")B++;else if(U[w]===">")B--;else if(U[w]===":"&&B===0){j=w;break}if(j===-1)return _;let F=U.substring(0,j).trim().replace(/\?$/,""),L=U.substring(j+1),H=-1,V=0;for(let w=0;w<L.length;w++)if(L[w]==="<")V++;else if(L[w]===">")V--;else if(L[w]==="="&&V===0){H=w;break}let A=z?"...":"";if(H!==-1)return`${A}${F} = ${L.substring(H+1).trim()}`;return`${A}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,Q,X)=>{if(!X.includes(":"))return Y;return`${Q}(${J(X)})`});{let Y=/\b(function\s+\w*\s*)\(/g,Q,X=[];while((Q=Y.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,_=0,W=null;while(q<Z.length&&K>0){let j=Z[q];if(W){if(j===W)W=null;q++;continue}if(j==='"'||j==="'"||j==="`"){W=j,q++;continue}if(j==="<")_++;else if(j===">"&&_>0)_--;else if(_===0){if(j==="(")K++;else if(j===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let U=J(z);X.push({start:G+1,end:q,replacement:U})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=X[G];Z=Z.substring(0,K)+_+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,Q)=>{if(!Q.includes(":"))return Y;if(Q.includes("{")||Q.includes("}"))return Y;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),_=K.split(":")[0].trim();if(q.length>0)return`${_} = ${q.join("=").trim()}`;return _}).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|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,`
743
743
 
744
- `),Z}async function l7($,Z,J){if(!$.trim())return;let Y;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:x0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=P.transformSync(v)}catch{Y=p7($)}let Q={exports:{}},X=Q.exports,G=process.cwd(),K={},q=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((P)=>P[1]).filter((P)=>!P.startsWith("node:")&&!P.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(P));for(let P of q)try{let v=a1.resolve(G,"node_modules",P),g=a1.join(v,"package.json"),c=JSON.parse(J0("fs").readFileSync(g,"utf8")),f=c.main||"index.js";if(c.exports){let d=typeof c.exports==="string"?c.exports:c.exports["."];if(typeof d==="string")f=d;else if(d?.bun)f=d.bun;else if(d?.import)f=d.import;else if(d?.default)f=d.default}K[P]=await import(a1.resolve(v,f))}catch{}let _=(P)=>{if(K[P])return K[P];return J0(P)},W=Z.props||{},z=Object.assign((P)=>{if(!P)return W;let v={};for(let[g,c]of Object.entries(P)){let f=W[g];if(f!==void 0)v[g]=f;else if(typeof c==="function")v[g]=c();else v[g]=c}return v},W),U=()=>W,j=(P,v)=>{let g={...P};for(let[c,f]of Object.entries(v))if(g[c]===void 0)if(typeof f==="function")g[c]=f();else g[c]=f;return g},B=(P)=>{let v=()=>P;return v.set=(g)=>{},v.update=(g)=>{},v},O=(P)=>{let v,g=!1;return()=>{if(!g)try{v=P(),g=!0}catch{v=void 0}return v}},F=(P)=>{},L=(P)=>P(),H=(P)=>{},V=(P)=>{},N=(P)=>{},w=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),R=()=>({push:(P)=>{},replace:(P)=>{},back:()=>{},forward:()=>{},go:(P)=>{}}),A=(P)=>{_1(P);let v=Z.__stx_runtime_head||{},g=P||{};Z.__stx_runtime_head={...v,...g.title&&{title:g.title},meta:[...v.meta||[],...g.meta||[]],link:[...v.link||[],...g.link||[]],script:[...v.script||[],...g.script||[]],htmlAttrs:{...v.htmlAttrs||{},...g.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...g.bodyAttrs||{}}}},T=(P)=>{A5(P);let v=s1();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},I=(P)=>({value:P}),M=(P)=>P,E=(P)=>({value:typeof P==="function"?P():P}),k=(P,v)=>{},y=(P)=>{},S=(P)=>{},b=(P)=>P?P():Promise.resolve(),D=(P)=>(v,...g)=>{},x=(P)=>{},h=(P,v)=>{},l=(P,v)=>v,U0=()=>({value:"light"}),M0=()=>({value:!1}),_0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},S0=new Proxy(_0,{get(P,v){if(v in P)return P[v];return},set(P,v,g){return P[v]=g,!0}}),v0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},L0=console;try{let P=n9(Y,J),v=new Set(Object.keys(W)),g=Object.keys(Z).filter((t)=>!v.has(t)&&t!=="props"),c=g.map((t)=>Z[t]),f=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"]),d=[],W0=[];for(let[t,S9]of Object.entries(W)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(f.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(P))continue;d.push(t),W0.push(S9)}let Y0=WJ(P).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
745
- `),w0=Z.params??{},N1=[],p1=[];for(let t=0;t<g.length;t++){if(g[t]==="params")continue;N1.push(g[t]),p1.push(c[t])}let b9=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","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...d,...N1,`return (async () => {
744
+ `),Z}async function l7($,Z,J){if(!$.trim())return;let Y;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:x0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=P.transformSync(v)}catch{Y=p7($)}let Q={exports:{}},X=Q.exports,G=process.cwd(),K={},q=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((P)=>P[1]).filter((P)=>!P.startsWith("node:")&&!P.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(P));for(let P of q)try{let v=D1.resolve(G,"node_modules",P),g=D1.join(v,"package.json"),c=JSON.parse(J0("fs").readFileSync(g,"utf8")),f=c.main||"index.js";if(c.exports){let d=typeof c.exports==="string"?c.exports:c.exports["."];if(typeof d==="string")f=d;else if(d?.bun)f=d.bun;else if(d?.import)f=d.import;else if(d?.default)f=d.default}K[P]=await import(D1.resolve(v,f))}catch{}let _=(P)=>{if(K[P])return K[P];return J0(P)},W=Z.props||{},z=Object.assign((P)=>{if(!P)return W;let v={};for(let[g,c]of Object.entries(P)){let f=W[g];if(f!==void 0)v[g]=f;else if(typeof c==="function")v[g]=c();else v[g]=c}return v},W),U=()=>W,j=(P,v)=>{let g={...P};for(let[c,f]of Object.entries(v))if(g[c]===void 0)if(typeof f==="function")g[c]=f();else g[c]=f;return g},B=(P)=>{let v=()=>P;return v.set=(g)=>{},v.update=(g)=>{},v},O=(P)=>{let v,g=!1;return()=>{if(!g)try{v=P(),g=!0}catch{v=void 0}return v}},F=(P)=>{},L=(P)=>P(),H=(P)=>{},V=(P)=>{},A=(P)=>{},w=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),R=()=>({push:(P)=>{},replace:(P)=>{},back:()=>{},forward:()=>{},go:(P)=>{}}),N=(P)=>{_1(P);let v=Z.__stx_runtime_head||{},g=P||{};Z.__stx_runtime_head={...v,...g.title&&{title:g.title},meta:[...v.meta||[],...g.meta||[]],link:[...v.link||[],...g.link||[]],script:[...v.script||[],...g.script||[]],htmlAttrs:{...v.htmlAttrs||{},...g.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...g.bodyAttrs||{}}}},T=(P)=>{N5(P);let v=r1();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},I=(P)=>({value:P}),M=(P)=>P,E=(P)=>({value:typeof P==="function"?P():P}),k=(P,v)=>{},y=(P)=>{},S=(P)=>{},b=(P)=>P?P():Promise.resolve(),D=(P)=>(v,...g)=>{},x=(P)=>{},h=(P,v)=>{},l=(P,v)=>v,U0=()=>({value:"light"}),M0=()=>({value:!1}),_0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},S0=new Proxy(_0,{get(P,v){if(v in P)return P[v];return},set(P,v,g){return P[v]=g,!0}}),v0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},L0=console;try{let P=n9(Y,J),v=new Set(Object.keys(W)),g=Object.keys(Z).filter((t)=>!v.has(t)&&t!=="props"),c=g.map((t)=>Z[t]),f=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"]),d=[],W0=[];for(let[t,S9]of Object.entries(W)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(f.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(P))continue;d.push(t),W0.push(S9)}let Y0=_J(P).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
745
+ `),w0=Z.params??{},R1=[],l1=[];for(let t=0;t<g.length;t++){if(g[t]==="params")continue;R1.push(g[t]),l1.push(c[t])}let b9=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","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...d,...R1,`return (async () => {
746
746
  ${P}
747
747
  ${Y0}
748
748
  return module.exports
749
- })()`)(Q,X,_,W,z,U,j,B,O,F,L,H,V,N,w,R,A,T,I,M,E,k,y,S,b,D,x,h,l,U0,M0,S0,v0,L0,_0.confirm,_0.alert,_0.fetch,w0,...W0,...p1);Object.assign(Z,b9);for(let[t,S9]of Object.entries(W))if(!(t in Z))Z[t]=S9}catch{try{await UJ(Y,Z,J)}catch{}}}function n9($,Z){let J=Z?a1.dirname(Z):process.cwd(),Y=$.split(`
750
- `),Q=[],X=0;while(X<Y.length){let G=Y[X].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;X<Y.length;X++){for(let q of Y[X])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}X++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let _=X;_<Y.length&&!q;_++){let W=null,z=!1,U=Y[_];for(let j=0;j<U.length;j++){let B=U[j];if(z){z=!1;continue}if(B==="\\"){z=!0;continue}if(W){if(B===W)W=null;continue}if(B==='"'||B==="'"||B==="`"){W=B;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0){X=_+1,q=!0;break}}}}if(!q)X=Y.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),_=G.match(/^import\s+['"](.+)['"]/),W=(z)=>{if(z.startsWith("."))return a1.resolve(J,z);return z};if(K){let[,z,U]=K,j=W(U);Q.push(`const ${z} = await import('${j}')`),Q.push(`module.exports.${z} = ${z};`)}else if(q){let[,z,U]=q,j=z.trim(),B=W(U);Q.push(`const { ${j} } = await import('${B}')`);for(let O of j.split(",")){let F=O.trim().split(/\s+as\s+/).pop()?.trim();if(F)Q.push(`module.exports.${F} = ${F};`)}}else if(_){let z=W(_[1]);Q.push(`await import('${z}')`)}else Q.push(G);X++;continue}if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=d7(Y,X),{type:q,name:_,value:W}=K;Q.push(`${q} ${_} = ${W};`),Q.push(`module.exports.${_} = ${_};`),X=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=i9(Y,X);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),X=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=d7(Y,X),{type:q,name:_,value:W}=K;Q.push(`${q} ${_} = ${W};`),Q.push(`module.exports.${_} = ${_};`),X=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=i9(Y,X);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),X=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=Y[X].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...Y];q[X]=K;let _=i9(q,X);if(Q.push(_.functionCode),_.name)Q.push(`module.exports.default = ${_.name};`);X=_.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),X++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],_=Y[X].replace(/^export\s+/,""),W=0,z=X;for(;z<Y.length;z++){let U=Y[z];for(let j of U)if(j==="{")W++;else if(j==="}")W--;if(z>X)_+=`
751
- `+U;if(W<=0&&z>=X)break}Q.push(_),Q.push(`module.exports.${q} = ${q};`),X=z+1}else Q.push(G),X++}else if(G.includes("module.exports"))Q.push(G),X++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),X++;else X++}return Q.join(`
752
- `)}function c7($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Q=I0($,J,J==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function i7($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let Y=0,Q=0,X="";while(Y<J.length){let G=J[Y];if(G==="{"||G==="["){if(Q++,Q===1){let K=c7(J,Y);if(K){let q=i7(K.pattern);Z.push(...q),Y=K.endPos,X="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){Y++;continue}if(G===","){if(X.trim())Z.push(X.trim());X="",Y++;continue}if(G===":"){X="",Y++;continue}if(G==="="){if(X.trim())Z.push(X.trim());X="",Y++;while(Y<J.length&&J[Y]!==","&&Q===0){if(J[Y]==="{"||J[Y]==="[")Q++;else if(J[Y]==="}"||J[Y]==="]")Q--;Y++}continue}if(/[\w$]/.test(G))X+=G;Y++}if(X.trim())Z.push(X.trim());return Z}function d7($,Z){let J=$[Z].trim(),Y=J.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!Y){let _=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(_){let W=J.slice(_[0].length),z=Z;if((W.startsWith("{")||W.startsWith("["))&&!W.includes(W.startsWith("{")?"}":"]")){let j=W.startsWith("{")?"}":"]",B=W;for(let O=Z+1;O<$.length;O++)if(B+=" "+$[O].trim(),z=O,$[O].includes(j))break;W=B}let U=c7(W,0);if(U){let j=_[1],B=U.pattern,O=W.slice(U.endPos).trim();if(O.startsWith("=")){let F=O.slice(1).trim(),L=F,H=Math.max(z,Z);if(m7(F)){let R=u7($,H,F);L=R.value,H=R.nextIndex}else H=H+1;L=L.trim().replace(/;$/,"");let V=i7(B),N=`__stx_src_${Z}`,w=V.map((R)=>`module.exports.${R} = ${R};`).join(`
753
- `);return{type:j,name:N,value:`${L}; ${j} ${B} = ${N};
749
+ })()`)(Q,X,_,W,z,U,j,B,O,F,L,H,V,A,w,R,N,T,I,M,E,k,y,S,b,D,x,h,l,U0,M0,S0,v0,L0,_0.confirm,_0.alert,_0.fetch,w0,...W0,...l1);Object.assign(Z,b9);for(let[t,S9]of Object.entries(W))if(!(t in Z))Z[t]=S9}catch{try{await OJ(Y,Z,J)}catch{}}}function n9($,Z){let J=Z?D1.dirname(Z):process.cwd(),Y=$.split(`
750
+ `),Q=[],X=0;while(X<Y.length){let G=Y[X].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;X<Y.length;X++){for(let q of Y[X])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}X++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let _=X;_<Y.length&&!q;_++){let W=null,z=!1,U=Y[_];for(let j=0;j<U.length;j++){let B=U[j];if(z){z=!1;continue}if(B==="\\"){z=!0;continue}if(W){if(B===W)W=null;continue}if(B==='"'||B==="'"||B==="`"){W=B;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0){X=_+1,q=!0;break}}}}if(!q)X=Y.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),_=G.match(/^import\s+['"](.+)['"]/),W=(z)=>{if(z.startsWith("."))return D1.resolve(J,z);return z};if(K){let[,z,U]=K,j=W(U);Q.push(`const ${z} = await import('${j}')`),Q.push(`module.exports.${z} = ${z};`)}else if(q){let[,z,U]=q,j=z.trim(),B=W(U);Q.push(`const { ${j} } = await import('${B}')`);for(let O of j.split(",")){let F=O.trim().split(/\s+as\s+/).pop()?.trim();if(F)Q.push(`module.exports.${F} = ${F};`)}}else if(_){let z=W(_[1]);Q.push(`await import('${z}')`)}else Q.push(G);X++;continue}if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=d7(Y,X),{type:q,name:_,value:W}=K;Q.push(`${q} ${_} = ${W};`),Q.push(`module.exports.${_} = ${_};`),X=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=i9(Y,X);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),X=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=d7(Y,X),{type:q,name:_,value:W}=K;Q.push(`${q} ${_} = ${W};`),Q.push(`module.exports.${_} = ${_};`),X=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=i9(Y,X);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),X=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=Y[X].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...Y];q[X]=K;let _=i9(q,X);if(Q.push(_.functionCode),_.name)Q.push(`module.exports.default = ${_.name};`);X=_.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),X++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],_=Y[X].replace(/^export\s+/,""),W=0,z=X;for(;z<Y.length;z++){let U=Y[z];for(let j of U)if(j==="{")W++;else if(j==="}")W--;if(z>X)_+=`
751
+ `+U;if(W<=0&&z>=X)break}Q.push(_),Q.push(`module.exports.${q} = ${q};`),X=z+1}else Q.push(G),X++}else if(G.includes("module.exports"))Q.push(G),X++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),X++;else X++}return zJ(Q.join(`
752
+ `),J)}function zJ($,Z){let J=$.length,Y="",Q=0,X=null,G=!1,K=!1,q=0;while(Q<J){let _=$[Q],W=$[Q+1];if(G){if(Y+=_,_===`
753
+ `)G=!1;Q++;continue}if(K){if(Y+=_,_==="*"&&W==="/"){Y+=W,Q+=2,K=!1;continue}Q++;continue}if(!X&&_==="/"&&W==="/"){G=!0,Y+=_,Q++;continue}if(!X&&_==="/"&&W==="*"){K=!0,Y+=_,Q++;continue}if(X){if(Y+=_,_==="\\"){Y+=W,Q+=2;continue}if(_===X&&X!=="`"){X=null,Q++;continue}if(X==="`"){if(_==="$"&&W==="{"){q++,Y+=W,Q+=2;continue}if(_==="`"){X=null,Q++;continue}}Q++;continue}if(q>0){if(_==="{")q++;else if(_==="}")q--}if(_==='"'||_==="'"||_==="`"){X=_,Y+=_,Q++;continue}if(_==="a"&&$.startsWith("await",Q)){let z=UJ($,Q);if(z){let{quote:U,path:j,end:B}=z;if(j.startsWith(".")){let O=D1.resolve(Z,j);Y+=`await import(${U}${O}${U})`,Q=B;continue}}}Y+=_,Q++}return Y}function UJ($,Z){let J=Z+5;if(J>=$.length)return null;if(!/\s/.test($[J]))return null;while(J<$.length&&/\s/.test($[J]))J++;if(!$.startsWith("import",J))return null;J+=6;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;J++;while(J<$.length&&/\s/.test($[J]))J++;let Y=$[J];if(Y!=="'"&&Y!=='"')return null;J++;let Q=J;while(J<$.length&&$[J]!==Y)if($[J]==="\\")J+=2;else J++;if(J>=$.length)return null;let X=$.slice(Q,J);J++;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!==")")return null;return{quote:Y,path:X,end:J+1}}function c7($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Q=I0($,J,J==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function i7($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let Y=0,Q=0,X="";while(Y<J.length){let G=J[Y];if(G==="{"||G==="["){if(Q++,Q===1){let K=c7(J,Y);if(K){let q=i7(K.pattern);Z.push(...q),Y=K.endPos,X="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){Y++;continue}if(G===","){if(X.trim())Z.push(X.trim());X="",Y++;continue}if(G===":"){X="",Y++;continue}if(G==="="){if(X.trim())Z.push(X.trim());X="",Y++;while(Y<J.length&&J[Y]!==","&&Q===0){if(J[Y]==="{"||J[Y]==="[")Q++;else if(J[Y]==="}"||J[Y]==="]")Q--;Y++}continue}if(/[\w$]/.test(G))X+=G;Y++}if(X.trim())Z.push(X.trim());return Z}function d7($,Z){let J=$[Z].trim(),Y=J.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!Y){let _=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(_){let W=J.slice(_[0].length),z=Z;if((W.startsWith("{")||W.startsWith("["))&&!W.includes(W.startsWith("{")?"}":"]")){let j=W.startsWith("{")?"}":"]",B=W;for(let O=Z+1;O<$.length;O++)if(B+=" "+$[O].trim(),z=O,$[O].includes(j))break;W=B}let U=c7(W,0);if(U){let j=_[1],B=U.pattern,O=W.slice(U.endPos).trim();if(O.startsWith("=")){let F=O.slice(1).trim(),L=F,H=Math.max(z,Z);if(m7(F)){let R=u7($,H,F);L=R.value,H=R.nextIndex}else H=H+1;L=L.trim().replace(/;$/,"");let V=i7(B),A=`__stx_src_${Z}`,w=V.map((R)=>`module.exports.${R} = ${R};`).join(`
754
+ `);return{type:j,name:A,value:`${L}; ${j} ${B} = ${A};
754
755
  ${w}`,nextIndex:H}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,X,G]=Y,K=G,q=Z;if(m7(G)){let _=u7($,Z,G);K=_.value,q=_.nextIndex}else q=Z+1;while(q<$.length){let _=$[q].trim();if(_.startsWith(".")||_.startsWith("?."))K+=`
755
- ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:X,value:K,nextIndex:q}}function i9($,Z){let J=$[Z].trim(),Y=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${J}`);let[,Q]=Y,X=J.replace(/^export\s+/,""),G=Z;if(_J(J)){let K=zJ($,Z,X);X=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:X,nextIndex:G}}function m7($){let Z=$.trim();if(Z.startsWith("{"))return I0(Z,"{","}",0)===-1;if(Z.startsWith("["))return I0(Z,"[","]",0)===-1;return!n7(Z)}function n7($){let Z={paren:0,bracket:0,brace:0},J=null,Y=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&J)continue;if((X==='"'||X==="'")&&!J){J=X;continue}if(X===J&&J!=="`"){J=null;continue}if(X==="`"&&!J){J="`";continue}if(X==="`"&&J==="`"&&Y===0){J=null;continue}if(J==="`"&&X==="$"&&$[Q+1]==="{"){Y++,Q++;continue}if(Y>0&&X==="{"){Y++;continue}if(Y>0&&X==="}"){Y--;continue}if(J)continue;if(X==="(")Z.paren++;else if(X===")")Z.paren--;else if(X==="[")Z.bracket++;else if(X==="]")Z.bracket--;else if(X==="{")Z.brace++;else if(X==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function _J($){let Z=$.indexOf("{");if(Z===-1)return!0;return I0($,"{","}",Z)===-1}function u7($,Z,J){let Y=J,Q=Z+1;while(Q<$.length&&!n7(Y)){let X=$[Q];Y+=`
756
+ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:X,value:K,nextIndex:q}}function i9($,Z){let J=$[Z].trim(),Y=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${J}`);let[,Q]=Y,X=J.replace(/^export\s+/,""),G=Z;if(BJ(J)){let K=jJ($,Z,X);X=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:X,nextIndex:G}}function m7($){let Z=$.trim();if(Z.startsWith("{"))return I0(Z,"{","}",0)===-1;if(Z.startsWith("["))return I0(Z,"[","]",0)===-1;return!n7(Z)}function n7($){let Z={paren:0,bracket:0,brace:0},J=null,Y=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&J)continue;if((X==='"'||X==="'")&&!J){J=X;continue}if(X===J&&J!=="`"){J=null;continue}if(X==="`"&&!J){J="`";continue}if(X==="`"&&J==="`"&&Y===0){J=null;continue}if(J==="`"&&X==="$"&&$[Q+1]==="{"){Y++,Q++;continue}if(Y>0&&X==="{"){Y++;continue}if(Y>0&&X==="}"){Y--;continue}if(J)continue;if(X==="(")Z.paren++;else if(X===")")Z.paren--;else if(X==="[")Z.bracket++;else if(X==="]")Z.bracket--;else if(X==="{")Z.brace++;else if(X==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function BJ($){let Z=$.indexOf("{");if(Z===-1)return!0;return I0($,"{","}",Z)===-1}function u7($,Z,J){let Y=J,Q=Z+1;while(Q<$.length&&!n7(Y)){let X=$[Q];Y+=`
756
757
  ${X}`,Q++}while(Q<$.length){let X=$[Q].trim();if(X.startsWith(".")||X.startsWith("?."))Y+=`
757
- ${$[Q]}`,Q++;else break}return{value:Y,nextIndex:Q}}function zJ($,Z,J){let Y=J,Q=Z+1;while(Q<$.length){let X=Y.indexOf("{");if(X!==-1){if(I0(Y,"{","}",X)!==-1)break}let G=$[Q];Y+=`
758
- ${G}`,Q++}return{functionCode:Y,nextIndex:Q}}async function UJ($,Z,J){let Y=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let X of Y){let[,,G,K]=X;try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);Z[G]=_()}catch{try{let q=K.trim().replace(/;$/,""),_=Function(`return (${q})`);Z[G]=_()}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let X of Q){let[,,G,K]=X;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);Z[G]=_()}catch{}}try{let X=$.replace(/^export\s+/gm,""),K=Function(`
758
+ ${$[Q]}`,Q++;else break}return{value:Y,nextIndex:Q}}function jJ($,Z,J){let Y=J,Q=Z+1;while(Q<$.length){let X=Y.indexOf("{");if(X!==-1){if(I0(Y,"{","}",X)!==-1)break}let G=$[Q];Y+=`
759
+ ${G}`,Q++}return{functionCode:Y,nextIndex:Q}}async function OJ($,Z,J){let Y=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let X of Y){let[,,G,K]=X;try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);Z[G]=_()}catch{try{let q=K.trim().replace(/;$/,""),_=Function(`return (${q})`);Z[G]=_()}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let X of Q){let[,,G,K]=X;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);Z[G]=_()}catch{}}try{let X=$.replace(/^export\s+/gm,""),K=Function(`
759
760
  ${X}
760
761
  const result = {};
761
762
  ${Array.from($.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)).map((q)=>`if (typeof ${q[1]} !== 'undefined') result.${q[1]} = ${q[1]};`).join(`
762
763
  `)}
763
764
  return result;
764
- `)();Object.entries(K).forEach(([q,_])=>{if(_!==void 0&&!(q in Z))Z[q]=_})}catch{}}function o7($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",Y=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:Y}}function s7($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var t1=C(()=>{r1();R1()});var $3={};r($3,{renderSlot:()=>a7,processSlots:()=>e7,parseSlots:()=>r7,parseSlotElement:()=>jJ,extractSlotContent:()=>LJ,applySlots:()=>FJ});function BJ($,Z){let J=1,Y=Z,Q="<template",X="</template";while(Y<$.length&&J>0){let G=$.indexOf("<",Y);if(G===-1)break;if(Y=G,$.startsWith(Q,Y)&&(Y+Q.length>=$.length||/[\s>\/]/.test($[Y+Q.length]))){J++,Y+=Q.length;continue}if($.startsWith(X,Y)){let K=$.indexOf(">",Y+X.length);if(K!==-1){if(J--,J===0)return K+1;Y=K+1;continue}}Y++}return J===0?Y:-1}function r7($){let Z={default:"",named:new Map},J=$,Y=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,Q=[],X;while((X=Y.exec($))!==null){let[W,z,U,j,B]=X,O=z||U||j,F=X.index+W.length,L=BJ($,F);if(L!==-1){let H=$.slice(F,L-11).trim();Q.push({start:X.index,end:L,slotName:O,content:H,propsBinding:B||void 0}),Z.named.set(O,{name:O,content:H,propsBinding:B||void 0})}}Q.sort((W,z)=>z.start-W.start);for(let W of Q)J=J.slice(0,W.start)+J.slice(W.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(J))!==null){let[W,z,U,j,B,O]=q,F=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(F+L).trim(),V=`<${z}${H?" "+H:""}>${O}</${z}>`;G.push({start:q.index,end:q.index+W.length,slotName:j,element:V})}let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=_.exec(J))!==null){let[W,z,U,j,B]=q,O=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+F).trim(),H=`<${z}${L?" "+L:""} />`;G.push({start:q.index,end:q.index+W.length,slotName:j,element:H})}G.sort((W,z)=>z.start-W.start);for(let W of G){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});J=J.slice(0,W.start)+J.slice(W.end)}return Z.default=J.trim(),Z}function jJ($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),J=Z?Z[1]:"",Y={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=Q.exec($))!==null)Y[X[1]]=X[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:J,props:Y,defaultContent:K}}async function a7($,Z,J,Y){if(!$)return J;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let X=$.propsBinding.trim(),G={...Y};if(X.startsWith("{")&&X.endsWith("}")){let K=X.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[_,W]=q.split(":").map((U)=>U.trim()),z=W||_;if(Z[_]!==void 0)G[z]=Z[_]}}else G[X]=Z;Q=OJ(Q,G)}return Q}function OJ($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(J,Y)=>{try{let Q=Y.trim(),X=t7(Q,Z);return K1(String(X??""))}catch{return`{{ ${Y} }}`}})}function t7($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let Y=$.split("."),Q=Z;for(let X of Y)if(Q&&typeof Q==="object"&&X in Q)Q=Q[X];else return;return Q}let J=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(J){let[,Y,Q,X]=J,G=Z[Y],K=parseInt(X,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!e($))return;return $0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function e7($,Z,J){let Y=$;Y=await HJ(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,_)=>{let W=Z.named.get(K),z=_?.trim()||"",U=q||"",j={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,O;while((O=B.exec(U))!==null){let F=O[1],L=O[2];j[F]=t7(L,J)}return await a7(W,j,z,J)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(X,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),Y}async function HJ($,Z,J){let Y=[],Q=[];$.replace(Z,(K,...q)=>{let _=q[q.length-2];return Q.push({match:K,index:_}),Y.push(J(K,...q.slice(0,-2))),K});let X=await Promise.all(Y),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:_}=Q[K];G=G.slice(0,_)+X[K]+G.slice(_+q.length)}return G}function LJ($){let Z=r7($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function FJ($,Z,J,Y){return await e7($,{default:Z,named:J},Y)}var Z3=C(()=>{o0();N0()});import VJ from"fs";import n from"path";function NJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function RJ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function Q1($){return!RJ($)}function G1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let J=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:x0()}).transformSync(Z);for(let X=0;X<J.length;X++)Q=Q.replace(`"__STX_EXPR_${X}__"`,J[X]),Q=Q.replace(`'__STX_EXPR_${X}__'`,J[X]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function AJ($){let Z=[],J=new Set,Y=0,Q=0,X=$.length,G=(W)=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]===W){Q++;return}Q++}},K=()=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let W=1;while(Q<X&&W>0)if($[Q]==="{")W++;else if($[Q]==="}")W--;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<X&&$[Q]!==`
765
- `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<X-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},_=()=>{if(Y!==0)return;let W=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((O)=>{let F=O.trim().split(":");return F[F.length-1].trim()});for(let O of B)if(O&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(O)&&!J.has(O))Z.push(O),J.add(O);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!J.has(B))Z.push(B),J.add(B);return}let U=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Q<X){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){Y++,Q++;continue}if($[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))_();Q++}return Z}async function z1($,Z,J,Y,Q,X,G,K=new Set,q){let{extractVariables:_}=await Promise.resolve().then(() => (t1(),T5)),W=K??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let z=new Set(W);z.add($);try{let U=(P)=>P.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),B=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=Q.__importedComponents;if(F){let P=[B,B.toLowerCase(),U(B),j(B)];for(let v of P)if(F.has(v)){O=F.get(v);break}}let L=[];if(!O){let P=[`${B}.stx`,`${U(B)}.stx`,`${j(B)}.stx`],v=[...new Set(P)],g=Q.__originalFilePath,c=[];if(g){let a=n.join(n.dirname(g),"components");c.push(a)}if(Y)c.push(Y);let f=n.join(n.dirname(X),"components");if(!c.includes(f))c.push(f);if(G.componentsDir&&G.componentsDir!==Y&&!c.includes(G.componentsDir))c.push(G.componentsDir);let d=process.cwd(),W0=[n.resolve(d,"src/components"),n.resolve(d,"components"),n.resolve(import.meta.dir,"components")];for(let a of W0)if(!c.includes(a))c.push(a);if(B.startsWith("./")||B.startsWith("../"))O=n.resolve(n.dirname(X),`${B}.stx`),L.push(O);else for(let a of c){if(!a)continue;for(let Y0 of v){let w0=n.join(a,Y0);if(L.push(w0),await i(w0)){O=w0;break}}if(O)break;if(!O)try{let Y0=await import("fs");if(!Y0.statSync(a,{throwIfNoEntry:!1})?.isDirectory())continue;let N1=Y0.readdirSync(a,{withFileTypes:!0});for(let p1 of N1)if(p1.isDirectory()){let J7=n.join(a,p1.name);for(let b9 of v){let t=n.join(J7,b9);if(L.push(t),await i(t)){O=t;break}}if(O)break}}catch{}if(O)break}}if(!O||!await i(O)){let P=L.length>0?`
765
+ `)();Object.entries(K).forEach(([q,_])=>{if(_!==void 0&&!(q in Z))Z[q]=_})}catch{}}function o7($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",Y=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:Y}}function s7($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var t1=C(()=>{a1();N1()});var $3={};r($3,{renderSlot:()=>a7,processSlots:()=>e7,parseSlots:()=>r7,parseSlotElement:()=>LJ,extractSlotContent:()=>wJ,applySlots:()=>AJ});function HJ($,Z){let J=1,Y=Z,Q="<template",X="</template";while(Y<$.length&&J>0){let G=$.indexOf("<",Y);if(G===-1)break;if(Y=G,$.startsWith(Q,Y)&&(Y+Q.length>=$.length||/[\s>\/]/.test($[Y+Q.length]))){J++,Y+=Q.length;continue}if($.startsWith(X,Y)){let K=$.indexOf(">",Y+X.length);if(K!==-1){if(J--,J===0)return K+1;Y=K+1;continue}}Y++}return J===0?Y:-1}function r7($){let Z={default:"",named:new Map},J=$,Y=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,Q=[],X;while((X=Y.exec($))!==null){let[W,z,U,j,B]=X,O=z||U||j,F=X.index+W.length,L=HJ($,F);if(L!==-1){let H=$.slice(F,L-11).trim();Q.push({start:X.index,end:L,slotName:O,content:H,propsBinding:B||void 0}),Z.named.set(O,{name:O,content:H,propsBinding:B||void 0})}}Q.sort((W,z)=>z.start-W.start);for(let W of Q)J=J.slice(0,W.start)+J.slice(W.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(J))!==null){let[W,z,U,j,B,O]=q,F=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(F+L).trim(),V=`<${z}${H?" "+H:""}>${O}</${z}>`;G.push({start:q.index,end:q.index+W.length,slotName:j,element:V})}let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=_.exec(J))!==null){let[W,z,U,j,B]=q,O=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+F).trim(),H=`<${z}${L?" "+L:""} />`;G.push({start:q.index,end:q.index+W.length,slotName:j,element:H})}G.sort((W,z)=>z.start-W.start);for(let W of G){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});J=J.slice(0,W.start)+J.slice(W.end)}return Z.default=J.trim(),Z}function LJ($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),J=Z?Z[1]:"",Y={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=Q.exec($))!==null)Y[X[1]]=X[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:J,props:Y,defaultContent:K}}async function a7($,Z,J,Y){if(!$)return J;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let X=$.propsBinding.trim(),G={...Y};if(X.startsWith("{")&&X.endsWith("}")){let K=X.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[_,W]=q.split(":").map((U)=>U.trim()),z=W||_;if(Z[_]!==void 0)G[z]=Z[_]}}else G[X]=Z;Q=FJ(Q,G)}return Q}function FJ($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(J,Y)=>{try{let Q=Y.trim(),X=t7(Q,Z);return q1(String(X??""))}catch{return`{{ ${Y} }}`}})}function t7($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let Y=$.split("."),Q=Z;for(let X of Y)if(Q&&typeof Q==="object"&&X in Q)Q=Q[X];else return;return Q}let J=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(J){let[,Y,Q,X]=J,G=Z[Y],K=parseInt(X,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!e($))return;return $0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function e7($,Z,J){let Y=$;Y=await VJ(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,_)=>{let W=Z.named.get(K),z=_?.trim()||"",U=q||"",j={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,O;while((O=B.exec(U))!==null){let F=O[1],L=O[2];j[F]=t7(L,J)}return await a7(W,j,z,J)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(X,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),Y}async function VJ($,Z,J){let Y=[],Q=[];$.replace(Z,(K,...q)=>{let _=q[q.length-2];return Q.push({match:K,index:_}),Y.push(J(K,...q.slice(0,-2))),K});let X=await Promise.all(Y),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:_}=Q[K];G=G.slice(0,_)+X[K]+G.slice(_+q.length)}return G}function wJ($){let Z=r7($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function AJ($,Z,J,Y){return await e7($,{default:Z,named:J},Y)}var Z3=C(()=>{s0();A0()});import RJ from"fs";import n from"path";function TJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function MJ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function G1($){return!MJ($)}function K1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let J=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:x0()}).transformSync(Z);for(let X=0;X<J.length;X++)Q=Q.replace(`"__STX_EXPR_${X}__"`,J[X]),Q=Q.replace(`'__STX_EXPR_${X}__'`,J[X]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function IJ($){let Z=[],J=new Set,Y=0,Q=0,X=$.length,G=(W)=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]===W){Q++;return}Q++}},K=()=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let W=1;while(Q<X&&W>0)if($[Q]==="{")W++;else if($[Q]==="}")W--;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<X&&$[Q]!==`
766
+ `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<X-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},_=()=>{if(Y!==0)return;let W=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((O)=>{let F=O.trim().split(":");return F[F.length-1].trim()});for(let O of B)if(O&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(O)&&!J.has(O))Z.push(O),J.add(O);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!J.has(B))Z.push(B),J.add(B);return}let U=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Q<X){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){Y++,Q++;continue}if($[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))_();Q++}return Z}async function z1($,Z,J,Y,Q,X,G,K=new Set,q){let{extractVariables:_}=await Promise.resolve().then(() => (t1(),T5)),W=K??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let z=new Set(W);z.add($);try{let U=(P)=>P.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),B=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=Q.__importedComponents;if(F){let P=[B,B.toLowerCase(),U(B),j(B)];for(let v of P)if(F.has(v)){O=F.get(v);break}}let L=[];if(!O){let P=[`${B}.stx`,`${U(B)}.stx`,`${j(B)}.stx`],v=[...new Set(P)],g=Q.__originalFilePath,c=[];if(g){let a=n.join(n.dirname(g),"components");c.push(a)}if(Y)c.push(Y);let f=n.join(n.dirname(X),"components");if(!c.includes(f))c.push(f);if(G.componentsDir&&G.componentsDir!==Y&&!c.includes(G.componentsDir))c.push(G.componentsDir);let d=process.cwd(),W0=[n.resolve(d,"src/components"),n.resolve(d,"components"),n.resolve(import.meta.dir,"components")];for(let a of W0)if(!c.includes(a))c.push(a);if(B.startsWith("./")||B.startsWith("../"))O=n.resolve(n.dirname(X),`${B}.stx`),L.push(O);else for(let a of c){if(!a)continue;for(let Y0 of v){let w0=n.join(a,Y0);if(L.push(w0),await i(w0)){O=w0;break}}if(O)break;if(!O)try{let Y0=await import("fs");if(!Y0.statSync(a,{throwIfNoEntry:!1})?.isDirectory())continue;let R1=Y0.readdirSync(a,{withFileTypes:!0});for(let l1 of R1)if(l1.isDirectory()){let J7=n.join(a,l1.name);for(let b9 of v){let t=n.join(J7,b9);if(L.push(t),await i(t)){O=t;break}}if(O)break}}catch{}if(O)break}}if(!O||!await i(O)){let P=L.length>0?`
766
767
  Searched paths:
767
768
  ${L.map((v)=>` - ${v}`).join(`
768
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}q.add(O);let H;if(o9.has(O))H=o9.get(O);else try{H=await Bun.file(O).text(),o9.set(O,H)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let V=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[P,v]of Object.entries(Q))if(!P.startsWith("__")||V.has(P))N[P]=v;let w={...N,...Z,props:Z,slot:J,__processedComponents:z,__sections:{}},R=H,A=R.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(A)R=A[1].trim();let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...H.matchAll(T)],M=[];for(let P of I){let v=P[1]||"",g=P[2]||"",c=v.includes("server");if(Q1(v)&&g.trim())g=G1(g);if(c&&g)try{await _(g,w,O)}catch(d){}if(!c){let d=g.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),W0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");M.push(`<script${W0}>${d}</script>`)}}let E=H.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k=E?E[1]:"",y=E?E[2]:"",S="",b=k&&/\bscoped\b/i.test(k);if(E)S=`<style${k}>${y}</style>`;let D=R;if(D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E)D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(J&&D.includes("{{ text || slot }}"))D=D.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{extractSlotContent:x,applySlots:h}=await Promise.resolve().then(() => (Z3(),$3)),{defaultSlot:l,namedSlots:U0}=x(J);D=await h(D,l||J,U0,w);for(let[P,v]of Object.entries(w))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let g=m9(v);w[P]=g}}let M0=M.some((P)=>/\b(state|derived|effect)\s*\(/.test(P)),_0={...G,componentsDir:n.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:M0,defaultLayout:void 0};w.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let S0=await r0(D,w,O,_0,q),v0=`stx_${B.replace(/[^a-zA-Z0-9]/g,"_")}_${++wJ}_${Math.random().toString(36).slice(2,8)}`,L0=S0;if(M0){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${NJ(JSON.stringify(Z))}"`}catch{}if(L0=`<div data-stx-scope="${v0}"${P}>${S0}</div>`,L0=M.map((g)=>{let c=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!c)return g;let[,f,d]=c,W0=n0(d),a=`
769
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}q.add(O);let H;if(o9.has(O))H=o9.get(O);else try{H=await Bun.file(O).text(),o9.set(O,H)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let V=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[P,v]of Object.entries(Q))if(!P.startsWith("__")||V.has(P))A[P]=v;let w={...A,...Z,props:Z,slot:J,__processedComponents:z,__sections:{}},R=H,N=R.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(N)R=N[1].trim();let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...H.matchAll(T)],M=[];for(let P of I){let v=P[1]||"",g=P[2]||"",c=v.includes("server");if(G1(v)&&g.trim())g=K1(g);if(c&&g)try{await _(g,w,O)}catch(d){}if(!c){let d=g.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),W0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");M.push(`<script${W0}>${d}</script>`)}}let E=H.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k=E?E[1]:"",y=E?E[2]:"",S="",b=k&&/\bscoped\b/i.test(k);if(E)S=`<style${k}>${y}</style>`;let D=R;if(D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E)D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(J&&D.includes("{{ text || slot }}"))D=D.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{extractSlotContent:x,applySlots:h}=await Promise.resolve().then(() => (Z3(),$3)),{defaultSlot:l,namedSlots:U0}=x(J);D=await h(D,l||J,U0,w);for(let[P,v]of Object.entries(w))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let g=m9(v);w[P]=g}}let M0=M.some((P)=>/\b(state|derived|effect)\s*\(/.test(P)),_0={...G,componentsDir:n.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:M0,defaultLayout:void 0};w.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let S0=await a0(D,w,O,_0,q),v0=`stx_${B.replace(/[^a-zA-Z0-9]/g,"_")}_${++NJ}_${Math.random().toString(36).slice(2,8)}`,L0=S0;if(M0){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${TJ(JSON.stringify(Z))}"`}catch{}if(L0=`<div data-stx-scope="${v0}"${P}>${S0}</div>`,L0=M.map((g)=>{let c=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!c)return g;let[,f,d]=c,W0=n0(d),a=`
769
770
  (function() {
770
771
  const { state, derived, effect, batch } = window.stx;
771
772
  const __scope = window.stx._scopes = window.stx._scopes || {};
@@ -782,7 +783,7 @@ ${W0}
782
783
  // Register all defined signals and functions in this scope
783
784
  const __localVars = {};
784
785
  try {
785
- ${AJ(W0).map((Y0)=>`if (typeof ${Y0} !== 'undefined') __localVars['${Y0}'] = ${Y0};`).join(`
786
+ ${IJ(W0).map((Y0)=>`if (typeof ${Y0} !== 'undefined') __localVars['${Y0}'] = ${Y0};`).join(`
786
787
  `)}
787
788
  }
788
789
  catch (e) {}
@@ -793,7 +794,7 @@ catch (e) {}
793
794
  `+S}else{if(S)L0+=`
794
795
  `+S;if(M.length>0){let P=w.__stx_event_bindings||[],v=await Promise.all(M.map(async(g)=>{let c=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!c)return g;return await L5(c[1],{eventBindings:P,templateContent:L0,filePath:O,projectRoot:process.cwd()})}));L0+=`
795
796
  `+v.join(`
796
- `),w.__stx_event_bindings=[]}}if(b){let P=N5(L0,O);if(P.hasScoped)L0=P.html}return L0}catch(U){return`[Error processing component: ${U instanceof Error?U.message:String(U)}]`}finally{W.delete($)}}async function i($){return Bun.file($).exists()}function Y3($,Z){let J=n.resolve(Z),Y=n.resolve($),Q=J.endsWith(n.sep)?J:J+n.sep;if(Y===J||Y.startsWith(Q))return Y;return null}async function s9($,Z,J,Y){let Q=await TJ($,Z,J,Y);if(Q===null)return null;let X=Y3(Q,process.cwd());if(!X)return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null;return X}async function TJ($,Z,J,Y){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=n.dirname(Z),X=process.cwd();if($.startsWith("/")){let U=n.join(X,$),j=Y3(U,X);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(J.debug)console.log(`Checking absolute path: ${j}`);if(await i(j)&&Y)Y.add(j);return j}let G=n.join(Q,$);if(await i(G)){if(J.debug)console.log(`Found direct path: ${G}`);if(Y)Y.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let U of[".stx",".tsx",".jsx"]){let j=`${G}${U}`;if(await i(j)){if(J.debug)console.log(`Found direct path with extension: ${j}`);if(Y)Y.add(j);return j}}let K="",q=n.resolve(Q),_=process.cwd();for(let U=0;U<10;U++){let j=n.join(q,"layouts"),B=!1;try{B=VJ.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=j;break}let O=n.dirname(q);if(O===q||O.length<_.length)break;q=O}if(K){let U=$.startsWith("layouts/")?$.slice(8):$,j=n.join(K,U);if(await i(j)){if(J.debug)console.log(`Found in current layouts dir: ${j}`);if(Y)Y.add(j);return j}if(!U.endsWith(".stx")){let B=`${j}.stx`;if(await i(B)){if(J.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(J.layoutsDir){let U=n.isAbsolute(J.layoutsDir)?J.layoutsDir:n.resolve(process.cwd(),J.layoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=n.join(U,j);if(await i(B)){if(J.debug)console.log(`Found in options.layoutsDir: ${B}`);if(Y)Y.add(B);return B}if(!$.endsWith(".stx")){let O=`${B}.stx`;if(await i(O)){if(J.debug)console.log(`Found in options.layoutsDir with extension: ${O}`);if(Y)Y.add(O);return O}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let U=$.split("layouts/"),j=n.join(J.partialsDir||Q,"layouts",U[1]);if(await i(j)){if(J.debug)console.log(`Found in layouts path: ${j}`);if(Y)Y.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await i(B)){if(J.debug)console.log(`Found in layouts path with extension: ${B}`);if(Y)Y.add(B);return B}}}if(J.partialsDir){if(K=n.join(J.partialsDir,"layouts"),await i(K)){let U=n.join(K,$);if(await i(U)){if(J.debug)console.log(`Found in partials layouts dir: ${U}`);if(Y)Y.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await i(j)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}}let W=J.partialsDir||n.join(process.cwd(),"views"),z=n.join(W,$);if(await i(z)){if(J.debug)console.log(`Found in views path: ${z}`);if(Y)Y.add(z);return z}if(!$.endsWith(".stx")){let U=`${z}.stx`;if(await i(U)){if(J.debug)console.log(`Found in views path with extension: ${U}`);if(Y)Y.add(U);return U}}if(Q.includes("temp")){let U=n.join(n.dirname(Q),"layouts",$);if(await i(U)){if(J.debug)console.log(`Found in temp layouts dir: ${U}`);if(Y)Y.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await i(j)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(J.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function J3($,Z,J){let Y=0,Q="",X="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
797
+ `),w.__stx_event_bindings=[]}}if(b){let P=A5(L0,O);if(P.hasScoped)L0=P.html}return L0}catch(U){return`[Error processing component: ${U instanceof Error?U.message:String(U)}]`}finally{W.delete($)}}async function i($){return Bun.file($).exists()}function Y3($,Z){let J=n.resolve(Z),Y=n.resolve($),Q=J.endsWith(n.sep)?J:J+n.sep;if(Y===J||Y.startsWith(Q))return Y;return null}async function s9($,Z,J,Y){let Q=await DJ($,Z,J,Y);if(Q===null)return null;let X=Y3(Q,process.cwd());if(!X)return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null;return X}async function DJ($,Z,J,Y){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=n.dirname(Z),X=process.cwd();if($.startsWith("/")){let U=n.join(X,$),j=Y3(U,X);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(J.debug)console.log(`Checking absolute path: ${j}`);if(await i(j)&&Y)Y.add(j);return j}let G=n.join(Q,$);if(await i(G)){if(J.debug)console.log(`Found direct path: ${G}`);if(Y)Y.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let U of[".stx",".tsx",".jsx"]){let j=`${G}${U}`;if(await i(j)){if(J.debug)console.log(`Found direct path with extension: ${j}`);if(Y)Y.add(j);return j}}let K="",q=n.resolve(Q),_=process.cwd();for(let U=0;U<10;U++){let j=n.join(q,"layouts"),B=!1;try{B=RJ.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=j;break}let O=n.dirname(q);if(O===q||O.length<_.length)break;q=O}if(K){let U=$.startsWith("layouts/")?$.slice(8):$,j=n.join(K,U);if(await i(j)){if(J.debug)console.log(`Found in current layouts dir: ${j}`);if(Y)Y.add(j);return j}if(!U.endsWith(".stx")){let B=`${j}.stx`;if(await i(B)){if(J.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(J.layoutsDir){let U=n.isAbsolute(J.layoutsDir)?J.layoutsDir:n.resolve(process.cwd(),J.layoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=n.join(U,j);if(await i(B)){if(J.debug)console.log(`Found in options.layoutsDir: ${B}`);if(Y)Y.add(B);return B}if(!$.endsWith(".stx")){let O=`${B}.stx`;if(await i(O)){if(J.debug)console.log(`Found in options.layoutsDir with extension: ${O}`);if(Y)Y.add(O);return O}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let U=$.split("layouts/"),j=n.join(J.partialsDir||Q,"layouts",U[1]);if(await i(j)){if(J.debug)console.log(`Found in layouts path: ${j}`);if(Y)Y.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await i(B)){if(J.debug)console.log(`Found in layouts path with extension: ${B}`);if(Y)Y.add(B);return B}}}if(J.partialsDir){if(K=n.join(J.partialsDir,"layouts"),await i(K)){let U=n.join(K,$);if(await i(U)){if(J.debug)console.log(`Found in partials layouts dir: ${U}`);if(Y)Y.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await i(j)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}}let W=J.partialsDir||n.join(process.cwd(),"views"),z=n.join(W,$);if(await i(z)){if(J.debug)console.log(`Found in views path: ${z}`);if(Y)Y.add(z);return z}if(!$.endsWith(".stx")){let U=`${z}.stx`;if(await i(U)){if(J.debug)console.log(`Found in views path with extension: ${U}`);if(Y)Y.add(U);return U}}if(Q.includes("temp")){let U=n.join(n.dirname(Q),"layouts",$);if(await i(U)){if(J.debug)console.log(`Found in temp layouts dir: ${U}`);if(Y)Y.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await i(j)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(J.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function J3($,Z,J){let Y=0,Q="",X="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
797
798
  `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){Y=q+1,Q=G[q].trim();let _=Math.max(0,q-2),W=Math.min(G.length,q+3);X=G.slice(_,W).map((z,U)=>{let j=_+U+1;return`${j===Y?"> ":" "}${j}: ${z}`}).join(`
798
799
  `);break}}else if(J){let G=$.indexOf(J);if(G>=0)return J3($,G)}}catch{}return{lineNumber:Y,lineContent:Q,context:X}}function Q0($,Z,J,Y,Q,X){let{lineNumber:G,context:K}=J3(Y,Q,X),q=J.split("/").pop(),_=0;if(typeof Q==="number"&&Q>=0&&Y){let z=Y.lastIndexOf(`
799
800
  `,Math.max(0,Q-1));_=Q-(z+1)+1}let W="";if(G>0)W+=`
@@ -808,8 +809,8 @@ ${o.yellow}${o.bold}Message:${o.reset} ${Z}
808
809
  `,K)W+=`
809
810
  ${o.blue}${o.bold}Context:${o.reset}
810
811
  ${o.dim}${K}${o.reset}
811
- `;return W}var o9,wJ=0,o;var F0=C(()=>{h9();o0();M1();r9();R1();l9();h7();t1();o9=new o1(500);o={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 X3($,Z,J=""){let Y=$,Q=[],X=/@markdown(?:\([^)]*\))?/g,G;while((G=X.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),_=q?q[1]:"",W=K+G[0].length,z=1,U=W,j=-1;while(z>0&&U<$.length){let F=$.indexOf("@markdown",U),L=$.indexOf("@endmarkdown",U);if(L===-1)break;if(F!==-1&&F<L&&F!==K){let H=$[F+9];if(H==="("||H===`
812
- `||H==="\r"||H===" "||H===void 0)z++;U=F+9}else{if(z--,z===0){j=L;break}U=L+12}}if(j===-1)continue;let B=$.slice(W,j),O=$.slice(K,j+12);Q.push({fullMatch:O,options:_,content:B,index:K}),X.lastIndex=j+12}for(let{fullMatch:K,options:q,content:_,index:W}of Q)try{let z={};if(q)q.split(",").forEach((B)=>{let O=B.trim();if(O)z[O]=!0});let U={gfm:z.gfm??!0,breaks:z.breaks??!1},j=l1(_.trim(),U);Y=Y.split(K).join(j)}catch(z){let U=z instanceof Error?z.message:String(z),j=Q0("Markdown Directive",`Error processing markdown: ${U}`,J,$,W,K);Y=Y.split(K).join(j)}return Y}async function Q3($,Z,J,Y){let Q={gfm:!0,breaks:!1};return Z.forEach((X)=>{let G=X.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),l1($.trim(),Q)}var a9=C(()=>{F0()});function DJ($){if(MJ.set($.name,$),$.client)IJ.set($.name,$.client)}function M5($){return DJ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(J,Y,Q,X)=>{let G=EJ(Y,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let _=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(_)}}let K=J;if($.transform)K=await $.transform(J,G,Q,X);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function EJ($,Z){let J={...Z};for(let Y of $){let Q=Y.indexOf(":"),X=Y.indexOf("="),G=Q>=0&&(X<0||Q<X)?Q:X;if(G>=0){let K=Y.slice(0,G).trim(),q=Y.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}J[K]=q}else{let K=Object.keys(J).filter((q)=>!Z||!(q in Z)).length;J[K===0?"value":`arg${K}`]=Y}}return J}var MJ,IJ;var t9=C(()=>{MJ=new Map,IJ=new Map});function e9($,Z=I1,J={},Y){return Z.sort((Q,X)=>Q-X).map((Q)=>{return`${$5($,{...J,w:Q,fm:Y})} ${Q}w`}).join(", ")}function G3($,Z,J=kJ,Y={},Q){return J.sort((X,G)=>X-G).map((X)=>{let G=Math.round(Z*X);return`${$5($,{...Y,w:G,dpr:X,fm:Q})} ${X}x`}).join(", ")}function $$($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let Y=Object.entries($).map(([Q,X])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:X,numericBp:Number.parseInt(G)||0}}).sort((Q,X)=>Q.numericBp-X.numericBp).map(({bp:Q,size:X})=>`(max-width: ${Q}) ${X}`);return Y.push(Z),Y.join(", ")}function $5($,Z={}){let J=Object.entries(Z).filter(([,X])=>X!==void 0&&X!==null).map(([X,G])=>{if(Array.isArray(G))return[X,G.join(",")];return[X,String(G)]});if(J.length===0)return $;let Y=J.map(([X,G])=>`${X}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${Y}`}function Z$($){return bJ[$]||"application/octet-stream"}var I1,kJ,e1,bJ;var Y$=C(()=>{I1=[320,480,640,768,1024,1280,1536,1920,2560],kJ=[1,1.5,2,3],e1=["avif","webp","jpeg"],bJ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function yJ(){try{return await import("ts-images")}catch{return null}}async function CJ($,Z={}){let J={...SJ,...Z},Y=await yJ();if(Y)try{return await PJ($,J,Y)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return vJ($,J)}async function PJ($,Z,J){let{generatePlaceholder:Y,generateThumbHash:Q}=J,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await Y($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function vJ($,Z){let J=Z.width||20,Y=Z.height||J,Q="#e5e7eb",X=`<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${Y}" viewBox="0 0 ${J} ${Y}"><rect fill="#e5e7eb" width="${J}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`,width:J,height:Y,aspectRatio:J/Y,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function K3($,Z,J={}){let Y=J.transitionDuration||300,Q=J.easing||"ease-out";return`
812
+ `;return W}var o9,NJ=0,o;var F0=C(()=>{h9();s0();I1();r9();N1();l9();h7();t1();o9=new s1(500);o={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 X3($,Z,J=""){let Y=$,Q=[],X=/@markdown(?:\([^)]*\))?/g,G;while((G=X.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),_=q?q[1]:"",W=K+G[0].length,z=1,U=W,j=-1;while(z>0&&U<$.length){let F=$.indexOf("@markdown",U),L=$.indexOf("@endmarkdown",U);if(L===-1)break;if(F!==-1&&F<L&&F!==K){let H=$[F+9];if(H==="("||H===`
813
+ `||H==="\r"||H===" "||H===void 0)z++;U=F+9}else{if(z--,z===0){j=L;break}U=L+12}}if(j===-1)continue;let B=$.slice(W,j),O=$.slice(K,j+12);Q.push({fullMatch:O,options:_,content:B,index:K}),X.lastIndex=j+12}for(let{fullMatch:K,options:q,content:_,index:W}of Q)try{let z={};if(q)q.split(",").forEach((B)=>{let O=B.trim();if(O)z[O]=!0});let U={gfm:z.gfm??!0,breaks:z.breaks??!1},j=c1(_.trim(),U);Y=Y.split(K).join(j)}catch(z){let U=z instanceof Error?z.message:String(z),j=Q0("Markdown Directive",`Error processing markdown: ${U}`,J,$,W,K);Y=Y.split(K).join(j)}return Y}async function Q3($,Z,J,Y){let Q={gfm:!0,breaks:!1};return Z.forEach((X)=>{let G=X.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),c1($.trim(),Q)}var a9=C(()=>{F0()});function bJ($){if(EJ.set($.name,$),$.client)kJ.set($.name,$.client)}function M5($){return bJ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(J,Y,Q,X)=>{let G=SJ(Y,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let _=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(_)}}let K=J;if($.transform)K=await $.transform(J,G,Q,X);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function SJ($,Z){let J={...Z};for(let Y of $){let Q=Y.indexOf(":"),X=Y.indexOf("="),G=Q>=0&&(X<0||Q<X)?Q:X;if(G>=0){let K=Y.slice(0,G).trim(),q=Y.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}J[K]=q}else{let K=Object.keys(J).filter((q)=>!Z||!(q in Z)).length;J[K===0?"value":`arg${K}`]=Y}}return J}var EJ,kJ;var t9=C(()=>{EJ=new Map,kJ=new Map});function e9($,Z=E1,J={},Y){return Z.sort((Q,X)=>Q-X).map((Q)=>{return`${$5($,{...J,w:Q,fm:Y})} ${Q}w`}).join(", ")}function G3($,Z,J=yJ,Y={},Q){return J.sort((X,G)=>X-G).map((X)=>{let G=Math.round(Z*X);return`${$5($,{...Y,w:G,dpr:X,fm:Q})} ${X}x`}).join(", ")}function $$($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let Y=Object.entries($).map(([Q,X])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:X,numericBp:Number.parseInt(G)||0}}).sort((Q,X)=>Q.numericBp-X.numericBp).map(({bp:Q,size:X})=>`(max-width: ${Q}) ${X}`);return Y.push(Z),Y.join(", ")}function $5($,Z={}){let J=Object.entries(Z).filter(([,X])=>X!==void 0&&X!==null).map(([X,G])=>{if(Array.isArray(G))return[X,G.join(",")];return[X,String(G)]});if(J.length===0)return $;let Y=J.map(([X,G])=>`${X}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${Y}`}function Z$($){return CJ[$]||"application/octet-stream"}var E1,yJ,e1,CJ;var Y$=C(()=>{E1=[320,480,640,768,1024,1280,1536,1920,2560],yJ=[1,1.5,2,3],e1=["avif","webp","jpeg"],CJ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function vJ(){try{return await import("ts-images")}catch{return null}}async function xJ($,Z={}){let J={...PJ,...Z},Y=await vJ();if(Y)try{return await fJ($,J,Y)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return gJ($,J)}async function fJ($,Z,J){let{generatePlaceholder:Y,generateThumbHash:Q}=J,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await Y($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function gJ($,Z){let J=Z.width||20,Y=Z.height||J,Q="#e5e7eb",X=`<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${Y}" viewBox="0 0 ${J} ${Y}"><rect fill="#e5e7eb" width="${J}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`,width:J,height:Y,aspectRatio:J/Y,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function K3($,Z,J={}){let Y=J.transitionDuration||300,Q=J.easing||"ease-out";return`
813
814
  #${$} {
814
815
  --stx-img-transition-duration: ${Y}ms;
815
816
  --stx-img-transition-easing: ${Q};
@@ -826,7 +827,7 @@ ${o.dim}${K}${o.reset}
826
827
  #${$}.stx-img-loaded img {
827
828
  opacity: 1;
828
829
  }
829
- `.trim()}async function q3($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(J$.has(J))return J$.get(J);let Y=await CJ($,Z);return J$.set(J,Y),Y}var SJ,X$,J$;var W3=C(()=>{SJ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},X$=`
830
+ `.trim()}async function q3($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(J$.has(J))return J$.get(J);let Y=await xJ($,Z);return J$.set(J,Y),Y}var PJ,X$,J$;var W3=C(()=>{PJ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},X$=`
830
831
  .stx-img-placeholder {
831
832
  position: relative;
832
833
  overflow: hidden;
@@ -855,8 +856,8 @@ ${o.dim}${K}${o.reset}
855
856
  filter: blur(0);
856
857
  transform: scale(1);
857
858
  }
858
- `.trim();J$=new Map});import{createHash as z3}from"crypto";import{readFile as xJ,stat as U3}from"fs/promises";async function R0($){try{let Z=await xJ($);return z3("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function _3($){return z3("sha256").update($).digest("hex").slice(0,16)}function I5($,Z){let J=JSON.stringify(Z,Object.keys(Z).sort());return`${_3($)}-${_3(J)}`}async function Q$($){try{return(await U3($)).mtimeMs}catch{return 0}}async function V0($){try{return await U3($),!0}catch{return!1}}var U1=()=>{};import{mkdir as fJ,readFile as gJ,writeFile as hJ,readdir as f_,rm as dJ,stat as g_}from"fs/promises";import{join as j3,dirname as mJ}from"path";async function uJ($){try{await fJ($,{recursive:!0})}catch{}}function O3($,Z,J){return j3($,J,`${Z}.json`)}async function B3($,Z,J){if((Date.now()-$.createdAt)/86400000>J)return!1;if(await Q$(Z)!==$.srcMtime)return!1;return!0}async function D5($,Z,J,Y=G$){if(!Y.enabled)return null;let Q=I5($,Z),X=D1.get(Q);if(X){if(await B3(X,$,Y.maxAge))return X.lastAccessedAt=Date.now(),X.data;D1.delete(Q)}let G=O3(Y.directory,Q,J);if(await V0(G))try{let K=await gJ(G,"utf-8"),q=JSON.parse(K);if(await B3(q,$,Y.maxAge))return q.lastAccessedAt=Date.now(),D1.set(Q,q),q.data}catch{}return null}async function E5($,Z,J,Y,Q=G$){if(!Q.enabled)return;let X=I5($,Z),G=await R0($),K=await Q$($),q={key:X,src:$,srcHash:G,srcMtime:K,optionsHash:I5("",Z),data:J,createdAt:Date.now(),lastAccessedAt:Date.now()};D1.set(X,q);let _=O3(Q.directory,X,Y);try{await uJ(mJ(_)),await hJ(_,JSON.stringify(q,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function k5($,Z=G$){if($==="all")D1.clear();else D1.clear();let J=$==="all"?["image","video"]:[$];for(let Y of J){let Q=j3(Z.directory,Y);try{await dJ(Q,{recursive:!0,force:!0})}catch{}}}var D1,G$;var K$=C(()=>{U1();D1=new Map,G$={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class S5{config;constructor($={}){this.config={...pJ,...$}}async get($,Z){return D5($,Z,"image",this.config)}async set($,Z,J){return E5($,Z,J,"image",this.config)}async clear(){return k5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function q$($){if(!b5)b5=new S5($);else if($)b5.updateConfig($);return b5}async function y5($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return q$(Y).get($,Z)}async function C5($,Z,J,Y){let Q=Y?{directory:`${Y.outputDir}/../.cache`}:{};return q$(Q).set($,Z,J)}async function H3(){return q$().clear()}var pJ,b5=null;var W$=C(()=>{K$();pJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as lJ,basename as cJ,extname as iJ,join as nJ}from"path";import{mkdir as oJ}from"fs/promises";async function _$(){try{return await import("ts-images")}catch{return null}}function L3($){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 sJ($,Z){let J=Z?L3(Z):L3("web"),Y=$.formatQuality||{};return{jpeg:{...J.jpeg,...Y.jpeg},png:{...J.png,...Y.png},webp:{...J.webp,...Y.webp},avif:{...J.avif,...Y.avif}}}async function F3($,Z,J){let Y=await _$();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await y5($,Z,J);if(Q)return Q;try{let X=lJ($);if(!await V0(X))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=sJ(J,Z.preset),K=J.outputDir||"dist/images",q=J.baseUrl||"/images";await oJ(K,{recursive:!0});let _=await R0(X),W=cJ($,iJ($)),z=Z.outputFormat?[Z.outputFormat]:J.defaultFormats||["avif","webp","jpeg"],U={src:$,processed:!0,variants:[],hash:_},j=null;if(Z.transformations&&Z.transformations.length>0)j=await z$(X,Z.transformations,Y);for(let B of z){let O=G[B]||{},F=`${W}-${_}.${B}`,L=nJ(K,F);try{let H=await Y.optimizeImage({input:j||X,output:L,format:B,quality:O.quality,progressive:O.progressive});if(H){if(U.variants.push({path:L,url:`${q}/${F}`,width:H.width||0,height:H.height||0,format:B,size:H.outputSize||0}),!U.originalWidth&&H.width)U.originalWidth=H.width,U.originalHeight=H.height}}catch(H){U.errors=U.errors||[],U.errors.push(`Failed to optimize ${B}: ${H}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await Y.generateThumbHash(X);U.placeholder=B.dataUrl}catch(B){U.errors=U.errors||[],U.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await Y.generatePlaceholder(X,{strategy:"dominant-color"});U.dominantColor=B.dominantColor}catch(B){U.errors=U.errors||[],U.errors.push(`Failed to extract dominant color: ${B}`)}return await C5($,Z,U,J),U}catch(X){return{src:$,processed:!1,errors:[`Processing failed: ${X}`]}}}async function V3($,Z,J,Y){let Q=await _$();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:Y,format:Z,quality:J}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function z$($,Z,J){let Y=J||await _$();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await Y.decode($);for(let X of Z){let G=X.options||{};switch(X.type){case"resize":if(G.width||G.height)Q=await Y.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await Y.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await Y.sharpen(Q,G.amount);break;case"grayscale":Q=await Y.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await Y.rotate(Q,G.angle);break;case"flip":Q=await Y.flip(Q);break;case"flop":Q=await Y.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await Y.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await Y.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await Y.saturation(Q,G.value);break}}return await Y.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var w3=C(()=>{U1();W$()});import{resolve as rJ,basename as aJ,extname as tJ,join as eJ}from"path";import{mkdir as $X}from"fs/promises";async function ZX(){try{return await import("ts-images")}catch{return null}}async function N3($,Z,J){let Y=await ZX();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=rJ($);if(!await V0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let X=Z.responsiveWidths||J.breakpoints||YX,G=Z.formats||J.defaultFormats||["avif","webp","jpeg"],K=J.outputDir||"dist/images",q=J.baseUrl||"/images";await $X(K,{recursive:!0});let _=await R0(Q),W=aJ($,tJ($)),z=J.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},U={src:$,byFormat:{},srcsets:{}};for(let B of G){U.byFormat[B]=[];let O=[];for(let F of X){let L=`${W}-${F}w-${_}.${B}`,H=eJ(K,L),V=`${q}/${L}`;try{let N=z[B]?.quality||80;if(await V0(H)){U.byFormat[B].push({path:H,url:V,width:F,height:0,format:B,size:0}),O.push(`${V} ${F}w`);continue}let w=await Y.processImage({input:Q,output:H,format:B,quality:N,resize:{width:F}});if(w)U.byFormat[B].push({path:H,url:V,width:F,height:w.height||Math.round(F*(w.height||1)/(w.width||1)),format:B,size:w.outputSize||0}),O.push(`${V} ${F}w`)}catch(N){console.warn(`[stx-media] Failed to generate ${B} at ${F}w: ${N}`)}}U.srcsets[B]=O.join(", ")}let j=Z.placeholder||J.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let B=await Y.generateThumbHash(Q);U.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await Y.generatePlaceholder(Q,{strategy:j,width:20});U.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:j}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return U.sizes=Z.sizes||JX(X),U}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function JX($){let Z=[...$].sort((Y,Q)=>Y-Q),J=[];for(let Y=0;Y<Z.length-1;Y++){let Q=Z[Y];J.push(`(max-width: ${Q}px) ${Q}px`)}return J.push(`${Z[Z.length-1]}px`),J.join(", ")}function R3($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((J)=>J.dpr).map((J)=>`${J.url} ${J.dpr}x`).join(", ");return $.map((J)=>`${J.url} ${J.width}w`).join(", ")}var YX;var A3=C(()=>{U1();YX=[320,480,640,768,1024,1280,1536,1920]});var T3={};r(T3,{setCachedImageResult:()=>C5,processImage:()=>F3,optimizeImage:()=>V3,getCachedImageResult:()=>y5,generateSrcset:()=>R3,generateResponsiveVariants:()=>N3,clearImageCache:()=>H3,applyTransformations:()=>z$,ImageProcessorCache:()=>S5});var M3=C(()=>{w3();A3();W$()});async function XX(){try{return await Promise.resolve().then(() => (M3(),T3))}catch($){if(!I3)console.warn("[stx-media] Image processor not available, some features disabled:",$),I3=!0;return null}}async function P5($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return qX(Y,J)}if(J.processedResult?.processed)return O$($,J.processedResult,Z);if(J.responsiveVariants)return b3($,J.responsiveVariants,Z);let{src:Q,alt:X,width:G,height:K,sizes:q,widths:_=I1,dpr:W,formats:z=e1,quality:U=U$,params:j={},placeholder:B="none",placeholderOptions:O={},lazy:F=!0,priority:L=!1,loading:H=L?"eager":x5,decoding:V=v5,fetchpriority:N,objectFit:w,objectPosition:R,crossorigin:A,referrerpolicy:T}=$,I=$.class,M=$.style,E=$.id,k=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return KX($);let b,D,x=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!L)try{b=await q3(Q,{strategy:B,...O}),D=K3(x,b,O)}catch{}let h=W!==void 0&&G!==void 0,l;if(h)l=GX($,x,b,Z);else l=await QX($,x,b,Z);let U0;if(L){let S0=z.includes("webp")?"webp":z[0],v0=e9(Q,_,{...j,q:U},S0),L0=typeof q==="object"?$$(q):q||"100vw";U0=`<link rel="preload" as="image" imagesrcset="${v0}" imagesizes="${L0}" />`}let M0=[];if(!D3&&B!=="none")M0.push(X$),D3=!0;if(D)M0.push(D);let _0=F?k3(x):void 0;return{html:l,preloadLink:U0,css:M0.length>0?M0.join(`
859
- `):void 0,script:_0}}async function QX($,Z,J,Y){let{src:Q,alt:X,width:G,height:K,sizes:q,widths:_=I1,formats:W=e1,quality:z=U$,params:U={},lazy:j=!0,priority:B=!1,loading:O=B?"eager":x5,decoding:F=v5,fetchpriority:L,objectFit:H,objectPosition:V,crossorigin:N,referrerpolicy:w}=$,R=$.class,A=$.style,T=$.data||{},I=typeof q==="object"?$$(q):q||"100vw",M=[];for(let y of W){let S=e9(Q,_,{...U,q:z},y),b=Z$(y);if(j&&!B)M.push(` <source type="${b}" data-srcset="${S}" data-sizes="${I}" />`);else M.push(` <source type="${b}" srcset="${S}" sizes="${I}" />`)}let E=B$({src:$5(Q,{...U,q:z}),alt:X,width:G,height:K,loading:B?void 0:O,decoding:F,fetchpriority:B?"high":L,objectFit:H,objectPosition:V,crossorigin:N,referrerpolicy:w,className:E3(R,J),style:j$(A,H,V,J),lazy:j&&!B,data:T}),k;if(J){let y=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;k=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
859
+ `.trim();J$=new Map});import{createHash as z3}from"crypto";import{readFile as hJ,stat as U3}from"fs/promises";async function R0($){try{let Z=await hJ($);return z3("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function _3($){return z3("sha256").update($).digest("hex").slice(0,16)}function I5($,Z){let J=JSON.stringify(Z,Object.keys(Z).sort());return`${_3($)}-${_3(J)}`}async function Q$($){try{return(await U3($)).mtimeMs}catch{return 0}}async function V0($){try{return await U3($),!0}catch{return!1}}var U1=()=>{};import{mkdir as dJ,readFile as mJ,writeFile as uJ,readdir as m_,rm as pJ,stat as u_}from"fs/promises";import{join as j3,dirname as lJ}from"path";async function cJ($){try{await dJ($,{recursive:!0})}catch{}}function O3($,Z,J){return j3($,J,`${Z}.json`)}async function B3($,Z,J){if((Date.now()-$.createdAt)/86400000>J)return!1;if(await Q$(Z)!==$.srcMtime)return!1;return!0}async function D5($,Z,J,Y=G$){if(!Y.enabled)return null;let Q=I5($,Z),X=k1.get(Q);if(X){if(await B3(X,$,Y.maxAge))return X.lastAccessedAt=Date.now(),X.data;k1.delete(Q)}let G=O3(Y.directory,Q,J);if(await V0(G))try{let K=await mJ(G,"utf-8"),q=JSON.parse(K);if(await B3(q,$,Y.maxAge))return q.lastAccessedAt=Date.now(),k1.set(Q,q),q.data}catch{}return null}async function E5($,Z,J,Y,Q=G$){if(!Q.enabled)return;let X=I5($,Z),G=await R0($),K=await Q$($),q={key:X,src:$,srcHash:G,srcMtime:K,optionsHash:I5("",Z),data:J,createdAt:Date.now(),lastAccessedAt:Date.now()};k1.set(X,q);let _=O3(Q.directory,X,Y);try{await cJ(lJ(_)),await uJ(_,JSON.stringify(q,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function k5($,Z=G$){if($==="all")k1.clear();else k1.clear();let J=$==="all"?["image","video"]:[$];for(let Y of J){let Q=j3(Z.directory,Y);try{await pJ(Q,{recursive:!0,force:!0})}catch{}}}var k1,G$;var K$=C(()=>{U1();k1=new Map,G$={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class S5{config;constructor($={}){this.config={...iJ,...$}}async get($,Z){return D5($,Z,"image",this.config)}async set($,Z,J){return E5($,Z,J,"image",this.config)}async clear(){return k5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function q$($){if(!b5)b5=new S5($);else if($)b5.updateConfig($);return b5}async function y5($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return q$(Y).get($,Z)}async function C5($,Z,J,Y){let Q=Y?{directory:`${Y.outputDir}/../.cache`}:{};return q$(Q).set($,Z,J)}async function H3(){return q$().clear()}var iJ,b5=null;var W$=C(()=>{K$();iJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as nJ,basename as oJ,extname as sJ,join as rJ}from"path";import{mkdir as aJ}from"fs/promises";async function _$(){try{return await import("ts-images")}catch{return null}}function L3($){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 tJ($,Z){let J=Z?L3(Z):L3("web"),Y=$.formatQuality||{};return{jpeg:{...J.jpeg,...Y.jpeg},png:{...J.png,...Y.png},webp:{...J.webp,...Y.webp},avif:{...J.avif,...Y.avif}}}async function F3($,Z,J){let Y=await _$();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await y5($,Z,J);if(Q)return Q;try{let X=nJ($);if(!await V0(X))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=tJ(J,Z.preset),K=J.outputDir||"dist/images",q=J.baseUrl||"/images";await aJ(K,{recursive:!0});let _=await R0(X),W=oJ($,sJ($)),z=Z.outputFormat?[Z.outputFormat]:J.defaultFormats||["avif","webp","jpeg"],U={src:$,processed:!0,variants:[],hash:_},j=null;if(Z.transformations&&Z.transformations.length>0)j=await z$(X,Z.transformations,Y);for(let B of z){let O=G[B]||{},F=`${W}-${_}.${B}`,L=rJ(K,F);try{let H=await Y.optimizeImage({input:j||X,output:L,format:B,quality:O.quality,progressive:O.progressive});if(H){if(U.variants.push({path:L,url:`${q}/${F}`,width:H.width||0,height:H.height||0,format:B,size:H.outputSize||0}),!U.originalWidth&&H.width)U.originalWidth=H.width,U.originalHeight=H.height}}catch(H){U.errors=U.errors||[],U.errors.push(`Failed to optimize ${B}: ${H}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await Y.generateThumbHash(X);U.placeholder=B.dataUrl}catch(B){U.errors=U.errors||[],U.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await Y.generatePlaceholder(X,{strategy:"dominant-color"});U.dominantColor=B.dominantColor}catch(B){U.errors=U.errors||[],U.errors.push(`Failed to extract dominant color: ${B}`)}return await C5($,Z,U,J),U}catch(X){return{src:$,processed:!1,errors:[`Processing failed: ${X}`]}}}async function V3($,Z,J,Y){let Q=await _$();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:Y,format:Z,quality:J}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function z$($,Z,J){let Y=J||await _$();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await Y.decode($);for(let X of Z){let G=X.options||{};switch(X.type){case"resize":if(G.width||G.height)Q=await Y.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await Y.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await Y.sharpen(Q,G.amount);break;case"grayscale":Q=await Y.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await Y.rotate(Q,G.angle);break;case"flip":Q=await Y.flip(Q);break;case"flop":Q=await Y.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await Y.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await Y.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await Y.saturation(Q,G.value);break}}return await Y.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var w3=C(()=>{U1();W$()});import{resolve as eJ,basename as $X,extname as ZX,join as YX}from"path";import{mkdir as JX}from"fs/promises";async function XX(){try{return await import("ts-images")}catch{return null}}async function A3($,Z,J){let Y=await XX();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=eJ($);if(!await V0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let X=Z.responsiveWidths||J.breakpoints||QX,G=Z.formats||J.defaultFormats||["avif","webp","jpeg"],K=J.outputDir||"dist/images",q=J.baseUrl||"/images";await JX(K,{recursive:!0});let _=await R0(Q),W=$X($,ZX($)),z=J.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},U={src:$,byFormat:{},srcsets:{}};for(let B of G){U.byFormat[B]=[];let O=[];for(let F of X){let L=`${W}-${F}w-${_}.${B}`,H=YX(K,L),V=`${q}/${L}`;try{let A=z[B]?.quality||80;if(await V0(H)){U.byFormat[B].push({path:H,url:V,width:F,height:0,format:B,size:0}),O.push(`${V} ${F}w`);continue}let w=await Y.processImage({input:Q,output:H,format:B,quality:A,resize:{width:F}});if(w)U.byFormat[B].push({path:H,url:V,width:F,height:w.height||Math.round(F*(w.height||1)/(w.width||1)),format:B,size:w.outputSize||0}),O.push(`${V} ${F}w`)}catch(A){console.warn(`[stx-media] Failed to generate ${B} at ${F}w: ${A}`)}}U.srcsets[B]=O.join(", ")}let j=Z.placeholder||J.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let B=await Y.generateThumbHash(Q);U.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await Y.generatePlaceholder(Q,{strategy:j,width:20});U.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:j}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return U.sizes=Z.sizes||GX(X),U}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function GX($){let Z=[...$].sort((Y,Q)=>Y-Q),J=[];for(let Y=0;Y<Z.length-1;Y++){let Q=Z[Y];J.push(`(max-width: ${Q}px) ${Q}px`)}return J.push(`${Z[Z.length-1]}px`),J.join(", ")}function R3($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((J)=>J.dpr).map((J)=>`${J.url} ${J.dpr}x`).join(", ");return $.map((J)=>`${J.url} ${J.width}w`).join(", ")}var QX;var N3=C(()=>{U1();QX=[320,480,640,768,1024,1280,1536,1920]});var T3={};r(T3,{setCachedImageResult:()=>C5,processImage:()=>F3,optimizeImage:()=>V3,getCachedImageResult:()=>y5,generateSrcset:()=>R3,generateResponsiveVariants:()=>A3,clearImageCache:()=>H3,applyTransformations:()=>z$,ImageProcessorCache:()=>S5});var M3=C(()=>{w3();N3();W$()});async function KX(){try{return await Promise.resolve().then(() => (M3(),T3))}catch($){if(!I3)console.warn("[stx-media] Image processor not available, some features disabled:",$),I3=!0;return null}}async function P5($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return zX(Y,J)}if(J.processedResult?.processed)return O$($,J.processedResult,Z);if(J.responsiveVariants)return b3($,J.responsiveVariants,Z);let{src:Q,alt:X,width:G,height:K,sizes:q,widths:_=E1,dpr:W,formats:z=e1,quality:U=U$,params:j={},placeholder:B="none",placeholderOptions:O={},lazy:F=!0,priority:L=!1,loading:H=L?"eager":x5,decoding:V=v5,fetchpriority:A,objectFit:w,objectPosition:R,crossorigin:N,referrerpolicy:T}=$,I=$.class,M=$.style,E=$.id,k=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return _X($);let b,D,x=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!L)try{b=await q3(Q,{strategy:B,...O}),D=K3(x,b,O)}catch{}let h=W!==void 0&&G!==void 0,l;if(h)l=WX($,x,b,Z);else l=await qX($,x,b,Z);let U0;if(L){let S0=z.includes("webp")?"webp":z[0],v0=e9(Q,_,{...j,q:U},S0),L0=typeof q==="object"?$$(q):q||"100vw";U0=`<link rel="preload" as="image" imagesrcset="${v0}" imagesizes="${L0}" />`}let M0=[];if(!D3&&B!=="none")M0.push(X$),D3=!0;if(D)M0.push(D);let _0=F?k3(x):void 0;return{html:l,preloadLink:U0,css:M0.length>0?M0.join(`
860
+ `):void 0,script:_0}}async function qX($,Z,J,Y){let{src:Q,alt:X,width:G,height:K,sizes:q,widths:_=E1,formats:W=e1,quality:z=U$,params:U={},lazy:j=!0,priority:B=!1,loading:O=B?"eager":x5,decoding:F=v5,fetchpriority:L,objectFit:H,objectPosition:V,crossorigin:A,referrerpolicy:w}=$,R=$.class,N=$.style,T=$.data||{},I=typeof q==="object"?$$(q):q||"100vw",M=[];for(let y of W){let S=e9(Q,_,{...U,q:z},y),b=Z$(y);if(j&&!B)M.push(` <source type="${b}" data-srcset="${S}" data-sizes="${I}" />`);else M.push(` <source type="${b}" srcset="${S}" sizes="${I}" />`)}let E=B$({src:$5(Q,{...U,q:z}),alt:X,width:G,height:K,loading:B?void 0:O,decoding:F,fetchpriority:B?"high":L,objectFit:H,objectPosition:V,crossorigin:A,referrerpolicy:w,className:E3(R,J),style:j$(N,H,V,J),lazy:j&&!B,data:T}),k;if(J){let y=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;k=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
860
861
  <picture>
861
862
  ${M.join(`
862
863
  `)}
@@ -866,9 +867,9 @@ ${M.join(`
866
867
  ${M.join(`
867
868
  `)}
868
869
  <img ${E} />
869
- </picture>`;return k}function GX($,Z,J,Y){let{src:Q,alt:X,width:G,height:K,dpr:q=[1,2,3],quality:_=U$,params:W={},lazy:z=!0,priority:U=!1,loading:j=U?"eager":x5,decoding:B=v5,fetchpriority:O,objectFit:F,objectPosition:L,crossorigin:H,referrerpolicy:V}=$,N=$.class,w=$.style,R=$.data||{},A=typeof G==="number"?G:Number.parseInt(String(G),10),T=G3(Q,A,q,{...W,q:_}),I=B$({src:$5(Q,{...W,w:A,q:_}),alt:X,width:G,height:K,loading:U?void 0:j,decoding:B,fetchpriority:U?"high":O,objectFit:F,objectPosition:L,crossorigin:H,referrerpolicy:V,className:E3(N,J),style:j$(w,F,L,J),lazy:z&&!U,data:R}),M=z&&!U?`data-srcset="${T}"`:`srcset="${T}"`;if(J){let E=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
870
+ </picture>`;return k}function WX($,Z,J,Y){let{src:Q,alt:X,width:G,height:K,dpr:q=[1,2,3],quality:_=U$,params:W={},lazy:z=!0,priority:U=!1,loading:j=U?"eager":x5,decoding:B=v5,fetchpriority:O,objectFit:F,objectPosition:L,crossorigin:H,referrerpolicy:V}=$,A=$.class,w=$.style,R=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=G3(Q,N,q,{...W,q:_}),I=B$({src:$5(Q,{...W,w:N,q:_}),alt:X,width:G,height:K,loading:U?void 0:j,decoding:B,fetchpriority:U?"high":O,objectFit:F,objectPosition:L,crossorigin:H,referrerpolicy:V,className:E3(A,J),style:j$(w,F,L,J),lazy:z&&!U,data:R}),M=z&&!U?`data-srcset="${T}"`:`srcset="${T}"`;if(J){let E=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
870
871
  <img ${I} ${M} />
871
- </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${M} />`}function KX($){let{src:Z,alt:J,width:Y,height:Q,loading:X=x5,decoding:G=v5,fetchpriority:K,objectFit:q,objectPosition:_,crossorigin:W,referrerpolicy:z,priority:U=!1}=$,j=$.class,B=$.style,O=$.id,F=$.data||{};return{html:`<img ${B$({src:Z,alt:J,width:Y,height:Q,loading:U?"eager":X,decoding:G,fetchpriority:U?"high":K,objectFit:q,objectPosition:_,crossorigin:W,referrerpolicy:z,className:j,style:j$(B,q,_),id:O,data:F})} />`}}function B$($){let Z=[];if($.lazy)Z.push(`data-src="${y0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${y0($.src)}"`);if(Z.push(`alt="${y0($.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="${y0($.className)}"`);if($.style)Z.push(`style="${y0($.style)}"`);if($.id)Z.push(`id="${y0($.id)}"`);if($.data)for(let[J,Y]of Object.entries($.data))Z.push(`data-${J}="${y0(Y)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function E3($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function j$($,Z,J,Y){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(J)Q.push(`object-position: ${J}`);if(Y)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function y0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function k3($){return`
872
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${M} />`}function _X($){let{src:Z,alt:J,width:Y,height:Q,loading:X=x5,decoding:G=v5,fetchpriority:K,objectFit:q,objectPosition:_,crossorigin:W,referrerpolicy:z,priority:U=!1}=$,j=$.class,B=$.style,O=$.id,F=$.data||{};return{html:`<img ${B$({src:Z,alt:J,width:Y,height:Q,loading:U?"eager":X,decoding:G,fetchpriority:U?"high":K,objectFit:q,objectPosition:_,crossorigin:W,referrerpolicy:z,className:j,style:j$(B,q,_),id:O,data:F})} />`}}function B$($){let Z=[];if($.lazy)Z.push(`data-src="${y0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${y0($.src)}"`);if(Z.push(`alt="${y0($.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="${y0($.className)}"`);if($.style)Z.push(`style="${y0($.style)}"`);if($.id)Z.push(`id="${y0($.id)}"`);if($.data)for(let[J,Y]of Object.entries($.data))Z.push(`data-${J}="${y0(Y)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function E3($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function j$($,Z,J,Y){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(J)Q.push(`object-position: ${J}`);if(Y)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function y0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function k3($){return`
872
873
  (function() {
873
874
  const container = document.getElementById('${$}');
874
875
  if (!container) return;
@@ -905,22 +906,22 @@ ${M.join(`
905
906
 
906
907
  observer.observe(container);
907
908
  })();
908
- `.trim()}async function qX($,Z){let J=await XX();if(!J)return P5({...$,process:!1},Z);let Y=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let X=await J.generateResponsiveVariants($.src,$,Y);if(X)return b3($,X,Z)}else{let X=await J.processImage($.src,$,Y);if(X.processed)return O$($,X,Z)}return P5({...$,process:!1},Z)}async function O$($,Z,J){let{alt:Y,width:Q,height:X,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:_,crossorigin:W,referrerpolicy:z}=$,U=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,O=$.data||{},F=Z.variants||[],L=F.find((D)=>D.format==="jpeg")||F.find((D)=>D.format==="webp")||F[0],H=L?.url||$.src,V=F.filter((D)=>D.format===(L?.format||"jpeg")).map((D)=>`${D.url} ${D.width}w`).join(", "),N=new Map;for(let D of F){if(!N.has(D.format))N.set(D.format,[]);N.get(D.format).push(D)}let w=[],R=["avif","webp","jpeg","png"];for(let D of R){let x=N.get(D);if(x&&x.length>0){let h=x.map((U0)=>`${U0.url} ${U0.width}w`).join(", "),l=Z$(D);if(G&&!K)w.push(` <source type="${l}" data-srcset="${h}" />`);else w.push(` <source type="${l}" srcset="${h}" />`)}}let A=[];if(G&&!K){if(A.push(`data-src="${y0(H)}"`),A.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)A.push(`data-srcset="${V}"`)}else if(A.push(`src="${y0(H)}"`),V)A.push(`srcset="${V}"`);A.push(`alt="${y0(Y)}"`);let T=Q||Z.originalWidth,I=X||Z.originalHeight;if(T)A.push(`width="${T}"`);if(I)A.push(`height="${I}"`);if(!K)A.push(`loading="${G?"lazy":"eager"}"`);if(A.push('decoding="async"'),K)A.push('fetchpriority="high"');if(W)A.push(`crossorigin="${W}"`);if(z)A.push(`referrerpolicy="${z}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(_)M.push(`object-position: ${_}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)A.push(`style="${M.join("; ")}"`);let E=[];if(U)E.push(U);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)A.push(`class="${E.join(" ")}"`);if(G&&!K)A.push("data-stx-lazy");for(let[D,x]of Object.entries(O))A.push(`data-${D}="${y0(x)}"`);let k;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let D=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;k=`<div id="${B}" class="stx-img-placeholder" style="${D}">
909
+ `.trim()}async function zX($,Z){let J=await KX();if(!J)return P5({...$,process:!1},Z);let Y=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let X=await J.generateResponsiveVariants($.src,$,Y);if(X)return b3($,X,Z)}else{let X=await J.processImage($.src,$,Y);if(X.processed)return O$($,X,Z)}return P5({...$,process:!1},Z)}async function O$($,Z,J){let{alt:Y,width:Q,height:X,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:_,crossorigin:W,referrerpolicy:z}=$,U=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,O=$.data||{},F=Z.variants||[],L=F.find((D)=>D.format==="jpeg")||F.find((D)=>D.format==="webp")||F[0],H=L?.url||$.src,V=F.filter((D)=>D.format===(L?.format||"jpeg")).map((D)=>`${D.url} ${D.width}w`).join(", "),A=new Map;for(let D of F){if(!A.has(D.format))A.set(D.format,[]);A.get(D.format).push(D)}let w=[],R=["avif","webp","jpeg","png"];for(let D of R){let x=A.get(D);if(x&&x.length>0){let h=x.map((U0)=>`${U0.url} ${U0.width}w`).join(", "),l=Z$(D);if(G&&!K)w.push(` <source type="${l}" data-srcset="${h}" />`);else w.push(` <source type="${l}" srcset="${h}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${y0(H)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)N.push(`data-srcset="${V}"`)}else if(N.push(`src="${y0(H)}"`),V)N.push(`srcset="${V}"`);N.push(`alt="${y0(Y)}"`);let T=Q||Z.originalWidth,I=X||Z.originalHeight;if(T)N.push(`width="${T}"`);if(I)N.push(`height="${I}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(W)N.push(`crossorigin="${W}"`);if(z)N.push(`referrerpolicy="${z}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(_)M.push(`object-position: ${_}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)N.push(`style="${M.join("; ")}"`);let E=[];if(U)E.push(U);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[D,x]of Object.entries(O))N.push(`data-${D}="${y0(x)}"`);let k;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let D=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;k=`<div id="${B}" class="stx-img-placeholder" style="${D}">
909
910
  <picture>
910
911
  ${w.join(`
911
912
  `)}
912
- <img ${A.join(" ")} />
913
+ <img ${N.join(" ")} />
913
914
  </picture>
914
915
  </div>`}else k=`<picture${B?` id="${B}"`:""}>
915
916
  ${w.join(`
916
917
  `)}
917
- <img ${A.join(" ")} />
918
+ <img ${N.join(" ")} />
918
919
  </picture>`;let y=[];if(Z.placeholder)y.push(X$);let S=G?k3(B):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:k,preloadLink:b,css:y.length>0?y.join(`
919
- `):void 0,script:S}}async function b3($,Z,J){let Y={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,X]of Object.entries(Z.byFormat))if(X)Y.variants.push(...X);return O$($,Y,J)}var I3=!1,U$=80,v5="async",x5="lazy",D3=!1;var S3=C(()=>{Y$();W3()});function WX(){return M5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,Y)=>{let{src:Q,alt:X,options:G}=_X($,Z,J);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:X||"",widths:G.widths||I1,formats:G.formats||e1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=J.__isDev||!1,_=await P5(K,{isDev:q}),W=_.html;if(_.preloadLink)W=_.preloadLink+`
920
+ `):void 0,script:S}}async function b3($,Z,J){let Y={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,X]of Object.entries(Z.byFormat))if(X)Y.variants.push(...X);return O$($,Y,J)}var I3=!1,U$=80,v5="async",x5="lazy",D3=!1;var S3=C(()=>{Y$();W3()});function UX(){return M5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,Y)=>{let{src:Q,alt:X,options:G}=BX($,Z,J);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:X||"",widths:G.widths||E1,formats:G.formats||e1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=J.__isDev||!1,_=await P5(K,{isDev:q}),W=_.html;if(_.preloadLink)W=_.preloadLink+`
920
921
  `+W;if(_.css)W+=`
921
922
  <style>${_.css}</style>`;if(_.script)W+=`
922
- <script>${_.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function _X($,Z,J){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let Y=$.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=zX(Y),X=H$(Q[0],J)||"",G=H$(Q[1],J)||"",K={};if(Q[2]){let q=H$(Q[2],J);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:X,alt:G,options:K}}function zX($){let Z=[],J="",Y=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!Y)Y=!0,Q=q;else if(q===Q)Y=!1,Q="";else J+=q;continue}if(!Y){if(q==="{")X++;if(q==="}")X--;if(q==="[")G++;if(q==="]")G--;if(q===","&&X===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function H$($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let Y=Z[J];if(Y!==void 0)return Y}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var y3;var C3=C(()=>{t9();S3();Y$();y3=WX()});class g5{config;constructor($={}){this.config={...UX,...$}}async get($,Z){return D5($,Z,"video",this.config)}async set($,Z,J){return E5($,Z,J,"video",this.config)}async clear(){return k5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function L$($){if(!f5)f5=new g5($);else if($)f5.updateConfig($);return f5}async function h5($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return L$(Y).get($,Z)}async function d5($,Z,J,Y){let Q=Y?{directory:`${Y.outputDir}/../.cache`}:{};return L$(Q).set($,Z,J)}async function P3(){return L$().clear()}var UX,f5=null;var F$=C(()=>{K$();UX={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as V$,basename as w$,extname as N$,join as m5}from"path";import{mkdir as R$}from"fs/promises";async function A$(){try{return await import("ts-videos")}catch{return null}}async function u5($,Z,J,Y){let Q=await A$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=V$($);if(!await V0(X))return null;await R$(J,{recursive:!0});let G=await R0(X),K=w$($,N$($)),q=Z.format||"webp",_=Z.timestamp||0,W=`${K}-poster-${G}.${q}`,z=m5(J,W),U=await Q.extractThumbnails(X,{timestamps:[_],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:J,outputPattern:W.replace(`.${q}`,"")});if(U&&U.length>0){let j=U[0];return{path:z,url:`${Y}/${W}`,width:j.width||Z.width||1280,height:j.height||720,timestamp:_,size:j.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function p5($,Z,J,Y){let Q=await A$();if(!Q)return[];try{let X=V$($);if(!await V0(X))return[];await R$(J,{recursive:!0});let G=await R0(X),K=w$($,N$($)),q=Z.format||"webp",z=(await new Q.Input(X).getInfo()).duration||60,U=Z.count||10,j=Z.interval||z/U,B=[];for(let F=0;F<U&&F*j<z;F++)B.push(F*j);let O=await Q.extractThumbnails(X,{timestamps:B,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:J,outputPattern:`${K}-thumb-${G}`});if(O&&O.length>0)return O.map((F,L)=>({path:F.path||m5(J,`${K}-thumb-${G}-${L}.${q}`),url:`${Y}/${K}-thumb-${G}-${L}.${q}`,width:F.width||Z.width||320,height:F.height||180,timestamp:B[L],size:F.size||0}));return[]}catch(X){return console.warn(`[stx-media] Failed to generate thumbnails: ${X}`),[]}}async function v3($,Z,J,Y){let Q=await A$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=V$($);if(!await V0(X))return null;await R$(J,{recursive:!0});let G=await R0(X),K=w$($,N$($)),W=(await new Q.Input(X).getInfo()).duration||60,z=Z.columns||10,U=Z.interval||5,j=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,O=Z.format||"jpeg",F=Math.ceil(W/U),L=Math.ceil(F/z),H=`${K}-sprite-${G}.${O}`,V=m5(J,H),N=[];for(let R=0;R<F;R++)N.push(R*U);let w=await Q.extractThumbnails(X,{timestamps:N,width:j,height:B,format:O,quality:Z.quality||70,outputDir:m5(J,".temp")});if(!w||w.length===0)return null;try{let R=await import("ts-images"),A=z*j,T=L*B,I=await R.createSprite({images:w.map((M)=>M.path),columns:z,padding:0,outputPath:V,format:O,quality:Z.quality||70});return{url:`${Y}/${H}`,path:V,columns:z,rows:L,thumbnailWidth:j,thumbnailHeight:B,interval:U,totalFrames:F}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(X){return console.warn(`[stx-media] Failed to generate sprite sheet: ${X}`),null}}var T$=C(()=>{U1()});import{resolve as f3,basename as g3,extname as h3,join as B1}from"path";import{mkdir as l5,writeFile as d3}from"fs/promises";async function m3(){try{return await import("ts-videos")}catch{return null}}async function c5($,Z,J,Y,Q){let X=await m3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=f3($);if(!await V0(G))return null;let K=await R0(G),q=g3($,h3($)),_=B1(J,`${q}-${K}-hls`);await l5(_,{recursive:!0});let W=Z.length>0?Z:u3,z=Q?.segmentDuration||6,B=(await new X.Input(G).getInfo()).duration||0,O=[],F=0;for(let V of W){let N=B1(_,V.label);await l5(N,{recursive:!0});let w=`${V.label}.m3u8`,R=B1(N,w);try{let A=await X.generateHLS(G,{outputDir:N,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(A)O.push({quality:V,url:`${Y}/${q}-${K}-hls/${V.label}/${w}`,path:R}),F+=A.segmentCount||Math.ceil(B/z)}catch(A){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${A}`)}}if(O.length===0)return null;let L=B1(_,"master.m3u8"),H=BX(O,Y,q,K);return await d3(L,H),{manifestUrl:`${Y}/${q}-${K}-hls/master.m3u8`,manifestPath:L,playlists:O,segmentCount:F,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function BX($,Z,J,Y){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let X of $){let{quality:G}=X,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
923
- `)}async function i5($,Z,J,Y,Q){let X=await m3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=f3($);if(!await V0(G))return null;let K=await R0(G),q=g3($,h3($)),_=B1(J,`${q}-${K}-dash`);await l5(_,{recursive:!0});let W=Z.length>0?Z:u3,z=Q?.segmentDuration||4,U=Q?.minBufferTime||2,O=(await new X.Input(G).getInfo()).duration||0,F=[],L=[];for(let w of W){let R=B1(_,w.label);await l5(R,{recursive:!0});try{if(await X.generateDASH(G,{outputDir:R,segmentDuration:z,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate})){if(F.push({bandwidth:w.bitrate,width:w.width,height:w.height||Math.round(w.width*9/16),url:`${Y}/${q}-${K}-dash/${w.label}/video`}),w.audioBitrate)L.push({bandwidth:w.audioBitrate,url:`${Y}/${q}-${K}-dash/${w.label}/audio`})}}catch(A){console.warn(`[stx-media] Failed to generate DASH for ${w.label}: ${A}`)}}if(F.length===0)return null;let H=B1(_,"manifest.mpd"),V=jX(F,L,O,z,U);await d3(H,V);let N=[{type:"video",representations:F}];if(L.length>0)N.push({type:"audio",representations:L});return{manifestUrl:`${Y}/${q}-${K}-dash/manifest.mpd`,manifestPath:H,adaptationSets:N,duration:O}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function jX($,Z,J,Y,Q){let X=x3(J),G=x3(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
923
+ <script>${_.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function BX($,Z,J){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let Y=$.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=jX(Y),X=H$(Q[0],J)||"",G=H$(Q[1],J)||"",K={};if(Q[2]){let q=H$(Q[2],J);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:X,alt:G,options:K}}function jX($){let Z=[],J="",Y=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!Y)Y=!0,Q=q;else if(q===Q)Y=!1,Q="";else J+=q;continue}if(!Y){if(q==="{")X++;if(q==="}")X--;if(q==="[")G++;if(q==="]")G--;if(q===","&&X===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function H$($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let Y=Z[J];if(Y!==void 0)return Y}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var y3;var C3=C(()=>{t9();S3();Y$();y3=UX()});class g5{config;constructor($={}){this.config={...OX,...$}}async get($,Z){return D5($,Z,"video",this.config)}async set($,Z,J){return E5($,Z,J,"video",this.config)}async clear(){return k5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function L$($){if(!f5)f5=new g5($);else if($)f5.updateConfig($);return f5}async function h5($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return L$(Y).get($,Z)}async function d5($,Z,J,Y){let Q=Y?{directory:`${Y.outputDir}/../.cache`}:{};return L$(Q).set($,Z,J)}async function P3(){return L$().clear()}var OX,f5=null;var F$=C(()=>{K$();OX={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as V$,basename as w$,extname as A$,join as m5}from"path";import{mkdir as R$}from"fs/promises";async function N$(){try{return await import("ts-videos")}catch{return null}}async function u5($,Z,J,Y){let Q=await N$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=V$($);if(!await V0(X))return null;await R$(J,{recursive:!0});let G=await R0(X),K=w$($,A$($)),q=Z.format||"webp",_=Z.timestamp||0,W=`${K}-poster-${G}.${q}`,z=m5(J,W),U=await Q.extractThumbnails(X,{timestamps:[_],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:J,outputPattern:W.replace(`.${q}`,"")});if(U&&U.length>0){let j=U[0];return{path:z,url:`${Y}/${W}`,width:j.width||Z.width||1280,height:j.height||720,timestamp:_,size:j.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function p5($,Z,J,Y){let Q=await N$();if(!Q)return[];try{let X=V$($);if(!await V0(X))return[];await R$(J,{recursive:!0});let G=await R0(X),K=w$($,A$($)),q=Z.format||"webp",z=(await new Q.Input(X).getInfo()).duration||60,U=Z.count||10,j=Z.interval||z/U,B=[];for(let F=0;F<U&&F*j<z;F++)B.push(F*j);let O=await Q.extractThumbnails(X,{timestamps:B,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:J,outputPattern:`${K}-thumb-${G}`});if(O&&O.length>0)return O.map((F,L)=>({path:F.path||m5(J,`${K}-thumb-${G}-${L}.${q}`),url:`${Y}/${K}-thumb-${G}-${L}.${q}`,width:F.width||Z.width||320,height:F.height||180,timestamp:B[L],size:F.size||0}));return[]}catch(X){return console.warn(`[stx-media] Failed to generate thumbnails: ${X}`),[]}}async function v3($,Z,J,Y){let Q=await N$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=V$($);if(!await V0(X))return null;await R$(J,{recursive:!0});let G=await R0(X),K=w$($,A$($)),W=(await new Q.Input(X).getInfo()).duration||60,z=Z.columns||10,U=Z.interval||5,j=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,O=Z.format||"jpeg",F=Math.ceil(W/U),L=Math.ceil(F/z),H=`${K}-sprite-${G}.${O}`,V=m5(J,H),A=[];for(let R=0;R<F;R++)A.push(R*U);let w=await Q.extractThumbnails(X,{timestamps:A,width:j,height:B,format:O,quality:Z.quality||70,outputDir:m5(J,".temp")});if(!w||w.length===0)return null;try{let R=await import("ts-images"),N=z*j,T=L*B,I=await R.createSprite({images:w.map((M)=>M.path),columns:z,padding:0,outputPath:V,format:O,quality:Z.quality||70});return{url:`${Y}/${H}`,path:V,columns:z,rows:L,thumbnailWidth:j,thumbnailHeight:B,interval:U,totalFrames:F}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(X){return console.warn(`[stx-media] Failed to generate sprite sheet: ${X}`),null}}var T$=C(()=>{U1()});import{resolve as f3,basename as g3,extname as h3,join as B1}from"path";import{mkdir as l5,writeFile as d3}from"fs/promises";async function m3(){try{return await import("ts-videos")}catch{return null}}async function c5($,Z,J,Y,Q){let X=await m3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=f3($);if(!await V0(G))return null;let K=await R0(G),q=g3($,h3($)),_=B1(J,`${q}-${K}-hls`);await l5(_,{recursive:!0});let W=Z.length>0?Z:u3,z=Q?.segmentDuration||6,B=(await new X.Input(G).getInfo()).duration||0,O=[],F=0;for(let V of W){let A=B1(_,V.label);await l5(A,{recursive:!0});let w=`${V.label}.m3u8`,R=B1(A,w);try{let N=await X.generateHLS(G,{outputDir:A,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(N)O.push({quality:V,url:`${Y}/${q}-${K}-hls/${V.label}/${w}`,path:R}),F+=N.segmentCount||Math.ceil(B/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${N}`)}}if(O.length===0)return null;let L=B1(_,"master.m3u8"),H=HX(O,Y,q,K);return await d3(L,H),{manifestUrl:`${Y}/${q}-${K}-hls/master.m3u8`,manifestPath:L,playlists:O,segmentCount:F,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function HX($,Z,J,Y){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let X of $){let{quality:G}=X,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
924
+ `)}async function i5($,Z,J,Y,Q){let X=await m3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=f3($);if(!await V0(G))return null;let K=await R0(G),q=g3($,h3($)),_=B1(J,`${q}-${K}-dash`);await l5(_,{recursive:!0});let W=Z.length>0?Z:u3,z=Q?.segmentDuration||4,U=Q?.minBufferTime||2,O=(await new X.Input(G).getInfo()).duration||0,F=[],L=[];for(let w of W){let R=B1(_,w.label);await l5(R,{recursive:!0});try{if(await X.generateDASH(G,{outputDir:R,segmentDuration:z,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate})){if(F.push({bandwidth:w.bitrate,width:w.width,height:w.height||Math.round(w.width*9/16),url:`${Y}/${q}-${K}-dash/${w.label}/video`}),w.audioBitrate)L.push({bandwidth:w.audioBitrate,url:`${Y}/${q}-${K}-dash/${w.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${w.label}: ${N}`)}}if(F.length===0)return null;let H=B1(_,"manifest.mpd"),V=LX(F,L,O,z,U);await d3(H,V);let A=[{type:"video",representations:F}];if(L.length>0)A.push({type:"audio",representations:L});return{manifestUrl:`${Y}/${q}-${K}-dash/manifest.mpd`,manifestPath:H,adaptationSets:A,duration:O}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function LX($,Z,J,Y,Q){let X=x3(J),G=x3(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
924
925
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
925
926
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
926
927
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -946,7 +947,7 @@ ${w.join(`
946
947
  </Representation>
947
948
  `}K+=` </AdaptationSet>
948
949
  `}return K+=` </Period>
949
- </MPD>`,K}function x3($){let Z=Math.floor($/3600),J=Math.floor($%3600/60),Y=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(J>0)Q+=`${J}M`;return Q+=`${Y}S`,Q}var u3;var M$=C(()=>{U1();u3=[{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 p3,basename as OX,extname as HX,join as LX}from"path";import{mkdir as FX}from"fs/promises";async function l3(){try{return await import("ts-videos")}catch{return null}}function VX($){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 wX($){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 I$($){let Z=await l3();if(!Z)return null;try{let J=p3($),Q=await new Z.Input(J).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(J){return console.warn(`[stx-media] Failed to analyze video: ${J}`),null}}async function c3($,Z,J,Y){let Q=await l3();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let X=await h5($,Z,J);if(X)return X;try{let G=p3($);if(!await V0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=J.outputDir||"dist/videos",q=J.baseUrl||"/videos";await FX(K,{recursive:!0});let _=await R0(G),W=OX($,HX($)),z={src:$,processed:!0,hash:_};Y?.({percentage:5,stage:"analyzing"}),z.metadata=await I$(G)||void 0;let U={};if(Z.quality)U.bitrate=VX(Z.quality);if(Z.platform)Object.assign(U,wX(Z.platform));if(Z.transcode)Object.assign(U,Z.transcode);if(Object.keys(U).length>0||Z.process){Y?.({percentage:10,stage:"transcoding"});let j=`${W}-${_}.mp4`,B=LX(K,j);try{let O=await NX(G,B,U,Q,(F)=>Y?.({percentage:10+F*0.5,stage:"transcoding"}));if(O)z.transcoded={path:B,url:`${q}/${j}`,duration:O.duration,size:O.size,video:{codec:U.codec||"h264",width:O.width,height:O.height,bitrate:O.bitrate,frameRate:O.frameRate},audio:O.audioCodec?{codec:U.audioCodec||"aac",bitrate:U.audioBitrate||128000,sampleRate:U.sampleRate||48000,channels:U.channels||2}:void 0}}catch(O){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${O}`)}}if(Z.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let j=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await u5(G,j,K,q);if(B)z.poster=B}if(J.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let j=await p5(G,J.thumbnails,K,q);if(j.length>0)z.thumbnails=j}if(Z.streaming){Y?.({percentage:80,stage:"generating-manifests"});let j=typeof Z.streaming==="object"?Z.streaming:J.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let B=await c5(G,j.qualities||J.streaming?.defaultQualities||[],K,q);if(B)z.streaming={...z.streaming,hls:B}}if(j.format==="dash"){let B=await i5(G,j.qualities||J.streaming?.defaultQualities||[],K,q);if(B)z.streaming={...z.streaming,dash:B}}}if(Z.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await d5($,Z,z,J),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function NX($,Z,J,Y,Q){try{let G=await new Y.Conversion($,Z,{videoCodec:J.codec,videoBitrate:J.bitrate,width:J.maxWidth,height:J.maxHeight,frameRate:J.frameRate,audioCodec:J.audioCodec,audioBitrate:J.audioBitrate,sampleRate:J.sampleRate,channels:J.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||J.maxWidth||0,height:G.height||J.maxHeight||0,bitrate:G.bitrate||J.bitrate||0,frameRate:G.frameRate||J.frameRate||30,audioCodec:G.audioCodec}}catch(X){return console.error(`[stx-media] Transcoding failed: ${X}`),null}}var i3=C(()=>{U1();F$();T$();M$()});var n3={};r(n3,{setCachedVideoResult:()=>d5,processVideo:()=>c3,getCachedVideoResult:()=>h5,generateThumbnails:()=>p5,generateSpriteSheet:()=>v3,generatePoster:()=>u5,generateHLSManifest:()=>c5,generateDASHManifest:()=>i5,clearVideoCache:()=>P3,analyzeVideo:()=>I$,VideoProcessorCache:()=>g5});var o3=C(()=>{i3();T$();M$();F$()});async function r3(){try{return await Promise.resolve().then(() => (o3(),n3))}catch($){if(!s3)console.warn("[stx-media] Video processor not available, some features disabled:",$),s3=!0;return null}}async function n5($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return DX(Y,J)}if(J.processedResult?.processed)return $6($,J.processedResult,Z);let Q;if(Y.generatePoster&&Y.src&&!$.poster)Q=await EX(Y,J);let{src:X,sources:G=[],poster:K,posterPlaceholder:q,controls:_=a3,autoplay:W=!1,muted:z=!1,loop:U=!1,preload:j=t3,playsinline:B=!0,lazy:O=!0,player:F="native",type:L,width:H,height:V,crossorigin:N,disablePictureInPicture:w=!1,disableRemotePlayback:R=!1}=$,A=Q||K,T=$.class,I=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return TX($,Z);if(L&&L!=="video")return AX(X||"",L,$);let E=G.length>0?G:X?[{src:X,type:e3(X)}]:[],k=[`id="${M}"`];if(_)k.push("controls");if(W)k.push("autoplay");if(z)k.push("muted");if(U)k.push("loop");if(B)k.push("playsinline");if(w)k.push("disablepictureinpicture");if(R)k.push("disableremoteplayback");if(N)k.push(`crossorigin="${N}"`);if(O){if(k.push(`data-preload="${j}"`),k.push('preload="none"'),A)k.push(`data-poster="${B0(A)}"`);k.push("data-stx-lazy")}else if(k.push(`preload="${j}"`),A)k.push(`poster="${B0(A)}"`);if(H)k.push(`width="${H}"`);if(V)k.push(`height="${V}"`);if(T)k.push(`class="${B0(T)}"`);if(I)k.push(`style="${B0(I)}"`);let y=E.map((D)=>{return` <source ${O?`data-src="${B0(D.src)}"`:`src="${B0(D.src)}"`} type="${D.type}"${D.media?` media="${D.media}"`:""} />`}).join(`
950
+ </MPD>`,K}function x3($){let Z=Math.floor($/3600),J=Math.floor($%3600/60),Y=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(J>0)Q+=`${J}M`;return Q+=`${Y}S`,Q}var u3;var M$=C(()=>{U1();u3=[{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 p3,basename as FX,extname as VX,join as wX}from"path";import{mkdir as AX}from"fs/promises";async function l3(){try{return await import("ts-videos")}catch{return null}}function RX($){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 NX($){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 I$($){let Z=await l3();if(!Z)return null;try{let J=p3($),Q=await new Z.Input(J).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(J){return console.warn(`[stx-media] Failed to analyze video: ${J}`),null}}async function c3($,Z,J,Y){let Q=await l3();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let X=await h5($,Z,J);if(X)return X;try{let G=p3($);if(!await V0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=J.outputDir||"dist/videos",q=J.baseUrl||"/videos";await AX(K,{recursive:!0});let _=await R0(G),W=FX($,VX($)),z={src:$,processed:!0,hash:_};Y?.({percentage:5,stage:"analyzing"}),z.metadata=await I$(G)||void 0;let U={};if(Z.quality)U.bitrate=RX(Z.quality);if(Z.platform)Object.assign(U,NX(Z.platform));if(Z.transcode)Object.assign(U,Z.transcode);if(Object.keys(U).length>0||Z.process){Y?.({percentage:10,stage:"transcoding"});let j=`${W}-${_}.mp4`,B=wX(K,j);try{let O=await TX(G,B,U,Q,(F)=>Y?.({percentage:10+F*0.5,stage:"transcoding"}));if(O)z.transcoded={path:B,url:`${q}/${j}`,duration:O.duration,size:O.size,video:{codec:U.codec||"h264",width:O.width,height:O.height,bitrate:O.bitrate,frameRate:O.frameRate},audio:O.audioCodec?{codec:U.audioCodec||"aac",bitrate:U.audioBitrate||128000,sampleRate:U.sampleRate||48000,channels:U.channels||2}:void 0}}catch(O){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${O}`)}}if(Z.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let j=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await u5(G,j,K,q);if(B)z.poster=B}if(J.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let j=await p5(G,J.thumbnails,K,q);if(j.length>0)z.thumbnails=j}if(Z.streaming){Y?.({percentage:80,stage:"generating-manifests"});let j=typeof Z.streaming==="object"?Z.streaming:J.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let B=await c5(G,j.qualities||J.streaming?.defaultQualities||[],K,q);if(B)z.streaming={...z.streaming,hls:B}}if(j.format==="dash"){let B=await i5(G,j.qualities||J.streaming?.defaultQualities||[],K,q);if(B)z.streaming={...z.streaming,dash:B}}}if(Z.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await d5($,Z,z,J),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function TX($,Z,J,Y,Q){try{let G=await new Y.Conversion($,Z,{videoCodec:J.codec,videoBitrate:J.bitrate,width:J.maxWidth,height:J.maxHeight,frameRate:J.frameRate,audioCodec:J.audioCodec,audioBitrate:J.audioBitrate,sampleRate:J.sampleRate,channels:J.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||J.maxWidth||0,height:G.height||J.maxHeight||0,bitrate:G.bitrate||J.bitrate||0,frameRate:G.frameRate||J.frameRate||30,audioCodec:G.audioCodec}}catch(X){return console.error(`[stx-media] Transcoding failed: ${X}`),null}}var i3=C(()=>{U1();F$();T$();M$()});var n3={};r(n3,{setCachedVideoResult:()=>d5,processVideo:()=>c3,getCachedVideoResult:()=>h5,generateThumbnails:()=>p5,generateSpriteSheet:()=>v3,generatePoster:()=>u5,generateHLSManifest:()=>c5,generateDASHManifest:()=>i5,clearVideoCache:()=>P3,analyzeVideo:()=>I$,VideoProcessorCache:()=>g5});var o3=C(()=>{i3();T$();M$();F$()});async function r3(){try{return await Promise.resolve().then(() => (o3(),n3))}catch($){if(!s3)console.warn("[stx-media] Video processor not available, some features disabled:",$),s3=!0;return null}}async function n5($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return bX(Y,J)}if(J.processedResult?.processed)return $6($,J.processedResult,Z);let Q;if(Y.generatePoster&&Y.src&&!$.poster)Q=await SX(Y,J);let{src:X,sources:G=[],poster:K,posterPlaceholder:q,controls:_=a3,autoplay:W=!1,muted:z=!1,loop:U=!1,preload:j=t3,playsinline:B=!0,lazy:O=!0,player:F="native",type:L,width:H,height:V,crossorigin:A,disablePictureInPicture:w=!1,disableRemotePlayback:R=!1}=$,N=Q||K,T=$.class,I=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return DX($,Z);if(L&&L!=="video")return IX(X||"",L,$);let E=G.length>0?G:X?[{src:X,type:e3(X)}]:[],k=[`id="${M}"`];if(_)k.push("controls");if(W)k.push("autoplay");if(z)k.push("muted");if(U)k.push("loop");if(B)k.push("playsinline");if(w)k.push("disablepictureinpicture");if(R)k.push("disableremoteplayback");if(A)k.push(`crossorigin="${A}"`);if(O){if(k.push(`data-preload="${j}"`),k.push('preload="none"'),N)k.push(`data-poster="${B0(N)}"`);k.push("data-stx-lazy")}else if(k.push(`preload="${j}"`),N)k.push(`poster="${B0(N)}"`);if(H)k.push(`width="${H}"`);if(V)k.push(`height="${V}"`);if(T)k.push(`class="${B0(T)}"`);if(I)k.push(`style="${B0(I)}"`);let y=E.map((D)=>{return` <source ${O?`data-src="${B0(D.src)}"`:`src="${B0(D.src)}"`} type="${D.type}"${D.media?` media="${D.media}"`:""} />`}).join(`
950
951
  `),S=`<video ${k.join(" ")}>
951
952
  ${y}
952
953
  Your browser does not support the video tag.
@@ -985,9 +986,9 @@ ${y}
985
986
 
986
987
  observer.observe(video);
987
988
  })();
988
- `.trim();return{html:S,script:b}}function AX($,Z,J){let{width:Y=640,height:Q=360}=J,X=J.class,G=J.style,K=J.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,_=null;switch(Z){case"youtube":_=MX($),q=_?`https://www.youtube-nocookie.com/embed/${_}`:$;break;case"vimeo":_=IX($),q=_?`https://player.vimeo.com/video/${_}`:$;break;case"dailymotion":_=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${_}`;break;case"twitch":_=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${_}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let W=[`id="${K}"`,`src="${B0(q)}"`,`width="${Y}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(X)W.push(`class="${B0(X)}"`);if(G)W.push(`style="${B0(G)}"`);if(J.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
989
+ `.trim();return{html:S,script:b}}function IX($,Z,J){let{width:Y=640,height:Q=360}=J,X=J.class,G=J.style,K=J.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,_=null;switch(Z){case"youtube":_=EX($),q=_?`https://www.youtube-nocookie.com/embed/${_}`:$;break;case"vimeo":_=kX($),q=_?`https://player.vimeo.com/video/${_}`:$;break;case"dailymotion":_=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${_}`;break;case"twitch":_=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${_}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let W=[`id="${K}"`,`src="${B0(q)}"`,`width="${Y}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(X)W.push(`class="${B0(X)}"`);if(G)W.push(`style="${B0(G)}"`);if(J.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
989
990
  <iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
990
- </div>`}}function TX($,Z={}){let{src:J,sources:Y=[],poster:Q,controls:X=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:_="metadata",playsinline:W=!0,lazy:z=!0,width:U,height:j}=$,B=$.class,O=$.style,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:Y.length>0?Y:J,autoplay:G,loop:q,muted:K,playsinline:W,preload:_,poster:Q,controls:X,title:$.title},H=["position: relative",U?`width: ${typeof U==="number"?U+"px":U}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",O||""].filter(Boolean).join("; "),V=`
991
+ </div>`}}function DX($,Z={}){let{src:J,sources:Y=[],poster:Q,controls:X=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:_="metadata",playsinline:W=!0,lazy:z=!0,width:U,height:j}=$,B=$.class,O=$.style,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:Y.length>0?Y:J,autoplay:G,loop:q,muted:K,playsinline:W,preload:_,poster:Q,controls:X,title:$.title},H=["position: relative",U?`width: ${typeof U==="number"?U+"px":U}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",O||""].filter(Boolean).join("; "),V=`
991
992
  <div
992
993
  id="${F}"
993
994
  class="ts-video-player${B?" "+B0(B):""}"
@@ -1008,7 +1009,7 @@ ${y}
1008
1009
  `:""}
1009
1010
  </div>
1010
1011
  </div>
1011
- `.trim(),N=`
1012
+ `.trim(),A=`
1012
1013
  (function() {
1013
1014
  var container = document.getElementById('${F}');
1014
1015
  if (!container) return;
@@ -1024,7 +1025,7 @@ ${y}
1024
1025
 
1025
1026
  // Load ts-video-player from CDN
1026
1027
  var script = document.createElement('script');
1027
- script.src = '${RX}';
1028
+ script.src = '${MX}';
1028
1029
  script.onload = initPlayer;
1029
1030
  script.onerror = function() {
1030
1031
  console.error('[stx] Failed to load ts-video-player');
@@ -1154,7 +1155,7 @@ else {
1154
1155
  .ts-video-player__play-button svg {
1155
1156
  margin-left: 4px;
1156
1157
  }
1157
- `.trim();return{html:V,script:N,css:w}}function e3($){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 MX($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let J of Z){let Y=$.match(J);if(Y)return Y[1]}return null}function IX($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function DX($,Z){let J=await r3();if(!J)return n5({...$,process:!1},Z);let Y=Z.tsVideosConfig,Q=await J.processVideo($.src,$,Y,$.onProcessProgress);if(Q.processed)return $6($,Q,Z);return n5({...$,process:!1},Z)}async function EX($,Z){let J=await r3();if(!J||!$.src)return;let Y=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,Y,Q.outputDir,Q.baseUrl||"/videos"))?.url}function $6($,Z,J){let{controls:Y=a3,autoplay:Q=!1,muted:X=!1,loop:G=!1,preload:K=t3,playsinline:q=!0,lazy:_=!0,width:W,height:z,crossorigin:U,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,O=$.class,F=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,H=$.src,V=e3(H);if(Z.transcoded)H=Z.transcoded.url,V="video/mp4";let N=Z.streaming?.hls||Z.streaming?.dash;if(N){if(Z.streaming?.hls)H=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)H=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let w=Z.poster?.url||$.poster,R=[`id="${L}"`];if(Y)R.push("controls");if(Q)R.push("autoplay");if(X)R.push("muted");if(G)R.push("loop");if(q)R.push("playsinline");if(j)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(U)R.push(`crossorigin="${U}"`);if(_){if(R.push(`data-preload="${K}"`),R.push('preload="none"'),w)R.push(`data-poster="${B0(w)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${K}"`),w)R.push(`poster="${B0(w)}"`);let A=W||Z.metadata?.width,T=z||Z.metadata?.height;if(A)R.push(`width="${A}"`);if(T)R.push(`height="${T}"`);if(O)R.push(`class="${B0(O)}"`);if(F)R.push(`style="${B0(F)}"`);let M=` <source ${_?`data-src="${B0(H)}"`:`src="${B0(H)}"`} type="${V}" />`,E=`<video ${R.join(" ")}>
1158
+ `.trim();return{html:V,script:A,css:w}}function e3($){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 EX($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let J of Z){let Y=$.match(J);if(Y)return Y[1]}return null}function kX($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function bX($,Z){let J=await r3();if(!J)return n5({...$,process:!1},Z);let Y=Z.tsVideosConfig,Q=await J.processVideo($.src,$,Y,$.onProcessProgress);if(Q.processed)return $6($,Q,Z);return n5({...$,process:!1},Z)}async function SX($,Z){let J=await r3();if(!J||!$.src)return;let Y=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,Y,Q.outputDir,Q.baseUrl||"/videos"))?.url}function $6($,Z,J){let{controls:Y=a3,autoplay:Q=!1,muted:X=!1,loop:G=!1,preload:K=t3,playsinline:q=!0,lazy:_=!0,width:W,height:z,crossorigin:U,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,O=$.class,F=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,H=$.src,V=e3(H);if(Z.transcoded)H=Z.transcoded.url,V="video/mp4";let A=Z.streaming?.hls||Z.streaming?.dash;if(A){if(Z.streaming?.hls)H=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)H=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let w=Z.poster?.url||$.poster,R=[`id="${L}"`];if(Y)R.push("controls");if(Q)R.push("autoplay");if(X)R.push("muted");if(G)R.push("loop");if(q)R.push("playsinline");if(j)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(U)R.push(`crossorigin="${U}"`);if(_){if(R.push(`data-preload="${K}"`),R.push('preload="none"'),w)R.push(`data-poster="${B0(w)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${K}"`),w)R.push(`poster="${B0(w)}"`);let N=W||Z.metadata?.width,T=z||Z.metadata?.height;if(N)R.push(`width="${N}"`);if(T)R.push(`height="${T}"`);if(O)R.push(`class="${B0(O)}"`);if(F)R.push(`style="${B0(F)}"`);let M=` <source ${_?`data-src="${B0(H)}"`:`src="${B0(H)}"`} type="${V}" />`,E=`<video ${R.join(" ")}>
1158
1159
  ${M}
1159
1160
  Your browser does not support the video tag.
1160
1161
  </video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${B0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -1194,7 +1195,7 @@ ${E}
1194
1195
 
1195
1196
  observer.observe(video);
1196
1197
  })();
1197
- `.trim();let y;if(N)y=`
1198
+ `.trim();let y;if(A)y=`
1198
1199
  .stx-video-wrapper {
1199
1200
  position: relative;
1200
1201
  width: 100%;
@@ -1203,9 +1204,9 @@ ${E}
1203
1204
  width: 100%;
1204
1205
  height: auto;
1205
1206
  }
1206
- `.trim();return{html:E,script:k,css:y}}var s3=!1,a3=!0,t3="metadata",RX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var Z6=C(()=>{E$()});function Y6(){return M5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,Y)=>{let{src:Q,options:X}=kX($,Z,J);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:X.poster,controls:X.controls!==!1,autoplay:X.autoplay||!1,muted:X.muted||!1,loop:X.loop||!1,preload:X.preload||"metadata",playsinline:X.playsinline!==!1,lazy:X.lazy!==!1,player:X.player||"native",type:X.type,width:X.width,height:X.height,class:X.class,style:X.style,id:X.id,crossorigin:X.crossorigin,disablePictureInPicture:X.disablePictureInPicture,disableRemotePlayback:X.disableRemotePlayback,title:X.title,quality:X.quality,platform:X.platform,process:X.process,generatePoster:X.generatePoster,streaming:X.streaming,transcode:X.transcode,spriteSheet:X.spriteSheet,waveform:X.waveform},q={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},_=await n5(G,q),W=_.html;if(_.css)W+=`
1207
+ `.trim();return{html:E,script:k,css:y}}var s3=!1,a3=!0,t3="metadata",MX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var Z6=C(()=>{E$()});function Y6(){return M5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,Y)=>{let{src:Q,options:X}=yX($,Z,J);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:X.poster,controls:X.controls!==!1,autoplay:X.autoplay||!1,muted:X.muted||!1,loop:X.loop||!1,preload:X.preload||"metadata",playsinline:X.playsinline!==!1,lazy:X.lazy!==!1,player:X.player||"native",type:X.type,width:X.width,height:X.height,class:X.class,style:X.style,id:X.id,crossorigin:X.crossorigin,disablePictureInPicture:X.disablePictureInPicture,disableRemotePlayback:X.disableRemotePlayback,title:X.title,quality:X.quality,platform:X.platform,process:X.process,generatePoster:X.generatePoster,streaming:X.streaming,transcode:X.transcode,spriteSheet:X.spriteSheet,waveform:X.waveform},q={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},_=await n5(G,q),W=_.html;if(_.css)W+=`
1207
1208
  <style>${_.css}</style>`;if(_.script)W+=`
1208
- <script>${_.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function kX($,Z,J){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let Y=$.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=bX(Y),X=J6(Q[0],J)||"",G={};if(Q[1]){let K=J6(Q[1],J);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:X,options:G}}function bX($){let Z=[],J="",Y=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!Y)Y=!0,Q=q;else if(q===Q)Y=!1,Q="";else J+=q;continue}if(!Y){if(q==="{")X++;if(q==="}")X--;if(q==="[")G++;if(q==="]")G--;if(q===","&&X===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function J6($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let Y=Z[J];if(Y!==void 0)return Y}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var D$;var E$=C(()=>{t9();Z6();D$=Y6()});function SX($,Z){let J=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1209
+ <script>${_.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function yX($,Z,J){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let Y=$.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=CX(Y),X=J6(Q[0],J)||"",G={};if(Q[1]){let K=J6(Q[1],J);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:X,options:G}}function CX($){let Z=[],J="",Y=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!Y)Y=!0,Q=q;else if(q===Q)Y=!1,Q="";else J+=q;continue}if(!Y){if(q==="{")X++;if(q==="}")X--;if(q==="[")G++;if(q==="]")G--;if(q===","&&X===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function J6($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let Y=Z[J];if(Y!==void 0)return Y}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var D$;var E$=C(()=>{t9();Z6();D$=Y6()});function PX($,Z){let J=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1209
1210
  ${$}
1210
1211
  </div>
1211
1212
  <script>
@@ -1250,7 +1251,7 @@ ${E}
1250
1251
  }
1251
1252
  }
1252
1253
  })();
1253
- </script>`}function yX($,Z){let J=Z.pwa?.updates,Y=J?.message||"A new version is available. Reload to update?",Q=J?.autoReload||!1,X=$.trim().length>0,G=`
1254
+ </script>`}function vX($,Z){let J=Z.pwa?.updates,Y=J?.message||"A new version is available. Reload to update?",Q=J?.autoReload||!1,X=$.trim().length>0,G=`
1254
1255
  <div class="stx-pwa-update-banner" style="
1255
1256
  position: fixed;
1256
1257
  bottom: 0;
@@ -1361,7 +1362,7 @@ else {
1361
1362
  // Also listen for custom event
1362
1363
  window.addEventListener('pwa-update-available', showUpdate);
1363
1364
  })();
1364
- </script>`}function CX($,Z){let J=$.trim().length>0,Y=`
1365
+ </script>`}function xX($,Z){let J=$.trim().length>0,Y=`
1365
1366
  <div class="stx-offline-indicator" style="
1366
1367
  position: fixed;
1367
1368
  top: 16px;
@@ -1422,7 +1423,7 @@ else {
1422
1423
  window.addEventListener('offline', updateStatus);
1423
1424
  updateStatus();
1424
1425
  })();
1425
- </script>`}function PX($,Z){let J=Z.pwa?.push,Y=J?.vapidPublicKey||"",Q=J?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
1426
+ </script>`}function fX($,Z){let J=Z.pwa?.push,Y=J?.vapidPublicKey||"",Q=J?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
1426
1427
  ${$}
1427
1428
  </div>
1428
1429
  <script>
@@ -1504,25 +1505,25 @@ catch (error) {
1504
1505
  init();
1505
1506
  }
1506
1507
  })();
1507
- </script>`}var vX,xX,fX,gX,X6;var Q6=C(()=>{vX={name:"pwa.installButton",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return SX($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},xX={name:"pwa.updatePrompt",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return yX($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},fX={name:"pwa.offlineIndicator",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return CX($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},gX={name:"pwa.pushSubscribe",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return PX($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},X6=[vX,xX,fX,gX]});function k$($){for(let[Z,J]of Object.entries(p))if(J===$)return Z;return}var p;var o5=C(()=>{p={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 hX(){return!1}function Z5(){return!hX()||process.env.STX_DEBUG==="true"}import dX from"path";function s5(){return{...b$}}function r5($){if(!b$.showRelativePaths||!$)return $;let Z=b$.baseDir||process.cwd();try{let J=dX.relative(Z,$);return J.startsWith("..")?$:J}catch{return $}}var mX,b$,a5,j1,t5;var e5=C(()=>{o5();mX={showRelativePaths:!1,enableAutoRecovery:Z5(),logRecoveryWarnings:!0},b$={...mX};a5=class a5 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,J,Y,Q,X,G){super($);this.code=Z;this.filePath=J;this.line=Y;this.column=Q;this.context=X;if(this.name="StxError",this.numericCode=G||p.EVALUATION_ERROR,this.filePath)this.filePath=r5(this.filePath)}};j1=class j1 extends a5{constructor($,Z,J,Y,Q,X){super($,"stx_RUNTIME_ERROR",Z,J,Y,Q,X||p.EVALUATION_ERROR);this.name="StxRuntimeError"}};t5=class t5 extends a5{isFatal=!0;constructor($,Z,J,Y,Q,X){super($,"stx_VALIDATION_ERROR",Z,J,Y,Q,X||p.DOM_API_VIOLATION);this.name="StxValidationError"}}});function K6($){let{type:Z,message:J,code:Y,filePath:Q,line:X,column:G,template:K,offset:q,snippet:_,suggestion:W,format:z="text"}=$,U=X,j=G;if(!U&&K&&q!==void 0){let H=nX(K,q);U=H.line,j=H.column}let B=Q?r5(Q):void 0,O=Y?k$(Y):void 0,F={type:Z,code:Y,codeName:O,message:J,filePath:B,line:U,column:j,snippet:_,suggestion:W,timestamp:new Date().toISOString()},L;switch(z){case"html":L=pX(F);break;case"json":L=JSON.stringify(F,null,2);break;case"console":L=lX(F,K,q);break;case"text":default:L=uX(F,K,q);break}return{formatted:L,data:F}}function uX($,Z,J){let Y=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(Y.push(`[${$.type} Error${Q}]`),$.filePath){let X=$.filePath;if($.line){if(X+=`:${$.line}`,$.column)X+=`:${$.column}`}Y.push(`at ${X}`)}if(Y.push(`
1508
- ${$.message}`),Z&&$.line){let X=cX(Z,$.line,2);if(X)Y.push(`
1508
+ </script>`}var gX,hX,dX,mX,X6;var Q6=C(()=>{gX={name:"pwa.installButton",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return PX($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},hX={name:"pwa.updatePrompt",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return vX($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},dX={name:"pwa.offlineIndicator",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return xX($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},mX={name:"pwa.pushSubscribe",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return fX($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},X6=[gX,hX,dX,mX]});function k$($){for(let[Z,J]of Object.entries(p))if(J===$)return Z;return}var p;var o5=C(()=>{p={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 uX(){return!1}function Z5(){return!uX()||process.env.STX_DEBUG==="true"}import pX from"path";function s5(){return{...b$}}function r5($){if(!b$.showRelativePaths||!$)return $;let Z=b$.baseDir||process.cwd();try{let J=pX.relative(Z,$);return J.startsWith("..")?$:J}catch{return $}}var lX,b$,a5,j1,t5;var e5=C(()=>{o5();lX={showRelativePaths:!1,enableAutoRecovery:Z5(),logRecoveryWarnings:!0},b$={...lX};a5=class a5 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,J,Y,Q,X,G){super($);this.code=Z;this.filePath=J;this.line=Y;this.column=Q;this.context=X;if(this.name="StxError",this.numericCode=G||p.EVALUATION_ERROR,this.filePath)this.filePath=r5(this.filePath)}};j1=class j1 extends a5{constructor($,Z,J,Y,Q,X){super($,"stx_RUNTIME_ERROR",Z,J,Y,Q,X||p.EVALUATION_ERROR);this.name="StxRuntimeError"}};t5=class t5 extends a5{isFatal=!0;constructor($,Z,J,Y,Q,X){super($,"stx_VALIDATION_ERROR",Z,J,Y,Q,X||p.DOM_API_VIOLATION);this.name="StxValidationError"}}});function K6($){let{type:Z,message:J,code:Y,filePath:Q,line:X,column:G,template:K,offset:q,snippet:_,suggestion:W,format:z="text"}=$,U=X,j=G;if(!U&&K&&q!==void 0){let H=rX(K,q);U=H.line,j=H.column}let B=Q?r5(Q):void 0,O=Y?k$(Y):void 0,F={type:Z,code:Y,codeName:O,message:J,filePath:B,line:U,column:j,snippet:_,suggestion:W,timestamp:new Date().toISOString()},L;switch(z){case"html":L=iX(F);break;case"json":L=JSON.stringify(F,null,2);break;case"console":L=nX(F,K,q);break;case"text":default:L=cX(F,K,q);break}return{formatted:L,data:F}}function cX($,Z,J){let Y=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(Y.push(`[${$.type} Error${Q}]`),$.filePath){let X=$.filePath;if($.line){if(X+=`:${$.line}`,$.column)X+=`:${$.column}`}Y.push(`at ${X}`)}if(Y.push(`
1509
+ ${$.message}`),Z&&$.line){let X=oX(Z,$.line,2);if(X)Y.push(`
1509
1510
  ${X}`)}if($.snippet)Y.push(`
1510
1511
  Snippet: ${$.snippet}`);if($.suggestion)Y.push(`
1511
- Suggestion: ${$.suggestion}`);return Y.join(" ")}function pX($){let Z=$.code?` [${$.code}]`:"",J=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",Y=`<!-- [${$.type} Error${Z}]${J}: ${G6($.message)}`;if($.suggestion)Y+=` | Suggestion: ${G6($.suggestion)}`;return Y+=" -->",Y}function lX($,Z,J){let _=[],W=$.code?` [${$.codeName||$.code}]`:"";if(_.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${W} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}_.push(`
1512
+ Suggestion: ${$.suggestion}`);return Y.join(" ")}function iX($){let Z=$.code?` [${$.code}]`:"",J=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",Y=`<!-- [${$.type} Error${Z}]${J}: ${G6($.message)}`;if($.suggestion)Y+=` | Suggestion: ${G6($.suggestion)}`;return Y+=" -->",Y}function nX($,Z,J){let _=[],W=$.code?` [${$.codeName||$.code}]`:"";if(_.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${W} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}_.push(`
1512
1513
  \x1B[90mat\x1B[0m ${z}`)}if(_.push(`
1513
1514
 
1514
- ${$.message}`),Z&&$.line){let z=iX(Z,$.line,2);if(z)_.push(`
1515
+ ${$.message}`),Z&&$.line){let z=sX(Z,$.line,2);if(z)_.push(`
1515
1516
 
1516
1517
  \x1B[90mContext:\x1B[0m
1517
1518
  ${z}`)}if($.suggestion)_.push(`
1518
1519
 
1519
1520
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return _.push(`
1520
- ${"\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"}`),_.join("")}function cX($,Z,J){let Y=$.split(`
1521
+ ${"\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"}`),_.join("")}function oX($,Z,J){let Y=$.split(`
1521
1522
  `),Q=Math.max(0,Z-J-1),X=Math.min(Y.length-1,Z+J-1),G=[];for(let K=Q;K<=X;K++){let q=(K+1).toString().padStart(4),_=K===Z-1?">":" ";G.push(`${_}${q} | ${Y[K]}`)}return G.join(`
1522
- `)}function iX($,Z,J){let Y=$.split(`
1523
+ `)}function sX($,Z,J){let Y=$.split(`
1523
1524
  `),Q=Math.max(0,Z-J-1),X=Math.min(Y.length-1,Z+J-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",_=[];for(let W=Q;W<=X;W++){let z=(W+1).toString().padStart(4),U=W===Z-1,j=U?"\x1B[31m>\x1B[0m":" ",B=U?`\x1B[31m${Y[W]}\x1B[0m`:`\x1B[90m${Y[W]}\x1B[0m`;_.push(`${j}\x1B[90m${z}\x1B[0m | ${B}`)}return _.join(`
1524
- `)}function G6($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function nX($,Z){let Y=$.substring(0,Z).split(`
1525
- `);return{line:Y.length,column:Y[Y.length-1].length}}function s($,Z,J){return K6({type:$,message:Z,code:J,format:"html"}).formatted}async function E1($,Z,J){try{return await $()}catch(Y){if(J&&Y instanceof Error)J(Y);return Z}}var q6=C(()=>{o5();e5()});class y${errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,J="error"){let Y={timestamp:new Date,error:$,context:Z,level:J};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(J))this.writeToFile(Y)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
1525
+ `)}function G6($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function rX($,Z){let Y=$.substring(0,Z).split(`
1526
+ `);return{line:Y.length,column:Y[Y.length-1].length}}function s($,Z,J){return K6({type:$,message:Z,code:J,format:"html"}).formatted}async function b1($,Z,J){try{return await $()}catch(Y){if(J&&Y instanceof Error)J(Y);return Z}}var q6=C(()=>{o5();e5()});class y${errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,J="error"){let Y={timestamp:new Date,error:$,context:Z,level:J};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(J))this.writeToFile(Y)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
1526
1527
  `).slice(1).join(`
1527
1528
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
1528
1529
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(Y))Z.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded(Z);let Q=`${this.formatEntry($)}
@@ -1533,25 +1534,25 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
1533
1534
  `)}}});var _6=()=>{};var z6=C(()=>{o5();q6();W6();_6();e5()});var c0=C(()=>{z6()});function U6($,Z,J,Y){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,_)=>{if(!_&&q.includes(":")){let W=q.split(":"),z=q,U=W.length>1?W[1]:"";if(U&&Z[U])_=Z[U];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[W[1]])_=Z.openGraph[W[1]];else _="";return _?`<meta property="${m(z)}" content="${m(_)}">`:""}return _?`<meta name="${m(q)}" content="${m(_)}">`:""});let X=/@metaTag\s*\(/g,G;while((G=X.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,_=1,W=q+1;while(W<Q.length&&_>0){if(Q[W]==="(")_++;else if(Q[W]===")"){if(_--,_===0)break}W++}if(_!==0)break;let z=Q.substring(q+1,W).trim(),U=W+1,j=(()=>{try{let B=O0(z,Z);if(!B)return"";let O="<meta";if(B.name)O+=` name="${m(String(B.name))}"`;if(B.property)O+=` property="${m(String(B.property))}"`;if(B.httpEquiv)O+=` http-equiv="${m(String(B.httpEquiv))}"`;if(B.content)O+=` content="${m(String(B.content))}"`;return O+=">",O}catch(B){let O=B instanceof Error?B.message:String(B);return s("MetaTag",O,p.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+j+Q.substring(U),X.lastIndex=0}return Q}function B6($,Z,J){let Y=$,Q=/@structuredData\s*\(/g,X;while((X=Q.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,q=1,_=K+1;while(_<Y.length&&q>0){if(Y[_]==="(")q++;else if(Y[_]===")"){if(q--,q===0)break}_++}if(q!==0)break;let W=Y.substring(K+1,_).trim(),z=_+1,U=(()=>{try{let j=O0(W,Z);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let B=j instanceof Error?j.message:String(j);return s("StructuredData",B,p.EVALUATION_ERROR)}})();Y=Y.substring(0,G)+U+Y.substring(z),Q.lastIndex=0}return Y}function j6($,Z,J,Y){let Q=$,X=/@seo\s*\(\s*\{/g,G;while((G=X.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,_=K+1,W=null,z=!1;while(_<Q.length&&q>0){let L=Q[_];if(z){z=!1,_++;continue}if(L==="\\"&&W){z=!0,_++;continue}if(W){if(L===W)W=null;_++;continue}if(L==='"'||L==="'"||L==="`"){W=L,_++;continue}if(L==="{")q++;else if(L==="}")q--;_++}if(q!==0)break;let U=Q.substring(_).match(/^\s*\)/);if(!U)break;let j=_+U[0].length,B=Q.substring(K,_),O=Q.substring(G.index,j),F=((L)=>{try{let H=O0(L,Z);if(!H)return"";let V="";if(H.title)V+=`<title>${m(H.title)}</title>
1534
1535
  `,V+=`<meta name="title" content="${m(H.title)}">
1535
1536
  `;if(H.description)V+=`<meta name="description" content="${m(H.description)}">
1536
- `;if(H.keywords){let N=Array.isArray(H.keywords)?H.keywords.join(", "):H.keywords;V+=`<meta name="keywords" content="${m(N)}">
1537
+ `;if(H.keywords){let A=Array.isArray(H.keywords)?H.keywords.join(", "):H.keywords;V+=`<meta name="keywords" content="${m(A)}">
1537
1538
  `}if(H.robots)V+=`<meta name="robots" content="${m(H.robots)}">
1538
1539
  `;if(H.canonical)V+=`<link rel="canonical" href="${m(H.canonical)}">
1539
- `;if(H.openGraph){let N=H.openGraph;if(V+=`<meta property="og:type" content="${m(N.type||"website")}">
1540
- `,N.title||H.title){let w=N.title||H.title||"";V+=`<meta property="og:title" content="${m(w)}">
1541
- `}if(N.description||H.description){let w=N.description||H.description||"";V+=`<meta property="og:description" content="${m(w)}">
1542
- `}if(N.url||H.canonical){let w=N.url||H.canonical||"";V+=`<meta property="og:url" content="${m(w)}">
1543
- `}if(N.image){if(V+=`<meta property="og:image" content="${m(N.image)}">
1544
- `,N.imageAlt)V+=`<meta property="og:image:alt" content="${m(N.imageAlt)}">
1545
- `;if(N.imageWidth)V+=`<meta property="og:image:width" content="${m(String(N.imageWidth))}">
1546
- `;if(N.imageHeight)V+=`<meta property="og:image:height" content="${m(String(N.imageHeight))}">
1547
- `}if(N.siteName)V+=`<meta property="og:site_name" content="${m(N.siteName)}">
1548
- `}if(H.twitter){let N=H.twitter;if(V+=`<meta name="twitter:card" content="${m(N.card||"summary_large_image")}">
1549
- `,N.title||H.title){let w=N.title||H.title||"";V+=`<meta name="twitter:title" content="${m(w)}">
1550
- `}if(N.description||H.description){let w=N.description||H.description||"";V+=`<meta name="twitter:description" content="${m(w)}">
1551
- `}if(N.image||H.openGraph&&H.openGraph.image){let w=N.image||(H.openGraph?H.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${m(w)}">
1552
- `}if(N.site)V+=`<meta name="twitter:site" content="${m(N.site)}">
1553
- `;if(N.creator)V+=`<meta name="twitter:creator" content="${m(N.creator)}">
1554
- `}if(H.structuredData){let N=JSON.stringify(H.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${N}</script>
1540
+ `;if(H.openGraph){let A=H.openGraph;if(V+=`<meta property="og:type" content="${m(A.type||"website")}">
1541
+ `,A.title||H.title){let w=A.title||H.title||"";V+=`<meta property="og:title" content="${m(w)}">
1542
+ `}if(A.description||H.description){let w=A.description||H.description||"";V+=`<meta property="og:description" content="${m(w)}">
1543
+ `}if(A.url||H.canonical){let w=A.url||H.canonical||"";V+=`<meta property="og:url" content="${m(w)}">
1544
+ `}if(A.image){if(V+=`<meta property="og:image" content="${m(A.image)}">
1545
+ `,A.imageAlt)V+=`<meta property="og:image:alt" content="${m(A.imageAlt)}">
1546
+ `;if(A.imageWidth)V+=`<meta property="og:image:width" content="${m(String(A.imageWidth))}">
1547
+ `;if(A.imageHeight)V+=`<meta property="og:image:height" content="${m(String(A.imageHeight))}">
1548
+ `}if(A.siteName)V+=`<meta property="og:site_name" content="${m(A.siteName)}">
1549
+ `}if(H.twitter){let A=H.twitter;if(V+=`<meta name="twitter:card" content="${m(A.card||"summary_large_image")}">
1550
+ `,A.title||H.title){let w=A.title||H.title||"";V+=`<meta name="twitter:title" content="${m(w)}">
1551
+ `}if(A.description||H.description){let w=A.description||H.description||"";V+=`<meta name="twitter:description" content="${m(w)}">
1552
+ `}if(A.image||H.openGraph&&H.openGraph.image){let w=A.image||(H.openGraph?H.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${m(w)}">
1553
+ `}if(A.site)V+=`<meta name="twitter:site" content="${m(A.site)}">
1554
+ `;if(A.creator)V+=`<meta name="twitter:creator" content="${m(A.creator)}">
1555
+ `}if(H.structuredData){let A=JSON.stringify(H.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${A}</script>
1555
1556
  `}return V.trim()}catch(H){let V=H instanceof Error?H.message:String(H);return s("SEO",`Error processing @seo directive: ${V}`,p.EVALUATION_ERROR)}})(B);Q=Q.substring(0,G.index)+F+Q.substring(j),X.lastIndex=G.index+F.length}return Q}function O6($,Z,J){if(J.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||J.skipDefaultSeoTags===!0)return $;let Y=Z.__stx_runtime_head;if(!!(Y?.title||Y?.meta?.some((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(J.seo?.defaultConfig?.title)G=J.seo.defaultConfig.title;else G=J.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(J.seo?.defaultConfig?.description)K=J.seo.defaultConfig.description;else K=J.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(J.seo?.defaultImage)q=J.seo.defaultImage;else if(J.defaultImage)q=J.defaultImage;let _=`
1556
1557
  <!-- stx SEO Tags -->
1557
1558
  <meta name="title" content="${m(G)}">
@@ -1568,7 +1569,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
1568
1569
  `;let W=$;if(!X)W=W.replace(/<head[^>]*>/,`$&
1569
1570
  <title>${m(G)}</title>`);return W.replace(/<head[^>]*>/,`$&
1570
1571
  ${_}
1571
- `)}function m($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var H6,L6;var P$=C(()=>{c0();N0();H6={name:"meta",handler:($,Z,J,Y)=>{if(Z.length<1)return s("Meta","meta directive requires at least the meta name",p.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${m(Q)}" content="${m(X)}">`},hasEndTag:!1},L6={name:"structuredData",handler:($,Z,J,Y)=>{if($.trim()==="")return s("StructuredData","structuredData directive requires JSON-LD content",p.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return s("StructuredData","structuredData requires @type property",p.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let X=Q instanceof Error?Q.message:String(Q);return s("StructuredData",X,p.EVALUATION_ERROR)}},hasEndTag:!0}});import Y5 from"path";function oX($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=J?J[1].trim():"",Q=Z,X=[],G=!0;if(Y){let z=Y.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let U=z[1],j=U.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Q=j[1];let B=U.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)X=B[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let O=U.match(/shadowDOM\s*:\s*(true|false)/);if(O)G=O[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",_=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=_?_[1].trim():"";return{tag:Q,props:X,template:q,styles:W,script:Y,shadowDOM:G}}function sX($){let{tag:Z,props:J,template:Y,styles:Q,shadowDOM:X}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),_=J.map((z)=>`'${z}'`).join(", "),W=J.map((z)=>`
1572
+ `)}function m($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var H6,L6;var P$=C(()=>{c0();A0();H6={name:"meta",handler:($,Z,J,Y)=>{if(Z.length<1)return s("Meta","meta directive requires at least the meta name",p.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${m(Q)}" content="${m(X)}">`},hasEndTag:!1},L6={name:"structuredData",handler:($,Z,J,Y)=>{if($.trim()==="")return s("StructuredData","structuredData directive requires JSON-LD content",p.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return s("StructuredData","structuredData requires @type property",p.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let X=Q instanceof Error?Q.message:String(Q);return s("StructuredData",X,p.EVALUATION_ERROR)}},hasEndTag:!0}});import Y5 from"path";function aX($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=J?J[1].trim():"",Q=Z,X=[],G=!0;if(Y){let z=Y.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let U=z[1],j=U.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Q=j[1];let B=U.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)X=B[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let O=U.match(/shadowDOM\s*:\s*(true|false)/);if(O)G=O[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",_=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=_?_[1].trim():"";return{tag:Q,props:X,template:q,styles:W,script:Y,shadowDOM:G}}function tX($){let{tag:Z,props:J,template:Y,styles:Q,shadowDOM:X}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),_=J.map((z)=>`'${z}'`).join(", "),W=J.map((z)=>`
1572
1573
  get ${z}() {
1573
1574
  return this.getAttribute('${z}') || '';
1574
1575
  }
@@ -1619,16 +1620,16 @@ ${W}
1619
1620
  }
1620
1621
 
1621
1622
  customElements.define('${Z}', ${G});
1622
- `}async function F6($,Z,J,Y){if(Z.length<1)return s("WebComponent","@webcomponent directive requires at least the tag name parameter",p.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",K=[Y5.join(Y5.dirname(Y),G,`${Q}.stx`),Y5.join(process.cwd(),G,`${Q}.stx`),Y5.join(Y5.dirname(Y),`${Q}.stx`)],q=null;for(let z of K)if(await i(z)){q=await Bun.file(z).text();break}if(!q)return s("WebComponent",`Component file not found: ${Q}.stx`,p.FILE_NOT_FOUND);let _=oX(q,Q);return`<script type="module">
1623
- ${sX(_)}
1624
- </script>`}var V6=C(()=>{c0();F0()});var w6={};r(w6,{timingPlugin:()=>$Q,pluginManager:()=>rX,definePlugin:()=>$9,debugPlugin:()=>eX,createVariablesPlugin:()=>ZQ,createFilterPlugin:()=>tX,createDirectivePlugin:()=>aX,PluginManager:()=>v$});function $9($){return $}class v${plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let J of $.dependencies)if(!this.plugins.has(J))throw Error(`Plugin "${$.name}" depends on "${J}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[J,Y]of this.plugins)if(Y.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${J}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let J=await Z.onError($);if(J){if(J.template!==void 0)$.template=J.template;if(J.context)$.context={...$.context,...J.context};if(J.metadata)$.metadata={...$.metadata,...J.metadata};if(J.skip)return $}}catch(J){console.error(`Error in plugin "${Z.name}" onError hook:`,J)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let J={...Z};for(let Y of this.sortedPlugins){let Q=Y[$];if(Q)try{let X=await Q(J);if(X){if(X.template!==void 0)J.template=X.template;if(X.context)J.context={...J.context,...X.context};if(X.metadata)J.metadata={...J.metadata,...X.metadata};if(X.skip)break}}catch(X){console.error(`Error in plugin "${Y.name}" ${$} hook:`,X)}}return J}async runDirectiveHooks($,Z,J){let Y={...J};for(let Q of this.sortedPlugins){let X=Q[$];if(X)try{let G=await X(Z,Y);if(G){if(G.template!==void 0)Y.template=G.template;if(G.context)Y.context={...Y.context,...G.context};if(G.metadata)Y.metadata={...Y.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return Y}}function aX($,Z,J={}){return{name:$,...J,registerDirectives:()=>Z}}function tX($,Z,J={}){return{name:$,...J,registerFilters:()=>Z}}function ZQ($){return $9({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var rX,eX,$Q;var N6=C(()=>{rX=new v$;eX=$9({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)}}),$Q=$9({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let J=performance.now()-Z;console.log(`[stx-timing] Processing took ${J.toFixed(2)}ms`)}}})});var A6={};r(A6,{validateConfig:()=>QQ,loadStxConfig:()=>O1,defineStxConfig:()=>XQ,defaultConfig:()=>f$,config:()=>g$});import x$ from"fs";import A0 from"path";import{loadConfigWithResult as YQ}from"bunfig";function JQ($,Z){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=A0.join(process.cwd(),"resources","views"),Q=A0.join(process.cwd(),"resources","layouts");if(x$.existsSync(Y)&&x$.existsSync(Q))return{root:"resources",pagesDir:"views"};let X=A0.join(process.cwd(),"resources","views","pages");if(x$.existsSync(X))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}async function O1($){if(!$){if(k1)return k1;if(Z9)return Z9}let Z=$?A0.resolve($):process.cwd(),J=R6.get(Z);if(J)return J;let Y=(async()=>{let X=(await YQ({name:"stx",alias:"ui",cwd:Z,defaultConfig:f$,verbose:!1})).config,G=JQ(X.root,X.pagesDir);if(X.root=G.root,X.pagesDir=G.pagesDir,X.root&&X.root!=="."){let K=X.root;if(X.partialsDir&&!A0.isAbsolute(X.partialsDir))X.partialsDir=A0.join(K,X.partialsDir);if(X.componentsDir&&!A0.isAbsolute(X.componentsDir))X.componentsDir=A0.join(K,X.componentsDir);if(X.layoutsDir&&!A0.isAbsolute(X.layoutsDir))X.layoutsDir=A0.join(K,X.layoutsDir)}if(X.plugins&&X.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (N6(),w6)),q=[],_=[];for(let W of X.plugins){let z=typeof W==="string"?W:W[0],U=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(z),B=A0.dirname(J0.resolve(z))}catch{let F=A0.resolve(process.cwd(),z);j=await import(F),B=A0.dirname(F)}let O=j.default||j;if(K.register(O,X),O.components){let F=A0.resolve(B,O.components);q.push(F)}if(O.pages){let F=A0.resolve(B,O.pages),L=U.path||"/";_.push({dir:F,prefix:L})}if(O.setup){let F={addDirective:(L)=>{X.customDirectives=X.customDirectives||[],X.customDirectives.push(L)},addRoute:(L,H)=>{X.apiRoutes=X.apiRoutes||{},X.apiRoutes[L]=H},addMiddleware:(L)=>{X.middleware=X.middleware||[],X.middleware.push(L)},pluginDir:B,config:X};await O.setup(U,F)}console.log(`[stx] Plugin loaded: ${O.name||z}`)}catch(j){console.warn(`[stx] Failed to load plugin ${z}:`,j.message)}}X._pluginComponentDirs=q,X._pluginPageDirs=_}return X})();if(R6.set(Z,Y),!$)Z9=Y,Y.then((Q)=>{k1=Q}).catch(()=>{});return Y}function XQ($){return $}function QQ($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((Y,Q)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((Y,Q)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,X)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${X}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(Q.strategy))Z.push({path:`pwa.routes[${X}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${X}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${X}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((X)=>!Y.includes(X)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var f$,k1=null,R6,Z9=null,g$;var J5=C(()=>{C9();P9();v9();x9();a9();C3();E$();Q6();P$();V6();f$={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,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:Q3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:F6,hasEndTag:!1,description:"Include a web component in the template"},G7,K7,H6,L6,q7,_7,z7,W7,O7,F7,y3,D$,...X6],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}};R6=new Map;g$=new Proxy(f$,{get($,Z){if(k1&&Z in k1)return k1[Z];if(!Z9)O1().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}})});var k6={};r(k6,{resetCssCache:()=>KQ,resetCrosswindCache:()=>qQ,rebuildCrosswindCSS:()=>WQ,loadCrosswindConfig:()=>m$,loadCrosswind:()=>d$,injectCrosswindCSS:()=>Q5,getCachedCSS:()=>_Q,generateCrosswindCSS:()=>E6,extractClassNames:()=>D6,buildCrosswindCSS:()=>I6});import T6 from"fs";import G0 from"path";async function M6($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function GQ(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",J=process.cwd();while(J!==G0.dirname(J))$.push(G0.join(J,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(G0.join(J,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(G0.join(J,"node_modules","@stacksjs","crosswind","dist","index.js")),J=G0.dirname(J);if(Z){let Y=[G0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function d$(){if(h$)return S1;h$=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of $){let Y=await M6(J);if(Y)return S1=Y,console.log(`${q0.green}[Crosswind]${q0.reset} CSS engine loaded`),S1}let Z=GQ();for(let J of Z)if(await Bun.file(J).exists()){let Y=await M6(J);if(Y)return S1=Y,console.log(`${q0.green}[Crosswind]${q0.reset} CSS engine loaded from ${G0.dirname(G0.dirname(J))}`),S1}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${q0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${q0.reset}`),console.warn(`${q0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${q0.reset}`),null}}function KQ(){Y9.clear()}function qQ(){S1=null,h$=!1,g0=null,X5="",Y9.clear()}async function m$($){try{let{loadConfigWithResult:Z}=await import("bunfig"),J=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!J?.path||!J.config||Object.keys(J.config).length===0)return null;let Y=G0.relative($,J.path);return console.log(`${q0.green}[Crosswind]${q0.reset} Loaded config from ${Y||J.path}`),J.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${q0.yellow}[Crosswind]${q0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function I6($){if(b1)return X5;b1=!0;try{let Z=await d$();if(!Z||!Z.build)return b1=!1,"";if(!g0)g0=await m$($);if(!g0)return b1=!1,"";let J=Z.defaultConfig?.theme||{},Y=g0.theme||{},Q={...Z.defaultConfig,...g0,theme:{...J,...Y,extend:{...J.extend||{},...Y.extend||{}}}},X=performance.now(),G=await Z.build(Q),K=performance.now()-X;if(X5=G.css,console.log(`${q0.cyan}[Crosswind]${q0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),Q.output){let q=G0.isAbsolute(Q.output)?Q.output:G0.join($,Q.output),_=G0.dirname(q);if(!T6.existsSync(_))T6.mkdirSync(_,{recursive:!0});await Bun.write(q,G.css)}return b1=!1,G.css}catch(Z){return console.error(`${q0.red}[Crosswind]${q0.reset} Build error:`,Z),b1=!1,X5}}async function WQ($){g0=null,await I6($)}function _Q(){return X5}function D6($){let Z=new Set,J=/class\s*=\s*["']([^"']+)["']/gi,Y=J.exec($);while(Y!==null){for(let G of Y[1].split(/\s+/))if(G.trim())Z.add(G.trim());Y=J.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,X=Q.exec($);while(X!==null){let G=X[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}X=Q.exec($)}return Z}async function E6($,Z){try{let J=await d$();if(!J)return"";let Y=D6($);if(Y.size===0)return"";let Q=[...Y].sort().join(" "),X=Y9.get(Q);if(X!==void 0)return X;let G=Z?G0.resolve(Z):process.cwd();if(!g0){let V=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (J5(),A6)),w=await N(G);if(w.css)if(typeof w.css==="string"){let R=G0.isAbsolute(w.css)?w.css:G0.resolve(G,w.css);if(await Bun.file(R).exists()){let A=await import(R);V=A.default||A,console.log(`${q0.green}[Crosswind]${q0.reset} Loaded config from stx.config.ts \u2192 ${w.css}`)}}else{if(V={content:w.css.content||[],preflight:w.css.preflight??!0,minify:w.css.minify??!1},w.css.config){let R=G0.isAbsolute(w.css.config)?w.css.config:G0.resolve(G,w.css.config);if(await Bun.file(R).exists()){let A=await import(R);V={...A.default||A,...V}}}console.log(`${q0.green}[Crosswind]${q0.reset} Using inline CSS config from stx.config.ts`)}}catch{}g0=V||await m$(G)}let K=J.defaultConfig||J.config,q=g0||{},_=K.theme||{},z=(q.theme||{}).extend||{},U={..._};if(Object.keys(z).length>0)U.extend=z;let j=[...K.safelist||[],...q.safelist||[]],B={...K,...q,content:[],output:"",preflight:!0,minify:!1,theme:U,safelist:j},O=new J.CSSGenerator(B);for(let V of j)O.generate(V);for(let V of Y)O.generate(V);let F=O.toCSS(!0,!1),L=B.shortcuts||q.shortcuts||{};for(let[V,N]of Object.entries(L)){if(!Y.has(V)&&!j.includes(V))continue;let w=N.split(/\s+/).filter(Boolean);for(let R of w)O.generate(R)}F=O.toCSS(!0,!1);let H=F.split(`
1625
- `);for(let[V,N]of Object.entries(L)){if(!Y.has(V)&&!j.includes(V))continue;let w=N.split(/\s+/).filter(Boolean),R=[],A=[];for(let T of w){let I=T.startsWith("dark:"),k=`.${(I?T.slice(5):T).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<H.length;y++){let S=H[y].trim();if(S===`${k} {`||S.startsWith(`${k} {`)){let b=y,D="";while(b<H.length){if(D+=H[b],H[b].includes("}"))break;b++}let x=D.match(/\{([^}]+)\}/);if(x)if(I)A.push(x[1].trim());else R.push(x[1].trim());break}}}if(R.length)F+=`
1626
- .${V} { ${R.join(" ")} }`;if(A.length)F+=`
1627
- @media (prefers-color-scheme: dark) { .dark .${V} { ${A.join(" ")} } }`}return Y9.set(Q,F),F}catch(J){return console.warn("Failed to generate Crosswind CSS:",J),""}}async function Q5($,Z){if($.includes('data-crosswind="generated"'))return $;let J=await E6($,Z);if(!J)return $;let Y=`<style data-crosswind="generated">
1623
+ `}async function F6($,Z,J,Y){if(Z.length<1)return s("WebComponent","@webcomponent directive requires at least the tag name parameter",p.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",K=[Y5.join(Y5.dirname(Y),G,`${Q}.stx`),Y5.join(process.cwd(),G,`${Q}.stx`),Y5.join(Y5.dirname(Y),`${Q}.stx`)],q=null;for(let z of K)if(await i(z)){q=await Bun.file(z).text();break}if(!q)return s("WebComponent",`Component file not found: ${Q}.stx`,p.FILE_NOT_FOUND);let _=aX(q,Q);return`<script type="module">
1624
+ ${tX(_)}
1625
+ </script>`}var V6=C(()=>{c0();F0()});var w6={};r(w6,{timingPlugin:()=>JQ,pluginManager:()=>eX,definePlugin:()=>$9,debugPlugin:()=>YQ,createVariablesPlugin:()=>XQ,createFilterPlugin:()=>ZQ,createDirectivePlugin:()=>$Q,PluginManager:()=>v$});function $9($){return $}class v${plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let J of $.dependencies)if(!this.plugins.has(J))throw Error(`Plugin "${$.name}" depends on "${J}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[J,Y]of this.plugins)if(Y.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${J}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let J=await Z.onError($);if(J){if(J.template!==void 0)$.template=J.template;if(J.context)$.context={...$.context,...J.context};if(J.metadata)$.metadata={...$.metadata,...J.metadata};if(J.skip)return $}}catch(J){console.error(`Error in plugin "${Z.name}" onError hook:`,J)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let J={...Z};for(let Y of this.sortedPlugins){let Q=Y[$];if(Q)try{let X=await Q(J);if(X){if(X.template!==void 0)J.template=X.template;if(X.context)J.context={...J.context,...X.context};if(X.metadata)J.metadata={...J.metadata,...X.metadata};if(X.skip)break}}catch(X){console.error(`Error in plugin "${Y.name}" ${$} hook:`,X)}}return J}async runDirectiveHooks($,Z,J){let Y={...J};for(let Q of this.sortedPlugins){let X=Q[$];if(X)try{let G=await X(Z,Y);if(G){if(G.template!==void 0)Y.template=G.template;if(G.context)Y.context={...Y.context,...G.context};if(G.metadata)Y.metadata={...Y.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return Y}}function $Q($,Z,J={}){return{name:$,...J,registerDirectives:()=>Z}}function ZQ($,Z,J={}){return{name:$,...J,registerFilters:()=>Z}}function XQ($){return $9({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var eX,YQ,JQ;var A6=C(()=>{eX=new v$;YQ=$9({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)}}),JQ=$9({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let J=performance.now()-Z;console.log(`[stx-timing] Processing took ${J.toFixed(2)}ms`)}}})});var N6={};r(N6,{validateConfig:()=>qQ,loadStxConfig:()=>O1,defineStxConfig:()=>KQ,defaultConfig:()=>f$,config:()=>g$});import x$ from"fs";import N0 from"path";import{loadConfigWithResult as QQ}from"bunfig";function GQ($,Z){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=N0.join(process.cwd(),"resources","views"),Q=N0.join(process.cwd(),"resources","layouts");if(x$.existsSync(Y)&&x$.existsSync(Q))return{root:"resources",pagesDir:"views"};let X=N0.join(process.cwd(),"resources","views","pages");if(x$.existsSync(X))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}async function O1($){if(!$){if(S1)return S1;if(Z9)return Z9}let Z=$?N0.resolve($):process.cwd(),J=R6.get(Z);if(J)return J;let Y=(async()=>{let X=(await QQ({name:"stx",alias:"ui",cwd:Z,defaultConfig:f$,verbose:!1})).config,G=GQ(X.root,X.pagesDir);if(X.root=G.root,X.pagesDir=G.pagesDir,X.root&&X.root!=="."){let K=X.root;if(X.partialsDir&&!N0.isAbsolute(X.partialsDir))X.partialsDir=N0.join(K,X.partialsDir);if(X.componentsDir&&!N0.isAbsolute(X.componentsDir))X.componentsDir=N0.join(K,X.componentsDir);if(X.layoutsDir&&!N0.isAbsolute(X.layoutsDir))X.layoutsDir=N0.join(K,X.layoutsDir)}if(X.plugins&&X.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (A6(),w6)),q=[],_=[];for(let W of X.plugins){let z=typeof W==="string"?W:W[0],U=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(z),B=N0.dirname(J0.resolve(z))}catch{let F=N0.resolve(process.cwd(),z);j=await import(F),B=N0.dirname(F)}let O=j.default||j;if(K.register(O,X),O.components){let F=N0.resolve(B,O.components);q.push(F)}if(O.pages){let F=N0.resolve(B,O.pages),L=U.path||"/";_.push({dir:F,prefix:L})}if(O.setup){let F={addDirective:(L)=>{X.customDirectives=X.customDirectives||[],X.customDirectives.push(L)},addRoute:(L,H)=>{X.apiRoutes=X.apiRoutes||{},X.apiRoutes[L]=H},addMiddleware:(L)=>{X.middleware=X.middleware||[],X.middleware.push(L)},pluginDir:B,config:X};await O.setup(U,F)}console.log(`[stx] Plugin loaded: ${O.name||z}`)}catch(j){console.warn(`[stx] Failed to load plugin ${z}:`,j.message)}}X._pluginComponentDirs=q,X._pluginPageDirs=_}return X})();if(R6.set(Z,Y),!$)Z9=Y,Y.then((Q)=>{S1=Q}).catch(()=>{});return Y}function KQ($){return $}function qQ($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((Y,Q)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((Y,Q)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,X)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${X}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(Q.strategy))Z.push({path:`pwa.routes[${X}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${X}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${X}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((X)=>!Y.includes(X)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var f$,S1=null,R6,Z9=null,g$;var J5=C(()=>{C9();P9();v9();x9();a9();C3();E$();Q6();P$();V6();f$={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,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:Q3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:F6,hasEndTag:!1,description:"Include a web component in the template"},G7,K7,H6,L6,q7,_7,z7,W7,O7,F7,y3,D$,...X6],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}};R6=new Map;g$=new Proxy(f$,{get($,Z){if(S1&&Z in S1)return S1[Z];if(!Z9)O1().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}})});var k6={};r(k6,{resetCssCache:()=>_Q,resetCrosswindCache:()=>zQ,rebuildCrosswindCSS:()=>UQ,loadCrosswindConfig:()=>m$,loadCrosswind:()=>d$,injectCrosswindCSS:()=>Q5,getCachedCSS:()=>BQ,generateCrosswindCSS:()=>E6,extractClassNames:()=>D6,buildCrosswindCSS:()=>I6});import T6 from"fs";import G0 from"path";async function M6($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function WQ(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",J=process.cwd();while(J!==G0.dirname(J))$.push(G0.join(J,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(G0.join(J,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(G0.join(J,"node_modules","@stacksjs","crosswind","dist","index.js")),J=G0.dirname(J);if(Z){let Y=[G0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function d$(){if(h$)return C1;h$=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of $){let Y=await M6(J);if(Y)return C1=Y,console.log(`${q0.green}[Crosswind]${q0.reset} CSS engine loaded`),C1}let Z=WQ();for(let J of Z)if(await Bun.file(J).exists()){let Y=await M6(J);if(Y)return C1=Y,console.log(`${q0.green}[Crosswind]${q0.reset} CSS engine loaded from ${G0.dirname(G0.dirname(J))}`),C1}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${q0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${q0.reset}`),console.warn(`${q0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${q0.reset}`),null}}function _Q(){Y9.clear()}function zQ(){C1=null,h$=!1,g0=null,X5="",Y9.clear()}async function m$($){try{let{loadConfigWithResult:Z}=await import("bunfig"),J=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!J?.path||!J.config||Object.keys(J.config).length===0)return null;let Y=G0.relative($,J.path);return console.log(`${q0.green}[Crosswind]${q0.reset} Loaded config from ${Y||J.path}`),J.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${q0.yellow}[Crosswind]${q0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function I6($){if(y1)return X5;y1=!0;try{let Z=await d$();if(!Z||!Z.build)return y1=!1,"";if(!g0)g0=await m$($);if(!g0)return y1=!1,"";let J=Z.defaultConfig?.theme||{},Y=g0.theme||{},Q={...Z.defaultConfig,...g0,theme:{...J,...Y,extend:{...J.extend||{},...Y.extend||{}}}},X=performance.now(),G=await Z.build(Q),K=performance.now()-X;if(X5=G.css,console.log(`${q0.cyan}[Crosswind]${q0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),Q.output){let q=G0.isAbsolute(Q.output)?Q.output:G0.join($,Q.output),_=G0.dirname(q);if(!T6.existsSync(_))T6.mkdirSync(_,{recursive:!0});await Bun.write(q,G.css)}return y1=!1,G.css}catch(Z){return console.error(`${q0.red}[Crosswind]${q0.reset} Build error:`,Z),y1=!1,X5}}async function UQ($){g0=null,await I6($)}function BQ(){return X5}function D6($){let Z=new Set,J=/class\s*=\s*["']([^"']+)["']/gi,Y=J.exec($);while(Y!==null){for(let G of Y[1].split(/\s+/))if(G.trim())Z.add(G.trim());Y=J.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,X=Q.exec($);while(X!==null){let G=X[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}X=Q.exec($)}return Z}async function E6($,Z){try{let J=await d$();if(!J)return"";let Y=D6($);if(Y.size===0)return"";let Q=[...Y].sort().join(" "),X=Y9.get(Q);if(X!==void 0)return X;let G=Z?G0.resolve(Z):process.cwd();if(!g0){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (J5(),N6)),w=await A(G);if(w.css)if(typeof w.css==="string"){let R=G0.isAbsolute(w.css)?w.css:G0.resolve(G,w.css);if(await Bun.file(R).exists()){let N=await import(R);V=N.default||N,console.log(`${q0.green}[Crosswind]${q0.reset} Loaded config from stx.config.ts \u2192 ${w.css}`)}}else{if(V={content:w.css.content||[],preflight:w.css.preflight??!0,minify:w.css.minify??!1},w.css.config){let R=G0.isAbsolute(w.css.config)?w.css.config:G0.resolve(G,w.css.config);if(await Bun.file(R).exists()){let N=await import(R);V={...N.default||N,...V}}}console.log(`${q0.green}[Crosswind]${q0.reset} Using inline CSS config from stx.config.ts`)}}catch{}g0=V||await m$(G)}let K=J.defaultConfig||J.config,q=g0||{},_=K.theme||{},z=(q.theme||{}).extend||{},U={..._};if(Object.keys(z).length>0)U.extend=z;let j=[...K.safelist||[],...q.safelist||[]],B={...K,...q,content:[],output:"",preflight:!0,minify:!1,theme:U,safelist:j},O=new J.CSSGenerator(B);for(let V of j)O.generate(V);for(let V of Y)O.generate(V);let F=O.toCSS(!0,!1),L=B.shortcuts||q.shortcuts||{};for(let[V,A]of Object.entries(L)){if(!Y.has(V)&&!j.includes(V))continue;let w=A.split(/\s+/).filter(Boolean);for(let R of w)O.generate(R)}F=O.toCSS(!0,!1);let H=F.split(`
1626
+ `);for(let[V,A]of Object.entries(L)){if(!Y.has(V)&&!j.includes(V))continue;let w=A.split(/\s+/).filter(Boolean),R=[],N=[];for(let T of w){let I=T.startsWith("dark:"),k=`.${(I?T.slice(5):T).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<H.length;y++){let S=H[y].trim();if(S===`${k} {`||S.startsWith(`${k} {`)){let b=y,D="";while(b<H.length){if(D+=H[b],H[b].includes("}"))break;b++}let x=D.match(/\{([^}]+)\}/);if(x)if(I)N.push(x[1].trim());else R.push(x[1].trim());break}}}if(R.length)F+=`
1627
+ .${V} { ${R.join(" ")} }`;if(N.length)F+=`
1628
+ @media (prefers-color-scheme: dark) { .dark .${V} { ${N.join(" ")} } }`}return Y9.set(Q,F),F}catch(J){return console.warn("Failed to generate Crosswind CSS:",J),""}}async function Q5($,Z){if($.includes('data-crosswind="generated"'))return $;let J=await E6($,Z);if(!J)return $;let Y=`<style data-crosswind="generated">
1628
1629
  ${J}
1629
1630
  </style>`;if($.includes("</head>"))return $.replace("</head>",`${Y}
1630
1631
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
1631
- ${Y}`);return Y+$}var S1=null,h$=!1,g0=null,X5="",b1=!1,Y9;var J9=C(()=>{X7();Y9=new Map});function b6(){return`
1632
+ ${Y}`);return Y+$}var C1=null,h$=!1,g0=null,X5="",y1=!1,Y9;var J9=C(()=>{X7();Y9=new Map});function b6(){return`
1632
1633
  // STX Lifecycle Runtime
1633
1634
  (function() {
1634
1635
  if (typeof window === 'undefined') return;
@@ -1973,7 +1974,7 @@ else {
1973
1974
 
1974
1975
  console.log('[stx] Lifecycle runtime initialized');
1975
1976
  })();
1976
- `}function u$($){return Symbol($)}var sU,rU,aU;var S6=C(()=>{sU=u$("theme"),rU=u$("router"),aU=u$("i18n")});import*as C6 from"crypto";function y6($){let Z=/\$(\w+)\./g,J=[],Y;while((Y=Z.exec($))!==null)if(!J.includes(Y[1]))J.push(Y[1]);return J}function zQ(){return`stx-${C6.randomBytes(4).toString("hex")}`}function UQ($){return/\$\w+\./.test($)}function BQ($){let Z=[],J=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(Y,(X,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return X;let _=[],W=!1,z=K,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(U)];for(let F of j){let L=F[0],H=F[1],V=F[2];if(UQ(V)){W=!0;let N=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(N){let w=N[1];if(_.push({attr:H,expr:w,fullMatch:L,originalAttr:H}),y6(w).forEach((A)=>J.add(A)),H==="text")z=z.replace(L,"");else if(H==="class")z=z.replace(L,'class=""');else if(H==="disabled"||H==="hidden")z=z.replace(L,"");else z=z.replace(L,`${H}=""`)}}}if(!W)return X;let B=z.match(/\bid\s*=\s*"([^"]+)"/),O;if(B)O=B[1];else O=zQ(),z=` id="${O}"${z}`;for(let F of _)Z.push({elementId:O,attribute:F.attr,expression:F.expr,stores:y6(F.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:J}}function jQ($,Z){if($.length===0)return"";let J=Array.from(Z),Y=`
1977
+ `}function u$($){return Symbol($)}var eU,$B,ZB;var S6=C(()=>{eU=u$("theme"),$B=u$("router"),ZB=u$("i18n")});import*as C6 from"crypto";function y6($){let Z=/\$(\w+)\./g,J=[],Y;while((Y=Z.exec($))!==null)if(!J.includes(Y[1]))J.push(Y[1]);return J}function jQ(){return`stx-${C6.randomBytes(4).toString("hex")}`}function OQ($){return/\$\w+\./.test($)}function HQ($){let Z=[],J=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(Y,(X,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return X;let _=[],W=!1,z=K,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(U)];for(let F of j){let L=F[0],H=F[1],V=F[2];if(OQ(V)){W=!0;let A=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(A){let w=A[1];if(_.push({attr:H,expr:w,fullMatch:L,originalAttr:H}),y6(w).forEach((N)=>J.add(N)),H==="text")z=z.replace(L,"");else if(H==="class")z=z.replace(L,'class=""');else if(H==="disabled"||H==="hidden")z=z.replace(L,"");else z=z.replace(L,`${H}=""`)}}}if(!W)return X;let B=z.match(/\bid\s*=\s*"([^"]+)"/),O;if(B)O=B[1];else O=jQ(),z=` id="${O}"${z}`;for(let F of _)Z.push({elementId:O,attribute:F.attr,expression:F.expr,stores:y6(F.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:J}}function LQ($,Z){if($.length===0)return"";let J=Array.from(Z),Y=`
1977
1978
  <script>
1978
1979
  (function() {
1979
1980
  'use strict';
@@ -2099,10 +2100,10 @@ else {
2099
2100
  }
2100
2101
  })();
2101
2102
  </script>
2102
- `,Y}function P6($){let{html:Z,bindings:J,stores:Y}=BQ($);if(J.length===0)return $;let Q=jQ(J,Y),X=Z.lastIndexOf("</body>");if(X!==-1)return Z.slice(0,X)+Q+Z.slice(X);return Z+Q}var v6=()=>{};function OQ($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return HQ(Z);case"google-analytics":return LQ(Z);case"plausible":return FQ(Z);case"self-hosted":return VQ(Z);case"custom":return wQ(Z);default:return""}}function HQ($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",Y=Z.defer!==!1?" defer":"",Q=[`data-site="${E0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${E0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
2103
+ `,Y}function P6($){let{html:Z,bindings:J,stores:Y}=HQ($);if(J.length===0)return $;let Q=LQ(J,Y),X=Z.lastIndexOf("</body>");if(X!==-1)return Z.slice(0,X)+Q+Z.slice(X);return Z+Q}var v6=()=>{};function FQ($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return VQ(Z);case"google-analytics":return wQ(Z);case"plausible":return AQ(Z);case"self-hosted":return RQ(Z);case"custom":return NQ(Z);default:return""}}function VQ($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",Y=Z.defer!==!1?" defer":"",Q=[`data-site="${E0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${E0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
2103
2104
  <!-- Fathom Analytics -->
2104
2105
  <script src="${E0(J)}" ${Q.join(" ")}${Y}></script>
2105
- `}function LQ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=E0(Z.measurementId),Y=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
2106
+ `}function wQ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=E0(Z.measurementId),Y=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
2106
2107
  <!-- Google Analytics -->
2107
2108
  <script async src="https://www.googletagmanager.com/gtag/js?id=${J}"></script>
2108
2109
  <script>
@@ -2112,10 +2113,10 @@ else {
2112
2113
  gtag('config', '${J}');
2113
2114
  ${Y}
2114
2115
  </script>
2115
- `}function FQ($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${E0(Z.domain)}"`],Q=J,X=[];if(Z.trackLocalhost)X.push("local");if(Z.hashMode)X.push("hash");if(X.length>0&&J==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${X.join(".")}.js`;return`
2116
+ `}function AQ($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${E0(Z.domain)}"`],Q=J,X=[];if(Z.trackLocalhost)X.push("local");if(Z.hashMode)X.push("hash");if(X.length>0&&J==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${X.join(".")}.js`;return`
2116
2117
  <!-- Plausible Analytics -->
2117
2118
  <script defer data-domain="${E0(Z.domain)}" src="${E0(Q)}"></script>
2118
- `}function VQ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=E0(Z.siteId),Y=E0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",X=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
2119
+ `}function RQ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=E0(Z.siteId),Y=E0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",X=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
2119
2120
  d.addEventListener('click',function(e){
2120
2121
  var a=e.target.closest('a');
2121
2122
  if(a&&a.hostname!==location.hostname){
@@ -2148,7 +2149,7 @@ else {
2148
2149
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
2149
2150
  })();
2150
2151
  </script>
2151
- `}function wQ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
2152
+ `}function NQ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
2152
2153
  <!-- Custom Analytics -->
2153
2154
  <script>
2154
2155
  ${Z.inlineScript}
@@ -2156,7 +2157,7 @@ ${Z.inlineScript}
2156
2157
  `;if(!Z.scriptUrl)return"";let J=[];if(Z.scriptId)J.push(`id="${E0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,X]of Object.entries(Z.attributes))J.push(`${E0(Q)}="${E0(X)}"`);return`
2157
2158
  <!-- Custom Analytics -->
2158
2159
  <script${J.length>0?` ${J.join(" ")}`:""} src="${E0(Z.scriptUrl)}" defer></script>
2159
- `}function x6($,Z){let J=OQ(Z);if(!J)return $;if(!$.includes("</head>")){let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+J+$.slice(Y);return $+J}return $.replace("</head>",`${J}</head>`)}function E0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var f6=()=>{};function d6($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let Y=J.toLowerCase();if(Y==="prevent")Z.prevent=!0;else if(Y==="stop")Z.stop=!0;else if(Y==="once")Z.once=!0;else if(Y==="capture")Z.capture=!0;else if(Y==="self")Z.self=!0;else if(Y==="passive")Z.passive=!0;else if(NQ.has(Y))Z.systemKeys.push(Y);else if(Y in m6)Z.mouse=Y;else if(Y in h6||/^[a-z]$/.test(Y))Z.keys.push(h6[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let Q=Y.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(Y.startsWith("throttle")){let Q=Y.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function u6($){let Z=[],J=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=Y.exec($))!==null){let[X,G,K]=Q,q=Q.index,_=q+X.length,W=`__stx_evt_${J++}`,z=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=U.exec(K))!==null){let[,O,F]=j,L=O.split("."),H=L[0];if(!g6.has(H))continue;z.push({attribute:`@${O}`,event:H,handler:F,modifiers:d6(L.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(K))!==null){let[,O,F]=j,L=O.split("."),H=L[0];if(!g6.has(H))continue;z.push({attribute:`@${O}`,event:H,handler:F,modifiers:d6(L.slice(1)),elementId:W})}if(z.length>0)Z.push({originalTag:X,elementId:W,events:z,startIndex:q,endIndex:_})}return Z}function RQ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let Y of J.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if(J.keys.length>0){let Y=J.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if(J.mouse!==null){let Y=m6[J.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function AQ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function TQ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=RQ($),Q=AQ($.handler,Z),X=[];if(Z.once)X.push("once: true");if(Z.capture)X.push("capture: true");if(Z.passive)X.push("passive: true");let G=X.length>0?`, { ${X.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2160
+ `}function x6($,Z){let J=FQ(Z);if(!J)return $;if(!$.includes("</head>")){let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+J+$.slice(Y);return $+J}return $.replace("</head>",`${J}</head>`)}function E0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var f6=()=>{};function d6($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let Y=J.toLowerCase();if(Y==="prevent")Z.prevent=!0;else if(Y==="stop")Z.stop=!0;else if(Y==="once")Z.once=!0;else if(Y==="capture")Z.capture=!0;else if(Y==="self")Z.self=!0;else if(Y==="passive")Z.passive=!0;else if(TQ.has(Y))Z.systemKeys.push(Y);else if(Y in m6)Z.mouse=Y;else if(Y in h6||/^[a-z]$/.test(Y))Z.keys.push(h6[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let Q=Y.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(Y.startsWith("throttle")){let Q=Y.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function u6($){let Z=[],J=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=Y.exec($))!==null){let[X,G,K]=Q,q=Q.index,_=q+X.length,W=`__stx_evt_${J++}`,z=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=U.exec(K))!==null){let[,O,F]=j,L=O.split("."),H=L[0];if(!g6.has(H))continue;z.push({attribute:`@${O}`,event:H,handler:F,modifiers:d6(L.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(K))!==null){let[,O,F]=j,L=O.split("."),H=L[0];if(!g6.has(H))continue;z.push({attribute:`@${O}`,event:H,handler:F,modifiers:d6(L.slice(1)),elementId:W})}if(z.length>0)Z.push({originalTag:X,elementId:W,events:z,startIndex:q,endIndex:_})}return Z}function MQ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let Y of J.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if(J.keys.length>0){let Y=J.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if(J.mouse!==null){let Y=m6[J.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function IQ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function DQ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=MQ($),Q=IQ($.handler,Z),X=[];if(Z.once)X.push("once: true");if(Z.capture)X.push("capture: true");if(Z.passive)X.push("passive: true");let G=X.length>0?`, { ${X.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2160
2161
  (function() {
2161
2162
  var $el = document.getElementById('${J}');
2162
2163
  if (!$el) return;
@@ -2210,7 +2211,7 @@ else {
2210
2211
  ${Q}
2211
2212
  }
2212
2213
  }${G});
2213
- })();`}function MQ($){if($.length===0)return"";return`
2214
+ })();`}function EQ($){if($.length===0)return"";return`
2214
2215
  <script data-stx-events>
2215
2216
  (function() {
2216
2217
  'use strict';
@@ -2238,11 +2239,11 @@ else {
2238
2239
  }
2239
2240
 
2240
2241
  // Event listeners
2241
- ${$.flatMap((J)=>J.events).map(TQ).join(`
2242
+ ${$.flatMap((J)=>J.events).map(DQ).join(`
2242
2243
  `)}
2243
2244
  })();
2244
- </script>`}function IQ($){let Z=u6($);if(Z.length===0)return{template:$,bindings:[]};let J=$,Y=[];for(let Q=Z.length-1;Q>=0;Q--){let X=Z[Q],G=X.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${X.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of X.events)q.elementId=K[1]}for(let K of X.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(_,""),G=G.replace(W,"")}J=J.slice(0,X.startIndex)+G+J.slice(X.endIndex),Y.push(...X.events)}return{template:J,bindings:Y}}function p6($,Z,J){if(/\b(?:state|derived|effect)\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:_}=IQ($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,..._],q}let Q=u6($);if(Q.length===0)return $;let X=$;for(let q=Q.length-1;q>=0;q--){let _=Q[q],W=_.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${_.elementId}"`);else{let z=W.match(/id=["']([^"']+)["']/);if(z)for(let U of _.events)U.elementId=z[1]}for(let z of _.events){let U=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");W=W.replace(j,""),W=W.replace(B,"")}X=X.slice(0,_.startIndex)+W+X.slice(_.endIndex)}let G=MQ(Q),K=X.lastIndexOf("</body>");if(K!==-1)X=X.slice(0,K)+G+`
2245
- `+X.slice(K);else X+=G;return X}var g6,h6,NQ,m6;var l6=C(()=>{g6=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"]),h6={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"},NQ=new Set(["ctrl","alt","shift","meta"]),m6={left:0,middle:1,right:2}});function X9($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function c6($,Z){let J=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(J)return J[1];let Y=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function EQ($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,X,G]=Y,K=Y.index,q=c6(G,"x-data");if(!q)continue;let _=`__stx_scope_${i6++}`,W=c6(G,"x-init"),z=kQ($,X,K+Q.length),U=$.slice(K,z.endIndex),j=bQ(U);Z.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:q,initExpr:W,bindings:[],refs:j})}return Z}function kQ($,Z,J){let Y=1,Q=J,X=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(Y>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=X.exec($),_=G.exec($),W=K.exec($);if(W&&W.index<(q?.index??1/0)){Q=W.index+W[0].length;continue}if(!_)return{endIndex:$.length};if(q&&q.index<_.index)Y++,Q=q.index+q[0].length;else{if(Y--,Y===0)return{endIndex:_.index+_[0].length};Q=_.index+_[0].length}}return{endIndex:$.length}}function bQ($){let Z=new Map,J=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=Y.exec(J))!==null){let[,X,G]=Q,K=SQ(X);Z.set(G,K)}return Z}function SQ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${DQ++}`}function yQ(){return`
2245
+ </script>`}function kQ($){let Z=u6($);if(Z.length===0)return{template:$,bindings:[]};let J=$,Y=[];for(let Q=Z.length-1;Q>=0;Q--){let X=Z[Q],G=X.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${X.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of X.events)q.elementId=K[1]}for(let K of X.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(_,""),G=G.replace(W,"")}J=J.slice(0,X.startIndex)+G+J.slice(X.endIndex),Y.push(...X.events)}return{template:J,bindings:Y}}function p6($,Z,J){if(/\b(?:state|derived|effect)\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:_}=kQ($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,..._],q}let Q=u6($);if(Q.length===0)return $;let X=$;for(let q=Q.length-1;q>=0;q--){let _=Q[q],W=_.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${_.elementId}"`);else{let z=W.match(/id=["']([^"']+)["']/);if(z)for(let U of _.events)U.elementId=z[1]}for(let z of _.events){let U=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");W=W.replace(j,""),W=W.replace(B,"")}X=X.slice(0,_.startIndex)+W+X.slice(_.endIndex)}let G=EQ(Q),K=X.lastIndexOf("</body>");if(K!==-1)X=X.slice(0,K)+G+`
2246
+ `+X.slice(K);else X+=G;return X}var g6,h6,TQ,m6;var l6=C(()=>{g6=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"]),h6={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"},TQ=new Set(["ctrl","alt","shift","meta"]),m6={left:0,middle:1,right:2}});function X9($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function c6($,Z){let J=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(J)return J[1];let Y=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function SQ($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,X,G]=Y,K=Y.index,q=c6(G,"x-data");if(!q)continue;let _=`__stx_scope_${i6++}`,W=c6(G,"x-init"),z=yQ($,X,K+Q.length),U=$.slice(K,z.endIndex),j=CQ(U);Z.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:q,initExpr:W,bindings:[],refs:j})}return Z}function yQ($,Z,J){let Y=1,Q=J,X=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(Y>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=X.exec($),_=G.exec($),W=K.exec($);if(W&&W.index<(q?.index??1/0)){Q=W.index+W[0].length;continue}if(!_)return{endIndex:$.length};if(q&&q.index<_.index)Y++,Q=q.index+q[0].length;else{if(Y--,Y===0)return{endIndex:_.index+_[0].length};Q=_.index+_[0].length}}return{endIndex:$.length}}function CQ($){let Z=new Map,J=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=Y.exec(J))!==null){let[,X,G]=Q,K=PQ(X);Z.set(G,K)}return Z}function PQ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${bQ++}`}function vQ(){return`
2246
2247
  // STX Reactive Runtime - x-cloak and transition CSS
2247
2248
  (function() {
2248
2249
  var style = document.createElement('style');
@@ -2446,7 +2447,7 @@ window.__stx_reactive = (function() {
2446
2447
 
2447
2448
  return { initScope: initScope, reactive: reactive };
2448
2449
  })();
2449
- `}function CQ($){if($.length===0)return"";let Z=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),Q=JSON.stringify(J.stateExpr),X=J.initExpr?JSON.stringify(J.initExpr):"null";return`
2450
+ `}function xQ($){if($.length===0)return"";let Z=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),Q=JSON.stringify(J.stateExpr),X=J.initExpr?JSON.stringify(J.initExpr):"null";return`
2450
2451
  (function() {
2451
2452
  var scopeEl = document.querySelector('${J.selector}');
2452
2453
  if (!scopeEl) return;
@@ -2455,20 +2456,24 @@ window.__stx_reactive = (function() {
2455
2456
  })();`}).join(`
2456
2457
  `);return`
2457
2458
  <script data-stx-scoped data-stx-reactive>
2458
- ${yQ()}
2459
+ ${vQ()}
2459
2460
  ${Z}
2460
- </script>`}function n6($,Z,J){if(i6=0,!vQ($))return $;let Y=EQ($);if(Y.length===0)return $;let Q=PQ($,Y),X=CQ(Y),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+X+`
2461
- `+Q.slice(G);else Q+=X;return Q}function PQ($,Z){let J=$;for(let Y of Z){let X=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${X9(Y.stateExpr)}["']`,"gi").exec(J);if(X)Y.id=X[1],Y.selector=`[data-stx-scope="${Y.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${X9(Y.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(J);if(K)Y.id=K[1],Y.selector=`[data-stx-scope="${Y.id}"]`;else J=J.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${X9(Y.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${Y.id}" $2$3$4`),J=J.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${X9(Y.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${Y.id}" $2$3$4`)}}return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),J=J.replace(/\s*x-init\s*=\s*'[^']*'/g,""),J}function vQ($){return/x-data\s*=\s*["']/.test($)}var i6=0,DQ=0;import xQ from"fs";import p$ from"path";import{createHighlighter as fQ}from"ts-syntax-highlighter";async function gQ($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let Y=(await xQ.promises.stat($)).mtime.getTime();if(Z.cache&&l$.has($)){let z=l$.get($);if(z.updatedAt>=Y)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:X,content:G}=w7(Q),K=Z.markdown||g$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=l1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await hQ(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:_,data:X||{}};if(Z.cache)l$.set($,{...W,updatedAt:Y});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let Y=J instanceof Error?J.message:String(J);return{content:Q0("Markdown File",`Error reading/parsing markdown file: ${Y}`,$,"",0,""),data:{}}}}async function hQ($,Z,J){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Q9)try{Q9=await fQ({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,_,W)=>{let z=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=_||(J?"text":"");if(!U)return K;try{if(!Q9.getSupportedLanguages().includes(U))return K;return(await Q9.highlight(z,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${_}:`,j)}return K},X=$,G=$.matchAll(Y);for(let K of G){let[q,_,W,z]=K,U=await Q(q,_,W,z);X=X.replace(q,U)}return X}async function o6($,Z,J="",Y={}){return await dQ($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,_)=>{try{let W=K;if(!p$.isAbsolute(K))W=p$.resolve(p$.dirname(J),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let H=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of H){let N=V.indexOf(":");if(N>0){let w=V.substring(0,N).trim(),R=V.substring(N+1).trim(),A=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(A||T)R=R.substring(1,R.length-1);z[w]=R}}}}catch(L){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:U,data:j}=await gQ(W,Y),B={...Z,...j,...z},O=U,F=/\{\{([^}]+)\}\}/g;return O=O.replace(F,(L,H)=>{let V=H.trim();return B[V]!==void 0?String(B[V]):L}),O}catch(W){let z=W instanceof Error?W.message:String(W);return Q0("Markdown File",`Error including markdown file: ${z}`,J,$,_,G)}})}async function dQ($,Z,J){let Y=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,_=Q;Y.push(J(..._).then((W)=>({match:K,replacement:W,index:q})))}let X=await Promise.all(Y);X.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of X)G=G.replace(K,()=>q);return G}var l$,Q9=null;var s6=C(()=>{J5();F0();l$=new Map});function a0($,Z){try{let J=$.trim();if(e(J))return $0(J,Object.keys(Z))(...Object.values(Z));else return X0(J,Z)}catch{return!1}}var r6=C(()=>{N0()});function t0($,Z){let J=mQ($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function mQ($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let Y=I0($,"(",")",J);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,Y),endPos:Y+1}}function H1($,Z,J,Y){let Q=1,X=Y,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${J}(?![a-z])`,"g");while(X<$.length&&Q>0){G.lastIndex=X,K.lastIndex=X;let q=G.exec($),_=K.exec($),W=q?q.index:1/0,z=_?_.index:1/0;if(W<z)Q++,X=W+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;X=z+_[0].length}else break}return-1}function a6($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let Y=Z+J[0].length,Q=t0($,Y);if(!Q)return null;let X=Q.endPos,G=H1($,"if","endif",X);if(G===-1)return null;let K=$.slice(X,G),q=[],_=0,W="if",z=Q.expression,U=0,j=0;while(_<K.length){let B=K.indexOf("@",_);if(B===-1)break;_=B;let O=K.substring(B);if(/^@if\s*\(/.test(O)){j++,_++;continue}if(/^@endif(?![a-z])/.test(O)){j--,_+=6;continue}if(j===0){let F=O.match(/^@elseif\s*/);if(F){q.push({type:W,condition:z,content:K.substring(U,_),start:X+U,end:X+_});let L=_+F[0].length,H=t0(K,L);if(!H){_++;continue}W="elseif",z=H.expression,_=H.endPos,U=_;continue}else if(/^@else(?![a-z])/.test(O)){q.push({type:W,condition:z,content:K.substring(U,_),start:X+U,end:X+_}),W="else",z=void 0,_+=5,U=_;continue}}_++}return q.push({type:W,condition:z,content:K.slice(U),start:X+U,end:X+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function c$($){let Z=[],J=/@if\s*\(/g,Y=J.exec($);while(Y!==null){if(Z.some((G)=>Y.index>G.start&&Y.index<G.end)){Y=J.exec($);continue}let X=a6($,Y.index);if(X)Z.push(X),J.lastIndex=X.end;Y=J.exec($)}return Z}function G9($,Z,J){let Y=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),X=Q.exec($);while(X!==null){if(Y.some((O)=>X.index>O.start&&X.index<O.end)){X=Q.exec($);continue}let K=X.index,q=K+X[0].length-1,_=I0($,"(",")",q);if(_===-1){X=Q.exec($);continue}let W=$.slice(q+1,_),z=_+1,U=H1($,Z,J,z);if(U===-1){X=Q.exec($);continue}let j=$.slice(z,U),B=U+`@${J}`.length;Y.push({fullMatch:$.slice(K,B),name:Z,params:W,content:j,start:K,end:B}),Q.lastIndex=B,X=Q.exec($)}return Y}function i$($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let Y=Z+J[0].length,Q=t0($,Y);if(!Q)return null;let X=Q.endPos,G=H1($,"switch","endswitch",X);if(G===-1)return null;let K=$.slice(X,G),q=[],_=0,W=null,z=0;while(_<K.length){let U=K.slice(_),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(z++,W)W.content+=j[0];_+=j[0].length;continue}if(B){if(z--,W)W.content+=B[0];_+=B[0].length;continue}if(z>0){if(W)W.content+=K[_];_++;continue}let O=U.match(/^@case\s*/),F=U.match(/^@default(?![a-z])/),L=U.match(/^@break(?![a-z])/);if(O&&U.startsWith("@case")){if(W)q.push(W);let H=_+O[0].length,V=t0(K,H);if(!V){_++;continue}W={type:"case",value:V.expression,content:""},_=V.endPos}else if(F&&U.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},_+=F[0].length}else if(L&&U.startsWith("@break"))_+=L[0].length;else{if(W)W.content+=K[_];_++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var t6=()=>{};var e6=()=>{};var n$=C(()=>{t6();e6()});function cQ($,Z,J){let Y=$,Q=!0;while(Q){Q=!1;let X=Y.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=i$(Y,G);if(!K)break;try{let q;if(e(K.expression))q=$0(K.expression,Object.keys(Z))(...Object.values(Z));else q=X0(K.expression,Z);let _="",W=!1;for(let z of K.cases)if(z.type==="default"){if(!W)_=z.content.trim()}else try{let U;if(z.value&&e(z.value))U=$0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)U=X0(z.value,Z);if(q===U){_=z.content.trim(),W=!0;break}}catch{continue}Y=Y.substring(0,G)+_+Y.substring(K.end),Q=!0}catch(q){let _=q instanceof Error?q.message:String(q),W=s("Switch",`Error evaluating @switch expression: ${_}`,p.EVALUATION_ERROR);Y=Y.substring(0,G)+W+Y.substring(K.end);break}}return Y}function y1($,Z,J){let Y=$;Y=cQ(Y,Z,J);{let X=!0;while(X){X=!1;let G=Y.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=t0(Y,K+7);if(!q)break;let _=q.endPos,W=H1(Y,"unless","endunless",_);if(W===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=Y.slice(_,W),U=q.expression,j=-1;{let O=0,F=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,H=/@else(?![a-z])/g,V=[],N;while((N=F.exec(z))!==null)V.push({pos:N.index,type:"open"});while((N=L.exec(z))!==null)V.push({pos:N.index,type:"close"});while((N=H.exec(z))!==null)V.push({pos:N.index,type:"else"});V.sort((w,R)=>w.pos-R.pos);for(let w of V)if(w.type==="open")O++;else if(w.type==="close")O--;else if(w.type==="else"&&O===0){j=w.pos;break}}let B;if(j!==-1){let O=z.slice(0,j),F=z.slice(j+5);B=`@if (${U})${F}@else ${O}@endif`}else B=`@if (!(${U}))${z}@endif`;Y=Y.substring(0,K)+B+Y.substring(W+10),X=!0}}Y=s$(Y,Z,J),Y=r$(Y,Z,J),Y=o$(Y,Z);let Q=()=>{let X=c$(Y);if(X.length===0)return!1;for(let G=X.length-1;G>=0;G--){let K=X[G];try{let q="",_=!1;for(let W of K.branches){if(_)break;if(W.type==="else")q=W.content,_=!0;else try{let z;if(W.condition&&e(W.condition))z=$0(W.condition,Object.keys(Z))(...Object.values(Z));else if(W.condition)z=X0(W.condition,Z);if(z)q=W.content,_=!0}catch(z){q=s(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${z instanceof Error?z.message:String(z)}`,p.EVALUATION_ERROR),_=!0}}Y=Y.substring(0,K.start)+q+Y.substring(K.end)}catch(q){let _=q instanceof Error?q.message:String(q),W=s("If",`Error processing @if block: ${_}`,p.EVALUATION_ERROR);Y=Y.substring(0,K.start)+W+Y.substring(K.end)}}return!0};while(Q());return Y}function $2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let Y=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){Y.push($[Z+1]),Z+=2;continue}if(Q===J){Z++;break}Y.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:Y.join(""),consumed:Z}}function o$($,Z){let J=$;function Y(K,q,_,W){let z=1,U=W,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${_}(?![a-z])`,"g");while(U<K.length&&z>0){j.lastIndex=U,B.lastIndex=U;let O=j.exec(K),F=B.exec(K),L=O?O.index:1/0,H=F?F.index:1/0;if(L<H)z++,U=L+O[0].length;else if(H<1/0){if(z--,z===0)return H;U=H+F[0].length}else break}return-1}function Q(K,q,_){let W=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${_}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],O;while((O=z.exec(K))!==null)B.push({pos:O.index,type:"open"});while((O=U.exec(K))!==null)B.push({pos:O.index,type:"close"});while((O=j.exec(K))!==null)B.push({pos:O.index,type:"else"});B.sort((F,L)=>F.pos-L.pos);for(let F of B)if(F.type==="open")W++;else if(F.type==="close")W--;else if(F.type==="else"&&W===0)return F.pos;return-1}{let K=!0;while(K){K=!1;let q=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,W,z,U=J.slice(_+5),j=$2(U);if(j)W=j.value,z=_+5+j.consumed;else z=_+5;let B=Y(J,"auth","endauth",z);if(B===-1){console.warn(`[stx] @auth directive at position ${_} has no matching @endauth \u2014 the block was skipped.`);break}let O=J.slice(z,B),F=Q(O,"auth","endauth"),L;if(!Z.auth)L=!1;else L=W?a0(`auth?.check && auth?.user?.[${W}]`,Z):a0("auth?.check",Z);let H;if(F!==-1){let V=O.slice(0,F),N=O.slice(F+5);H=L?V:N}else H=L?O:"";J=J.substring(0,_)+H+J.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let q=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,W,z,U=J.slice(_+6),j=$2(U);if(j)W=j.value,z=_+6+j.consumed;else z=_+6;let B=Y(J,"guest","endguest",z);if(B===-1){console.warn(`[stx] @guest directive at position ${_} has no matching @endguest \u2014 the block was skipped.`);break}let O=J.slice(z,B),F=Q(O,"guest","endguest"),L;if(!Z.auth)L=!0;else L=W?a0(`!auth?.check || !auth?.user?.[${W}]`,Z):a0("!auth?.check",Z);let H;if(F!==-1){let V=O.slice(0,F),N=O.slice(F+5);H=L?V:N}else H=L?O:"";J=J.substring(0,_)+H+J.substring(B+9),K=!0}}function X(K,q,_){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[K];if(q)W.push(q);if(_){let z=a0(_,Z);W.push(z)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,_=K==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let z=J.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let U=z.index,j=J.slice(U+`@${K}`.length),B=G(j);if(!B)break;let O=U+`@${K}`.length+B.paramsEnd,F=Y(J,K,q,O);if(F===-1){console.warn(`[stx] @${K} directive at position ${U} has no matching @${q} \u2014 the block was skipped.`);break}let L=J.slice(O,F),H=[],V=0,N=new RegExp(`@${K}\\s*\\(`,"g"),w=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${_}\\s*\\(`,"g"),A=/@else(?![a-z])/g,T=[],I;while((I=N.exec(L))!==null)T.push({pos:I.index,type:"open"});while((I=w.exec(L))!==null)T.push({pos:I.index,type:"close"});while((I=R.exec(L))!==null)T.push({pos:I.index,type:"elseDirective"});while((I=A.exec(L))!==null)T.push({pos:I.index,type:"else"});T.sort((b,D)=>b.pos-D.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)H.push(b)}let M=[],E=0;for(let b=0;b<H.length;b++){let D=H[b];if(M.push({content:L.slice(E,D.pos),ability:void 0}),D.type==="elseDirective"){let x=L.slice(D.pos+`@${_}`.length),h=G(x);if(h){M[M.length-1]={content:L.slice(E,D.pos)},E=D.pos+`@${_}`.length+h.paramsEnd,M.push({content:"",ability:h.ability,type:h.type,id:h.id}),M.pop();let l=H[b+1],U0=l?l.pos:L.length;M.push({content:L.slice(E,U0),ability:h.ability,type:h.type,id:h.id}),E=U0}}else E=D.pos+5}if(E<L.length){let b=M[M.length-1];if(H.length>0&&H[H.length-1].type==="else")M.push({content:L.slice(E),isFinalElse:!0});else if(M.length===0)M.push({content:L.slice(E)})}let k=X(B.ability,B.type,B.id),y=K==="can"?k:!k,S="";if(y)S=M[0]?.content||"";else{let b=!1;for(let D=1;D<M.length;D++){let x=M[D];if(x.isFinalElse){S=x.content,b=!0;break}if(x.ability){let h=X(x.ability,x.type,x.id);if(K==="can"?h:!h){S=x.content,b=!0;break}}}if(!b&&M.length>0){let D=M[M.length-1];if(D.isFinalElse)S=D.content}}J=J.substring(0,U)+S+J.substring(F+`@${q}`.length),W=!0}}return J}function s$($,Z,J){let Y=$;function Q(X,G,K,q,_){let W=!0;while(W){W=!1;let z=new RegExp(`@${G}\\s*\\(`),U=X.match(z);if(!U||U.index===void 0)break;let j=U.index,B=t0(X,j+`@${G}`.length);if(!B)break;let O=B.endPos,F=H1(X,G,K,O);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let L=X.slice(O,F),H=B.expression,V=-1,N=0,w=0;while(w<L.length){let R=L.indexOf("@",w);if(R===-1)break;let A=L.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){N++,w=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){N--,w=R+1;continue}if(N===0&&/^@else(?![a-z])/.test(A)){V=R;break}w=R+1}try{let R=q(H.trim()),A;if(V!==-1){let T=L.slice(0,V),I=L.slice(V+5);A=R?T:I}else A=R?L:"";X=X.substring(0,j)+A+X.substring(F+`@${K}`.length),W=!0}catch(R){let A=R instanceof Error?R.message:String(R),T=s(_,`Error processing @${G} directive: ${A}`,p.EVALUATION_ERROR);X=X.substring(0,j)+T+X.substring(F+`@${K}`.length);break}}return X}return Y=Q(Y,"isset","endisset",(X)=>{let G=a0(X,Z);return G!==void 0&&G!==null},"Isset"),Y=Q(Y,"empty","endempty",(X)=>{let G=a0(X,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),Y}function r$($,Z,J){let Y=$,Q="development";function X(G,K,q,_){let W=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),U=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,O=!0;while(O){O=!1,W.lastIndex=0;let F=W.exec(B);if(!F)break;let L=F.index,H=L+F[0].length;if(K==="env"){let k=B.substring(H).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!k)break;H+=k[0].length,_=Q===k[2]}let V=1,N=H,w=-1;while(V>0&&N<B.length){W.lastIndex=N,z.lastIndex=N;let k=W.exec(B),y=z.exec(B),S=k?k.index:1/0,b=y?y.index:1/0;if(S<b)V++,N=S+k[0].length;else if(b<1/0){if(V--,V===0){w=b;break}N=b+y[0].length}else break}if(w===-1){console.warn(`[stx] @${K} directive at position ${L} has no matching @${q} \u2014 the block was skipped.`);break}let R=B.substring(H,w),A=-1,T=0,I=0;while(I<R.length){let k=R.indexOf("@",I);if(k===-1)break;let y=R.substring(k);if(U.test(y)){T++,I=k+1;continue}if(j.test(y)){T--,I=k+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){A=k;break}I=k+1}let M;if(A!==-1){let k=R.slice(0,A),y=R.slice(A+5);M=_?k:y}else M=_?R:"";let E=`@${q}`.length;B=B.substring(0,L)+M+B.substring(w+E),O=!0}return B}return Y=X(Y,"env","endenv",!1),Y=X(Y,"production","endproduction",Q==="production"),Y=X(Y,"development","enddevelopment",Q==="development"),Y=X(Y,"staging","endstaging",Q==="staging"),Y=X(Y,"testing","endtesting",Q==="testing"),Y}var K9=C(()=>{r6();c0();n$();N0()});function Y2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function q9($,Z){if(!$)return Z?.nonceGenerator?.()??Y2();let J=Z2.get($);if(!J)J=Z?.nonceGenerator?.()??Y2(),Z2.set($,J);return J}function iQ($,Z){let J=[];for(let[Y,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)J.push(Y);continue}if(Array.isArray(Q)){let X=[...Q];if(Z&&(Y==="script-src"||Y==="style-src"))X=X.filter((G)=>!G.startsWith("'nonce-")),X.push(`'nonce-${Z}'`);if(X.length>0)J.push(`${Y} ${X.join(" ")}`)}}return J.join("; ")}function J2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${iQ($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function X2($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=Z.useNonce?q9(J,Z):void 0,Q=J2(Z.directives,Y);return $.replace(/<head([^>]*)>/,`<head$1>
2462
- ${Q}`)}function Q2($,Z,J,Y){let Q=$,X=Y.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!X?.enabled||!X.directives)return"<!-- CSP not configured -->";let G=X.useNonce?q9(Z,X):void 0;return J2(X.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return q9(Z,X)}),X?.enabled&&X.useNonce)Z.cspNonce=q9(Z,X);return Q}var Z2;var G2=C(()=>{Z2=new WeakMap});import nQ from"crypto";function sQ($=oQ){let Z=nQ.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return a$=Z,Z}function rQ(){if(!a$)sQ();return a$}function aQ($=K2){let Z=rQ();return`<input type="hidden" name="${$}" value="${Z}">`}function q2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,Y)=>{return aQ(Y||K2)})}var oQ=40,K2="_token",a$=null;var W2=()=>{};async function _2($,Z,J,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return $;let Q=$;for(let X of Y.customDirectives){if(!X.name||typeof X.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",X);continue}if(X.hasEndTag)Q=await tQ(Q,X,Z,J,Y);else Q=await eQ(Q,X,Z,J,Y)}return Q}async function tQ($,Z,J,Y,Q){let{name:X,handler:G}=Z,K=`@${X}`,q=`@end${X}`,_=$,W=T1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],U=W.exec(_);while(U!==null){let[j,B="",O=""]=U,F=U.index||0;try{let L=B?z2(B):[],H=O.trim(),V=await G(H,L,J,Y);z.push({original:j,processed:V,startIndex:F})}catch(L){let H=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${X}:`,L);z.push({original:j,processed:s("CustomDirective",`Error in @${X}${B?`(${B})`:""}: ${H}`,p.EVALUATION_ERROR),startIndex:F})}U=W.exec(_)}for(let j=z.length-1;j>=0;j--){let{original:B,processed:O}=z[j];_=_.replace(B,O)}return _}async function eQ($,Z,J,Y,Q){let{name:X,handler:G}=Z,K=$,q=T1(`@${X}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),_=[],W=q.exec(K);while(W!==null){let[j,B=""]=W,O=W.index||0;try{let F=z2(B),L=await G("",F,J,Y);_.push({original:j,processed:L,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${X}:`,F);_.push({original:j,processed:s("CustomDirective",`Error in @${X}(${B}): ${L}`,p.EVALUATION_ERROR),startIndex:O})}W=q.exec(K)}let z=T1(`@${X}(?!\\w)(?!\\s*\\()`,"g"),U=z.exec(K);while(U!==null){let[j]=U,B=U.index||0;try{let O=await G("",[],J,Y);_.push({original:j,processed:O,startIndex:B})}catch(O){let F=O instanceof Error?O.message:String(O);if(Q.debug)console.error(`Error processing custom directive @${X}:`,O);_.push({original:j,processed:s("CustomDirective",`Error in @${X}: ${F}`,p.EVALUATION_ERROR),startIndex:B})}U=z.exec(K)}for(let j=_.length-1;j>=0;j--){let{original:B,processed:O}=_[j];K=K.replace(B,O)}return K}function z2($){if(!$.trim())return[];let Z=[],J="",Y=!1,Q="";for(let X=0;X<$.length;X++){let G=$[X];if((G==='"'||G==="'")&&(X===0||$[X-1]!=="\\"))if(!Y)Y=!0,Q=G;else if(G===Q)Y=!1;else J+=G;else if(G===","&&!Y)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((X)=>{let G=X.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var U2=C(()=>{c0();M1()});import $G from"crypto";function H0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function W9($,Z,J,Y){let Q=$||Z;return J?`${Q} ${Y}`:Q}function ZG(){return $G.randomUUID()}function _9($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let Y=ZG();Z.csrf={token:Y}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${H0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,Q)=>{let X=Q.toUpperCase();if(Q&&!["GET","POST"].includes(X))return`<input type="hidden" name="_method" value="${H0(X)}">`;return Y}),J}function O2($,Z,J=j2){let Y=$;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,X,G,K,q,_="")=>{let W=X||G||"POST",z=K||q||"",U=e0(_),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",O=`<form method="${H0(B)}" action="${H0(z)}"${U?` ${U}`:""}>`;if(O+=`
2461
+ </script>`}function n6($,Z,J){if(i6=0,!gQ($))return $;let Y=SQ($);if(Y.length===0)return $;let Q=fQ($,Y),X=xQ(Y),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+X+`
2462
+ `+Q.slice(G);else Q+=X;return Q}function fQ($,Z){let J=$;for(let Y of Z){let X=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${X9(Y.stateExpr)}["']`,"gi").exec(J);if(X)Y.id=X[1],Y.selector=`[data-stx-scope="${Y.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${X9(Y.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(J);if(K)Y.id=K[1],Y.selector=`[data-stx-scope="${Y.id}"]`;else J=J.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${X9(Y.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${Y.id}" $2$3$4`),J=J.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${X9(Y.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${Y.id}" $2$3$4`)}}return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),J=J.replace(/\s*x-init\s*=\s*'[^']*'/g,""),J}function gQ($){return/x-data\s*=\s*["']/.test($)}var i6=0,bQ=0;import hQ from"fs";import p$ from"path";import{createHighlighter as dQ}from"ts-syntax-highlighter";async function mQ($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let Y=(await hQ.promises.stat($)).mtime.getTime();if(Z.cache&&l$.has($)){let z=l$.get($);if(z.updatedAt>=Y)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:X,content:G}=w7(Q),K=Z.markdown||g$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=c1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await uQ(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:_,data:X||{}};if(Z.cache)l$.set($,{...W,updatedAt:Y});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let Y=J instanceof Error?J.message:String(J);return{content:Q0("Markdown File",`Error reading/parsing markdown file: ${Y}`,$,"",0,""),data:{}}}}async function uQ($,Z,J){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Q9)try{Q9=await dQ({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,_,W)=>{let z=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=_||(J?"text":"");if(!U)return K;try{if(!Q9.getSupportedLanguages().includes(U))return K;return(await Q9.highlight(z,U,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${_}:`,j)}return K},X=$,G=$.matchAll(Y);for(let K of G){let[q,_,W,z]=K,U=await Q(q,_,W,z);X=X.replace(q,U)}return X}async function o6($,Z,J="",Y={}){return await pQ($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,_)=>{try{let W=K;if(!p$.isAbsolute(K))W=p$.resolve(p$.dirname(J),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let H=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of H){let A=V.indexOf(":");if(A>0){let w=V.substring(0,A).trim(),R=V.substring(A+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(N||T)R=R.substring(1,R.length-1);z[w]=R}}}}catch(L){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:U,data:j}=await mQ(W,Y),B={...Z,...j,...z},O=U,F=/\{\{([^}]+)\}\}/g;return O=O.replace(F,(L,H)=>{let V=H.trim();return B[V]!==void 0?String(B[V]):L}),O}catch(W){let z=W instanceof Error?W.message:String(W);return Q0("Markdown File",`Error including markdown file: ${z}`,J,$,_,G)}})}async function pQ($,Z,J){let Y=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,_=Q;Y.push(J(..._).then((W)=>({match:K,replacement:W,index:q})))}let X=await Promise.all(Y);X.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of X)G=G.replace(K,()=>q);return G}var l$,Q9=null;var s6=C(()=>{J5();F0();l$=new Map});function t0($,Z){try{let J=$.trim();if(e(J))return $0(J,Object.keys(Z))(...Object.values(Z));else return X0(J,Z)}catch{return!1}}var r6=C(()=>{A0()});function e0($,Z){let J=lQ($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function lQ($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let Y=I0($,"(",")",J);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,Y),endPos:Y+1}}function H1($,Z,J,Y){let Q=1,X=Y,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${J}(?![a-z])`,"g");while(X<$.length&&Q>0){G.lastIndex=X,K.lastIndex=X;let q=G.exec($),_=K.exec($),W=q?q.index:1/0,z=_?_.index:1/0;if(W<z)Q++,X=W+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;X=z+_[0].length}else break}return-1}function a6($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let Y=Z+J[0].length,Q=e0($,Y);if(!Q)return null;let X=Q.endPos,G=H1($,"if","endif",X);if(G===-1)return null;let K=$.slice(X,G),q=[],_=0,W="if",z=Q.expression,U=0,j=0;while(_<K.length){let B=K.indexOf("@",_);if(B===-1)break;_=B;let O=K.substring(B);if(/^@if\s*\(/.test(O)){j++,_++;continue}if(/^@endif(?![a-z])/.test(O)){j--,_+=6;continue}if(j===0){let F=O.match(/^@elseif\s*/);if(F){q.push({type:W,condition:z,content:K.substring(U,_),start:X+U,end:X+_});let L=_+F[0].length,H=e0(K,L);if(!H){_++;continue}W="elseif",z=H.expression,_=H.endPos,U=_;continue}else if(/^@else(?![a-z])/.test(O)){q.push({type:W,condition:z,content:K.substring(U,_),start:X+U,end:X+_}),W="else",z=void 0,_+=5,U=_;continue}}_++}return q.push({type:W,condition:z,content:K.slice(U),start:X+U,end:X+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function c$($){let Z=[],J=/@if\s*\(/g,Y=J.exec($);while(Y!==null){if(Z.some((G)=>Y.index>G.start&&Y.index<G.end)){Y=J.exec($);continue}let X=a6($,Y.index);if(X)Z.push(X),J.lastIndex=X.end;Y=J.exec($)}return Z}function G9($,Z,J){let Y=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),X=Q.exec($);while(X!==null){if(Y.some((O)=>X.index>O.start&&X.index<O.end)){X=Q.exec($);continue}let K=X.index,q=K+X[0].length-1,_=I0($,"(",")",q);if(_===-1){X=Q.exec($);continue}let W=$.slice(q+1,_),z=_+1,U=H1($,Z,J,z);if(U===-1){X=Q.exec($);continue}let j=$.slice(z,U),B=U+`@${J}`.length;Y.push({fullMatch:$.slice(K,B),name:Z,params:W,content:j,start:K,end:B}),Q.lastIndex=B,X=Q.exec($)}return Y}function i$($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let Y=Z+J[0].length,Q=e0($,Y);if(!Q)return null;let X=Q.endPos,G=H1($,"switch","endswitch",X);if(G===-1)return null;let K=$.slice(X,G),q=[],_=0,W=null,z=0;while(_<K.length){let U=K.slice(_),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(z++,W)W.content+=j[0];_+=j[0].length;continue}if(B){if(z--,W)W.content+=B[0];_+=B[0].length;continue}if(z>0){if(W)W.content+=K[_];_++;continue}let O=U.match(/^@case\s*/),F=U.match(/^@default(?![a-z])/),L=U.match(/^@break(?![a-z])/);if(O&&U.startsWith("@case")){if(W)q.push(W);let H=_+O[0].length,V=e0(K,H);if(!V){_++;continue}W={type:"case",value:V.expression,content:""},_=V.endPos}else if(F&&U.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},_+=F[0].length}else if(L&&U.startsWith("@break"))_+=L[0].length;else{if(W)W.content+=K[_];_++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var t6=()=>{};var e6=()=>{};var n$=C(()=>{t6();e6()});function oQ($,Z,J){let Y=$,Q=!0;while(Q){Q=!1;let X=Y.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=i$(Y,G);if(!K)break;try{let q;if(e(K.expression))q=$0(K.expression,Object.keys(Z))(...Object.values(Z));else q=X0(K.expression,Z);let _="",W=!1;for(let z of K.cases)if(z.type==="default"){if(!W)_=z.content.trim()}else try{let U;if(z.value&&e(z.value))U=$0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)U=X0(z.value,Z);if(q===U){_=z.content.trim(),W=!0;break}}catch{continue}Y=Y.substring(0,G)+_+Y.substring(K.end),Q=!0}catch(q){let _=q instanceof Error?q.message:String(q),W=s("Switch",`Error evaluating @switch expression: ${_}`,p.EVALUATION_ERROR);Y=Y.substring(0,G)+W+Y.substring(K.end);break}}return Y}function L1($,Z,J){let Y=$;Y=oQ(Y,Z,J);{let X=!0;while(X){X=!1;let G=Y.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=e0(Y,K+7);if(!q)break;let _=q.endPos,W=H1(Y,"unless","endunless",_);if(W===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=Y.slice(_,W),U=q.expression,j=-1;{let O=0,F=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,H=/@else(?![a-z])/g,V=[],A;while((A=F.exec(z))!==null)V.push({pos:A.index,type:"open"});while((A=L.exec(z))!==null)V.push({pos:A.index,type:"close"});while((A=H.exec(z))!==null)V.push({pos:A.index,type:"else"});V.sort((w,R)=>w.pos-R.pos);for(let w of V)if(w.type==="open")O++;else if(w.type==="close")O--;else if(w.type==="else"&&O===0){j=w.pos;break}}let B;if(j!==-1){let O=z.slice(0,j),F=z.slice(j+5);B=`@if (${U})${F}@else ${O}@endif`}else B=`@if (!(${U}))${z}@endif`;Y=Y.substring(0,K)+B+Y.substring(W+10),X=!0}}Y=s$(Y,Z,J),Y=r$(Y,Z,J),Y=o$(Y,Z);let Q=()=>{let X=c$(Y);if(X.length===0)return!1;for(let G=X.length-1;G>=0;G--){let K=X[G];try{let q="",_=!1;for(let W of K.branches){if(_)break;if(W.type==="else")q=W.content,_=!0;else try{let z;if(W.condition&&e(W.condition))z=$0(W.condition,Object.keys(Z))(...Object.values(Z));else if(W.condition)z=X0(W.condition,Z);if(z)q=W.content,_=!0}catch(z){q=s(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${z instanceof Error?z.message:String(z)}`,p.EVALUATION_ERROR),_=!0}}Y=Y.substring(0,K.start)+q+Y.substring(K.end)}catch(q){let _=q instanceof Error?q.message:String(q),W=s("If",`Error processing @if block: ${_}`,p.EVALUATION_ERROR);Y=Y.substring(0,K.start)+W+Y.substring(K.end)}}return!0};while(Q());return Y}function $2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let Y=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){Y.push($[Z+1]),Z+=2;continue}if(Q===J){Z++;break}Y.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:Y.join(""),consumed:Z}}function o$($,Z){let J=$;function Y(K,q,_,W){let z=1,U=W,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${_}(?![a-z])`,"g");while(U<K.length&&z>0){j.lastIndex=U,B.lastIndex=U;let O=j.exec(K),F=B.exec(K),L=O?O.index:1/0,H=F?F.index:1/0;if(L<H)z++,U=L+O[0].length;else if(H<1/0){if(z--,z===0)return H;U=H+F[0].length}else break}return-1}function Q(K,q,_){let W=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${_}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],O;while((O=z.exec(K))!==null)B.push({pos:O.index,type:"open"});while((O=U.exec(K))!==null)B.push({pos:O.index,type:"close"});while((O=j.exec(K))!==null)B.push({pos:O.index,type:"else"});B.sort((F,L)=>F.pos-L.pos);for(let F of B)if(F.type==="open")W++;else if(F.type==="close")W--;else if(F.type==="else"&&W===0)return F.pos;return-1}{let K=!0;while(K){K=!1;let q=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,W,z,U=J.slice(_+5),j=$2(U);if(j)W=j.value,z=_+5+j.consumed;else z=_+5;let B=Y(J,"auth","endauth",z);if(B===-1){console.warn(`[stx] @auth directive at position ${_} has no matching @endauth \u2014 the block was skipped.`);break}let O=J.slice(z,B),F=Q(O,"auth","endauth"),L;if(!Z.auth)L=!1;else L=W?t0(`auth?.check && auth?.user?.[${W}]`,Z):t0("auth?.check",Z);let H;if(F!==-1){let V=O.slice(0,F),A=O.slice(F+5);H=L?V:A}else H=L?O:"";J=J.substring(0,_)+H+J.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let q=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,W,z,U=J.slice(_+6),j=$2(U);if(j)W=j.value,z=_+6+j.consumed;else z=_+6;let B=Y(J,"guest","endguest",z);if(B===-1){console.warn(`[stx] @guest directive at position ${_} has no matching @endguest \u2014 the block was skipped.`);break}let O=J.slice(z,B),F=Q(O,"guest","endguest"),L;if(!Z.auth)L=!0;else L=W?t0(`!auth?.check || !auth?.user?.[${W}]`,Z):t0("!auth?.check",Z);let H;if(F!==-1){let V=O.slice(0,F),A=O.slice(F+5);H=L?V:A}else H=L?O:"";J=J.substring(0,_)+H+J.substring(B+9),K=!0}}function X(K,q,_){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[K];if(q)W.push(q);if(_){let z=t0(_,Z);W.push(z)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,_=K==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let z=J.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let U=z.index,j=J.slice(U+`@${K}`.length),B=G(j);if(!B)break;let O=U+`@${K}`.length+B.paramsEnd,F=Y(J,K,q,O);if(F===-1){console.warn(`[stx] @${K} directive at position ${U} has no matching @${q} \u2014 the block was skipped.`);break}let L=J.slice(O,F),H=[],V=0,A=new RegExp(`@${K}\\s*\\(`,"g"),w=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${_}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],I;while((I=A.exec(L))!==null)T.push({pos:I.index,type:"open"});while((I=w.exec(L))!==null)T.push({pos:I.index,type:"close"});while((I=R.exec(L))!==null)T.push({pos:I.index,type:"elseDirective"});while((I=N.exec(L))!==null)T.push({pos:I.index,type:"else"});T.sort((b,D)=>b.pos-D.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)H.push(b)}let M=[],E=0;for(let b=0;b<H.length;b++){let D=H[b];if(M.push({content:L.slice(E,D.pos),ability:void 0}),D.type==="elseDirective"){let x=L.slice(D.pos+`@${_}`.length),h=G(x);if(h){M[M.length-1]={content:L.slice(E,D.pos)},E=D.pos+`@${_}`.length+h.paramsEnd,M.push({content:"",ability:h.ability,type:h.type,id:h.id}),M.pop();let l=H[b+1],U0=l?l.pos:L.length;M.push({content:L.slice(E,U0),ability:h.ability,type:h.type,id:h.id}),E=U0}}else E=D.pos+5}if(E<L.length){let b=M[M.length-1];if(H.length>0&&H[H.length-1].type==="else")M.push({content:L.slice(E),isFinalElse:!0});else if(M.length===0)M.push({content:L.slice(E)})}let k=X(B.ability,B.type,B.id),y=K==="can"?k:!k,S="";if(y)S=M[0]?.content||"";else{let b=!1;for(let D=1;D<M.length;D++){let x=M[D];if(x.isFinalElse){S=x.content,b=!0;break}if(x.ability){let h=X(x.ability,x.type,x.id);if(K==="can"?h:!h){S=x.content,b=!0;break}}}if(!b&&M.length>0){let D=M[M.length-1];if(D.isFinalElse)S=D.content}}J=J.substring(0,U)+S+J.substring(F+`@${q}`.length),W=!0}}return J}function s$($,Z,J){let Y=$;function Q(X,G,K,q,_){let W=!0;while(W){W=!1;let z=new RegExp(`@${G}\\s*\\(`),U=X.match(z);if(!U||U.index===void 0)break;let j=U.index,B=e0(X,j+`@${G}`.length);if(!B)break;let O=B.endPos,F=H1(X,G,K,O);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let L=X.slice(O,F),H=B.expression,V=-1,A=0,w=0;while(w<L.length){let R=L.indexOf("@",w);if(R===-1)break;let N=L.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){A++,w=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){A--,w=R+1;continue}if(A===0&&/^@else(?![a-z])/.test(N)){V=R;break}w=R+1}try{let R=q(H.trim()),N;if(V!==-1){let T=L.slice(0,V),I=L.slice(V+5);N=R?T:I}else N=R?L:"";X=X.substring(0,j)+N+X.substring(F+`@${K}`.length),W=!0}catch(R){let N=R instanceof Error?R.message:String(R),T=s(_,`Error processing @${G} directive: ${N}`,p.EVALUATION_ERROR);X=X.substring(0,j)+T+X.substring(F+`@${K}`.length);break}}return X}return Y=Q(Y,"isset","endisset",(X)=>{let G=t0(X,Z);return G!==void 0&&G!==null},"Isset"),Y=Q(Y,"empty","endempty",(X)=>{let G=t0(X,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),Y}function r$($,Z,J){let Y=$,Q="development";function X(G,K,q,_){let W=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),U=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,O=!0;while(O){O=!1,W.lastIndex=0;let F=W.exec(B);if(!F)break;let L=F.index,H=L+F[0].length;if(K==="env"){let k=B.substring(H).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!k)break;H+=k[0].length,_=Q===k[2]}let V=1,A=H,w=-1;while(V>0&&A<B.length){W.lastIndex=A,z.lastIndex=A;let k=W.exec(B),y=z.exec(B),S=k?k.index:1/0,b=y?y.index:1/0;if(S<b)V++,A=S+k[0].length;else if(b<1/0){if(V--,V===0){w=b;break}A=b+y[0].length}else break}if(w===-1){console.warn(`[stx] @${K} directive at position ${L} has no matching @${q} \u2014 the block was skipped.`);break}let R=B.substring(H,w),N=-1,T=0,I=0;while(I<R.length){let k=R.indexOf("@",I);if(k===-1)break;let y=R.substring(k);if(U.test(y)){T++,I=k+1;continue}if(j.test(y)){T--,I=k+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){N=k;break}I=k+1}let M;if(N!==-1){let k=R.slice(0,N),y=R.slice(N+5);M=_?k:y}else M=_?R:"";let E=`@${q}`.length;B=B.substring(0,L)+M+B.substring(w+E),O=!0}return B}return Y=X(Y,"env","endenv",!1),Y=X(Y,"production","endproduction",Q==="production"),Y=X(Y,"development","enddevelopment",Q==="development"),Y=X(Y,"staging","endstaging",Q==="staging"),Y=X(Y,"testing","endtesting",Q==="testing"),Y}var K9=C(()=>{r6();c0();n$();A0()});function Y2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function q9($,Z){if(!$)return Z?.nonceGenerator?.()??Y2();let J=Z2.get($);if(!J)J=Z?.nonceGenerator?.()??Y2(),Z2.set($,J);return J}function sQ($,Z){let J=[];for(let[Y,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)J.push(Y);continue}if(Array.isArray(Q)){let X=[...Q];if(Z&&(Y==="script-src"||Y==="style-src"))X=X.filter((G)=>!G.startsWith("'nonce-")),X.push(`'nonce-${Z}'`);if(X.length>0)J.push(`${Y} ${X.join(" ")}`)}}return J.join("; ")}function J2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${sQ($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function X2($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=Z.useNonce?q9(J,Z):void 0,Q=J2(Z.directives,Y);return $.replace(/<head([^>]*)>/,`<head$1>
2463
+ ${Q}`)}function Q2($,Z,J,Y){let Q=$,X=Y.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!X?.enabled||!X.directives)return"<!-- CSP not configured -->";let G=X.useNonce?q9(Z,X):void 0;return J2(X.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return q9(Z,X)}),X?.enabled&&X.useNonce)Z.cspNonce=q9(Z,X);return Q}var Z2;var G2=C(()=>{Z2=new WeakMap});import rQ from"crypto";function tQ($=aQ){let Z=rQ.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return a$=Z,Z}function eQ(){if(!a$)tQ();return a$}function $G($=K2){let Z=eQ();return`<input type="hidden" name="${$}" value="${Z}">`}function q2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,Y)=>{return $G(Y||K2)})}var aQ=40,K2="_token",a$=null;var W2=()=>{};async function _2($,Z,J,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return $;let Q=$;for(let X of Y.customDirectives){if(!X.name||typeof X.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",X);continue}if(X.hasEndTag)Q=await ZG(Q,X,Z,J,Y);else Q=await YG(Q,X,Z,J,Y)}return Q}async function ZG($,Z,J,Y,Q){let{name:X,handler:G}=Z,K=`@${X}`,q=`@end${X}`,_=$,W=M1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],U=W.exec(_);while(U!==null){let[j,B="",O=""]=U,F=U.index||0;try{let L=B?z2(B):[],H=O.trim(),V=await G(H,L,J,Y);z.push({original:j,processed:V,startIndex:F})}catch(L){let H=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${X}:`,L);z.push({original:j,processed:s("CustomDirective",`Error in @${X}${B?`(${B})`:""}: ${H}`,p.EVALUATION_ERROR),startIndex:F})}U=W.exec(_)}for(let j=z.length-1;j>=0;j--){let{original:B,processed:O}=z[j];_=_.replace(B,O)}return _}async function YG($,Z,J,Y,Q){let{name:X,handler:G}=Z,K=$,q=M1(`@${X}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),_=[],W=q.exec(K);while(W!==null){let[j,B=""]=W,O=W.index||0;try{let F=z2(B),L=await G("",F,J,Y);_.push({original:j,processed:L,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${X}:`,F);_.push({original:j,processed:s("CustomDirective",`Error in @${X}(${B}): ${L}`,p.EVALUATION_ERROR),startIndex:O})}W=q.exec(K)}let z=M1(`@${X}(?!\\w)(?!\\s*\\()`,"g"),U=z.exec(K);while(U!==null){let[j]=U,B=U.index||0;try{let O=await G("",[],J,Y);_.push({original:j,processed:O,startIndex:B})}catch(O){let F=O instanceof Error?O.message:String(O);if(Q.debug)console.error(`Error processing custom directive @${X}:`,O);_.push({original:j,processed:s("CustomDirective",`Error in @${X}: ${F}`,p.EVALUATION_ERROR),startIndex:B})}U=z.exec(K)}for(let j=_.length-1;j>=0;j--){let{original:B,processed:O}=_[j];K=K.replace(B,O)}return K}function z2($){if(!$.trim())return[];let Z=[],J="",Y=!1,Q="";for(let X=0;X<$.length;X++){let G=$[X];if((G==='"'||G==="'")&&(X===0||$[X-1]!=="\\"))if(!Y)Y=!0,Q=G;else if(G===Q)Y=!1;else J+=G;else if(G===","&&!Y)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((X)=>{let G=X.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var U2=C(()=>{c0();I1()});import JG from"crypto";function H0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function W9($,Z,J,Y){let Q=$||Z;return J?`${Q} ${Y}`:Q}function XG(){return JG.randomUUID()}function _9($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let Y=XG();Z.csrf={token:Y}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${H0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,Q)=>{let X=Q.toUpperCase();if(Q&&!["GET","POST"].includes(X))return`<input type="hidden" name="_method" value="${H0(X)}">`;return Y}),J}function O2($,Z,J=j2){let Y=$;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,X,G,K,q,_="")=>{let W=X||G||"POST",z=K||q||"",U=$1(_),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",O=`<form method="${H0(B)}" action="${H0(z)}"${U?` ${U}`:""}>`;if(O+=`
2463
2464
  ${_9("@csrf",Z)}`,!["GET","POST"].includes(j))O+=`
2464
- ${_9(`@method('${j}')`,Z)}`;return O}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,X,G,K,q,_="")=>{let W=X||G||"",z=K||q||"",U=e0(_),j=G5(W,Z),B=j!==void 0&&j!==null?j:z||"",O=U.match(/type=['"]([^'"]+)['"]/i),F=O?O[1]:"text",L=K5(W,Z),H=U.match(/class=['"]([^'"]+)['"]/i),V=W9(H?H[1]:"",J.input,L,J.inputError),N=U.replace(/class=['"][^'"]+['"]/i,"");return N=N.replace(/type=['"][^'"]+['"]/i,""),`<input type="${H0(F)}" name="${H0(W)}" value="${H0(B)}" class="${V}"${N?` ${N}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,X,G="",K="")=>{let q=e0(G),_=G5(X,Z)||K.trim(),W=K5(X,Z),z=q.match(/class=['"]([^'"]+)['"]/i),U=W9(z?z[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${H0(X)}" class="${U}"${j?` ${j}`:""}>${H0(_)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,X,G="",K)=>{let q=e0(G),_=G5(X,Z),W=K5(X,Z),z=q.match(/class=['"]([^'"]+)['"]/i),U=W9(z?z[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(_!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(O,F,L)=>{if((Array.isArray(_)?_.some((V)=>String(V)===L):String(_)===L)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return O});return`<select name="${H0(X)}" class="${U}"${j?` ${j}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="1",K="")=>{let q=e0(K),_=G5(X,Z),W=_!==void 0&&(Array.isArray(_)?_.some((B)=>String(B)===G):_===!0||String(_)===G),z=q.match(/class=['"]([^'"]+)['"]/i),U=z?z[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${H0(X)}" value="${H0(G)}" class="${U}"${W?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G,K="")=>{let q=e0(K),_=G5(X,Z),W=_!==void 0&&_===G,z=q.match(/class=['"]([^'"]+)['"]/i),U=z?z[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${H0(X)}" value="${H0(G)}" class="${U}"${W?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="")=>{let K=e0(G),q=K.match(/accept=['"]([^'"]+)['"]/i),_=q?q[1]:"",W=K.includes("multiple"),z=K5(X,Z),U=K.match(/class=['"]([^'"]+)['"]/i),j=W9(U?U[1]:"",J.input,z,J.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),O=[`<input type="file" name="${H0(X)}"`,`class="${j}"`];if(_)O.push(`accept="${H0(_)}"`);if(W)O.push("multiple");if(B)O.push(B);return`${O.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,X,G="",K)=>{let q=e0(G),_=q.match(/class=['"]([^'"]+)['"]/i),W=_?_[1]:J.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${H0(X)}" class="${W}"${z?` ${z}`:""}>${K}</label>`}),Y}function H2($,Z,J=j2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,Q,X)=>{try{if(K5(Q,Z))return X.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return B2(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return B2(Q,Z)}let q=K.trim();if(e(q)){let _=X0(q,Z);return _!==void 0?String(_):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),Y}})}function K5($,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 B2($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function G5($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let Y=$.slice(0,-2);if(J=Z[Y],J!==void 0)return J}return Z[$]}function e0($){if(!$.trim())return"";let Z=[],J=$.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=Y.exec(J))!==null){let[,X,,G]=Q;Z.push(`${X}="${G.trim()}"`)}return Z.join(" ")}var j2;var L2=C(()=>{N0();j2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import F2 from"path";function YG($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function JG($,Z){if({...Z4,...Z.i18n}.cache&&$4[$]){let Q=$4[$],X=Z.i18n?.cacheMaxAge??0;if(!YG(Q,X))return Q.translations}if(q5[$]?.state==="loading")return q5[$].promise;t$[$]="loading";let Y=N2($,Z).then((Q)=>{return t$[$]="loaded",delete q5[$],Q}).catch((Q)=>{throw t$[$]="error",q5[$]={promise:Y,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return q5[$]={promise:Y,state:"loading"},Y}async function N2($,Z){let J={...Z4,...Z.i18n},Y=F2.resolve(import.meta.dir,"..",J.translationsDir),Q=KG(J.format),X=F2.join(Y,`${$}${Q}`);try{let G={};try{let K=await import(X);G=K.default||K}catch(K){let q=await Bun.file(X).text();if(J.format==="yaml"||J.format==="yml")G=QG(q);else if(J.format==="json")G=JSON.parse(q);else throw K}if(J.cache)$4[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(G){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,G);if($!==J.defaultLocale)return N2(J.defaultLocale,Z);return{}}}async function XG($,Z){return JG($,Z)}function QG($){let Z={},J=$.split(`
2465
- `),Y=[{obj:Z,indent:-1}];for(let Q of J){let X=Q.replace(/#.*$/,"").trimEnd();if(!X.trim())continue;let G=X.search(/\S/);if(G===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=G)Y.pop();let K=Y[Y.length-1].obj,q=X.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,_,W]=q,z=_.trim(),U=W.trim();if(U==="")K[z]={},Y.push({obj:K[z],indent:G});else K[z]=GG(U)}}return Z}function GG($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let J=Number($);if(!Number.isNaN(J))return J;return $}function KG($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function qG($,Z){for(let J of $){let Y=J.trim(),Q=Y.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let X=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10),K=X[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(X[2],10);if(Z>=G&&Z<=K)return X[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function WG($,Z={}){return R2($,Z)}function R2($,Z){let J="",Y=0;while(Y<$.length)if($[Y]==="{"){let Q=_G($,Y);if(Q===-1){J+=$[Y],Y++;continue}let X=$.slice(Y+1,Q);J+=zG(X,Z),Y=Q+1}else if($[Y]==="'"&&Y+1<$.length)if($[Y+1]==="'")J+="'",Y+=2;else if($[Y+1]==="{"||$[Y+1]==="}")J+=$[Y+1],Y+=2;else J+=$[Y],Y++;else J+=$[Y],Y++;return J}function _G($,Z){let J=0;for(let Y=Z;Y<$.length;Y++)if($[Y]==="{")J++;else if($[Y]==="}"){if(J--,J===0)return Y}return-1}function zG($,Z){let J=UG($);if(J.length===0)return`{${$}}`;let Y=J[0].trim(),Q=Z[Y];if(J.length===1)return Q!==void 0?String(Q):`{${Y}}`;switch(J[1].trim().toLowerCase()){case"plural":return BG(Q,J.slice(2).join(","),Z);case"select":return OG(Q,J.slice(2).join(","));case"selectordinal":return HG(Q,J.slice(2).join(","));case"number":return FG(Q,J[2]?.trim());case"date":return VG(Q,J[2]?.trim());case"time":return wG(Q,J[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function UG($){let Z=[],J="",Y=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X==="{")Y++,J+=X;else if(X==="}")Y--,J+=X;else if(X===","&&Y===0)Z.push(J),J="";else J+=X}if(J)Z.push(J);return Z}function BG($,Z,J){let Y=Number($)||0,Q=Y4(Z),X=`=${Y}`;if(Q[X])return e$(Q[X],Y,J);let G=jG(Y);if(Q[G])return e$(Q[G],Y,J);if(Q.other)return e$(Q.other,Y,J);return String(Y)}function e$($,Z,J){let Y=$.replace(/#/g,String(Z));return R2(Y,J)}function jG($){let Z=Math.abs($),J=Math.floor(Z),Y=String($).includes(".")?String($).split(".")[1].length:0;if(J===1&&Y===0)return"one";return"other"}function OG($,Z){let J=String($||""),Y=Y4(Z);if(Y[J])return Y[J];return Y.other||String($)}function HG($,Z){let J=Number($)||0,Y=Y4(Z),Q=LG(J);if(Y[Q])return Y[Q].replace(/#/g,String(J));if(Y.other)return Y.other.replace(/#/g,String(J));return String(J)}function LG($){let Z=Math.abs($),J=Z%10,Y=Z%100;if(J===1&&Y!==11)return"one";if(J===2&&Y!==12)return"two";if(J===3&&Y!==13)return"few";return"other"}function Y4($){let Z={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=J.exec($);while(Y!==null)Z[Y[1]]=Y[2],Y=J.exec($);return Z}function FG($,Z){let J=Number($);if(Number.isNaN(J))return String($);switch(Z){case"integer":return Math.floor(J).toLocaleString();case"percent":return`${(J*100).toFixed(0)}%`;case"currency":return J.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return J.toLocaleString()}}function VG($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return J.toLocaleDateString(void 0,Y)}function wG($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return J.toLocaleTimeString(void 0,Y)}function NG($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function V2($,Z,J=!0,Y={}){let Q=$.split("."),X=Z;for(let K of Q){if(X===void 0||X===null)break;X=X[K]}if(X===void 0||X===null)return J?$:"";let G=String(X);if(NG(G))return WG(G,Y);if(G.includes("|")&&"count"in Y){let K=Number(Y.count),q=G.split("|");G=qG(q,K)}for(let[K,q]of Object.entries(Y)){let _=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${_}`,"g"),String(q))}return G}async function A2($,Z,J,Y){let Q=$,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...Z4,...Y.i18n},K=await XG(G.locale,Y);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await w2(Q,X,async(W,z,U,j,B)=>{try{let O={};if(U)try{let L=[()=>JSON.parse(U),()=>{let H=`{"data":${U}}`,V=JSON.parse(H);return typeof V.data==="object"?V.data:{}},()=>{return O0(U,Z)}];for(let H of L)try{if(O=H(),Object.keys(O).length>0)break}catch{}}catch(L){if(Y.debug)console.error("Error parsing parameters for @translate directive:",L)}return V2(z,K,G.fallbackToKey,O)||j.trim()}catch(O){if(Y.debug)console.error("Error processing @translate directive:",O);return s("Translate",`Error in @translate('${z}'): ${O instanceof Error?O.message:String(O)}`,p.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let W=[...Q.matchAll(q)];console.warn(`Found ${W.length} @translate matches`),W.forEach((z,U)=>console.warn(`Match ${U}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await w2(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,z,U,j)=>{try{let B={};if(U)try{let O=[()=>JSON.parse(U),()=>{let F=`{"data":${U}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return O0(U,Z)}];for(let F of O)try{if(B=F(),Object.keys(B).length>0)break}catch{}}catch(O){if(Y.debug)console.error("Error parsing parameters for @translate directive:",O)}return V2(z,K,G.fallbackToKey,B)}catch(B){if(Y.debug)console.error("Error processing @translate directive:",B);return s("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,p.EVALUATION_ERROR)}}),Q}async function w2($,Z,J){let Y=[];return $.replace(Z,(X,...G)=>{let K=J(X,...G).then((q)=>({match:X,replacement:q}));return Y.push(K),X}),(await Promise.all(Y)).reduce((X,{match:G,replacement:K})=>X.replace(G,K),$)}var Z4,$4,q5,t$;var T2=C(()=>{c0();N0();Z4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},$4={},q5={},t$={}});var b2={};r(b2,{processLoops:()=>J4});function TG($,Z){let J=/@component\s*\(/g,Y=$,Q,X=[];while((Q=J.exec(Y))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,_=K+1;while(_<Y.length&&q>0){if(Y[_]==="(")q++;else if(Y[_]===")"){if(q--,q===0)break}_++}if(q!==0)continue;let W=Y.substring(K+1,_),z=_+1,U=W.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let j=U[1],B=W.slice(U[0].length),O=B.match(/^\s*,\s*/);if(!O)continue;let F=B.slice(O[0].length).trim();if(!F)continue;try{let L=O0(F,Z),H=JSON.stringify(L),V=`@component('${j}', ${H})`;X.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=X[G];Y=Y.substring(0,K)+_+Y.substring(q)}return Y}function z9($,Z,J){let Y=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),X;while((X=Q.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,q=1,_=K+1,W=null,z=!1;while(_<Y.length&&q>0){let B=Y[_];if(z){z=!1,_++;continue}if(B==="\\"&&W){z=!0,_++;continue}if(W){if(B===W)W=null;_++;continue}if(B==='"'||B==="'"||B==="`"){W=B,_++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}_++}if(q!==0)break;let U=Y.substring(K+1,_),j=J(U);Y=Y.substring(0,G)+j+Y.substring(_+1)}return Y}function MG($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return Y}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,Q,X)=>{try{let G=Object.keys(Z),K=Object.values(Z);c1(X);let _=$0(X,G)(...K),z=JSON.stringify(_).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${Q}="${z}"`}catch(G){return Y}}),J}function IG($,Z){let J=$;return J=z9(J,"@break",(Y)=>{try{let X=`!!(${Y.trim()})`,G;if(e(X)){let K=$0(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(X0(X,Z));return G?U9:""}catch{return""}}),J=z9(J,"@continue",(Y)=>{try{let X=`!!(${Y.trim()})`,G;if(e(X)){let K=$0(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(X0(X,Z));return G?B9:""}catch{return""}}),J}function DG($){let Z=$;return Z=Z.replace(/@break(?!\()/g,U9),Z=Z.replace(/@continue(?!\()/g,B9),Z}function M2($){let Z=$.includes(U9),J=Z?$.substring(0,$.indexOf(U9)):$;return{hasBreak:Z,content:J}}function I2($){let Z=$.includes(B9),J=Z?$.substring(0,$.indexOf(B9)):$;return{hasContinue:Z,content:J}}function E2($){let Z=$;return Z=z9(Z,"@break",(J)=>{let Y=J.trim();if(!F5(Y))return"";return`\`; if (${Y}) { break; } result += \``}),Z=z9(Z,"@continue",(J)=>{let Y=J.trim();if(!F5(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function EG($){let Z=/@forelse\s*\(/g,J,Y=[],Q=/@foreach\s*\(/g,X=/@endforeach/g,G;while((G=Q.exec($))!==null)Y.push({pos:G.index,delta:1});while((G=X.exec($))!==null)Y.push({pos:G.index,delta:-1});Y.sort((W,z)=>W.pos-z.pos);let K=[],q=0;for(let W of Y)q+=W.delta,K.push({pos:W.pos,depth:q});function _(W){let z=0,U=K.length-1,j=0;while(z<=U){let B=z+U>>1;if(K[B].pos<=W)j=K[B].depth,z=B+1;else U=B-1}return j}while((J=Z.exec($))!==null){if(_(J.index)>0)continue;let W=J.index,z=J.index+J[0].length-1,U=1,j=z+1,B=-1;while(j<$.length&&U>0){if($[j]==="(")U++;else if($[j]===")"){if(U--,U===0){B=j;break}}j++}if(B===-1)continue;let O=$.substring(z+1,B),F=O.indexOf(" as ");if(F===-1)continue;let L=O.substring(0,F).trim(),H=O.substring(F+4).trim(),V=B+1,N=1,w=V,R=/@forelse\s*\(/g,A=/@endforelse/g,T=-1;while(N>0&&w<$.length){R.lastIndex=w,A.lastIndex=w;let S=R.exec($),b=A.exec($);if(!b)break;if(S&&S.index<b.index)N++,w=S.index+S[0].length;else{if(N--,N===0){T=b.index;break}w=b.index+11}}if(T===-1)continue;let I=$.substring(V,T),M=T+11,E=-1,k=0,y=0;while(y<I.length){let S=I.indexOf("@",y);if(S===-1)break;let b=I.substring(S);if(/^@forelse\s*\(/.test(b))k++,y=S+1;else if(b.startsWith("@endforelse"))k--,y=S+11;else if(k===0&&b.startsWith("@empty")){if(I.length<=S+6||!/[a-z]/i.test(I[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:W,end:M,arrayExpr:L,itemVar:H,foreachContent:I.substring(0,E),emptyContent:I.substring(E+6)}}return null}function D2($,Z){let J=$;while(!0){let Y=EG(J);if(!Y)break;let{start:Q,end:X,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:_}=Y;try{let W;if(e(G))W=$0(G,Object.keys(Z))(...Object.values(Z));else W=X0(G,Z);let z;if(!Array.isArray(W)||W.length===0)z=_;else z=`@foreach (${G} as ${K})${q}@endforeach`;J=J.substring(0,Q)+z+J.substring(X)}catch(W){let z=W instanceof Error?W.message:String(W),U=s("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,p.EVALUATION_ERROR);J=J.substring(0,Q)+U+J.substring(X)}}return J}function J4($,Z,J,Y){let Q=$;Q=D2(Q,Z);function X(q){let _=/@foreach\s*\(/g,W;while((W=_.exec(q))!==null){let z=W.index,U=W.index+W[0].length-1,j=1,B=U+1,O=-1;while(B<q.length&&j>0){if(q[B]==="(")j++;else if(q[B]===")"){if(j--,j===0){O=B;break}}B++}if(O===-1)continue;let F=q.substring(U+1,O),L=F.indexOf(" as ");if(L===-1)continue;let H=z,V=F.substring(0,L),N=F.substring(L+4),w=O+1,R=1,A=w,T=/@foreach\s*\(/g,I=/@endforeach/g;while(R>0&&A<q.length){T.lastIndex=A,I.lastIndex=A;let M=T.exec(q),E=I.exec(q);if(!E)break;if(M&&M.index<E.index)R++,A=M.index+M[0].length;else{if(R--,R===0){let k=q.substring(w,E.index),y=E.index+11;return{start:H,end:y,arrayExpr:V,itemVar:N,content:k}}A=E.index+11}}}return null}function G(q,_){let W=q;while(!0){let z=X(W);if(!z)break;let{start:U,end:j,arrayExpr:B,itemVar:O,content:F}=z;try{let L=B.trim(),H;if(e(L))H=$0(L,Object.keys(_))(...Object.values(_));else H=X0(L,_);let V=!1;if(!Array.isArray(H))if(H instanceof Map)H=Array.from(H),V=!0;else if(H instanceof Set)H=Array.from(H);else if(typeof H==="string")H=Array.from(H);else if(H&&typeof H==="object"&&!(H instanceof Date)&&!(H instanceof RegExp))H=Object.entries(H),V=!0;else{let M=s("Foreach",`Error in @foreach: ${L} is not iterable`,p.TYPE_ERROR);W=W.substring(0,U)+M+W.substring(j);continue}let N=Y?.loops?.useAltLoopVariable??AG,w=O.trim(),R=null,A;if(w.includes("=>")){let M=w.split("=>").map((E)=>E.trim());if(M.length===2)R=M[0],A=M[1];else A=w}else A=w;let T="",I=H;for(let M=0;M<I.length;M++){let E=I[M],k={index:M,iteration:M+1,first:M===0,last:M===I.length-1,count:I.length},y={..._,loop:k,$loop:k};if(A.startsWith("[")&&A.endsWith("]")){let x=A.slice(1,-1).split(",").map((h)=>h.trim());if(Array.isArray(E))x.forEach((h,l)=>{if(h)y[h]=E[l]});else y[A]=E}else y[A]=E;if(R)if(V&&Array.isArray(E)&&E.length===2)y[R]=E[0],y[A]=E[1];else y[R]=M;let S=IG(F,y),b=I2(S);if(b.hasContinue){T+=b.content;continue}let D=M2(S);if(D.hasBreak){T+=D.content;break}if(S=D2(S,y),S=G(S,y),S=y1(S,y,J),S=DG(S),D=M2(S),D.hasBreak){T+=D.content;break}if(b=I2(S),b.hasContinue){T+=b.content;continue}S=q1(S,y,J),S=MG(S,y),S=TG(S,y),T+=S}W=W.substring(0,U)+T+W.substring(j)}catch(L){let H=s("Foreach",`Error in @foreach(${B.trim()} as ${O.trim()}): ${L instanceof Error?L.message:String(L)}`,p.EVALUATION_ERROR);W=W.substring(0,U)+H+W.substring(j)}}return W}Q=G(Q,Z),Q=kG(Q,Z);let K=Y?.loops?.maxWhileIterations??RG;return Q=bG(Q,Z,K),Q}function k2($){return F5($)}function kG($,Z){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let X=Q.index,G=X+Q[0].length-1,K=I0(J,"(",")",G);if(K===-1)break;let q=J.slice(G+1,K),_=K+1,W=G9(J.slice(X),"for","endfor");if(W.length===0)break;let z=W[0].content,U=X+W[0].end;if(!k2(q)){let j=s("For",`Unsafe expression in @for: ${q}`,p.UNSAFE_EXPRESSION);J=J.substring(0,X)+j+J.substring(U),Y=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),O=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,V)=>{return`\${${V}}`});O=E2(O);let L=Function(...j,`
2465
+ ${_9(`@method('${j}')`,Z)}`;return O}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,X,G,K,q,_="")=>{let W=X||G||"",z=K||q||"",U=$1(_),j=G5(W,Z),B=j!==void 0&&j!==null?j:z||"",O=U.match(/type=['"]([^'"]+)['"]/i),F=O?O[1]:"text",L=K5(W,Z),H=U.match(/class=['"]([^'"]+)['"]/i),V=W9(H?H[1]:"",J.input,L,J.inputError),A=U.replace(/class=['"][^'"]+['"]/i,"");return A=A.replace(/type=['"][^'"]+['"]/i,""),`<input type="${H0(F)}" name="${H0(W)}" value="${H0(B)}" class="${V}"${A?` ${A}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,X,G="",K="")=>{let q=$1(G),_=G5(X,Z)||K.trim(),W=K5(X,Z),z=q.match(/class=['"]([^'"]+)['"]/i),U=W9(z?z[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${H0(X)}" class="${U}"${j?` ${j}`:""}>${H0(_)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,X,G="",K)=>{let q=$1(G),_=G5(X,Z),W=K5(X,Z),z=q.match(/class=['"]([^'"]+)['"]/i),U=W9(z?z[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(_!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(O,F,L)=>{if((Array.isArray(_)?_.some((V)=>String(V)===L):String(_)===L)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return O});return`<select name="${H0(X)}" class="${U}"${j?` ${j}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="1",K="")=>{let q=$1(K),_=G5(X,Z),W=_!==void 0&&(Array.isArray(_)?_.some((B)=>String(B)===G):_===!0||String(_)===G),z=q.match(/class=['"]([^'"]+)['"]/i),U=z?z[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${H0(X)}" value="${H0(G)}" class="${U}"${W?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G,K="")=>{let q=$1(K),_=G5(X,Z),W=_!==void 0&&_===G,z=q.match(/class=['"]([^'"]+)['"]/i),U=z?z[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${H0(X)}" value="${H0(G)}" class="${U}"${W?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="")=>{let K=$1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),_=q?q[1]:"",W=K.includes("multiple"),z=K5(X,Z),U=K.match(/class=['"]([^'"]+)['"]/i),j=W9(U?U[1]:"",J.input,z,J.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),O=[`<input type="file" name="${H0(X)}"`,`class="${j}"`];if(_)O.push(`accept="${H0(_)}"`);if(W)O.push("multiple");if(B)O.push(B);return`${O.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,X,G="",K)=>{let q=$1(G),_=q.match(/class=['"]([^'"]+)['"]/i),W=_?_[1]:J.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${H0(X)}" class="${W}"${z?` ${z}`:""}>${K}</label>`}),Y}function H2($,Z,J=j2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,Q,X)=>{try{if(K5(Q,Z))return X.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return B2(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return B2(Q,Z)}let q=K.trim();if(e(q)){let _=X0(q,Z);return _!==void 0?String(_):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),Y}})}function K5($,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 B2($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function G5($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let Y=$.slice(0,-2);if(J=Z[Y],J!==void 0)return J}return Z[$]}function $1($){if(!$.trim())return"";let Z=[],J=$.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=Y.exec(J))!==null){let[,X,,G]=Q;Z.push(`${X}="${G.trim()}"`)}return Z.join(" ")}var j2;var L2=C(()=>{A0();j2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import F2 from"path";function QG($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function GG($,Z){if({...Z4,...Z.i18n}.cache&&$4[$]){let Q=$4[$],X=Z.i18n?.cacheMaxAge??0;if(!QG(Q,X))return Q.translations}if(q5[$]?.state==="loading")return q5[$].promise;t$[$]="loading";let Y=A2($,Z).then((Q)=>{return t$[$]="loaded",delete q5[$],Q}).catch((Q)=>{throw t$[$]="error",q5[$]={promise:Y,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return q5[$]={promise:Y,state:"loading"},Y}async function A2($,Z){let J={...Z4,...Z.i18n},Y=F2.resolve(import.meta.dir,"..",J.translationsDir),Q=_G(J.format),X=F2.join(Y,`${$}${Q}`);try{let G={};try{let K=await import(X);G=K.default||K}catch(K){let q=await Bun.file(X).text();if(J.format==="yaml"||J.format==="yml")G=qG(q);else if(J.format==="json")G=JSON.parse(q);else throw K}if(J.cache)$4[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(G){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,G);if($!==J.defaultLocale)return A2(J.defaultLocale,Z);return{}}}async function KG($,Z){return GG($,Z)}function qG($){let Z={},J=$.split(`
2466
+ `),Y=[{obj:Z,indent:-1}];for(let Q of J){let X=Q.replace(/#.*$/,"").trimEnd();if(!X.trim())continue;let G=X.search(/\S/);if(G===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=G)Y.pop();let K=Y[Y.length-1].obj,q=X.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,_,W]=q,z=_.trim(),U=W.trim();if(U==="")K[z]={},Y.push({obj:K[z],indent:G});else K[z]=WG(U)}}return Z}function WG($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let J=Number($);if(!Number.isNaN(J))return J;return $}function _G($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function zG($,Z){for(let J of $){let Y=J.trim(),Q=Y.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let X=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10),K=X[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(X[2],10);if(Z>=G&&Z<=K)return X[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function UG($,Z={}){return R2($,Z)}function R2($,Z){let J="",Y=0;while(Y<$.length)if($[Y]==="{"){let Q=BG($,Y);if(Q===-1){J+=$[Y],Y++;continue}let X=$.slice(Y+1,Q);J+=jG(X,Z),Y=Q+1}else if($[Y]==="'"&&Y+1<$.length)if($[Y+1]==="'")J+="'",Y+=2;else if($[Y+1]==="{"||$[Y+1]==="}")J+=$[Y+1],Y+=2;else J+=$[Y],Y++;else J+=$[Y],Y++;return J}function BG($,Z){let J=0;for(let Y=Z;Y<$.length;Y++)if($[Y]==="{")J++;else if($[Y]==="}"){if(J--,J===0)return Y}return-1}function jG($,Z){let J=OG($);if(J.length===0)return`{${$}}`;let Y=J[0].trim(),Q=Z[Y];if(J.length===1)return Q!==void 0?String(Q):`{${Y}}`;switch(J[1].trim().toLowerCase()){case"plural":return HG(Q,J.slice(2).join(","),Z);case"select":return FG(Q,J.slice(2).join(","));case"selectordinal":return VG(Q,J.slice(2).join(","));case"number":return AG(Q,J[2]?.trim());case"date":return RG(Q,J[2]?.trim());case"time":return NG(Q,J[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function OG($){let Z=[],J="",Y=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X==="{")Y++,J+=X;else if(X==="}")Y--,J+=X;else if(X===","&&Y===0)Z.push(J),J="";else J+=X}if(J)Z.push(J);return Z}function HG($,Z,J){let Y=Number($)||0,Q=Y4(Z),X=`=${Y}`;if(Q[X])return e$(Q[X],Y,J);let G=LG(Y);if(Q[G])return e$(Q[G],Y,J);if(Q.other)return e$(Q.other,Y,J);return String(Y)}function e$($,Z,J){let Y=$.replace(/#/g,String(Z));return R2(Y,J)}function LG($){let Z=Math.abs($),J=Math.floor(Z),Y=String($).includes(".")?String($).split(".")[1].length:0;if(J===1&&Y===0)return"one";return"other"}function FG($,Z){let J=String($||""),Y=Y4(Z);if(Y[J])return Y[J];return Y.other||String($)}function VG($,Z){let J=Number($)||0,Y=Y4(Z),Q=wG(J);if(Y[Q])return Y[Q].replace(/#/g,String(J));if(Y.other)return Y.other.replace(/#/g,String(J));return String(J)}function wG($){let Z=Math.abs($),J=Z%10,Y=Z%100;if(J===1&&Y!==11)return"one";if(J===2&&Y!==12)return"two";if(J===3&&Y!==13)return"few";return"other"}function Y4($){let Z={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=J.exec($);while(Y!==null)Z[Y[1]]=Y[2],Y=J.exec($);return Z}function AG($,Z){let J=Number($);if(Number.isNaN(J))return String($);switch(Z){case"integer":return Math.floor(J).toLocaleString();case"percent":return`${(J*100).toFixed(0)}%`;case"currency":return J.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return J.toLocaleString()}}function RG($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return J.toLocaleDateString(void 0,Y)}function NG($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return J.toLocaleTimeString(void 0,Y)}function TG($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function V2($,Z,J=!0,Y={}){let Q=$.split("."),X=Z;for(let K of Q){if(X===void 0||X===null)break;X=X[K]}if(X===void 0||X===null)return J?$:"";let G=String(X);if(TG(G))return UG(G,Y);if(G.includes("|")&&"count"in Y){let K=Number(Y.count),q=G.split("|");G=zG(q,K)}for(let[K,q]of Object.entries(Y)){let _=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${_}`,"g"),String(q))}return G}async function N2($,Z,J,Y){let Q=$,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...Z4,...Y.i18n},K=await KG(G.locale,Y);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await w2(Q,X,async(W,z,U,j,B)=>{try{let O={};if(U)try{let L=[()=>JSON.parse(U),()=>{let H=`{"data":${U}}`,V=JSON.parse(H);return typeof V.data==="object"?V.data:{}},()=>{return O0(U,Z)}];for(let H of L)try{if(O=H(),Object.keys(O).length>0)break}catch{}}catch(L){if(Y.debug)console.error("Error parsing parameters for @translate directive:",L)}return V2(z,K,G.fallbackToKey,O)||j.trim()}catch(O){if(Y.debug)console.error("Error processing @translate directive:",O);return s("Translate",`Error in @translate('${z}'): ${O instanceof Error?O.message:String(O)}`,p.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let W=[...Q.matchAll(q)];console.warn(`Found ${W.length} @translate matches`),W.forEach((z,U)=>console.warn(`Match ${U}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await w2(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,z,U,j)=>{try{let B={};if(U)try{let O=[()=>JSON.parse(U),()=>{let F=`{"data":${U}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return O0(U,Z)}];for(let F of O)try{if(B=F(),Object.keys(B).length>0)break}catch{}}catch(O){if(Y.debug)console.error("Error parsing parameters for @translate directive:",O)}return V2(z,K,G.fallbackToKey,B)}catch(B){if(Y.debug)console.error("Error processing @translate directive:",B);return s("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,p.EVALUATION_ERROR)}}),Q}async function w2($,Z,J){let Y=[];return $.replace(Z,(X,...G)=>{let K=J(X,...G).then((q)=>({match:X,replacement:q}));return Y.push(K),X}),(await Promise.all(Y)).reduce((X,{match:G,replacement:K})=>X.replace(G,K),$)}var Z4,$4,q5,t$;var T2=C(()=>{c0();A0();Z4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},$4={},q5={},t$={}});var S2={};r(S2,{processLoops:()=>J4});function DG($,Z){let J=/@component\s*\(/g,Y=$,Q,X=[];while((Q=J.exec(Y))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,_=K+1;while(_<Y.length&&q>0){if(Y[_]==="(")q++;else if(Y[_]===")"){if(q--,q===0)break}_++}if(q!==0)continue;let W=Y.substring(K+1,_),z=_+1,U=W.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let j=U[1],B=W.slice(U[0].length),O=B.match(/^\s*,\s*/);if(!O)continue;let F=B.slice(O[0].length).trim();if(!F)continue;try{let L=O0(F,Z),H=JSON.stringify(L),V=`@component('${j}', ${H})`;X.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=X[G];Y=Y.substring(0,K)+_+Y.substring(q)}return Y}function z9($,Z,J){let Y=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),X;while((X=Q.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,q=1,_=K+1,W=null,z=!1;while(_<Y.length&&q>0){let B=Y[_];if(z){z=!1,_++;continue}if(B==="\\"&&W){z=!0,_++;continue}if(W){if(B===W)W=null;_++;continue}if(B==='"'||B==="'"||B==="`"){W=B,_++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}_++}if(q!==0)break;let U=Y.substring(K+1,_),j=J(U);Y=Y.substring(0,G)+j+Y.substring(_+1)}return Y}function EG($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return Y}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,Q,X)=>{try{let G=Object.keys(Z),K=Object.values(Z);i1(X);let _=$0(X,G)(...K),z=JSON.stringify(_).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${Q}="${z}"`}catch(G){return Y}}),J}function kG($,Z){let J=$;return J=z9(J,"@break",(Y)=>{try{let X=`!!(${Y.trim()})`,G;if(e(X)){let K=$0(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(X0(X,Z));return G?U9:""}catch{return""}}),J=z9(J,"@continue",(Y)=>{try{let X=`!!(${Y.trim()})`,G;if(e(X)){let K=$0(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(X0(X,Z));return G?B9:""}catch{return""}}),J}function bG($){let Z=$;return Z=Z.replace(/@break(?!\()/g,U9),Z=Z.replace(/@continue(?!\()/g,B9),Z}function M2($){let Z=$.includes(U9),J=Z?$.substring(0,$.indexOf(U9)):$;return{hasBreak:Z,content:J}}function I2($){let Z=$.includes(B9),J=Z?$.substring(0,$.indexOf(B9)):$;return{hasContinue:Z,content:J}}function E2($){let Z=$;return Z=z9(Z,"@break",(J)=>{let Y=J.trim();if(!F5(Y))return"";return`\`; if (${Y}) { break; } result += \``}),Z=z9(Z,"@continue",(J)=>{let Y=J.trim();if(!F5(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function SG($){let Z=/@forelse\s*\(/g,J,Y=[],Q=/@foreach\s*\(/g,X=/@endforeach/g,G;while((G=Q.exec($))!==null)Y.push({pos:G.index,delta:1});while((G=X.exec($))!==null)Y.push({pos:G.index,delta:-1});Y.sort((W,z)=>W.pos-z.pos);let K=[],q=0;for(let W of Y)q+=W.delta,K.push({pos:W.pos,depth:q});function _(W){let z=0,U=K.length-1,j=0;while(z<=U){let B=z+U>>1;if(K[B].pos<=W)j=K[B].depth,z=B+1;else U=B-1}return j}while((J=Z.exec($))!==null){if(_(J.index)>0)continue;let W=J.index,z=J.index+J[0].length-1,U=1,j=z+1,B=-1;while(j<$.length&&U>0){if($[j]==="(")U++;else if($[j]===")"){if(U--,U===0){B=j;break}}j++}if(B===-1)continue;let O=$.substring(z+1,B),F=O.indexOf(" as ");if(F===-1)continue;let L=O.substring(0,F).trim(),H=O.substring(F+4).trim(),V=B+1,A=1,w=V,R=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(A>0&&w<$.length){R.lastIndex=w,N.lastIndex=w;let S=R.exec($),b=N.exec($);if(!b)break;if(S&&S.index<b.index)A++,w=S.index+S[0].length;else{if(A--,A===0){T=b.index;break}w=b.index+11}}if(T===-1)continue;let I=$.substring(V,T),M=T+11,E=-1,k=0,y=0;while(y<I.length){let S=I.indexOf("@",y);if(S===-1)break;let b=I.substring(S);if(/^@forelse\s*\(/.test(b))k++,y=S+1;else if(b.startsWith("@endforelse"))k--,y=S+11;else if(k===0&&b.startsWith("@empty")){if(I.length<=S+6||!/[a-z]/i.test(I[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:W,end:M,arrayExpr:L,itemVar:H,foreachContent:I.substring(0,E),emptyContent:I.substring(E+6)}}return null}function D2($,Z){let J=$;while(!0){let Y=SG(J);if(!Y)break;let{start:Q,end:X,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:_}=Y;try{let W;if(e(G))W=$0(G,Object.keys(Z))(...Object.values(Z));else W=X0(G,Z);let z;if(!Array.isArray(W)||W.length===0)z=_;else z=`@foreach (${G} as ${K})${q}@endforeach`;J=J.substring(0,Q)+z+J.substring(X)}catch(W){let z=W instanceof Error?W.message:String(W),U=s("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,p.EVALUATION_ERROR);J=J.substring(0,Q)+U+J.substring(X)}}return J}function J4($,Z,J,Y){let Q=$;Q=D2(Q,Z);function X(q){let _=/@foreach\s*\(/g,W;while((W=_.exec(q))!==null){let z=W.index,U=W.index+W[0].length-1,j=1,B=U+1,O=-1;while(B<q.length&&j>0){if(q[B]==="(")j++;else if(q[B]===")"){if(j--,j===0){O=B;break}}B++}if(O===-1)continue;let F=q.substring(U+1,O),L=F.indexOf(" as ");if(L===-1)continue;let H=z,V=F.substring(0,L),A=F.substring(L+4),w=O+1,R=1,N=w,T=/@foreach\s*\(/g,I=/@endforeach/g;while(R>0&&N<q.length){T.lastIndex=N,I.lastIndex=N;let M=T.exec(q),E=I.exec(q);if(!E)break;if(M&&M.index<E.index)R++,N=M.index+M[0].length;else{if(R--,R===0){let k=q.substring(w,E.index),y=E.index+11;return{start:H,end:y,arrayExpr:V,itemVar:A,content:k}}N=E.index+11}}}return null}function G(q,_){let W=q;while(!0){let z=X(W);if(!z)break;let{start:U,end:j,arrayExpr:B,itemVar:O,content:F}=z;try{let L=B.trim(),H;if(e(L))H=$0(L,Object.keys(_))(...Object.values(_));else H=X0(L,_);let V=!1;if(!Array.isArray(H))if(H instanceof Map)H=Array.from(H),V=!0;else if(H instanceof Set)H=Array.from(H);else if(typeof H==="string")H=Array.from(H);else if(H&&typeof H==="object"&&!(H instanceof Date)&&!(H instanceof RegExp))H=Object.entries(H),V=!0;else{let M=s("Foreach",`Error in @foreach: ${L} is not iterable`,p.TYPE_ERROR);W=W.substring(0,U)+M+W.substring(j);continue}let A=Y?.loops?.useAltLoopVariable??IG,w=O.trim(),R=null,N;if(w.includes("=>")){let M=w.split("=>").map((E)=>E.trim());if(M.length===2)R=M[0],N=M[1];else N=w}else N=w;let T="",I=H;for(let M=0;M<I.length;M++){let E=I[M],k={index:M,iteration:M+1,first:M===0,last:M===I.length-1,count:I.length},y={..._,loop:k,$loop:k};if(N.startsWith("[")&&N.endsWith("]")){let x=N.slice(1,-1).split(",").map((h)=>h.trim());if(Array.isArray(E))x.forEach((h,l)=>{if(h)y[h]=E[l]});else y[N]=E}else y[N]=E;if(R)if(V&&Array.isArray(E)&&E.length===2)y[R]=E[0],y[N]=E[1];else y[R]=M;let S=kG(F,y),b=I2(S);if(b.hasContinue){T+=b.content;continue}let D=M2(S);if(D.hasBreak){T+=D.content;break}if(S=D2(S,y),S=G(S,y),S=L1(S,y,J),S=bG(S),D=M2(S),D.hasBreak){T+=D.content;break}if(b=I2(S),b.hasContinue){T+=b.content;continue}S=o0(S,y,J),S=EG(S,y),S=DG(S,y),T+=S}W=W.substring(0,U)+T+W.substring(j)}catch(L){let H=s("Foreach",`Error in @foreach(${B.trim()} as ${O.trim()}): ${L instanceof Error?L.message:String(L)}`,p.EVALUATION_ERROR);W=W.substring(0,U)+H+W.substring(j)}}return W}Q=G(Q,Z),Q=b2(Q,Z,J,Y);let K=Y?.loops?.maxWhileIterations??MG;return Q=PG(Q,Z,K),Q}function k2($){return F5($)}function b2($,Z,J,Y){let Q=$,X=!0;while(X){X=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,_=I0(Q,"(",")",q);if(_===-1)break;let W=Q.slice(q+1,_),z=_+1,U=G9(Q.slice(K),"for","endfor");if(U.length===0)break;let j=U[0].content,B=K+U[0].end;if(!k2(W)){let O=s("For",`Unsafe expression in @for: ${W}`,p.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+O+Q.substring(B),X=!0;continue}try{let O=yG(W),F=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(O.length>0&&F){let R=CG({forExpr:W,content:j,iterVarNames:O,context:Z,filePath:J,options:Y});Q=Q.substring(0,K)+R+Q.substring(B),X=!0;continue}let L=Object.keys(Z),H=Object.values(Z),V=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});V=E2(V);let w=Function(...L,`
2466
2467
  let result = '';
2467
- for (${q}) {
2468
- result += \`${O}\`;
2468
+ for (${W}) {
2469
+ result += \`${V}\`;
2469
2470
  }
2470
2471
  return result;
2471
- `)(...B);J=J.substring(0,X)+L+J.substring(U),Y=!0}catch(j){let B=s("For",`Error in @for(${q}): ${j instanceof Error?j.message:String(j)}`,p.EVALUATION_ERROR);J=J.substring(0,X)+B+J.substring(U),Y=!0}}return J}function bG($,Z,J){let Y=$,Q=!0;while(Q){Q=!1;let X=Y.match(/@while\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=G+X[0].length-1,q=I0(Y,"(",")",K);if(q===-1)break;let _=Y.slice(K+1,q),W=G9(Y.slice(G),"while","endwhile");if(W.length===0)break;let z=W[0].content,U=G+W[0].end;if(!k2(_)){let j=s("While",`Unsafe expression in @while: ${_}`,p.UNSAFE_EXPRESSION);Y=Y.substring(0,G)+j+Y.substring(U),Q=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),O=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,V)=>{return`\${${V}}`});O=E2(O);let L=Function(...j,`
2472
+ `)(...H);Q=Q.substring(0,K)+w+Q.substring(B),X=!0}catch(O){let F=s("For",`Error in @for(${W}): ${O instanceof Error?O.message:String(O)}`,p.EVALUATION_ERROR);Q=Q.substring(0,K)+F+Q.substring(B),X=!0}}return Q}function yG($){let Z=$.trim(),J=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(J){let X=J[1];return X.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let _=q.indexOf(":");if(_>=0&&X.startsWith("{")){let U=q.slice(_+1).trim(),j=U.indexOf("=");return(j>=0?U.slice(0,j):U).trim()}let W=q.indexOf("="),z=(W>=0?q.slice(0,W):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function CG($){let{forExpr:Z,content:J,iterVarNames:Y,context:Q,filePath:X,options:G}=$,K=Object.keys(Q),q=Object.values(Q),_=Function(...K,"__pushIter",`
2473
+ for (${Z}) {
2474
+ __pushIter([${Y.join(", ")}])
2475
+ }
2476
+ `),W=[];_(...q,(j)=>{W.push(j)});let z=X??"inline.stx",U="";for(let j of W){let B={...Q};Y.forEach((F,L)=>{B[F]=j[L]});let O=b2(J,B,X,G);O=L1(O,B,z),O=o0(O,B,z),U+=O}return U}function PG($,Z,J){let Y=$,Q=!0;while(Q){Q=!1;let X=Y.match(/@while\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=G+X[0].length-1,q=I0(Y,"(",")",K);if(q===-1)break;let _=Y.slice(K+1,q),W=G9(Y.slice(G),"while","endwhile");if(W.length===0)break;let z=W[0].content,U=G+W[0].end;if(!k2(_)){let j=s("While",`Unsafe expression in @while: ${_}`,p.UNSAFE_EXPRESSION);Y=Y.substring(0,G)+j+Y.substring(U),Q=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),O=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,V)=>{return`\${${V}}`});O=E2(O);let L=Function(...j,`
2472
2477
  let result = '';
2473
2478
  let maxIterations = ${J}; // Configurable safety limit
2474
2479
  let counter = 0;
@@ -2480,8 +2485,8 @@ ${Q}`)}function Q2($,Z,J,Y){let Q=$,X=Y.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!X?
2480
2485
  result += '<!-- [While Error [1104]]: Maximum iterations (${J}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
2481
2486
  }
2482
2487
  return result;
2483
- `)(...B);Y=Y.substring(0,G)+L+Y.substring(U),Q=!0}catch(j){let B=s("While",`Error in @while(${_}): ${j instanceof Error?j.message:String(j)}`,p.EVALUATION_ERROR);Y=Y.substring(0,G)+B+Y.substring(U),Q=!0}}return Y}var RG=1000,AG=!1,U9="<!--__STX_BREAK__-->",B9="<!--__STX_CONTINUE__-->";var X4=C(()=>{K9();c0();o0();n$();N0()});import K0 from"path";function Q4($,Z){let J=0;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(Q==="("||Q==="["||Q==="{")J++;else if(Q===")"||Q==="]"||Q==="}")J--;else if(Q===","&&J===0)return Y}return-1}function SG($,Z,J){let Y=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),X=Q.exec(Y);while(X){let G=X.index,K=G+X[0].length-1,q=1,_=K+1;while(_<Y.length&&q>0){if(Y[_]==="(")q++;else if(Y[_]===")")q--;_++}if(q!==0)break;let W=Y.substring(K+1,_-1),z=`${J}(${W})`;Y=Y.substring(0,G)+z+Y.substring(_),Q.lastIndex=G+z.length,X=Q.exec(Y)}return Y}function yG($){return/\b(state|derived|effect)\s*\(/.test($)}function CG($){let Z=$,J=[],Y=new Set,Q=0,X=0,G=Z.length,K=(z)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===z){X++;return}X++}},q=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let z=1;while(X<G&&z>0)if(Z[X]==="{")z++;else if(Z[X]==="}")z--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},_=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
2484
- `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},W=()=>{if(Q!==0)return;let z=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!Y.has(B))J.push(B),Y.add(B);return}let U=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!Y.has(B))J.push(B),Y.add(B);return}let j=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))J.push(B),Y.add(B)}};while(X<G){if(_())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){Q++,X++;continue}if(Z[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))W();X++}return J.join(", ")}function PG($,Z){let J=CG($);return`
2488
+ `)(...B);Y=Y.substring(0,G)+L+Y.substring(U),Q=!0}catch(j){let B=s("While",`Error in @while(${_}): ${j instanceof Error?j.message:String(j)}`,p.EVALUATION_ERROR);Y=Y.substring(0,G)+B+Y.substring(U),Q=!0}}return Y}var MG=1000,IG=!1,U9="<!--__STX_BREAK__-->",B9="<!--__STX_CONTINUE__-->";var X4=C(()=>{K9();c0();s0();n$();A0()});import K0 from"path";function Q4($,Z){let J=0;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(Q==="("||Q==="["||Q==="{")J++;else if(Q===")"||Q==="]"||Q==="}")J--;else if(Q===","&&J===0)return Y}return-1}function vG($,Z,J){let Y=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),X=Q.exec(Y);while(X){let G=X.index,K=G+X[0].length-1,q=1,_=K+1;while(_<Y.length&&q>0){if(Y[_]==="(")q++;else if(Y[_]===")")q--;_++}if(q!==0)break;let W=Y.substring(K+1,_-1),z=`${J}(${W})`;Y=Y.substring(0,G)+z+Y.substring(_),Q.lastIndex=G+z.length,X=Q.exec(Y)}return Y}function xG($){return/\b(state|derived|effect)\s*\(/.test($)}function fG($){let Z=$,J=[],Y=new Set,Q=0,X=0,G=Z.length,K=(z)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===z){X++;return}X++}},q=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let z=1;while(X<G&&z>0)if(Z[X]==="{")z++;else if(Z[X]==="}")z--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},_=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
2489
+ `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},W=()=>{if(Q!==0)return;let z=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!Y.has(B))J.push(B),Y.add(B);return}let U=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!Y.has(B))J.push(B),Y.add(B);return}let j=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))J.push(B),Y.add(B)}};while(X<G){if(_())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){Q++,X++;continue}if(Z[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))W();X++}return J.join(", ")}function gG($,Z){let J=fG($);return`
2485
2490
  (function() {
2486
2491
  var { state, derived, effect, batch, onMount, onDestroy, useFetch, useRef, useQuery, useMutation, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect } = window.stx;
2487
2492
  var __destroyHooks = [];
@@ -2494,38 +2499,38 @@ ${$}
2494
2499
  if (!window.stx._scopes) window.stx._scopes = {};
2495
2500
  window.stx._scopes['${Z}'] = { ${J}, __destroyCallbacks: __destroyHooks };
2496
2501
  })();
2497
- `}function vG($,Z){let J=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let Q=(J[2]+J[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let X=J[1],G=J[2],K=J[3];return{html:`${X}${G} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function gG($){if($.__onceStore instanceof Set)return $.__onceStore;return fG}async function G4($,Z,J,Y,Q,X=new Set){let G=Y.partialsDir||K0.join(K0.dirname(J),"partials");if(G&&!K0.isAbsolute(G)){let B=K0.resolve(__dirname,"..");G=K0.resolve(B,G)}let K=SG($,"@partial","@include"),q=gG(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,O,F)=>{let L=O.trim(),H=`${J}:${L}`;if(q.has(H))return"";return q.add(H),O});{let B=/@includeIf\s*\(/g,O;while((O=B.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")")H--;V++}if(H!==0)break;let N=K.substring(L+1,V-1),w=N.match(/^\s*['"]([^'"]+)['"]/);if(!w){B.lastIndex=V;continue}let R=w[1],A=_(R,G,J),T="";if(A&&await Bun.file(A).exists())Q.add(A),T=`@include(${N})`;K=K.substring(0,F)+T+K.substring(V),B.lastIndex=0}}for(let[B,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let F=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=F.exec(K))!==null){let H=L.index,V=H+L[0].length-1,N=1,w=V+1;while(w<K.length&&N>0){if(K[w]==="(")N++;else if(K[w]===")")N--;w++}if(N!==0)break;let R=K.substring(V+1,w-1),A=Q4(R,0);if(A===-1){F.lastIndex=w;continue}let T=R.substring(0,A).trim(),I=R.substring(A+1).trim(),M=I.match(/^\s*['"]([^'"]+)['"]/);if(!M){F.lastIndex=w;continue}let E=M[1],k=I.substring(M[0].length),y,S=Q4(k,0);if(S!==-1)y=k.substring(S+1).trim();try{let b=`Boolean(${T})`,D;if(e(b)){let l=$0(b,Object.keys(Z));D=Boolean(l(...Object.values(Z)))}else D=Boolean(X0(b,Z));let x=O?!D:D,h="";if(x){let l=_(E,G,J);if(l&&await Bun.file(l).exists())Q.add(l);h=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,H)+h+K.substring(w),F.lastIndex=0}catch(b){let D=b instanceof Error?b.message:String(b),x=Q0("Include",`Error evaluating ${B} condition: ${D}`,J,$,H);K=K.substring(0,H)+x+K.substring(w),F.lastIndex=0}}}{let B=/@each\s*\(/g,O;while((O=B.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let N=K.substring(L+1,V),w=K.substring(F,V+1),R=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){B.lastIndex=0,K=K.replace(w,"");continue}let[,A,T,I,M]=R;try{let E,k=T.trim();if(e(k))E=$0(k,Object.keys(Z))(...Object.values(Z));else E=X0(k,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let b={...Z,[I]:S},D=await z(A,b,$,F);y+=D}else if(M)y=await z(M,{},$,F);K=K.substring(0,F)+y+K.substring(V+1),B.lastIndex=0}catch(E){let k=E instanceof Error?E.message:String(E);K=K.substring(0,F)+Q0("Each",`Error in @each: ${k}`,J,$,F)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,O;while((O=B.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let N=K.substring(L+1,V),w=K.substring(F,V+1),R=N.match(/^\s*(\[[^\]]+\])/);if(!R){B.lastIndex=0,K=K.replace(w,"");continue}let A=R[1],T=N.slice(R[0].length),I,M=T.match(/^\s*,\s*\{/);if(M){T=T.slice(M[0].length-1);let y=1,S=1;while(S<T.length&&y>0){if(T[S]==="{")y++;else if(T[S]==="}"){if(y--,y===0)break}S++}I=T.substring(0,S+1),T=T.slice(S+1)}let E,k=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)E=k[1];try{let y=JSON.parse(A.replace(/'/g,'"')),S={};if(I)try{S=O0(I,Z)}catch(D){let x=D instanceof Error?D.message:String(D);if(Y.debug){let h=Q0("Include",`Error parsing includeFirst variables: ${x}`,J,$,F,w);K=K.replace(w,()=>h)}else K=K.replace(w,()=>E||"");continue}let b=!1;for(let D of y){let x=_(D,G,J);if(!x)continue;if(await i(x)){let h=await z(D,S,$,F);K=K.replace(w,()=>h),b=!0;break}}if(!b)if(E!==void 0)K=K.replace(w,()=>E);else if(Y.debug){let D=Q0("Include",`None of the includeFirst paths exist: ${A}`,J,$,F,w);K=K.replace(w,()=>D)}else K=K.replace(w,"")}catch(y){let S=y instanceof Error?y.message:String(y),b=Q0("Include",`Error processing @includeFirst: ${S}`,J,$,F,w);K=K.replace(w,()=>b)}B.lastIndex=0}}function _(B,O,F){try{let L=B;if(!B.endsWith(".stx"))L=`${B}.stx`;let H=K0.resolve(O),V=K0.resolve(K0.dirname(F)),N;if(!L.startsWith("./")&&!L.startsWith("../"))N=K0.resolve(O,L);else N=K0.resolve(V,L);let w=K0.normalize(N),R=w.startsWith(H+K0.sep)||w===H,A=w.startsWith(V+K0.sep)||w===V,T=!1,I=K0.dirname(V);if(w.startsWith(I+K0.sep)){if(!K0.relative(I,w).split(K0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))T=!0}if(!R&&!A&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${w}`),console.error(` Allowed dirs: ${H}, ${V}`),null;return w}catch(L){return console.error(`Error resolving path ${B}: ${L}`),null}}let W=K0.resolve(J);X.add(W);async function z(B,O={},F,L){let H=_(B,G,J);if(!H)return Q0("Include",`Could not resolve path for include: ${B}`,J,F,L);let V=K0.resolve(H);if(X.has(V)){let N=[...X,V].map((w)=>K0.basename(w)).join(" -> ");return Q0("Include",`Circular include detected: ${N}`,J,F,L)}try{Q.add(H);let N;if(!N)try{N=await Bun.file(H).text()}catch(D){let x=D instanceof Error?D.message:String(D);return Q0("Include",`Error loading include file ${B}: ${x}`,J,F,L)}let w=N,R=w.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(R)w=R[1].trim();let A=N.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(A)T=`<style${A[1]}>${A[2]}</style>`;w=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=w.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[D,x]of Object.entries(O))I[D]=x;let M=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...N.matchAll(M)],k="",y=null;for(let D of E){let x=D[1]||"",h=D[2]||"",l=x.includes("server");if(Q1(x)&&h.trim())h=G1(h);let M0=yG(h);if(M0&&!l){y=`stx_scope_${K0.basename(H,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++xG}`;let _0=n0(h),S0=PG(_0,y);k+=`<script data-stx-scoped>${S0}</script>
2502
+ `}function hG($,Z){let J=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let Q=(J[2]+J[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let X=J[1],G=J[2],K=J[3];return{html:`${X}${G} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function uG($){if($.__onceStore instanceof Set)return $.__onceStore;return mG}async function G4($,Z,J,Y,Q,X=new Set){let G=Y.partialsDir||K0.join(K0.dirname(J),"partials");if(G&&!K0.isAbsolute(G)){let B=K0.resolve(__dirname,"..");G=K0.resolve(B,G)}let K=vG($,"@partial","@include"),q=uG(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,O,F)=>{let L=O.trim(),H=`${J}:${L}`;if(q.has(H))return"";return q.add(H),O});{let B=/@includeIf\s*\(/g,O;while((O=B.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")")H--;V++}if(H!==0)break;let A=K.substring(L+1,V-1),w=A.match(/^\s*['"]([^'"]+)['"]/);if(!w){B.lastIndex=V;continue}let R=w[1],N=_(R,G,J),T="";if(N&&await Bun.file(N).exists())Q.add(N),T=`@include(${A})`;K=K.substring(0,F)+T+K.substring(V),B.lastIndex=0}}for(let[B,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let F=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=F.exec(K))!==null){let H=L.index,V=H+L[0].length-1,A=1,w=V+1;while(w<K.length&&A>0){if(K[w]==="(")A++;else if(K[w]===")")A--;w++}if(A!==0)break;let R=K.substring(V+1,w-1),N=Q4(R,0);if(N===-1){F.lastIndex=w;continue}let T=R.substring(0,N).trim(),I=R.substring(N+1).trim(),M=I.match(/^\s*['"]([^'"]+)['"]/);if(!M){F.lastIndex=w;continue}let E=M[1],k=I.substring(M[0].length),y,S=Q4(k,0);if(S!==-1)y=k.substring(S+1).trim();try{let b=`Boolean(${T})`,D;if(e(b)){let l=$0(b,Object.keys(Z));D=Boolean(l(...Object.values(Z)))}else D=Boolean(X0(b,Z));let x=O?!D:D,h="";if(x){let l=_(E,G,J);if(l&&await Bun.file(l).exists())Q.add(l);h=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,H)+h+K.substring(w),F.lastIndex=0}catch(b){let D=b instanceof Error?b.message:String(b),x=Q0("Include",`Error evaluating ${B} condition: ${D}`,J,$,H);K=K.substring(0,H)+x+K.substring(w),F.lastIndex=0}}}{let B=/@each\s*\(/g,O;while((O=B.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let A=K.substring(L+1,V),w=K.substring(F,V+1),R=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){B.lastIndex=0,K=K.replace(w,"");continue}let[,N,T,I,M]=R;try{let E,k=T.trim();if(e(k))E=$0(k,Object.keys(Z))(...Object.values(Z));else E=X0(k,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let b={...Z,[I]:S},D=await z(N,b,$,F);y+=D}else if(M)y=await z(M,{},$,F);K=K.substring(0,F)+y+K.substring(V+1),B.lastIndex=0}catch(E){let k=E instanceof Error?E.message:String(E);K=K.substring(0,F)+Q0("Each",`Error in @each: ${k}`,J,$,F)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,O;while((O=B.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let A=K.substring(L+1,V),w=K.substring(F,V+1),R=A.match(/^\s*(\[[^\]]+\])/);if(!R){B.lastIndex=0,K=K.replace(w,"");continue}let N=R[1],T=A.slice(R[0].length),I,M=T.match(/^\s*,\s*\{/);if(M){T=T.slice(M[0].length-1);let y=1,S=1;while(S<T.length&&y>0){if(T[S]==="{")y++;else if(T[S]==="}"){if(y--,y===0)break}S++}I=T.substring(0,S+1),T=T.slice(S+1)}let E,k=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)E=k[1];try{let y=JSON.parse(N.replace(/'/g,'"')),S={};if(I)try{S=O0(I,Z)}catch(D){let x=D instanceof Error?D.message:String(D);if(Y.debug){let h=Q0("Include",`Error parsing includeFirst variables: ${x}`,J,$,F,w);K=K.replace(w,()=>h)}else K=K.replace(w,()=>E||"");continue}let b=!1;for(let D of y){let x=_(D,G,J);if(!x)continue;if(await i(x)){let h=await z(D,S,$,F);K=K.replace(w,()=>h),b=!0;break}}if(!b)if(E!==void 0)K=K.replace(w,()=>E);else if(Y.debug){let D=Q0("Include",`None of the includeFirst paths exist: ${N}`,J,$,F,w);K=K.replace(w,()=>D)}else K=K.replace(w,"")}catch(y){let S=y instanceof Error?y.message:String(y),b=Q0("Include",`Error processing @includeFirst: ${S}`,J,$,F,w);K=K.replace(w,()=>b)}B.lastIndex=0}}function _(B,O,F){try{let L=B;if(!B.endsWith(".stx"))L=`${B}.stx`;let H=K0.resolve(O),V=K0.resolve(K0.dirname(F)),A;if(!L.startsWith("./")&&!L.startsWith("../"))A=K0.resolve(O,L);else A=K0.resolve(V,L);let w=K0.normalize(A),R=w.startsWith(H+K0.sep)||w===H,N=w.startsWith(V+K0.sep)||w===V,T=!1,I=K0.dirname(V);if(w.startsWith(I+K0.sep)){if(!K0.relative(I,w).split(K0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))T=!0}if(!R&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${w}`),console.error(` Allowed dirs: ${H}, ${V}`),null;return w}catch(L){return console.error(`Error resolving path ${B}: ${L}`),null}}let W=K0.resolve(J);X.add(W);async function z(B,O={},F,L){let H=_(B,G,J);if(!H)return Q0("Include",`Could not resolve path for include: ${B}`,J,F,L);let V=K0.resolve(H);if(X.has(V)){let A=[...X,V].map((w)=>K0.basename(w)).join(" -> ");return Q0("Include",`Circular include detected: ${A}`,J,F,L)}try{Q.add(H);let A;if(!A)try{A=await Bun.file(H).text()}catch(D){let x=D instanceof Error?D.message:String(D);return Q0("Include",`Error loading include file ${B}: ${x}`,J,F,L)}let w=A,R=w.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(R)w=R[1].trim();let N=A.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(N)T=`<style${N[1]}>${N[2]}</style>`;w=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=w.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[D,x]of Object.entries(O))I[D]=x;let M=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...A.matchAll(M)],k="",y=null;for(let D of E){let x=D[1]||"",h=D[2]||"",l=x.includes("server");if(G1(x)&&h.trim())h=K1(h);let M0=xG(h);if(M0&&!l){y=`stx_scope_${K0.basename(H,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++dG}`;let _0=n0(h),S0=gG(_0,y);k+=`<script data-stx-scoped>${S0}</script>
2498
2503
  `;continue}if(l)try{let{extractVariables:_0}=await Promise.resolve().then(() => (t1(),T5));await _0(h,I,H)}catch(_0){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${H}:`,_0)}if(!l&&!M0){let _0=x.replace(/\bclient\b/i,"").trim();k+=`<script data-stx-scoped${_0?` ${_0}`:""}>${h}</script>
2499
- `}}if(y){let D=vG(w,y);if(w=D.html,D.mergedIntoExisting)k=k.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${D.mergedIntoExisting}']`),y=D.mergedIntoExisting}if(w.includes("@include")||w.includes("@partial"))w=await G4(w,I,H,Y,Q,X);let{processLoops:S}=await Promise.resolve().then(() => (X4(),b2)),b=S(w,I,H);if(b=y1(b,I,H),b=q1(b,I,H),T)b+=`
2504
+ `}}if(y){let D=hG(w,y);if(w=D.html,D.mergedIntoExisting)k=k.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${D.mergedIntoExisting}']`),y=D.mergedIntoExisting}if(w.includes("@include")||w.includes("@partial"))w=await G4(w,I,H,Y,Q,X);let{processLoops:S}=await Promise.resolve().then(() => (X4(),S2)),b=S(w,I,H);if(b=L1(b,I,H),b=o0(b,I,H),T)b+=`
2500
2505
  `+T;if(k)b+=`
2501
- `+k;return b}catch(N){let w=N instanceof Error?N.message:String(N);return Q0("Include",`Error processing include ${B}: ${w}`,J,F,L)}}let U=/@include\s*\(/g,j;while((j=U.exec(K))!==null){let B=j.index,O=B+j[0].length-1,F=1,L=O+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")")F--;L++}if(F!==0)break;let H=K.substring(B,L),V=K.substring(O+1,L-1),N=V.match(/^\s*['"]([^'"]+)['"]/);if(!N){U.lastIndex=L;continue}let w=N[1],R,A=V.substring(N[0].length),T=Q4(A,0);if(T!==-1)R=A.substring(T+1).trim();let I={};if(R)try{I=O0(R,Z)}catch(E){let k=E instanceof Error?E.message:String(E);K=K.replace(H,Q0("Include",`Error parsing include variables for ${w}: ${k}`,J,$,B)),U.lastIndex=0;continue}let M=await z(w,I,$,B);K=K.substring(0,B)+M+K.substring(L),U.lastIndex=0}return K}function K4($,Z){let J=$;function Y(Q,X,G,K){let q=Q,_=!0;while(_){_=!1;let W=new RegExp(`@${X}\\(['"]([^'"]+)['"]\\)`),z=q.match(W);if(!z||z.index===void 0)break;let U=z.index,j=z[1],B=U+z[0].length,O=new RegExp(`@${X}\\(`),F=new RegExp(`@${G}(?![a-z])`),L=1,H=B,V=-1;while(L>0&&H<q.length){let w=q.slice(H),R=w.match(O),A=w.match(F),T=R?H+R.index:1/0,I=A?H+A.index:1/0;if(T<I)L++,H=T+(R[0].length||1);else if(I<1/0){if(L--,L===0){V=I;break}H=I+G.length+1}else break}if(V===-1)break;let N=q.slice(B,V);if(!Z[j])Z[j]=[];if(K)Z[j].unshift(N);else Z[j].push(N);q=q.substring(0,U)+q.substring(V+`@${G}`.length),_=!0}return q}return J=Y(J,"push","endpush",!1),J=Y(J,"prepend","endprepend",!0),J}function q4($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,Y)=>{if(!Z[Y]||Z[Y].length===0)return"";return Z[Y].join(`
2502
- `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",xG=0,Yj,fG;var S2=C(()=>{K9();o0();M1();N0();F0();Yj=new o1(500),fG=new Set});import*as W4 from"path";async function y2($,Z,J=""){if(W4.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return P2($,Z,J,"@js","@endjs")}async function C2($,Z,J=""){if(W4.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((X)=>({...X,displayName:`User ${X.id}: ${X.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return P2($,Z,J,"@ts","@endts")}async function P2($,Z,J,Y,Q){let X=$,G=T1(`${Y}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:_,content:W,index:z}of K)try{let U=Object.keys(Z),j=Object.values(Z),B=W.trim();if(Y==="@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 F=(B.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((w)=>w.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",H=`
2506
+ `+k;return b}catch(A){let w=A instanceof Error?A.message:String(A);return Q0("Include",`Error processing include ${B}: ${w}`,J,F,L)}}let U=/@include\s*\(/g,j;while((j=U.exec(K))!==null){let B=j.index,O=B+j[0].length-1,F=1,L=O+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")")F--;L++}if(F!==0)break;let H=K.substring(B,L),V=K.substring(O+1,L-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){U.lastIndex=L;continue}let w=A[1],R,N=V.substring(A[0].length),T=Q4(N,0);if(T!==-1)R=N.substring(T+1).trim();let I={};if(R)try{I=O0(R,Z)}catch(E){let k=E instanceof Error?E.message:String(E);K=K.replace(H,Q0("Include",`Error parsing include variables for ${w}: ${k}`,J,$,B)),U.lastIndex=0;continue}let M=await z(w,I,$,B);K=K.substring(0,B)+M+K.substring(L),U.lastIndex=0}return K}function K4($,Z){let J=$;function Y(Q,X,G,K){let q=Q,_=!0;while(_){_=!1;let W=new RegExp(`@${X}\\(['"]([^'"]+)['"]\\)`),z=q.match(W);if(!z||z.index===void 0)break;let U=z.index,j=z[1],B=U+z[0].length,O=new RegExp(`@${X}\\(`),F=new RegExp(`@${G}(?![a-z])`),L=1,H=B,V=-1;while(L>0&&H<q.length){let w=q.slice(H),R=w.match(O),N=w.match(F),T=R?H+R.index:1/0,I=N?H+N.index:1/0;if(T<I)L++,H=T+(R[0].length||1);else if(I<1/0){if(L--,L===0){V=I;break}H=I+G.length+1}else break}if(V===-1)break;let A=q.slice(B,V);if(!Z[j])Z[j]=[];if(K)Z[j].unshift(A);else Z[j].push(A);q=q.substring(0,U)+q.substring(V+`@${G}`.length),_=!0}return q}return J=Y(J,"push","endpush",!1),J=Y(J,"prepend","endprepend",!0),J}function q4($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,Y)=>{if(!Z[Y]||Z[Y].length===0)return"";return Z[Y].join(`
2507
+ `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",dG=0,Gj,mG;var y2=C(()=>{K9();s0();I1();A0();F0();Gj=new s1(500),mG=new Set});import*as W4 from"path";async function C2($,Z,J=""){if(W4.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return v2($,Z,J,"@js","@endjs")}async function P2($,Z,J=""){if(W4.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((X)=>({...X,displayName:`User ${X.id}: ${X.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return v2($,Z,J,"@ts","@endts")}async function v2($,Z,J,Y,Q){let X=$,G=M1(`${Y}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:_,content:W,index:z}of K)try{let U=Object.keys(Z),j=Object.values(Z),B=W.trim();if(Y==="@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 F=(B.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((w)=>w.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",H=`
2503
2508
  ${B}
2504
2509
  ${L}
2505
- `,N=Function(...U,H)(...j);if(N&&typeof N==="object")Object.assign(Z,N);X=X.replace(_,"")}catch(U){console.error(`Error executing ${Y} code block in ${J}:`,U);let j=U instanceof Error?U.message:String(U),B=Q0(`${Y} Directive`,`Error executing code: ${j}`,J,$,z,_);console.error(B),X=X.replace(_,"")}return X}var v2=C(()=>{M1();F0()});function hG($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function x2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,Y,Q,X)=>{return hG(Y,X||"_method")})}async function f2($,Z,J,Y,Q){if(!Y.middleware||Y.middleware.length===0)return $;let X=$,G=Y.middleware.filter((K)=>K.timing===Q);if(G.length===0)return X;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(X,Z,J,Y);if(typeof q==="string")X=q;else if(Y.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(Y.debug)console.error(`Error in middleware ${K.name}:`,q);if(Y.debug){let _=Q0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,J,$);X=X.replace(/<body[^>]*>/,`$&
2506
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${K1(_)}</div>
2507
- `)}}}return X}async function g2($,Z,J,Y){return f2($,Z,J,Y,"before")}async function h2($,Z,J,Y){return f2($,Z,J,Y,"after")}var d2=C(()=>{o0();F0()});import{defineRoute as Oj,defineRoutes as Hj,resetRoutes as Lj,route as Fj,setAppUrl as Vj}from"stx-router";import{route as dG}from"stx-router";function m2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,Y,Q,X)=>{try{let G=Q?O0(Q,{}):{};return dG(Y,G,X==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var u2=C(()=>{N0()});async function p2($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(W5.exact[$])for(let Y of W5.exact[$])await Promise.resolve(Y(Z,$));if(W5.exact[J])for(let Y of W5.exact[J])await Promise.resolve(Y(Z,$));for(let{pattern:Y,callback:Q}of W5.patterns)if(Y.test($)||Y.test(J))await Promise.resolve(Q(Z,$))}var W5;var l2=C(()=>{W5={patterns:[],exact:{}}});function c2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>c2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function i2($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],X;while((X=Y.exec($))!==null)Q.push([X.index,X.index+X[0].length]);function G(_){return Q.some(([W,z])=>_>=W&&_<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((X=K.exec(J))!==null){if(G(X.index))continue;let _=X[0],W=X[2];if(!W||!W.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,U,j=W,B=!1;while((U=z.exec(W))!==null){let O=U[1],F=U[2];if(F.includes("()")&&!F.includes(".get(")||F.includes("$store")||F.includes("$ref"))continue;try{let L=Object.keys(Z),H=Object.values(Z),V=F.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!L.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let w=Function(...L,`return (${F})`)(...H);if(O==="class"){let R=c2(w);if(R){let A=j.match(/\sclass="([^"]*)"/);if(A)j=j.replace(A[0],` class="${A[1]} ${R}"`);else j=j.replace(U[0],` class="${R}"`)}else j=j.replace(U[0],"");B=!0;continue}if(mG.has(O)){if(w)j=j.replace(U[0],` ${O}`);else j=j.replace(U[0],"");B=!0;continue}if(w===null||w===void 0||w===!1)j=j.replace(U[0],"");else{let R=String(w).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(U[0],` ${O}="${R}"`)}B=!0}catch{continue}}if(B){let O=_.endsWith("/>")?" /":"",L=`<${X[1]}${j}${O}>`;q.push({start:X.index,end:X.index+_.length,replacement:L})}}for(let _=q.length-1;_>=0;_--){let{start:W,end:z,replacement:U}=q[_];J=J.slice(0,W)+U+J.slice(z)}return J}var mG;var n2=C(()=>{mG=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function L1($,Z){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=Z;let Y=J.exec($);if(!Y)return null;return{full:Y[0],tag:Y[1],attrs:Y[2],selfClosing:Y[3].includes("/")||uG.has(Y[1].toLowerCase()),start:Y.index,end:Y.index+Y[0].length}}function lG($,Z,J){let Y=1,Q=J,X=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(Y>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q;let K=X.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)Y++,Q=K.index+K[0].length;else{if(Y--,Y===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function h0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=lG($,Z.tag,Z.end);if(J===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:J,innerHTML:$.slice(Z.end,J-`</${Z.tag}>`.length)}}function o2($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function C1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return Y?Y[1]:null}function $1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function Z1($,Z,J){let Y=Z.selfClosing?" /":"",Q=`<${Z.tag}${J}${Y}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function cG($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function iG($){let Z=$,J=0;while(J<Z.length){let Y=L1(Z,J);if(!Y)break;let Q=C1(Y.attrs,"v-for");if(Q===null){J=Y.end;continue}let X=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!X){J=Y.end;continue}let G=X[1].trim(),K=X[2].trim(),q;if(G.includes(",")){let F=G.split(",").map((V)=>V.trim()),L=F[0],H=F[1];q=`${K} as ${H} => ${L}`}else q=`${K} as ${G}`;let _=$1(Y.attrs,"v-for"),W=$1(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=h0(Z,Y),U=Z.slice(z.outerStart,z.outerEnd),j=Z1(U,{...Y,start:0,end:Y.end-Y.start},W),B=`@foreach(${q})
2510
+ `,A=Function(...U,H)(...j);if(A&&typeof A==="object")Object.assign(Z,A);X=X.replace(_,"")}catch(U){console.error(`Error executing ${Y} code block in ${J}:`,U);let j=U instanceof Error?U.message:String(U),B=Q0(`${Y} Directive`,`Error executing code: ${j}`,J,$,z,_);console.error(B),X=X.replace(_,"")}return X}var x2=C(()=>{I1();F0()});function pG($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function f2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,Y,Q,X)=>{return pG(Y,X||"_method")})}async function g2($,Z,J,Y,Q){if(!Y.middleware||Y.middleware.length===0)return $;let X=$,G=Y.middleware.filter((K)=>K.timing===Q);if(G.length===0)return X;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(X,Z,J,Y);if(typeof q==="string")X=q;else if(Y.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(Y.debug)console.error(`Error in middleware ${K.name}:`,q);if(Y.debug){let _=Q0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,J,$);X=X.replace(/<body[^>]*>/,`$&
2511
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${q1(_)}</div>
2512
+ `)}}}return X}async function h2($,Z,J,Y){return g2($,Z,J,Y,"before")}async function d2($,Z,J,Y){return g2($,Z,J,Y,"after")}var m2=C(()=>{s0();F0()});import{defineRoute as Vj,defineRoutes as wj,resetRoutes as Aj,route as Rj,setAppUrl as Nj}from"stx-router";import{route as lG}from"stx-router";function u2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,Y,Q,X)=>{try{let G=Q?O0(Q,{}):{};return lG(Y,G,X==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var p2=C(()=>{A0()});async function l2($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(W5.exact[$])for(let Y of W5.exact[$])await Promise.resolve(Y(Z,$));if(W5.exact[J])for(let Y of W5.exact[J])await Promise.resolve(Y(Z,$));for(let{pattern:Y,callback:Q}of W5.patterns)if(Y.test($)||Y.test(J))await Promise.resolve(Q(Z,$))}var W5;var c2=C(()=>{W5={patterns:[],exact:{}}});function i2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>i2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function n2($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],X;while((X=Y.exec($))!==null)Q.push([X.index,X.index+X[0].length]);function G(_){return Q.some(([W,z])=>_>=W&&_<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((X=K.exec(J))!==null){if(G(X.index))continue;let _=X[0],W=X[2];if(!W||!W.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,U,j=W,B=!1;while((U=z.exec(W))!==null){let O=U[1],F=U[2];if(F.includes("()")&&!F.includes(".get(")||F.includes("$store")||F.includes("$ref"))continue;try{let L=Object.keys(Z),H=Object.values(Z),V=F.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!L.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let w=Function(...L,`return (${F})`)(...H);if(O==="class"){let R=i2(w);if(R){let N=j.match(/\sclass="([^"]*)"/);if(N)j=j.replace(N[0],` class="${N[1]} ${R}"`);else j=j.replace(U[0],` class="${R}"`)}else j=j.replace(U[0],"");B=!0;continue}if(cG.has(O)){if(w)j=j.replace(U[0],` ${O}`);else j=j.replace(U[0],"");B=!0;continue}if(w===null||w===void 0||w===!1)j=j.replace(U[0],"");else{let R=String(w).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(U[0],` ${O}="${R}"`)}B=!0}catch{continue}}if(B){let O=_.endsWith("/>")?" /":"",L=`<${X[1]}${j}${O}>`;q.push({start:X.index,end:X.index+_.length,replacement:L})}}for(let _=q.length-1;_>=0;_--){let{start:W,end:z,replacement:U}=q[_];J=J.slice(0,W)+U+J.slice(z)}return J}var cG;var o2=C(()=>{cG=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function F1($,Z){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=Z;let Y=J.exec($);if(!Y)return null;return{full:Y[0],tag:Y[1],attrs:Y[2],selfClosing:Y[3].includes("/")||iG.has(Y[1].toLowerCase()),start:Y.index,end:Y.index+Y[0].length}}function oG($,Z,J){let Y=1,Q=J,X=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(Y>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q;let K=X.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)Y++,Q=K.index+K[0].length;else{if(Y--,Y===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function h0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=oG($,Z.tag,Z.end);if(J===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:J,innerHTML:$.slice(Z.end,J-`</${Z.tag}>`.length)}}function s2($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function P1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return Y?Y[1]:null}function Z1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function Y1($,Z,J){let Y=Z.selfClosing?" /":"",Q=`<${Z.tag}${J}${Y}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function sG($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function rG($){let Z=$,J=0;while(J<Z.length){let Y=F1(Z,J);if(!Y)break;let Q=P1(Y.attrs,"v-for");if(Q===null){J=Y.end;continue}let X=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!X){J=Y.end;continue}let G=X[1].trim(),K=X[2].trim(),q;if(G.includes(",")){let F=G.split(",").map((V)=>V.trim()),L=F[0],H=F[1];q=`${K} as ${H} => ${L}`}else q=`${K} as ${G}`;let _=Z1(Y.attrs,"v-for"),W=Z1(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=h0(Z,Y),U=Z.slice(z.outerStart,z.outerEnd),j=Y1(U,{...Y,start:0,end:Y.end-Y.start},W),B=`@foreach(${q})
2508
2513
  `,O=`${B}${j}
2509
- @endforeach`;Z=Z.slice(0,z.outerStart)+O+Z.slice(z.outerEnd),J=z.outerStart+B.length}return Z}function nG($){let Z=$,J=0;while(J<Z.length){let Y=L1(Z,J);if(!Y)break;let Q=C1(Y.attrs,"v-if");if(Q===null){J=Y.end;continue}let X=[],G=h0(Z,Y),K=$1(Y.attrs,"v-if"),q=Z1(Z.slice(G.outerStart,G.outerEnd),{...Y,start:0,end:Y.end-Y.start},K);X.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:Y});let _=G.outerEnd,W=!0;while(W){let O=Z.slice(_).match(/^\s*/),F=O?O[0].length:0,L=L1(Z,_+F);if(!L){W=!1;break}let H=C1(L.attrs,"v-else-if"),V=o2(L.attrs,"v-else");if(H!==null){let N=h0(Z,L),w=$1(L.attrs,"v-else-if"),R=Z1(Z.slice(N.outerStart,N.outerEnd),{...L,start:0,end:L.end-L.start},w);X.push({type:"else-if",expr:H,outerStart:_,outerEnd:N.outerEnd,element:R,parsedTag:L}),_=N.outerEnd}else if(V){let N=h0(Z,L),w=$1(L.attrs,"v-else"),R=Z1(Z.slice(N.outerStart,N.outerEnd),{...L,start:0,end:L.end-L.start},w);X.push({type:"else",outerStart:_,outerEnd:N.outerEnd,element:R,parsedTag:L}),W=!1}else W=!1}let z=[];for(let O of X)if(O.type==="if")z.push(`@if(${O.expr})
2514
+ @endforeach`;Z=Z.slice(0,z.outerStart)+O+Z.slice(z.outerEnd),J=z.outerStart+B.length}return Z}function aG($){let Z=$,J=0;while(J<Z.length){let Y=F1(Z,J);if(!Y)break;let Q=P1(Y.attrs,"v-if");if(Q===null){J=Y.end;continue}let X=[],G=h0(Z,Y),K=Z1(Y.attrs,"v-if"),q=Y1(Z.slice(G.outerStart,G.outerEnd),{...Y,start:0,end:Y.end-Y.start},K);X.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:Y});let _=G.outerEnd,W=!0;while(W){let O=Z.slice(_).match(/^\s*/),F=O?O[0].length:0,L=F1(Z,_+F);if(!L){W=!1;break}let H=P1(L.attrs,"v-else-if"),V=s2(L.attrs,"v-else");if(H!==null){let A=h0(Z,L),w=Z1(L.attrs,"v-else-if"),R=Y1(Z.slice(A.outerStart,A.outerEnd),{...L,start:0,end:L.end-L.start},w);X.push({type:"else-if",expr:H,outerStart:_,outerEnd:A.outerEnd,element:R,parsedTag:L}),_=A.outerEnd}else if(V){let A=h0(Z,L),w=Z1(L.attrs,"v-else"),R=Y1(Z.slice(A.outerStart,A.outerEnd),{...L,start:0,end:L.end-L.start},w);X.push({type:"else",outerStart:_,outerEnd:A.outerEnd,element:R,parsedTag:L}),W=!1}else W=!1}let z=[];for(let O of X)if(O.type==="if")z.push(`@if(${O.expr})
2510
2515
  ${O.element}`);else if(O.type==="else-if")z.push(`@elseif(${O.expr})
2511
2516
  ${O.element}`);else z.push(`@else
2512
2517
  ${O.element}`);z.push("@endif");let U=z.join(`
2513
- `),j=X[0].outerStart,B=X[X.length-1].outerEnd;Z=Z.slice(0,j)+U+Z.slice(B),J=j+U.length}return Z}function oG($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function sG($){let Z=$,J=0;while(J<Z.length){let Y=L1(Z,J);if(!Y)break;let Q=Y.attrs,X=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){X=!0;let W=K[1],z=K[2],U=K[3];Q=Q.replace(K[0],""),Q+=` :${W}="${U}" @update:${W}="${U} = $event"`,K=Q.match(G)}if(X){let W=h0(Z,Y),z=Z.slice(W.outerStart,W.outerEnd),U=Z1(z,{...Y,start:0,end:Y.end-Y.start},Q);Z=Z.slice(0,W.outerStart)+U+Z.slice(W.outerEnd),J=W.outerStart+U.length;continue}let q=C1(Y.attrs,"v-model");if(q===null){J=Y.end;continue}if(pG.has(Y.tag.toLowerCase())){let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=h0(Z,Y),U=Z.slice(z.outerStart,z.outerEnd),j=Z1(U,{...Y,start:0,end:Y.end-Y.start},W);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),J=z.outerStart+j.length}else{let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=h0(Z,Y),U=Z.slice(z.outerStart,z.outerEnd),j=Z1(U,{...Y,start:0,end:Y.end-Y.start},W);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),J=z.outerStart+j.length}}return Z}function rG($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function aG($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function tG($){let Z=$,J=0;while(J<Z.length){let Y=L1(Z,J);if(!Y)break;let Q=C1(Y.attrs,"v-html");if(Q===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let X=h0(Z,Y),G=$1(Y.attrs,"v-html"),K=Y.selfClosing?" /":"",q=`<${Y.tag}${G}${K}>{!! ${Q} !!}</${Y.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function eG($){let Z=$,J=0;while(J<Z.length){let Y=L1(Z,J);if(!Y)break;let Q=C1(Y.attrs,"v-text");if(Q===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let X=h0(Z,Y),G=$1(Y.attrs,"v-text"),K=Y.selfClosing?" /":"",q=`<${Y.tag}${G}${K}>{{ ${Q} }}</${Y.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function $K($){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 ZK($){let Z=$,J=0;while(J<Z.length){let Y=L1(Z,J);if(!Y)break;if(!o2(Y.attrs,"v-once")){J=Y.end;continue}let Q=$1(Y.attrs,"v-once"),X=h0(Z,Y),G=Z.slice(X.outerStart,X.outerEnd),q=`@once
2514
- ${Z1(G,{...Y,start:0,end:Y.end-Y.start},Q)}
2515
- @endonce`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function YK($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function JK($){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 s2($){if(!cG($))return $;let Z=$;return Z=iG(Z),Z=nG(Z),Z=ZK(Z),Z=rG(Z),Z=aG(Z),Z=sG(Z),Z=oG(Z),Z=JK(Z),Z=tG(Z),Z=eG(Z),Z=$K(Z),Z=YK(Z),Z}var uG,pG;var r2=C(()=>{uG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),pG=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"])});async function a2($,Z,J,Y,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let _=K.length-1;_>=0;_--){let W=K[_];try{let z=X0(W.expr,Z);if(!z||typeof z!=="string"){let H=`<!-- dynamic component: could not resolve "${W.expr}" -->`;X=X.slice(0,W.index)+H+X.slice(W.index+W.full.length);continue}let U=W.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,O;while((O=B.exec(U))!==null){let H=O[1]||O[2],V=O[3];if(O[1])try{j[H]=X0(V,Z)}catch{j[H]=V}else j[H]=V}let F=Y.componentsDir||"components",L=await z1(z,j,W.slotContent,F,Z,J,Y,new Set,Q??new Set);X=X.slice(0,W.index)+L+X.slice(W.index+W.full.length)}catch(z){let j=`<!-- dynamic component error: ${z instanceof Error?z.message:String(z)} -->`;X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length)}}return X=await XK(X,Z,J,Y,Q),X}async function XK($,Z,J,Y,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let _=K.length-1;_>=0;_--){let W=K[_];try{let z=X0(W.expr,Z);if(!z||typeof z!=="string"){let B=`<!-- dynamic component: could not resolve "${W.expr}" -->`;X=X.slice(0,W.index)+B+X.slice(W.index+W.full.length);continue}let U=Y.componentsDir||"components",j=await z1(z,{},"",U,Z,J,Y,new Set,Q??new Set);X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length)}catch(z){let j=`<!-- dynamic component error: ${z instanceof Error?z.message:String(z)} -->`;X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length)}}return X}var t2=C(()=>{F0();N0()});function QK($,Z={},J={}){let{title:Y="stx App",lang:Q="en",meta:X=[],link:G=[],script:K=[],headRaw:q="",bodyClass:_="",bodyAttrs:W={}}=Z,z=J.title||Y,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...X].map((w)=>{return` <meta ${Object.entries(w).map(([A,T])=>`${A}="${T}"`).join(" ")}>`}).join(`
2516
- `),O=G.map((w)=>{return` <link ${Object.entries(w).map(([A,T])=>`${A}="${T}"`).join(" ")}>`}).join(`
2517
- `),F=K.map((w)=>{if(w.src)return` <script ${Object.entries(w).filter(([A])=>A!=="content").map(([A,T])=>`${A}="${T}"`).join(" ")}></script>`;if(w.content)return` <script>${w.content}</script>`;return""}).filter(Boolean).join(`
2518
- `),L=Object.entries(W).map(([w,R])=>` ${w}="${R}"`).join(""),H=_?` class="${_}"`:"",V=[B,` <title>${z}</title>`,O,F,q?` ${q}`:"",...(J.styles||[]).map((w)=>` ${w}`),...(J.headScripts||[]).map((w)=>` ${w}`),J.headStack||""].filter(Boolean),N=[$,...(J.bodyScripts||[]).map((w)=>w),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
2518
+ `),j=X[0].outerStart,B=X[X.length-1].outerEnd;Z=Z.slice(0,j)+U+Z.slice(B),J=j+U.length}return Z}function tG($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function eG($){let Z=$,J=0;while(J<Z.length){let Y=F1(Z,J);if(!Y)break;let Q=Y.attrs,X=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){X=!0;let W=K[1],z=K[2],U=K[3];Q=Q.replace(K[0],""),Q+=` :${W}="${U}" @update:${W}="${U} = $event"`,K=Q.match(G)}if(X){let W=h0(Z,Y),z=Z.slice(W.outerStart,W.outerEnd),U=Y1(z,{...Y,start:0,end:Y.end-Y.start},Q);Z=Z.slice(0,W.outerStart)+U+Z.slice(W.outerEnd),J=W.outerStart+U.length;continue}let q=P1(Y.attrs,"v-model");if(q===null){J=Y.end;continue}if(nG.has(Y.tag.toLowerCase())){let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=h0(Z,Y),U=Z.slice(z.outerStart,z.outerEnd),j=Y1(U,{...Y,start:0,end:Y.end-Y.start},W);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),J=z.outerStart+j.length}else{let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=h0(Z,Y),U=Z.slice(z.outerStart,z.outerEnd),j=Y1(U,{...Y,start:0,end:Y.end-Y.start},W);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),J=z.outerStart+j.length}}return Z}function $K($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function ZK($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function YK($){let Z=$,J=0;while(J<Z.length){let Y=F1(Z,J);if(!Y)break;let Q=P1(Y.attrs,"v-html");if(Q===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let X=h0(Z,Y),G=Z1(Y.attrs,"v-html"),K=Y.selfClosing?" /":"",q=`<${Y.tag}${G}${K}>{!! ${Q} !!}</${Y.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function JK($){let Z=$,J=0;while(J<Z.length){let Y=F1(Z,J);if(!Y)break;let Q=P1(Y.attrs,"v-text");if(Q===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let X=h0(Z,Y),G=Z1(Y.attrs,"v-text"),K=Y.selfClosing?" /":"",q=`<${Y.tag}${G}${K}>{{ ${Q} }}</${Y.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function XK($){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 QK($){let Z=$,J=0;while(J<Z.length){let Y=F1(Z,J);if(!Y)break;if(!s2(Y.attrs,"v-once")){J=Y.end;continue}let Q=Z1(Y.attrs,"v-once"),X=h0(Z,Y),G=Z.slice(X.outerStart,X.outerEnd),q=`@once
2519
+ ${Y1(G,{...Y,start:0,end:Y.end-Y.start},Q)}
2520
+ @endonce`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function GK($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function KK($){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 r2($){if(!sG($))return $;let Z=$;return Z=rG(Z),Z=aG(Z),Z=QK(Z),Z=$K(Z),Z=ZK(Z),Z=eG(Z),Z=tG(Z),Z=KK(Z),Z=YK(Z),Z=JK(Z),Z=XK(Z),Z=GK(Z),Z}var iG,nG;var a2=C(()=>{iG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),nG=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"])});async function t2($,Z,J,Y,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let _=K.length-1;_>=0;_--){let W=K[_];try{let z=X0(W.expr,Z);if(!z||typeof z!=="string"){let H=`<!-- dynamic component: could not resolve "${W.expr}" -->`;X=X.slice(0,W.index)+H+X.slice(W.index+W.full.length);continue}let U=W.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,O;while((O=B.exec(U))!==null){let H=O[1]||O[2],V=O[3];if(O[1])try{j[H]=X0(V,Z)}catch{j[H]=V}else j[H]=V}let F=Y.componentsDir||"components",L=await z1(z,j,W.slotContent,F,Z,J,Y,new Set,Q??new Set);X=X.slice(0,W.index)+L+X.slice(W.index+W.full.length)}catch(z){let j=`<!-- dynamic component error: ${z instanceof Error?z.message:String(z)} -->`;X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length)}}return X=await qK(X,Z,J,Y,Q),X}async function qK($,Z,J,Y,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let _=K.length-1;_>=0;_--){let W=K[_];try{let z=X0(W.expr,Z);if(!z||typeof z!=="string"){let B=`<!-- dynamic component: could not resolve "${W.expr}" -->`;X=X.slice(0,W.index)+B+X.slice(W.index+W.full.length);continue}let U=Y.componentsDir||"components",j=await z1(z,{},"",U,Z,J,Y,new Set,Q??new Set);X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length)}catch(z){let j=`<!-- dynamic component error: ${z instanceof Error?z.message:String(z)} -->`;X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length)}}return X}var e2=C(()=>{F0();A0()});function WK($,Z={},J={}){let{title:Y="stx App",lang:Q="en",meta:X=[],link:G=[],script:K=[],headRaw:q="",bodyClass:_="",bodyAttrs:W={}}=Z,z=J.title||Y,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...X].map((w)=>{return` <meta ${Object.entries(w).map(([N,T])=>`${N}="${T}"`).join(" ")}>`}).join(`
2521
+ `),O=G.map((w)=>{return` <link ${Object.entries(w).map(([N,T])=>`${N}="${T}"`).join(" ")}>`}).join(`
2522
+ `),F=K.map((w)=>{if(w.src)return` <script ${Object.entries(w).filter(([N])=>N!=="content").map(([N,T])=>`${N}="${T}"`).join(" ")}></script>`;if(w.content)return` <script>${w.content}</script>`;return""}).filter(Boolean).join(`
2523
+ `),L=Object.entries(W).map(([w,R])=>` ${w}="${R}"`).join(""),H=_?` class="${_}"`:"",V=[B,` <title>${z}</title>`,O,F,q?` ${q}`:"",...(J.styles||[]).map((w)=>` ${w}`),...(J.headScripts||[]).map((w)=>` ${w}`),J.headStack||""].filter(Boolean),A=[$,...(J.bodyScripts||[]).map((w)=>w),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
2519
2524
  <html lang="${Q}">
2520
2525
  <head>
2521
2526
  ${V.join(`
2522
2527
  `)}
2523
2528
  </head>
2524
2529
  <body${H}${L}>
2525
- ${N.join(`
2530
+ ${A.join(`
2526
2531
  `)}
2527
2532
  </body>
2528
- </html>`}function GK($){let Z=$.trim();while(Z.startsWith("<!--")){let J=Z.indexOf("-->");if(J===-1)break;Z=Z.slice(J+3).trim()}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}function e2($,Z={},J={}){if(GK($))return $;return QK($,Z,J)}function _4($){let Z=$,J=new Set,Y=new Set,Q=()=>{if(k0)Y.add(k0);return Z};return Q.set=(X)=>{if(!Object.is(X,Z)){let G=Z;if(Z=X,J.forEach((K)=>K(Z,G)),_5)Y.forEach((K)=>O9.add(K));else Y.forEach((K)=>K())}},Q.update=(X)=>{Q.set(X(Z))},Q.subscribe=(X)=>{return J.add(X),()=>J.delete(X)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function z4($){let Z,J=!0,Y=new Set,Q=()=>{if(!J)if(J=!0,_5)Y.forEach((G)=>O9.add(G));else Y.forEach((G)=>G())},X=()=>{if(k0)Y.add(k0);if(J){let G=k0;k0=Q,j9.push(Q);try{Z=$()}finally{j9.pop(),k0=G}J=!1}return Z};return Object.defineProperty(X,"_isDerived",{value:!0,writable:!1}),X}function U4($,Z={}){let J,Y=!1,Q=()=>{if(Y)return;if(J)J(),J=void 0;let X=k0;k0=Q,j9.push(Q);try{J=$()}finally{j9.pop(),k0=X}};if(Z.immediate!==!1)Q();return()=>{if(Y=!0,J)J()}}function B4($){if(_5){$();return}_5=!0;try{$()}finally{_5=!1,O9.forEach((Z)=>Z()),O9.clear()}}function j4($){KK.push($)}function O4($){qK.push($)}function H9($){return typeof $==="function"&&$._isSignal===!0}function L9($){return typeof $==="function"&&$._isDerived===!0}function H4($){if(H9($)||L9($))return $();return $}function L4($){let Z=k0;k0=null;try{return $()}finally{k0=Z}}var k0=null,j9,_5=!1,O9,KK,qK;var F4=C(()=>{j9=[],O9=new Set,KK=[],qK=[]});var V4={};r(V4,{untrack:()=>H4,state:()=>_4,peek:()=>L4,onMount:()=>j4,onDestroy:()=>O4,isSignal:()=>H9,isDerived:()=>L9,generateSignalsRuntimeDev:()=>F9,generateSignalsRuntime:()=>$8,effect:()=>U4,derived:()=>z4,default:()=>WK,batch:()=>B4});function $8(){try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(F9());return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return F9()}}function F9(){return`
2533
+ </html>`}function _K($){let Z=$.trim();while(Z.startsWith("<!--")){let J=Z.indexOf("-->");if(J===-1)break;Z=Z.slice(J+3).trim()}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}function $8($,Z={},J={}){if(_K($))return $;return WK($,Z,J)}function _4($){let Z=$,J=new Set,Y=new Set,Q=()=>{if(k0)Y.add(k0);return Z};return Q.set=(X)=>{if(!Object.is(X,Z)){let G=Z;if(Z=X,J.forEach((K)=>K(Z,G)),_5)Y.forEach((K)=>O9.add(K));else Y.forEach((K)=>K())}},Q.update=(X)=>{Q.set(X(Z))},Q.subscribe=(X)=>{return J.add(X),()=>J.delete(X)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function z4($){let Z,J=!0,Y=new Set,Q=()=>{if(!J)if(J=!0,_5)Y.forEach((G)=>O9.add(G));else Y.forEach((G)=>G())},X=()=>{if(k0)Y.add(k0);if(J){let G=k0;k0=Q,j9.push(Q);try{Z=$()}finally{j9.pop(),k0=G}J=!1}return Z};return Object.defineProperty(X,"_isDerived",{value:!0,writable:!1}),X}function U4($,Z={}){let J,Y=!1,Q=()=>{if(Y)return;if(J)J(),J=void 0;let X=k0;k0=Q,j9.push(Q);try{J=$()}finally{j9.pop(),k0=X}};if(Z.immediate!==!1)Q();return()=>{if(Y=!0,J)J()}}function B4($){if(_5){$();return}_5=!0;try{$()}finally{_5=!1,O9.forEach((Z)=>Z()),O9.clear()}}function j4($){zK.push($)}function O4($){UK.push($)}function H9($){return typeof $==="function"&&$._isSignal===!0}function L9($){return typeof $==="function"&&$._isDerived===!0}function H4($){if(H9($)||L9($))return $();return $}function L4($){let Z=k0;k0=null;try{return $()}finally{k0=Z}}var k0=null,j9,_5=!1,O9,zK,UK;var F4=C(()=>{j9=[],O9=new Set,zK=[],UK=[]});var V4={};r(V4,{untrack:()=>H4,state:()=>_4,peek:()=>L4,onMount:()=>j4,onDestroy:()=>O4,isSignal:()=>H9,isDerived:()=>L9,generateSignalsRuntimeDev:()=>F9,generateSignalsRuntime:()=>Z8,effect:()=>U4,derived:()=>z4,default:()=>BK,batch:()=>B4});function Z8(){try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(F9());return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return F9()}}function F9(){return`
2529
2534
  // STX Signals Runtime (Development Build)
2530
2535
  console.log('[stx] signals runtime loading');
2531
2536
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -6618,7 +6623,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
6618
6623
  }
6619
6624
  }
6620
6625
  })();
6621
- `}var WK;var w4=C(()=>{F4();F4();WK={state:_4,derived:z4,effect:U4,batch:B4,onMount:j4,onDestroy:O4,isSignal:H9,isDerived:L9,untrack:H4,peek:L4,generateSignalsRuntime:$8,generateSignalsRuntimeDev:F9}});var N4={};r(N4,{templateCache:()=>Z8,readFileCached:()=>_K,invalidateFileCacheByDir:()=>UK,invalidateFileCache:()=>zK,hashFilePath:()=>z5,getCachedSignalsRuntime:()=>jK,getCachedRouterScript:()=>OK,clearDevCaches:()=>HK,checkCache:()=>LK,cacheTemplate:()=>FK});import Y1 from"fs";import P1 from"path";async function _K($){let J;for(let Y=0;Y<3;Y++)try{let X=(await Y1.promises.stat($)).mtime.getTime(),G=F1.get($);if(G&&G.mtime===X)return G.content;let K=await Bun.file($).text(),_=(await Y1.promises.stat($)).mtime.getTime();if(_!==X)continue;return F1.set($,{content:K,mtime:_}),K}catch(Q){J=Q;break}throw F1.delete($),Error(`File not found: ${$}${J?` (${J.message})`:""}`)}function zK($){F1.delete($)}function UK($){for(let Z of F1.keys())if(Z.startsWith($))F1.delete(Z)}async function jK($=!1){if($){let{generateSignalsRuntimeDev:Z}=await Promise.resolve().then(() => (w4(),V4));return Z()}if(V9===null){let{generateSignalsRuntime:Z}=await Promise.resolve().then(() => (w4(),V4));V9=Z()}return V9}async function OK(){if(w9===null){let{getRouterScript:$}=await import("stx-router");w9=$()}return w9}function HK(){F1.clear(),V9=null,BK=null,w9=null}async function LK($,Z){try{if(!Z.cachePath)return null;let J=P1.resolve(Z.cachePath),Y=P1.join(J,`${z5($)}.html`),Q=P1.join(J,`${z5($)}.meta.json`);if(!await i(Y)||!await i(Q))return null;let X=await Bun.file(Q).text(),G=JSON.parse(X);if(G.cacheVersion!==Z.cacheVersion)return null;if((await Y1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await i(q)){if((await Y1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(Y).text()}catch(J){return console.warn(`Cache error for ${$}:`,J),null}}async function FK($,Z,J,Y){try{if(!Y.cachePath)return;let Q=P1.resolve(Y.cachePath);await Y1.promises.mkdir(Q,{recursive:!0});let X=P1.join(Q,`${z5($)}.html`),G=P1.join(Q,`${z5($)}.meta.json`),K=await Y1.promises.stat($);await Bun.write(X,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(J),cacheVersion:Y.cacheVersion,generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),Z8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:J})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function z5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,VK)}var Z8,F1,V9=null,BK=null,w9=null,VK=16;var R4=C(()=>{F0();Z8=new Map,F1=new Map});function Y8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,J="",Y;while((Y=Z.exec($))!==null)J+=Y[1]+`
6626
+ `}var BK;var w4=C(()=>{F4();F4();BK={state:_4,derived:z4,effect:U4,batch:B4,onMount:j4,onDestroy:O4,isSignal:H9,isDerived:L9,untrack:H4,peek:L4,generateSignalsRuntime:Z8,generateSignalsRuntimeDev:F9}});var A4={};r(A4,{templateCache:()=>Y8,readFileCached:()=>jK,invalidateFileCacheByDir:()=>HK,invalidateFileCache:()=>OK,hashFilePath:()=>z5,getCachedSignalsRuntime:()=>FK,getCachedRouterScript:()=>VK,clearDevCaches:()=>wK,checkCache:()=>AK,cacheTemplate:()=>RK});import J1 from"fs";import v1 from"path";async function jK($){let J;for(let Y=0;Y<3;Y++)try{let X=(await J1.promises.stat($)).mtime.getTime(),G=V1.get($);if(G&&G.mtime===X)return G.content;let K=await Bun.file($).text(),_=(await J1.promises.stat($)).mtime.getTime();if(_!==X)continue;return V1.set($,{content:K,mtime:_}),K}catch(Q){J=Q;break}throw V1.delete($),Error(`File not found: ${$}${J?` (${J.message})`:""}`)}function OK($){V1.delete($)}function HK($){for(let Z of V1.keys())if(Z.startsWith($))V1.delete(Z)}async function FK($=!1){if($){let{generateSignalsRuntimeDev:Z}=await Promise.resolve().then(() => (w4(),V4));return Z()}if(V9===null){let{generateSignalsRuntime:Z}=await Promise.resolve().then(() => (w4(),V4));V9=Z()}return V9}async function VK(){if(w9===null){let{getRouterScript:$}=await import("stx-router");w9=$()}return w9}function wK(){V1.clear(),V9=null,LK=null,w9=null}async function AK($,Z){try{if(!Z.cachePath)return null;let J=v1.resolve(Z.cachePath),Y=v1.join(J,`${z5($)}.html`),Q=v1.join(J,`${z5($)}.meta.json`);if(!await i(Y)||!await i(Q))return null;let X=await Bun.file(Q).text(),G=JSON.parse(X);if(G.cacheVersion!==Z.cacheVersion)return null;if((await J1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await i(q)){if((await J1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(Y).text()}catch(J){return console.warn(`Cache error for ${$}:`,J),null}}async function RK($,Z,J,Y){try{if(!Y.cachePath)return;let Q=v1.resolve(Y.cachePath);await J1.promises.mkdir(Q,{recursive:!0});let X=v1.join(Q,`${z5($)}.html`),G=v1.join(Q,`${z5($)}.meta.json`),K=await J1.promises.stat($);await Bun.write(X,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(J),cacheVersion:Y.cacheVersion,generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),Y8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:J})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function z5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,NK)}var Y8,V1,V9=null,LK=null,w9=null,NK=16;var R4=C(()=>{F0();Y8=new Map,V1=new Map});function J8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,J="",Y;while((Y=Z.exec($))!==null)J+=Y[1]+`
6622
6627
  `;let Q=/\{\{([\s\S]*?)\}\}/g;while((Y=Q.exec($))!==null)J+=Y[1]+`
6623
6628
  `;if(!J.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((U)=>{return new RegExp(`\\b${U}\\b`).test(J)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,_,W=!1;while((_=q.exec(J))!==null)if(!K.has(_[1])){W=!0;break}if(!G&&!W)return $;let z=`<script type="module">
6624
6629
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -6627,21 +6632,21 @@ import '@stacksjs/browser'
6627
6632
  `+$.slice(B);return $.replace("</head>",`${z}
6628
6633
  </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
6629
6634
  ${z}`);return z+`
6630
- `+$}async function J8($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
6635
+ `+$}async function X8($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
6631
6636
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
6632
6637
  `+$.slice(q)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
6633
- `+$}let{getCachedSignalsRuntime:J}=await Promise.resolve().then(() => (R4(),N4)),Q=`<script data-stx-scoped>${await J(Z.debug)}</script>`,X=$.indexOf("<script");if(X!==-1)return $.slice(0,X)+Q+`
6638
+ `+$}let{getCachedSignalsRuntime:J}=await Promise.resolve().then(() => (R4(),A4)),Q=`<script data-stx-scoped>${await J(Z.debug)}</script>`,X=$.indexOf("<script");if(X!==-1)return $.slice(0,X)+Q+`
6634
6639
  `+$.slice(X);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Q+`
6635
6640
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
6636
6641
  `+Q+$.slice(K+1)}return Q+`
6637
- `+$}async function A4($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let J=Z?.router,Y="";if(J){let K={};if(J.container)K.container=J.container;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight;if(Object.keys(K).length>0)Y=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
6638
- `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (R4(),N4)),X=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+Y+X+`
6639
- </body>`+$.slice(G+7)}var _8={};r(_8,{scanScriptTags:()=>G8,processSignals:()=>I4,processScriptSetup:()=>q8,parseLoopExpression:()=>K8,hasSignalsSyntax:()=>R9,extractExports:()=>W8,convertSignalLoopsToAttributes:()=>M4,convertSignalDirectivesToAttributes:()=>T4});function G8($,Z={}){let J=[];N9.lastIndex=0;let Y;while((Y=N9.exec($))!==null){let Q=Y[1],X=Y.index+Y[0].length,G=$.toLowerCase().indexOf("</script>",X);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(Q)){N9.lastIndex=K;continue}J.push({fullMatch:$.slice(Y.index,K),attrs:Q,body:$.slice(X,G),start:Y.index,end:K}),N9.lastIndex=K}return J}function K8($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Q=J[1].trim(),X=J[2].trim(),{itemVar:G,indexVar:K}=X8(X);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let Y=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let Q=Y[1].trim(),X=Y[2].trim(),{itemVar:G,indexVar:K}=X8(Q);if(G)return{style:"in",iterable:X,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function X8($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let Y=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let X=Z.match(/^(\w+)$/);if(X)return{itemVar:X[1],indexVar:null};return{itemVar:null,indexVar:null}}function R9($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((J)=>J.test($))}function NK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(Q.startsWith("if"))J++;else if(Q==="endif")J--;else if(J===0)return!0}return!1}function T4($){let Z=$,J=/@if\s*\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let X=Y.index,G=X+Y[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let _=Z.substring(G,q-1).trim(),W=q,z=1,U=W,j=/@(if\s*\(|endif)/g;j.lastIndex=W;let B;while((B=j.exec(Z))!==null)if(B[1].startsWith("if"))z++;else if(B[1]==="endif"){if(z--,z===0){U=B.index+B[0].length;break}}if(z!==0)continue;let O=Z.substring(W,U-6).trim();if(NK(O))continue;let F=O.match(Q8),L;if(F){let[,H,V,N]=F,w=_.replace(/"/g,"&quot;");L=`<${H}${V} @if="${w}">${N}</${H}>`}else L=`<template @if="${_.replace(/"/g,"&quot;")}">${O}</template>`;Q.push({start:X,end:U,replacement:L})}for(let X=Q.length-1;X>=0;X--){let{start:G,end:K,replacement:q}=Q[X];Z=Z.substring(0,G)+q+Z.substring(K)}return Z}function M4($,Z){let J=$,Y=/@(for|foreach)\s*\(/g,Q,X=[];while((Q=Y.exec(J))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,_=1,W=q;while(W<J.length&&_>0){if(J[W]==="(")_++;else if(J[W]===")")_--;W++}if(_!==0)continue;let z=J.substring(q,W-1).trim(),U=W,j=K8(z);if(j.iterable){let R=j.iterable.trim();if(R.startsWith("[")||R.startsWith("{")||R.startsWith("'")||R.startsWith('"')||R.startsWith("`")||/^-?\d/.test(R))continue;if(Z){let A=R.split(/[.[(]/)[0].trim();if(A&&A in Z)continue}}if(j.style==="as")z=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let B=G==="for"?"@endfor":"@endforeach",O=1,F=U,L=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");L.lastIndex=U;let H;while((H=L.exec(J))!==null)if(H[1].startsWith(G))O++;else if(O--,O===0){F=H.index+H[0].length;break}if(O!==0)continue;let V=J.substring(U,F-B.length).trim(),N=V.match(Q8),w;if(N){let[,R,A,T]=N;w=`<${R}${A} @for="${z}">${T}</${R}>`}else w=`<template @for="${z}">${V}</template>`;X.push({start:K,end:F,replacement:w})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=X[G];J=J.substring(0,K)+_+J.substring(q)}return J}function RK($){let Z=new Set,J=[],Y=0,Q=0,X=$.length,G=(W)=>{let z=Y+1;while(z<X){let U=$[z];if(U==="\\"){z+=2;continue}if(U===W)return z+1;z++}return X},K=()=>{let W=Y+2;while(W<X&&$[W]!==`
6642
+ `+$}async function N4($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let J=Z?.router,Y="";if(J){let K={};if(J.container)K.container=J.container;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight;if(Object.keys(K).length>0)Y=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
6643
+ `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (R4(),A4)),X=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+Y+X+`
6644
+ </body>`+$.slice(G+7)}var z8={};r(z8,{scanScriptTags:()=>K8,processSignals:()=>I4,processScriptSetup:()=>W8,parseLoopExpression:()=>q8,hasSignalsSyntax:()=>R9,extractExports:()=>_8,convertSignalLoopsToAttributes:()=>M4,convertSignalDirectivesToAttributes:()=>T4});function K8($,Z={}){let J=[];A9.lastIndex=0;let Y;while((Y=A9.exec($))!==null){let Q=Y[1],X=Y.index+Y[0].length,G=$.toLowerCase().indexOf("</script>",X);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(Q)){A9.lastIndex=K;continue}J.push({fullMatch:$.slice(Y.index,K),attrs:Q,body:$.slice(X,G),start:Y.index,end:K}),A9.lastIndex=K}return J}function q8($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Q=J[1].trim(),X=J[2].trim(),{itemVar:G,indexVar:K}=Q8(X);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let Y=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let Q=Y[1].trim(),X=Y[2].trim(),{itemVar:G,indexVar:K}=Q8(Q);if(G)return{style:"in",iterable:X,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Q8($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let Y=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let X=Z.match(/^(\w+)$/);if(X)return{itemVar:X[1],indexVar:null};return{itemVar:null,indexVar:null}}function R9($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((J)=>J.test($))}function MK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(Q.startsWith("if"))J++;else if(Q==="endif")J--;else if(J===0)return!0}return!1}function T4($){let Z=$,J=/@if\s*\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let X=Y.index,G=X+Y[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let _=Z.substring(G,q-1).trim(),W=q,z=1,U=W,j=/@(if\s*\(|endif)/g;j.lastIndex=W;let B;while((B=j.exec(Z))!==null)if(B[1].startsWith("if"))z++;else if(B[1]==="endif"){if(z--,z===0){U=B.index+B[0].length;break}}if(z!==0)continue;let O=Z.substring(W,U-6).trim();if(MK(O))continue;let F=O.match(G8),L;if(F){let[,H,V,A]=F,w=_.replace(/"/g,"&quot;");L=`<${H}${V} @if="${w}">${A}</${H}>`}else L=`<template @if="${_.replace(/"/g,"&quot;")}">${O}</template>`;Q.push({start:X,end:U,replacement:L})}for(let X=Q.length-1;X>=0;X--){let{start:G,end:K,replacement:q}=Q[X];Z=Z.substring(0,G)+q+Z.substring(K)}return Z}function M4($,Z){let J=$,Y=/@(for|foreach)\s*\(/g,Q,X=[];while((Q=Y.exec(J))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,_=1,W=q;while(W<J.length&&_>0){if(J[W]==="(")_++;else if(J[W]===")")_--;W++}if(_!==0)continue;let z=J.substring(q,W-1).trim(),U=W,j=q8(z);if(j.iterable){let R=j.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(j.style==="as")z=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let B=G==="for"?"@endfor":"@endforeach",O=1,F=U,L=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");L.lastIndex=U;let H;while((H=L.exec(J))!==null)if(H[1].startsWith(G))O++;else if(O--,O===0){F=H.index+H[0].length;break}if(O!==0)continue;let V=J.substring(U,F-B.length).trim(),A=V.match(G8),w;if(A){let[,R,N,T]=A;w=`<${R}${N} @for="${z}">${T}</${R}>`}else w=`<template @for="${z}">${V}</template>`;X.push({start:K,end:F,replacement:w})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=X[G];J=J.substring(0,K)+_+J.substring(q)}return J}function IK($){let Z=new Set,J=[],Y=0,Q=0,X=$.length,G=(W)=>{let z=Y+1;while(z<X){let U=$[z];if(U==="\\"){z+=2;continue}if(U===W)return z+1;z++}return X},K=()=>{let W=Y+2;while(W<X&&$[W]!==`
6640
6645
  `)W++;return W},q=()=>{let W=Y+2;while(W<X-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return X},_=(W)=>{let z=W,U=0;while(z<X){let j=$[z];if(j==="/"&&$[z+1]==="/"){let B=z+2;while(B<X&&$[B]!==`
6641
- `)B++;z=B;continue}if(j==="/"&&$[z+1]==="*"){let B=z+2;while(B<X-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=z+1;while(B<X){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}z=B;continue}if(j==="("||j==="["||j==="{"){U++,z++;continue}if(j===")"||j==="]"||j==="}"){U--,z++;continue}if(j===";"&&U===0)return z+1;z++}return X};while(Y<X){let W=$[Y];if(W==="/"&&$[Y+1]==="/"){let z=K();J.push($.slice(Y,z)),Y=z;continue}if(W==="/"&&$[Y+1]==="*"){let z=q();J.push($.slice(Y,z)),Y=z;continue}if(W==='"'||W==="'"||W==="`"){let z=G(W);J.push($.slice(Y,z)),Y=z;continue}if(W==="{"){Q++,J.push(W),Y++;continue}if(W==="}"){Q--,J.push(W),Y++;continue}if(Q===0){let z=Y>0?$[Y-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let j=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],O=_(Y+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),Y=O;continue}Z.add(B),J.push($.slice(Y,O)),Y=O;continue}}}J.push(W),Y++}return J.join("")}async function q8($,Z){let J=G8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let j of J){let B=j.body;if(Q1(j.attrs))B=G1(B);if(Y.test(B))Q.push({fullMatch:j.fullMatch,attrs:j.attrs,content:B})}if(Q.length===0)return{output:$,setupCode:null};let X=`__stx_setup_${Date.now()}_${wK++}`,{hasUserImports:G,bundleClientScript:K}=await Promise.resolve().then(() => (g9(),f9)),q=[];for(let j=0;j<Q.length;j++){let B=Q[j].content;if(G(B))console.log("[stx:bundler] bundling signal script imports"),B=await K(B,Z||"",{projectRoot:process.cwd()});B=B.replace(/^\s*import\s+(?:type\s+)?\{[^}]*\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,"// [stx import stripped \u2014 resolved via window.stx in __stx_setup]");let O=n0(B);q.push(`// \u2500\u2500 merged signal script #${j+1} \u2500\u2500
6646
+ `)B++;z=B;continue}if(j==="/"&&$[z+1]==="*"){let B=z+2;while(B<X-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=z+1;while(B<X){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}z=B;continue}if(j==="("||j==="["||j==="{"){U++,z++;continue}if(j===")"||j==="]"||j==="}"){U--,z++;continue}if(j===";"&&U===0)return z+1;z++}return X};while(Y<X){let W=$[Y];if(W==="/"&&$[Y+1]==="/"){let z=K();J.push($.slice(Y,z)),Y=z;continue}if(W==="/"&&$[Y+1]==="*"){let z=q();J.push($.slice(Y,z)),Y=z;continue}if(W==='"'||W==="'"||W==="`"){let z=G(W);J.push($.slice(Y,z)),Y=z;continue}if(W==="{"){Q++,J.push(W),Y++;continue}if(W==="}"){Q--,J.push(W),Y++;continue}if(Q===0){let z=Y>0?$[Y-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let j=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],O=_(Y+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),Y=O;continue}Z.add(B),J.push($.slice(Y,O)),Y=O;continue}}}J.push(W),Y++}return J.join("")}async function W8($,Z){let J=K8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let j of J){let B=j.body;if(G1(j.attrs))B=K1(B);if(Y.test(B))Q.push({fullMatch:j.fullMatch,attrs:j.attrs,content:B})}if(Q.length===0)return{output:$,setupCode:null};let X=`__stx_setup_${Date.now()}_${TK++}`,{hasUserImports:G,bundleClientScript:K}=await Promise.resolve().then(() => (g9(),f9)),q=[];for(let j=0;j<Q.length;j++){let B=Q[j].content;if(G(B))console.log("[stx:bundler] bundling signal script imports"),B=await K(B,Z||"",{projectRoot:process.cwd()});B=B.replace(/^\s*import\s+(?:type\s+)?\{[^}]*\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,"// [stx import stripped \u2014 resolved via window.stx in __stx_setup]");let O=n0(B);q.push(`// \u2500\u2500 merged signal script #${j+1} \u2500\u2500
6642
6647
  ${O}`)}let _=q.join(`
6643
6648
 
6644
- `);_=RK(_);let W=W8(_),z=`
6649
+ `);_=IK(_);let W=_8(_),z=`
6645
6650
  <script data-stx-scoped>
6646
6651
  function ${X}() {
6647
6652
  const { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect } = window.stx;
@@ -6649,23 +6654,23 @@ ${_}
6649
6654
  return { ${W} };
6650
6655
  }
6651
6656
  if(window.stx)window.stx._latestSetup=${X};
6652
- </script>`,U=$;for(let j of Q)U=U.split(j.fullMatch).join("");if(U.includes("<body"))U=U.replace(/<body([^>]*)>/,`<body$1 data-stx="${X}">`);else{let j=["script","style","html","head","meta","link","title","!doctype"];U=U.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(B,O,F)=>{if(j.includes(O.toLowerCase()))return B;return`<${O}${F} data-stx="${X}">`})}return{output:U,setupCode:z}}function W8($){let Z=$,J=[],Y=new Set,Q=0,X=0,G=Z.length,K=(z)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===z){X++;return}X++}},q=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let z=1;while(X<G&&z>0)if(Z[X]==="{")z++;else if(Z[X]==="}")z--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},_=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
6653
- `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},W=()=>{if(Q!==0)return;let z=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!Y.has(B))J.push(B),Y.add(B);return}let U=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!Y.has(B))J.push(B),Y.add(B);return}let j=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))J.push(B),Y.add(B)}};while(X<G){if(_())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){Q++,X++;continue}if(Z[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))W();X++}return J.join(", ")}async function I4($,Z,J){if(!R9($))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:X}=await q8(Y,J);if(Y=Q,Y=await J8(Y,Z),Y=Y8(Y),X)if(Y.includes("</head>"))Y=Y.replace("</head>",`${X}
6657
+ </script>`,U=$;for(let j of Q)U=U.split(j.fullMatch).join("");if(U.includes("<body"))U=U.replace(/<body([^>]*)>/,`<body$1 data-stx="${X}">`);else{let j=["script","style","html","head","meta","link","title","!doctype"];U=U.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(B,O,F)=>{if(j.includes(O.toLowerCase()))return B;return`<${O}${F} data-stx="${X}">`})}return{output:U,setupCode:z}}function _8($){let Z=$,J=[],Y=new Set,Q=0,X=0,G=Z.length,K=(z)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===z){X++;return}X++}},q=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let z=1;while(X<G&&z>0)if(Z[X]==="{")z++;else if(Z[X]==="}")z--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},_=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
6658
+ `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},W=()=>{if(Q!==0)return;let z=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!Y.has(B))J.push(B),Y.add(B);return}let U=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!Y.has(B))J.push(B),Y.add(B);return}let j=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))J.push(B),Y.add(B)}};while(X<G){if(_())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){Q++,X++;continue}if(Z[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))W();X++}return J.join(", ")}async function I4($,Z,J){if(!R9($))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:X}=await W8(Y,J);if(Y=Q,Y=await X8(Y,Z),Y=J8(Y),X)if(Y.includes("</head>"))Y=Y.replace("</head>",`${X}
6654
6659
  </head>`);else if(Y.includes("<body"))Y=Y.replace(/<body([^>]*)>/,`<body$1>
6655
6660
  ${X}`);else Y=Y+`
6656
- `+X;let G=Y.match(/<body([^>]*)>/i),K=G&&/data-stx/.test(G[1]);if(!X&&!K){if(Y.includes("<body")&&G&&!/data-stx-auto/.test(G[1]))Y=Y.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return Y}var wK=0,N9,Q8;var D4=C(()=>{F0();N9=/<script\b([^>]*)>/gi,Q8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s});import b0 from"path";import E4 from"fs";function z8($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function U8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class B8{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,X=Y?.__importedComponents;if(X){let j=[Q,Q.toLowerCase(),z8(Q),U8(Q)];for(let B of j)if(X.has(B))return X.get(B)}let G=[...new Set([`${Q}.stx`,`${z8(Q)}.stx`,`${U8(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=b0.resolve(b0.dirname(Z),`${Q}.stx`);if(await i(j))return j;return null}let K=[],q=J.componentsDir||"",_=Y?.__originalFilePath;if(_)K.push(b0.join(b0.dirname(_),"components"));if(q)K.push(q);let W=b0.join(b0.dirname(Z),"components");if(!K.includes(W))K.push(W);let z=process.cwd(),U=[b0.resolve(z,"src/components"),b0.resolve(z,"components"),b0.resolve(import.meta.dir,"components")];for(let j of U)if(!K.includes(j))K.push(j);for(let j of K){if(!j)continue;for(let B of G){let O=b0.join(j,B);if(await i(O))return O}try{if(!E4.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let O=E4.readdirSync(j,{withFileTypes:!0});for(let F of O)if(F.isDirectory()){let L=b0.join(j,F.name);for(let H of G){let V=b0.join(L,H);if(await i(V))return V}}}catch{}}return null}}var d0;var k4=C(()=>{F0();d0=new B8});function m0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function AK($){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 b4;var S4=C(()=>{b4={name:"StxLink",aliases:["stx-link"],render($,Z,J){let Y=AK($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),X=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(Y.reactive)q.push(`:href="${m0(Y.value)}"`);else q.push(`href="${m0(Y.value)}"`);if(Q)q.push(`class="${m0(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${m0(X)}"`),q.push(`data-stx-exact-active-class="${m0(G)}"`),K)q.push("data-stx-prefetch");for(let[W,z]of Object.entries($.events))q.push(`@${m0(W)}="${m0(z)}"`);let _=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[W,z]of Object.entries($.static)){if(_.has(W))continue;if(typeof z==="boolean"){if(z)q.push(m0(W))}else q.push(`${m0(W)}="${m0(z)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function z0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function T0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function C4($,Z,J=!1){let Y=$.serverDynamic[Z];if(Y!==void 0)return Y!==!1&&Y!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return J}function j8($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let Y of Z)if(Y.includes(":")){let[Q,X]=Y.split(":"),G=TK[Q];if(G)J.push(`(max-width: ${G}px) ${X}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))J.push(`(max-width: ${K}px) ${X}`)}}else J.push(Y);return J.join(", ")}function P4($,Z,J,Y){return Z.map((Q)=>`${U5($,Q,void 0,J,Y)} ${Q}w`).join(", ")}function MK($,Z,J,Y,Q){return Z.map((X)=>{let G=J?J*X:void 0;return`${U5($,G,void 0,Y,Q)} ${X}x`}).join(", ")}function U5($,Z,J,Y,Q){if(!Y||Y==="local"||Y==="static")return $;if(Y==="cloudinary"){let X=[];if(Z)X.push(`w_${Z}`);if(J)X.push(`h_${J}`);if(Q)X.push(`f_${Q}`);X.push("q_auto");let G=X.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(Y==="imgix"){let X=new URLSearchParams;if(Z)X.set("w",String(Z));if(J)X.set("h",String(J));if(Q)X.set("fm",Q);X.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}if(Y==="bunny"){let X=new URLSearchParams;if(Z)X.set("width",String(Z));if(J)X.set("height",String(J));if(Q)X.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}return $}function IK($,Z,J="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var TK,y4,v4;var x4=C(()=>{TK={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},y4=[320,640,768,1024,1280,1536,1920];v4={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,J){let Y=T0($,"src")||"",Q=T0($,"alt")||"",X=T0($,"width"),G=T0($,"height"),K=T0($,"sizes"),q=T0($,"srcset"),_=T0($,"densities"),W=T0($,"format"),z=T0($,"placeholder"),U=T0($,"placeholderColor")||"#e5e7eb",j=T0($,"provider"),B=T0($,"class")||T0($,"className")||"",O=T0($,"style")||"",F=T0($,"quality"),L=C4($,"lazy",!0),H=C4($,"preload",!1),V=C4($,"picture",!1)||!!W,N=X?Number.parseInt(X):void 0,w=G?Number.parseInt(G):void 0,R=q||"",A="";if(!R&&K)R=P4(Y,y4,j,W),A=j8(K);else if(!R&&_){let S=_.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));R=MK(Y,S,N,j,W)}else if(K)A=j8(K);let T=[];if(O)T.push(O);if(N&&w)T.push(`aspect-ratio:${N}/${w}`);if(z==="blur"||z==="color"){let S=IK(N||16,w||9,U);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${z0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let I=U5(Y,N,w,j,W),M=[];if(M.push(`src="${z0(I)}"`),M.push(`alt="${z0(Q)}"`),X)M.push(`width="${z0(X)}"`);if(G)M.push(`height="${z0(G)}"`);if(L)M.push('loading="lazy"');if(M.push('decoding="async"'),B)M.push(`class="${z0(B)}"`);if(T.length>0)M.push(`style="${z0(T.join(";"))}"`);if(R)M.push(`srcset="${z0(R)}"`);if(A)M.push(`sizes="${z0(A)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,b]of Object.entries($.static)){if(E.has(S))continue;if(typeof b==="boolean"){if(b)M.push(z0(S))}else M.push(`${z0(S)}="${z0(b)}"`)}let k=`<img ${M.join(" ")} />`,y="";if(H){let b=W==="webp"?"image/webp":W==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${z0(I)}"${b?` type="${b}"`:""}${R?` imagesrcset="${z0(R)}"`:""}${A?` imagesizes="${z0(A)}"`:""} />
6657
- `}if(V){let S=[];if(W==="avif"||W==="auto"){let b=U5(Y,N,w,j,"avif"),D=R?P4(Y,y4,j,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${z0(D)}"${A?` sizes="${z0(A)}"`:""} />`)}if(W==="webp"||W==="auto"){let b=U5(Y,N,w,j,"webp"),D=R?P4(Y,y4,j,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${z0(D)}"${A?` sizes="${z0(A)}"`:""} />`)}return`${y}<picture>
6661
+ `+X;let G=Y.match(/<body([^>]*)>/i),K=G&&/data-stx/.test(G[1]);if(!X&&!K){if(Y.includes("<body")&&G&&!/data-stx-auto/.test(G[1]))Y=Y.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return Y}var TK=0,A9,G8;var D4=C(()=>{F0();A9=/<script\b([^>]*)>/gi,G8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s});import b0 from"path";import E4 from"fs";function U8($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function B8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class j8{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,X=Y?.__importedComponents;if(X){let j=[Q,Q.toLowerCase(),U8(Q),B8(Q)];for(let B of j)if(X.has(B))return X.get(B)}let G=[...new Set([`${Q}.stx`,`${U8(Q)}.stx`,`${B8(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=b0.resolve(b0.dirname(Z),`${Q}.stx`);if(await i(j))return j;return null}let K=[],q=J.componentsDir||"",_=Y?.__originalFilePath;if(_)K.push(b0.join(b0.dirname(_),"components"));if(q)K.push(q);let W=b0.join(b0.dirname(Z),"components");if(!K.includes(W))K.push(W);let z=process.cwd(),U=[b0.resolve(z,"src/components"),b0.resolve(z,"components"),b0.resolve(import.meta.dir,"components")];for(let j of U)if(!K.includes(j))K.push(j);for(let j of K){if(!j)continue;for(let B of G){let O=b0.join(j,B);if(await i(O))return O}try{if(!E4.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let O=E4.readdirSync(j,{withFileTypes:!0});for(let F of O)if(F.isDirectory()){let L=b0.join(j,F.name);for(let H of G){let V=b0.join(L,H);if(await i(V))return V}}}catch{}}return null}}var d0;var k4=C(()=>{F0();d0=new j8});function m0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function DK($){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 b4;var S4=C(()=>{b4={name:"StxLink",aliases:["stx-link"],render($,Z,J){let Y=DK($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),X=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(Y.reactive)q.push(`:href="${m0(Y.value)}"`);else q.push(`href="${m0(Y.value)}"`);if(Q)q.push(`class="${m0(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${m0(X)}"`),q.push(`data-stx-exact-active-class="${m0(G)}"`),K)q.push("data-stx-prefetch");for(let[W,z]of Object.entries($.events))q.push(`@${m0(W)}="${m0(z)}"`);let _=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[W,z]of Object.entries($.static)){if(_.has(W))continue;if(typeof z==="boolean"){if(z)q.push(m0(W))}else q.push(`${m0(W)}="${m0(z)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function z0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function T0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function C4($,Z,J=!1){let Y=$.serverDynamic[Z];if(Y!==void 0)return Y!==!1&&Y!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return J}function O8($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let Y of Z)if(Y.includes(":")){let[Q,X]=Y.split(":"),G=EK[Q];if(G)J.push(`(max-width: ${G}px) ${X}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))J.push(`(max-width: ${K}px) ${X}`)}}else J.push(Y);return J.join(", ")}function P4($,Z,J,Y){return Z.map((Q)=>`${U5($,Q,void 0,J,Y)} ${Q}w`).join(", ")}function kK($,Z,J,Y,Q){return Z.map((X)=>{let G=J?J*X:void 0;return`${U5($,G,void 0,Y,Q)} ${X}x`}).join(", ")}function U5($,Z,J,Y,Q){if(!Y||Y==="local"||Y==="static")return $;if(Y==="cloudinary"){let X=[];if(Z)X.push(`w_${Z}`);if(J)X.push(`h_${J}`);if(Q)X.push(`f_${Q}`);X.push("q_auto");let G=X.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(Y==="imgix"){let X=new URLSearchParams;if(Z)X.set("w",String(Z));if(J)X.set("h",String(J));if(Q)X.set("fm",Q);X.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}if(Y==="bunny"){let X=new URLSearchParams;if(Z)X.set("width",String(Z));if(J)X.set("height",String(J));if(Q)X.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}return $}function bK($,Z,J="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var EK,y4,v4;var x4=C(()=>{EK={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},y4=[320,640,768,1024,1280,1536,1920];v4={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,J){let Y=T0($,"src")||"",Q=T0($,"alt")||"",X=T0($,"width"),G=T0($,"height"),K=T0($,"sizes"),q=T0($,"srcset"),_=T0($,"densities"),W=T0($,"format"),z=T0($,"placeholder"),U=T0($,"placeholderColor")||"#e5e7eb",j=T0($,"provider"),B=T0($,"class")||T0($,"className")||"",O=T0($,"style")||"",F=T0($,"quality"),L=C4($,"lazy",!0),H=C4($,"preload",!1),V=C4($,"picture",!1)||!!W,A=X?Number.parseInt(X):void 0,w=G?Number.parseInt(G):void 0,R=q||"",N="";if(!R&&K)R=P4(Y,y4,j,W),N=O8(K);else if(!R&&_){let S=_.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));R=kK(Y,S,A,j,W)}else if(K)N=O8(K);let T=[];if(O)T.push(O);if(A&&w)T.push(`aspect-ratio:${A}/${w}`);if(z==="blur"||z==="color"){let S=bK(A||16,w||9,U);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${z0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let I=U5(Y,A,w,j,W),M=[];if(M.push(`src="${z0(I)}"`),M.push(`alt="${z0(Q)}"`),X)M.push(`width="${z0(X)}"`);if(G)M.push(`height="${z0(G)}"`);if(L)M.push('loading="lazy"');if(M.push('decoding="async"'),B)M.push(`class="${z0(B)}"`);if(T.length>0)M.push(`style="${z0(T.join(";"))}"`);if(R)M.push(`srcset="${z0(R)}"`);if(N)M.push(`sizes="${z0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,b]of Object.entries($.static)){if(E.has(S))continue;if(typeof b==="boolean"){if(b)M.push(z0(S))}else M.push(`${z0(S)}="${z0(b)}"`)}let k=`<img ${M.join(" ")} />`,y="";if(H){let b=W==="webp"?"image/webp":W==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${z0(I)}"${b?` type="${b}"`:""}${R?` imagesrcset="${z0(R)}"`:""}${N?` imagesizes="${z0(N)}"`:""} />
6662
+ `}if(V){let S=[];if(W==="avif"||W==="auto"){let b=U5(Y,A,w,j,"avif"),D=R?P4(Y,y4,j,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${z0(D)}"${N?` sizes="${z0(N)}"`:""} />`)}if(W==="webp"||W==="auto"){let b=U5(Y,A,w,j,"webp"),D=R?P4(Y,y4,j,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${z0(D)}"${N?` sizes="${z0(N)}"`:""} />`)}return`${y}<picture>
6658
6663
  ${S.join(`
6659
6664
  `)}
6660
6665
  ${k}
6661
- </picture>`}return`${y}${k}`}}});function f4($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function B5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function A9($,Z,J){let Y=B5($,Z);if(Y!==void 0){let Q=Number.parseInt(Y,10);if(!Number.isNaN(Q))return Q}return J}var g4;var h4=C(()=>{g4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let Y=f4(B5($,"color")||"#6366f1"),Q=f4(B5($,"initialColor")||B5($,"initial-color")||""),X=f4(B5($,"height")||"3px"),G=A9($,"duration",2000),K=A9($,"throttle",200),q=A9($,"zIndex",999999)||A9($,"z-index",999999),_=Q?`linear-gradient(to right, ${Q}, ${Y})`:Y;return`
6666
+ </picture>`}return`${y}${k}`}}});function f4($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function B5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function N9($,Z,J){let Y=B5($,Z);if(Y!==void 0){let Q=Number.parseInt(Y,10);if(!Number.isNaN(Q))return Q}return J}var g4;var h4=C(()=>{g4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let Y=f4(B5($,"color")||"#6366f1"),Q=f4(B5($,"initialColor")||B5($,"initial-color")||""),X=f4(B5($,"height")||"3px"),G=N9($,"duration",2000),K=N9($,"throttle",200),q=N9($,"zIndex",999999)||N9($,"z-index",999999),_=Q?`linear-gradient(to right, ${Q}, ${Y})`:Y;return`
6662
6667
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${X};background:${_};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
6663
6668
  <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>
6664
6669
  </div>
6665
6670
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
6666
6671
  <script>
6667
6672
  (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()})})();
6668
- </script>`}}});function H8($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function DK($,Z,J){let Y=H8($,Z);if(Y!==void 0){let Q=Number.parseInt(Y,10);if(!Number.isNaN(Q))return Q}return J}var O8,d4;var m4=C(()=>{O8={"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%)"},d4={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let Y=H8($,"position")||"top-right",Q=DK($,"max",5),X=O8[Y]||O8["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${Q}" style="position:fixed;${X};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
6673
+ </script>`}}});function L8($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function SK($,Z,J){let Y=L8($,Z);if(Y!==void 0){let Q=Number.parseInt(Y,10);if(!Number.isNaN(Q))return Q}return J}var H8,d4;var m4=C(()=>{H8={"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%)"},d4={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let Y=L8($,"position")||"top-right",Q=SK($,"max",5),X=H8[Y]||H8["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${Q}" style="position:fixed;${X};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
6669
6674
  <style>
6670
6675
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
6671
6676
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -6673,7 +6678,7 @@ ${k}
6673
6678
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
6674
6679
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
6675
6680
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
6676
- </style>`}}});function T9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var L8,u4;var p4=C(()=>{L8={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)"},u4={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let Y=T9($,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=T9($,"size")||"md",X=T9($,"closeOnBackdrop")!=="false",G=T9($,"closeOnEscape")!=="false",K=L8[Q]||L8.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${X}" data-close-escape="${G}" 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">
6681
+ </style>`}}});function T9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var F8,u4;var p4=C(()=>{F8={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)"},u4={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let Y=T9($,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=T9($,"size")||"md",X=T9($,"closeOnBackdrop")!=="false",G=T9($,"closeOnEscape")!=="false",K=F8[Q]||F8.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${X}" data-close-escape="${G}" 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">
6677
6682
  <div class="stx-modal-panel" style="${K};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)">
6678
6683
  <div style="padding:1.5rem">${Z}</div>
6679
6684
  </div>
@@ -6682,7 +6687,7 @@ ${k}
6682
6687
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
6683
6688
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
6684
6689
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
6685
- </style>`}}});function v1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var F8,l4;var c4=C(()=>{F8={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},l4={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let Y=v1($,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=v1($,"side")||"right",X=v1($,"size")||"md",G=v1($,"closeOnBackdrop")!=="false",K=v1($,"closeOnEscape")!=="false",q=v1($,"overlay")!=="false",_=F8[X]||F8.md,W=Q==="left",z=W?"left:0":"right:0",U=W?"translateX(-100%)":"translateX(100%)",j=W?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
6690
+ </style>`}}});function x1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var V8,l4;var c4=C(()=>{V8={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},l4={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let Y=x1($,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=x1($,"side")||"right",X=x1($,"size")||"md",G=x1($,"closeOnBackdrop")!=="false",K=x1($,"closeOnEscape")!=="false",q=x1($,"overlay")!=="false",_=V8[X]||V8.md,W=Q==="left",z=W?"left:0":"right:0",U=W?"translateX(-100%)":"translateX(100%)",j=W?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
6686
6691
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${z};width:${_};max-width:100vw;transform:${U};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">
6687
6692
  <div style="padding:1.5rem">${Z}</div>
6688
6693
  </div>
@@ -6691,24 +6696,24 @@ ${k}
6691
6696
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
6692
6697
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
6693
6698
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
6694
- </style>`}}});var N8={};r(N8,{preloadIconCollection:()=>w8,IconBuiltin:()=>M9});async function V8($){if(j5.has($))return j5.get($);try{let Z=J0.resolve(`@iconify/json/json/${$}.json`),J=await Bun.file(Z).json();return j5.set($,J.icons),J.icons}catch{try{let J=`${process.cwd()}/node_modules/@iconify/json/json/${$}.json`,Y=Bun.file(J);if(await Y.exists()){let Q=await Y.json();return j5.set($,Q.icons),Q.icons}}catch{}}return null}function x1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}async function w8($="lucide"){await V8($)}var j5,M9;var I9=C(()=>{j5=new Map;M9={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let Y=x1($,"name")??x1($,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",X=Y;if(Y.includes(":")){let H=Y.split(":");Q=H[0],X=H[1]}let G=x1($,"size")||"24",K=x1($,"color")||"currentColor",q=x1($,"class")||"",_=x1($,"style")||"",W=j5.get(Q);if(!W)return V8(Q),`<!-- Icon: collection "${Q}" not loaded -->`;let z=W[X];if(!z)return`<!-- Icon: "${X}" not found in ${Q} -->`;let U=z.width||24,j=z.height||24,B=`0 0 ${U} ${j}`,O=z.body;if(K!=="currentColor")O=O.replace(/currentColor/g,K);let F=q?` class="${q}"`:"",L=_?` style="${_}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${L}>${O}</svg>`}}});function R8(){d0.registerBuiltin(b4),d0.registerBuiltin(v4),d0.registerBuiltin(g4),d0.registerBuiltin(d4),d0.registerBuiltin(u4),d0.registerBuiltin(l4),d0.registerBuiltin(M9)}var A8=C(()=>{S4();x4();h4();m4();p4();c4();I9();k4();S4();x4();h4();m4();p4();c4();I9()});function T8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function M8($,Z,J){let Y=[],Q=0;while(Q<$.length){let X=$.indexOf("<",Q);if(X===-1)break;let K=$.slice(X+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=X+1;continue}let q=K[1];if(J&&J.has(q.toLowerCase())){let O=X+1+q.length;while(O<$.length&&$[O]!==">")O++;Q=O+1;continue}let _=X+1+q.length,W=null,z=_,U=-1,j=!1;while(_<$.length){let O=$[_];if(W){if(O==="\\"&&_+1<$.length){_+=2;continue}if(O===W)W=null;_++;continue}if(O==='"'||O==="'"){W=O,_++;continue}if(O==="/"&&_+1<$.length&&$[_+1]===">"){U=_+2,j=!0;break}if(O===">"){U=_+1;break}_++}if(U===-1){Q=X+1;continue}let B=$.slice(z,j?U-2:U-1).trim();if(j)Y.push({fullMatch:$.slice(X,U),tagName:q,attributes:B,content:"",startIndex:X,endIndex:U,isSelfClosing:!0}),Q=U;else{let O=`<${q}`,F=`</${q}>`,L=1,H=U,V=-1;while(L>0&&H<$.length){let R=$.indexOf(O,H),A=$.indexOf(F,H);if(A===-1)break;if(R!==-1&&R<A){let T=$[R+O.length];if(T===" "||T===">"||T==="/"||T===`
6695
- `||T==="\t")L++;H=R+O.length}else{if(L--,L===0){V=A;break}H=A+F.length}}if(V===-1){Q=U;continue}let N=$.slice(U,V),w=V+F.length;Y.push({fullMatch:$.slice(X,w),tagName:q,attributes:B,content:N,startIndex:X,endIndex:w,isSelfClosing:!1}),Q=w}}return Y}var I8=C(()=>{N0();F0()});import f1 from"path";function kK($,Z,J){let Y={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),X=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){Y.events[q]=K;continue}if(q.startsWith("__stx_")){let _=X(q.slice(6));try{let W=K.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");Y.serverDynamic[_]=JSON.parse(W)}catch(W){if(J.debug)console.error(`Error parsing __stx_${_}:`,W);Y.serverDynamic[_]=K}continue}if(q.startsWith(":")){let _=X(q.slice(1)),W=K==="true"?_:K;try{if(!e(W)){if(J.debug)console.error(`Unsafe expression in :${_} binding: ${W}`);Y.clientReactive[_]=W;continue}let z=Object.keys(Z),j=$0(W,z)(...Object.values(Z));if(j===void 0){let B=W.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(B.some((L)=>!O.has(L)&&!z.includes(L))){Y.clientReactive[_]=W;continue}}Y.serverDynamic[_]=j}catch{Y.clientReactive[_]=W}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let _=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(_)try{let W=_[1];if(e(W)){let U=$0(W,Object.keys(Z))(...Object.values(Z));Y.static[q]=U!=null?String(U):""}else{if(J.debug)console.error(`Unsafe expression in ${q}: ${W}`);Y.static[q]=K}}catch(W){if(J.debug)console.error(`Error evaluating expression for ${q}:`,W);Y.static[q]=K}else{let W=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,U;while((U=z.exec(K))!==null)try{let j=U[1];if(!e(j)){if(J.debug)console.error(`Unsafe expression in ${q}: ${j}`);continue}let O=$0(j,Object.keys(Z))(...Object.values(Z));W=W.replace(U[0],String(O??""))}catch(j){if(J.debug)console.error(`Error evaluating expression in ${q}:`,j)}Y.static[q]=W}continue}Y.static[q]=K}return Y}function bK($){let Z={},J=0,Y=$.length;while(J<Y){while(J<Y&&/\s/.test($[J]))J++;if(J>=Y)break;let Q="";while(J<Y&&!/[\s=]/.test($[J]))Q+=$[J],J++;if(!Q)break;while(J<Y&&/\s/.test($[J]))J++;if(J<Y&&$[J]==="="){J++;while(J<Y&&/\s/.test($[J]))J++;let X="";if(J<Y&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<Y){let K=$[J];if(K==="\\"&&J+1<Y){J++,X+=$[J],J++;continue}if(K===G){J++;break}X+=K,J++}}else while(J<Y&&!/\s/.test($[J]))X+=$[J],J++;Z[Q]=X}else Z[Q]="true"}return Z}async function SK($,Z,J,Y,Q){let X=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(X))!==null){let[_,W]=q,z=W.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of z){let j=U.split("/"),O=j[j.length-1].replace(/\.stx$/,""),F=O.includes("-")?O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):O.charAt(0).toUpperCase()+O.slice(1),L=null,H=[f1.resolve(f1.dirname(J),`${U}.stx`),f1.resolve(f1.dirname(J),U),f1.resolve(Y.componentsDir||"components",`${U}.stx`),f1.resolve(Y.componentsDir||"components",U),U.endsWith(".stx")?U:`${U}.stx`];for(let V of H)try{if(await Bun.file(V).exists()){L=V;break}}catch{}if(L){G.set(F,L),G.set(O,L),G.set(O.toLowerCase(),L);let V=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,L),Q.add(L),Y.debug)console.log(`Imported component: ${F} -> ${L}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${U}`)}X=X.replace(_,""),K.lastIndex=0}return X}async function yK($,Z,J,Y,Q){let X=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,_;while((_=q.exec(X))!==null){let W=_.index,z=W+_[0].length-1,U=1,j=z+1;while(j<X.length&&U>0){if(X[j]==="(")U++;else if(X[j]===")"){if(U--,U===0)break}j++}if(U!==0)break;let B=X.substring(z+1,j),O=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){q.lastIndex=0;continue}let L=F[1],H,V=B.slice(F[0].length),N=V.match(/^\s*,\s*/);if(N)H=V.slice(N[0].length).trim();let w={};if(H)try{w=O0(H,Z)}catch(E){let k=E instanceof Error?E.message:String(E);X=X.replace(X.substring(W,O),`[Error parsing component props: ${k}]`);continue}let R="",A=O,I=X.substring(O).match(/^([\s\S]*?)@endcomponent/);if(I)R=I[1].trim(),A=O+I[0].length;let M=await z1(L,w,R,G,Z,J,Y,K,Q);X=X.substring(0,W)+M+X.substring(A),q.lastIndex=0}return X}async function CK($,Z,J,Y,Q){if(!$)return $;let X=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents;return X=await z(X,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),X=await z(X,/[A-Z][a-zA-Z0-9]*/,!0),X=await z(X,/[a-z][a-z0-9]*/,!1,EK),X;async function z(U,j,B,O){if(!U)return U;let F=U,L=M8(F,j,O);for(let H=L.length-1;H>=0;H--){let V=L[H],N=B?T8(V.tagName):V.tagName,w=bK(V.attributes),R=kK(w,Z,Y),A=d0.getBuiltin(V.tagName);if(A){let E={context:Z,filePath:J,options:Y,dependencies:Q},k=A.render(R,V.content,E);if(Object.keys(R.clientReactive).length>0)k=E8(k,R.clientReactive);if(Object.keys(R.events).length>0){let y=Object.entries(R.events).map(([S,b])=>`${S}="${b.replace(/"/g,"&quot;")}"`).join(" ");k=k.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}F=F.substring(0,V.startIndex)+k+F.substring(V.endIndex);continue}let T={};for(let[E,k]of Object.entries(R.static))T[E]=k;for(let[E,k]of Object.entries(R.serverDynamic))T[E]=k;let M=await z1(N,T,V.content,G,Z,J,Y,K,Q);if(Object.keys(R.clientReactive).length>0)M=E8(M,R.clientReactive);if(Object.keys(R.events).length>0){let E=M.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(E){let k=Object.entries(R.events).map(([S,b])=>`${S}="${b}"`).join(" "),y=E[1].length+E[2].length;M=M.substring(0,y)+" "+k+M.substring(y)}}F=F.substring(0,V.startIndex)+M+F.substring(V.endIndex)}return F}}function E8($,Z){let J=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!J)return $;let Y=Object.entries(Z).map(([X,G])=>`:${X}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=J[1].length+J[2].length;return $.substring(0,Q)+" "+Y+$.substring(Q)}async function i4($,Z,J,Y,Q){if(!D8)R8(),D8=!0;let X=await SK($,Z,J,Y,Q);X=await yK(X,Z,J,Y,Q);for(let G=0;G<3;G++){let K=X;if(X=await CK(X,Z,J,Y,Q),X===K)break}return X}var D8=!1,EK;var k8=C(()=>{k4();A8();I8();F0();N0();EK=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"])});import g1 from"path";function b8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function S8($,Z,J){try{let Y;if($.startsWith("/")){let Q=Z;for(let X=0;X<5;X++){let G=g1.join(Q,$);if(J0("fs").existsSync(G))return G;Q=g1.dirname(Q)}Y=g1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))Y=g1.resolve(Z,$);else Y=g1.resolve(Z,$);if(J0("fs").existsSync(Y))return Y;return null}catch{return null}}async function y8($,Z,J){let Y=$,Q=g1.dirname(Z),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=X.exec(Y))!==null){let[_,W,z,U]=G;if(b8(z))continue;let j=S8(z,Q,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),z.endsWith(".ts")||z.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:x0()});if(F.outputs.length>0)B=await F.outputs[0].text()}let O=`<script>
6699
+ </style>`}}});var R8={};r(R8,{preloadIconCollection:()=>A8,IconBuiltin:()=>M9});async function w8($){if(j5.has($))return j5.get($);try{let Z=J0.resolve(`@iconify/json/json/${$}.json`),J=await Bun.file(Z).json();return j5.set($,J.icons),J.icons}catch{try{let J=`${process.cwd()}/node_modules/@iconify/json/json/${$}.json`,Y=Bun.file(J);if(await Y.exists()){let Q=await Y.json();return j5.set($,Q.icons),Q.icons}}catch{}}return null}function f1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}async function A8($="lucide"){await w8($)}var j5,M9;var I9=C(()=>{j5=new Map;M9={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let Y=f1($,"name")??f1($,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",X=Y;if(Y.includes(":")){let H=Y.split(":");Q=H[0],X=H[1]}let G=f1($,"size")||"24",K=f1($,"color")||"currentColor",q=f1($,"class")||"",_=f1($,"style")||"",W=j5.get(Q);if(!W)return w8(Q),`<!-- Icon: collection "${Q}" not loaded -->`;let z=W[X];if(!z)return`<!-- Icon: "${X}" not found in ${Q} -->`;let U=z.width||24,j=z.height||24,B=`0 0 ${U} ${j}`,O=z.body;if(K!=="currentColor")O=O.replace(/currentColor/g,K);let F=q?` class="${q}"`:"",L=_?` style="${_}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${L}>${O}</svg>`}}});function N8(){d0.registerBuiltin(b4),d0.registerBuiltin(v4),d0.registerBuiltin(g4),d0.registerBuiltin(d4),d0.registerBuiltin(u4),d0.registerBuiltin(l4),d0.registerBuiltin(M9)}var T8=C(()=>{S4();x4();h4();m4();p4();c4();I9();k4();S4();x4();h4();m4();p4();c4();I9()});function M8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function I8($,Z,J){let Y=[],Q=0;while(Q<$.length){let X=$.indexOf("<",Q);if(X===-1)break;let K=$.slice(X+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=X+1;continue}let q=K[1];if(J&&J.has(q.toLowerCase())){let O=X+1+q.length;while(O<$.length&&$[O]!==">")O++;Q=O+1;continue}let _=X+1+q.length,W=null,z=_,U=-1,j=!1;while(_<$.length){let O=$[_];if(W){if(O==="\\"&&_+1<$.length){_+=2;continue}if(O===W)W=null;_++;continue}if(O==='"'||O==="'"){W=O,_++;continue}if(O==="/"&&_+1<$.length&&$[_+1]===">"){U=_+2,j=!0;break}if(O===">"){U=_+1;break}_++}if(U===-1){Q=X+1;continue}let B=$.slice(z,j?U-2:U-1).trim();if(j)Y.push({fullMatch:$.slice(X,U),tagName:q,attributes:B,content:"",startIndex:X,endIndex:U,isSelfClosing:!0}),Q=U;else{let O=`<${q}`,F=`</${q}>`,L=1,H=U,V=-1;while(L>0&&H<$.length){let R=$.indexOf(O,H),N=$.indexOf(F,H);if(N===-1)break;if(R!==-1&&R<N){let T=$[R+O.length];if(T===" "||T===">"||T==="/"||T===`
6700
+ `||T==="\t")L++;H=R+O.length}else{if(L--,L===0){V=N;break}H=N+F.length}}if(V===-1){Q=U;continue}let A=$.slice(U,V),w=V+F.length;Y.push({fullMatch:$.slice(X,w),tagName:q,attributes:B,content:A,startIndex:X,endIndex:w,isSelfClosing:!1}),Q=w}}return Y}var D8=C(()=>{A0();F0()});import g1 from"path";function CK($,Z,J){let Y={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),X=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){Y.events[q]=K;continue}if(q.startsWith("__stx_")){let _=X(q.slice(6));try{let W=K.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");Y.serverDynamic[_]=JSON.parse(W)}catch(W){if(J.debug)console.error(`Error parsing __stx_${_}:`,W);Y.serverDynamic[_]=K}continue}if(q.startsWith(":")){let _=X(q.slice(1)),W=K==="true"?_:K;try{if(!e(W)){if(J.debug)console.error(`Unsafe expression in :${_} binding: ${W}`);Y.clientReactive[_]=W;continue}let z=Object.keys(Z),j=$0(W,z)(...Object.values(Z));if(j===void 0){let B=W.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(B.some((L)=>!O.has(L)&&!z.includes(L))){Y.clientReactive[_]=W;continue}}Y.serverDynamic[_]=j}catch{Y.clientReactive[_]=W}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let _=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(_)try{let W=_[1];if(e(W)){let U=$0(W,Object.keys(Z))(...Object.values(Z));Y.static[q]=U!=null?String(U):""}else{if(J.debug)console.error(`Unsafe expression in ${q}: ${W}`);Y.static[q]=K}}catch(W){if(J.debug)console.error(`Error evaluating expression for ${q}:`,W);Y.static[q]=K}else{let W=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,U;while((U=z.exec(K))!==null)try{let j=U[1];if(!e(j)){if(J.debug)console.error(`Unsafe expression in ${q}: ${j}`);continue}let O=$0(j,Object.keys(Z))(...Object.values(Z));W=W.replace(U[0],String(O??""))}catch(j){if(J.debug)console.error(`Error evaluating expression in ${q}:`,j)}Y.static[q]=W}continue}Y.static[q]=K}return Y}function PK($){let Z={},J=0,Y=$.length;while(J<Y){while(J<Y&&/\s/.test($[J]))J++;if(J>=Y)break;let Q="";while(J<Y&&!/[\s=]/.test($[J]))Q+=$[J],J++;if(!Q)break;while(J<Y&&/\s/.test($[J]))J++;if(J<Y&&$[J]==="="){J++;while(J<Y&&/\s/.test($[J]))J++;let X="";if(J<Y&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<Y){let K=$[J];if(K==="\\"&&J+1<Y){J++,X+=$[J],J++;continue}if(K===G){J++;break}X+=K,J++}}else while(J<Y&&!/\s/.test($[J]))X+=$[J],J++;Z[Q]=X}else Z[Q]="true"}return Z}async function vK($,Z,J,Y,Q){let X=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(X))!==null){let[_,W]=q,z=W.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of z){let j=U.split("/"),O=j[j.length-1].replace(/\.stx$/,""),F=O.includes("-")?O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):O.charAt(0).toUpperCase()+O.slice(1),L=null,H=[g1.resolve(g1.dirname(J),`${U}.stx`),g1.resolve(g1.dirname(J),U),g1.resolve(Y.componentsDir||"components",`${U}.stx`),g1.resolve(Y.componentsDir||"components",U),U.endsWith(".stx")?U:`${U}.stx`];for(let V of H)try{if(await Bun.file(V).exists()){L=V;break}}catch{}if(L){G.set(F,L),G.set(O,L),G.set(O.toLowerCase(),L);let V=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,L),Q.add(L),Y.debug)console.log(`Imported component: ${F} -> ${L}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${U}`)}X=X.replace(_,""),K.lastIndex=0}return X}async function xK($,Z,J,Y,Q){let X=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,_;while((_=q.exec(X))!==null){let W=_.index,z=W+_[0].length-1,U=1,j=z+1;while(j<X.length&&U>0){if(X[j]==="(")U++;else if(X[j]===")"){if(U--,U===0)break}j++}if(U!==0)break;let B=X.substring(z+1,j),O=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){q.lastIndex=0;continue}let L=F[1],H,V=B.slice(F[0].length),A=V.match(/^\s*,\s*/);if(A)H=V.slice(A[0].length).trim();let w={};if(H)try{w=O0(H,Z)}catch(E){let k=E instanceof Error?E.message:String(E);X=X.replace(X.substring(W,O),`[Error parsing component props: ${k}]`);continue}let R="",N=O,I=X.substring(O).match(/^([\s\S]*?)@endcomponent/);if(I)R=I[1].trim(),N=O+I[0].length;let M=await z1(L,w,R,G,Z,J,Y,K,Q);X=X.substring(0,W)+M+X.substring(N),q.lastIndex=0}return X}async function fK($,Z,J,Y,Q){if(!$)return $;let X=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents;return X=await z(X,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),X=await z(X,/[A-Z][a-zA-Z0-9]*/,!0),X=await z(X,/[a-z][a-z0-9]*/,!1,yK),X;async function z(U,j,B,O){if(!U)return U;let F=U,L=I8(F,j,O);for(let H=L.length-1;H>=0;H--){let V=L[H],A=B?M8(V.tagName):V.tagName,w=PK(V.attributes),R=CK(w,Z,Y),N=d0.getBuiltin(V.tagName);if(N){let E={context:Z,filePath:J,options:Y,dependencies:Q},k=N.render(R,V.content,E);if(Object.keys(R.clientReactive).length>0)k=k8(k,R.clientReactive);if(Object.keys(R.events).length>0){let y=Object.entries(R.events).map(([S,b])=>`${S}="${b.replace(/"/g,"&quot;")}"`).join(" ");k=k.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}F=F.substring(0,V.startIndex)+k+F.substring(V.endIndex);continue}let T={};for(let[E,k]of Object.entries(R.static))T[E]=k;for(let[E,k]of Object.entries(R.serverDynamic))T[E]=k;let M=await z1(A,T,V.content,G,Z,J,Y,K,Q);if(Object.keys(R.clientReactive).length>0)M=k8(M,R.clientReactive);if(Object.keys(R.events).length>0){let E=M.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(E){let k=Object.entries(R.events).map(([S,b])=>`${S}="${b}"`).join(" "),y=E[1].length+E[2].length;M=M.substring(0,y)+" "+k+M.substring(y)}}F=F.substring(0,V.startIndex)+M+F.substring(V.endIndex)}return F}}function k8($,Z){let J=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!J)return $;let Y=Object.entries(Z).map(([X,G])=>`:${X}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=J[1].length+J[2].length;return $.substring(0,Q)+" "+Y+$.substring(Q)}async function i4($,Z,J,Y,Q){if(!E8)N8(),E8=!0;let X=await vK($,Z,J,Y,Q);X=await xK(X,Z,J,Y,Q);for(let G=0;G<3;G++){let K=X;if(X=await fK(X,Z,J,Y,Q),X===K)break}return X}var E8=!1,yK;var b8=C(()=>{k4();T8();D8();F0();A0();yK=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"])});import h1 from"path";function S8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function y8($,Z,J){try{let Y;if($.startsWith("/")){let Q=Z;for(let X=0;X<5;X++){let G=h1.join(Q,$);if(J0("fs").existsSync(G))return G;Q=h1.dirname(Q)}Y=h1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))Y=h1.resolve(Z,$);else Y=h1.resolve(Z,$);if(J0("fs").existsSync(Y))return Y;return null}catch{return null}}async function C8($,Z,J){let Y=$,Q=h1.dirname(Z),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=X.exec(Y))!==null){let[_,W,z,U]=G;if(S8(z))continue;let j=y8(z,Q,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),z.endsWith(".ts")||z.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:x0()});if(F.outputs.length>0)B=await F.outputs[0].text()}let O=`<script>
6696
6701
  // Source: ${z}
6697
6702
  ${B}
6698
- </script>`;Y=Y.replace(_,O),X.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(Y))!==null){let[_,W,z,U]=q,j=W+U;if(b8(z))continue;if(/rel=["']stylesheet["']/.test(j)||z.endsWith(".css")){let O=S8(z,Q,Z);if(O)try{let F=await Bun.file(O).text();J.add(O);let L=`<style>
6703
+ </script>`;Y=Y.replace(_,O),X.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(Y))!==null){let[_,W,z,U]=q,j=W+U;if(S8(z))continue;if(/rel=["']stylesheet["']/.test(j)||z.endsWith(".css")){let O=y8(z,Q,Z);if(O)try{let F=await Bun.file(O).text();J.add(O);let L=`<style>
6699
6704
  /* Source: ${z} */
6700
6705
  ${F}
6701
- </style>`;Y=Y.replace(_,L),K.lastIndex=0}catch(F){}}}return Y}var C8=C(()=>{R1()});function n4($,Z){let J=$,Y=/@json\s*\(/g,Q;while((Q=Y.exec(J))!==null){let X=Q.index,G=X+Q[0].length-1,K=1,q=G+1,_=null,W=!1;while(q<J.length&&K>0){let V=J[q];if(W){W=!1,q++;continue}if(V==="\\"&&_){W=!0,q++;continue}if(_){if(V===_)_=null;q++;continue}if(V==='"'||V==="'"||V==="`"){_=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=J.substring(G+1,q).trim(),U=J.substring(X,q+1),j=-1,B=0,O=null,F=!1;for(let V=0;V<z.length;V++){let N=z[V];if(F){F=!1;continue}if(N==="\\"&&O){F=!0;continue}if(O){if(N===O)O=null;continue}if(N==='"'||N==="'"||N==="`"){O=N;continue}if(N==="("||N==="["||N==="{")B++;else if(N===")"||N==="]"||N==="}")B--;if(N===","&&B===0){j=V;break}}let L=j>=0?z.substring(0,j).trim():z,H=j>=0?z.substring(j+1).trim():void 0;try{let V=L.trim(),N;if(e(V))N=$0(V,Object.keys(Z))(...Object.values(Z));else N=void 0;let w;if(H==="true")w=JSON.stringify(N,null,2);else w=JSON.stringify(N);let R=w.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,X)+R+J.substring(q+1),Y.lastIndex=X+R.length}catch(V){C0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),Y.lastIndex=X+U.length}}return J}function o4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function P8($){let Z=$,J=/@memo\s*\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let X=Y.index,G=X+Y[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let _=Z.slice(G,q-1).trim(),W=q,z=Z.slice(W),U=z.indexOf("@endmemo");if(U===-1)continue;let j=z.slice(0,U),B=W+U+8,O=j.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)/),F=O?O[0].length:0,L=j.slice(F),H=j.match(/(\s*)$/),V=H?H[0].length:0,N=L.slice(0,L.length-V),w=N.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(w){let[A,T,I="",M]=w,E=`<${T}${I} data-stx-memo="${_}"${M}>`;R=j.slice(0,F)+E+N.slice(A.length)+j.slice(F+N.length)}else R=`${j.slice(0,F)}<div data-stx-memo="${_}">${N}</div>${j.slice(F+N.length)}`;Q.push({start:X,end:B,replacement:R}),J.lastIndex=B}for(let X=Q.length-1;X>=0;X--){let G=Q[X];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function s4($){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 v8($){let J=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",Q=0,X;while((X=J.exec($))!==null){let G=X.index,K=G+X[0].length,q=!1,_=!1,W=-1;while(K<$.length){let O=$[K];if(q){if(O==="'")q=!1}else if(_){if(O==='"')_=!1}else if(O==="'")q=!0;else if(O==='"')_=!0;else if(O===">"){W=K;break}K++}if(W===-1)continue;if($.slice(G,W+1).includes("x-cloak"))continue;let U=$.slice(W+1),j=U.indexOf("</"),B=j>=0?U.slice(0,j):U.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))Y+=$.slice(Q,W)+" x-cloak>",Q=W+1}return Y+=$.slice(Q),Y}var r4=C(()=>{c0();N0()});function a4($,Z,J){let Y=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1},Q=Y.allowPatterns??[],X=[];for(let{pattern:G,message:K,suggestion:q}of PK){if(Q.some((W)=>K.includes(W)||G.source.includes(W)))continue;G.lastIndex=0;let _=$.match(G);if(_&&_.length>0){let W=$.split(`
6706
+ </style>`;Y=Y.replace(_,L),K.lastIndex=0}catch(F){}}}return Y}var P8=C(()=>{N1()});function n4($,Z){let J=$,Y=/@json\s*\(/g,Q;while((Q=Y.exec(J))!==null){let X=Q.index,G=X+Q[0].length-1,K=1,q=G+1,_=null,W=!1;while(q<J.length&&K>0){let V=J[q];if(W){W=!1,q++;continue}if(V==="\\"&&_){W=!0,q++;continue}if(_){if(V===_)_=null;q++;continue}if(V==='"'||V==="'"||V==="`"){_=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=J.substring(G+1,q).trim(),U=J.substring(X,q+1),j=-1,B=0,O=null,F=!1;for(let V=0;V<z.length;V++){let A=z[V];if(F){F=!1;continue}if(A==="\\"&&O){F=!0;continue}if(O){if(A===O)O=null;continue}if(A==='"'||A==="'"||A==="`"){O=A;continue}if(A==="("||A==="["||A==="{")B++;else if(A===")"||A==="]"||A==="}")B--;if(A===","&&B===0){j=V;break}}let L=j>=0?z.substring(0,j).trim():z,H=j>=0?z.substring(j+1).trim():void 0;try{let V=L.trim(),A;if(e(V))A=$0(V,Object.keys(Z))(...Object.values(Z));else A=void 0;let w;if(H==="true")w=JSON.stringify(A,null,2);else w=JSON.stringify(A);let R=w.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,X)+R+J.substring(q+1),Y.lastIndex=X+R.length}catch(V){C0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),Y.lastIndex=X+U.length}}return J}function o4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function v8($){let Z=$,J=/@memo\s*\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let X=Y.index,G=X+Y[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let _=Z.slice(G,q-1).trim(),W=q,z=Z.slice(W),U=z.indexOf("@endmemo");if(U===-1)continue;let j=z.slice(0,U),B=W+U+8,O=j.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)/),F=O?O[0].length:0,L=j.slice(F),H=j.match(/(\s*)$/),V=H?H[0].length:0,A=L.slice(0,L.length-V),w=A.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(w){let[N,T,I="",M]=w,E=`<${T}${I} data-stx-memo="${_}"${M}>`;R=j.slice(0,F)+E+A.slice(N.length)+j.slice(F+A.length)}else R=`${j.slice(0,F)}<div data-stx-memo="${_}">${A}</div>${j.slice(F+A.length)}`;Q.push({start:X,end:B,replacement:R}),J.lastIndex=B}for(let X=Q.length-1;X>=0;X--){let G=Q[X];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function s4($){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 x8($){let J=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",Q=0,X;while((X=J.exec($))!==null){let G=X.index,K=G+X[0].length,q=!1,_=!1,W=-1;while(K<$.length){let O=$[K];if(q){if(O==="'")q=!1}else if(_){if(O==='"')_=!1}else if(O==="'")q=!0;else if(O==='"')_=!0;else if(O===">"){W=K;break}K++}if(W===-1)continue;if($.slice(G,W+1).includes("x-cloak"))continue;let U=$.slice(W+1),j=U.indexOf("</"),B=j>=0?U.slice(0,j):U.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))Y+=$.slice(Q,W)+" x-cloak>",Q=W+1}return Y+=$.slice(Q),Y}var r4=C(()=>{c0();A0()});function a4($,Z,J){let Y=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1},Q=Y.allowPatterns??[],X=[];for(let{pattern:G,message:K,suggestion:q}of gK){if(Q.some((W)=>K.includes(W)||G.source.includes(W)))continue;G.lastIndex=0;let _=$.match(G);if(_&&_.length>0){let W=$.split(`
6702
6707
  `),z=[];W.forEach((j,B)=>{if(G.lastIndex=0,G.test(j))z.push(B+1)});let U=z.length>0?` (line${z.length>1?"s":""}: ${z.join(", ")})`:"";X.push(` \u2717 ${K}${U}
6703
6708
  \u2192 ${q}`)}}if(X.length>0&&Y.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
6704
6709
  ${X.join(`
6705
6710
  `)}
6706
- Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var PK;var t4=C(()=>{PK=[{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 x8={};r(x8,{getStoreScript:()=>vK,clearStoreCache:()=>xK});import D9 from"path";async function vK($){let Z;if($)Z=D9.resolve($);else{let W=await O1();Z=D9.resolve(W.root||process.cwd(),W.storesDir||"stores")}let J=h1.get(Z);if(J!==void 0)return J||null;let Y=new Bun.Glob("*.ts"),Q=[];try{for await(let W of Y.scan({cwd:Z,absolute:!0})){let z=D9.basename(W,".ts");if(["index","types"].includes(z))continue;if(W.includes(".d.ts"))continue;Q.push(W)}}catch{return h1.set(Z,""),null}if(Q.length===0)return h1.set(Z,""),null;let X=[];for(let W of Q){let z=await Bun.file(W).text();X.push({file:W,hasUseStore:/useStore\s*\(/.test(z)})}X.sort((W,z)=>{if(W.hasUseStore===z.hasUseStore)return 0;return W.hasUseStore?1:-1});let G=X.map((W)=>W.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:x0()});for(let W of G)try{let z=await Bun.file(W).text(),U=D9.basename(W,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${U}
6707
- ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${W}:`,z)}if(K.length===0)return h1.set(Z,""),null;let _=`;(function(){
6711
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var gK;var t4=C(()=>{gK=[{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 f8={};r(f8,{getStoreScript:()=>hK,clearStoreCache:()=>dK});import D9 from"path";async function hK($){let Z;if($)Z=D9.resolve($);else{let W=await O1();Z=D9.resolve(W.root||process.cwd(),W.storesDir||"stores")}let J=d1.get(Z);if(J!==void 0)return J||null;let Y=new Bun.Glob("*.ts"),Q=[];try{for await(let W of Y.scan({cwd:Z,absolute:!0})){let z=D9.basename(W,".ts");if(["index","types"].includes(z))continue;if(W.includes(".d.ts"))continue;Q.push(W)}}catch{return d1.set(Z,""),null}if(Q.length===0)return d1.set(Z,""),null;let X=[];for(let W of Q){let z=await Bun.file(W).text();X.push({file:W,hasUseStore:/useStore\s*\(/.test(z)})}X.sort((W,z)=>{if(W.hasUseStore===z.hasUseStore)return 0;return W.hasUseStore?1:-1});let G=X.map((W)=>W.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:x0()});for(let W of G)try{let z=await Bun.file(W).text(),U=D9.basename(W,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${U}
6712
+ ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${W}:`,z)}if(K.length===0)return d1.set(Z,""),null;let _=`;(function(){
6708
6713
  ${K.join(`
6709
6714
 
6710
6715
  `)}
6711
- })();`;return h1.set(Z,_),_}function xK(){h1.clear()}var h1;var f8=C(()=>{J5();R1();h1=new Map});var h8={};r(h8,{processDeferDirectives:()=>mK});function fK(){return`stx-defer-${++g8}`}function gK($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function hK($,Z,J){let{trigger:Y,value:Q}=gK(Z),X=J,G,K,q,_=J.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(_)G=_[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let W=J.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(W)K=W[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=J.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),X=X.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return X=X.trim(),{trigger:Y,triggerValue:Q,content:X,placeholder:G,loading:K,error:q}}function dK($,Z){let{trigger:J,triggerValue:Y}=Z,Q;switch(J){case"visible":Q=`
6716
+ })();`;return d1.set(Z,_),_}function dK(){d1.clear()}var d1;var g8=C(()=>{J5();N1();d1=new Map});var d8={};r(d8,{processDeferDirectives:()=>cK});function mK(){return`stx-defer-${++h8}`}function uK($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function pK($,Z,J){let{trigger:Y,value:Q}=uK(Z),X=J,G,K,q,_=J.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(_)G=_[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let W=J.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(W)K=W[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=J.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),X=X.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return X=X.trim(),{trigger:Y,triggerValue:Q,content:X,placeholder:G,loading:K,error:q}}function lK($,Z){let{trigger:J,triggerValue:Y}=Z,Q;switch(J){case"visible":Q=`
6712
6717
  const observer = new IntersectionObserver((entries) => {
6713
6718
  if (entries[0].isIntersecting) {
6714
6719
  observer.disconnect();
@@ -6781,7 +6786,7 @@ else {
6781
6786
  ${Q}
6782
6787
  })();
6783
6788
  </script>
6784
- `}function mK($,Z,J){g8=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(Y,(Q,X,G)=>{let K=fK(),q=hK(Q,X,G),_=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",W=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",U=`<div data-defer-content style="display: none;">${q.content}</div>`,j=dK(K,q);return`
6789
+ `}function cK($,Z,J){h8=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(Y,(Q,X,G)=>{let K=mK(),q=pK(Q,X,G),_=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",W=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",U=`<div data-defer-content style="display: none;">${q.content}</div>`,j=lK(K,q);return`
6785
6790
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
6786
6791
  ${_}
6787
6792
  ${W}
@@ -6789,7 +6794,7 @@ else {
6789
6794
  ${z}
6790
6795
  </div>
6791
6796
  ${j}
6792
- `})}var g8=0;var m8={};r(m8,{processTeleportDirectives:()=>cK,ensureTeleportTargets:()=>iK});function uK(){return`stx-teleport-${++d8}`}function pK($){let Z=$.split(",").map((Q)=>Q.trim()),J=Z[0].replace(/['"]/g,""),Y;for(let Q=1;Q<Z.length;Q++){let X=Z[Q].match(/disabled:\s*(.+)/);if(X)Y=X[1].trim()}return{target:J,disabled:Y}}function lK($,Z){return`
6797
+ `})}var h8=0;var u8={};r(u8,{processTeleportDirectives:()=>sK,ensureTeleportTargets:()=>rK});function iK(){return`stx-teleport-${++m8}`}function nK($){let Z=$.split(",").map((Q)=>Q.trim()),J=Z[0].replace(/['"]/g,""),Y;for(let Q=1;Q<Z.length;Q++){let X=Z[Q].match(/disabled:\s*(.+)/);if(X)Y=X[1].trim()}return{target:J,disabled:Y}}function oK($,Z){return`
6793
6798
  <script>
6794
6799
  (function() {
6795
6800
  const source = document.getElementById('${$}');
@@ -6825,12 +6830,12 @@ else {
6825
6830
  }));
6826
6831
  })();
6827
6832
  </script>
6828
- `}function cK($,Z,J){d8=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(Y,(Q,X,G)=>{let K=uK(),{target:q,disabled:_}=pK(X),W=G.trim();if(_)try{let U=!1;if(_==="true")U=!0;else if(_==="false")U=!1;else if(_ in Z)U=Boolean(Z[_]);if(U)return`<div class="stx-teleport-inline" data-teleport-disabled>${W}</div>`}catch{}let z=lK(K,q);return`
6833
+ `}function sK($,Z,J){m8=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(Y,(Q,X,G)=>{let K=iK(),{target:q,disabled:_}=nK(X),W=G.trim();if(_)try{let U=!1;if(_==="true")U=!0;else if(_==="false")U=!1;else if(_ in Z)U=Boolean(Z[_]);if(U)return`<div class="stx-teleport-inline" data-teleport-disabled>${W}</div>`}catch{}let z=oK(K,q);return`
6829
6834
  <div id="${K}" class="stx-teleport-source" style="display: none;">
6830
6835
  <template>${W}</template>
6831
6836
  </div>
6832
6837
  ${z}
6833
- `})}function iK(){return`
6838
+ `})}function rK(){return`
6834
6839
  <script>
6835
6840
  (function() {
6836
6841
  // Common teleport targets
@@ -6847,7 +6852,7 @@ else {
6847
6852
  });
6848
6853
  })();
6849
6854
  </script>
6850
- `}var d8=0;var c8={};r(c8,{processTransitionDirectives:()=>rK,processTransitionAttributes:()=>$q,performLeave:()=>sK,performEnter:()=>oK,generateTransitionRuntime:()=>eK,generateTransitionCSS:()=>tK});function u8($,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 nK($){let Z=getComputedStyle($),J=Z.transitionDuration||"0s",Y=Z.animationDuration||"0s",Q=(X)=>{let G=X.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(J),Q(Y))}function p8($,Z){return new Promise((J)=>{let Y=Z??nK($);if(Y===0){J();return}let Q=!1,X=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),J()},G=(K)=>{if(K.target===$)X()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(X,Y+50)})}function l8($){$.offsetHeight}async function oK($,Z={}){let J=Z.name||"stx",Y=u8(J,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(Y.enterFrom),$.classList.add(Y.enterActive),l8($),$.classList.remove(Y.enterFrom),$.classList.add(Y.enterTo),Z.onEnter)await new Promise((X)=>{Z.onEnter($,X)});else await p8($,Q);$.classList.remove(Y.enterActive),$.classList.remove(Y.enterTo),Z.onAfterEnter?.($)}async function sK($,Z={}){let J=Z.name||"stx",Y=u8(J,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(Y.leaveFrom),$.classList.add(Y.leaveActive),l8($),$.classList.remove(Y.leaveFrom),$.classList.add(Y.leaveTo),Z.onLeave)await new Promise((X)=>{Z.onLeave($,X)});else await p8($,Q);$.classList.remove(Y.leaveActive),$.classList.remove(Y.leaveTo),Z.onAfterLeave?.($)}function rK($,Z={},J){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(Y,(Q,X,G)=>{let K=aK(X),q=K.name||"stx",_=K.duration||300,W=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
6855
+ `}var m8=0;var i8={};r(i8,{processTransitionDirectives:()=>$q,processTransitionAttributes:()=>Xq,performLeave:()=>eK,performEnter:()=>tK,generateTransitionRuntime:()=>Jq,generateTransitionCSS:()=>Yq});function p8($,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 aK($){let Z=getComputedStyle($),J=Z.transitionDuration||"0s",Y=Z.animationDuration||"0s",Q=(X)=>{let G=X.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(J),Q(Y))}function l8($,Z){return new Promise((J)=>{let Y=Z??aK($);if(Y===0){J();return}let Q=!1,X=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),J()},G=(K)=>{if(K.target===$)X()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(X,Y+50)})}function c8($){$.offsetHeight}async function tK($,Z={}){let J=Z.name||"stx",Y=p8(J,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(Y.enterFrom),$.classList.add(Y.enterActive),c8($),$.classList.remove(Y.enterFrom),$.classList.add(Y.enterTo),Z.onEnter)await new Promise((X)=>{Z.onEnter($,X)});else await l8($,Q);$.classList.remove(Y.enterActive),$.classList.remove(Y.enterTo),Z.onAfterEnter?.($)}async function eK($,Z={}){let J=Z.name||"stx",Y=p8(J,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(Y.leaveFrom),$.classList.add(Y.leaveActive),c8($),$.classList.remove(Y.leaveFrom),$.classList.add(Y.leaveTo),Z.onLeave)await new Promise((X)=>{Z.onLeave($,X)});else await l8($,Q);$.classList.remove(Y.leaveActive),$.classList.remove(Y.leaveTo),Z.onAfterLeave?.($)}function $q($,Z={},J){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(Y,(Q,X,G)=>{let K=Zq(X),q=K.name||"stx",_=K.duration||300,W=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
6851
6856
  <div
6852
6857
  class="stx-transition-wrapper"
6853
6858
  data-transition="${q}"
@@ -6889,7 +6894,7 @@ else {
6889
6894
  });
6890
6895
  })();
6891
6896
  </script>
6892
- `})}function aK($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3]||Y[4]||Y[5];switch(Q){case"name":Z.name=X;break;case"duration":Z.duration=parseInt(X,10);break;case"mode":Z.mode=X;break;case"easing":Z.easing=X;break}}return Z}function tK(){return`
6897
+ `})}function Zq($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3]||Y[4]||Y[5];switch(Q){case"name":Z.name=X;break;case"duration":Z.duration=parseInt(X,10);break;case"mode":Z.mode=X;break;case"easing":Z.easing=X;break}}return Z}function Yq(){return`
6893
6898
  /* STX Transition Presets */
6894
6899
 
6895
6900
  /* Fade */
@@ -7076,7 +7081,7 @@ else {
7076
7081
  opacity: 1;
7077
7082
  max-height: 1000px;
7078
7083
  }
7079
- `}function eK(){return`
7084
+ `}function Jq(){return`
7080
7085
  // STX Transition Runtime
7081
7086
  (function() {
7082
7087
  if (typeof window === 'undefined') return;
@@ -7165,7 +7170,7 @@ else {
7165
7170
 
7166
7171
  console.log('[stx] Transition runtime initialized');
7167
7172
  })();
7168
- `}function $q($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(J,Y,Q,X)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${G}" data-stx-transition-condition="${X}" data-stx-transition-id="${K}"`})}var n8={};r(n8,{withErrorBoundary:()=>i8,processErrorBoundaryDirectives:()=>Jq,generateErrorBoundaryRuntime:()=>qq,generateErrorBoundaryCSS:()=>Kq,createErrorBoundary:()=>Gq});function Yq(){return`eb-${++Zq}-${Date.now().toString(36)}`}function Jq($,Z={},J){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(Y,(Q,X,G,K)=>{let q=Yq(),_=Xq(X||"");return Qq(q,G.trim(),K.trim(),_)})}function Xq($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3]||Y[4];switch(Q){case"id":Z.id=X;break;case"logErrors":Z.logErrors=X==="true";break}}return Z}function Qq($,Z,J,Y){let Q=Y.logErrors!==!1;return`
7173
+ `}function Xq($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(J,Y,Q,X)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${G}" data-stx-transition-condition="${X}" data-stx-transition-id="${K}"`})}var o8={};r(o8,{withErrorBoundary:()=>n8,processErrorBoundaryDirectives:()=>Kq,generateErrorBoundaryRuntime:()=>Uq,generateErrorBoundaryCSS:()=>zq,createErrorBoundary:()=>_q});function Gq(){return`eb-${++Qq}-${Date.now().toString(36)}`}function Kq($,Z={},J){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(Y,(Q,X,G,K)=>{let q=Gq(),_=qq(X||"");return Wq(q,G.trim(),K.trim(),_)})}function qq($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3]||Y[4];switch(Q){case"id":Z.id=X;break;case"logErrors":Z.logErrors=X==="true";break}}return Z}function Wq($,Z,J,Y){let Q=Y.logErrors!==!1;return`
7169
7174
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
7170
7175
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
7171
7176
  ${Z}
@@ -7285,7 +7290,7 @@ else {
7285
7290
  };
7286
7291
  })();
7287
7292
  </script>
7288
- `}async function i8($,Z,J){try{return await $()}catch(Y){if(J)J(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return Z}}function Gq($,Z={}){let J=Z.onError?(Y)=>Z.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>i8(Y,$,J)}function Kq(){return`
7293
+ `}async function n8($,Z,J){try{return await $()}catch(Y){if(J)J(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return Z}}function _q($,Z={}){let J=Z.onError?(Y)=>Z.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>n8(Y,$,J)}function zq(){return`
7289
7294
  /* STX Error Boundary Styles */
7290
7295
  .stx-error-boundary {
7291
7296
  position: relative;
@@ -7329,7 +7334,7 @@ else {
7329
7334
  color: #fecaca;
7330
7335
  }
7331
7336
  }
7332
- `}function qq(){return`
7337
+ `}function Uq(){return`
7333
7338
  // STX Error Boundary Runtime
7334
7339
  (function() {
7335
7340
  if (typeof window === 'undefined') return;
@@ -7394,7 +7399,7 @@ else {
7394
7399
 
7395
7400
  console.log('[stx] Error boundary runtime initialized');
7396
7401
  })();
7397
- `}var Zq=0;var o8={};r(o8,{renderSSRSuspense:()=>Oq,processSuspenseDirectives:()=>zq,generateSuspenseRuntime:()=>Lq,generateSuspenseCSS:()=>Hq,createSSRSuspense:()=>jq});function _q(){return`suspense-${++Wq}-${Date.now().toString(36)}`}function zq($,Z={},J){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(Y,(Q,X,G,K)=>{let q=_q(),_=Uq(X||"");return Bq(q,G.trim(),K.trim(),_)})}function Uq($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4];switch(Q){case"id":Z.id=X;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function Bq($,Z,J,Y){let Q=Y.timeout||30000,X=Y.id||$;return`
7402
+ `}var Qq=0;var s8={};r(s8,{renderSSRSuspense:()=>Vq,processSuspenseDirectives:()=>Oq,generateSuspenseRuntime:()=>Aq,generateSuspenseCSS:()=>wq,createSSRSuspense:()=>Fq});function jq(){return`suspense-${++Bq}-${Date.now().toString(36)}`}function Oq($,Z={},J){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(Y,(Q,X,G,K)=>{let q=jq(),_=Hq(X||"");return Lq(q,G.trim(),K.trim(),_)})}function Hq($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4];switch(Q){case"id":Z.id=X;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function Lq($,Z,J,Y){let Q=Y.timeout||30000,X=Y.id||$;return`
7398
7403
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${X}" data-status="pending">
7399
7404
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
7400
7405
  ${J}
@@ -7584,7 +7589,7 @@ else {
7584
7589
  }, 0);
7585
7590
  })();
7586
7591
  </script>
7587
- `}function jq($,Z,J){return{id:$,fallback:J,content:Z}}async function Oq($){let Z=$.map((Y)=>`
7592
+ `}function Fq($,Z,J){return{id:$,fallback:J,content:Z}}async function Vq($){let Z=$.map((Y)=>`
7588
7593
  <div id="stx-ssr-suspense-${Y.id}" class="stx-ssr-suspense">
7589
7594
  ${Y.fallback}
7590
7595
  </div>
@@ -7609,7 +7614,7 @@ else {
7609
7614
  }
7610
7615
  })();
7611
7616
  </script>
7612
- `}}return{initial:Z,streaming:J()}}function Hq(){return`
7617
+ `}}return{initial:Z,streaming:J()}}function wq(){return`
7613
7618
  /* STX Suspense Styles */
7614
7619
  .stx-suspense {
7615
7620
  position: relative;
@@ -7665,7 +7670,7 @@ else {
7665
7670
  background-size: 200% 100%;
7666
7671
  }
7667
7672
  }
7668
- `}function Lq(){return`
7673
+ `}function Aq(){return`
7669
7674
  // STX Suspense Runtime
7670
7675
  (function() {
7671
7676
  if (typeof window === 'undefined') return;
@@ -7732,7 +7737,7 @@ else {
7732
7737
 
7733
7738
  console.log('[stx] Suspense runtime initialized');
7734
7739
  })();
7735
- `}var Wq=0;var t8={};r(t8,{processAsyncDirectives:()=>Vq,isAsyncComponent:()=>Nq,generateAsyncComponentRuntime:()=>Aq,generateAsyncComponentCSS:()=>Rq,defineAsyncComponent:()=>wq});function s8(){return`async-${++Fq}-${Date.now().toString(36)}`}function Vq($,Z={},J){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,X=$;return X=X.replace(Y,(G,K,q,_)=>{let W=s8(),z=r8(K);return a8(W,z,q.trim(),_.trim())}),X=X.replace(Q,(G,K,q)=>{let _=s8(),W=r8(K);return a8(_,W,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function r8($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4],K=Y[5];switch(Q){case"component":Z.component=X||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=X||K;break;case"errorComponent":Z.errorComponent=X||K;break}}return Z}function a8($,Z,J,Y){let{component:Q,timeout:X,delay:G,suspensible:K,retries:q}=Z;return`
7740
+ `}var Bq=0;var e8={};r(e8,{processAsyncDirectives:()=>Nq,isAsyncComponent:()=>Mq,generateAsyncComponentRuntime:()=>Dq,generateAsyncComponentCSS:()=>Iq,defineAsyncComponent:()=>Tq});function r8(){return`async-${++Rq}-${Date.now().toString(36)}`}function Nq($,Z={},J){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,X=$;return X=X.replace(Y,(G,K,q,_)=>{let W=r8(),z=a8(K);return t8(W,z,q.trim(),_.trim())}),X=X.replace(Q,(G,K,q)=>{let _=r8(),W=a8(K);return t8(_,W,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function a8($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4],K=Y[5];switch(Q){case"component":Z.component=X||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=X||K;break;case"errorComponent":Z.errorComponent=X||K;break}}return Z}function t8($,Z,J,Y){let{component:Q,timeout:X,delay:G,suspensible:K,retries:q}=Z;return`
7736
7741
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
7737
7742
  <div class="stx-async-loading" data-async-loading="${$}">
7738
7743
  ${J}
@@ -7917,7 +7922,7 @@ catch (error) {
7917
7922
  loadComponent();
7918
7923
  })();
7919
7924
  </script>
7920
- `}function wq($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function Nq($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function Rq(){return`
7925
+ `}function Tq($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function Mq($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function Iq(){return`
7921
7926
  /* STX Async Component Styles */
7922
7927
  .stx-async-component {
7923
7928
  position: relative;
@@ -7991,7 +7996,7 @@ catch (error) {
7991
7996
  background-size: 200% 100%;
7992
7997
  }
7993
7998
  }
7994
- `}function Aq(){return`
7999
+ `}function Dq(){return`
7995
8000
  // STX Async Component Runtime
7996
8001
  (function() {
7997
8002
  if (typeof window === 'undefined') return;
@@ -8045,7 +8050,7 @@ catch (error) {
8045
8050
 
8046
8051
  console.log('[stx] Async component runtime initialized');
8047
8052
  })();
8048
- `}var Fq=0;var $Z={};r($Z,{shouldCacheComponent:()=>kq,processKeepAliveDirectives:()=>Mq,onDeactivated:()=>Cq,onActivated:()=>yq,generateKeepAliveRuntime:()=>Sq,generateKeepAliveCSS:()=>bq,createKeepAliveCache:()=>Eq});function e8(){return`keep-alive-${++Tq}-${Date.now().toString(36)}`}function Mq($,Z={},J){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(Y,(Q,X,G)=>{let K=e8(),q=Iq(X||"");return Dq(K,G.trim(),q)})}function Iq($){let Z={max:10},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=X;break;case"exclude":Z.exclude=X;break;case"id":Z.id=X;break}}return Z}function Dq($,Z,J){let{max:Y,include:Q,exclude:X}=J,G=J.id||$;return`
8053
+ `}var Rq=0;var ZZ={};r(ZZ,{shouldCacheComponent:()=>Cq,processKeepAliveDirectives:()=>kq,onDeactivated:()=>fq,onActivated:()=>xq,generateKeepAliveRuntime:()=>vq,generateKeepAliveCSS:()=>Pq,createKeepAliveCache:()=>yq});function $Z(){return`keep-alive-${++Eq}-${Date.now().toString(36)}`}function kq($,Z={},J){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(Y,(Q,X,G)=>{let K=$Z(),q=bq(X||"");return Sq(K,G.trim(),q)})}function bq($){let Z={max:10},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=X;break;case"exclude":Z.exclude=X;break;case"id":Z.id=X;break}}return Z}function Sq($,Z,J){let{max:Y,include:Q,exclude:X}=J,G=J.id||$;return`
8049
8054
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
8050
8055
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
8051
8056
  ${Z}
@@ -8332,7 +8337,7 @@ else {
8332
8337
  });
8333
8338
  })();
8334
8339
  </script>
8335
- `}function Eq($={}){return{id:$.id||e8(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((J)=>J.trim()):null,exclude:$.exclude?$.exclude.split(",").map((J)=>J.trim()):null}}function kq($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function bq(){return`
8340
+ `}function yq($={}){return{id:$.id||$Z(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((J)=>J.trim()):null,exclude:$.exclude?$.exclude.split(",").map((J)=>J.trim()):null}}function Cq($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function Pq(){return`
8336
8341
  /* STX Keep-Alive Styles */
8337
8342
  .stx-keep-alive {
8338
8343
  position: relative;
@@ -8357,7 +8362,7 @@ else {
8357
8362
  .stx-keep-alive-content > [data-activated] {
8358
8363
  opacity: 1;
8359
8364
  }
8360
- `}function Sq(){return`
8365
+ `}function vq(){return`
8361
8366
  // STX Keep-Alive Runtime
8362
8367
  (function() {
8363
8368
  if (typeof window === 'undefined') return;
@@ -8393,11 +8398,11 @@ else {
8393
8398
 
8394
8399
  console.log('[stx] Keep-alive runtime initialized');
8395
8400
  })();
8396
- `}function yq($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function Cq($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var Tq=0;var QZ={};r(QZ,{useVirtualList:()=>YZ,processVirtualListDirectives:()=>$7,processVirtualGridDirectives:()=>XZ,processInfiniteListDirectives:()=>JZ,generateVirtualListCSS:()=>ZZ,default:()=>Pq,createVirtualList:()=>e4});function e4($,Z){let{itemHeight:J,containerHeight:Y,overscan:Q=3,keyProperty:X="id",dynamicHeight:G=!1,estimatedItemHeight:K=J,direction:q="vertical"}=Z,_=[...$],W=0,z=new Map;function U(){if(G)return j();let R=Math.max(0,Math.floor(W/J)-Q),A=Math.ceil(Y/J),T=Math.min(_.length-1,R+A+Q*2);return{startIndex:R,endIndex:T}}function j(){let R=0,A=0,T=_.length-1;for(let I=0;I<_.length;I++){let M=z.get(I)||K;if(R+M>W){A=Math.max(0,I-Q);break}R+=M}R=0;for(let I=0;I<_.length;I++){let M=z.get(I)||K;if(R+=M,R>W+Y){T=Math.min(_.length-1,I+Q);break}}return{startIndex:A,endIndex:T}}function B(){if(G){let R=0;for(let A=0;A<_.length;A++)R+=z.get(A)||K;return R}return _.length*J}function O(R){if(G){let A=0;for(let T=0;T<R;T++)A+=z.get(T)||K;return A}return R*J}function F(){let{startIndex:R,endIndex:A}=U();return{startIndex:R,endIndex:A,scrollTop:W,totalHeight:B(),visibleItems:_.slice(R,A+1),itemHeights:new Map(z)}}function L(R,A="auto"){let T=O(R);H(T,A)}function H(R,A="auto"){W=Math.max(0,Math.min(R,B()-Y))}function V(){U()}function N(R){_=[...R],z.clear(),V()}function w(){_=[],z.clear()}return{scrollToIndex:L,scrollToOffset:H,getState:F,refresh:V,setItems:N,destroy:w}}function $7($,Z={},J){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(Y,(Q,X,G,K)=>{let q=X.trim(),_=Z[q];if(!_||!Array.isArray(_))return`<!-- virtualList: items "${q}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let H=G.trim(),V=Function(`return ${H}`)();W={...W,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(W.containerHeight/W.itemHeight),j=W.overscan||3,B=0,O=Math.min(_.length-1,U+j),F="";for(let H=B;H<=O&&H<_.length;H++){let V=_[H],N=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(w,R)=>{if(typeof V==="object"&&V!==null)return String(V[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(H));F+=`
8401
+ `}function xq($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function fq($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var Eq=0;var GZ={};r(GZ,{useVirtualList:()=>JZ,processVirtualListDirectives:()=>$7,processVirtualGridDirectives:()=>QZ,processInfiniteListDirectives:()=>XZ,generateVirtualListCSS:()=>YZ,default:()=>gq,createVirtualList:()=>e4});function e4($,Z){let{itemHeight:J,containerHeight:Y,overscan:Q=3,keyProperty:X="id",dynamicHeight:G=!1,estimatedItemHeight:K=J,direction:q="vertical"}=Z,_=[...$],W=0,z=new Map;function U(){if(G)return j();let R=Math.max(0,Math.floor(W/J)-Q),N=Math.ceil(Y/J),T=Math.min(_.length-1,R+N+Q*2);return{startIndex:R,endIndex:T}}function j(){let R=0,N=0,T=_.length-1;for(let I=0;I<_.length;I++){let M=z.get(I)||K;if(R+M>W){N=Math.max(0,I-Q);break}R+=M}R=0;for(let I=0;I<_.length;I++){let M=z.get(I)||K;if(R+=M,R>W+Y){T=Math.min(_.length-1,I+Q);break}}return{startIndex:N,endIndex:T}}function B(){if(G){let R=0;for(let N=0;N<_.length;N++)R+=z.get(N)||K;return R}return _.length*J}function O(R){if(G){let N=0;for(let T=0;T<R;T++)N+=z.get(T)||K;return N}return R*J}function F(){let{startIndex:R,endIndex:N}=U();return{startIndex:R,endIndex:N,scrollTop:W,totalHeight:B(),visibleItems:_.slice(R,N+1),itemHeights:new Map(z)}}function L(R,N="auto"){let T=O(R);H(T,N)}function H(R,N="auto"){W=Math.max(0,Math.min(R,B()-Y))}function V(){U()}function A(R){_=[...R],z.clear(),V()}function w(){_=[],z.clear()}return{scrollToIndex:L,scrollToOffset:H,getState:F,refresh:V,setItems:A,destroy:w}}function $7($,Z={},J){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(Y,(Q,X,G,K)=>{let q=X.trim(),_=Z[q];if(!_||!Array.isArray(_))return`<!-- virtualList: items "${q}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let H=G.trim(),V=Function(`return ${H}`)();W={...W,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(W.containerHeight/W.itemHeight),j=W.overscan||3,B=0,O=Math.min(_.length-1,U+j),F="";for(let H=B;H<=O&&H<_.length;H++){let V=_[H],A=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(w,R)=>{if(typeof V==="object"&&V!==null)return String(V[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(H));F+=`
8397
8402
  <div class="virtual-item ${W.itemClass||""}"
8398
8403
  style="position: absolute; top: ${H*W.itemHeight}px; height: ${W.itemHeight}px; width: 100%;"
8399
8404
  data-index="${H}">
8400
- ${N}
8405
+ ${A}
8401
8406
  </div>`}let L=_.length*W.itemHeight;return`
8402
8407
  <div id="${z}"
8403
8408
  class="virtual-list-container ${W.containerClass||""}"
@@ -8470,7 +8475,7 @@ else {
8470
8475
  };
8471
8476
  })();
8472
8477
  </script>
8473
- `})}function ZZ(){return`
8478
+ `})}function YZ(){return`
8474
8479
  .virtual-list-container {
8475
8480
  position: relative;
8476
8481
  overflow-y: auto;
@@ -8518,7 +8523,7 @@ else {
8518
8523
  0% { background-position: 200% 0; }
8519
8524
  100% { background-position: -200% 0; }
8520
8525
  }
8521
- `}function YZ($,Z){let J=null,Y=()=>{if(!J)J=e4($(),Z);return J};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let X=Q.target;if(J)J.scrollToOffset(X.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{Y().scrollToIndex(Q)}}}function JZ($,Z={},J){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(Y,(Q,X,G,K,q)=>{let _=X.trim(),W=Z[_];if(!W||!Array.isArray(W))return`<!-- infiniteList: items "${_}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();z={...z,...B}}catch{}let U=`ilist-${Math.random().toString(36).substring(2,9)}`,j=$7(`@virtualList(${_}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return j=j.replace("</script>",`
8526
+ `}function JZ($,Z){let J=null,Y=()=>{if(!J)J=e4($(),Z);return J};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let X=Q.target;if(J)J.scrollToOffset(X.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{Y().scrollToIndex(Q)}}}function XZ($,Z={},J){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(Y,(Q,X,G,K,q)=>{let _=X.trim(),W=Z[_];if(!W||!Array.isArray(W))return`<!-- infiniteList: items "${_}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();z={...z,...B}}catch{}let U=`ilist-${Math.random().toString(36).substring(2,9)}`,j=$7(`@virtualList(${_}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return j=j.replace("</script>",`
8522
8527
  // Infinite scroll detection
8523
8528
  container.addEventListener('scroll', function() {
8524
8529
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -8536,9 +8541,9 @@ else {
8536
8541
  ${q}
8537
8542
  </div>
8538
8543
  </div>
8539
- `})}function XZ($,Z={},J){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(Y,(Q,X,G,K)=>{let q=X.trim(),_=Z[q];if(!_||!Array.isArray(_))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let W={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();W={...W,...V}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(_.length/W.columns),j=U*(W.rowHeight+(W.gap||0)),B=Math.ceil(W.containerHeight/(W.rowHeight+(W.gap||0))),O=W.overscan||2,F=0,L=Math.min(U-1,B+O),H="";for(let V=F;V<=L;V++)for(let N=0;N<W.columns;N++){let w=V*W.columns+N;if(w>=_.length)break;let R=_[w],A=N*(100/W.columns),T=V*(W.rowHeight+(W.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,E)=>{if(typeof R==="object"&&R!==null)return String(R[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(w));H+=`
8544
+ `})}function QZ($,Z={},J){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(Y,(Q,X,G,K)=>{let q=X.trim(),_=Z[q];if(!_||!Array.isArray(_))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let W={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();W={...W,...V}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(_.length/W.columns),j=U*(W.rowHeight+(W.gap||0)),B=Math.ceil(W.containerHeight/(W.rowHeight+(W.gap||0))),O=W.overscan||2,F=0,L=Math.min(U-1,B+O),H="";for(let V=F;V<=L;V++)for(let A=0;A<W.columns;A++){let w=V*W.columns+A;if(w>=_.length)break;let R=_[w],N=A*(100/W.columns),T=V*(W.rowHeight+(W.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,E)=>{if(typeof R==="object"&&R!==null)return String(R[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(w));H+=`
8540
8545
  <div class="virtual-grid-item"
8541
- style="position: absolute; top: ${T}px; left: ${A}%; width: calc(${100/W.columns}% - ${W.gap||0}px); height: ${W.rowHeight}px;"
8546
+ style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/W.columns}% - ${W.gap||0}px); height: ${W.rowHeight}px;"
8542
8547
  data-index="${w}">
8543
8548
  ${I}
8544
8549
  </div>`}return`
@@ -8606,7 +8611,7 @@ else {
8606
8611
  });
8607
8612
  })();
8608
8613
  </script>
8609
- `})}var Pq;var GZ=C(()=>{Pq={createVirtualList:e4,processVirtualListDirectives:$7,processInfiniteListDirectives:JZ,processVirtualGridDirectives:XZ,generateVirtualListCSS:ZZ,useVirtualList:YZ}});function KZ(){return`<script data-stx-hydration-runtime>
8614
+ `})}var gq;var KZ=C(()=>{gq={createVirtualList:e4,processVirtualListDirectives:$7,processInfiniteListDirectives:XZ,processVirtualGridDirectives:QZ,generateVirtualListCSS:YZ,useVirtualList:JZ}});function qZ(){return`<script data-stx-hydration-runtime>
8610
8615
  (function() {
8611
8616
  'use strict';
8612
8617
 
@@ -8766,7 +8771,7 @@ else {
8766
8771
  stxIslands.initIslands();
8767
8772
  }
8768
8773
  })();
8769
- </script>`}function qZ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let J=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(J)return J[1];return null}function WZ($,Z){let J={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=Y.exec($))!==null){let X=Q[1],G=Q[2];if(G in Z)J[X]=Z[G];else J[X]=G}return J}var wZ={};r(wZ,{processStaticDirectives:()=>FZ,processPartialHydrationDirectives:()=>zZ,onHydrated:()=>LZ,isHydrated:()=>HZ,hydrateIsland:()=>BZ,hydrateByStrategy:()=>jZ,hydrateAll:()=>OZ,generatePartialHydrationCSS:()=>UZ,generateIslandManifest:()=>VZ,default:()=>uq,createIslandRegistry:()=>_Z});function _Z(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let J=$.get(Z);if(!J||J.hydrated)return;if(J.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:J.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((J)=>!J.hydrated).map((J)=>this.hydrate(J.id));await Promise.all(Z)}}}function vq($){return`
8774
+ </script>`}function WZ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let J=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(J)return J[1];return null}function _Z($,Z){let J={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=Y.exec($))!==null){let X=Q[1],G=Q[2];if(G in Z)J[X]=Z[G];else J[X]=G}return J}var AZ={};r(AZ,{processStaticDirectives:()=>VZ,processPartialHydrationDirectives:()=>UZ,onHydrated:()=>FZ,isHydrated:()=>LZ,hydrateIsland:()=>jZ,hydrateByStrategy:()=>OZ,hydrateAll:()=>HZ,generatePartialHydrationCSS:()=>BZ,generateIslandManifest:()=>wZ,default:()=>iq,createIslandRegistry:()=>zZ});function zZ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let J=$.get(Z);if(!J||J.hydrated)return;if(J.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:J.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((J)=>!J.hydrated).map((J)=>this.hydrate(J.id));await Promise.all(Z)}}}function hq($){return`
8770
8775
  <script data-hydrate="${$}">
8771
8776
  (function() {
8772
8777
  const island = document.querySelector('[data-island="${$}"]');
@@ -8777,7 +8782,7 @@ else {
8777
8782
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
8778
8783
  })();
8779
8784
  </script>
8780
- `}function xq($,Z){let J=Z.timeout||2000,Y=Z.priority||"low";return`
8785
+ `}function dq($,Z){let J=Z.timeout||2000,Y=Z.priority||"low";return`
8781
8786
  <script data-hydrate="${$}">
8782
8787
  (function() {
8783
8788
  const island = document.querySelector('[data-island="${$}"]');
@@ -8813,7 +8818,7 @@ else {
8813
8818
  }
8814
8819
  })();
8815
8820
  </script>
8816
- `}function fq($,Z){let J=Z.rootMargin||"0px",Y=Z.threshold||0;return`
8821
+ `}function mq($,Z){let J=Z.rootMargin||"0px",Y=Z.threshold||0;return`
8817
8822
  <script data-hydrate="${$}">
8818
8823
  (function() {
8819
8824
  const island = document.querySelector('[data-island="${$}"]');
@@ -8846,7 +8851,7 @@ else {
8846
8851
  }
8847
8852
  })();
8848
8853
  </script>
8849
- `}function gq($,Z){let J=Z.media||"(min-width: 768px)";return`
8854
+ `}function uq($,Z){let J=Z.media||"(min-width: 768px)";return`
8850
8855
  <script data-hydrate="${$}">
8851
8856
  (function() {
8852
8857
  const island = document.querySelector('[data-island="${$}"]');
@@ -8875,7 +8880,7 @@ else {
8875
8880
  }
8876
8881
  })();
8877
8882
  </script>
8878
- `}function hq($){return`
8883
+ `}function pq($){return`
8879
8884
  <script data-hydrate="${$}">
8880
8885
  (function() {
8881
8886
  const island = document.querySelector('[data-island="${$}"]');
@@ -8897,7 +8902,7 @@ else {
8897
8902
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
8898
8903
  })();
8899
8904
  </script>
8900
- `}function dq($,Z){let J=Z.event||"stx:activate";return`
8905
+ `}function lq($,Z){let J=Z.event||"stx:activate";return`
8901
8906
  <script data-hydrate="${$}">
8902
8907
  (function() {
8903
8908
  const island = document.querySelector('[data-island="${$}"]');
@@ -8918,9 +8923,9 @@ else {
8918
8923
  });
8919
8924
  })();
8920
8925
  </script>
8921
- `}function zZ($,Z={},J){let Y=$,Q=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(Y=d1(Y,"load",Z),Y=d1(Y,"idle",Z),Y=d1(Y,"visible",Z),Y=d1(Y,"media",Z),Y=mq(Y),Y=d1(Y,"hover",Z),Y=d1(Y,"event",Z),Q=X&&Y!==$,Q)Y+=`
8922
- `+KZ();return Y}function d1($,Z,J){let Y=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(Y,(Q,X,G)=>{let K={strategy:Z};if(X)try{let O=X.split(",").map((F)=>F.trim());for(let F of O){let[L,H]=F.split(":").map((V)=>V.trim());if(L&&H){let V=H.replace(/^['"]|['"]$/g,"");K[L]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,_=qZ(G.trim()),W=WZ(G.trim(),J),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(_)z.push(`data-component="${_}"`);let j=Object.keys(W).length>0?`
8923
- <script type="application/json" data-island-props="${q}">${JSON.stringify(W)}</script>`:"",B="";switch(Z){case"load":B=vq(q);break;case"idle":B=xq(q,K);break;case"visible":B=fq(q,K);break;case"media":B=gq(q,K);break;case"hover":B=hq(q);break;case"event":B=dq(q,K);break}return`
8926
+ `}function UZ($,Z={},J){let Y=$,Q=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(Y=m1(Y,"load",Z),Y=m1(Y,"idle",Z),Y=m1(Y,"visible",Z),Y=m1(Y,"media",Z),Y=cq(Y),Y=m1(Y,"hover",Z),Y=m1(Y,"event",Z),Q=X&&Y!==$,Q)Y+=`
8927
+ `+qZ();return Y}function m1($,Z,J){let Y=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(Y,(Q,X,G)=>{let K={strategy:Z};if(X)try{let O=X.split(",").map((F)=>F.trim());for(let F of O){let[L,H]=F.split(":").map((V)=>V.trim());if(L&&H){let V=H.replace(/^['"]|['"]$/g,"");K[L]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,_=WZ(G.trim()),W=_Z(G.trim(),J),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(_)z.push(`data-component="${_}"`);let j=Object.keys(W).length>0?`
8928
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(W)}</script>`:"",B="";switch(Z){case"load":B=hq(q);break;case"idle":B=dq(q,K);break;case"visible":B=mq(q,K);break;case"media":B=uq(q,K);break;case"hover":B=pq(q);break;case"event":B=lq(q,K);break}return`
8924
8929
  <div data-island="${q}"
8925
8930
  data-strategy="${Z}"
8926
8931
  ${z.join(`
@@ -8930,7 +8935,7 @@ else {
8930
8935
  ${G.trim()}${j}
8931
8936
  </div>
8932
8937
  ${B}
8933
- `})}function mq($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(J,Y)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
8938
+ `})}function cq($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(J,Y)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
8934
8939
  <div data-island="${Q}"
8935
8940
  data-strategy="only"
8936
8941
  class="stx-island stx-client-only">
@@ -8949,7 +8954,7 @@ else {
8949
8954
  }
8950
8955
  })();
8951
8956
  </script>
8952
- `})}function UZ(){return`
8957
+ `})}function BZ(){return`
8953
8958
  /* Island base styles */
8954
8959
  .stx-island {
8955
8960
  display: contents;
@@ -8990,11 +8995,11 @@ else {
8990
8995
  .stx-island.hydrated {
8991
8996
  opacity: 1;
8992
8997
  }
8993
- `}function BZ($){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 jZ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((J)=>{J.classList.add("hydrated"),J.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function OZ(){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 HZ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function LZ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let J=document.querySelector(`[data-island="${$}"]`);if(!J){Z();return}if(J.classList.contains("hydrated")){Z();return}J.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function FZ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,J)=>{return`<div class="stx-static">${J.trim()}</div>`})}function VZ($){let Z=$.map((J)=>({id:J.id,component:J.component,strategy:J.options.strategy,props:J.props}));return`
8998
+ `}function jZ($){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 OZ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((J)=>{J.classList.add("hydrated"),J.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function HZ(){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 LZ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function FZ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let J=document.querySelector(`[data-island="${$}"]`);if(!J){Z();return}if(J.classList.contains("hydrated")){Z();return}J.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function VZ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,J)=>{return`<div class="stx-static">${J.trim()}</div>`})}function wZ($){let Z=$.map((J)=>({id:J.id,component:J.component,strategy:J.options.strategy,props:J.props}));return`
8994
8999
  <script type="application/json" id="stx-island-manifest">
8995
9000
  ${JSON.stringify(Z)}
8996
9001
  </script>
8997
- `}var uq;var NZ=C(()=>{uq={processPartialHydrationDirectives:zZ,processStaticDirectives:FZ,generatePartialHydrationCSS:UZ,generateIslandManifest:VZ,createIslandRegistry:_Z,hydrateIsland:BZ,hydrateByStrategy:jZ,hydrateAll:OZ,isHydrated:HZ,onHydrated:LZ}});var yZ={};r(yZ,{watchMultiple:()=>IZ,watchEffect:()=>DZ,watch:()=>MZ,unref:()=>RZ,toRefs:()=>AZ,throttledComputed:()=>SZ,stxWatchMultiple:()=>IZ,stxWatchEffect:()=>DZ,stxWatch:()=>MZ,stxUnref:()=>RZ,stxToRefs:()=>AZ,stxThrottledComputed:()=>SZ,stxShallowRef:()=>TZ,stxRef:()=>m1,stxIsRef:()=>J1,stxDebouncedComputed:()=>bZ,stxComputed:()=>H5,shallowRef:()=>TZ,ref:()=>m1,processWatchDirectives:()=>kZ,processComputedDirectives:()=>EZ,isRef:()=>J1,default:()=>pq,debouncedComputed:()=>bZ,computed:()=>H5});function m1($){let Z=$,J=new Set,Y={get value(){if(u0){let Q=O5.get(Y);if(!Q)Q=new Set,O5.set(Y,Q);Q.add(u0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,J.forEach((G)=>G(Q));let X=O5.get(Y);if(X)X.forEach((G)=>G())}},subscribe(Q){return J.add(Q),()=>J.delete(Q)},peek(){return Z}};return Y}function J1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function RZ($){return J1($)?$.value:$}function AZ($){let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=m1($[J]);return Z}function TZ($){return m1($)}function H5($){let Z=typeof $==="function",J=Z?$:$.get,Y=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,X,G=!0,K=new Set,q=new Set,_=()=>{if(G=!0,q.size>0){let U=z.value;q.forEach((j)=>j(U))}};function W(){K.clear();let U=u0;u0=_,E9.push(_);try{return J()}finally{E9.pop(),u0=U}}let z={get value(){if(u0){let U=O5.get(z);if(!U)U=new Set,O5.set(z,U);U.add(u0)}if(G){let U=W();if(!Q(X,U))X=U;G=!1}return X},set value(U){if(Y)Y(U);else console.warn("Computed property is readonly")},subscribe(U){return q.add(U),()=>q.delete(U)},peek(){if(G)X=J(),G=!1;return X},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function MZ($,Z,J={}){let{immediate:Y=!1,deep:Q=!1,flush:X="pre",once:G=!1}=J,K,q=!0,_=!1,W=()=>{if(J1($))return Q?V1($.value):$.value;return $()},z=()=>{if(!q||_)return;let B=W();if(K!==void 0&&Object.is(K,B)&&!Q)return;let O=()=>{if(Z(B,K),K=Q?V1(B):B,G)j()};if(X==="sync")O();else if(X==="post")queueMicrotask(O);else Promise.resolve().then(O)},U=null;if(J1($))U=$.subscribe(()=>z());else U=H5($).subscribe(()=>z());if(Y)K=void 0,z();else K=W();let j=()=>{if(q=!1,U)U(),U=null};return j.pause=()=>{_=!0},j.resume=()=>{_=!1},j}function IZ($,Z,J={}){let{immediate:Y=!1,once:Q=!1}=J,X=$.map((z)=>J1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((U)=>J1(U)?U.value:void 0);if(Z(z,X),X=[...z],Q)W()},_=$.map((z)=>{if(J1(z))return z.subscribe(()=>q());return()=>{}});if(Y)q();let W=()=>{G=!1,_.forEach((z)=>z())};return W.pause=()=>{K=!0},W.resume=()=>{K=!1},W}function DZ($,Z={}){let{flush:J="pre"}=Z,Y,Q=!0,X=!1,G=()=>{if(!Q||X)return;if(Y)Y();let q=u0;u0=G,E9.push(G);try{Y=$()}finally{E9.pop(),u0=q}};if(J==="sync")G();else if(J==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,Y)Y()};return K.pause=()=>{X=!0},K.resume=()=>{X=!1},K}function EZ($,Z={},J){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(Y,(Q,X,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[X]=q,`<!-- computed: ${X} = ${q} -->`}catch(K){return`<!-- computed error: ${X} - ${K} -->`}})}function kZ($,Z={},J){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(Y,(Q,X,G)=>{return`
9002
+ `}var iq;var RZ=C(()=>{iq={processPartialHydrationDirectives:UZ,processStaticDirectives:VZ,generatePartialHydrationCSS:BZ,generateIslandManifest:wZ,createIslandRegistry:zZ,hydrateIsland:jZ,hydrateByStrategy:OZ,hydrateAll:HZ,isHydrated:LZ,onHydrated:FZ}});var CZ={};r(CZ,{watchMultiple:()=>DZ,watchEffect:()=>EZ,watch:()=>IZ,unref:()=>NZ,toRefs:()=>TZ,throttledComputed:()=>yZ,stxWatchMultiple:()=>DZ,stxWatchEffect:()=>EZ,stxWatch:()=>IZ,stxUnref:()=>NZ,stxToRefs:()=>TZ,stxThrottledComputed:()=>yZ,stxShallowRef:()=>MZ,stxRef:()=>u1,stxIsRef:()=>X1,stxDebouncedComputed:()=>SZ,stxComputed:()=>H5,shallowRef:()=>MZ,ref:()=>u1,processWatchDirectives:()=>bZ,processComputedDirectives:()=>kZ,isRef:()=>X1,default:()=>nq,debouncedComputed:()=>SZ,computed:()=>H5});function u1($){let Z=$,J=new Set,Y={get value(){if(u0){let Q=O5.get(Y);if(!Q)Q=new Set,O5.set(Y,Q);Q.add(u0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,J.forEach((G)=>G(Q));let X=O5.get(Y);if(X)X.forEach((G)=>G())}},subscribe(Q){return J.add(Q),()=>J.delete(Q)},peek(){return Z}};return Y}function X1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function NZ($){return X1($)?$.value:$}function TZ($){let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=u1($[J]);return Z}function MZ($){return u1($)}function H5($){let Z=typeof $==="function",J=Z?$:$.get,Y=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,X,G=!0,K=new Set,q=new Set,_=()=>{if(G=!0,q.size>0){let U=z.value;q.forEach((j)=>j(U))}};function W(){K.clear();let U=u0;u0=_,E9.push(_);try{return J()}finally{E9.pop(),u0=U}}let z={get value(){if(u0){let U=O5.get(z);if(!U)U=new Set,O5.set(z,U);U.add(u0)}if(G){let U=W();if(!Q(X,U))X=U;G=!1}return X},set value(U){if(Y)Y(U);else console.warn("Computed property is readonly")},subscribe(U){return q.add(U),()=>q.delete(U)},peek(){if(G)X=J(),G=!1;return X},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function IZ($,Z,J={}){let{immediate:Y=!1,deep:Q=!1,flush:X="pre",once:G=!1}=J,K,q=!0,_=!1,W=()=>{if(X1($))return Q?w1($.value):$.value;return $()},z=()=>{if(!q||_)return;let B=W();if(K!==void 0&&Object.is(K,B)&&!Q)return;let O=()=>{if(Z(B,K),K=Q?w1(B):B,G)j()};if(X==="sync")O();else if(X==="post")queueMicrotask(O);else Promise.resolve().then(O)},U=null;if(X1($))U=$.subscribe(()=>z());else U=H5($).subscribe(()=>z());if(Y)K=void 0,z();else K=W();let j=()=>{if(q=!1,U)U(),U=null};return j.pause=()=>{_=!0},j.resume=()=>{_=!1},j}function DZ($,Z,J={}){let{immediate:Y=!1,once:Q=!1}=J,X=$.map((z)=>X1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((U)=>X1(U)?U.value:void 0);if(Z(z,X),X=[...z],Q)W()},_=$.map((z)=>{if(X1(z))return z.subscribe(()=>q());return()=>{}});if(Y)q();let W=()=>{G=!1,_.forEach((z)=>z())};return W.pause=()=>{K=!0},W.resume=()=>{K=!1},W}function EZ($,Z={}){let{flush:J="pre"}=Z,Y,Q=!0,X=!1,G=()=>{if(!Q||X)return;if(Y)Y();let q=u0;u0=G,E9.push(G);try{Y=$()}finally{E9.pop(),u0=q}};if(J==="sync")G();else if(J==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,Y)Y()};return K.pause=()=>{X=!0},K.resume=()=>{X=!1},K}function kZ($,Z={},J){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(Y,(Q,X,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[X]=q,`<!-- computed: ${X} = ${q} -->`}catch(K){return`<!-- computed error: ${X} - ${K} -->`}})}function bZ($,Z={},J){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(Y,(Q,X,G)=>{return`
8998
9003
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
8999
9004
  (function() {
9000
9005
  // Watch implementation for ${X}
@@ -9006,9 +9011,9 @@ else {
9006
9011
  }
9007
9012
  })();
9008
9013
  </script>
9009
- `})}function V1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>V1(J));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let J=new Map;return $.forEach((Y,Q)=>J.set(V1(Q),V1(Y))),J}if($ instanceof Set){let J=new Set;return $.forEach((Y)=>J.add(V1(Y))),J}let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=V1($[J]);return Z}function bZ($,Z=100){let J=m1($()),Y=null,Q=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{J.value=$()},Z)};return H5($).subscribe(()=>Q()),{get value(){return J.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function SZ($,Z=100){let J=m1($()),Y=0,Q=()=>{let G=Date.now();if(G-Y>=Z)Y=G,J.value=$()};return H5($).subscribe(()=>Q()),{get value(){return J.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var u0=null,E9,O5,pq;var CZ=C(()=>{E9=[],O5=new WeakMap;pq={ref:m1,computed:H5,watch:MZ,watchMultiple:IZ,watchEffect:DZ,isRef:J1,unref:RZ,toRefs:AZ,shallowRef:TZ,debouncedComputed:bZ,throttledComputed:SZ,processComputedDirectives:EZ,processWatchDirectives:kZ}});var fZ={};r(fZ,{v:()=>lq,processHasErrorsDirective:()=>xZ,processFormValidationDirectives:()=>iq,processErrorsDirective:()=>vZ,processErrorDirective:()=>PZ,defineForm:()=>cq,Validator:()=>u1});class u1{rules=[];defaultValue="";addRule($){let Z=new u1;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let J=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=$||J}})}max($,Z){let J=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=$||J}})}length($,Z,J){let Y=J||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:Y,validate:(Q)=>{if(!Q)return!0;let X=String(Q).length;return X>=$&&X<=Z||Y}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(J)=>{if(!J)return!0;return $.test(String(J))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(J)=>{if(!J&&J!==0)return!0;return!Number.isNaN(Number(J))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let J=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=$||J}})}maxValue($,Z){let J=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=$||J}})}between($,Z,J){let Y=J||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:Y,validate:(Q)=>{if(!Q&&Q!==0)return!0;let X=Number(Q);return X>=$&&X<=Z||Y}})}matches($,Z){let J=Z||`Must match ${$}`;return this.addRule({name:"matches",message:J,validate:(Y,Q)=>{if(!Q)return!0;return Y===Q[$]||J}})}oneOf($,Z){let J=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:J,validate:(Y)=>{if(!Y)return!0;return $.includes(Y)||J}})}notOneOf($,Z){let J=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:J,validate:(Y)=>{if(!Y)return!0;return!$.includes(Y)||J}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let J=new Date(String(Z));return!Number.isNaN(J.getTime())||$}})}before($,Z){let J=new Date($),Y=Z||`Must be before ${J.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<J||Y}})}after($,Z){let J=new Date($),Y=Z||`Must be after ${J.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>J||Y}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let J=new u1;J.rules=[...this.rules],J.defaultValue=this.defaultValue;for(let Y of Z.getRules())J.rules.push({...Y,validate:(Q,X)=>{if(!$(Q,X||{}))return!0;return Y.validate(Q,X)}});return J}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new u1;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let J=[];for(let Y of this.rules){let Q=await Y.validate($,Z);if(Q!==!0)J.push(Q)}return J}validateSync($,Z){let J=[];for(let Y of this.rules){if(Y.async)continue;let Q=Y.validate($,Z);if(Q!==!0)J.push(Q)}return J}}function cq($,Z){let J=Object.keys($),Y={},Q={},X={},G={},K={};for(let H of J)Y[H]=Z?.[H]??$[H].getDefaultValue(),Q[H]=[],X[H]=!1,G[H]=!1,K[H]=!1;let q=!1;async function _(H){K[H]=!0;let V=await $[H].validate(Y[H],Y);return Q[H]=V,K[H]=!1,V.length===0}async function W(){q=!0;let H=await Promise.all(J.map(_));return q=!1,H.every(Boolean)}function z(){for(let H of J)Y[H]=Z?.[H]??$[H].getDefaultValue(),Q[H]=[],X[H]=!1,G[H]=!1}function U(H){for(let V of J)if(V in H)Y[V]=H[V],G[V]=!0}function j(H,V){Y[H]=V,G[H]=!0}function B(H,V=!0){if(X[H]=V,V)_(H)}function O(H){return{value:Y[H],errors:Q[H],touched:X[H],dirty:G[H],valid:Q[H].length===0,validating:K[H]}}function F(H){return async(V)=>{V?.preventDefault?.();for(let w of J)X[w]=!0;if(await W())await H(Y)}}return{values:Y,errors:Q,touched:X,dirty:G,get isValid(){return J.every((H)=>Q[H].length===0)},get isValidating(){return q||J.some((H)=>K[H])},get isDirty(){return J.some((H)=>G[H])},validate:W,validateField:_,reset:z,setValues:U,setFieldValue:j,setFieldTouched:B,getFieldState:O,handleSubmit:F}}function PZ($,Z,J){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((W)=>{return G.replace(/\{\{\s*message\s*\}\}/g,W)}).join(`
9010
- `)}catch{return""}})}function vZ($,Z,J){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((W)=>G.replace(/\{\{\s*message\s*\}\}/g,W)).join(`
9011
- `)}catch{return""}})}function xZ($,Z,J){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return G}catch{return""}})}function iq($,Z,J){let Y=$;return Y=PZ(Y,Z,J),Y=vZ(Y,Z,J),Y=xZ(Y,Z,J),Y}var lq;var gZ=C(()=>{lq=new u1});var mZ={};r(mZ,{processXElementDirectives:()=>nq,hasXElementDirectives:()=>dZ,generateXElementRuntime:()=>hZ});function hZ(){return`<script data-stx-scoped>
9014
+ `})}function w1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>w1(J));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let J=new Map;return $.forEach((Y,Q)=>J.set(w1(Q),w1(Y))),J}if($ instanceof Set){let J=new Set;return $.forEach((Y)=>J.add(w1(Y))),J}let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=w1($[J]);return Z}function SZ($,Z=100){let J=u1($()),Y=null,Q=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{J.value=$()},Z)};return H5($).subscribe(()=>Q()),{get value(){return J.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function yZ($,Z=100){let J=u1($()),Y=0,Q=()=>{let G=Date.now();if(G-Y>=Z)Y=G,J.value=$()};return H5($).subscribe(()=>Q()),{get value(){return J.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var u0=null,E9,O5,nq;var PZ=C(()=>{E9=[],O5=new WeakMap;nq={ref:u1,computed:H5,watch:IZ,watchMultiple:DZ,watchEffect:EZ,isRef:X1,unref:NZ,toRefs:TZ,shallowRef:MZ,debouncedComputed:SZ,throttledComputed:yZ,processComputedDirectives:kZ,processWatchDirectives:bZ}});var gZ={};r(gZ,{v:()=>oq,processHasErrorsDirective:()=>fZ,processFormValidationDirectives:()=>rq,processErrorsDirective:()=>xZ,processErrorDirective:()=>vZ,defineForm:()=>sq,Validator:()=>p1});class p1{rules=[];defaultValue="";addRule($){let Z=new p1;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let J=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=$||J}})}max($,Z){let J=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=$||J}})}length($,Z,J){let Y=J||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:Y,validate:(Q)=>{if(!Q)return!0;let X=String(Q).length;return X>=$&&X<=Z||Y}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(J)=>{if(!J)return!0;return $.test(String(J))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(J)=>{if(!J&&J!==0)return!0;return!Number.isNaN(Number(J))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let J=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=$||J}})}maxValue($,Z){let J=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=$||J}})}between($,Z,J){let Y=J||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:Y,validate:(Q)=>{if(!Q&&Q!==0)return!0;let X=Number(Q);return X>=$&&X<=Z||Y}})}matches($,Z){let J=Z||`Must match ${$}`;return this.addRule({name:"matches",message:J,validate:(Y,Q)=>{if(!Q)return!0;return Y===Q[$]||J}})}oneOf($,Z){let J=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:J,validate:(Y)=>{if(!Y)return!0;return $.includes(Y)||J}})}notOneOf($,Z){let J=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:J,validate:(Y)=>{if(!Y)return!0;return!$.includes(Y)||J}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let J=new Date(String(Z));return!Number.isNaN(J.getTime())||$}})}before($,Z){let J=new Date($),Y=Z||`Must be before ${J.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<J||Y}})}after($,Z){let J=new Date($),Y=Z||`Must be after ${J.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>J||Y}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let J=new p1;J.rules=[...this.rules],J.defaultValue=this.defaultValue;for(let Y of Z.getRules())J.rules.push({...Y,validate:(Q,X)=>{if(!$(Q,X||{}))return!0;return Y.validate(Q,X)}});return J}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new p1;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let J=[];for(let Y of this.rules){let Q=await Y.validate($,Z);if(Q!==!0)J.push(Q)}return J}validateSync($,Z){let J=[];for(let Y of this.rules){if(Y.async)continue;let Q=Y.validate($,Z);if(Q!==!0)J.push(Q)}return J}}function sq($,Z){let J=Object.keys($),Y={},Q={},X={},G={},K={};for(let H of J)Y[H]=Z?.[H]??$[H].getDefaultValue(),Q[H]=[],X[H]=!1,G[H]=!1,K[H]=!1;let q=!1;async function _(H){K[H]=!0;let V=await $[H].validate(Y[H],Y);return Q[H]=V,K[H]=!1,V.length===0}async function W(){q=!0;let H=await Promise.all(J.map(_));return q=!1,H.every(Boolean)}function z(){for(let H of J)Y[H]=Z?.[H]??$[H].getDefaultValue(),Q[H]=[],X[H]=!1,G[H]=!1}function U(H){for(let V of J)if(V in H)Y[V]=H[V],G[V]=!0}function j(H,V){Y[H]=V,G[H]=!0}function B(H,V=!0){if(X[H]=V,V)_(H)}function O(H){return{value:Y[H],errors:Q[H],touched:X[H],dirty:G[H],valid:Q[H].length===0,validating:K[H]}}function F(H){return async(V)=>{V?.preventDefault?.();for(let w of J)X[w]=!0;if(await W())await H(Y)}}return{values:Y,errors:Q,touched:X,dirty:G,get isValid(){return J.every((H)=>Q[H].length===0)},get isValidating(){return q||J.some((H)=>K[H])},get isDirty(){return J.some((H)=>G[H])},validate:W,validateField:_,reset:z,setValues:U,setFieldValue:j,setFieldTouched:B,getFieldState:O,handleSubmit:F}}function vZ($,Z,J){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((W)=>{return G.replace(/\{\{\s*message\s*\}\}/g,W)}).join(`
9015
+ `)}catch{return""}})}function xZ($,Z,J){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((W)=>G.replace(/\{\{\s*message\s*\}\}/g,W)).join(`
9016
+ `)}catch{return""}})}function fZ($,Z,J){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return G}catch{return""}})}function rq($,Z,J){let Y=$;return Y=vZ(Y,Z,J),Y=xZ(Y,Z,J),Y=fZ(Y,Z,J),Y}var oq;var hZ=C(()=>{oq=new p1});var uZ={};r(uZ,{processXElementDirectives:()=>aq,hasXElementDirectives:()=>mZ,generateXElementRuntime:()=>dZ});function dZ(){return`<script data-stx-scoped>
9012
9017
  (function() {
9013
9018
  'use strict';
9014
9019
 
@@ -9292,9 +9297,9 @@ else {
9292
9297
  // Expose for manual initialization
9293
9298
  window.XElement = XElement;
9294
9299
  })();
9295
- </script>`}function dZ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function nq($){if(!dZ($))return $;let Z=hZ(),J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+`
9300
+ </script>`}function mZ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function aq($){if(!mZ($))return $;let Z=dZ(),J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+`
9296
9301
  `+$.slice(J);return $+`
9297
- `+Z}var uZ=()=>{};function Z7($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var pZ=C(()=>{uZ()});var lZ={};r(lZ,{injectPwaTags:()=>oq,generateThemeColorMeta:()=>aq,generateSwRegistrationScript:()=>sq,generatePwaTags:()=>k9,generateManifestLink:()=>rq});function k9($){let Z=$.pwa;if(!Z?.enabled)return"";let J=Z.manifest,Y=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=Z7($),X=`
9302
+ `+Z}var pZ=()=>{};function Z7($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var lZ=C(()=>{pZ()});var cZ={};r(cZ,{injectPwaTags:()=>tq,generateThemeColorMeta:()=>ZW,generateSwRegistrationScript:()=>eq,generatePwaTags:()=>k9,generateManifestLink:()=>$W});function k9($){let Z=$.pwa;if(!Z?.enabled)return"";let J=Z.manifest,Y=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=Z7($),X=`
9298
9303
  <!-- stx PWA Meta Tags -->
9299
9304
  <link rel="manifest" href="/manifest.json">
9300
9305
  <meta name="theme-color" content="${Y7(J?.themeColor||"#000000")}">
@@ -9338,9 +9343,9 @@ if ('serviceWorker' in navigator) {
9338
9343
  });
9339
9344
  }
9340
9345
  </script>
9341
- <!-- End stx PWA -->`,X}function oq($,Z){let J=Z.pwa;if(!J?.enabled||J.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let X=k9(Z);return $.slice(0,Q)+X+`
9346
+ <!-- End stx PWA -->`,X}function tq($,Z){let J=Z.pwa;if(!J?.enabled||J.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let X=k9(Z);return $.slice(0,Q)+X+`
9342
9347
  `+$.slice(Q)}return $+k9(Z)}let Y=k9(Z);return $.replace("</head>",`${Y}
9343
- </head>`)}function sq($){if(!$.pwa?.enabled)return"";return`<script>
9348
+ </head>`)}function eq($){if(!$.pwa?.enabled)return"";return`<script>
9344
9349
  if ('serviceWorker' in navigator) {
9345
9350
  window.addEventListener('load', function() {
9346
9351
  navigator.serviceWorker.register('/${Z7($)}')
@@ -9352,37 +9357,37 @@ if ('serviceWorker' in navigator) {
9352
9357
  });
9353
9358
  });
9354
9359
  }
9355
- </script>`}function rq(){return'<link rel="manifest" href="/manifest.json">'}function aq($){return`<meta name="theme-color" content="${Y7($)}">`}function Y7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var cZ=C(()=>{pZ()});import D0 from"path";function tq($,Z){let J=$.length,Y=Z,Q=!0,X=[],G=(K)=>K+9<=J&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(Y<J){let K=$[Y];if(G(Y))return Y;if(K==="/"&&$[Y+1]==="/"){if(Y=$.indexOf(`
9360
+ </script>`}function $W(){return'<link rel="manifest" href="/manifest.json">'}function ZW($){return`<meta name="theme-color" content="${Y7($)}">`}function Y7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var iZ=C(()=>{lZ()});import D0 from"path";function YW($,Z){let J=$.length,Y=Z,Q=!0,X=[],G=(K)=>K+9<=J&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(Y<J){let K=$[Y];if(G(Y))return Y;if(K==="/"&&$[Y+1]==="/"){if(Y=$.indexOf(`
9356
9361
  `,Y+2),Y===-1)return-1;Y+=1,Q=!0;continue}if(K==="/"&&$[Y+1]==="*"){let q=$.indexOf("*/",Y+2);if(q===-1)return-1;Y=q+2,Q=!0;continue}if(K==="/"&&Q){let q=Y+1,_=!1;while(q<J){let W=$[q];if(W==="\\"){q+=2;continue}if(W==="[")_=!0;else if(W==="]")_=!1;else if(W==="/"&&!_){q++;break}else if(W===`
9357
9362
  `){q=-1;break}q++}if(q===-1){Y++,Q=!1;continue}while(q<J&&/[a-z]/.test($[q]))q++;Y=q,Q=!1;continue}if(K==="'"||K==='"'){let q=K;Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]===q){Y++;break}if($[Y]===`
9358
- `)break;Y++}Q=!1;continue}if(K==="`"){Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;break}if($[Y]==="$"&&$[Y+1]==="{"){X.push(!0),Y+=2,Q=!0;break}Y++}if(X.length===0)Q=!1;continue}if(K==="}"&&X.length>0){X.pop(),Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++,Q=!1;break}if($[Y]==="$"&&$[Y+1]==="{"){X.push(!0),Y+=2,Q=!0;break}Y++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;Y++}return-1}async function r0($,Z,J,Y,Q){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return $;let X=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;try{return await v7.timeAsync("template-processing",async()=>{let G=await eq($,Z,J,Y,Q);if(X)G=s4(G);if(X&&Y.autoShell&&Y.buildMode!=="compile"){let K=Y.app?.head||{},_=(Z.__stx_runtime_head||null)??s1(),W={...K,..._.title&&{title:_.title},meta:[...K.meta||[],..._.meta||[]],link:[...K.link||[],..._.link||[]],script:[...K.script||[],..._.script||[]],..._.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},..._.htmlAttrs}},..._.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},..._.bodyAttrs}}};G=e2(G,W);let z=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(z&&G.includes("<head")){let j=z[1];G=G.replace("<head>",`<head>
9359
- <meta name="stx-layout" content="${j}">`)}let U=G.match(/function (__stx_setup_\d+_\d+)\(/);if(U&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${U[1]}">`);let j=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${U[1]}"`,"i");G=G.replace(j,"$1")}}if(X)try{let{getStoreScript:K}=await Promise.resolve().then(() => (f8(),x8)),q=Y.storesDir,_=await K(q);if(_){let W=`<script data-stx-stores>${_}</script>`,z=G.indexOf("<script data-stx-scoped>");if(z!==-1){let U=G.indexOf("</script>",z+24);if(U!==-1){let j=U+9;G=G.slice(0,j)+`
9360
- `+W+G.slice(j)}}}}catch{}if(X&&Z.__stx_inject_css!==!1)G=await Q5(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof t5)throw G;let K=G instanceof Error?G.message:String(G),q=new j1(`Template processing failed: ${K}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(C0.log(q,{filePath:J,context:Z}),C$.logDetailedError(q,{filePath:J,template:$.substring(0,500)}),Y.debug)throw q;return S$.createFallbackContent("Template Processing",q)}}async function eq($,Z,J,Y,Q){let X=process.cwd(),G={...Y,partialsDir:Y.partialsDir&&!D0.isAbsolute(Y.partialsDir)?D0.resolve(X,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!D0.isAbsolute(Y.componentsDir)?D0.resolve(X,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!D0.isAbsolute(Y.layoutsDir)?D0.resolve(X,Y.layoutsDir):Y.layoutsDir},K=G,q=$;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let _="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,_),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,F)=>{return`{{ ${F} }}`}),q=s2(q),q=await y8(q,J,Q);let W={};q=K4(q,W);let z={...Z.__sections||{}},U="",j=/@nolayout\b/.test(q);if(j)q=q.replace(/@nolayout\b\s*/g,"");let B=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B)U=B[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!U&&!j&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),F=/@section\s*\(/.test(q);if(!O||F){let L="",H=D0.dirname(J),V=K.layoutsDir?D0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let w=D0.join(H,"_layout.stx");if(await i(w)){L=w;break}let R=D0.dirname(H);if(R===H||R.length<V.length)break;H=R}if(L)U=L;else if(K.layoutsDir){let N=D0.isAbsolute(K.layoutsDir)?K.layoutsDir:D0.resolve(process.cwd(),K.layoutsDir),w=D0.join(N,`${K.defaultLayout}.stx`);if(await i(w))U=w}if(U&&!F)q=`@section('content')
9363
+ `)break;Y++}Q=!1;continue}if(K==="`"){Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;break}if($[Y]==="$"&&$[Y+1]==="{"){X.push(!0),Y+=2,Q=!0;break}Y++}if(X.length===0)Q=!1;continue}if(K==="}"&&X.length>0){X.pop(),Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++,Q=!1;break}if($[Y]==="$"&&$[Y+1]==="{"){X.push(!0),Y+=2,Q=!0;break}Y++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;Y++}return-1}async function a0($,Z,J,Y,Q){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return $;let X=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;try{return await v7.timeAsync("template-processing",async()=>{let G=await JW($,Z,J,Y,Q);if(X)G=s4(G);if(X&&Y.autoShell&&Y.buildMode!=="compile"){let K=Y.app?.head||{},_=(Z.__stx_runtime_head||null)??r1(),W={...K,..._.title&&{title:_.title},meta:[...K.meta||[],..._.meta||[]],link:[...K.link||[],..._.link||[]],script:[...K.script||[],..._.script||[]],..._.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},..._.htmlAttrs}},..._.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},..._.bodyAttrs}}};G=$8(G,W);let z=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(z&&G.includes("<head")){let j=z[1];G=G.replace("<head>",`<head>
9364
+ <meta name="stx-layout" content="${j}">`)}let U=G.match(/function (__stx_setup_\d+_\d+)\(/);if(U&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${U[1]}">`);let j=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${U[1]}"`,"i");G=G.replace(j,"$1")}}if(X)try{let{getStoreScript:K}=await Promise.resolve().then(() => (g8(),f8)),q=Y.storesDir,_=await K(q);if(_){let W=`<script data-stx-stores>${_}</script>`,z=G.indexOf("<script data-stx-scoped>");if(z!==-1){let U=G.indexOf("</script>",z+24);if(U!==-1){let j=U+9;G=G.slice(0,j)+`
9365
+ `+W+G.slice(j)}}}}catch{}if(X&&Z.__stx_inject_css!==!1)G=await Q5(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof t5)throw G;let K=G instanceof Error?G.message:String(G),q=new j1(`Template processing failed: ${K}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(C0.log(q,{filePath:J,context:Z}),C$.logDetailedError(q,{filePath:J,template:$.substring(0,500)}),Y.debug)throw q;return S$.createFallbackContent("Template Processing",q)}}async function JW($,Z,J,Y,Q){let X=process.cwd(),G={...Y,partialsDir:Y.partialsDir&&!D0.isAbsolute(Y.partialsDir)?D0.resolve(X,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!D0.isAbsolute(Y.componentsDir)?D0.resolve(X,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!D0.isAbsolute(Y.layoutsDir)?D0.resolve(X,Y.layoutsDir):Y.layoutsDir},K=G,q=$;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let _="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,_),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,F)=>{return`{{ ${F} }}`}),q=r2(q),q=await C8(q,J,Q);let W={};q=K4(q,W);let z={...Z.__sections||{}},U="",j=/@nolayout\b/.test(q);if(j)q=q.replace(/@nolayout\b\s*/g,"");let B=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B)U=B[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!U&&!j&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),F=/@section\s*\(/.test(q);if(!O||F){let L="",H=D0.dirname(J),V=K.layoutsDir?D0.dirname(K.layoutsDir):process.cwd();for(let A=0;A<20;A++){let w=D0.join(H,"_layout.stx");if(await i(w)){L=w;break}let R=D0.dirname(H);if(R===H||R.length<V.length)break;H=R}if(L)U=L;else if(K.layoutsDir){let A=D0.isAbsolute(K.layoutsDir)?K.layoutsDir:D0.resolve(process.cwd(),K.layoutsDir),w=D0.join(A,`${K.defaultLayout}.stx`);if(await i(w))U=w}if(U&&!F)q=`@section('content')
9361
9366
  ${q.trim()}
9362
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,F,L)=>{return z[F]=L,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,F,L)=>{if(L.includes("@parent"))z[F]=L.replace("@parent",w1);else z[F]=L.trim();return""}),Z.__sections=z,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,F,L)=>{return z[F]||L||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return z.content||""});if(q=q4(q,W),U)try{let O=D0.isAbsolute(U)?U:await E1(()=>s9(U,J,G,Q),null,()=>{throw new j1(`Failed to resolve layout path: ${U}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!O){let w=`Layout not found: ${U} (referenced from ${J})`;if(C0.log(Error(w),{layoutPath:U,filePath:J},"warning"),G.debug)throw new j1(w,J);return q}let F=await E1(()=>Bun.file(O).text(),"",()=>{throw new j1(`Failed to read layout file: ${O}`,J,void 0,void 0,"Layout content could not be loaded")}),L=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L){if(G.debug)console.log(`Found nested layout: ${L[1]} in ${O}`);let w={},R=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,M,E)=>{return w[M]=E.trim(),""});for(let[I,M]of Object.entries(w))if(z[I]&&z[I].includes(w1)){let E=z[I].indexOf(w1);z[I]=z[I].slice(0,E)+M+z[I].slice(E+w1.length)}else if(!z[I])z[I]=M;let A={...Z,__sections:z},T=`@layout('${L[1]}')${R}`;return await r0(T,A,O,G,Q)}let H=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),V=K4(H,W),N={};return V=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(w,R,A)=>{return N[R]=A.trim(),`@slot('${R}')`}),V=V.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,R,A)=>{if(z[R]){let T=z[R];if(T.includes(w1)){let I=N[R]||"",M=T.indexOf(w1);T=T.slice(0,M)+I+T.slice(M+w1.length)}return T}return A||""}),V=V.replace(/\{\{\s*slot\s*\}\}/g,()=>{return z.content||""}),V=q4(V,W),Z.__originalFilePath=J,q=await iZ(V,Z,O,G,Q),q=`<!-- stx-layout: ${U} -->
9363
- ${q}`,q}catch(O){return C0.log(O instanceof Error?O:Error(String(O)),{layoutPath:U,filePath:J},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return await iZ(q,Z,J,G,Q)}async function iZ($,Z,J,Y,Q){let X=$;Z.__stx_sfc_mode=!0;let G=Y;if(await E1(()=>p2(J,Z),void 0,(f)=>{C0.log(f,{filePath:J,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${J}: ${f.message}`)}),Z.__stx_options=G,G.buildMode)Z.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",q={};for(let[f,d]of Object.entries(process.env))if(f.startsWith(K)&&d!==void 0)q[f]=d;Z.$env=q,X=await E1(()=>g2(X,Z,J,G),X,(f)=>{C0.log(f,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${f.message}`)});let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,W;while((W=_.exec(X))!==null){let f=W[1],d=W[2];if(/\bserver\b/.test(f)&&d.trim())try{let{extractVariables:a}=await Promise.resolve().then(() => (t1(),T5));await a(d,Z,J)}catch(a){let Y0=a instanceof Error?a:Error(String(a));C0.log(Y0,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${Y0.message}`)}}try{let{interpolateScriptsInTemplate:f}=await Promise.resolve().then(() => (o0(),y7));X=f(X,Z,{skipServer:!0})}catch(f){let d=f instanceof Error?f:Error(String(f));C0.log(d,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${d.message}`)}if(X=await y2(X,Z,J),X=await C2(X,Z,J),X=await _2(X,Z,J,G),w5(X))X=T4(X),X=M4(X,Z);X=J4(X,Z,J,G),X=await i4(X,Z,J,G,Q),X=await a2(X,Z,J,G,Q),X=U7(X,Z,J,G);let{processDeferDirectives:z}=await Promise.resolve().then(() => h8);X=z(X,Z,J);let{processTeleportDirectives:U}=await Promise.resolve().then(() => m8);X=U(X,Z,J);let{processTransitionDirectives:j,processTransitionAttributes:B}=await Promise.resolve().then(() => c8);X=j(X,Z,J),X=B(X);let{processErrorBoundaryDirectives:O}=await Promise.resolve().then(() => n8);X=O(X,Z,J);let{processSuspenseDirectives:F}=await Promise.resolve().then(() => o8);X=F(X,Z,J);let{processAsyncDirectives:L}=await Promise.resolve().then(() => t8);X=L(X,Z,J);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => $Z);X=H(X,Z,J);let{processVirtualListDirectives:V,processVirtualGridDirectives:N,processInfiniteListDirectives:w}=await Promise.resolve().then(() => (GZ(),QZ));X=V(X,Z,J),X=N(X,Z,J),X=w(X,Z,J);let{processPartialHydrationDirectives:R,processStaticDirectives:A}=await Promise.resolve().then(() => (NZ(),wZ));X=R(X,Z,J),X=A(X);let{processComputedDirectives:T,processWatchDirectives:I}=await Promise.resolve().then(() => (CZ(),yZ));X=T(X,Z,J),X=I(X,Z,J);let{processFormValidationDirectives:M}=await Promise.resolve().then(() => (gZ(),fZ));X=M(X,Z,J);let{processHeadDirective:E,processTitleDirective:k,processMetaDirective:y,resetHead:S}=await Promise.resolve().then(() => (r1(),c9));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)S();let b=E(X);if(X=b.content,X=k(X,Z),X=y(X,Z),X=m2(X),X=o$(X,Z),X=q2(X),X=x2(X),X=await G4(X,Z,J,G,Q),X=await i4(X,Z,J,G,Q),X=s4(X),X=y1(X,Z,J),X=s$(X,Z),X=r$(X,Z),X=_9(X,Z),X=O2(X,Z),X=H2(X,Z),X=await o6(X,Z,J,G),X=await X3(X,Z,J),X=await A2(X,Z,J,G),X=Q7(X,Z,J,G),X=U6(X,Z,J,G),X=B6(X,Z,J),X=j6(X,Z,J,G),X=Q2(X,Z,J,G),X=n4(X,Z),X=o4(X),X=P8(X),!G.skipEventDirectives)X=p6(X,Z,J);if(X=n6(X,Z,J),G.debug){let f=/\bx-data\s*=/.test(X),d=R9($);if(f&&d)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
9367
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,F,L)=>{return z[F]=L,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,F,L)=>{if(L.includes("@parent"))z[F]=L.replace("@parent",A1);else z[F]=L.trim();return""}),Z.__sections=z,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,F,L)=>{return z[F]||L||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return z.content||""});if(q=q4(q,W),U)try{let O=D0.isAbsolute(U)?U:await b1(()=>s9(U,J,G,Q),null,()=>{throw new j1(`Failed to resolve layout path: ${U}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!O){let w=`Layout not found: ${U} (referenced from ${J})`;if(C0.log(Error(w),{layoutPath:U,filePath:J},"warning"),G.debug)throw new j1(w,J);return q}let F=await b1(()=>Bun.file(O).text(),"",()=>{throw new j1(`Failed to read layout file: ${O}`,J,void 0,void 0,"Layout content could not be loaded")}),L=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L){if(G.debug)console.log(`Found nested layout: ${L[1]} in ${O}`);let w={},R=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,M,E)=>{return w[M]=E.trim(),""});for(let[I,M]of Object.entries(w))if(z[I]&&z[I].includes(A1)){let E=z[I].indexOf(A1);z[I]=z[I].slice(0,E)+M+z[I].slice(E+A1.length)}else if(!z[I])z[I]=M;let N={...Z,__sections:z},T=`@layout('${L[1]}')${R}`;return await a0(T,N,O,G,Q)}let H=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),V=K4(H,W),A={};return V=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(w,R,N)=>{return A[R]=N.trim(),`@slot('${R}')`}),V=V.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,R,N)=>{if(z[R]){let T=z[R];if(T.includes(A1)){let I=A[R]||"",M=T.indexOf(A1);T=T.slice(0,M)+I+T.slice(M+A1.length)}return T}return N||""}),V=V.replace(/\{\{\s*slot\s*\}\}/g,()=>{return z.content||""}),V=q4(V,W),Z.__originalFilePath=J,q=await nZ(V,Z,O,G,Q),q=`<!-- stx-layout: ${U} -->
9368
+ ${q}`,q}catch(O){return C0.log(O instanceof Error?O:Error(String(O)),{layoutPath:U,filePath:J},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return await nZ(q,Z,J,G,Q)}async function nZ($,Z,J,Y,Q){let X=$;Z.__stx_sfc_mode=!0;let G=Y;if(await b1(()=>l2(J,Z),void 0,(f)=>{C0.log(f,{filePath:J,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${J}: ${f.message}`)}),Z.__stx_options=G,G.buildMode)Z.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",q={};for(let[f,d]of Object.entries(process.env))if(f.startsWith(K)&&d!==void 0)q[f]=d;Z.$env=q,X=await b1(()=>h2(X,Z,J,G),X,(f)=>{C0.log(f,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${f.message}`)});let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,W;while((W=_.exec(X))!==null){let f=W[1],d=W[2];if(/\bserver\b/.test(f)&&d.trim())try{let{extractVariables:a}=await Promise.resolve().then(() => (t1(),T5));await a(d,Z,J)}catch(a){let Y0=a instanceof Error?a:Error(String(a));C0.log(Y0,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${Y0.message}`)}}try{let{interpolateScriptsInTemplate:f}=await Promise.resolve().then(() => (s0(),y7));X=f(X,Z,{skipServer:!0})}catch(f){let d=f instanceof Error?f:Error(String(f));C0.log(d,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${d.message}`)}if(X=await C2(X,Z,J),X=await P2(X,Z,J),X=await _2(X,Z,J,G),w5(X))X=T4(X),X=M4(X,Z);X=J4(X,Z,J,G),X=await i4(X,Z,J,G,Q),X=await t2(X,Z,J,G,Q),X=U7(X,Z,J,G);let{processDeferDirectives:z}=await Promise.resolve().then(() => d8);X=z(X,Z,J);let{processTeleportDirectives:U}=await Promise.resolve().then(() => u8);X=U(X,Z,J);let{processTransitionDirectives:j,processTransitionAttributes:B}=await Promise.resolve().then(() => i8);X=j(X,Z,J),X=B(X);let{processErrorBoundaryDirectives:O}=await Promise.resolve().then(() => o8);X=O(X,Z,J);let{processSuspenseDirectives:F}=await Promise.resolve().then(() => s8);X=F(X,Z,J);let{processAsyncDirectives:L}=await Promise.resolve().then(() => e8);X=L(X,Z,J);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => ZZ);X=H(X,Z,J);let{processVirtualListDirectives:V,processVirtualGridDirectives:A,processInfiniteListDirectives:w}=await Promise.resolve().then(() => (KZ(),GZ));X=V(X,Z,J),X=A(X,Z,J),X=w(X,Z,J);let{processPartialHydrationDirectives:R,processStaticDirectives:N}=await Promise.resolve().then(() => (RZ(),AZ));X=R(X,Z,J),X=N(X);let{processComputedDirectives:T,processWatchDirectives:I}=await Promise.resolve().then(() => (PZ(),CZ));X=T(X,Z,J),X=I(X,Z,J);let{processFormValidationDirectives:M}=await Promise.resolve().then(() => (hZ(),gZ));X=M(X,Z,J);let{processHeadDirective:E,processTitleDirective:k,processMetaDirective:y,resetHead:S}=await Promise.resolve().then(() => (a1(),c9));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)S();let b=E(X);if(X=b.content,X=k(X,Z),X=y(X,Z),X=u2(X),X=o$(X,Z),X=q2(X),X=f2(X),X=await G4(X,Z,J,G,Q),X=await i4(X,Z,J,G,Q),X=s4(X),X=L1(X,Z,J),X=s$(X,Z),X=r$(X,Z),X=_9(X,Z),X=O2(X,Z),X=H2(X,Z),X=await o6(X,Z,J,G),X=await X3(X,Z,J),X=await N2(X,Z,J,G),X=Q7(X,Z,J,G),X=U6(X,Z,J,G),X=B6(X,Z,J),X=j6(X,Z,J,G),X=Q2(X,Z,J,G),X=n4(X,Z),X=o4(X),X=v8(X),!G.skipEventDirectives)X=p6(X,Z,J);if(X=n6(X,Z,J),G.debug){let f=/\bx-data\s*=/.test(X),d=R9($);if(f&&d)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
9364
9369
  Both work on the same page, but they manage separate scopes.
9365
- Prefer signals (state/derived/effect) for new components.`)}X=i2(X,Z),X=await q1(X,Z,J),X=v8(X),X=P6(X);let{processXElementDirectives:D}=await Promise.resolve().then(() => mZ);if(X=D(X),X=await I4(X,G,J),X=await h2(X,Z,J,G),G.seo?.enabled)X=O6(X,Z,G);let{renderHead:x,getHead:h}=await Promise.resolve().then(() => (r1(),c9)),l=Z.__stx_runtime_head,U0=l&&(l.title||l.meta?.length||l.link?.length)?l:h();if(U0.title||U0.meta?.length||U0.link?.length){let f=x(U0);if(f){if(X.includes("</head>"))X=X.replace("</head>",`${f}
9370
+ Prefer signals (state/derived/effect) for new components.`)}X=n2(X,Z),X=await o0(X,Z,J),X=x8(X),X=P6(X);let{processXElementDirectives:D}=await Promise.resolve().then(() => uZ);if(X=D(X),X=await I4(X,G,J),X=await d2(X,Z,J,G),G.seo?.enabled)X=O6(X,Z,G);let{renderHead:x,getHead:h}=await Promise.resolve().then(() => (a1(),c9)),l=Z.__stx_runtime_head,U0=l&&(l.title||l.meta?.length||l.link?.length)?l:h();if(U0.title||U0.meta?.length||U0.link?.length){let f=x(U0);if(f){if(X.includes("</head>"))X=X.replace("</head>",`${f}
9366
9371
  </head>`);else if(X.includes("<head>"))X=X.replace("<head>",`<head>
9367
9372
  ${f}`)}}if(b.headContent){if(X.includes("</head>"))X=X.replace("</head>",`${b.headContent}
9368
9373
  </head>`);else if(X.includes("<head>"))X=X.replace("<head>",`<head>
9369
- ${b.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)X=X2(X,G.csp,Z);if(G.analytics?.enabled)X=x6(X,G);if(G.heatmap?.enabled)X=L7(X,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:f}=await Promise.resolve().then(() => (cZ(),lZ));X=f(X,G)}let M0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),_0=/\bSTX\.\w+/.test(X),S0=/window\.STX\s*=/.test(X);if(M0&&_0&&!S0){let d=`<script data-stx-scoped>
9374
+ ${b.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)X=X2(X,G.csp,Z);if(G.analytics?.enabled)X=x6(X,G);if(G.heatmap?.enabled)X=L7(X,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:f}=await Promise.resolve().then(() => (iZ(),cZ));X=f(X,G)}let M0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),_0=/\bSTX\.\w+/.test(X),S0=/window\.STX\s*=/.test(X);if(M0&&_0&&!S0){let d=`<script data-stx-scoped>
9370
9375
  ${b6()}
9371
- </script>`;if(X.includes("</head>")){let W0=X.indexOf("</head>"),Y0=X.slice(0,W0).indexOf("<script");if(Y0!==-1){let w0=X.slice(0,Y0),N1=X.slice(Y0);X=w0+d+`
9372
- `+N1}else X=X.replace("</head>",`${d}
9376
+ </script>`;if(X.includes("</head>")){let W0=X.indexOf("</head>"),Y0=X.slice(0,W0).indexOf("<script");if(Y0!==-1){let w0=X.slice(0,Y0),R1=X.slice(Y0);X=w0+d+`
9377
+ `+R1}else X=X.replace("</head>",`${d}
9373
9378
  </head>`)}else if(X.includes("<body"))X=X.replace(/<body([^>]*)>/,`<body$1>
9374
9379
  ${d}`);else X=d+`
9375
- `+X}{let f=/<script\s+server\b[^>]*>/gi,d,W0=[];while((d=f.exec(X))!==null){let a=d.index+d[0].length,Y0=tq(X,a);if(Y0===-1)continue;let w0=Y0+9;while(w0<X.length&&/\s/.test(X[w0]))w0++;W0.push({start:d.index,end:w0})}for(let a=W0.length-1;a>=0;a--){let{start:Y0,end:w0}=W0[a];X=X.substring(0,Y0)+X.substring(w0)}}let v0=N5(X,J);if(v0.hasScoped)X=v0.html;let L0=Z.__stx_event_bindings||[],P=!1,v=[],g=/\s:[a-z][\w.-]*\s*=/.test(X),{scanScriptTags:c}=await Promise.resolve().then(() => (D4(),_8));for(let f of c(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))v.push({match:f.fullMatch,attrs:f.attrs,content:f.body});for(let{match:f,attrs:d,content:W0}of v){P=!0;let a=W0;a4(W0,J,Y.strict);let Y0=await L5(W0,{eventBindings:L0,attrs:d,hasColonDirectives:g,templateContent:$,filePath:J,projectRoot:process.cwd(),production:Y.buildMode==="compile"});X=X.replace(f,()=>Y0)}if(P)Z.__stx_event_bindings=[];return X}var w1="<!--PARENT_CONTENT_PLACEHOLDER-->";var r9=C(()=>{J9();C9();S6();v6();f6();x9();P9();l6();h9();s6();K9();G2();W2();U2();c0();r1();o0();L2();T2();S2();v2();X4();a9();d2();M1();u2();P$();F0();l2();n2();r2();t2();l9();D4();k8();C8();r4();t4();r4();t4()});import j0 from"fs";import Z0 from"path";import{matchRoute as FW,Router as GY}from"stx-router";import{findErrorPage as NW,formatRoutes as RW,generateRouteManifest as AW,generateRouteTypes as TW,matchRoute as MW}from"stx-router";function y9($,Z={}){return new GY($,Z).routes}r9();J5();J9();import{abortNavigation as gH,clearMiddleware as nZ,createClientCookieManager as hH,createMiddlewareContext as oZ,createRouteLocation as sZ,createServerCookieManager as dH,createStorageManager as mH,defineMiddleware as uH,getMiddleware as pH,getMiddlewareNames as rZ,hasMiddleware as lH,loadMiddlewareFromDirectory as aZ,navigateTo as cH,registerMiddleware as iH,runMiddleware as tZ}from"stx-router";class eZ{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=Z0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[J,Y]of Object.entries(Z))this.cache.set(J,Y)}catch{}this.loaded=!0}async save(){await j0.promises.mkdir(this.cacheDir,{recursive:!0});let $=Z0.join(this.cacheDir,"build-cache.json"),Z={};for(let[J,Y]of this.cache)Z[J]=Y;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let J=j0.statSync($),Y=`${$}:${J.mtimeMs}`;for(let X of Z)if(j0.existsSync(X)){let G=j0.statSync(X);Y+=`:${X}:${G.mtimeMs}`}let Q=0;for(let X=0;X<Y.length;X++){let G=Y.charCodeAt(X);Q=(Q<<5)-Q+G,Q=Q&Q}return Math.abs(Q).toString(36)}get($,Z,J){let Y=this.cache.get($);if(!Y)return null;let Q=this.getHash(Z,J);if(Y.hash!==Q)return this.cache.delete($),null;return Y.html}set($,Z,J,Y){let Q=this.getHash(Z,J);this.cache.set($,{hash:Q,html:Y,generatedAt:Date.now(),dependencies:J})}}class $Y{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return Z0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let J=this.getFilePath($);await j0.promises.mkdir(Z0.dirname(J),{recursive:!0}),await Bun.write(J,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await j0.promises.unlink(Z)}async invalidatePattern($){let Z=Z0.join(this.cacheDir,"isr");if(!j0.existsSync(Z))return;let J=await j0.promises.readdir(Z);for(let Y of J){let Q=Y.replace(/_/g,"/").replace(".json","");if($.test(Q))await j0.promises.unlink(Z0.join(Z,Y))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function $W($){try{let J=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let Y=J[1];if(!Y.includes("getStaticPaths"))return null;let Q=Y.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!Q)return null;return await Function(`
9380
+ `+X}{let f=/<script\s+server\b[^>]*>/gi,d,W0=[];while((d=f.exec(X))!==null){let a=d.index+d[0].length,Y0=YW(X,a);if(Y0===-1)continue;let w0=Y0+9;while(w0<X.length&&/\s/.test(X[w0]))w0++;W0.push({start:d.index,end:w0})}for(let a=W0.length-1;a>=0;a--){let{start:Y0,end:w0}=W0[a];X=X.substring(0,Y0)+X.substring(w0)}}let v0=A5(X,J);if(v0.hasScoped)X=v0.html;let L0=Z.__stx_event_bindings||[],P=!1,v=[],g=/\s:[a-z][\w.-]*\s*=/.test(X),{scanScriptTags:c}=await Promise.resolve().then(() => (D4(),z8));for(let f of c(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))v.push({match:f.fullMatch,attrs:f.attrs,content:f.body});for(let{match:f,attrs:d,content:W0}of v){P=!0;let a=W0;a4(W0,J,Y.strict);let Y0=await L5(W0,{eventBindings:L0,attrs:d,hasColonDirectives:g,templateContent:$,filePath:J,projectRoot:process.cwd(),production:Y.buildMode==="compile"});X=X.replace(f,()=>Y0)}if(P)Z.__stx_event_bindings=[];return X}var A1="<!--PARENT_CONTENT_PLACEHOLDER-->";var r9=C(()=>{J9();C9();S6();v6();f6();x9();P9();l6();h9();s6();K9();G2();W2();U2();c0();a1();s0();L2();T2();y2();x2();X4();a9();m2();I1();p2();P$();F0();c2();o2();a2();e2();l9();D4();b8();P8();r4();t4();r4();t4()});import j0 from"fs";import Z0 from"path";import{matchRoute as RW,Router as KY}from"stx-router";import{findErrorPage as MW,formatRoutes as IW,generateRouteManifest as DW,generateRouteTypes as EW,matchRoute as kW}from"stx-router";function y9($,Z={}){return new KY($,Z).routes}r9();J5();J9();import{abortNavigation as uH,clearMiddleware as oZ,createClientCookieManager as pH,createMiddlewareContext as sZ,createRouteLocation as rZ,createServerCookieManager as lH,createStorageManager as cH,defineMiddleware as iH,getMiddleware as nH,getMiddlewareNames as aZ,hasMiddleware as oH,loadMiddlewareFromDirectory as tZ,navigateTo as sH,registerMiddleware as rH,runMiddleware as eZ}from"stx-router";class $Y{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=Z0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[J,Y]of Object.entries(Z))this.cache.set(J,Y)}catch{}this.loaded=!0}async save(){await j0.promises.mkdir(this.cacheDir,{recursive:!0});let $=Z0.join(this.cacheDir,"build-cache.json"),Z={};for(let[J,Y]of this.cache)Z[J]=Y;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let J=j0.statSync($),Y=`${$}:${J.mtimeMs}`;for(let X of Z)if(j0.existsSync(X)){let G=j0.statSync(X);Y+=`:${X}:${G.mtimeMs}`}let Q=0;for(let X=0;X<Y.length;X++){let G=Y.charCodeAt(X);Q=(Q<<5)-Q+G,Q=Q&Q}return Math.abs(Q).toString(36)}get($,Z,J){let Y=this.cache.get($);if(!Y)return null;let Q=this.getHash(Z,J);if(Y.hash!==Q)return this.cache.delete($),null;return Y.html}set($,Z,J,Y){let Q=this.getHash(Z,J);this.cache.set($,{hash:Q,html:Y,generatedAt:Date.now(),dependencies:J})}}class ZY{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return Z0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let J=this.getFilePath($);await j0.promises.mkdir(Z0.dirname(J),{recursive:!0}),await Bun.write(J,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await j0.promises.unlink(Z)}async invalidatePattern($){let Z=Z0.join(this.cacheDir,"isr");if(!j0.existsSync(Z))return;let J=await j0.promises.readdir(Z);for(let Y of J){let Q=Y.replace(/_/g,"/").replace(".json","");if($.test(Q))await j0.promises.unlink(Z0.join(Z,Y))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function XW($){try{let J=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let Y=J[1];if(!Y.includes("getStaticPaths"))return null;let Q=Y.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!Q)return null;return await Function(`
9376
9381
  return (async function getStaticPaths() {
9377
9382
  ${Q[1]}
9378
9383
  })()
9379
- `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function ZW($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let J=await $W($.filePath);if(!J||J.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let Y of J.paths){let Q=$.pattern;for(let[X,G]of Object.entries(Y.params))Q=Q.replace(`:${X}`,G).replace(`:${X}*`,G);Z.push({url:Q,params:Y.params,props:Y.props,revalidate:Y.revalidate})}}return Z}async function YW($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let J of Z)if(await Bun.file(J).exists())try{let Y=await import(J);if(typeof Y.default==="function")return await Y.default();else if(typeof Y.default==="object")return Y.default;else if(typeof Y.getData==="function")return await Y.getData();else{let{default:Q,...X}=Y;return X}}catch(Y){console.error(`Error loading data file ${J}:`,Y)}return null}async function JW($,Z,J){let Y=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let Q=Y[1];if(!Q.includes("getStaticProps"))return null;try{let X=Q.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!X)return null;return await Function("params",`
9384
+ `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function QW($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let J=await XW($.filePath);if(!J||J.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let Y of J.paths){let Q=$.pattern;for(let[X,G]of Object.entries(Y.params))Q=Q.replace(`:${X}`,G).replace(`:${X}*`,G);Z.push({url:Q,params:Y.params,props:Y.props,revalidate:Y.revalidate})}}return Z}async function GW($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let J of Z)if(await Bun.file(J).exists())try{let Y=await import(J);if(typeof Y.default==="function")return await Y.default();else if(typeof Y.default==="object")return Y.default;else if(typeof Y.getData==="function")return await Y.getData();else{let{default:Q,...X}=Y;return X}}catch(Y){console.error(`Error loading data file ${J}:`,Y)}return null}async function KW($,Z,J){let Y=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let Q=Y[1];if(!Q.includes("getStaticProps"))return null;try{let X=Q.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!X)return null;return await Function("params",`
9380
9385
  return (async function getStaticProps() {
9381
9386
  ${X[1]}
9382
9387
  })()
9383
- `)(Z)}catch(X){return console.error(`Error executing getStaticProps in ${J}:`,X),null}}async function ZY($,Z,J={},Y,Q){let X=await Bun.file($.filePath).text(),G=await YW($.filePath),K=await JW(X,Z,$.filePath),q={...G||{},...K||{},...J,params:Z,$route:{path:$.pattern,params:Z}},_=new Set,W={...Q,debug:!1,cache:!1,autoShell:!0},z=await r0(X,q,$.filePath,W,_);if(Object.keys(Z).length>0){let U=`<script>if(window.stx)window.stx._rp=${JSON.stringify(Z)};else window.__stx_rp=${JSON.stringify(Z)};</script>`;if(z.includes("</head>"))z=z.replace("</head>",`${U}
9388
+ `)(Z)}catch(X){return console.error(`Error executing getStaticProps in ${J}:`,X),null}}async function YY($,Z,J={},Y,Q){let X=await Bun.file($.filePath).text(),G=await GW($.filePath),K=await KW(X,Z,$.filePath),q={...G||{},...K||{},...J,params:Z,$route:{path:$.pattern,params:Z}},_=new Set,W={...Q,debug:!1,cache:!1,autoShell:!0},z=await a0(X,q,$.filePath,W,_);if(Object.keys(Z).length>0){let U=`<script>if(window.stx)window.stx._rp=${JSON.stringify(Z)};else window.__stx_rp=${JSON.stringify(Z)};</script>`;if(z.includes("</head>"))z=z.replace("</head>",`${U}
9384
9389
  </head>`);else z=`${U}
9385
- ${z}`}if(z=await A4(z),z=await Q5(z),Y.minify!==!1)return XW(z);return z}function XW($){let Z=[],J=0,Y=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,Q;while((Q=Y.exec($))!==null){let G=$.slice(J,Q.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=Q[1],q=Q[2],_=Q[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+q+_),J=Q.index+Q[0].length}let X=$.slice(J);return Z.push(X.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function QW($){let Z=0;for(let J=0;J<$.length;J++){let Y=$.charCodeAt(J);Z=(Z<<5)-Z+Y,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function GW($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
9390
+ ${z}`}if(z=await N4(z),z=await Q5(z),Y.minify!==!1)return qW(z);return z}function qW($){let Z=[],J=0,Y=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,Q;while((Q=Y.exec($))!==null){let G=$.slice(J,Q.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=Q[1],q=Q[2],_=Q[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+q+_),J=Q.index+Q[0].length}let X=$.slice(J);return Z.push(X.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function WW($){let Z=0;for(let J=0;J<$.length;J++){let Y=$.charCodeAt(J);Z=(Z<<5)-Z+Y,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function _W($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
9386
9391
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
9387
9392
  ${$.map((Y)=>{let Q=new URL(Y.loc,Z).href,X=` <url>
9388
9393
  <loc>${P0(Q)}</loc>`;if(Y.lastmod)X+=`
@@ -9391,7 +9396,7 @@ ${$.map((Y)=>{let Q=new URL(Y.loc,Z).href,X=` <url>
9391
9396
  <priority>${Y.priority}</priority>`;return X+=`
9392
9397
  </url>`,X}).join(`
9393
9398
  `)}
9394
- </urlset>`}function P0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function KW($,Z){let J=Z.map((Y)=>{let Q=" <item>";if(Q+=`
9399
+ </urlset>`}function P0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function zW($,Z){let J=Z.map((Y)=>{let Q=" <item>";if(Q+=`
9395
9400
  <title>${P0(Y.title)}</title>`,Q+=`
9396
9401
  <link>${P0(Y.link)}</link>`,Y.description)Q+=`
9397
9402
  <description>${P0(Y.description)}</description>`;if(Y.pubDate)Q+=`
@@ -9412,10 +9417,10 @@ ${$.map((Y)=>{let Q=new URL(Y.loc,Z).href,X=` <url>
9412
9417
  ${J.join(`
9413
9418
  `)}
9414
9419
  </channel>
9415
- </rss>`}async function qW($={}){let Z=Date.now(),J=await O1(),Y={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||".stx/ssg-cache",contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0},Q={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]};await Y.hooks.onBuildStart?.();try{if(Y.cleanOutput&&j0.existsSync(Y.outputDir))await j0.promises.rm(Y.outputDir,{recursive:!0});await j0.promises.mkdir(Y.outputDir,{recursive:!0});let X=new eZ(Y.cacheDir);if(Y.cache)await X.load();try{let{preloadIconCollection:B}=await Promise.resolve().then(() => (I9(),N8));await B("lucide")}catch{}try{let{generateCrosswindCSS:B}=await Promise.resolve().then(() => (J9(),k6));await B('<div class="bg-black"></div>')}catch{}nZ();let G=J?.routeMiddleware?.dir||"middleware";await aZ(process.cwd(),G);let K=rZ();if(K.length>0)console.log(`Loaded ${K.length} middleware: ${K.join(", ")}`);let q=J?.routeMiddleware?.global||[],_=y9(".",{pagesDir:Y.pagesDir});console.log(`Found ${_.length} routes`);let W=[];for(let B of _){let O=await ZW(B);for(let F of O)W.push({route:B,url:F.url,params:F.params,props:F.props,revalidate:F.revalidate??Y.revalidate})}Q.totalPages=W.length,console.log(`Generating ${Q.totalPages} pages...`);let z=[],U=[];for(let B=0;B<W.length;B+=Y.concurrency)U.push(W.slice(B,B+Y.concurrency));for(let B of U)await Promise.all(B.map(async(O)=>{let{route:F,url:L,params:H,props:V,revalidate:N}=O;try{await Y.hooks.onPageStart?.(L);let w=await Bun.file(F.filePath).text(),R=UW(w),A=R?.middleware?Array.isArray(R.middleware)?R.middleware:[R.middleware]:[],T=[...q,...A];if(T.length>0){let S=sZ(L,H,R||{}),b=oZ(S,null),D=await tZ(T,b);if(D.redirect){let x=typeof D.redirect==="string"?D.redirect:D.redirect.path||D.redirect,h=BW(String(x),L),l=jW(L,Y);await j0.promises.mkdir(Z0.dirname(l),{recursive:!0}),await Bun.write(l,h),Q.successCount++,Q.pages.push({route:L,outputPath:l,size:Buffer.byteLength(h),cached:!1}),z.push({loc:L,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${L} \u2192 redirect to ${x}`);return}if(D.abort){let x=typeof D.abort==="string"?D.abort:D.abort?.error?.message||"aborted";console.warn(` \u21B3 ${L} \u2014 middleware aborted: ${x}`);return}}let I=w.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(I)try{if(!await Function("route",`
9420
+ </rss>`}async function UW($={}){let Z=Date.now(),J=await O1(),Y={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||".stx/ssg-cache",contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0},Q={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]};await Y.hooks.onBuildStart?.();try{if(Y.cleanOutput&&j0.existsSync(Y.outputDir))await j0.promises.rm(Y.outputDir,{recursive:!0});await j0.promises.mkdir(Y.outputDir,{recursive:!0});let X=new $Y(Y.cacheDir);if(Y.cache)await X.load();try{let{preloadIconCollection:B}=await Promise.resolve().then(() => (I9(),R8));await B("lucide")}catch{}try{let{generateCrosswindCSS:B}=await Promise.resolve().then(() => (J9(),k6));await B('<div class="bg-black"></div>')}catch{}oZ();let G=J?.routeMiddleware?.dir||"middleware";await tZ(process.cwd(),G);let K=aZ();if(K.length>0)console.log(`Loaded ${K.length} middleware: ${K.join(", ")}`);let q=J?.routeMiddleware?.global||[],_=y9(".",{pagesDir:Y.pagesDir});console.log(`Found ${_.length} routes`);let W=[];for(let B of _){let O=await QW(B);for(let F of O)W.push({route:B,url:F.url,params:F.params,props:F.props,revalidate:F.revalidate??Y.revalidate})}Q.totalPages=W.length,console.log(`Generating ${Q.totalPages} pages...`);let z=[],U=[];for(let B=0;B<W.length;B+=Y.concurrency)U.push(W.slice(B,B+Y.concurrency));for(let B of U)await Promise.all(B.map(async(O)=>{let{route:F,url:L,params:H,props:V,revalidate:A}=O;try{await Y.hooks.onPageStart?.(L);let w=await Bun.file(F.filePath).text(),R=HW(w),N=R?.middleware?Array.isArray(R.middleware)?R.middleware:[R.middleware]:[],T=[...q,...N];if(T.length>0){let S=rZ(L,H,R||{}),b=sZ(S,null),D=await eZ(T,b);if(D.redirect){let x=typeof D.redirect==="string"?D.redirect:D.redirect.path||D.redirect,h=LW(String(x),L),l=FW(L,Y);await j0.promises.mkdir(Z0.dirname(l),{recursive:!0}),await Bun.write(l,h),Q.successCount++,Q.pages.push({route:L,outputPath:l,size:Buffer.byteLength(h),cached:!1}),z.push({loc:L,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${L} \u2192 redirect to ${x}`);return}if(D.abort){let x=typeof D.abort==="string"?D.abort:D.abort?.error?.message||"aborted";console.warn(` \u21B3 ${L} \u2014 middleware aborted: ${x}`);return}}let I=w.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(I)try{if(!await Function("route",`
9416
9421
  const validate = ${I[1]};
9417
9422
  return validate(route);
9418
- `)({params:H})){console.warn(`Validation failed for ${L}, skipping...`);return}}catch{}let M=null,E=!1;if(Y.cache){if(M=X.get(L,F.filePath,[]),M)E=!0,Q.cachedCount++}if(!M){if(M=await ZY(F,H,V,Y,J),Y.cache)X.set(L,F.filePath,[],M)}let k;if(Y.trailingSlash)k=Z0.join(Y.outputDir,L,"index.html");else k=L==="/"?Z0.join(Y.outputDir,"index.html"):Z0.join(Y.outputDir,`${L}.html`);await j0.promises.mkdir(Z0.dirname(k),{recursive:!0}),await Bun.write(k,M),z.push({loc:L,lastmod:new Date().toISOString().split("T")[0],priority:L==="/"?1:0.8});let y={route:L,outputPath:k,size:Buffer.byteLength(M,"utf8"),cached:E};if(N!==!1)y.revalidateAt=Date.now()+N*1000;Q.pages.push(y),Q.successCount++,await Y.hooks.onPageEnd?.(L,M)}catch(w){Q.failedCount++,Q.errors.push({route:L,error:w}),await Y.hooks.onError?.(w,L),console.error(`Error generating ${L}:`,w)}}));if(Y.cache)await X.save();if(Y.generate404){let B=Z0.join(Y.pagesDir,"404.stx");if(await Bun.file(B).exists()){let O=new Set,F={...J,debug:!1,cache:!1},L=await r0(await Bun.file(B).text(),{},B,F,O);await Bun.write(Z0.join(Y.outputDir,"404.html"),L)}else await Bun.write(Z0.join(Y.outputDir,"404.html"),`<!DOCTYPE html>
9423
+ `)({params:H})){console.warn(`Validation failed for ${L}, skipping...`);return}}catch{}let M=null,E=!1;if(Y.cache){if(M=X.get(L,F.filePath,[]),M)E=!0,Q.cachedCount++}if(!M){if(M=await YY(F,H,V,Y,J),Y.cache)X.set(L,F.filePath,[],M)}let k;if(Y.trailingSlash)k=Z0.join(Y.outputDir,L,"index.html");else k=L==="/"?Z0.join(Y.outputDir,"index.html"):Z0.join(Y.outputDir,`${L}.html`);await j0.promises.mkdir(Z0.dirname(k),{recursive:!0}),await Bun.write(k,M),z.push({loc:L,lastmod:new Date().toISOString().split("T")[0],priority:L==="/"?1:0.8});let y={route:L,outputPath:k,size:Buffer.byteLength(M,"utf8"),cached:E};if(A!==!1)y.revalidateAt=Date.now()+A*1000;Q.pages.push(y),Q.successCount++,await Y.hooks.onPageEnd?.(L,M)}catch(w){Q.failedCount++,Q.errors.push({route:L,error:w}),await Y.hooks.onError?.(w,L),console.error(`Error generating ${L}:`,w)}}));if(Y.cache)await X.save();if(Y.generate404){let B=Z0.join(Y.pagesDir,"404.stx");if(await Bun.file(B).exists()){let O=new Set,F={...J,debug:!1,cache:!1},L=await a0(await Bun.file(B).text(),{},B,F,O);await Bun.write(Z0.join(Y.outputDir,"404.html"),L)}else await Bun.write(Z0.join(Y.outputDir,"404.html"),`<!DOCTYPE html>
9419
9424
  <html lang="en">
9420
9425
  <head>
9421
9426
  <meta charset="UTF-8">
@@ -9436,15 +9441,15 @@ ${J.join(`
9436
9441
  <a href="/">Go home</a>
9437
9442
  </div>
9438
9443
  </body>
9439
- </html>`)}for(let B of[500]){let O=Z0.join(Y.pagesDir,`${B}.stx`);if(await Bun.file(O).exists()){let F=new Set,L={...J,debug:!1,cache:!1},H=await r0(await Bun.file(O).text(),{},O,L,F);await Bun.write(Z0.join(Y.outputDir,`${B}.html`),H)}}let j=Z0.join(Y.pagesDir,"error.stx");if(await Bun.file(j).exists()){let B=new Set,O={...J,debug:!1,cache:!1},F=await r0(await Bun.file(j).text(),{},j,O,B);await Bun.write(Z0.join(Y.outputDir,"error.html"),F)}if(Y.sitemap&&z.length>0){let B=GW(z,Y.domain),O=Z0.join(Y.outputDir,"sitemap.xml");await Bun.write(O,B),Q.sitemapPath=O,console.log(`Generated sitemap.xml with ${z.length} URLs`)}if(Y.rss){let B=typeof Y.rss==="object"?Y.rss:{title:"Site Feed",description:"Latest updates",link:Y.domain},O=[];if(B.getItems)O=await B.getItems();let F=KW(B,O),L=Z0.join(Y.outputDir,"rss.xml");await Bun.write(L,F),Q.rssPath=L,console.log(`Generated rss.xml with ${O.length} items`)}if(Y.publicDir&&j0.existsSync(Y.publicDir))await YY(Y.publicDir,Y.outputDir),console.log(`Copied public assets from ${Y.publicDir}`)}catch(X){throw await Y.hooks.onError?.(X),X}return Q.buildTime=Date.now()-Z,await Y.hooks.onBuildEnd?.(Q),console.log(`
9444
+ </html>`)}for(let B of[500]){let O=Z0.join(Y.pagesDir,`${B}.stx`);if(await Bun.file(O).exists()){let F=new Set,L={...J,debug:!1,cache:!1},H=await a0(await Bun.file(O).text(),{},O,L,F);await Bun.write(Z0.join(Y.outputDir,`${B}.html`),H)}}let j=Z0.join(Y.pagesDir,"error.stx");if(await Bun.file(j).exists()){let B=new Set,O={...J,debug:!1,cache:!1},F=await a0(await Bun.file(j).text(),{},j,O,B);await Bun.write(Z0.join(Y.outputDir,"error.html"),F)}if(Y.sitemap&&z.length>0){let B=_W(z,Y.domain),O=Z0.join(Y.outputDir,"sitemap.xml");await Bun.write(O,B),Q.sitemapPath=O,console.log(`Generated sitemap.xml with ${z.length} URLs`)}if(Y.rss){let B=typeof Y.rss==="object"?Y.rss:{title:"Site Feed",description:"Latest updates",link:Y.domain},O=[];if(B.getItems)O=await B.getItems();let F=zW(B,O),L=Z0.join(Y.outputDir,"rss.xml");await Bun.write(L,F),Q.rssPath=L,console.log(`Generated rss.xml with ${O.length} items`)}if(Y.publicDir&&j0.existsSync(Y.publicDir))await JY(Y.publicDir,Y.outputDir),console.log(`Copied public assets from ${Y.publicDir}`)}catch(X){throw await Y.hooks.onError?.(X),X}return Q.buildTime=Date.now()-Z,await Y.hooks.onBuildEnd?.(Q),console.log(`
9440
9445
  Build complete!
9441
9446
  Total: ${Q.totalPages} pages
9442
9447
  Success: ${Q.successCount}
9443
9448
  Cached: ${Q.cachedCount}
9444
9449
  Failed: ${Q.failedCount}
9445
9450
  Time: ${Q.buildTime}ms
9446
- `),Q}async function YY($,Z){let J=await j0.promises.readdir($,{withFileTypes:!0});for(let Y of J){let Q=Z0.join($,Y.name),X=Z0.join(Z,Y.name);if(Y.isDirectory())await j0.promises.mkdir(X,{recursive:!0}),await YY(Q,X);else await j0.promises.copyFile(Q,X)}}function WW($={}){let Z=$.cacheDir||".stx/ssg-cache",J=new $Y(Z),Y=$.revalidate||3600;return{async get(Q){let X=await J.get(Q);if(!X)return null;if(Date.now()>X.revalidateAfter)this.revalidate(Q).catch(console.error);return{html:X.html,headers:{"Cache-Control":`public, max-age=${Y}, stale-while-revalidate=${Y*2}`,ETag:X.etag,"X-ISR-Generated":new Date(X.generatedAt).toISOString(),...X.headers}}},async revalidate(Q){let G=y9(".",{pagesDir:$.pagesDir||"pages"}).find((z)=>{return Q.match(z.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${Q}`);return}let K=Q.match(G.regex),q={};if(K)G.params.forEach((z,U)=>{q[z]=K[U+1]});let _=await O1(),W=await ZY(G,q,{},$,_);await J.set(Q,{html:W,generatedAt:Date.now(),revalidateAfter:Date.now()+Y*1000,etag:QW(W)}),console.log(`Revalidated: ${Q}`)},async invalidate(Q){if(typeof Q==="string")await J.invalidate(Q);else await J.invalidatePattern(Q)}}}function _W($){return async()=>{return{paths:await $(),fallback:!1}}}function zW(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),J=Z.match(/^---\n([\s\S]*?)\n---/),Y={},Q=Z;if(J){let _=J[1];Q=Z.slice(J[0].length).trim();for(let W of _.split(`
9447
- `)){let z=W.indexOf(":");if(z>0){let U=W.slice(0,z).trim(),j=W.slice(z+1).trim();if(j==="true")j=!0;else if(j==="false")j=!1;else if(/^\d+$/.test(j))j=parseInt(j,10);else if(/^\d+\.\d+$/.test(j))j=parseFloat(j);else if(j.startsWith("[")&&j.endsWith("]"))j=j.slice(1,-1).split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,""));Y[U]=j}}}let X=Q.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),G=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,q;while((q=K.exec(X))!==null){let _=parseInt(q[1],10),W=q[2],z=W.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:z,text:W,level:_})}return{content:X,data:Y,toc:G}}}}function UW($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function BW($,Z){return`<!DOCTYPE html>
9451
+ `),Q}async function JY($,Z){let J=await j0.promises.readdir($,{withFileTypes:!0});for(let Y of J){let Q=Z0.join($,Y.name),X=Z0.join(Z,Y.name);if(Y.isDirectory())await j0.promises.mkdir(X,{recursive:!0}),await JY(Q,X);else await j0.promises.copyFile(Q,X)}}function BW($={}){let Z=$.cacheDir||".stx/ssg-cache",J=new ZY(Z),Y=$.revalidate||3600;return{async get(Q){let X=await J.get(Q);if(!X)return null;if(Date.now()>X.revalidateAfter)this.revalidate(Q).catch(console.error);return{html:X.html,headers:{"Cache-Control":`public, max-age=${Y}, stale-while-revalidate=${Y*2}`,ETag:X.etag,"X-ISR-Generated":new Date(X.generatedAt).toISOString(),...X.headers}}},async revalidate(Q){let G=y9(".",{pagesDir:$.pagesDir||"pages"}).find((z)=>{return Q.match(z.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${Q}`);return}let K=Q.match(G.regex),q={};if(K)G.params.forEach((z,U)=>{q[z]=K[U+1]});let _=await O1(),W=await YY(G,q,{},$,_);await J.set(Q,{html:W,generatedAt:Date.now(),revalidateAfter:Date.now()+Y*1000,etag:WW(W)}),console.log(`Revalidated: ${Q}`)},async invalidate(Q){if(typeof Q==="string")await J.invalidate(Q);else await J.invalidatePattern(Q)}}}function jW($){return async()=>{return{paths:await $(),fallback:!1}}}function OW(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),J=Z.match(/^---\n([\s\S]*?)\n---/),Y={},Q=Z;if(J){let _=J[1];Q=Z.slice(J[0].length).trim();for(let W of _.split(`
9452
+ `)){let z=W.indexOf(":");if(z>0){let U=W.slice(0,z).trim(),j=W.slice(z+1).trim();if(j==="true")j=!0;else if(j==="false")j=!1;else if(/^\d+$/.test(j))j=parseInt(j,10);else if(/^\d+\.\d+$/.test(j))j=parseFloat(j);else if(j.startsWith("[")&&j.endsWith("]"))j=j.slice(1,-1).split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,""));Y[U]=j}}}let X=Q.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),G=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,q;while((q=K.exec(X))!==null){let _=parseInt(q[1],10),W=q[2],z=W.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:z,text:W,level:_})}return{content:X,data:Y,toc:G}}}}function HW($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function LW($,Z){return`<!DOCTYPE html>
9448
9453
  <html>
9449
9454
  <head>
9450
9455
  <meta charset="utf-8">
@@ -9456,4 +9461,4 @@ Build complete!
9456
9461
  <p>Redirecting to <a href="${$}">${$}</a>...</p>
9457
9462
  <script>window.location.replace('${$}')</script>
9458
9463
  </body>
9459
- </html>`}function jW($,Z){if($==="/"||$==="")return Z0.join(Z.outputDir,"index.html");let J=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return Z0.join(Z.outputDir,J,"index.html");return Z0.join(Z.outputDir,`${J}.html`)}var $L={generateStaticSite:qW,createISRHandler:WW,defineStaticPaths:_W,createMarkdownLoader:zW};export{qW as generateStaticSite,_W as defineStaticPaths,$L as default,zW as createMarkdownLoader,WW as createISRHandler};
9464
+ </html>`}function FW($,Z){if($==="/"||$==="")return Z0.join(Z.outputDir,"index.html");let J=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return Z0.join(Z.outputDir,J,"index.html");return Z0.join(Z.outputDir,`${J}.html`)}var XL={generateStaticSite:UW,createISRHandler:BW,defineStaticPaths:jW,createMarkdownLoader:OW};export{UW as generateStaticSite,jW as defineStaticPaths,XL as default,OW as createMarkdownLoader,BW as createISRHandler};