@stacksjs/stx 0.2.12 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ssg.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var g9=Object.defineProperty;var h9=(Z)=>Z;function d9(Z,$){this[Z]=h9.bind(null,$)}var r=(Z,$)=>{for(var J in $)g9(Z,J,{get:$[J],enumerable:!0,configurable:!0,set:d9.bind($,J)})};var P=(Z,$)=>()=>(Z&&($=Z(Z=0)),$);var J4=import.meta.require;var K4;var c0=P(()=>{K4={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 i0(Z,$,J,Y){let Q=Z;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let _={"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||_} -->`});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 n0,s0;var EZ=P(()=>{n0={name:"a11y",handler:(Z,$,J,Y)=>{if(!$.length)return Z;let Q=$[0].replace(/['"]/g,""),X=$.length>1?$[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} -->${Z}`},hasEndTag:!1},s0={name:"screenReader",handler:(Z)=>{return`<span class="sr-only">${Z}</span>`},hasEndTag:!0}});function u9(Z,$={}){let{duration:J,delay:Y,ease:Q,direction:X,custom:G}={...u4,...$};if(Z==="custom"&&G)return G;switch(Z){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 iY=Object.defineProperty;var nY=($)=>$;function oY($,Z){this[$]=nY.bind(null,Z)}var r=($,Z)=>{for(var J in Z)iY($,J,{get:Z[J],enumerable:!0,configurable:!0,set:oY.bind(Z,J)})};var P=($,Z)=>()=>($&&(Z=$($=0)),Z);var J0=import.meta.require;var K0;var r7=P(()=>{K0={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 a7($,Z,J,Y){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let _={"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||_} -->`});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 t7,e7;var D$=P(()=>{t7={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},e7={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function rY($,Z={}){let{duration:J,delay:Y,ease:Q,direction:X,custom:G}={...u0,...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 g9=Object.defineProperty;var h9=(Z)=>Z;function d9(Z,$){this[Z]=h9.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 p9(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function aY(){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 l9(Z){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(Z))}function c9(Z=0.1,$="0px"){return`
40
+ `}function tY($){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 eY($=0.1,Z="0px"){return`
41
41
  <script data-stx-scoped>
42
42
  // Intersection Observer for scroll animations
43
43
  (function() {
@@ -52,8 +52,8 @@ else {
52
52
  // Create the observer
53
53
  const options = {
54
54
  root: null, // Use viewport
55
- rootMargin: '${$}',
56
- threshold: ${Z}
55
+ rootMargin: '${Z}',
56
+ threshold: ${$}
57
57
  };
58
58
 
59
59
  const observer = new IntersectionObserver((entries) => {
@@ -80,7 +80,7 @@ else {
80
80
  }
81
81
  })();
82
82
  </script>
83
- `}function i9(){return`
83
+ `}function $2(){return`
84
84
  <style id="stx-animation-base">
85
85
  :root {
86
86
  --stx-transition-duration: 300ms;
@@ -195,11 +195,11 @@ 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 n9(Z,$,J={}){let{staggerDelay:Y=50,sequence:Q=!1}=J;return`
198
+ `}function Z2($,Z,J={}){let{staggerDelay:Y=50,sequence:Q=!1}=J;return`
199
199
  <script data-stx-scoped>
200
- // Animation Group: ${Z}
200
+ // Animation Group: ${$}
201
201
  (function() {
202
- const elements = ${JSON.stringify($)};
202
+ const elements = ${JSON.stringify(Z)};
203
203
  const staggerDelay = ${Y};
204
204
  const sequence = ${Q};
205
205
 
@@ -232,11 +232,11 @@ else {
232
232
  }
233
233
  })();
234
234
  </script>
235
- `}function e0(Z,$,J,Y){let Q=Z;if(Y.animation?.enabled===!1)return Q;let X=J.includes("test")&&J.includes("animation");if(!l9(Q)&&!X)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=i9();Q=Q.replace("</head>",`${K}
236
- </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=c9(),U=Q.lastIndexOf("</body>");if(U!==-1)Q=Q.slice(0,U)+q+`
237
- `+Q.slice(U)}}return Q}var u4,o0,r0,a0,t0;var DZ=P(()=>{u4={duration:300,delay:0,ease:"ease",direction:"both"};o0={name:"transition",handler:(Z,$,J,Y)=>{if($.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${Z}`;let Q=$[0],X=$.length>1?Number.parseInt($[1],10)||u4.duration:u4.duration,G=$.length>2?$[2]||u4.ease:u4.ease,K=$.length>3?Number.parseInt($[3],10)||u4.delay:u4.delay,q=$.length>4?$[4]||u4.direction:u4.direction,U=`stx-transition-${Math.random().toString(36).substr(2,9)}`,_=u9(Q,{duration:X,delay:K,ease:G,direction:q}),W="stx-transition",z="";if(Q==="fade")z="stx-fade";else if(Q==="slide")z="stx-slide";else if(Q==="scale")z="stx-scale";else if(Q==="flip")z="stx-flip";else if(Q==="rotate")z="stx-rotate";return`<div id="${U}" class="${W} ${z} ${q==="out"?"stx-out":""}"
238
- style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${Z}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},r0={name:"scrollAnimate",handler:(Z,$,J,Y)=>{if($.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${Z}`;let Q=$[0],X=$.length>1?Number.parseInt($[1],10)||300:300,G=$.length>2?$[2]||"ease":"ease",K=$.length>3?Number.parseFloat($[3])||0.2:0.2,q=$.length>4?Number.parseInt($[4],10)||0:0,U=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,_=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,W="stx-transition stx-observe stx-out";if(Q==="fade")W+=" stx-fade";else if(Q==="slide-up"||Q==="slide")W+=" stx-from-bottom";else if(Q==="slide-down")W+=" stx-from-top";else if(Q==="slide-left")W+=" stx-from-right";else if(Q==="slide-right")W+=" stx-from-left";else if(Q==="scale")W+=" stx-scale";else if(Q.includes("-"))W+=` stx-${Q}`;else W+=` stx-${Q}`;return`<div id="${U}" class="${W}" style="${_}" data-threshold="${K}">${Z}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},a0={name:"animationGroup",handler:(Z,$,J,Y)=>{if($.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${Z}`;let Q=$[0],X=$.slice(1).map((U)=>U.startsWith("#")||U.startsWith(".")?U:`#${U}`),G=J.staggerDelay||50,K=J.sequence||!0,q=n9(Q,X,{staggerDelay:G,sequence:K});return`${Z}
239
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},t0={name:"motion",handler:(Z,$,J,Y)=>{let Q=$.length>0?$[0].toLowerCase()==="true":!0,X=p9();return`<div data-animate="${Q?"auto":"true"}">${Z}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as Z$}from"stx-router";var $$=P(()=>{kZ()});async function s9(Z,$,J,Y){let Q=$[0]?.replace(/['"]/g,"")||"main",X=Z$();if(Q!=="main")X=X.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${X}</script>`}var Y$;var kZ=P(()=>{$$();Y$={name:"stxRouter",handler:s9,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function J$(Z){let $=Z.heatmap;if(!$?.enabled)return"";let J={...o9,...$};return`
235
+ `}function X6($,Z,J,Y){let Q=$;if(Y.animation?.enabled===!1)return Q;let X=J.includes("test")&&J.includes("animation");if(!tY(Q)&&!X)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=$2();Q=Q.replace("</head>",`${K}
236
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=eY(),U=Q.lastIndexOf("</body>");if(U!==-1)Q=Q.slice(0,U)+q+`
237
+ `+Q.slice(U)}}return Q}var u0,$6,Z6,Y6,J6;var k$=P(()=>{u0={duration:300,delay:0,ease:"ease",direction:"both"};$6={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)||u0.duration:u0.duration,G=Z.length>2?Z[2]||u0.ease:u0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||u0.delay:u0.delay,q=Z.length>4?Z[4]||u0.direction:u0.direction,U=`stx-transition-${Math.random().toString(36).substr(2,9)}`,_=rY(Q,{duration:X,delay:K,ease:G,direction:q}),W="stx-transition",z="";if(Q==="fade")z="stx-fade";else if(Q==="slide")z="stx-slide";else if(Q==="scale")z="stx-scale";else if(Q==="flip")z="stx-flip";else if(Q==="rotate")z="stx-rotate";return`<div id="${U}" class="${W} ${z} ${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"},Z6={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,U=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,_=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,W="stx-transition stx-observe stx-out";if(Q==="fade")W+=" stx-fade";else if(Q==="slide-up"||Q==="slide")W+=" stx-from-bottom";else if(Q==="slide-down")W+=" stx-from-top";else if(Q==="slide-left")W+=" stx-from-right";else if(Q==="slide-right")W+=" stx-from-left";else if(Q==="scale")W+=" stx-scale";else if(Q.includes("-"))W+=` stx-${Q}`;else W+=` stx-${Q}`;return`<div id="${U}" class="${W}" style="${_}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Y6={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((U)=>U.startsWith("#")||U.startsWith(".")?U:`#${U}`),G=J.staggerDelay||50,K=J.sequence||!0,q=Z2(Q,X,{staggerDelay:G,sequence:K});return`${$}
239
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},J6={name:"motion",handler:($,Z,J,Y)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,X=aY();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as Q6}from"stx-router";var G6=P(()=>{S$()});async function Y2($,Z,J,Y){let Q=Z[0]?.replace(/['"]/g,"")||"main",X=Q6();if(Q!=="main")X=X.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${X}</script>`}var K6;var S$=P(()=>{G6();K6={name:"stxRouter",handler:Y2,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function q6($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...J2,...Z};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
241
241
  <script>
242
242
  (function() {
@@ -619,16 +619,16 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function X$(Z,$){let J=J$($);if(!J)return Z;let Y=Z.lastIndexOf("</body>");if(Y!==-1)return Z.slice(0,Y)+J+Z.slice(Y);return Z+J}function r9(Z){let $={},J=Z.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of J){let[Q,X]=Y.split("="),G=X?.replace(/["']/g,"");switch(Q){case"endpoint":$.endpoint=G;break;case"samplingRate":$.samplingRate=Number.parseInt(G,10);break;case"batchSize":$.batchSize=Number.parseInt(G,10);break;case"trackMouse":$.trackMouse=G==="true";break;case"trackClicks":$.trackClicks=G==="true";break;case"trackScroll":$.trackScroll=G==="true";break;case"honorDnt":$.honorDnt=G==="true";break;case"debugOverlay":$.debugOverlay=G==="true";break}}return $}var o9,Q$;var SZ=P(()=>{o9={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};Q$={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(Z,$,J,Y)=>{let Q=J.__stx_config||{};if($.length>0){let X=r9($.join(" "));Q.heatmap={...Q.heatmap,...X,enabled:!0}}return J$(Q)}}});function c4(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function G$(Z){let $=Z.trim().toLowerCase();return!$.startsWith("javascript:")&&!$.startsWith("vbscript:")&&!$.startsWith("data:text/html")}function K$(Z){let $=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=Z.match($);if(!J)return{data:{},content:Z.trim()};let Y=J[1],Q=Z.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 U=K.slice(0,q).trim(),_=K.slice(q+1).trim();if(typeof _==="string"){if(_.startsWith('"')&&_.endsWith('"')||_.startsWith("'")&&_.endsWith("'"))_=_.slice(1,-1);else if(_.startsWith("[")&&_.endsWith("]"))try{_=JSON.parse(_)}catch{}else if(_==="true")_=!0;else if(_==="false")_=!1;else if(/^-?\d+(?:\.\d+)?$/.test(_))_=Number(_)}X[U]=_}return{data:X,content:Q.trim()}}function m5(Z,$={}){let{gfm:J=!0,breaks:Y=!1}=$,Q=Z,X=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(_,W,z)=>{let j=X.length,B=W?` class="language-${c4(W)}"`:"";return X.push(`<pre><code${B}>${c4(z.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Q=Q.replace(/`([^`]*)`/g,(_,W)=>`<code>${c4(W)}</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)=>{return`<img src="${G$(z)?c4(z):""}" alt="${c4(W)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(_,W,z)=>{return`<a href="${G$(z)?c4(z):""}">${W}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
624
- `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),J)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(_,W,z)=>{let B=`<tr>${W.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${c4(F)}</th>`).join("")}</tr>`,H=z.trim().split(`
625
- `).map((F)=>{return`<tr>${F.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${c4(O)}</td>`).join("")}</tr>`}).join(`
622
+ `}function _6($,Z){let J=q6(Z);if(!J)return $;let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+J+$.slice(Y);return $+J}function X2($){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 J2,U6;var b$=P(()=>{J2={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};U6={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=X2(Z.join(" "));Q.heatmap={...Q.heatmap,...X,enabled:!0}}return q6(Q)}}});function i0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function W6($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function z6($){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 U=K.slice(0,q).trim(),_=K.slice(q+1).trim();if(typeof _==="string"){if(_.startsWith('"')&&_.endsWith('"')||_.startsWith("'")&&_.endsWith("'"))_=_.slice(1,-1);else if(_.startsWith("[")&&_.endsWith("]"))try{_=JSON.parse(_)}catch{}else if(_==="true")_=!0;else if(_==="false")_=!1;else if(/^-?\d+(?:\.\d+)?$/.test(_))_=Number(_)}X[U]=_}return{data:X,content:Q.trim()}}function m1($,Z={}){let{gfm:J=!0,breaks:Y=!1}=Z,Q=$,X=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(_,W,z)=>{let j=X.length,B=W?` class="language-${i0(W)}"`:"";return X.push(`<pre><code${B}>${i0(z.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Q=Q.replace(/`([^`]*)`/g,(_,W)=>`<code>${i0(W)}</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)=>{return`<img src="${W6(z)?i0(z):""}" alt="${i0(W)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(_,W,z)=>{return`<a href="${W6(z)?i0(z):""}">${W}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
624
+ `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),J)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(_,W,z)=>{let B=`<tr>${W.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${i0(F)}</th>`).join("")}</tr>`,O=z.trim().split(`
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>
627
627
  <thead>
628
628
  ${B}
629
629
  </thead>
630
630
  <tbody>
631
- ${H}
631
+ ${O}
632
632
  </tbody>
633
633
  </table>`});if(J)Q=Q.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Q=Q.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Q.split(`
634
634
  `),K=[],q=!1,U=[];for(let _ of G){let W=_.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(W)||/^\0CODEBLOCK\d+\0$/.test(W)||W===""){if(q&&U.length>0)K.push(`<p>${U.join(Y?`<br />
@@ -637,13 +637,13 @@ ${H}
637
637
  `:`
638
638
  `)}</p>`);if(Q=K.join(`
639
639
  `),Y)Q=Q.replace(/\n/g,`<br />
640
- `);for(let _=0;_<X.length;_++)Q=Q.replace(`\x00CODEBLOCK${_}\x00`,X[_]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function i4(Z){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;Z=Z.replace($,(Y,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
641
- `});let J=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return Z=Z.replace(J,(Y,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
642
- `}),Z}var bZ={};r(bZ,{hasUserImports:()=>a9,bundleClientScript:()=>e9});import f4 from"path";import J5 from"fs";function a9(Z){let $=/^\s*import\s+(?!type\s)/gm;if(!Z.match($))return!1;let Y=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=Y.exec(Z))!==null){let G=Q[1];if(!q$.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(Z))!==null){let G=Q[1];if(!q$.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function t9(Z){return{name:"stx-client-bundle",setup($){$.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(J)=>({path:J.path,external:!0})),$.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(J)=>({path:J.path,external:!0})),$.onResolve({filter:/^@\//},(J)=>{let Y=f4.resolve(Z,J.path.slice(2)),Q=[Y,`${Y}.ts`,`${Y}.js`,f4.join(Y,"index.ts"),f4.join(Y,"index.js")];for(let X of Q)if(J5.existsSync(X)&&J5.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 e9(Z,$,J={}){let Y=J.projectRoot||process.cwd(),Q=J.minify??!1,X=J.cacheDir||f4.join(Y,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(Z+$);let K=G.digest("hex").slice(0,12),q=f4.join(X,`${K}.js`),U=Bun.file(q);if(await U.exists())return console.log("[stx:bundler] cache hit:",K),await U.text();let _=f4.join(Y,".stx","bundle-tmp"),W=f4.join(_,`${K}.ts`),z=f4.join(_,"out",K);J5.mkdirSync(_,{recursive:!0}),J5.mkdirSync(z,{recursive:!0});let j=f4.dirname($),B=[],H=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=H.exec(Z))!==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(Z))!==null){if(L[1])continue;B.push(L[2])}let O=B.length>0?`
643
- export { ${B.join(", ")} }`:"";await Bun.write(W,Z+O),console.log("[stx:bundler] bundling:",K,"from:",f4.basename($));try{let V=await Bun.build({entrypoints:[W],outdir:z,target:"browser",format:"esm",minify:Q,plugins:[t9(Y)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"'},root:j});if(!V.success){let N=V.logs.filter((R)=>R.level==="error").map((R)=>R.message).join(", ");return console.warn("[stx:bundler] build failed:",N),Z}let A="";for(let N of V.outputs){A=await N.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"),J5.mkdirSync(X,{recursive:!0}),await Bun.write(q,A),A}catch(V){return console.warn("[stx:bundler] error:",V instanceof Error?V.message:V),Z}finally{try{J5.rmSync(W,{force:!0}),J5.rmSync(z,{recursive:!0,force:!0})}catch{}}}var q$;var yZ=P(()=>{q$=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function JJ(Z){let $=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(Z))!==null)if(!YJ.has(Y[1]))$.add(Y[1]);return Array.from($)}function XJ(Z){let $=new Set,J=new Set,Y=Z;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(Z))!==null){let q=G[1],U=G[2];if(G[0].includes("import type"))continue;q.split(",").map((W)=>W.trim().split(/\s+as\s+/)[0]).filter((W)=>W.length>0).forEach((W)=>{if(Q.add(W),U==="stx")$.add(W);else J.add(W)}),Y=Y.replace(G[0],"// [auto-import processed]")}for(let q of ZJ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(Y))$.add(q)}for(let q of $J){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(Y))J.add(q)}let K=JJ(Y);for(let q of K)if(!Q.has(q))J.add(q);return{code:Y,stxImports:Array.from($),browserImports:Array.from(J)}}function QJ(Z,$){let J=[];if(Z.length>0)J.push(` var { ${Z.join(", ")} } = window.stx || window;`);if($.length>0)J.push(` var { ${$.join(", ")} } = window.StacksBrowser || {};`);if(J.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
640
+ `);for(let _=0;_<X.length;_++)Q=Q.replace(`\x00CODEBLOCK${_}\x00`,X[_]);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
+ `});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
+ `}),$}var y$={};r(y$,{hasUserImports:()=>Q2,bundleClientScript:()=>K2});import f0 from"path";import X1 from"fs";function Q2($){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(!B6.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(!B6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function G2($){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 K2($,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`),U=Bun.file(q);if(await U.exists())return console.log("[stx:bundler] cache hit:",K),await U.text();let _=f0.join(Y,".stx","bundle-tmp"),W=f0.join(_,`${K}.ts`),z=f0.join(_,"out",K);X1.mkdirSync(_,{recursive:!0}),X1.mkdirSync(z,{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 R=V.split(":")[0].trim();if(R)B.push(R)});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(W,$+H),console.log("[stx:bundler] bundling:",K,"from:",f0.basename(Z));try{let V=await Bun.build({entrypoints:[W],outdir:z,target:"browser",format:"esm",minify:Q,plugins:[G2(Y)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"'},root:j});if(!V.success){let N=V.logs.filter((A)=>A.level==="error").map((A)=>A.message).join(", ");return console.warn("[stx:bundler] build failed:",N),$}let R="";for(let N of V.outputs){R=await N.text();break}return R=R.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),console.log("[stx:bundler] bundled:",K,"output:",R.length,"bytes"),X1.mkdirSync(X,{recursive:!0}),await Bun.write(q,R),R}catch(V){return console.warn("[stx:bundler] error:",V instanceof Error?V.message:V),$}finally{try{X1.rmSync(W,{force:!0}),X1.rmSync(z,{recursive:!0,force:!0})}catch{}}}var B6;var C$=P(()=>{B6=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function W2($){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(!U2.has(Y[1]))Z.add(Y[1]);return Array.from(Z)}function z2($){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],U=G[2];if(G[0].includes("import type"))continue;q.split(",").map((W)=>W.trim().split(/\s+as\s+/)[0]).filter((W)=>W.length>0).forEach((W)=>{if(Q.add(W),U==="stx")Z.add(W);else J.add(W)}),Y=Y.replace(G[0],"// [auto-import processed]")}for(let q of q2){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(Y))Z.add(q)}for(let q of _2){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(Y))J.add(q)}let K=W2(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 B2($,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 KJ(Z){let $=[];if(Z.self)$.push("if ($event.target !== $el) return");for(let J of Z.systemKeys)$.push(`if (!$event.${J}Key) return`);if(Z.keys.length>0){let J=Z.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");$.push(`if (!(${J})) return`)}if(Z.mouse!==null){let J=GJ[Z.mouse];$.push(`if ($event.button !== ${J}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function qJ(Z,$){let{elementId:J,event:Y,handler:Q,modifiers:X}=Z,G=KJ(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(", ")} }`:"",U="";if(G)U+=`${G}; `;let _=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function W(z){return`var scope = $el.closest('[data-stx-scope]');
646
+ `;return""}function O2($){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=j2[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function H2($,Z){let{elementId:J,event:Y,handler:Q,modifiers:X}=$,G=O2(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(", ")} }`:"",U="";if(G)U+=`${G}; `;let _=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function W(z){return`var scope = $el.closest('[data-stx-scope]');
647
647
  if (scope && scope.__stx_execute) {
648
648
  scope.__stx_execute('${_}', $event, $el);
649
649
  }
@@ -679,25 +679,25 @@ else {
679
679
  else {
680
680
  ${Q}
681
681
  }
682
- }${q})`}function _J(Z){if(Z.length===0)return"";return`
682
+ }${q})`}function L2($){if($.length===0)return"";return`
683
683
  // STX: auto-generated event bindings
684
- ${Z.map((J,Y)=>qJ(J,Y)).join(`
685
- `)}`}function _$(Z){let $=[],J=new Set,Y=Z.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 U=0;while(G<X){if(Y[G]==="\\"){G+=2;continue}if(Y[G]==="`"&&U===0){G++;break}if(Y[G]==="$"&&Y[G+1]==="{"){U++,G+=2;continue}if(Y[G]==="}"&&U>0){U--,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),U=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let z=U[1];if(!z.startsWith("_")&&!J.has(z))$.push(z),J.add(z);G+=U[0].length;continue}let _=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((z)=>{let j=z.trim(),B=j.indexOf(":"),H=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!J.has(H))$.push(H),J.add(H)}),G+=_[0].length;continue}let W=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let z=W[1];if(!z.startsWith("_")&&!J.has(z))$.push(z),J.add(z);G+=W[0].length;continue}}G++}return $}function WJ(Z){let $=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(z){let j;while((j=J.exec(z))!==null){let B=j[0];if(!UJ.has(B))$.add(B)}}let Q=/\{\{([\s\S]*?)\}\}/g,X;while((X=Q.exec(Z))!==null)Y(X[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((X=G.exec(Z))!==null)Y(X[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((X=K.exec(Z))!==null)Y(X[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((X=q.exec(Z))!==null)Y(X[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((X=U.exec(Z))!==null)Y(X[1]);let _=/@model\s*=\s*["']([^"']*)["']/gi;while((X=_.exec(Z))!==null)Y(X[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((X=W.exec(Z))!==null)Y(X[1]);return $}async function j7(Z,$={}){let J=Z,Y="",Q=!1,{hasUserImports:X,bundleClientScript:G}=await Promise.resolve().then(() => (yZ(),bZ));if(X(J))console.log("[stx:bundler] user imports detected, bundling..."),J=await G(J,$.filePath||"",{projectRoot:$.projectRoot,minify:$.production}),Q=!0;if($.autoImports!==!1){let B=XJ(J);J=B.code,Y=QJ(B.stxImports,B.browserImports)}if(J=i4(J),!Q&&X5($.attrs||""))J=Q5(J);let K=_J($.eventBindings||[]),q=($.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}`:""}`}>
684
+ ${$.map((J,Y)=>H2(J,Y)).join(`
685
+ `)}`}function j6($){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 U=0;while(G<X){if(Y[G]==="\\"){G+=2;continue}if(Y[G]==="`"&&U===0){G++;break}if(Y[G]==="$"&&Y[G+1]==="{"){U++,G+=2;continue}if(Y[G]==="}"&&U>0){U--,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),U=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let z=U[1];if(!z.startsWith("_")&&!J.has(z))Z.push(z),J.add(z);G+=U[0].length;continue}let _=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((z)=>{let j=z.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+=_[0].length;continue}let W=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let z=W[1];if(!z.startsWith("_")&&!J.has(z))Z.push(z),J.add(z);G+=W[0].length;continue}}G++}return Z}function V2($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(z){let j;while((j=J.exec(z))!==null){let B=j[0];if(!F2.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 U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((X=U.exec($))!==null)Y(X[1]);let _=/@model\s*=\s*["']([^"']*)["']/gi;while((X=_.exec($))!==null)Y(X[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((X=W.exec($))!==null)Y(X[1]);return Z}async function j5($,Z={}){let J=$,Y="",Q=!1,{hasUserImports:X,bundleClientScript:G}=await Promise.resolve().then(() => (C$(),y$));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=z2(J);J=B.code,Y=B2(B.stxImports,B.browserImports)}if(J=n0(J),!Q&&Q1(Z.attrs||""))J=G1(J);let K=L2(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
- </script>`}let _=/\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),W=/function __stx_setup_/.test(J),z=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(Z);function j(B){let H=B.length>0?`
689
+ </script>`}let _=/\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($),W=/function __stx_setup_/.test(J),z=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function j(B){let O=B.length>0?`
690
690
  return { ${B.join(", ")} };`:"";return`<script data-stx-scoped>
691
691
  window.stx.mount(function() {
692
692
  'use strict';
693
693
  ${Y}${J}
694
- ${K}${H}
695
- })</script>`}if(!z&&!W){if(_)return j(_$(Z));if($.templateContent){let B=_$(Z);if(B.length>0){let H=WJ($.templateContent);if(B.some((L)=>H.has(L)))return j(B)}}}return`<script data-stx-scoped>
694
+ ${K}${O}
695
+ })</script>`}if(!z&&!W){if(_)return j(j6($));if(Z.templateContent){let B=j6($);if(B.length>0){let O=V2(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 ZJ,$J,YJ,GJ,UJ;var CZ=P(()=>{V4();ZJ=["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"],$J=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],YJ=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"]);GJ={left:0,middle:1,right:2};UJ=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 jJ(Z){let $="",J=null,Y=!1;for(let Q=0;Q<Z.length;Q++){let X=Z[Q];if(Y){Y=!1;continue}if(X==="\\"&&J){Y=!0;continue}if(J){if(J==="`"&&X==="$"&&Q+1<Z.length&&Z[Q+1]==="{"){let G=1;Q+=2;while(Q<Z.length&&G>0){if(Z[Q]==="{")G++;else if(Z[Q]==="}")G--;if(G>0)$+=Z[Q],Q++}continue}if(X===J)J=null;continue}if(X==='"'||X==="'"||X==="`"){J=X;continue}$+=X}return $}function u5(Z){let $=Z.trim(),J=jJ($);for(let Y of W$)if(Y.test(J))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${$}`);if(!U$.allowBracketNotation&&BJ.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function HJ(Z){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[J,Y]of Object.entries(Z)){if(J.startsWith("__")||W$.some((Q)=>Q.test(J)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))$[J]=PZ(Y);else $[J]=Y}return $}function PZ(Z,$=0){if($>=U$.maxSanitizeDepth)return"[Object too deep]";if(Z===null||typeof Z!=="object")return Z;if(Array.isArray(Z))return Z.map((Y)=>PZ(Y,$+1));if(Z instanceof Date||Z instanceof RegExp||Z instanceof Map||Z instanceof Set||Z instanceof Error)return Z;let J={};for(let[Y,Q]of Object.entries(Z)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(Q&&typeof Q==="object")J[Y]=PZ(Q,$+1);else J[Y]=Q}return J}function X4(Z,$){try{let J=u5(Z),Y=HJ($);return Function(...Object.keys(Y),`
700
+ })()</script>`}var q2,_2,U2,j2,F2;var P$=P(()=>{V0();q2=["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"],_2=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],U2=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"]);j2={left:0,middle:1,right:2};F2=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 A2($){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 u1($){let Z=$.trim(),J=A2(Z);for(let Y of H6)if(Y.test(J))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${Z}`);if(!O6.allowBracketNotation&&R2.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function w2($){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("__")||H6.some((Q)=>Q.test(J)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))Z[J]=v$(Y);else Z[J]=Y}return Z}function v$($,Z=0){if(Z>=O6.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>v$(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]=v$(Q,Z+1);else J[Y]=Q}return J}function X0($,Z){try{let J=u1($),Y=w2(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(Z){try{return u5(Z),!0}catch{return!1}}function H4(Z,$){try{let J=X4(Z,$);if(J&&typeof J==="object"&&!Array.isArray(J))return J;return{}}catch{return{}}}function Z4(Z,$){let J=u5(Z);return Function(...$,`
711
+ `)(...Object.values(Y))}catch{return}}function e($){try{return u1($),!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=u1($);return Function(...Z,`
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 H7(Z){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($))return!1;return!0}var zJ,U$,W$,BJ;var A4=P(()=>{zJ={maxSanitizeDepth:10,allowBracketNotation:!1},U$={...zJ},W$=[/\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/],BJ=/[\w)\]]\s*\[\s*['"]/});function O7(Z,$){let J=OJ++,Y=`<!--__STX_${Z.toUpperCase()}_${J}__-->`;return LJ.set(Y,{type:Z,expression:$}),Y}var OJ=0,LJ;var z$=P(()=>{LJ=new Map});var V$={};r(V$,{usesSignalsInScript:()=>L7,unescapeHtml:()=>vZ,registerFilters:()=>VJ,registerFilter:()=>H$,processExpressions:()=>K5,interpolateScriptsInTemplate:()=>AJ,interpolateScriptExpressions:()=>L$,getAllFilters:()=>O$,evaluateExpression:()=>p4,escapeHtml:()=>G5,defaultFilters:()=>l5,clearCustomFilters:()=>NJ,applyFilters:()=>F$});function FJ(Z){let $=B$.get(Z);if(!$){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${J}(?!\\w)`,"g"),B$.set(Z,$)}return $.lastIndex=0,$}function H$(Z,$){if(Z in l5)console.warn(`Filter "${Z}" already exists as a built-in filter. Custom filter will take precedence.`);p5[Z]=$}function VJ(Z){for(let[$,J]of Object.entries(Z))H$($,J)}function O$(){return{...l5,...p5}}function NJ(){for(let Z of Object.keys(p5))delete p5[Z]}function G5(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function L7(Z){let $=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=$.exec(Z))!==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(Z))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(Z))return!0;return!1}function j$(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=Z.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",X=!1,G=0;for(let U=0;U<Y.length;U++){let _=Y[U];if(!X&&_==="`"){X=!0,G=0;continue}if(X){if(_==="`"&&G===0){X=!1;continue}if(_==="$"&&Y[U+1]==="{"){G++,U++;continue}if(_==="}"&&G>0){G--;continue}continue}Q+=_}Y=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(Y))!==null){let U=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!J.includes(U)&&!(U in $))return!1}}return!0}function L$(Z,$){let J=Z;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>{try{let X=p4(Q,$);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=p4(Q,$);if(G===void 0)return Y;return JSON.stringify(G)}catch{return Y}}),J}function AJ(Z,$,J={}){return Z.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=L$(X,$);return`<script${Q}>${G}</script>`})}function K5(Z,$,J){let Y=Z,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=L7(Z);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,q,U)=>{try{let _=p4(q,$);return _!==void 0&&_!==null?String(_):""}catch(_){let W=_ instanceof Error?_.message:String(_);return Q4("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${W}`,J,Z,U,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,q,U)=>{try{let _=p4(q,$);if(_===void 0&&$.__stx_buildMode==="compile")return O7("raw",q.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if($.__stx_buildMode==="compile")return O7("raw",q.trim());let W=_ instanceof Error?_.message:String(_);return Q4("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${W}`,J,Z,U,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,U)=>{let _=q.trim(),W=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],z=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,B=_.match(z)?.[1],H=B&&((B in $)||W.includes(B)),F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,L=_.match(F),O=L&&!W.includes(L[1])&&!(L[1]in $);if(/^__[A-Z_]+__$/.test(_))return"";try{let V=p4(q,$);if(V===void 0&&G&&!j$(_,$))return K;if(V===void 0&&$.__stx_buildMode==="compile"&&!G)return O7("expr",_);return V!==void 0&&V!==null?G5(String(V)):""}catch(V){if(G&&!j$(_,$))return K;if(O)return K;let A=V instanceof Error?V.message:String(V);return Q4("Expression",`Error evaluating: {{ ${_} }}: ${A}`,J,Z,U,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 F$(Z,$,J){if(!$.trim())return Z;let Y=Z,Q=$.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=p5[G]||l5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(O$()).join(", ")}`);let q=[];if(Q.startsWith(":")){let U=Q.match(/^:([^|\s]+)/);if(U){let _=U[1].trim();try{let W=Number(_);q=[Number.isNaN(W)?_:W]}catch{q=[_]}Q=Q.substring(U[0].length).trim()}}else if(Q.startsWith("(")){let U=1,_=1;while(U>0&&_<Q.length){if(Q[_]==="(")U++;if(Q[_]===")")U--;_++}if(U===0){let W=Q.substring(1,_-1).trim();if(W)try{if(W.startsWith("{")&&W.endsWith("}"))q=[p4(`(${W})`,J,!0)];else{let z=[],j="",B=null,H=0,F=0,L=0,O=!1;for(let V=0;V<W.length;V++){let A=W[V];if(O){j+=A,O=!1;continue}if(A==="\\"){j+=A,O=!0;continue}if(B){if(j+=A,A===B)B=null;continue}if(A==='"'||A==="'"||A==="`"){B=A,j+=A;continue}if(A==="(")H++;else if(A===")")H--;else if(A==="[")F++;else if(A==="]")F--;else if(A==="{")L++;else if(A==="}")L--;if(A===","&&H===0&&F===0&&L===0){z.push(j),j="";continue}j+=A}if(j)z.push(j);q=z.map((V)=>{let A=V.trim();return p4(A,J,!0)})}}catch{q=[W]}Q=Q.substring(_).trim()}}try{Y=K(Y,J,...q)}catch(U){let _=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${G}': ${_}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return Y}function RJ(Z){let $=!1,J="",Y=0,Q=0,X=0,G=!1;for(let K=0;K<Z.length;K++){let q=Z[K],U=Z[K+1];if($&&G){G=!1;continue}if($&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!$)$=!0,J=q;else if(q===J)$=!1,J="";continue}if($&&J==="`"&&q==="$"&&U==="{"){let _=1;K+=2;while(K<Z.length&&_>0){if(Z[K]==="{")_++;else if(Z[K]==="}")_--;if(_>0)K++}continue}if($)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(U==="|"){K++;continue}if(U==="="){K++;continue}return K}}return-1}function p4(Z,$,J=!1){try{let Y=Z.trim(),Q=RJ(Y);if(Q>0){let X=Y.substring(0,Q).trim(),G=Y.substring(Q+1).trim(),K=p4(X,$,!0);return F$(K,G,$)}if(!e(Y)){if(!J)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return X4(Y,$)}try{let X=Object.keys($),G=Object.values($);return Z4(Y,X)(...G)}catch{return X4(Y,$)}}catch(Y){if(!J)console.error(`Error evaluating expression: ${Z}`,Y);throw Y}}function vZ(Z){if(!Z)return"";return Z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var p5,B$,l5;var n4=P(()=>{A4();V4();z$();p5={},B$=new Map;l5={uppercase:(Z,$)=>{return Z!==void 0&&Z!==null?String(Z).toUpperCase():""},lowercase:(Z,$)=>{return Z!==void 0&&Z!==null?String(Z).toLowerCase():""},capitalize:(Z,$)=>{if(Z===void 0||Z===null)return"";let J=String(Z);return J.charAt(0).toUpperCase()+J.slice(1)},number:(Z,$,J=0)=>{if(Z===void 0||Z===null)return"";try{let Y=Number(Z);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:(Z,$,J="en-US")=>{if(Z===void 0||Z===null)return"";try{let Y=Number(Z);if(Number.isNaN(Y))return String(Z);return Y.toLocaleString(J)}catch{return String(Z)}},join:(Z,$,J=",")=>{if(!Array.isArray(Z))return"";return Z.join(String(J))},escape:(Z,$)=>{if(Z===void 0||Z===null)return"";return G5(String(Z))},translate:(Z,$,J={})=>{if(!$||!$.__translations)return Z;let Y=$.__translations,Q=$.__i18nConfig?.fallbackToKey??!0,X=String(Z).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?Z:"";let K=String(G);return Object.entries(J).forEach(([q,U])=>{K=K.replace(FJ(q),String(U))}),K},t:(Z,$,J={})=>{return l5.translate(Z,$,J)},truncate:(Z,$,J=50,Y="...")=>{if(Z===void 0||Z===null)return"";let Q=String(Z);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(Z===void 0||Z===null)return"";try{let Q=Z instanceof Date?Z:new Date(Z);if(Number.isNaN(Q.getTime()))return String(Z);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(Z)}},currency:(Z,$,J="USD",Y="en-US")=>{if(Z===void 0||Z===null)return"";try{let Q=Number(Z);if(Number.isNaN(Q))return String(Z);return new Intl.NumberFormat(Y,{style:"currency",currency:J}).format(Q)}catch{return String(Z)}},pluralize:(Z,$,J,Y)=>{let Q=Number(Z);if(Number.isNaN(Q))return J;let X=Y||`${J}s`;return Q===1?J:X},first:(Z,$)=>{if(Z===void 0||Z===null)return"";if(Array.isArray(Z))return Z.length===0?"":Z[0];return String(Z).charAt(0)},last:(Z,$)=>{if(Z===void 0||Z===null)return"";if(Array.isArray(Z))return Z.length===0?"":Z[Z.length-1];let J=String(Z);return J.charAt(J.length-1)},length:(Z,$)=>{if(Z===void 0||Z===null)return 0;if(Array.isArray(Z)||typeof Z==="string")return Z.length;if(Z instanceof Map||Z instanceof Set)return Z.size;if(typeof Z==="object")return Object.keys(Z).length;return 0},json:(Z,$,J=!1)=>{if(Z===void 0)return"undefined";if(Z===null)return"null";try{return J?JSON.stringify(Z,null,2):JSON.stringify(Z)}catch{return String(Z)}},default:(Z,$,J="")=>{return Z===void 0||Z===null||Z===""?J:Z},reverse:(Z,$)=>{if(Z===void 0||Z===null)return"";if(Array.isArray(Z))return[...Z].reverse();return String(Z).split("").reverse().join("")},slice:(Z,$,J=0,Y)=>{if(Z===void 0||Z===null)return"";if(Array.isArray(Z)||typeof Z==="string")return Z.slice(J,Y);return Z},replace:(Z,$,J,Y="")=>{if(Z===void 0||Z===null)return"";let Q=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(Z).replace(new RegExp(Q,"g"),()=>Y)},stripTags:(Z,$)=>{if(Z===void 0||Z===null)return"";return String(Z).replace(/<[^>]*>/g,"")},urlencode:(Z,$)=>{if(Z===void 0||Z===null)return"";return encodeURIComponent(String(Z))},abs:(Z,$)=>{let J=Number(Z);return Number.isNaN(J)?0:Math.abs(J)},round:(Z,$,J=0)=>{let Y=Number(Z);if(Number.isNaN(Y))return 0;let Q=10**J;return Math.round(Y*Q)/Q}}});class c5{cache=new Map;maxSize;constructor(Z=100){this.maxSize=Z}get(Z){if(!this.cache.has(Z))return;let $=this.cache.get(Z);return this.cache.delete(Z),this.cache.set(Z,$),$}set(Z,$){if(this.cache.has(Z))this.cache.delete(Z);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(Z){return this.cache.has(Z)}delete(Z){return this.cache.delete(Z)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function w5(Z,$){if($?.includes("g"))return new RegExp(Z,$);let J=`${Z}:${$||""}`;if(!R5.has(J)){if(R5.size>=wJ){let Y=R5.keys().next().value;if(Y)R5.delete(Y)}R5.set(J,new RegExp(Z,$))}return R5.get(J)}class N${pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(Z){let $=Array.from(new Set(Z)),J=$.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 U=`${J}:${q}`,_=Q.get(U);if(!_){if(Q.size>=X){let W=Q.keys().next().value;if(W)Q.delete(W)}_=Function(...$,`
722
+ `)}function O5($){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 N2,O6,H6,R2;var R0=P(()=>{N2={maxSanitizeDepth:10,allowBracketNotation:!1},O6={...N2},H6=[/\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/],R2=/[\w)\]]\s*\[\s*['"]/});function H5($,Z){let J=T2++,Y=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return M2.set(Y,{type:$,expression:Z}),Y}var T2=0,M2;var L6=P(()=>{M2=new Map});var T6={};r(T6,{usesSignalsInScript:()=>L5,unescapeHtml:()=>x$,registerFilters:()=>E2,registerFilter:()=>N6,processExpressions:()=>q1,interpolateScriptsInTemplate:()=>k2,interpolateScriptExpressions:()=>A6,getAllFilters:()=>R6,evaluateExpression:()=>p0,escapeHtml:()=>K1,defaultFilters:()=>l1,clearCustomFilters:()=>D2,applyFilters:()=>w6});function I2($){let Z=F6.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),F6.set($,Z)}return Z.lastIndex=0,Z}function N6($,Z){if($ in l1)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);p1[$]=Z}function E2($){for(let[Z,J]of Object.entries($))N6(Z,J)}function R6(){return{...l1,...p1}}function D2(){for(let $ of Object.keys(p1))delete p1[$]}function K1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function L5($){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 V6($,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 U=0;U<Y.length;U++){let _=Y[U];if(!X&&_==="`"){X=!0,G=0;continue}if(X){if(_==="`"&&G===0){X=!1;continue}if(_==="$"&&Y[U+1]==="{"){G++,U++;continue}if(_==="}"&&G>0){G--;continue}continue}Q+=_}Y=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(Y))!==null){let U=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!J.includes(U)&&!(U in Z))return!1}}return!0}function A6($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>{try{let X=p0(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=p0(Q,Z);if(G===void 0)return Y;return JSON.stringify(G)}catch{return Y}}),J}function k2($,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=A6(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=L5($);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,q,U)=>{try{let _=p0(q,Z);return _!==void 0&&_!==null?String(_):""}catch(_){let W=_ instanceof Error?_.message:String(_);return Q0("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${W}`,J,$,U,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,q,U)=>{try{let _=p0(q,Z);if(_===void 0&&Z.__stx_buildMode==="compile")return H5("raw",q.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if(Z.__stx_buildMode==="compile")return H5("raw",q.trim());let W=_ instanceof Error?_.message:String(_);return Q0("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${W}`,J,$,U,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,U)=>{let _=q.trim(),W=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],z=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,B=_.match(z)?.[1],O=B&&((B in Z)||W.includes(B)),F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,L=_.match(F),H=L&&!W.includes(L[1])&&!(L[1]in Z);if(/^__[A-Z_]+__$/.test(_))return"";try{let V=p0(q,Z);if(V===void 0&&G&&!V6(_,Z))return K;if(V===void 0&&Z.__stx_buildMode==="compile"&&!G)return H5("expr",_);return V!==void 0&&V!==null?K1(String(V)):""}catch(V){if(G&&!V6(_,Z))return K;if(H)return K;let R=V instanceof Error?V.message:String(V);return Q0("Expression",`Error evaluating: {{ ${_} }}: ${R}`,J,$,U,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 w6($,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=p1[G]||l1[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(R6()).join(", ")}`);let q=[];if(Q.startsWith(":")){let U=Q.match(/^:([^|\s]+)/);if(U){let _=U[1].trim();try{let W=Number(_);q=[Number.isNaN(W)?_:W]}catch{q=[_]}Q=Q.substring(U[0].length).trim()}}else if(Q.startsWith("(")){let U=1,_=1;while(U>0&&_<Q.length){if(Q[_]==="(")U++;if(Q[_]===")")U--;_++}if(U===0){let W=Q.substring(1,_-1).trim();if(W)try{if(W.startsWith("{")&&W.endsWith("}"))q=[p0(`(${W})`,J,!0)];else{let z=[],j="",B=null,O=0,F=0,L=0,H=!1;for(let V=0;V<W.length;V++){let R=W[V];if(H){j+=R,H=!1;continue}if(R==="\\"){j+=R,H=!0;continue}if(B){if(j+=R,R===B)B=null;continue}if(R==='"'||R==="'"||R==="`"){B=R,j+=R;continue}if(R==="(")O++;else if(R===")")O--;else if(R==="[")F++;else if(R==="]")F--;else if(R==="{")L++;else if(R==="}")L--;if(R===","&&O===0&&F===0&&L===0){z.push(j),j="";continue}j+=R}if(j)z.push(j);q=z.map((V)=>{let R=V.trim();return p0(R,J,!0)})}}catch{q=[W]}Q=Q.substring(_).trim()}}try{Y=K(Y,J,...q)}catch(U){let _=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${G}': ${_}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return Y}function S2($){let Z=!1,J="",Y=0,Q=0,X=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],U=$[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==="$"&&U==="{"){let _=1;K+=2;while(K<$.length&&_>0){if($[K]==="{")_++;else if($[K]==="}")_--;if(_>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(U==="|"){K++;continue}if(U==="="){K++;continue}return K}}return-1}function p0($,Z,J=!1){try{let Y=$.trim(),Q=S2(Y);if(Q>0){let X=Y.substring(0,Q).trim(),G=Y.substring(Q+1).trim(),K=p0(X,Z,!0);return w6(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(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function x$($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var p1,F6,l1;var o0=P(()=>{R0();V0();L6();p1={},F6=new Map;l1={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,U])=>{K=K.replace(I2(q),String(U))}),K},t:($,Z,J={})=>{return l1.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 c1{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 w1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let J=`${$}:${Z||""}`;if(!A1.has(J)){if(A1.size>=b2){let Y=A1.keys().next().value;if(Y)A1.delete(Y)}A1.set(J,new RegExp($,Z))}return A1.get(J)}class M6{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 U=`${J}:${q}`,_=Q.get(U);if(!_){if(Q.size>=X){let W=Q.keys().next().value;if(W)Q.delete(W)}_=Function(...Z,`
723
723
  'use strict';
724
724
  try {
725
725
  return ${q};
@@ -730,46 +730,46 @@ catch (e) {
730
730
  }
731
731
  throw e;
732
732
  }
733
- `),Q.set(U,_)}return _(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:$.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class A${metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(Z){this.enabled=Z}isEnabled(){return this.enabled}setBudget(Z,$){this.budgets.set(Z,{warnThreshold:0.8,action:"warn",...$})}setBudgets(Z){for(let[$,J]of Object.entries(Z))this.setBudget($,J)}removeBudget(Z){this.budgets.delete(Z)}getBudgets(){let Z={};for(let[$,J]of this.budgets.entries())Z[$]=J;return Z}onViolation(Z){this.violationHandlers.push(Z)}offViolation(Z){let $=this.violationHandlers.indexOf(Z);if($!==-1)this.violationHandlers.splice($,1)}time(Z,$){if(!this.enabled)return $();let J=performance.now(),Y=$(),Q=performance.now()-J;return this.recordTime(Z,Q),this.checkBudget(Z,Q),Y}async timeAsync(Z,$){if(!this.enabled)return $();let J=performance.now(),Y=await $(),Q=performance.now()-J;return this.recordTime(Z,Q),this.checkBudget(Z,Q),Y}checkBudget(Z,$){let J=this.budgets.get(Z);if(!J)return;let Y=$/J.maxTime*100,Q=J.warnThreshold!==void 0?$>=J.maxTime*J.warnThreshold&&$<J.maxTime:!1,X=$>=J.maxTime;if(!Q&&!X)return;let G={label:Z,actualTime:$,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] "${Z}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${J.maxTime}ms budget)`:`[Performance Budget Exceeded] "${Z}" took ${$.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(Z);if(J)J.count++,J.totalTime+=$,J.maxTime=Math.max(J.maxTime,$),J.minTime=Math.min(J.minTime,$);else this.metrics.set(Z,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(Z){if(Z){let J=this.metrics.get(Z);if(!J)return{};let Y=this.budgets.get(Z);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 $={};for(let[J,Y]of this.metrics.entries()){let Q=this.budgets.get(J);$[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 $}getViolations(Z){if(Z)return this.violations.filter(($)=>$.label===Z);return[...this.violations]}getViolationStats(){let Z={},$=0,J=0;for(let Y of this.violations)if(Z[Y.label]=(Z[Y.label]||0)+1,Y.isWarning)$++;else J++;return{total:this.violations.length,byLabel:Z,warnings:$,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 TJ(){if(!xZ)xZ=new A$;return xZ}var R5,wJ=500,R_,xZ=null,R$;var T5=P(()=>{R5=new Map;R_=new N$;R$=new Proxy({},{get(Z,$){return TJ()[$]}})});function w$(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 T$(Z,$,J={}){let{prefix:Y="",preserveHost:Q=!0,scopeKeyframes:X=!0,scopeCustomProperties:G=!1}=J;if(!Z.trim())return"";let K=fZ(Z),q=[],U=new Map;if(X)for(let _ of K){let W=_.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(W){let z=W[1],j=`${$}_${z}`;U.set(z,j)}}for(let _ of K){let W=M$(_,$,Y,Q,U,G);q.push(W)}return q.join(`
733
+ `),Q.set(U,_)}return _(...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 I6{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 y2(){if(!f$)f$=new I6;return f$}var A1,b2=500,b_,f$=null,E6;var T1=P(()=>{A1=new Map;b_=new M6;E6=new Proxy({},{get($,Z){return y2()[Z]}})});function D6($,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 k6($,Z,J={}){let{prefix:Y="",preserveHost:Q=!0,scopeKeyframes:X=!0,scopeCustomProperties:G=!1}=J;if(!$.trim())return"";let K=g$($),q=[],U=new Map;if(X)for(let _ of K){let W=_.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(W){let z=W[1],j=`${Z}_${z}`;U.set(z,j)}}for(let _ of K){let W=S6(_,Z,Y,Q,U,G);q.push(W)}return q.join(`
734
734
 
735
- `)}function fZ(Z){let $=[],J=Z.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 U=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(U){let[,_,W,z]=U;if(_==="keyframes")$.push({selector:`@keyframes ${W.trim()}`,declarations:z.trim()});else if(_==="media"||_==="supports"||_==="container"){let j=fZ(z);$.push({selector:`@${_} ${W.trim()}`,declarations:j.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
736
- `)})}else $.push({selector:`@${_} ${W.trim()}`,declarations:z.trim()})}G="",X=!1}else if(Q.trim()){Q+=q;let U=Q.match(/([^{]+)\{([^}]*)\}/);if(U)$.push({selector:U[1].trim(),declarations:U[2].trim()});Q=""}continue}}if(X)G+=q;else Q+=q}return $}function M$(Z,$,J,Y,Q,X){let{selector:G,declarations:K}=Z;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let _=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(_)||_} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let W=fZ(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>M$(z,$,J,Y,Q,X)).join(`
735
+ `)}function g$($){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 U=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(U){let[,_,W,z]=U;if(_==="keyframes")Z.push({selector:`@keyframes ${W.trim()}`,declarations:z.trim()});else if(_==="media"||_==="supports"||_==="container"){let j=g$(z);Z.push({selector:`@${_} ${W.trim()}`,declarations:j.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
736
+ `)})}else Z.push({selector:`@${_} ${W.trim()}`,declarations:z.trim()})}G="",X=!1}else if(Q.trim()){Q+=q;let U=Q.match(/([^{]+)\{([^}]*)\}/);if(U)Z.push({selector:U[1].trim(),declarations:U[2].trim()});Q=""}continue}}if(X)G+=q;else Q+=q}return Z}function S6($,Z,J,Y,Q,X){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let _=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(_)||_} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let W=g$(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>S6(z,Z,J,Y,Q,X)).join(`
737
737
  `);return`${G} {
738
738
  ${W}
739
- }`}return`${G} { ${K} }`}let q=MJ(G,$,J,Y),U=K;for(let[_,W]of Q)U=U.replace(new RegExp(`\\b${_}\\b`,"g"),W);if(X)U=U.replace(/--([a-z-]+)/gi,`--${$}-$1`);return`${q} { ${U} }`}function MJ(Z,$,J,Y){let Q=Z.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(\([^)]*\))?/,`.${$}$1`);X.push(q)}continue}if(G.includes("::slotted")){X.push(G);continue}if(G===":root"){X.push(`:root .${$}`);continue}let K=J?`${J} .${$}`:`.${$}`;X.push(`${K} ${G}`)}return X.join(", ")}function F7(Z,$){if(!/<style\s+[^>]*\bscoped\b/i.test(Z))return{html:Z,hasScoped:!1};let J=w$($),Y=`data-v-${J}`,Q=Z,X=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(X,(K,q,U)=>{G=!0;let _=IJ(U,Y),W=q.replace(/\bscoped\b/gi,"").trim(),z=W?` ${W}`:"";return`<style data-stx-scoped="${J}"${z}>${_}</style>`}),!G)return{html:Z,hasScoped:!1};return Q=EJ(Q,Y),{html:Q,hasScoped:!0}}function IJ(Z,$){return T$(Z,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${$}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${$}]`)}function EJ(Z,$){let J=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return Z.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,Q,X)=>{if(J.has(Q.toLowerCase()))return Y;if(Y.includes($))return Y;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return Y;if(X)return Y.replace(`<${Q}${X}`,`<${Q} ${$}${X}`);if(Y.endsWith("/>"))return`<${Q} ${$} />`;return`<${Q} ${$}>`})}var gZ=()=>{};var I$=()=>{};function I4(Z,$,J,Y=0){let Q=0,X=Y,G=null,K=0,q=!1;while(X<Z.length){let U=Z[X];if(G&&q){q=!1,X++;continue}if(G&&U==="\\"){q=!0,X++;continue}if(q=!1,(U==='"'||U==="'"||U==="`")&&!G){G=U,X++;continue}if(U===G&&G!=="`"){G=null,X++;continue}if(G==="`"&&U==="$"&&Z[X+1]==="{"){K++,X+=2;continue}if(K>0&&U==="}"){K--,X++;continue}if(U==="`"&&G==="`"&&K===0){G=null,X++;continue}if(G){X++;continue}if(U===$)Q++;else if(U===J){if(Q--,Q===0)return X}X++}return-1}var hZ={};r(hZ,{useTitle:()=>CJ,useSeoMeta:()=>N7,usePageTitle:()=>CJ,useHead:()=>_5,resetHead:()=>SJ,renderHtmlAttrs:()=>vJ,renderHead:()=>PJ,renderBodyAttrs:()=>xJ,processTitleDirective:()=>hJ,processMetaDirective:()=>dJ,processHeadDirective:()=>gJ,getPageMeta:()=>kJ,getHead:()=>i5,definePageMeta:()=>yJ,applyHead:()=>fJ});function i5(){return s4}function kJ(){return V7}function SJ(){s4={},DJ.length=0,V7={}}function _5(Z){s4=bJ(s4,Z)}function bJ(Z,$){return{title:$.title??Z.title,titleTemplate:$.titleTemplate??Z.titleTemplate,base:$.base??Z.base,meta:[...Z.meta||[],...$.meta||[]],link:[...Z.link||[],...$.link||[]],script:[...Z.script||[],...$.script||[]],style:[...Z.style||[],...$.style||[]],htmlAttrs:{...Z.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...Z.bodyAttrs,...$.bodyAttrs}}}function N7(Z){let $=[];if(Z.description)$.push({name:"description",content:Z.description});if(Z.keywords){let q=Array.isArray(Z.keywords)?Z.keywords.join(", "):Z.keywords;$.push({name:"keywords",content:q})}if(Z.author)$.push({name:"author",content:Z.author});if(Z.robots)$.push({name:"robots",content:Z.robots});let J=Z.ogTitle??Z.title,Y=Z.ogDescription??Z.description;if(J)$.push({property:"og:title",content:J});if(Y)$.push({property:"og:description",content:Y});if(Z.ogImage)$.push({property:"og:image",content:Z.ogImage});if(Z.ogUrl)$.push({property:"og:url",content:Z.ogUrl});if(Z.ogType)$.push({property:"og:type",content:Z.ogType});if(Z.ogSiteName)$.push({property:"og:site_name",content:Z.ogSiteName});if(Z.ogLocale)$.push({property:"og:locale",content:Z.ogLocale});let Q=Z.twitterTitle??Z.title,X=Z.twitterDescription??Z.description,G=Z.twitterImage??Z.ogImage;if(Z.twitterCard)$.push({name:"twitter:card",content:Z.twitterCard});if(Q)$.push({name:"twitter:title",content:Q});if(X)$.push({name:"twitter:description",content:X});if(G)$.push({name:"twitter:image",content:G});if(Z.twitterSite)$.push({name:"twitter:site",content:Z.twitterSite});if(Z.twitterCreator)$.push({name:"twitter:creator",content:Z.twitterCreator});if(Z.articleAuthor)$.push({property:"article:author",content:Z.articleAuthor});if(Z.articlePublishedTime)$.push({property:"article:published_time",content:Z.articlePublishedTime});if(Z.articleModifiedTime)$.push({property:"article:modified_time",content:Z.articleModifiedTime});if(Z.articleSection)$.push({property:"article:section",content:Z.articleSection});if(Z.articleTags)for(let q of Z.articleTags)$.push({property:"article:tag",content:q});let K=[];if(Z.canonical)K.push({rel:"canonical",href:Z.canonical});_5({title:Z.title,titleTemplate:Z.titleTemplate,meta:$,link:K})}function yJ(Z){if(V7={...V7,...Z},Z.title||Z.description)N7({title:Z.title,description:Z.description})}function CJ(Z){let $=typeof Z==="function"?Z():Z;_5({title:$})}function PJ(Z=s4){let $=[];if(Z.title){let J=Z.title;if(Z.titleTemplate)J=typeof Z.titleTemplate==="function"?Z.titleTemplate(J):Z.titleTemplate.replace("%s",J);$.push(`<title>${q5(J)}</title>`)}if(Z.base){let J=Object.entries(Z.base).map(([Y,Q])=>`${Y}="${q5(Q)}"`).join(" ");$.push(`<base ${J}>`)}for(let J of Z.meta||[]){let Y=Object.entries(J).filter(([Q,X])=>X!==void 0).map(([Q,X])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${q5(String(X))}"`}).join(" ");$.push(`<meta ${Y}>`)}for(let J of Z.link||[]){let Y=Object.entries(J).filter(([Q,X])=>X!==void 0).map(([Q,X])=>`${Q}="${q5(String(X))}"`).join(" ");$.push(`<link ${Y}>`)}for(let J of Z.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}="${q5(String(K))}"`}).filter(Boolean).join(" ");if(Y)$.push(`<script ${X}>${Y}</script>`);else $.push(`<script ${X}></script>`)}for(let J of Z.style||[]){let Y=J.type?` type="${J.type}"`:"";$.push(`<style${Y}>${J.content}</style>`)}return $.join(`
740
- `)}function vJ(Z=s4){if(!Z.htmlAttrs)return"";return Object.entries(Z.htmlAttrs).map(([$,J])=>`${$}="${q5(J)}"`).join(" ")}function xJ(Z=s4){if(!Z.bodyAttrs)return"";return Object.entries(Z.bodyAttrs).map(([$,J])=>`${$}="${q5(J)}"`).join(" ")}function q5(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function fJ(Z=s4){if(typeof document>"u")return;if(Z.title){let $=Z.title;if(Z.titleTemplate)$=typeof Z.titleTemplate==="function"?Z.titleTemplate($):Z.titleTemplate.replace("%s",$);document.title=$}for(let $ of Z.meta||[]){let J=$.name?`meta[name="${$.name}"]`:$.property?`meta[property="${$.property}"]`:null;if(J){let Y=document.querySelector(J);if(!Y){if(Y=document.createElement("meta"),$.name)Y.setAttribute("name",$.name);if($.property)Y.setAttribute("property",$.property);document.head.appendChild(Y)}Y.setAttribute("content",$.content)}}for(let $ of Z.link||[]){let J=`link[rel="${$.rel}"]${$.href?`[href="${$.href}"]`:""}`,Y=document.querySelector(J);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[Q,X]of Object.entries($))if(X!==void 0)Y.setAttribute(Q,String(X))}if(Z.htmlAttrs)for(let[$,J]of Object.entries(Z.htmlAttrs))document.documentElement.setAttribute($,J);if(Z.bodyAttrs)for(let[$,J]of Object.entries(Z.bodyAttrs))document.body.setAttribute($,J)}function gJ(Z){let $="";return{content:Z.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,Q)=>{return $+=Q.trim()+`
741
- `,""}),headContent:$.trim()}}function hJ(Z,$){return Z.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(J,Y,Q,X)=>{let G=Y?Q:$[(X||"").trim()]??X;return _5({title:G}),""})}function dJ(Z,$){return Z.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(J,Y,Q,X,G,K)=>{let q=X?G:K,U=X?q:$[(q||"").trim()]??q,W=Q.includes(":")?{property:Q,content:U}:{name:Q,content:U};return _5({meta:[W]}),""})}var s4,DJ,V7;var n5=P(()=>{s4={},DJ=[],V7={}});var A7={};r(A7,{stripTypeScript:()=>S$,hasVariables:()=>x$,extractVariables:()=>b$,extractScriptFromTemplate:()=>v$,convertToCommonJS:()=>mZ});import s5 from"path";function mJ(Z){let $=[],J=0,Y=Z.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)$.push(K[1]);else{let q=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let _=q[1].slice(1,-1).split(",").map((W)=>{let z=W.split(":");return(z.length>1?z[1]:z[0]).trim()}).filter((W)=>/^\w+$/.test(W));$.push(..._)}}}}return[...new Set($)]}function S$(Z){let $=Z;$=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function J(Y){if(!Y.includes(":"))return Y;let Q=[],X="",G=0,K=0,q=null;for(let U=0;U<Y.length;U++){let _=Y[U];if(q){if(X+=_,_===q)q=null;continue}if(_==='"'||_==="'"||_==="`"){q=_,X+=_;continue}if(_==="<")G++;else if(_===">"&&G>0)G--;else if(_==="(")K++;else if(_===")")K--;if(_===","&&G===0&&K===0){Q.push(X),X="";continue}X+=_}if(X)Q.push(X);return Q.map((U)=>{let _=U.trim(),W=_.startsWith("..."),z=W?_.slice(3):_,j=-1,B=0;for(let N=0;N<z.length;N++)if(z[N]==="<")B++;else if(z[N]===">")B--;else if(z[N]===":"&&B===0){j=N;break}if(j===-1)return U;let F=z.substring(0,j).trim().replace(/\?$/,""),L=z.substring(j+1),O=-1,V=0;for(let N=0;N<L.length;N++)if(L[N]==="<")V++;else if(L[N]===">")V--;else if(L[N]==="="&&V===0){O=N;break}let A=W?"...":"";if(O!==-1)return`${A}${F} = ${L.substring(O+1).trim()}`;return`${A}${F}`}).join(", ")}$=$.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($))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,U=0,_=null;while(q<$.length&&K>0){let j=$[q];if(_){if(j===_)_=null;q++;continue}if(j==='"'||j==="'"||j==="`"){_=j,q++;continue}if(j==="<")U++;else if(j===">"&&U>0)U--;else if(U===0){if(j==="(")K++;else if(j===")")K--}if(K>0)q++}if(K!==0)continue;let W=$.substring(G+1,q);if(!W.includes(":"))continue;let z=J(W);X.push({start:G+1,end:q,replacement:z})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:U}=X[G];$=$.substring(0,K)+U+$.substring(q)}}return $=$.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("="),U=K.split(":")[0].trim();if(q.length>0)return`${U} = ${q.join("=").trim()}`;return U}).join(", ")}) =>`}),$=$.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),$=$.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),$=$.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),$=$.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),$=$.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
739
+ }`}return`${G} { ${K} }`}let q=C2(G,Z,J,Y),U=K;for(let[_,W]of Q)U=U.replace(new RegExp(`\\b${_}\\b`,"g"),W);if(X)U=U.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${U} }`}function C2($,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 F5($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let J=D6(Z),Y=`data-v-${J}`,Q=$,X=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(X,(K,q,U)=>{G=!0;let _=P2(U,Y),W=q.replace(/\bscoped\b/gi,"").trim(),z=W?` ${W}`:"";return`<style data-stx-scoped="${J}"${z}>${_}</style>`}),!G)return{html:$,hasScoped:!1};return Q=v2(Q,Y),{html:Q,hasScoped:!0}}function P2($,Z){return k6($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function v2($,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 h$=()=>{};var b6=()=>{};function I0($,Z,J,Y=0){let Q=0,X=Y,G=null,K=0,q=!1;while(X<$.length){let U=$[X];if(G&&q){q=!1,X++;continue}if(G&&U==="\\"){q=!0,X++;continue}if(q=!1,(U==='"'||U==="'"||U==="`")&&!G){G=U,X++;continue}if(U===G&&G!=="`"){G=null,X++;continue}if(G==="`"&&U==="$"&&$[X+1]==="{"){K++,X+=2;continue}if(K>0&&U==="}"){K--,X++;continue}if(U==="`"&&G==="`"&&K===0){G=null,X++;continue}if(G){X++;continue}if(U===Z)Q++;else if(U===J){if(Q--,Q===0)return X}X++}return-1}var d$={};r(d$,{useTitle:()=>m2,useSeoMeta:()=>N5,usePageTitle:()=>m2,useHead:()=>U1,resetHead:()=>g2,renderHtmlAttrs:()=>p2,renderHead:()=>u2,renderBodyAttrs:()=>l2,processTitleDirective:()=>n2,processMetaDirective:()=>o2,processHeadDirective:()=>i2,getPageMeta:()=>f2,getHead:()=>i1,definePageMeta:()=>d2,applyHead:()=>c2});function i1(){return s0}function f2(){return V5}function g2(){s0={},x2.length=0,V5={}}function U1($){s0=h2(s0,$)}function h2($,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});U1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function d2($){if(V5={...V5,...$},$.title||$.description)N5({title:$.title,description:$.description})}function m2($){let Z=typeof $==="function"?$():$;U1({title:Z})}function u2($=s0){let Z=[];if($.title){let J=$.title;if($.titleTemplate)J=typeof $.titleTemplate==="function"?$.titleTemplate(J):$.titleTemplate.replace("%s",J);Z.push(`<title>${_1(J)}</title>`)}if($.base){let J=Object.entries($.base).map(([Y,Q])=>`${Y}="${_1(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}="${_1(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}="${_1(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}="${_1(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 p2($=s0){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,J])=>`${Z}="${_1(J)}"`).join(" ")}function l2($=s0){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,J])=>`${Z}="${_1(J)}"`).join(" ")}function _1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function c2($=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 i2($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,Q)=>{return Z+=Q.trim()+`
741
+ `,""}),headContent:Z.trim()}}function n2($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(J,Y,Q,X)=>{let G=Y?Q:Z[(X||"").trim()]??X;return U1({title:G}),""})}function o2($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(J,Y,Q,X,G,K)=>{let q=X?G:K,U=X?q:Z[(q||"").trim()]??q,W=Q.includes(":")?{property:Q,content:U}:{name:Q,content:U};return U1({meta:[W]}),""})}var s0,x2,V5;var n1=P(()=>{s0={},x2=[],V5={}});var R5={};r(R5,{stripTypeScript:()=>v6,hasVariables:()=>m6,extractVariables:()=>x6,extractScriptFromTemplate:()=>d6,convertToCommonJS:()=>u$});import o1 from"path";function s2($){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 _=q[1].slice(1,-1).split(",").map((W)=>{let z=W.split(":");return(z.length>1?z[1]:z[0]).trim()}).filter((W)=>/^\w+$/.test(W));Z.push(..._)}}}}return[...new Set(Z)]}function v6($){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 U=0;U<Y.length;U++){let _=Y[U];if(q){if(X+=_,_===q)q=null;continue}if(_==='"'||_==="'"||_==="`"){q=_,X+=_;continue}if(_==="<")G++;else if(_===">"&&G>0)G--;else if(_==="(")K++;else if(_===")")K--;if(_===","&&G===0&&K===0){Q.push(X),X="";continue}X+=_}if(X)Q.push(X);return Q.map((U)=>{let _=U.trim(),W=_.startsWith("..."),z=W?_.slice(3):_,j=-1,B=0;for(let N=0;N<z.length;N++)if(z[N]==="<")B++;else if(z[N]===">")B--;else if(z[N]===":"&&B===0){j=N;break}if(j===-1)return U;let F=z.substring(0,j).trim().replace(/\?$/,""),L=z.substring(j+1),H=-1,V=0;for(let N=0;N<L.length;N++)if(L[N]==="<")V++;else if(L[N]===">")V--;else if(L[N]==="="&&V===0){H=N;break}let R=W?"...":"";if(H!==-1)return`${R}${F} = ${L.substring(H+1).trim()}`;return`${R}${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,U=0,_=null;while(q<Z.length&&K>0){let j=Z[q];if(_){if(j===_)_=null;q++;continue}if(j==='"'||j==="'"||j==="`"){_=j,q++;continue}if(j==="<")U++;else if(j===">"&&U>0)U--;else if(U===0){if(j==="(")K++;else if(j===")")K--}if(K>0)q++}if(K!==0)continue;let W=Z.substring(G+1,q);if(!W.includes(":"))continue;let z=J(W);X.push({start:G+1,end:q,replacement:z})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:U}=X[G];Z=Z.substring(0,K)+U+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("="),U=K.split(":")[0].trim();if(q.length>0)return`${U} = ${q.join("=").trim()}`;return U}).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
- `),$}async function b$(Z,$,J){if(!Z.trim())return;let Y;try{let C=new Bun.Transpiler({loader:"ts",target:"browser"}),v=Z.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=C.transformSync(v)}catch{Y=S$(Z)}let Q={exports:{}},X=Q.exports,G=process.cwd(),K={},q=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of q)try{let v=s5.resolve(G,"node_modules",C),x=s5.join(v,"package.json"),l=JSON.parse(J4("fs").readFileSync(x,"utf8")),g=l.main||"index.js";if(l.exports){let m=typeof l.exports==="string"?l.exports:l.exports["."];if(typeof m==="string")g=m;else if(m?.bun)g=m.bun;else if(m?.import)g=m.import;else if(m?.default)g=m.default}K[C]=await import(s5.resolve(v,g))}catch{}let U=(C)=>{if(K[C])return K[C];return J4(C)},_=$.props||{},W=Object.assign((C)=>{if(!C)return _;let v={};for(let[x,l]of Object.entries(C)){let g=_[x];if(g!==void 0)v[x]=g;else if(typeof l==="function")v[x]=l();else v[x]=l}return v},_),z=()=>_,j=(C,v)=>{let x={...C};for(let[l,g]of Object.entries(v))if(x[l]===void 0)if(typeof g==="function")x[l]=g();else x[l]=g;return x},B=(C)=>{let v=()=>C;return v.set=(x)=>{},v.update=(x)=>{},v},H=(C)=>{let v,x=!1;return()=>{if(!x)try{v=C(),x=!0}catch{v=void 0}return v}},F=(C)=>{},L=(C)=>C(),O=(C)=>{},V=(C)=>{},A=(C)=>{},N=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),R=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),w=(C)=>{_5(C);let v=$.__stx_runtime_head||{},x=C||{};$.__stx_runtime_head={...v,...x.title&&{title:x.title},meta:[...v.meta||[],...x.meta||[]],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],htmlAttrs:{...v.htmlAttrs||{},...x.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs||{}}}},M=(C)=>{N7(C);let v=i5();$.__stx_runtime_head={...$.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},E=(C)=>({value:C}),T=(C)=>C,I=(C)=>({value:typeof C==="function"?C():C}),D=(C,v)=>{},y=(C)=>{},b=(C)=>{},S=(C)=>C?C():Promise.resolve(),k=(C)=>(v,...x)=>{},f=(C)=>{},h=(C,v)=>{},p=(C,v)=>v,z4=()=>({value:"light"}),M4=()=>({value:!1}),U4={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:{}},b4=new Proxy(U4,{get(C,v){if(v in C)return C[v];return},set(C,v,x){return C[v]=x,!0}}),P4={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},L4=console;try{let C=mZ(Y,J),v=new Set(Object.keys(_)),x=Object.keys($).filter((t)=>!v.has(t)&&t!=="props"),l=x.map((t)=>$[t]),g=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"]),m=[],_4=[];for(let[t,MZ]of Object.entries(_)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(g.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(C))continue;m.push(t),_4.push(MZ)}let G4=mJ(C).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
745
- `),F4=$.params??{},v4=[],x4=[];for(let t=0;t<x.length;t++){if(x[t]==="params")continue;v4.push(x[t]),x4.push(l[t])}let TZ=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",...m,...v4,`return (async () => {
744
+ `),Z}async function x6($,Z,J){if(!$.trim())return;let Y;try{let C=new Bun.Transpiler({loader:"ts",target:"browser"}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=C.transformSync(v)}catch{Y=v6($)}let Q={exports:{}},X=Q.exports,G=process.cwd(),K={},q=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of q)try{let v=o1.resolve(G,"node_modules",C),x=o1.join(v,"package.json"),l=JSON.parse(J0("fs").readFileSync(x,"utf8")),g=l.main||"index.js";if(l.exports){let m=typeof l.exports==="string"?l.exports:l.exports["."];if(typeof m==="string")g=m;else if(m?.bun)g=m.bun;else if(m?.import)g=m.import;else if(m?.default)g=m.default}K[C]=await import(o1.resolve(v,g))}catch{}let U=(C)=>{if(K[C])return K[C];return J0(C)},_=Z.props||{},W=Object.assign((C)=>{if(!C)return _;let v={};for(let[x,l]of Object.entries(C)){let g=_[x];if(g!==void 0)v[x]=g;else if(typeof l==="function")v[x]=l();else v[x]=l}return v},_),z=()=>_,j=(C,v)=>{let x={...C};for(let[l,g]of Object.entries(v))if(x[l]===void 0)if(typeof g==="function")x[l]=g();else x[l]=g;return x},B=(C)=>{let v=()=>C;return v.set=(x)=>{},v.update=(x)=>{},v},O=(C)=>{let v,x=!1;return()=>{if(!x)try{v=C(),x=!0}catch{v=void 0}return v}},F=(C)=>{},L=(C)=>C(),H=(C)=>{},V=(C)=>{},R=(C)=>{},N=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),A=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),w=(C)=>{U1(C);let v=Z.__stx_runtime_head||{},x=C||{};Z.__stx_runtime_head={...v,...x.title&&{title:x.title},meta:[...v.meta||[],...x.meta||[]],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],htmlAttrs:{...v.htmlAttrs||{},...x.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs||{}}}},M=(C)=>{N5(C);let v=i1();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},E=(C)=>({value:C}),T=(C)=>C,I=(C)=>({value:typeof C==="function"?C():C}),D=(C,v)=>{},y=(C)=>{},b=(C)=>{},S=(C)=>C?C():Promise.resolve(),k=(C)=>(v,...x)=>{},f=(C)=>{},h=(C,v)=>{},p=(C,v)=>v,z0=()=>({value:"light"}),M0=()=>({value:!1}),U0={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:{}},b0=new Proxy(U0,{get(C,v){if(v in C)return C[v];return},set(C,v,x){return C[v]=x,!0}}),P0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},L0=console;try{let C=u$(Y,J),v=new Set(Object.keys(_)),x=Object.keys(Z).filter((t)=>!v.has(t)&&t!=="props"),l=x.map((t)=>Z[t]),g=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"]),m=[],_0=[];for(let[t,I$]of Object.entries(_)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(g.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(C))continue;m.push(t),_0.push(I$)}let G0=s2(C).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
745
+ `),F0=Z.params??{},v0=[],x0=[];for(let t=0;t<x.length;t++){if(x[t]==="params")continue;v0.push(x[t]),x0.push(l[t])}let M$=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",...m,...v0,`return (async () => {
746
746
  ${C}
747
- ${G4}
747
+ ${G0}
748
748
  return module.exports
749
- })()`)(Q,X,U,_,W,z,j,B,H,F,L,O,V,A,N,R,w,M,E,T,I,D,y,b,S,k,f,h,p,z4,M4,b4,P4,L4,U4.confirm,U4.alert,U4.fetch,F4,..._4,...x4);Object.assign($,TZ);for(let[t,MZ]of Object.entries(_))if(!(t in $))$[t]=MZ}catch{try{await lJ(Y,$,J)}catch{}}}function mZ(Z,$){let J=$?s5.dirname($):process.cwd(),Y=Z.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 U=X;U<Y.length&&!q;U++){let _=null,W=!1,z=Y[U];for(let j=0;j<z.length;j++){let B=z[j];if(W){W=!1;continue}if(B==="\\"){W=!0;continue}if(_){if(B===_)_=null;continue}if(B==='"'||B==="'"||B==="`"){_=B;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0){X=U+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+['"](.+)['"]/),U=G.match(/^import\s+['"](.+)['"]/),_=(W)=>{if(W.startsWith("."))return s5.resolve(J,W);return W};if(K){let[,W,z]=K,j=_(z);Q.push(`const ${W} = await import('${j}')`),Q.push(`module.exports.${W} = ${W};`)}else if(q){let[,W,z]=q,j=W.trim(),B=_(z);Q.push(`const { ${j} } = await import('${B}')`);for(let H of j.split(",")){let F=H.trim().split(/\s+as\s+/).pop()?.trim();if(F)Q.push(`module.exports.${F} = ${F};`)}}else if(U){let W=_(U[1]);Q.push(`await import('${W}')`)}else Q.push(G);X++;continue}if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=E$(Y,X),{type:q,name:U,value:_}=K;Q.push(`${q} ${U} = ${_};`),Q.push(`module.exports.${U} = ${U};`),X=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=dZ(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=E$(Y,X),{type:q,name:U,value:_}=K;Q.push(`${q} ${U} = ${_};`),Q.push(`module.exports.${U} = ${U};`),X=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=dZ(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 U=dZ(q,X);if(Q.push(U.functionCode),U.name)Q.push(`module.exports.default = ${U.name};`);X=U.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],U=Y[X].replace(/^export\s+/,""),_=0,W=X;for(;W<Y.length;W++){let z=Y[W];for(let j of z)if(j==="{")_++;else if(j==="}")_--;if(W>X)U+=`
749
+ })()`)(Q,X,U,_,W,z,j,B,O,F,L,H,V,R,N,A,w,M,E,T,I,D,y,b,S,k,f,h,p,z0,M0,b0,P0,L0,U0.confirm,U0.alert,U0.fetch,F0,..._0,...x0);Object.assign(Z,M$);for(let[t,I$]of Object.entries(_))if(!(t in Z))Z[t]=I$}catch{try{await t2(Y,Z,J)}catch{}}}function u$($,Z){let J=Z?o1.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 U=X;U<Y.length&&!q;U++){let _=null,W=!1,z=Y[U];for(let j=0;j<z.length;j++){let B=z[j];if(W){W=!1;continue}if(B==="\\"){W=!0;continue}if(_){if(B===_)_=null;continue}if(B==='"'||B==="'"||B==="`"){_=B;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0){X=U+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+['"](.+)['"]/),U=G.match(/^import\s+['"](.+)['"]/),_=(W)=>{if(W.startsWith("."))return o1.resolve(J,W);return W};if(K){let[,W,z]=K,j=_(z);Q.push(`const ${W} = await import('${j}')`),Q.push(`module.exports.${W} = ${W};`)}else if(q){let[,W,z]=q,j=W.trim(),B=_(z);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(U){let W=_(U[1]);Q.push(`await import('${W}')`)}else Q.push(G);X++;continue}if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=y6(Y,X),{type:q,name:U,value:_}=K;Q.push(`${q} ${U} = ${_};`),Q.push(`module.exports.${U} = ${U};`),X=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=m$(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=y6(Y,X),{type:q,name:U,value:_}=K;Q.push(`${q} ${U} = ${_};`),Q.push(`module.exports.${U} = ${U};`),X=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=m$(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 U=m$(q,X);if(Q.push(U.functionCode),U.name)Q.push(`module.exports.default = ${U.name};`);X=U.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],U=Y[X].replace(/^export\s+/,""),_=0,W=X;for(;W<Y.length;W++){let z=Y[W];for(let j of z)if(j==="{")_++;else if(j==="}")_--;if(W>X)U+=`
751
751
  `+z;if(_<=0&&W>=X)break}Q.push(U),Q.push(`module.exports.${q} = ${q};`),X=W+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 y$(Z,$){let J=Z[$];if(J!=="{"&&J!=="[")return null;let Q=I4(Z,J,J==="{"?"}":"]",$);if(Q===-1)return null;return{pattern:Z.slice($,Q+1),endPos:Q+1}}function C$(Z){let $=[],J=Z.slice(1,-1).trim();if(!J)return $;let Y=0,Q=0,X="";while(Y<J.length){let G=J[Y];if(G==="{"||G==="["){if(Q++,Q===1){let K=y$(J,Y);if(K){let q=C$(K.pattern);$.push(...q),Y=K.endPos,X="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){Y++;continue}if(G===","){if(X.trim())$.push(X.trim());X="",Y++;continue}if(G===":"){X="",Y++;continue}if(G==="="){if(X.trim())$.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())$.push(X.trim());return $}function E$(Z,$){let J=Z[$].trim(),Y=J.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!Y){let U=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let _=J.slice(U[0].length),W=$;if((_.startsWith("{")||_.startsWith("["))&&!_.includes(_.startsWith("{")?"}":"]")){let j=_.startsWith("{")?"}":"]",B=_;for(let H=$+1;H<Z.length;H++)if(B+=" "+Z[H].trim(),W=H,Z[H].includes(j))break;_=B}let z=y$(_,0);if(z){let j=U[1],B=z.pattern,H=_.slice(z.endPos).trim();if(H.startsWith("=")){let F=H.slice(1).trim(),L=F,O=Math.max(W,$);if(D$(F)){let R=k$(Z,O,F);L=R.value,O=R.nextIndex}else O=O+1;L=L.trim().replace(/;$/,"");let V=C$(B),A=`__stx_src_${$}`,N=V.map((R)=>`module.exports.${R} = ${R};`).join(`
753
- `);return{type:j,name:A,value:`${L}; ${j} ${B} = ${A};
754
- ${N}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,X,G]=Y,K=G,q=$;if(D$(G)){let U=k$(Z,$,G);K=U.value,q=U.nextIndex}else q=$+1;while(q<Z.length){let U=Z[q].trim();if(U.startsWith(".")||U.startsWith("?."))K+=`
755
- ${Z[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:X,value:K,nextIndex:q}}function dZ(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=$;if(uJ(J)){let K=pJ(Z,$,X);X=K.functionCode,G=K.nextIndex}else G=$+1;return{name:Q,functionCode:X,nextIndex:G}}function D$(Z){let $=Z.trim();if($.startsWith("{"))return I4($,"{","}",0)===-1;if($.startsWith("["))return I4($,"[","]",0)===-1;return!P$($)}function P$(Z){let $={paren:0,bracket:0,brace:0},J=null,Y=0;for(let Q=0;Q<Z.length;Q++){let X=Z[Q];if((Q>0?Z[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==="$"&&Z[Q+1]==="{"){Y++,Q++;continue}if(Y>0&&X==="{"){Y++;continue}if(Y>0&&X==="}"){Y--;continue}if(J)continue;if(X==="(")$.paren++;else if(X===")")$.paren--;else if(X==="[")$.bracket++;else if(X==="]")$.bracket--;else if(X==="{")$.brace++;else if(X==="}")$.brace--}return $.paren===0&&$.bracket===0&&$.brace===0&&J===null}function uJ(Z){let $=Z.indexOf("{");if($===-1)return!0;return I4(Z,"{","}",$)===-1}function k$(Z,$,J){let Y=J,Q=$+1;while(Q<Z.length&&!P$(Y)){let X=Z[Q];Y+=`
756
- ${X}`,Q++}while(Q<Z.length){let X=Z[Q].trim();if(X.startsWith(".")||X.startsWith("?."))Y+=`
757
- ${Z[Q]}`,Q++;else break}return{value:Y,nextIndex:Q}}function pJ(Z,$,J){let Y=J,Q=$+1;while(Q<Z.length){let X=Y.indexOf("{");if(X!==-1){if(I4(Y,"{","}",X)!==-1)break}let G=Z[Q];Y+=`
758
- ${G}`,Q++}return{functionCode:Y,nextIndex:Q}}async function lJ(Z,$,J){let Y=Z.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(/;$/,""),U=Function(`return ${q}`);$[G]=U()}catch{try{let q=K.trim().replace(/;$/,""),U=Function(`return (${q})`);$[G]=U()}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}}let Q=Z.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 $))try{let q=K.trim().replace(/;$/,""),U=Function(`return ${q}`);$[G]=U()}catch{}}try{let X=Z.replace(/^export\s+/gm,""),K=Function(`
752
+ `)}function f6($,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 g6($){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=f6(J,Y);if(K){let q=g6(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 y6($,Z){let J=$[Z].trim(),Y=J.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!Y){let U=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let _=J.slice(U[0].length),W=Z;if((_.startsWith("{")||_.startsWith("["))&&!_.includes(_.startsWith("{")?"}":"]")){let j=_.startsWith("{")?"}":"]",B=_;for(let O=Z+1;O<$.length;O++)if(B+=" "+$[O].trim(),W=O,$[O].includes(j))break;_=B}let z=f6(_,0);if(z){let j=U[1],B=z.pattern,O=_.slice(z.endPos).trim();if(O.startsWith("=")){let F=O.slice(1).trim(),L=F,H=Math.max(W,Z);if(C6(F)){let A=P6($,H,F);L=A.value,H=A.nextIndex}else H=H+1;L=L.trim().replace(/;$/,"");let V=g6(B),R=`__stx_src_${Z}`,N=V.map((A)=>`module.exports.${A} = ${A};`).join(`
753
+ `);return{type:j,name:R,value:`${L}; ${j} ${B} = ${R};
754
+ ${N}`,nextIndex:H}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,X,G]=Y,K=G,q=Z;if(C6(G)){let U=P6($,Z,G);K=U.value,q=U.nextIndex}else q=Z+1;while(q<$.length){let U=$[q].trim();if(U.startsWith(".")||U.startsWith("?."))K+=`
755
+ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:X,value:K,nextIndex:q}}function m$($,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(r2(J)){let K=a2($,Z,X);X=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:X,nextIndex:G}}function C6($){let Z=$.trim();if(Z.startsWith("{"))return I0(Z,"{","}",0)===-1;if(Z.startsWith("["))return I0(Z,"[","]",0)===-1;return!h6(Z)}function h6($){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 r2($){let Z=$.indexOf("{");if(Z===-1)return!0;return I0($,"{","}",Z)===-1}function P6($,Z,J){let Y=J,Q=Z+1;while(Q<$.length&&!h6(Y)){let X=$[Q];Y+=`
756
+ ${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 a2($,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 t2($,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(/;$/,""),U=Function(`return ${q}`);Z[G]=U()}catch{try{let q=K.trim().replace(/;$/,""),U=Function(`return (${q})`);Z[G]=U()}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(/;$/,""),U=Function(`return ${q}`);Z[G]=U()}catch{}}try{let X=$.replace(/^export\s+/gm,""),K=Function(`
759
759
  ${X}
760
760
  const result = {};
761
- ${Array.from(Z.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)).map((q)=>`if (typeof ${q[1]} !== 'undefined') result.${q[1]} = ${q[1]};`).join(`
761
+ ${Array.from($.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)).map((q)=>`if (typeof ${q[1]} !== 'undefined') result.${q[1]} = ${q[1]};`).join(`
762
762
  `)}
763
763
  return result;
764
- `)();Object.entries(K).forEach(([q,U])=>{if(U!==void 0&&!(q in $))$[q]=U})}catch{}}function v$(Z){let $=Z.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=$?$[1]:"",Y=$?Z.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):Z;return{scriptContent:J,templateWithoutScript:Y}}function x$(Z){let $=Z.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var o5=P(()=>{n5()});var m$={};r(m$,{renderSlot:()=>g$,processSlots:()=>d$,parseSlots:()=>f$,parseSlotElement:()=>iJ,extractSlotContent:()=>oJ,applySlots:()=>rJ});function cJ(Z,$){let J=1,Y=$,Q="<template",X="</template";while(Y<Z.length&&J>0){let G=Z.indexOf("<",Y);if(G===-1)break;if(Y=G,Z.startsWith(Q,Y)&&(Y+Q.length>=Z.length||/[\s>\/]/.test(Z[Y+Q.length]))){J++,Y+=Q.length;continue}if(Z.startsWith(X,Y)){let K=Z.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 f$(Z){let $={default:"",named:new Map},J=Z,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(Z))!==null){let[_,W,z,j,B]=X,H=W||z||j,F=X.index+_.length,L=cJ(Z,F);if(L!==-1){let O=Z.slice(F,L-11).trim();Q.push({start:X.index,end:L,slotName:H,content:O,propsBinding:B||void 0}),$.named.set(H,{name:H,content:O,propsBinding:B||void 0})}}Q.sort((_,W)=>W.start-_.start);for(let _ of Q)J=J.slice(0,_.start)+J.slice(_.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,j,B,H]=q,F=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(F+L).trim(),V=`<${W}${O?" "+O:""}>${H}</${W}>`;G.push({start:q.index,end:q.index+_.length,slotName:j,element:V})}let U=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=U.exec(J))!==null){let[_,W,z,j,B]=q,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(H+F).trim(),O=`<${W}${L?" "+L:""} />`;G.push({start:q.index,end:q.index+_.length,slotName:j,element:O})}G.sort((_,W)=>W.start-_.start);for(let _ of G){let W=$.named.get(_.slotName);if(W)W.content+=_.element;else $.named.set(_.slotName,{name:_.slotName,content:_.element});J=J.slice(0,_.start)+J.slice(_.end)}return $.default=J.trim(),$}function iJ(Z){let $=Z.match(/name\s*=\s*["']([^"']+)["']/),J=$?$[1]:"",Y={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=Q.exec(Z))!==null)Y[X[1]]=X[2];let G=Z.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:J,props:Y,defaultContent:K}}async function g$(Z,$,J,Y){if(!Z)return J;let Q=Z.content;if(Z.propsBinding&&Object.keys($).length>0){let X=Z.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[U,_]=q.split(":").map((z)=>z.trim()),W=_||U;if($[U]!==void 0)G[W]=$[U]}}else G[X]=$;Q=nJ(Q,G)}return Q}function nJ(Z,$){return Z.replace(/\{\{\s*([^}]+)\s*\}\}/g,(J,Y)=>{try{let Q=Y.trim(),X=h$(Q,$);return G5(String(X??""))}catch{return`{{ ${Y} }}`}})}function h$(Z,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(Z)){let Y=Z.split("."),Q=$;for(let X of Y)if(Q&&typeof Q==="object"&&X in Q)Q=Q[X];else return;return Q}let J=Z.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(J){let[,Y,Q,X]=J,G=$[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(Z))return;return Z4(Z,Object.keys($))(...Object.values($))}catch{return}}async function d$(Z,$,J){let Y=Z;Y=await sJ(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,U)=>{let _=$.named.get(K),W=U?.trim()||"",z=q||"",j={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=B.exec(z))!==null){let F=H[1],L=H[2];j[F]=h$(L,J)}return await g$(_,j,W,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 $.default||q}),Y}async function sJ(Z,$,J){let Y=[],Q=[];Z.replace($,(K,...q)=>{let U=q[q.length-2];return Q.push({match:K,index:U}),Y.push(J(K,...q.slice(0,-2))),K});let X=await Promise.all(Y),G=Z;for(let K=Q.length-1;K>=0;K--){let{match:q,index:U}=Q[K];G=G.slice(0,U)+X[K]+G.slice(U+q.length)}return G}function oJ(Z){let $=f$(Z);return{defaultSlot:$.default,namedSlots:$.named}}async function rJ(Z,$,J,Y){return await d$(Z,{default:$,named:J},Y)}var u$=P(()=>{n4();A4()});import aJ from"fs";import o from"path";function eJ(Z){return Z.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Z2(Z){return/\bjs\b/.test(Z)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(Z)}function X5(Z){return!Z2(Z)}function Q5(Z){try{let $=Z.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");$=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let J=[];$=$.replace(/\{!![\s\S]*?!!\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`}),$=$.replace(/\{\{\{[\s\S]*?\}\}\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`}),$=$.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"}).transformSync($);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($){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",$);return Z}}function $2(Z){let $=[],J=new Set,Y=0,Q=0,X=Z.length,G=(_)=>{Q++;while(Q<X){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===_){Q++;return}Q++}},K=()=>{Q++;while(Q<X){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let _=1;while(Q<X&&_>0)if(Z[Q]==="{")_++;else if(Z[Q]==="}")_--;else if(Z[Q]==="'"||Z[Q]==='"')G(Z[Q]);else if(Z[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<X&&Z[Q]!==`
765
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<X-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},U=()=>{if(Y!==0)return;let _=Z.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(_){let B=_[2].split(",").map((H)=>{let F=H.trim().split(":");return F[F.length-1].trim()});for(let H of B)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!J.has(H))$.push(H),J.add(H);return}let W=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!J.has(B))$.push(B),J.add(B);return}let z=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[1];if(!J.has(B))$.push(B),J.add(B);return}let j=Z.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))$.push(B),J.add(B)}};while(Q<X){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){G(Z[Q]);continue}if(Z[Q]==="`"){K();continue}if(Z[Q]==="{"){Y++,Q++;continue}if(Z[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))U();Q++}return $}async function U5(Z,$,J,Y,Q,X,G,K=new Set,q){let{extractVariables:U}=await Promise.resolve().then(() => (o5(),A7)),_=K??new Set;if(_.has(Z))return`[Circular component reference: ${Z}]`;let W=new Set(_);W.add(Z);try{let z=(C)=>C.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),B=Z.endsWith(".stx")?Z.slice(0,-4):Z,H=null,F=Q.__importedComponents;if(F){let C=[B,B.toLowerCase(),z(B),j(B)];for(let v of C)if(F.has(v)){H=F.get(v);break}}let L=[];if(!H){let C=[`${B}.stx`,`${z(B)}.stx`,`${j(B)}.stx`],v=[...new Set(C)],x=Q.__originalFilePath,l=[];if(x){let $4=o.join(o.dirname(x),"components");l.push($4)}if(Y)l.push(Y);let g=o.join(o.dirname(X),"components");if(!l.includes(g))l.push(g);if(G.componentsDir&&G.componentsDir!==Y&&!l.includes(G.componentsDir))l.push(G.componentsDir);let m=process.cwd(),_4=[o.resolve(m,"src/components"),o.resolve(m,"components"),o.resolve(import.meta.dir,"components")];for(let $4 of _4)if(!l.includes($4))l.push($4);if(B.startsWith("./")||B.startsWith("../"))H=o.resolve(o.dirname(X),`${B}.stx`),L.push(H);else for(let $4 of l){if(!$4)continue;for(let G4 of v){let F4=o.join($4,G4);if(L.push(F4),await c(F4)){H=F4;break}}if(H)break;if(!H)try{let G4=await import("fs");if(!G4.statSync($4,{throwIfNoEntry:!1})?.isDirectory())continue;let v4=G4.readdirSync($4,{withFileTypes:!0});for(let x4 of v4)if(x4.isDirectory()){let Y5=o.join($4,x4.name);for(let TZ of v){let t=o.join(Y5,TZ);if(L.push(t),await c(t)){H=t;break}}if(H)break}}catch{}if(H)break}}if(!H||!await c(H)){let C=L.length>0?`
764
+ `)();Object.entries(K).forEach(([q,U])=>{if(U!==void 0&&!(q in Z))Z[q]=U})}catch{}}function d6($){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 m6($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var s1=P(()=>{n1()});var i6={};r(i6,{renderSlot:()=>p6,processSlots:()=>c6,parseSlots:()=>u6,parseSlotElement:()=>$J,extractSlotContent:()=>JJ,applySlots:()=>XJ});function e2($,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 u6($){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,j,B]=X,O=W||z||j,F=X.index+_.length,L=e2($,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)=>W.start-_.start);for(let _ of Q)J=J.slice(0,_.start)+J.slice(_.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,j,B,O]=q,F=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(F+L).trim(),V=`<${W}${H?" "+H:""}>${O}</${W}>`;G.push({start:q.index,end:q.index+_.length,slotName:j,element:V})}let U=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=U.exec(J))!==null){let[_,W,z,j,B]=q,O=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+F).trim(),H=`<${W}${L?" "+L:""} />`;G.push({start:q.index,end:q.index+_.length,slotName:j,element:H})}G.sort((_,W)=>W.start-_.start);for(let _ of G){let W=Z.named.get(_.slotName);if(W)W.content+=_.element;else Z.named.set(_.slotName,{name:_.slotName,content:_.element});J=J.slice(0,_.start)+J.slice(_.end)}return Z.default=J.trim(),Z}function $J($){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 p6($,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[U,_]=q.split(":").map((z)=>z.trim()),W=_||U;if(Z[U]!==void 0)G[W]=Z[U]}}else G[X]=Z;Q=ZJ(Q,G)}return Q}function ZJ($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(J,Y)=>{try{let Q=Y.trim(),X=l6(Q,Z);return K1(String(X??""))}catch{return`{{ ${Y} }}`}})}function l6($,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 c6($,Z,J){let Y=$;Y=await YJ(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,U)=>{let _=Z.named.get(K),W=U?.trim()||"",z=q||"",j={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,O;while((O=B.exec(z))!==null){let F=O[1],L=O[2];j[F]=l6(L,J)}return await p6(_,j,W,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 YJ($,Z,J){let Y=[],Q=[];$.replace(Z,(K,...q)=>{let U=q[q.length-2];return Q.push({match:K,index:U}),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:U}=Q[K];G=G.slice(0,U)+X[K]+G.slice(U+q.length)}return G}function JJ($){let Z=u6($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function XJ($,Z,J,Y){return await c6($,{default:Z,named:J},Y)}var n6=P(()=>{o0();R0()});import QJ from"fs";import s from"path";function KJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qJ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function Q1($){return!qJ($)}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"}).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 _J($){let Z=[],J=new Set,Y=0,Q=0,X=$.length,G=(_)=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]===_){Q++;return}Q++}},K=()=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let _=1;while(Q<X&&_>0)if($[Q]==="{")_++;else if($[Q]==="}")_--;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},U=()=>{if(Y!==0)return;let _=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(_){let B=_[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 W=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!J.has(B))Z.push(B),J.add(B);return}let z=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[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])))U();Q++}return Z}async function W1($,Z,J,Y,Q,X,G,K=new Set,q){let{extractVariables:U}=await Promise.resolve().then(() => (s1(),R5)),_=K??new Set;if(_.has($))return`[Circular component reference: ${$}]`;let W=new Set(_);W.add($);try{let z=(C)=>C.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),B=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=Q.__importedComponents;if(F){let C=[B,B.toLowerCase(),z(B),j(B)];for(let v of C)if(F.has(v)){O=F.get(v);break}}let L=[];if(!O){let C=[`${B}.stx`,`${z(B)}.stx`,`${j(B)}.stx`],v=[...new Set(C)],x=Q.__originalFilePath,l=[];if(x){let Z0=s.join(s.dirname(x),"components");l.push(Z0)}if(Y)l.push(Y);let g=s.join(s.dirname(X),"components");if(!l.includes(g))l.push(g);if(G.componentsDir&&G.componentsDir!==Y&&!l.includes(G.componentsDir))l.push(G.componentsDir);let m=process.cwd(),_0=[s.resolve(m,"src/components"),s.resolve(m,"components"),s.resolve(import.meta.dir,"components")];for(let Z0 of _0)if(!l.includes(Z0))l.push(Z0);if(B.startsWith("./")||B.startsWith("../"))O=s.resolve(s.dirname(X),`${B}.stx`),L.push(O);else for(let Z0 of l){if(!Z0)continue;for(let G0 of v){let F0=s.join(Z0,G0);if(L.push(F0),await c(F0)){O=F0;break}}if(O)break;if(!O)try{let G0=await import("fs");if(!G0.statSync(Z0,{throwIfNoEntry:!1})?.isDirectory())continue;let v0=G0.readdirSync(Z0,{withFileTypes:!0});for(let x0 of v0)if(x0.isDirectory()){let J1=s.join(Z0,x0.name);for(let M$ of v){let t=s.join(J1,M$);if(L.push(t),await c(t)){O=t;break}}if(O)break}}catch{}if(O)break}}if(!O||!await c(O)){let C=L.length>0?`
766
766
  Searched paths:
767
767
  ${L.map((v)=>` - ${v}`).join(`
768
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${Z}']${C}`}q.add(H);let O;if(uZ.has(H))O=uZ.get(H);else try{O=await Bun.file(H).text(),uZ.set(H,O)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let V=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[C,v]of Object.entries(Q))if(!C.startsWith("__")||V.has(C))A[C]=v;let N={...A,...$,props:$,slot:J,__processedComponents:W,__sections:{}},R=O,w=R.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(w)R=w[1].trim();let M=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...O.matchAll(M)],T=[];for(let C of E){let v=C[1]||"",x=C[2]||"",l=v.includes("server");if(X5(v)&&x.trim())x=Q5(x);if(l&&x)try{await U(x,N,H)}catch(m){}if(!l){let m=x.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),_4=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");T.push(`<script${_4}>${m}</script>`)}}let I=O.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),D=I?I[1]:"",y=I?I[2]:"",b="",S=D&&/\bscoped\b/i.test(D);if(I)b=`<style${D}>${y}</style>`;let k=R;if(k=k.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),I)k=k.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(J&&k.includes("{{ text || slot }}"))k=k.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{extractSlotContent:f,applySlots:h}=await Promise.resolve().then(() => (u$(),m$)),{defaultSlot:p,namedSlots:z4}=f(J);k=await h(k,p||J,z4,N);for(let[C,v]of Object.entries(N))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let x=vZ(v);N[C]=x}}let M4=T.some((C)=>/\b(state|derived|effect)\s*\(/.test(C)),U4={...G,componentsDir:o.dirname(H),skipSignalsRuntime:!0,skipEventDirectives:M4,defaultLayout:void 0};N.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let b4=await o4(k,N,H,U4,q),P4=`stx_${B.replace(/[^a-zA-Z0-9]/g,"_")}_${++tJ}_${Math.random().toString(36).slice(2,8)}`,L4=b4;if(M4){let C="";if(Object.keys($).length>0)try{C=` data-stx-props="${eJ(JSON.stringify($))}"`}catch{}if(L4=`<div data-stx-scope="${P4}"${C}>${b4}</div>`,L4=T.map((x)=>{let l=x.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!l)return x;let[,g,m]=l,_4=i4(m),$4=`
768
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(O);let H;if(p$.has(O))H=p$.get(O);else try{H=await Bun.file(O).text(),p$.set(O,H)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let V=new Set(["__originalFilePath","__importedComponents"]),R={};for(let[C,v]of Object.entries(Q))if(!C.startsWith("__")||V.has(C))R[C]=v;let N={...R,...Z,props:Z,slot:J,__processedComponents:W,__sections:{}},A=H,w=A.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(w)A=w[1].trim();let M=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...H.matchAll(M)],T=[];for(let C of E){let v=C[1]||"",x=C[2]||"",l=v.includes("server");if(Q1(v)&&x.trim())x=G1(x);if(l&&x)try{await U(x,N,O)}catch(m){}if(!l){let m=x.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),_0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");T.push(`<script${_0}>${m}</script>`)}}let I=H.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),D=I?I[1]:"",y=I?I[2]:"",b="",S=D&&/\bscoped\b/i.test(D);if(I)b=`<style${D}>${y}</style>`;let k=A;if(k=k.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),I)k=k.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(J&&k.includes("{{ text || slot }}"))k=k.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{extractSlotContent:f,applySlots:h}=await Promise.resolve().then(() => (n6(),i6)),{defaultSlot:p,namedSlots:z0}=f(J);k=await h(k,p||J,z0,N);for(let[C,v]of Object.entries(N))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let x=x$(v);N[C]=x}}let M0=T.some((C)=>/\b(state|derived|effect)\s*\(/.test(C)),U0={...G,componentsDir:s.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:M0,defaultLayout:void 0};N.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let b0=await r0(k,N,O,U0,q),P0=`stx_${B.replace(/[^a-zA-Z0-9]/g,"_")}_${++GJ}_${Math.random().toString(36).slice(2,8)}`,L0=b0;if(M0){let C="";if(Object.keys(Z).length>0)try{C=` data-stx-props="${KJ(JSON.stringify(Z))}"`}catch{}if(L0=`<div data-stx-scope="${P0}"${C}>${b0}</div>`,L0=T.map((x)=>{let l=x.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!l)return x;let[,g,m]=l,_0=n0(m),Z0=`
769
769
  (function() {
770
770
  const { state, derived, effect, batch } = window.stx;
771
771
  const __scope = window.stx._scopes = window.stx._scopes || {};
772
- const __scopeVars = __scope['${P4}'] = __scope['${P4}'] || {};
772
+ const __scopeVars = __scope['${P0}'] = __scope['${P0}'] || {};
773
773
 
774
774
  // Scope-specific lifecycle callbacks
775
775
  __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
@@ -777,53 +777,53 @@ ${L.map((v)=>` - ${v}`).join(`
777
777
  const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
778
778
  const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
779
779
 
780
- ${_4}
780
+ ${_0}
781
781
 
782
782
  // Register all defined signals and functions in this scope
783
783
  const __localVars = {};
784
784
  try {
785
- ${$2(_4).map((G4)=>`if (typeof ${G4} !== 'undefined') __localVars['${G4}'] = ${G4};`).join(`
785
+ ${_J(_0).map((G0)=>`if (typeof ${G0} !== 'undefined') __localVars['${G0}'] = ${G0};`).join(`
786
786
  `)}
787
787
  }
788
788
  catch (e) {}
789
789
  Object.assign(__scopeVars, __localVars);
790
- })();`;return`<script data-stx-scoped${g}>${$4}</script>`}).join(`
790
+ })();`;return`<script data-stx-scoped${g}>${Z0}</script>`}).join(`
791
791
  `)+`
792
- `+L4,b)L4+=`
793
- `+b}else{if(b)L4+=`
794
- `+b;if(T.length>0){let C=N.__stx_event_bindings||[],v=await Promise.all(T.map(async(x)=>{let l=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!l)return x;return await j7(l[1],{eventBindings:C,templateContent:L4,filePath:H,projectRoot:process.cwd()})}));L4+=`
792
+ `+L0,b)L0+=`
793
+ `+b}else{if(b)L0+=`
794
+ `+b;if(T.length>0){let C=N.__stx_event_bindings||[],v=await Promise.all(T.map(async(x)=>{let l=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!l)return x;return await j5(l[1],{eventBindings:C,templateContent:L0,filePath:O,projectRoot:process.cwd()})}));L0+=`
795
795
  `+v.join(`
796
- `),N.__stx_event_bindings=[]}}if(S){let C=F7(L4,H);if(C.hasScoped)L4=C.html}return L4}catch(z){return`[Error processing component: ${z instanceof Error?z.message:String(z)}]`}finally{_.delete(Z)}}async function c(Z){return Bun.file(Z).exists()}async function pZ(Z,$,J,Y){if(J.debug)console.log(`Resolving template path: ${Z} from ${$}`);let Q=o.dirname($);if(Z.startsWith("/")){let W=o.join(process.cwd(),Z);if(J.debug)console.log(`Checking absolute path: ${W}`);if(await c(W)&&Y)Y.add(W);return W}let X=o.join(Q,Z);if(await c(X)){if(J.debug)console.log(`Found direct path: ${X}`);if(Y)Y.add(X);return X}if(!Z.endsWith(".stx")&&!Z.endsWith(".jsx")&&!Z.endsWith(".tsx"))for(let W of[".stx",".tsx",".jsx"]){let z=`${X}${W}`;if(await c(z)){if(J.debug)console.log(`Found direct path with extension: ${z}`);if(Y)Y.add(z);return z}}let G="",K=o.resolve(Q),q=process.cwd();for(let W=0;W<10;W++){let z=o.join(K,"layouts"),j=!1;try{j=aJ.statSync(z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){G=z;break}let B=o.dirname(K);if(B===K||B.length<q.length)break;K=B}if(G){let W=Z.startsWith("layouts/")?Z.slice(8):Z,z=o.join(G,W);if(await c(z)){if(J.debug)console.log(`Found in current layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!W.endsWith(".stx")){let j=`${z}.stx`;if(await c(j)){if(J.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(J.layoutsDir){let W=o.isAbsolute(J.layoutsDir)?J.layoutsDir:o.resolve(process.cwd(),J.layoutsDir),z=Z.startsWith("layouts/")?Z.slice(8):Z,j=o.join(W,z);if(await c(j)){if(J.debug)console.log(`Found in options.layoutsDir: ${j}`);if(Y)Y.add(j);return j}if(!Z.endsWith(".stx")){let B=`${j}.stx`;if(await c(B)){if(J.debug)console.log(`Found in options.layoutsDir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.startsWith("layouts/")||Z.includes("/layouts/")){let W=Z.split("layouts/"),z=o.join(J.partialsDir||Q,"layouts",W[1]);if(await c(z)){if(J.debug)console.log(`Found in layouts path: ${z}`);if(Y)Y.add(z);return z}if(!z.endsWith(".stx")){let j=`${z}.stx`;if(await c(j)){if(J.debug)console.log(`Found in layouts path with extension: ${j}`);if(Y)Y.add(j);return j}}}if(J.partialsDir){if(G=o.join(J.partialsDir,"layouts"),await c(G)){let W=o.join(G,Z);if(await c(W)){if(J.debug)console.log(`Found in partials layouts dir: ${W}`);if(Y)Y.add(W);return W}if(!Z.endsWith(".stx")){let z=`${W}.stx`;if(await c(z)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${z}`);if(Y)Y.add(z);return z}}}}let U=J.partialsDir||o.join(process.cwd(),"views"),_=o.join(U,Z);if(await c(_)){if(J.debug)console.log(`Found in views path: ${_}`);if(Y)Y.add(_);return _}if(!Z.endsWith(".stx")){let W=`${_}.stx`;if(await c(W)){if(J.debug)console.log(`Found in views path with extension: ${W}`);if(Y)Y.add(W);return W}}if(Q.includes("temp")){let W=o.join(o.dirname(Q),"layouts",Z);if(await c(W)){if(J.debug)console.log(`Found in temp layouts dir: ${W}`);if(Y)Y.add(W);return W}if(!Z.endsWith(".stx")){let z=`${W}.stx`;if(await c(z)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${z}`);if(Y)Y.add(z);return z}}}if(J.debug)console.warn(`Template not found after trying all paths: ${Z} (referenced from ${$})`);else console.warn(`Template not found: ${Z} (referenced from ${$})`);return null}function p$(Z,$,J){let Y=0,Q="",X="";try{if(typeof $==="number"&&$>=0){let G=Z.split(`
797
- `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=$){Y=q+1,Q=G[q].trim();let U=Math.max(0,q-2),_=Math.min(G.length,q+3);X=G.slice(U,_).map((W,z)=>{let j=U+z+1;return`${j===Y?"> ":" "}${j}: ${W}`}).join(`
798
- `);break}}else if(J){let G=Z.indexOf(J);if(G>=0)return p$(Z,G)}}catch{}return{lineNumber:Y,lineContent:Q,context:X}}function Q4(Z,$,J,Y,Q,X){let{lineNumber:G,context:K}=p$(Y,Q,X),q=J.split("/").pop(),U=`
796
+ `),N.__stx_event_bindings=[]}}if(S){let C=F5(L0,O);if(C.hasScoped)L0=C.html}return L0}catch(z){return`[Error processing component: ${z instanceof Error?z.message:String(z)}]`}finally{_.delete($)}}async function c($){return Bun.file($).exists()}async function l$($,Z,J,Y){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=s.dirname(Z);if($.startsWith("/")){let W=s.join(process.cwd(),$);if(J.debug)console.log(`Checking absolute path: ${W}`);if(await c(W)&&Y)Y.add(W);return W}let X=s.join(Q,$);if(await c(X)){if(J.debug)console.log(`Found direct path: ${X}`);if(Y)Y.add(X);return X}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let W of[".stx",".tsx",".jsx"]){let z=`${X}${W}`;if(await c(z)){if(J.debug)console.log(`Found direct path with extension: ${z}`);if(Y)Y.add(z);return z}}let G="",K=s.resolve(Q),q=process.cwd();for(let W=0;W<10;W++){let z=s.join(K,"layouts"),j=!1;try{j=QJ.statSync(z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){G=z;break}let B=s.dirname(K);if(B===K||B.length<q.length)break;K=B}if(G){let W=$.startsWith("layouts/")?$.slice(8):$,z=s.join(G,W);if(await c(z)){if(J.debug)console.log(`Found in current layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!W.endsWith(".stx")){let j=`${z}.stx`;if(await c(j)){if(J.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(J.layoutsDir){let W=s.isAbsolute(J.layoutsDir)?J.layoutsDir:s.resolve(process.cwd(),J.layoutsDir),z=$.startsWith("layouts/")?$.slice(8):$,j=s.join(W,z);if(await c(j)){if(J.debug)console.log(`Found in options.layoutsDir: ${j}`);if(Y)Y.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await c(B)){if(J.debug)console.log(`Found in options.layoutsDir with extension: ${B}`);if(Y)Y.add(B);return B}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let W=$.split("layouts/"),z=s.join(J.partialsDir||Q,"layouts",W[1]);if(await c(z)){if(J.debug)console.log(`Found in layouts path: ${z}`);if(Y)Y.add(z);return z}if(!z.endsWith(".stx")){let j=`${z}.stx`;if(await c(j)){if(J.debug)console.log(`Found in layouts path with extension: ${j}`);if(Y)Y.add(j);return j}}}if(J.partialsDir){if(G=s.join(J.partialsDir,"layouts"),await c(G)){let W=s.join(G,$);if(await c(W)){if(J.debug)console.log(`Found in partials layouts dir: ${W}`);if(Y)Y.add(W);return W}if(!$.endsWith(".stx")){let z=`${W}.stx`;if(await c(z)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${z}`);if(Y)Y.add(z);return z}}}}let U=J.partialsDir||s.join(process.cwd(),"views"),_=s.join(U,$);if(await c(_)){if(J.debug)console.log(`Found in views path: ${_}`);if(Y)Y.add(_);return _}if(!$.endsWith(".stx")){let W=`${_}.stx`;if(await c(W)){if(J.debug)console.log(`Found in views path with extension: ${W}`);if(Y)Y.add(W);return W}}if(Q.includes("temp")){let W=s.join(s.dirname(Q),"layouts",$);if(await c(W)){if(J.debug)console.log(`Found in temp layouts dir: ${W}`);if(Y)Y.add(W);return W}if(!$.endsWith(".stx")){let z=`${W}.stx`;if(await c(z)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${z}`);if(Y)Y.add(z);return z}}}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 o6($,Z,J){let Y=0,Q="",X="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
797
+ `),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 U=Math.max(0,q-2),_=Math.min(G.length,q+3);X=G.slice(U,_).map((W,z)=>{let j=U+z+1;return`${j===Y?"> ":" "}${j}: ${W}`}).join(`
798
+ `);break}}else if(J){let G=$.indexOf(J);if(G>=0)return o6($,G)}}catch{}return{lineNumber:Y,lineContent:Q,context:X}}function Q0($,Z,J,Y,Q,X){let{lineNumber:G,context:K}=o6(Y,Q,X),q=J.split("/").pop(),U=`
799
799
  ${n.bold}${n.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${n.reset}
800
- `;if(U+=`${n.bold}${n.red}\u2502${n.reset} ${n.bold}${n.bgRed} ERROR ${n.reset} ${n.red}${Z} Error${n.reset}${" ".repeat(Math.max(0,43-Z.length))}${n.bold}${n.red}\u2502${n.reset}
800
+ `;if(U+=`${n.bold}${n.red}\u2502${n.reset} ${n.bold}${n.bgRed} ERROR ${n.reset} ${n.red}${$} Error${n.reset}${" ".repeat(Math.max(0,43-$.length))}${n.bold}${n.red}\u2502${n.reset}
801
801
  `,U+=`${n.bold}${n.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${n.reset}
802
802
  `,U+=`
803
803
  ${n.cyan}${n.bold}File:${n.reset} ${n.dim}${q}${n.reset}`,G>0)U+=` ${n.gray}(line ${G})${n.reset}`;if(U+=`
804
- ${n.yellow}${n.bold}Message:${n.reset} ${$}
804
+ ${n.yellow}${n.bold}Message:${n.reset} ${Z}
805
805
  `,K)U+=`
806
806
  ${n.blue}${n.bold}Context:${n.reset}
807
807
  ${n.dim}${K}${n.reset}
808
- `;return U}var uZ,tJ=0,n;var V4=P(()=>{CZ();n4();T5();lZ();gZ();I$();o5();uZ=new c5(500);n={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 l$(Z,$,J=""){let Y=Z,Q=[],X=/@markdown(?:\([^)]*\))?/g,G;while((G=X.exec(Z))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),U=q?q[1]:"",_=K+G[0].length,W=1,z=_,j=-1;while(W>0&&z<Z.length){let F=Z.indexOf("@markdown",z),L=Z.indexOf("@endmarkdown",z);if(L===-1)break;if(F!==-1&&F<L&&F!==K){let O=Z[F+9];if(O==="("||O===`
809
- `||O==="\r"||O===" "||O===void 0)W++;z=F+9}else{if(W--,W===0){j=L;break}z=L+12}}if(j===-1)continue;let B=Z.slice(_,j),H=Z.slice(K,j+12);Q.push({fullMatch:H,options:U,content:B,index:K}),X.lastIndex=j+12}for(let{fullMatch:K,options:q,content:U,index:_}of Q)try{let W={};if(q)q.split(",").forEach((B)=>{let H=B.trim();if(H)W[H]=!0});let z={gfm:W.gfm??!0,breaks:W.breaks??!1},j=m5(U.trim(),z);Y=Y.split(K).join(j)}catch(W){let z=W instanceof Error?W.message:String(W),j=Q4("Markdown Directive",`Error processing markdown: ${z}`,J,Z,_,K);Y=Y.split(K).join(j)}return Y}async function c$(Z,$,J,Y){let Q={gfm:!0,breaks:!1};return $.forEach((X)=>{let G=X.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),m5(Z.trim(),Q)}var cZ=P(()=>{V4()});function X2(Z){if(Y2.set(Z.name,Z),Z.client)J2.set(Z.name,Z.client)}function R7(Z){return X2(Z),{name:Z.name,hasEndTag:Z.hasEndTag??!0,description:Z.description,handler:async(J,Y,Q,X)=>{let G=Q2(Y,Z.defaults);if(Z.validate){let q=Z.validate(G);if(q!==!0){let U=typeof q==="string"?q:`Invalid parameters for @${Z.name}`;throw Error(U)}}let K=J;if(Z.transform)K=await Z.transform(J,G,Q,X);if(Z.clientScript){let q=Z.clientScript(G);K+=`<script>${q}</script>`}if(Z.css){let q=Z.css(G);K+=`<style>${q}</style>`}return K}}}function Q2(Z,$){let J={...$};for(let Y of Z){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)=>!$||!(q in $)).length;J[K===0?"value":`arg${K}`]=Y}}return J}var Y2,J2;var iZ=P(()=>{Y2=new Map,J2=new Map});function nZ(Z,$=M5,J={},Y){return $.sort((Q,X)=>Q-X).map((Q)=>{return`${a5(Z,{...J,w:Q,fm:Y})} ${Q}w`}).join(", ")}function i$(Z,$,J=G2,Y={},Q){return J.sort((X,G)=>X-G).map((X)=>{let G=Math.round($*X);return`${a5(Z,{...Y,w:G,dpr:X,fm:Q})} ${X}x`}).join(", ")}function sZ(Z,$="100vw"){if(!Z||Object.keys(Z).length===0)return $;let Y=Object.entries(Z).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($),Y.join(", ")}function a5(Z,$={}){let J=Object.entries($).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 Z;let Y=J.map(([X,G])=>`${X}=${encodeURIComponent(G)}`).join("&"),Q=Z.includes("?")?"&":"?";return`${Z}${Q}${Y}`}function oZ(Z){return K2[Z]||"application/octet-stream"}var M5,G2,r5,K2;var rZ=P(()=>{M5=[320,480,640,768,1024,1280,1536,1920,2560],G2=[1,1.5,2,3],r5=["avif","webp","jpeg"],K2={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function _2(){try{return await import("ts-images")}catch{return null}}async function U2(Z,$={}){let J={...q2,...$},Y=await _2();if(Y)try{return await W2(Z,J,Y)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return z2(Z,J)}async function W2(Z,$,J){let{generatePlaceholder:Y,generateThumbHash:Q}=J,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await Q(Z)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await Y(Z,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.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:$.strategy,dominantColor:K.dominantColor,css:K.css}}function z2(Z,$){let J=$.width||20,Y=$.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:$.strategy,dominantColor:"#e5e7eb"}}function n$(Z,$,J={}){let Y=J.transitionDuration||300,Q=J.easing||"ease-out";return`
810
- #${Z} {
808
+ `;return U}var p$,GJ=0,n;var V0=P(()=>{P$();o0();T1();c$();h$();b6();s1();p$=new c1(500);n={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 s6($,Z,J=""){let Y=$,Q=[],X=/@markdown(?:\([^)]*\))?/g,G;while((G=X.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),U=q?q[1]:"",_=K+G[0].length,W=1,z=_,j=-1;while(W>0&&z<$.length){let F=$.indexOf("@markdown",z),L=$.indexOf("@endmarkdown",z);if(L===-1)break;if(F!==-1&&F<L&&F!==K){let H=$[F+9];if(H==="("||H===`
809
+ `||H==="\r"||H===" "||H===void 0)W++;z=F+9}else{if(W--,W===0){j=L;break}z=L+12}}if(j===-1)continue;let B=$.slice(_,j),O=$.slice(K,j+12);Q.push({fullMatch:O,options:U,content:B,index:K}),X.lastIndex=j+12}for(let{fullMatch:K,options:q,content:U,index:_}of Q)try{let W={};if(q)q.split(",").forEach((B)=>{let O=B.trim();if(O)W[O]=!0});let z={gfm:W.gfm??!0,breaks:W.breaks??!1},j=m1(U.trim(),z);Y=Y.split(K).join(j)}catch(W){let z=W instanceof Error?W.message:String(W),j=Q0("Markdown Directive",`Error processing markdown: ${z}`,J,$,_,K);Y=Y.split(K).join(j)}return Y}async function r6($,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}),m1($.trim(),Q)}var i$=P(()=>{V0()});function zJ($){if(UJ.set($.name,$),$.client)WJ.set($.name,$.client)}function A5($){return zJ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(J,Y,Q,X)=>{let G=BJ(Y,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let U=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(U)}}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 BJ($,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 UJ,WJ;var n$=P(()=>{UJ=new Map,WJ=new Map});function o$($,Z=M1,J={},Y){return Z.sort((Q,X)=>Q-X).map((Q)=>{return`${a1($,{...J,w:Q,fm:Y})} ${Q}w`}).join(", ")}function a6($,Z,J=jJ,Y={},Q){return J.sort((X,G)=>X-G).map((X)=>{let G=Math.round(Z*X);return`${a1($,{...Y,w:G,dpr:X,fm:Q})} ${X}x`}).join(", ")}function s$($,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 a1($,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 r$($){return OJ[$]||"application/octet-stream"}var M1,jJ,r1,OJ;var a$=P(()=>{M1=[320,480,640,768,1024,1280,1536,1920,2560],jJ=[1,1.5,2,3],r1=["avif","webp","jpeg"],OJ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function LJ(){try{return await import("ts-images")}catch{return null}}async function FJ($,Z={}){let J={...HJ,...Z},Y=await LJ();if(Y)try{return await VJ($,J,Y)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return NJ($,J)}async function VJ($,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 NJ($,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 t6($,Z,J={}){let Y=J.transitionDuration||300,Q=J.easing||"ease-out";return`
810
+ #${$} {
811
811
  --stx-img-transition-duration: ${Y}ms;
812
812
  --stx-img-transition-easing: ${Q};
813
- background-image: url('${$.dataURL}');
813
+ background-image: url('${Z.dataURL}');
814
814
  background-size: cover;
815
815
  background-position: center;
816
816
  }
817
817
 
818
- #${Z} img {
818
+ #${$} img {
819
819
  opacity: 0;
820
820
  transition: opacity var(--stx-img-transition-duration) var(--stx-img-transition-easing);
821
821
  }
822
822
 
823
- #${Z}.stx-img-loaded img {
823
+ #${$}.stx-img-loaded img {
824
824
  opacity: 1;
825
825
  }
826
- `.trim()}async function s$(Z,$={}){let J=`${Z}:${JSON.stringify($)}`;if(aZ.has(J))return aZ.get(J);let Y=await U2(Z,$);return aZ.set(J,Y),Y}var q2,tZ,aZ;var o$=P(()=>{q2={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},tZ=`
826
+ `.trim()}async function e6($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(t$.has(J))return t$.get(J);let Y=await FJ($,Z);return t$.set(J,Y),Y}var HJ,e$,t$;var $Z=P(()=>{HJ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},e$=`
827
827
  .stx-img-placeholder {
828
828
  position: relative;
829
829
  overflow: hidden;
@@ -852,22 +852,22 @@ ${n.dim}${K}${n.reset}
852
852
  filter: blur(0);
853
853
  transform: scale(1);
854
854
  }
855
- `.trim();aZ=new Map});import{createHash as a$}from"crypto";import{readFile as B2,stat as t$}from"fs/promises";async function R4(Z){try{let $=await B2(Z);return a$("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function r$(Z){return a$("sha256").update(Z).digest("hex").slice(0,16)}function w7(Z,$){let J=JSON.stringify($,Object.keys($).sort());return`${r$(Z)}-${r$(J)}`}async function eZ(Z){try{return(await t$(Z)).mtimeMs}catch{return 0}}async function N4(Z){try{return await t$(Z),!0}catch{return!1}}var W5=()=>{};import{mkdir as j2,readFile as H2,writeFile as O2,readdir as KU,rm as L2,stat as qU}from"fs/promises";import{join as Z8,dirname as F2}from"path";async function V2(Z){try{await j2(Z,{recursive:!0})}catch{}}function $8(Z,$,J){return Z8(Z,J,`${$}.json`)}async function e$(Z,$,J){if((Date.now()-Z.createdAt)/86400000>J)return!1;if(await eZ($)!==Z.srcMtime)return!1;return!0}async function T7(Z,$,J,Y=Z6){if(!Y.enabled)return null;let Q=w7(Z,$),X=I5.get(Q);if(X){if(await e$(X,Z,Y.maxAge))return X.lastAccessedAt=Date.now(),X.data;I5.delete(Q)}let G=$8(Y.directory,Q,J);if(await N4(G))try{let K=await H2(G,"utf-8"),q=JSON.parse(K);if(await e$(q,Z,Y.maxAge))return q.lastAccessedAt=Date.now(),I5.set(Q,q),q.data}catch{}return null}async function M7(Z,$,J,Y,Q=Z6){if(!Q.enabled)return;let X=w7(Z,$),G=await R4(Z),K=await eZ(Z),q={key:X,src:Z,srcHash:G,srcMtime:K,optionsHash:w7("",$),data:J,createdAt:Date.now(),lastAccessedAt:Date.now()};I5.set(X,q);let U=$8(Q.directory,X,Y);try{await V2(F2(U)),await O2(U,JSON.stringify(q,null,2))}catch(_){console.warn(`[stx-media] Failed to write cache: ${_}`)}}async function I7(Z,$=Z6){if(Z==="all")I5.clear();else I5.clear();let J=Z==="all"?["image","video"]:[Z];for(let Y of J){let Q=Z8($.directory,Y);try{await L2(Q,{recursive:!0,force:!0})}catch{}}}var I5,Z6;var $6=P(()=>{W5();I5=new Map,Z6={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class D7{config;constructor(Z={}){this.config={...N2,...Z}}async get(Z,$){return T7(Z,$,"image",this.config)}async set(Z,$,J){return M7(Z,$,J,"image",this.config)}async clear(){return I7("image",this.config)}updateConfig(Z){this.config={...this.config,...Z}}}function Y6(Z){if(!E7)E7=new D7(Z);else if(Z)E7.updateConfig(Z);return E7}async function k7(Z,$,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return Y6(Y).get(Z,$)}async function S7(Z,$,J,Y){let Q=Y?{directory:`${Y.outputDir}/../.cache`}:{};return Y6(Q).set(Z,$,J)}async function Y8(){return Y6().clear()}var N2,E7=null;var J6=P(()=>{$6();N2={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as A2,basename as R2,extname as w2,join as T2}from"path";import{mkdir as M2}from"fs/promises";async function X6(){try{return await import("ts-images")}catch{return null}}function J8(Z){switch(Z){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 I2(Z,$){let J=$?J8($):J8("web"),Y=Z.formatQuality||{};return{jpeg:{...J.jpeg,...Y.jpeg},png:{...J.png,...Y.png},webp:{...J.webp,...Y.webp},avif:{...J.avif,...Y.avif}}}async function X8(Z,$,J){let Y=await X6();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:Z,processed:!1};let Q=await k7(Z,$,J);if(Q)return Q;try{let X=A2(Z);if(!await N4(X))return{src:Z,processed:!1,errors:[`Source file not found: ${Z}`]};let G=I2(J,$.preset),K=J.outputDir||"dist/images",q=J.baseUrl||"/images";await M2(K,{recursive:!0});let U=await R4(X),_=R2(Z,w2(Z)),W=$.outputFormat?[$.outputFormat]:J.defaultFormats||["avif","webp","jpeg"],z={src:Z,processed:!0,variants:[],hash:U},j=null;if($.transformations&&$.transformations.length>0)j=await Q6(X,$.transformations,Y);for(let B of W){let H=G[B]||{},F=`${_}-${U}.${B}`,L=T2(K,F);try{let O=await Y.optimizeImage({input:j||X,output:L,format:B,quality:H.quality,progressive:H.progressive});if(O){if(z.variants.push({path:L,url:`${q}/${F}`,width:O.width||0,height:O.height||0,format:B,size:O.outputSize||0}),!z.originalWidth&&O.width)z.originalWidth=O.width,z.originalHeight=O.height}}catch(O){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${B}: ${O}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let B=await Y.generateThumbHash(X);z.placeholder=B.dataUrl}catch(B){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${B}`)}if($.useDominantColor)try{let B=await Y.generatePlaceholder(X,{strategy:"dominant-color"});z.dominantColor=B.dominantColor}catch(B){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${B}`)}return await S7(Z,$,z,J),z}catch(X){return{src:Z,processed:!1,errors:[`Processing failed: ${X}`]}}}async function Q8(Z,$,J,Y){let Q=await X6();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:Z,output:Y,format:$,quality:J}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function Q6(Z,$,J){let Y=J||await X6();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await Y.decode(Z);for(let X of $){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 G8=P(()=>{W5();J6()});import{resolve as E2,basename as D2,extname as k2,join as S2}from"path";import{mkdir as b2}from"fs/promises";async function y2(){try{return await import("ts-images")}catch{return null}}async function K8(Z,$,J){let Y=await y2();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=E2(Z);if(!await N4(Q))return console.warn(`[stx-media] Source file not found: ${Z}`),null;try{let X=$.responsiveWidths||J.breakpoints||C2,G=$.formats||J.defaultFormats||["avif","webp","jpeg"],K=J.outputDir||"dist/images",q=J.baseUrl||"/images";await b2(K,{recursive:!0});let U=await R4(Q),_=D2(Z,k2(Z)),W=J.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:Z,byFormat:{},srcsets:{}};for(let B of G){z.byFormat[B]=[];let H=[];for(let F of X){let L=`${_}-${F}w-${U}.${B}`,O=S2(K,L),V=`${q}/${L}`;try{let A=W[B]?.quality||80;if(await N4(O)){z.byFormat[B].push({path:O,url:V,width:F,height:0,format:B,size:0}),H.push(`${V} ${F}w`);continue}let N=await Y.processImage({input:Q,output:O,format:B,quality:A,resize:{width:F}});if(N)z.byFormat[B].push({path:O,url:V,width:F,height:N.height||Math.round(F*(N.height||1)/(N.width||1)),format:B,size:N.outputSize||0}),H.push(`${V} ${F}w`)}catch(A){console.warn(`[stx-media] Failed to generate ${B} at ${F}w: ${A}`)}}z.srcsets[B]=H.join(", ")}let j=$.placeholder||J.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let B=await Y.generateThumbHash(Q);z.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});z.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:j}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return z.sizes=$.sizes||P2(X),z}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function P2(Z){let $=[...Z].sort((Y,Q)=>Y-Q),J=[];for(let Y=0;Y<$.length-1;Y++){let Q=$[Y];J.push(`(max-width: ${Q}px) ${Q}px`)}return J.push(`${$[$.length-1]}px`),J.join(", ")}function q8(Z,$="width"){if(!Z||Z.length===0)return"";if($==="dpr")return Z.filter((J)=>J.dpr).map((J)=>`${J.url} ${J.dpr}x`).join(", ");return Z.map((J)=>`${J.url} ${J.width}w`).join(", ")}var C2;var _8=P(()=>{W5();C2=[320,480,640,768,1024,1280,1536,1920]});var U8={};r(U8,{setCachedImageResult:()=>S7,processImage:()=>X8,optimizeImage:()=>Q8,getCachedImageResult:()=>k7,generateSrcset:()=>q8,generateResponsiveVariants:()=>K8,clearImageCache:()=>Y8,applyTransformations:()=>Q6,ImageProcessorCache:()=>D7});var W8=P(()=>{G8();_8();J6()});async function v2(){try{return await Promise.resolve().then(() => (W8(),U8))}catch(Z){if(!z8)console.warn("[stx-media] Image processor not available, some features disabled:",Z),z8=!0;return null}}async function b7(Z,$={}){let J=$,Y=Z;if(Y.process&&!Y.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return h2(Y,J)}if(J.processedResult?.processed)return _6(Z,J.processedResult,$);if(J.responsiveVariants)return O8(Z,J.responsiveVariants,$);let{src:Q,alt:X,width:G,height:K,sizes:q,widths:U=M5,dpr:_,formats:W=r5,quality:z=G6,params:j={},placeholder:B="none",placeholderOptions:H={},lazy:F=!0,priority:L=!1,loading:O=L?"eager":C7,decoding:V=y7,fetchpriority:A,objectFit:N,objectPosition:R,crossorigin:w,referrerpolicy:M}=Z,E=Z.class,T=Z.style,I=Z.id,D=Z.data||{},{isDev:y=!1,baseUrl:b=""}=$;if(y&&!$.optimize)return g2(Z);let S,k,f=I||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!L)try{S=await s$(Q,{strategy:B,...H}),k=n$(f,S,H)}catch{}let h=_!==void 0&&G!==void 0,p;if(h)p=f2(Z,f,S,$);else p=await x2(Z,f,S,$);let z4;if(L){let b4=W.includes("webp")?"webp":W[0],P4=nZ(Q,U,{...j,q:z},b4),L4=typeof q==="object"?sZ(q):q||"100vw";z4=`<link rel="preload" as="image" imagesrcset="${P4}" imagesizes="${L4}" />`}let M4=[];if(!B8&&B!=="none")M4.push(tZ),B8=!0;if(k)M4.push(k);let U4=F?H8(f):void 0;return{html:p,preloadLink:z4,css:M4.length>0?M4.join(`
856
- `):void 0,script:U4}}async function x2(Z,$,J,Y){let{src:Q,alt:X,width:G,height:K,sizes:q,widths:U=M5,formats:_=r5,quality:W=G6,params:z={},lazy:j=!0,priority:B=!1,loading:H=B?"eager":C7,decoding:F=y7,fetchpriority:L,objectFit:O,objectPosition:V,crossorigin:A,referrerpolicy:N}=Z,R=Z.class,w=Z.style,M=Z.data||{},E=typeof q==="object"?sZ(q):q||"100vw",T=[];for(let y of _){let b=nZ(Q,U,{...z,q:W},y),S=oZ(y);if(j&&!B)T.push(` <source type="${S}" data-srcset="${b}" data-sizes="${E}" />`);else T.push(` <source type="${S}" srcset="${b}" sizes="${E}" />`)}let I=K6({src:a5(Q,{...z,q:W}),alt:X,width:G,height:K,loading:B?void 0:H,decoding:F,fetchpriority:B?"high":L,objectFit:O,objectPosition:V,crossorigin:A,referrerpolicy:N,className:j8(R,J),style:q6(w,O,V,J),lazy:j&&!B,data:M}),D;if(J){let y=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${$}" class="stx-img-placeholder" style="${y}">
855
+ `.trim();t$=new Map});import{createHash as YZ}from"crypto";import{readFile as RJ,stat as JZ}from"fs/promises";async function A0($){try{let Z=await RJ($);return YZ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function ZZ($){return YZ("sha256").update($).digest("hex").slice(0,16)}function w5($,Z){let J=JSON.stringify(Z,Object.keys(Z).sort());return`${ZZ($)}-${ZZ(J)}`}async function $4($){try{return(await JZ($)).mtimeMs}catch{return 0}}async function N0($){try{return await JZ($),!0}catch{return!1}}var z1=()=>{};import{mkdir as AJ,readFile as wJ,writeFile as TJ,readdir as HU,rm as MJ,stat as LU}from"fs/promises";import{join as QZ,dirname as IJ}from"path";async function EJ($){try{await AJ($,{recursive:!0})}catch{}}function GZ($,Z,J){return QZ($,J,`${Z}.json`)}async function XZ($,Z,J){if((Date.now()-$.createdAt)/86400000>J)return!1;if(await $4(Z)!==$.srcMtime)return!1;return!0}async function T5($,Z,J,Y=Z4){if(!Y.enabled)return null;let Q=w5($,Z),X=I1.get(Q);if(X){if(await XZ(X,$,Y.maxAge))return X.lastAccessedAt=Date.now(),X.data;I1.delete(Q)}let G=GZ(Y.directory,Q,J);if(await N0(G))try{let K=await wJ(G,"utf-8"),q=JSON.parse(K);if(await XZ(q,$,Y.maxAge))return q.lastAccessedAt=Date.now(),I1.set(Q,q),q.data}catch{}return null}async function M5($,Z,J,Y,Q=Z4){if(!Q.enabled)return;let X=w5($,Z),G=await A0($),K=await $4($),q={key:X,src:$,srcHash:G,srcMtime:K,optionsHash:w5("",Z),data:J,createdAt:Date.now(),lastAccessedAt:Date.now()};I1.set(X,q);let U=GZ(Q.directory,X,Y);try{await EJ(IJ(U)),await TJ(U,JSON.stringify(q,null,2))}catch(_){console.warn(`[stx-media] Failed to write cache: ${_}`)}}async function I5($,Z=Z4){if($==="all")I1.clear();else I1.clear();let J=$==="all"?["image","video"]:[$];for(let Y of J){let Q=QZ(Z.directory,Y);try{await MJ(Q,{recursive:!0,force:!0})}catch{}}}var I1,Z4;var Y4=P(()=>{z1();I1=new Map,Z4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class D5{config;constructor($={}){this.config={...DJ,...$}}async get($,Z){return T5($,Z,"image",this.config)}async set($,Z,J){return M5($,Z,J,"image",this.config)}async clear(){return I5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function J4($){if(!E5)E5=new D5($);else if($)E5.updateConfig($);return E5}async function k5($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return J4(Y).get($,Z)}async function S5($,Z,J,Y){let Q=Y?{directory:`${Y.outputDir}/../.cache`}:{};return J4(Q).set($,Z,J)}async function KZ(){return J4().clear()}var DJ,E5=null;var X4=P(()=>{Y4();DJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as kJ,basename as SJ,extname as bJ,join as yJ}from"path";import{mkdir as CJ}from"fs/promises";async function Q4(){try{return await import("ts-images")}catch{return null}}function qZ($){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 PJ($,Z){let J=Z?qZ(Z):qZ("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 _Z($,Z,J){let Y=await Q4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await k5($,Z,J);if(Q)return Q;try{let X=kJ($);if(!await N0(X))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=PJ(J,Z.preset),K=J.outputDir||"dist/images",q=J.baseUrl||"/images";await CJ(K,{recursive:!0});let U=await A0(X),_=SJ($,bJ($)),W=Z.outputFormat?[Z.outputFormat]:J.defaultFormats||["avif","webp","jpeg"],z={src:$,processed:!0,variants:[],hash:U},j=null;if(Z.transformations&&Z.transformations.length>0)j=await G4(X,Z.transformations,Y);for(let B of W){let O=G[B]||{},F=`${_}-${U}.${B}`,L=yJ(K,F);try{let H=await Y.optimizeImage({input:j||X,output:L,format:B,quality:O.quality,progressive:O.progressive});if(H){if(z.variants.push({path:L,url:`${q}/${F}`,width:H.width||0,height:H.height||0,format:B,size:H.outputSize||0}),!z.originalWidth&&H.width)z.originalWidth=H.width,z.originalHeight=H.height}}catch(H){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${B}: ${H}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await Y.generateThumbHash(X);z.placeholder=B.dataUrl}catch(B){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await Y.generatePlaceholder(X,{strategy:"dominant-color"});z.dominantColor=B.dominantColor}catch(B){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${B}`)}return await S5($,Z,z,J),z}catch(X){return{src:$,processed:!1,errors:[`Processing failed: ${X}`]}}}async function UZ($,Z,J,Y){let Q=await Q4();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 G4($,Z,J){let Y=J||await Q4();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 WZ=P(()=>{z1();X4()});import{resolve as vJ,basename as xJ,extname as fJ,join as gJ}from"path";import{mkdir as hJ}from"fs/promises";async function dJ(){try{return await import("ts-images")}catch{return null}}async function zZ($,Z,J){let Y=await dJ();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=vJ($);if(!await N0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let X=Z.responsiveWidths||J.breakpoints||mJ,G=Z.formats||J.defaultFormats||["avif","webp","jpeg"],K=J.outputDir||"dist/images",q=J.baseUrl||"/images";await hJ(K,{recursive:!0});let U=await A0(Q),_=xJ($,fJ($)),W=J.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:$,byFormat:{},srcsets:{}};for(let B of G){z.byFormat[B]=[];let O=[];for(let F of X){let L=`${_}-${F}w-${U}.${B}`,H=gJ(K,L),V=`${q}/${L}`;try{let R=W[B]?.quality||80;if(await N0(H)){z.byFormat[B].push({path:H,url:V,width:F,height:0,format:B,size:0}),O.push(`${V} ${F}w`);continue}let N=await Y.processImage({input:Q,output:H,format:B,quality:R,resize:{width:F}});if(N)z.byFormat[B].push({path:H,url:V,width:F,height:N.height||Math.round(F*(N.height||1)/(N.width||1)),format:B,size:N.outputSize||0}),O.push(`${V} ${F}w`)}catch(R){console.warn(`[stx-media] Failed to generate ${B} at ${F}w: ${R}`)}}z.srcsets[B]=O.join(", ")}let j=Z.placeholder||J.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let B=await Y.generateThumbHash(Q);z.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});z.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:j}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return z.sizes=Z.sizes||uJ(X),z}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function uJ($){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 BZ($,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 mJ;var jZ=P(()=>{z1();mJ=[320,480,640,768,1024,1280,1536,1920]});var OZ={};r(OZ,{setCachedImageResult:()=>S5,processImage:()=>_Z,optimizeImage:()=>UZ,getCachedImageResult:()=>k5,generateSrcset:()=>BZ,generateResponsiveVariants:()=>zZ,clearImageCache:()=>KZ,applyTransformations:()=>G4,ImageProcessorCache:()=>D5});var HZ=P(()=>{WZ();jZ();X4()});async function pJ(){try{return await Promise.resolve().then(() => (HZ(),OZ))}catch($){if(!LZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),LZ=!0;return null}}async function b5($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return nJ(Y,J)}if(J.processedResult?.processed)return U4($,J.processedResult,Z);if(J.responsiveVariants)return RZ($,J.responsiveVariants,Z);let{src:Q,alt:X,width:G,height:K,sizes:q,widths:U=M1,dpr:_,formats:W=r1,quality:z=K4,params:j={},placeholder:B="none",placeholderOptions:O={},lazy:F=!0,priority:L=!1,loading:H=L?"eager":C5,decoding:V=y5,fetchpriority:R,objectFit:N,objectPosition:A,crossorigin:w,referrerpolicy:M}=$,E=$.class,T=$.style,I=$.id,D=$.data||{},{isDev:y=!1,baseUrl:b=""}=Z;if(y&&!Z.optimize)return iJ($);let S,k,f=I||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!L)try{S=await e6(Q,{strategy:B,...O}),k=t6(f,S,O)}catch{}let h=_!==void 0&&G!==void 0,p;if(h)p=cJ($,f,S,Z);else p=await lJ($,f,S,Z);let z0;if(L){let b0=W.includes("webp")?"webp":W[0],P0=o$(Q,U,{...j,q:z},b0),L0=typeof q==="object"?s$(q):q||"100vw";z0=`<link rel="preload" as="image" imagesrcset="${P0}" imagesizes="${L0}" />`}let M0=[];if(!FZ&&B!=="none")M0.push(e$),FZ=!0;if(k)M0.push(k);let U0=F?NZ(f):void 0;return{html:p,preloadLink:z0,css:M0.length>0?M0.join(`
856
+ `):void 0,script:U0}}async function lJ($,Z,J,Y){let{src:Q,alt:X,width:G,height:K,sizes:q,widths:U=M1,formats:_=r1,quality:W=K4,params:z={},lazy:j=!0,priority:B=!1,loading:O=B?"eager":C5,decoding:F=y5,fetchpriority:L,objectFit:H,objectPosition:V,crossorigin:R,referrerpolicy:N}=$,A=$.class,w=$.style,M=$.data||{},E=typeof q==="object"?s$(q):q||"100vw",T=[];for(let y of _){let b=o$(Q,U,{...z,q:W},y),S=r$(y);if(j&&!B)T.push(` <source type="${S}" data-srcset="${b}" data-sizes="${E}" />`);else T.push(` <source type="${S}" srcset="${b}" sizes="${E}" />`)}let I=q4({src:a1(Q,{...z,q:W}),alt:X,width:G,height:K,loading:B?void 0:O,decoding:F,fetchpriority:B?"high":L,objectFit:H,objectPosition:V,crossorigin:R,referrerpolicy:N,className:VZ(A,J),style:_4(w,H,V,J),lazy:j&&!B,data:M}),D;if(J){let y=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
857
857
  <picture>
858
858
  ${T.join(`
859
859
  `)}
860
860
  <img ${I} />
861
861
  </picture>
862
- </div>`}else D=`<picture${$?` id="${$}"`:""}>
862
+ </div>`}else D=`<picture${Z?` id="${Z}"`:""}>
863
863
  ${T.join(`
864
864
  `)}
865
865
  <img ${I} />
866
- </picture>`;return D}function f2(Z,$,J,Y){let{src:Q,alt:X,width:G,height:K,dpr:q=[1,2,3],quality:U=G6,params:_={},lazy:W=!0,priority:z=!1,loading:j=z?"eager":C7,decoding:B=y7,fetchpriority:H,objectFit:F,objectPosition:L,crossorigin:O,referrerpolicy:V}=Z,A=Z.class,N=Z.style,R=Z.data||{},w=typeof G==="number"?G:Number.parseInt(String(G),10),M=i$(Q,w,q,{..._,q:U}),E=K6({src:a5(Q,{..._,w,q:U}),alt:X,width:G,height:K,loading:z?void 0:j,decoding:B,fetchpriority:z?"high":H,objectFit:F,objectPosition:L,crossorigin:O,referrerpolicy:V,className:j8(A,J),style:q6(N,F,L,J),lazy:W&&!z,data:R}),T=W&&!z?`data-srcset="${M}"`:`srcset="${M}"`;if(J){let I=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${$}" class="stx-img-placeholder" style="${I}">
866
+ </picture>`;return D}function cJ($,Z,J,Y){let{src:Q,alt:X,width:G,height:K,dpr:q=[1,2,3],quality:U=K4,params:_={},lazy:W=!0,priority:z=!1,loading:j=z?"eager":C5,decoding:B=y5,fetchpriority:O,objectFit:F,objectPosition:L,crossorigin:H,referrerpolicy:V}=$,R=$.class,N=$.style,A=$.data||{},w=typeof G==="number"?G:Number.parseInt(String(G),10),M=a6(Q,w,q,{..._,q:U}),E=q4({src:a1(Q,{..._,w,q:U}),alt:X,width:G,height:K,loading:z?void 0:j,decoding:B,fetchpriority:z?"high":O,objectFit:F,objectPosition:L,crossorigin:H,referrerpolicy:V,className:VZ(R,J),style:_4(N,F,L,J),lazy:W&&!z,data:A}),T=W&&!z?`data-srcset="${M}"`:`srcset="${M}"`;if(J){let I=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${I}">
867
867
  <img ${E} ${T} />
868
- </div>`}return`<img ${$?`id="${$}" `:""}${E} ${T} />`}function g2(Z){let{src:$,alt:J,width:Y,height:Q,loading:X=C7,decoding:G=y7,fetchpriority:K,objectFit:q,objectPosition:U,crossorigin:_,referrerpolicy:W,priority:z=!1}=Z,j=Z.class,B=Z.style,H=Z.id,F=Z.data||{};return{html:`<img ${K6({src:$,alt:J,width:Y,height:Q,loading:z?"eager":X,decoding:G,fetchpriority:z?"high":K,objectFit:q,objectPosition:U,crossorigin:_,referrerpolicy:W,className:j,style:q6(B,q,U),id:H,data:F})} />`}}function K6(Z){let $=[];if(Z.lazy)$.push(`data-src="${y4(Z.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${y4(Z.src)}"`);if($.push(`alt="${y4(Z.alt)}"`),Z.width)$.push(`width="${Z.width}"`);if(Z.height)$.push(`height="${Z.height}"`);if(Z.loading)$.push(`loading="${Z.loading}"`);if(Z.decoding)$.push(`decoding="${Z.decoding}"`);if(Z.fetchpriority)$.push(`fetchpriority="${Z.fetchpriority}"`);if(Z.crossorigin)$.push(`crossorigin="${Z.crossorigin}"`);if(Z.referrerpolicy)$.push(`referrerpolicy="${Z.referrerpolicy}"`);if(Z.className)$.push(`class="${y4(Z.className)}"`);if(Z.style)$.push(`style="${y4(Z.style)}"`);if(Z.id)$.push(`id="${y4(Z.id)}"`);if(Z.data)for(let[J,Y]of Object.entries(Z.data))$.push(`data-${J}="${y4(Y)}"`);if(Z.lazy)$.push("data-stx-lazy");return $.join(" ")}function j8(Z,$){let J=[];if(Z)J.push(Z);if($)J.push("stx-img-blur");return J.join(" ")||""}function q6(Z,$,J,Y){let Q=[];if($)Q.push(`object-fit: ${$}`);if(J)Q.push(`object-position: ${J}`);if(Y)Q.push("opacity: 0; transition: opacity 300ms ease-out");if(Z)Q.push(Z);return Q.join("; ")}function y4(Z){return Z.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function H8(Z){return`
868
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${E} ${T} />`}function iJ($){let{src:Z,alt:J,width:Y,height:Q,loading:X=C5,decoding:G=y5,fetchpriority:K,objectFit:q,objectPosition:U,crossorigin:_,referrerpolicy:W,priority:z=!1}=$,j=$.class,B=$.style,O=$.id,F=$.data||{};return{html:`<img ${q4({src:Z,alt:J,width:Y,height:Q,loading:z?"eager":X,decoding:G,fetchpriority:z?"high":K,objectFit:q,objectPosition:U,crossorigin:_,referrerpolicy:W,className:j,style:_4(B,q,U),id:O,data:F})} />`}}function q4($){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 VZ($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function _4($,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 NZ($){return`
869
869
  (function() {
870
- const container = document.getElementById('${Z}');
870
+ const container = document.getElementById('${$}');
871
871
  if (!container) return;
872
872
 
873
873
  const img = container.querySelector('img[data-stx-lazy]') || container;
@@ -902,7 +902,7 @@ ${T.join(`
902
902
 
903
903
  observer.observe(container);
904
904
  })();
905
- `.trim()}async function h2(Z,$){let J=await v2();if(!J)return b7({...Z,process:!1},$);let Y=$.tsImagesConfig;if(Z.responsiveWidths&&Z.responsiveWidths.length>0||Z.widths&&Z.widths.length>0||!Z.width&&!Z.dpr){let X=await J.generateResponsiveVariants(Z.src,Z,Y);if(X)return O8(Z,X,$)}else{let X=await J.processImage(Z.src,Z,Y);if(X.processed)return _6(Z,X,$)}return b7({...Z,process:!1},$)}async function _6(Z,$,J){let{alt:Y,width:Q,height:X,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:U,crossorigin:_,referrerpolicy:W}=Z,z=Z.class,j=Z.style,B=Z.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=Z.data||{},F=$.variants||[],L=F.find((k)=>k.format==="jpeg")||F.find((k)=>k.format==="webp")||F[0],O=L?.url||Z.src,V=F.filter((k)=>k.format===(L?.format||"jpeg")).map((k)=>`${k.url} ${k.width}w`).join(", "),A=new Map;for(let k of F){if(!A.has(k.format))A.set(k.format,[]);A.get(k.format).push(k)}let N=[],R=["avif","webp","jpeg","png"];for(let k of R){let f=A.get(k);if(f&&f.length>0){let h=f.map((z4)=>`${z4.url} ${z4.width}w`).join(", "),p=oZ(k);if(G&&!K)N.push(` <source type="${p}" data-srcset="${h}" />`);else N.push(` <source type="${p}" srcset="${h}" />`)}}let w=[];if(G&&!K){if(w.push(`data-src="${y4(O)}"`),w.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)w.push(`data-srcset="${V}"`)}else if(w.push(`src="${y4(O)}"`),V)w.push(`srcset="${V}"`);w.push(`alt="${y4(Y)}"`);let M=Q||$.originalWidth,E=X||$.originalHeight;if(M)w.push(`width="${M}"`);if(E)w.push(`height="${E}"`);if(!K)w.push(`loading="${G?"lazy":"eager"}"`);if(w.push('decoding="async"'),K)w.push('fetchpriority="high"');if(_)w.push(`crossorigin="${_}"`);if(W)w.push(`referrerpolicy="${W}"`);let T=[];if(q)T.push(`object-fit: ${q}`);if(U)T.push(`object-position: ${U}`);if($.placeholder&&G)T.push("opacity: 0; transition: opacity 300ms ease-out");if(j)T.push(j);if(T.length>0)w.push(`style="${T.join("; ")}"`);let I=[];if(z)I.push(z);if($.placeholder)I.push("stx-img-blur");if(I.length>0)w.push(`class="${I.join(" ")}"`);if(G&&!K)w.push("data-stx-lazy");for(let[k,f]of Object.entries(H))w.push(`data-${k}="${y4(f)}"`);let D;if($.placeholder||$.dominantColor&&Z.useDominantColor){let k=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${k}">
905
+ `.trim()}async function nJ($,Z){let J=await pJ();if(!J)return b5({...$,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 RZ($,X,Z)}else{let X=await J.processImage($.src,$,Y);if(X.processed)return U4($,X,Z)}return b5({...$,process:!1},Z)}async function U4($,Z,J){let{alt:Y,width:Q,height:X,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:U,crossorigin:_,referrerpolicy:W}=$,z=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,O=$.data||{},F=Z.variants||[],L=F.find((k)=>k.format==="jpeg")||F.find((k)=>k.format==="webp")||F[0],H=L?.url||$.src,V=F.filter((k)=>k.format===(L?.format||"jpeg")).map((k)=>`${k.url} ${k.width}w`).join(", "),R=new Map;for(let k of F){if(!R.has(k.format))R.set(k.format,[]);R.get(k.format).push(k)}let N=[],A=["avif","webp","jpeg","png"];for(let k of A){let f=R.get(k);if(f&&f.length>0){let h=f.map((z0)=>`${z0.url} ${z0.width}w`).join(", "),p=r$(k);if(G&&!K)N.push(` <source type="${p}" data-srcset="${h}" />`);else N.push(` <source type="${p}" srcset="${h}" />`)}}let w=[];if(G&&!K){if(w.push(`data-src="${y0(H)}"`),w.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)w.push(`data-srcset="${V}"`)}else if(w.push(`src="${y0(H)}"`),V)w.push(`srcset="${V}"`);w.push(`alt="${y0(Y)}"`);let M=Q||Z.originalWidth,E=X||Z.originalHeight;if(M)w.push(`width="${M}"`);if(E)w.push(`height="${E}"`);if(!K)w.push(`loading="${G?"lazy":"eager"}"`);if(w.push('decoding="async"'),K)w.push('fetchpriority="high"');if(_)w.push(`crossorigin="${_}"`);if(W)w.push(`referrerpolicy="${W}"`);let T=[];if(q)T.push(`object-fit: ${q}`);if(U)T.push(`object-position: ${U}`);if(Z.placeholder&&G)T.push("opacity: 0; transition: opacity 300ms ease-out");if(j)T.push(j);if(T.length>0)w.push(`style="${T.join("; ")}"`);let I=[];if(z)I.push(z);if(Z.placeholder)I.push("stx-img-blur");if(I.length>0)w.push(`class="${I.join(" ")}"`);if(G&&!K)w.push("data-stx-lazy");for(let[k,f]of Object.entries(O))w.push(`data-${k}="${y0(f)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let k=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${k}">
906
906
  <picture>
907
907
  ${N.join(`
908
908
  `)}
@@ -912,12 +912,12 @@ ${N.join(`
912
912
  ${N.join(`
913
913
  `)}
914
914
  <img ${w.join(" ")} />
915
- </picture>`;let y=[];if($.placeholder)y.push(tZ);let b=G?H8(B):void 0,S;if(K&&V)S=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:S,css:y.length>0?y.join(`
916
- `):void 0,script:b}}async function O8(Z,$,J){let Y={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[Q,X]of Object.entries($.byFormat))if(X)Y.variants.push(...X);return _6(Z,Y,J)}var z8=!1,G6=80,y7="async",C7="lazy",B8=!1;var L8=P(()=>{rZ();o$()});function d2(){return R7({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}=m2(Z,$,J);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:X||"",widths:G.widths||M5,formats:G.formats||r5,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,U=await b7(K,{isDev:q}),_=U.html;if(U.preloadLink)_=U.preloadLink+`
915
+ </picture>`;let y=[];if(Z.placeholder)y.push(e$);let b=G?NZ(B):void 0,S;if(K&&V)S=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:S,css:y.length>0?y.join(`
916
+ `):void 0,script:b}}async function RZ($,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 U4($,Y,J)}var LZ=!1,K4=80,y5="async",C5="lazy",FZ=!1;var AZ=P(()=>{a$();$Z()});function oJ(){return A5({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}=sJ($,Z,J);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:X||"",widths:G.widths||M1,formats:G.formats||r1,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,U=await b5(K,{isDev:q}),_=U.html;if(U.preloadLink)_=U.preloadLink+`
917
917
  `+_;if(U.css)_+=`
918
918
  <style>${U.css}</style>`;if(U.script)_+=`
919
- <script>${U.script}</script>`;return _},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function m2(Z,$,J){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let Y=Z.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=u2(Y),X=U6(Q[0],J)||"",G=U6(Q[1],J)||"",K={};if(Q[2]){let q=U6(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 u2(Z){let $=[],J="",Y=!1,Q="",X=0,G=0;for(let K=0;K<Z.length;K++){let q=Z[K],U=K>0?Z[K-1]:"";if((q==='"'||q==="'"||q==="`")&&U!=="\\"){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){$.push(J.trim()),J="";continue}}J+=q}if(J.trim())$.push(J.trim());return $}function U6(Z,$){if(typeof Z!=="string")return Z;let J=Z.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=$[J];if(Y!==void 0)return Y}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var F8;var V8=P(()=>{iZ();L8();rZ();F8=d2()});class v7{config;constructor(Z={}){this.config={...p2,...Z}}async get(Z,$){return T7(Z,$,"video",this.config)}async set(Z,$,J){return M7(Z,$,J,"video",this.config)}async clear(){return I7("video",this.config)}updateConfig(Z){this.config={...this.config,...Z}}}function W6(Z){if(!P7)P7=new v7(Z);else if(Z)P7.updateConfig(Z);return P7}async function x7(Z,$,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return W6(Y).get(Z,$)}async function f7(Z,$,J,Y){let Q=Y?{directory:`${Y.outputDir}/../.cache`}:{};return W6(Q).set(Z,$,J)}async function N8(){return W6().clear()}var p2,P7=null;var z6=P(()=>{$6();p2={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as B6,basename as j6,extname as H6,join as g7}from"path";import{mkdir as O6}from"fs/promises";async function L6(){try{return await import("ts-videos")}catch{return null}}async function h7(Z,$,J,Y){let Q=await L6();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=B6(Z);if(!await N4(X))return null;await O6(J,{recursive:!0});let G=await R4(X),K=j6(Z,H6(Z)),q=$.format||"webp",U=$.timestamp||0,_=`${K}-poster-${G}.${q}`,W=g7(J,_),z=await Q.extractThumbnails(X,{timestamps:[U],width:$.width||1280,height:$.height,format:q,quality:$.quality||85,outputDir:J,outputPattern:_.replace(`.${q}`,"")});if(z&&z.length>0){let j=z[0];return{path:W,url:`${Y}/${_}`,width:j.width||$.width||1280,height:j.height||720,timestamp:U,size:j.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function d7(Z,$,J,Y){let Q=await L6();if(!Q)return[];try{let X=B6(Z);if(!await N4(X))return[];await O6(J,{recursive:!0});let G=await R4(X),K=j6(Z,H6(Z)),q=$.format||"webp",W=(await new Q.Input(X).getInfo()).duration||60,z=$.count||10,j=$.interval||W/z,B=[];for(let F=0;F<z&&F*j<W;F++)B.push(F*j);let H=await Q.extractThumbnails(X,{timestamps:B,width:$.width||320,format:q,quality:$.quality||80,outputDir:J,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((F,L)=>({path:F.path||g7(J,`${K}-thumb-${G}-${L}.${q}`),url:`${Y}/${K}-thumb-${G}-${L}.${q}`,width:F.width||$.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 A8(Z,$,J,Y){let Q=await L6();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=B6(Z);if(!await N4(X))return null;await O6(J,{recursive:!0});let G=await R4(X),K=j6(Z,H6(Z)),_=(await new Q.Input(X).getInfo()).duration||60,W=$.columns||10,z=$.interval||5,j=$.thumbnailWidth||160,B=$.thumbnailHeight||90,H=$.format||"jpeg",F=Math.ceil(_/z),L=Math.ceil(F/W),O=`${K}-sprite-${G}.${H}`,V=g7(J,O),A=[];for(let R=0;R<F;R++)A.push(R*z);let N=await Q.extractThumbnails(X,{timestamps:A,width:j,height:B,format:H,quality:$.quality||70,outputDir:g7(J,".temp")});if(!N||N.length===0)return null;try{let R=await import("ts-images"),w=W*j,M=L*B,E=await R.createSprite({images:N.map((T)=>T.path),columns:W,padding:0,outputPath:V,format:H,quality:$.quality||70});return{url:`${Y}/${O}`,path:V,columns:W,rows:L,thumbnailWidth:j,thumbnailHeight:B,interval:z,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 F6=P(()=>{W5()});import{resolve as w8,basename as T8,extname as M8,join as z5}from"path";import{mkdir as m7,writeFile as I8}from"fs/promises";async function E8(){try{return await import("ts-videos")}catch{return null}}async function u7(Z,$,J,Y,Q){let X=await E8();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=w8(Z);if(!await N4(G))return null;let K=await R4(G),q=T8(Z,M8(Z)),U=z5(J,`${q}-${K}-hls`);await m7(U,{recursive:!0});let _=$.length>0?$:D8,W=Q?.segmentDuration||6,B=(await new X.Input(G).getInfo()).duration||0,H=[],F=0;for(let V of _){let A=z5(U,V.label);await m7(A,{recursive:!0});let N=`${V.label}.m3u8`,R=z5(A,N);try{let w=await X.generateHLS(G,{outputDir:A,segmentDuration:W,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(w)H.push({quality:V,url:`${Y}/${q}-${K}-hls/${V.label}/${N}`,path:R}),F+=w.segmentCount||Math.ceil(B/W)}catch(w){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${w}`)}}if(H.length===0)return null;let L=z5(U,"master.m3u8"),O=l2(H,Y,q,K);return await I8(L,O),{manifestUrl:`${Y}/${q}-${K}-hls/master.m3u8`,manifestPath:L,playlists:H,segmentCount:F,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function l2(Z,$,J,Y){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let X of Z){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(`
920
- `)}async function p7(Z,$,J,Y,Q){let X=await E8();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=w8(Z);if(!await N4(G))return null;let K=await R4(G),q=T8(Z,M8(Z)),U=z5(J,`${q}-${K}-dash`);await m7(U,{recursive:!0});let _=$.length>0?$:D8,W=Q?.segmentDuration||4,z=Q?.minBufferTime||2,H=(await new X.Input(G).getInfo()).duration||0,F=[],L=[];for(let N of _){let R=z5(U,N.label);await m7(R,{recursive:!0});try{if(await X.generateDASH(G,{outputDir:R,segmentDuration:W,width:N.width,height:N.height,videoBitrate:N.bitrate,audioBitrate:N.audioBitrate})){if(F.push({bandwidth:N.bitrate,width:N.width,height:N.height||Math.round(N.width*9/16),url:`${Y}/${q}-${K}-dash/${N.label}/video`}),N.audioBitrate)L.push({bandwidth:N.audioBitrate,url:`${Y}/${q}-${K}-dash/${N.label}/audio`})}}catch(w){console.warn(`[stx-media] Failed to generate DASH for ${N.label}: ${w}`)}}if(F.length===0)return null;let O=z5(U,"manifest.mpd"),V=c2(F,L,H,W,z);await I8(O,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:O,adaptationSets:A,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function c2(Z,$,J,Y,Q){let X=R8(J),G=R8(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
919
+ <script>${U.script}</script>`;return _},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function sJ($,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=rJ(Y),X=W4(Q[0],J)||"",G=W4(Q[1],J)||"",K={};if(Q[2]){let q=W4(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 rJ($){let Z=[],J="",Y=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],U=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&U!=="\\"){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 W4($,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 wZ;var TZ=P(()=>{n$();AZ();a$();wZ=oJ()});class v5{config;constructor($={}){this.config={...aJ,...$}}async get($,Z){return T5($,Z,"video",this.config)}async set($,Z,J){return M5($,Z,J,"video",this.config)}async clear(){return I5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function z4($){if(!P5)P5=new v5($);else if($)P5.updateConfig($);return P5}async function x5($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return z4(Y).get($,Z)}async function f5($,Z,J,Y){let Q=Y?{directory:`${Y.outputDir}/../.cache`}:{};return z4(Q).set($,Z,J)}async function MZ(){return z4().clear()}var aJ,P5=null;var B4=P(()=>{Y4();aJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as j4,basename as O4,extname as H4,join as g5}from"path";import{mkdir as L4}from"fs/promises";async function F4(){try{return await import("ts-videos")}catch{return null}}async function h5($,Z,J,Y){let Q=await F4();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=j4($);if(!await N0(X))return null;await L4(J,{recursive:!0});let G=await A0(X),K=O4($,H4($)),q=Z.format||"webp",U=Z.timestamp||0,_=`${K}-poster-${G}.${q}`,W=g5(J,_),z=await Q.extractThumbnails(X,{timestamps:[U],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:J,outputPattern:_.replace(`.${q}`,"")});if(z&&z.length>0){let j=z[0];return{path:W,url:`${Y}/${_}`,width:j.width||Z.width||1280,height:j.height||720,timestamp:U,size:j.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function d5($,Z,J,Y){let Q=await F4();if(!Q)return[];try{let X=j4($);if(!await N0(X))return[];await L4(J,{recursive:!0});let G=await A0(X),K=O4($,H4($)),q=Z.format||"webp",W=(await new Q.Input(X).getInfo()).duration||60,z=Z.count||10,j=Z.interval||W/z,B=[];for(let F=0;F<z&&F*j<W;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||g5(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 IZ($,Z,J,Y){let Q=await F4();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=j4($);if(!await N0(X))return null;await L4(J,{recursive:!0});let G=await A0(X),K=O4($,H4($)),_=(await new Q.Input(X).getInfo()).duration||60,W=Z.columns||10,z=Z.interval||5,j=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,O=Z.format||"jpeg",F=Math.ceil(_/z),L=Math.ceil(F/W),H=`${K}-sprite-${G}.${O}`,V=g5(J,H),R=[];for(let A=0;A<F;A++)R.push(A*z);let N=await Q.extractThumbnails(X,{timestamps:R,width:j,height:B,format:O,quality:Z.quality||70,outputDir:g5(J,".temp")});if(!N||N.length===0)return null;try{let A=await import("ts-images"),w=W*j,M=L*B,E=await A.createSprite({images:N.map((T)=>T.path),columns:W,padding:0,outputPath:V,format:O,quality:Z.quality||70});return{url:`${Y}/${H}`,path:V,columns:W,rows:L,thumbnailWidth:j,thumbnailHeight:B,interval:z,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 V4=P(()=>{z1()});import{resolve as DZ,basename as kZ,extname as SZ,join as B1}from"path";import{mkdir as m5,writeFile as bZ}from"fs/promises";async function yZ(){try{return await import("ts-videos")}catch{return null}}async function u5($,Z,J,Y,Q){let X=await yZ();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=DZ($);if(!await N0(G))return null;let K=await A0(G),q=kZ($,SZ($)),U=B1(J,`${q}-${K}-hls`);await m5(U,{recursive:!0});let _=Z.length>0?Z:CZ,W=Q?.segmentDuration||6,B=(await new X.Input(G).getInfo()).duration||0,O=[],F=0;for(let V of _){let R=B1(U,V.label);await m5(R,{recursive:!0});let N=`${V.label}.m3u8`,A=B1(R,N);try{let w=await X.generateHLS(G,{outputDir:R,segmentDuration:W,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(w)O.push({quality:V,url:`${Y}/${q}-${K}-hls/${V.label}/${N}`,path:A}),F+=w.segmentCount||Math.ceil(B/W)}catch(w){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${w}`)}}if(O.length===0)return null;let L=B1(U,"master.m3u8"),H=tJ(O,Y,q,K);return await bZ(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 tJ($,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(`
920
+ `)}async function p5($,Z,J,Y,Q){let X=await yZ();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=DZ($);if(!await N0(G))return null;let K=await A0(G),q=kZ($,SZ($)),U=B1(J,`${q}-${K}-dash`);await m5(U,{recursive:!0});let _=Z.length>0?Z:CZ,W=Q?.segmentDuration||4,z=Q?.minBufferTime||2,O=(await new X.Input(G).getInfo()).duration||0,F=[],L=[];for(let N of _){let A=B1(U,N.label);await m5(A,{recursive:!0});try{if(await X.generateDASH(G,{outputDir:A,segmentDuration:W,width:N.width,height:N.height,videoBitrate:N.bitrate,audioBitrate:N.audioBitrate})){if(F.push({bandwidth:N.bitrate,width:N.width,height:N.height||Math.round(N.width*9/16),url:`${Y}/${q}-${K}-dash/${N.label}/video`}),N.audioBitrate)L.push({bandwidth:N.audioBitrate,url:`${Y}/${q}-${K}-dash/${N.label}/audio`})}}catch(w){console.warn(`[stx-media] Failed to generate DASH for ${N.label}: ${w}`)}}if(F.length===0)return null;let H=B1(U,"manifest.mpd"),V=eJ(F,L,O,W,z);await bZ(H,V);let R=[{type:"video",representations:F}];if(L.length>0)R.push({type:"audio",representations:L});return{manifestUrl:`${Y}/${q}-${K}-dash/manifest.mpd`,manifestPath:H,adaptationSets:R,duration:O}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function eJ($,Z,J,Y,Q){let X=EZ(J),G=EZ(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
921
921
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
922
922
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
923
923
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -927,15 +927,15 @@ ${N.join(`
927
927
  profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
928
928
  <Period>
929
929
  <AdaptationSet mimeType="video/mp4" codecs="avc1.64001f" segmentAlignment="true" startWithSAP="1">
930
- `;for(let q=0;q<Z.length;q++){let U=Z[q];K+=` <Representation id="video${q}" bandwidth="${U.bandwidth}" width="${U.width}" height="${U.height}">
930
+ `;for(let q=0;q<$.length;q++){let U=$[q];K+=` <Representation id="video${q}" bandwidth="${U.bandwidth}" width="${U.width}" height="${U.height}">
931
931
  <BaseURL>${U.url}/</BaseURL>
932
932
  <SegmentBase indexRange="0-999">
933
933
  <Initialization range="0-999"/>
934
934
  </SegmentBase>
935
935
  </Representation>
936
936
  `}if(K+=` </AdaptationSet>
937
- `,$.length>0){K+=` <AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.2" segmentAlignment="true" startWithSAP="1">
938
- `;for(let q=0;q<$.length;q++){let U=$[q];K+=` <Representation id="audio${q}" bandwidth="${U.bandwidth}">
937
+ `,Z.length>0){K+=` <AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.2" segmentAlignment="true" startWithSAP="1">
938
+ `;for(let q=0;q<Z.length;q++){let U=Z[q];K+=` <Representation id="audio${q}" bandwidth="${U.bandwidth}">
939
939
  <BaseURL>${U.url}/</BaseURL>
940
940
  <SegmentBase indexRange="0-999">
941
941
  <Initialization range="0-999"/>
@@ -943,11 +943,11 @@ ${N.join(`
943
943
  </Representation>
944
944
  `}K+=` </AdaptationSet>
945
945
  `}return K+=` </Period>
946
- </MPD>`,K}function R8(Z){let $=Math.floor(Z/3600),J=Math.floor(Z%3600/60),Y=Math.floor(Z%60),Q="PT";if($>0)Q+=`${$}H`;if(J>0)Q+=`${J}M`;return Q+=`${Y}S`,Q}var D8;var V6=P(()=>{W5();D8=[{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 k8,basename as i2,extname as n2,join as s2}from"path";import{mkdir as o2}from"fs/promises";async function S8(){try{return await import("ts-videos")}catch{return null}}function r2(Z){switch(Z){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 a2(Z){switch(Z){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 N6(Z){let $=await S8();if(!$)return null;try{let J=k8(Z),Q=await new $.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 b8(Z,$,J,Y){let Q=await S8();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:Z,processed:!1};let X=await x7(Z,$,J);if(X)return X;try{let G=k8(Z);if(!await N4(G))return{src:Z,processed:!1,errors:[`Source file not found: ${Z}`]};let K=J.outputDir||"dist/videos",q=J.baseUrl||"/videos";await o2(K,{recursive:!0});let U=await R4(G),_=i2(Z,n2(Z)),W={src:Z,processed:!0,hash:U};Y?.({percentage:5,stage:"analyzing"}),W.metadata=await N6(G)||void 0;let z={};if($.quality)z.bitrate=r2($.quality);if($.platform)Object.assign(z,a2($.platform));if($.transcode)Object.assign(z,$.transcode);if(Object.keys(z).length>0||$.process){Y?.({percentage:10,stage:"transcoding"});let j=`${_}-${U}.mp4`,B=s2(K,j);try{let H=await t2(G,B,z,Q,(F)=>Y?.({percentage:10+F*0.5,stage:"transcoding"}));if(H)W.transcoded={path:B,url:`${q}/${j}`,duration:H.duration,size:H.size,video:{codec:z.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:z.audioCodec||"aac",bitrate:z.audioBitrate||128000,sampleRate:z.sampleRate||48000,channels:z.channels||2}:void 0}}catch(H){W.errors=W.errors||[],W.errors.push(`Transcoding failed: ${H}`)}}if($.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let j=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},B=await h7(G,j,K,q);if(B)W.poster=B}if(J.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let j=await d7(G,J.thumbnails,K,q);if(j.length>0)W.thumbnails=j}if($.streaming){Y?.({percentage:80,stage:"generating-manifests"});let j=typeof $.streaming==="object"?$.streaming:J.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let B=await u7(G,j.qualities||J.streaming?.defaultQualities||[],K,q);if(B)W.streaming={...W.streaming,hls:B}}if(j.format==="dash"){let B=await p7(G,j.qualities||J.streaming?.defaultQualities||[],K,q);if(B)W.streaming={...W.streaming,dash:B}}}if($.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await f7(Z,$,W,J),W}catch(G){return{src:Z,processed:!1,errors:[`Processing failed: ${G}`]}}}async function t2(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 y8=P(()=>{W5();z6();F6();V6()});var C8={};r(C8,{setCachedVideoResult:()=>f7,processVideo:()=>b8,getCachedVideoResult:()=>x7,generateThumbnails:()=>d7,generateSpriteSheet:()=>A8,generatePoster:()=>h7,generateHLSManifest:()=>u7,generateDASHManifest:()=>p7,clearVideoCache:()=>N8,analyzeVideo:()=>N6,VideoProcessorCache:()=>v7});var P8=P(()=>{y8();F6();V6();z6()});async function x8(){try{return await Promise.resolve().then(() => (P8(),C8))}catch(Z){if(!v8)console.warn("[stx-media] Video processor not available, some features disabled:",Z),v8=!0;return null}}async function l7(Z,$={}){let J=$,Y=Z;if(Y.process&&!Y.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return XX(Y,J)}if(J.processedResult?.processed)return d8(Z,J.processedResult,$);let Q;if(Y.generatePoster&&Y.src&&!Z.poster)Q=await QX(Y,J);let{src:X,sources:G=[],poster:K,posterPlaceholder:q,controls:U=f8,autoplay:_=!1,muted:W=!1,loop:z=!1,preload:j=g8,playsinline:B=!0,lazy:H=!0,player:F="native",type:L,width:O,height:V,crossorigin:A,disablePictureInPicture:N=!1,disableRemotePlayback:R=!1}=Z,w=Q||K,M=Z.class,E=Z.style,T=Z.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return $X(Z,$);if(L&&L!=="video")return ZX(X||"",L,Z);let I=G.length>0?G:X?[{src:X,type:h8(X)}]:[],D=[`id="${T}"`];if(U)D.push("controls");if(_)D.push("autoplay");if(W)D.push("muted");if(z)D.push("loop");if(B)D.push("playsinline");if(N)D.push("disablepictureinpicture");if(R)D.push("disableremoteplayback");if(A)D.push(`crossorigin="${A}"`);if(H){if(D.push(`data-preload="${j}"`),D.push('preload="none"'),w)D.push(`data-poster="${B4(w)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${j}"`),w)D.push(`poster="${B4(w)}"`);if(O)D.push(`width="${O}"`);if(V)D.push(`height="${V}"`);if(M)D.push(`class="${B4(M)}"`);if(E)D.push(`style="${B4(E)}"`);let y=I.map((k)=>{return` <source ${H?`data-src="${B4(k.src)}"`:`src="${B4(k.src)}"`} type="${k.type}"${k.media?` media="${k.media}"`:""} />`}).join(`
946
+ </MPD>`,K}function EZ($){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 CZ;var N4=P(()=>{z1();CZ=[{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 PZ,basename as $X,extname as ZX,join as YX}from"path";import{mkdir as JX}from"fs/promises";async function vZ(){try{return await import("ts-videos")}catch{return null}}function XX($){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 QX($){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 R4($){let Z=await vZ();if(!Z)return null;try{let J=PZ($),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 xZ($,Z,J,Y){let Q=await vZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let X=await x5($,Z,J);if(X)return X;try{let G=PZ($);if(!await N0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=J.outputDir||"dist/videos",q=J.baseUrl||"/videos";await JX(K,{recursive:!0});let U=await A0(G),_=$X($,ZX($)),W={src:$,processed:!0,hash:U};Y?.({percentage:5,stage:"analyzing"}),W.metadata=await R4(G)||void 0;let z={};if(Z.quality)z.bitrate=XX(Z.quality);if(Z.platform)Object.assign(z,QX(Z.platform));if(Z.transcode)Object.assign(z,Z.transcode);if(Object.keys(z).length>0||Z.process){Y?.({percentage:10,stage:"transcoding"});let j=`${_}-${U}.mp4`,B=YX(K,j);try{let O=await GX(G,B,z,Q,(F)=>Y?.({percentage:10+F*0.5,stage:"transcoding"}));if(O)W.transcoded={path:B,url:`${q}/${j}`,duration:O.duration,size:O.size,video:{codec:z.codec||"h264",width:O.width,height:O.height,bitrate:O.bitrate,frameRate:O.frameRate},audio:O.audioCodec?{codec:z.audioCodec||"aac",bitrate:z.audioBitrate||128000,sampleRate:z.sampleRate||48000,channels:z.channels||2}:void 0}}catch(O){W.errors=W.errors||[],W.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 h5(G,j,K,q);if(B)W.poster=B}if(J.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let j=await d5(G,J.thumbnails,K,q);if(j.length>0)W.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 u5(G,j.qualities||J.streaming?.defaultQualities||[],K,q);if(B)W.streaming={...W.streaming,hls:B}}if(j.format==="dash"){let B=await p5(G,j.qualities||J.streaming?.defaultQualities||[],K,q);if(B)W.streaming={...W.streaming,dash:B}}}if(Z.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await f5($,Z,W,J),W}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function GX($,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 fZ=P(()=>{z1();B4();V4();N4()});var gZ={};r(gZ,{setCachedVideoResult:()=>f5,processVideo:()=>xZ,getCachedVideoResult:()=>x5,generateThumbnails:()=>d5,generateSpriteSheet:()=>IZ,generatePoster:()=>h5,generateHLSManifest:()=>u5,generateDASHManifest:()=>p5,clearVideoCache:()=>MZ,analyzeVideo:()=>R4,VideoProcessorCache:()=>v5});var hZ=P(()=>{fZ();V4();N4();B4()});async function mZ(){try{return await Promise.resolve().then(() => (hZ(),gZ))}catch($){if(!dZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),dZ=!0;return null}}async function l5($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return zX(Y,J)}if(J.processedResult?.processed)return cZ($,J.processedResult,Z);let Q;if(Y.generatePoster&&Y.src&&!$.poster)Q=await BX(Y,J);let{src:X,sources:G=[],poster:K,posterPlaceholder:q,controls:U=uZ,autoplay:_=!1,muted:W=!1,loop:z=!1,preload:j=pZ,playsinline:B=!0,lazy:O=!0,player:F="native",type:L,width:H,height:V,crossorigin:R,disablePictureInPicture:N=!1,disableRemotePlayback:A=!1}=$,w=Q||K,M=$.class,E=$.style,T=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return _X($,Z);if(L&&L!=="video")return qX(X||"",L,$);let I=G.length>0?G:X?[{src:X,type:lZ(X)}]:[],D=[`id="${T}"`];if(U)D.push("controls");if(_)D.push("autoplay");if(W)D.push("muted");if(z)D.push("loop");if(B)D.push("playsinline");if(N)D.push("disablepictureinpicture");if(A)D.push("disableremoteplayback");if(R)D.push(`crossorigin="${R}"`);if(O){if(D.push(`data-preload="${j}"`),D.push('preload="none"'),w)D.push(`data-poster="${B0(w)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${j}"`),w)D.push(`poster="${B0(w)}"`);if(H)D.push(`width="${H}"`);if(V)D.push(`height="${V}"`);if(M)D.push(`class="${B0(M)}"`);if(E)D.push(`style="${B0(E)}"`);let y=I.map((k)=>{return` <source ${O?`data-src="${B0(k.src)}"`:`src="${B0(k.src)}"`} type="${k.type}"${k.media?` media="${k.media}"`:""} />`}).join(`
947
947
  `),b=`<video ${D.join(" ")}>
948
948
  ${y}
949
949
  Your browser does not support the video tag.
950
- </video>`,S;if(H)S=`
950
+ </video>`,S;if(O)S=`
951
951
  (function() {
952
952
  var video = document.getElementById('${T}');
953
953
  if (!video) return;
@@ -982,20 +982,20 @@ ${y}
982
982
 
983
983
  observer.observe(video);
984
984
  })();
985
- `.trim();return{html:b,script:S}}function ZX(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,U=null;switch($){case"youtube":U=YX(Z),q=U?`https://www.youtube-nocookie.com/embed/${U}`:Z;break;case"vimeo":U=JX(Z),q=U?`https://player.vimeo.com/video/${U}`:Z;break;case"dailymotion":U=Z.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${U}`;break;case"twitch":U=Z.split("/").pop()||"",q=`https://player.twitch.tv/?video=${U}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=Z}let _=[`id="${K}"`,`src="${B4(q)}"`,`width="${Y}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(X)_.push(`class="${B4(X)}"`);if(G)_.push(`style="${B4(G)}"`);if(J.lazy)_.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
985
+ `.trim();return{html:b,script:S}}function qX($,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,U=null;switch(Z){case"youtube":U=UX($),q=U?`https://www.youtube-nocookie.com/embed/${U}`:$;break;case"vimeo":U=WX($),q=U?`https://player.vimeo.com/video/${U}`:$;break;case"dailymotion":U=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${U}`;break;case"twitch":U=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${U}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let _=[`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)_.push(`class="${B0(X)}"`);if(G)_.push(`style="${B0(G)}"`);if(J.lazy)_.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
986
986
  <iframe ${_.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
987
- </div>`}}function $X(Z,$={}){let{src:J,sources:Y=[],poster:Q,controls:X=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:U="metadata",playsinline:_=!0,lazy:W=!0,width:z,height:j}=Z,B=Z.class,H=Z.style,F=Z.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:Y.length>0?Y:J,autoplay:G,loop:q,muted:K,playsinline:_,preload:U,poster:Q,controls:X,title:Z.title},O=["position: relative",z?`width: ${typeof z==="number"?z+"px":z}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",H||""].filter(Boolean).join("; "),V=`
987
+ </div>`}}function _X($,Z={}){let{src:J,sources:Y=[],poster:Q,controls:X=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:U="metadata",playsinline:_=!0,lazy:W=!0,width:z,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:_,preload:U,poster:Q,controls:X,title:$.title},H=["position: relative",z?`width: ${typeof z==="number"?z+"px":z}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",O||""].filter(Boolean).join("; "),V=`
988
988
  <div
989
989
  id="${F}"
990
- class="ts-video-player${B?" "+B4(B):""}"
991
- style="${O}"
990
+ class="ts-video-player${B?" "+B0(B):""}"
991
+ style="${H}"
992
992
  data-ts-video-player
993
993
  data-config='${JSON.stringify(L)}'
994
994
  ${W?"data-lazy":""}
995
995
  >
996
996
  <div class="ts-video-player__container">
997
997
  ${Q?`
998
- <div class="ts-video-player__placeholder" style="background-image: url('${B4(Q)}');">
998
+ <div class="ts-video-player__placeholder" style="background-image: url('${B0(Q)}');">
999
999
  <button class="ts-video-player__play-button" aria-label="Play video">
1000
1000
  <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
1001
1001
  <path d="M8 5v14l11-7z"/>
@@ -1005,7 +1005,7 @@ ${y}
1005
1005
  `:""}
1006
1006
  </div>
1007
1007
  </div>
1008
- `.trim(),A=`
1008
+ `.trim(),R=`
1009
1009
  (function() {
1010
1010
  var container = document.getElementById('${F}');
1011
1011
  if (!container) return;
@@ -1021,7 +1021,7 @@ ${y}
1021
1021
 
1022
1022
  // Load ts-video-player from CDN
1023
1023
  var script = document.createElement('script');
1024
- script.src = '${e2}';
1024
+ script.src = '${KX}';
1025
1025
  script.onload = initPlayer;
1026
1026
  script.onerror = function() {
1027
1027
  console.error('[stx] Failed to load ts-video-player');
@@ -1151,10 +1151,10 @@ else {
1151
1151
  .ts-video-player__play-button svg {
1152
1152
  margin-left: 4px;
1153
1153
  }
1154
- `.trim();return{html:V,script:A,css:N}}function h8(Z){switch(Z.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 YX(Z){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let J of $){let Y=Z.match(J);if(Y)return Y[1]}return null}function JX(Z){let $=Z.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function B4(Z){return Z.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function XX(Z,$){let J=await x8();if(!J)return l7({...Z,process:!1},$);let Y=$.tsVideosConfig,Q=await J.processVideo(Z.src,Z,Y,Z.onProcessProgress);if(Q.processed)return d8(Z,Q,$);return l7({...Z,process:!1},$)}async function QX(Z,$){let J=await x8();if(!J||!Z.src)return;let Y=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},Q=$.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster(Z.src,Y,Q.outputDir,Q.baseUrl||"/videos"))?.url}function d8(Z,$,J){let{controls:Y=f8,autoplay:Q=!1,muted:X=!1,loop:G=!1,preload:K=g8,playsinline:q=!0,lazy:U=!0,width:_,height:W,crossorigin:z,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=Z,H=Z.class,F=Z.style,L=Z.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=Z.src,V=h8(O);if($.transcoded)O=$.transcoded.url,V="video/mp4";let A=$.streaming?.hls||$.streaming?.dash;if(A){if($.streaming?.hls)O=$.streaming.hls.manifestUrl,V="application/x-mpegURL";else if($.streaming?.dash)O=$.streaming.dash.manifestUrl,V="application/dash+xml"}let N=$.poster?.url||Z.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(z)R.push(`crossorigin="${z}"`);if(U){if(R.push(`data-preload="${K}"`),R.push('preload="none"'),N)R.push(`data-poster="${B4(N)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${K}"`),N)R.push(`poster="${B4(N)}"`);let w=_||$.metadata?.width,M=W||$.metadata?.height;if(w)R.push(`width="${w}"`);if(M)R.push(`height="${M}"`);if(H)R.push(`class="${B4(H)}"`);if(F)R.push(`style="${B4(F)}"`);let T=` <source ${U?`data-src="${B4(O)}"`:`src="${B4(O)}"`} type="${V}" />`,I=`<video ${R.join(" ")}>
1154
+ `.trim();return{html:V,script:R,css:N}}function lZ($){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 UX($){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 WX($){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 zX($,Z){let J=await mZ();if(!J)return l5({...$,process:!1},Z);let Y=Z.tsVideosConfig,Q=await J.processVideo($.src,$,Y,$.onProcessProgress);if(Q.processed)return cZ($,Q,Z);return l5({...$,process:!1},Z)}async function BX($,Z){let J=await mZ();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 cZ($,Z,J){let{controls:Y=uZ,autoplay:Q=!1,muted:X=!1,loop:G=!1,preload:K=pZ,playsinline:q=!0,lazy:U=!0,width:_,height:W,crossorigin:z,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,O=$.class,F=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,H=$.src,V=lZ(H);if(Z.transcoded)H=Z.transcoded.url,V="video/mp4";let R=Z.streaming?.hls||Z.streaming?.dash;if(R){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 N=Z.poster?.url||$.poster,A=[`id="${L}"`];if(Y)A.push("controls");if(Q)A.push("autoplay");if(X)A.push("muted");if(G)A.push("loop");if(q)A.push("playsinline");if(j)A.push("disablepictureinpicture");if(B)A.push("disableremoteplayback");if(z)A.push(`crossorigin="${z}"`);if(U){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),N)A.push(`data-poster="${B0(N)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),N)A.push(`poster="${B0(N)}"`);let w=_||Z.metadata?.width,M=W||Z.metadata?.height;if(w)A.push(`width="${w}"`);if(M)A.push(`height="${M}"`);if(O)A.push(`class="${B0(O)}"`);if(F)A.push(`style="${B0(F)}"`);let T=` <source ${U?`data-src="${B0(H)}"`:`src="${B0(H)}"`} type="${V}" />`,I=`<video ${A.join(" ")}>
1155
1155
  ${T}
1156
1156
  Your browser does not support the video tag.
1157
- </video>`;if($.spriteSheet)I=`<div class="stx-video-wrapper" data-sprite-sheet="${B4($.spriteSheet.url)}" data-sprite-cols="${$.spriteSheet.columns}" data-sprite-interval="${$.spriteSheet.interval}">
1157
+ </video>`;if(Z.spriteSheet)I=`<div class="stx-video-wrapper" data-sprite-sheet="${B0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
1158
1158
  ${I}
1159
1159
  </div>`;let D;if(U)D=`
1160
1160
  (function() {
@@ -1191,7 +1191,7 @@ ${I}
1191
1191
 
1192
1192
  observer.observe(video);
1193
1193
  })();
1194
- `.trim();let y;if(A)y=`
1194
+ `.trim();let y;if(R)y=`
1195
1195
  .stx-video-wrapper {
1196
1196
  position: relative;
1197
1197
  width: 100%;
@@ -1200,10 +1200,10 @@ ${I}
1200
1200
  width: 100%;
1201
1201
  height: auto;
1202
1202
  }
1203
- `.trim();return{html:I,script:D,css:y}}var v8=!1,f8=!0,g8="metadata",e2="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var m8=P(()=>{R6()});function u8(){return R7({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}=GX(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},U=await l7(G,q),_=U.html;if(U.css)_+=`
1203
+ `.trim();return{html:I,script:D,css:y}}var dZ=!1,uZ=!0,pZ="metadata",KX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var iZ=P(()=>{w4()});function nZ(){return A5({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}=jX($,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},U=await l5(G,q),_=U.html;if(U.css)_+=`
1204
1204
  <style>${U.css}</style>`;if(U.script)_+=`
1205
- <script>${U.script}</script>`;return _},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function GX(Z,$,J){if($.src)return{src:String($.src),options:$.options||{}};let Y=Z.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=KX(Y),X=p8(Q[0],J)||"",G={};if(Q[1]){let K=p8(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 KX(Z){let $=[],J="",Y=!1,Q="",X=0,G=0;for(let K=0;K<Z.length;K++){let q=Z[K],U=K>0?Z[K-1]:"";if((q==='"'||q==="'"||q==="`")&&U!=="\\"){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){$.push(J.trim()),J="";continue}}J+=q}if(J.trim())$.push(J.trim());return $}function p8(Z,$){if(typeof Z!=="string")return Z;let J=Z.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=$[J];if(Y!==void 0)return Y}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var A6;var R6=P(()=>{iZ();m8();A6=u8()});function qX(Z,$){let J=$.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1206
- ${Z}
1205
+ <script>${U.script}</script>`;return _},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function jX($,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=OX(Y),X=oZ(Q[0],J)||"",G={};if(Q[1]){let K=oZ(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 OX($){let Z=[],J="",Y=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],U=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&U!=="\\"){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 oZ($,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 A4;var w4=P(()=>{n$();iZ();A4=nZ()});function HX($,Z){let J=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1206
+ ${$}
1207
1207
  </div>
1208
1208
  <script>
1209
1209
  (function() {
@@ -1247,7 +1247,7 @@ ${I}
1247
1247
  }
1248
1248
  }
1249
1249
  })();
1250
- </script>`}function _X(Z,$){let J=$.pwa?.updates,Y=J?.message||"A new version is available. Reload to update?",Q=J?.autoReload||!1,X=Z.trim().length>0,G=`
1250
+ </script>`}function LX($,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=`
1251
1251
  <div class="stx-pwa-update-banner" style="
1252
1252
  position: fixed;
1253
1253
  bottom: 0;
@@ -1287,7 +1287,7 @@ ${I}
1287
1287
  font-size: 14px;
1288
1288
  ">Update Now</button>
1289
1289
  </div>
1290
- </div>`;return`${X?`<div class="stx-pwa-update" style="display:none;">${Z}</div>`:G}
1290
+ </div>`;return`${X?`<div class="stx-pwa-update" style="display:none;">${$}</div>`:G}
1291
1291
  <script>
1292
1292
  (function() {
1293
1293
  const updateContainer = document.querySelector('.stx-pwa-update, .stx-pwa-update-banner');
@@ -1358,7 +1358,7 @@ else {
1358
1358
  // Also listen for custom event
1359
1359
  window.addEventListener('pwa-update-available', showUpdate);
1360
1360
  })();
1361
- </script>`}function UX(Z,$){let J=Z.trim().length>0,Y=`
1361
+ </script>`}function FX($,Z){let J=$.trim().length>0,Y=`
1362
1362
  <div class="stx-offline-indicator" style="
1363
1363
  position: fixed;
1364
1364
  top: 16px;
@@ -1381,7 +1381,7 @@ else {
1381
1381
  <circle cx="12" cy="20" r="1"/>
1382
1382
  </svg>
1383
1383
  <span>You are offline</span>
1384
- </div>`;return`${J?`<div class="stx-offline-indicator" style="display:none;">${Z}</div>`:`
1384
+ </div>`;return`${J?`<div class="stx-offline-indicator" style="display:none;">${$}</div>`:`
1385
1385
  <div class="stx-offline-indicator" style="
1386
1386
  position: fixed;
1387
1387
  top: 16px;
@@ -1419,8 +1419,8 @@ else {
1419
1419
  window.addEventListener('offline', updateStatus);
1420
1420
  updateStatus();
1421
1421
  })();
1422
- </script>`}function WX(Z,$){let J=$.pwa?.push,Y=J?.vapidPublicKey||"",Q=J?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
1423
- ${Z}
1422
+ </script>`}function VX($,Z){let J=Z.pwa?.push,Y=J?.vapidPublicKey||"",Q=J?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
1423
+ ${$}
1424
1424
  </div>
1425
1425
  <script>
1426
1426
  (function() {
@@ -1501,55 +1501,55 @@ catch (error) {
1501
1501
  init();
1502
1502
  }
1503
1503
  })();
1504
- </script>`}var zX,BX,jX,HX,l8;var c8=P(()=>{zX={name:"pwa.installButton",handler:(Z,$,J,Y)=>{let Q=J.__stx_options||{};return qX(Z,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},BX={name:"pwa.updatePrompt",handler:(Z,$,J,Y)=>{let Q=J.__stx_options||{};return _X(Z,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},jX={name:"pwa.offlineIndicator",handler:(Z,$,J,Y)=>{let Q=J.__stx_options||{};return UX(Z,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},HX={name:"pwa.pushSubscribe",handler:(Z,$,J,Y)=>{let Q=J.__stx_options||{};return WX(Z,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},l8=[zX,BX,jX,HX]});function w6(Z){for(let[$,J]of Object.entries(u))if(J===Z)return $;return}var u;var c7=P(()=>{u={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 OX(){return!1}function t5(){return!OX()||process.env.STX_DEBUG==="true"}import LX from"path";function i7(){return{...T6}}function n7(Z){if(!T6.showRelativePaths||!Z)return Z;let $=T6.baseDir||process.cwd();try{let J=LX.relative($,Z);return J.startsWith("..")?Z:J}catch{return Z}}var FX,T6,s7,B5,o7;var r7=P(()=>{c7();FX={showRelativePaths:!1,enableAutoRecovery:t5(),logRecoveryWarnings:!0},T6={...FX};s7=class s7 extends Error{code;filePath;line;column;context;numericCode;constructor(Z,$,J,Y,Q,X,G){super(Z);this.code=$;this.filePath=J;this.line=Y;this.column=Q;this.context=X;if(this.name="StxError",this.numericCode=G||u.EVALUATION_ERROR,this.filePath)this.filePath=n7(this.filePath)}};B5=class B5 extends s7{constructor(Z,$,J,Y,Q,X){super(Z,"stx_RUNTIME_ERROR",$,J,Y,Q,X||u.EVALUATION_ERROR);this.name="StxRuntimeError"}};o7=class o7 extends s7{isFatal=!0;constructor(Z,$,J,Y,Q,X){super(Z,"stx_VALIDATION_ERROR",$,J,Y,Q,X||u.DOM_API_VIOLATION);this.name="StxValidationError"}}});function n8(Z){let{type:$,message:J,code:Y,filePath:Q,line:X,column:G,template:K,offset:q,snippet:U,suggestion:_,format:W="text"}=Z,z=X,j=G;if(!z&&K&&q!==void 0){let O=TX(K,q);z=O.line,j=O.column}let B=Q?n7(Q):void 0,H=Y?w6(Y):void 0,F={type:$,code:Y,codeName:H,message:J,filePath:B,line:z,column:j,snippet:U,suggestion:_,timestamp:new Date().toISOString()},L;switch(W){case"html":L=NX(F);break;case"json":L=JSON.stringify(F,null,2);break;case"console":L=AX(F,K,q);break;case"text":default:L=VX(F,K,q);break}return{formatted:L,data:F}}function VX(Z,$,J){let Y=[],Q=Z.code?` [${Z.codeName||Z.code}]`:"";if(Y.push(`[${Z.type} Error${Q}]`),Z.filePath){let X=Z.filePath;if(Z.line){if(X+=`:${Z.line}`,Z.column)X+=`:${Z.column}`}Y.push(`at ${X}`)}if(Y.push(`
1505
- ${Z.message}`),$&&Z.line){let X=RX($,Z.line,2);if(X)Y.push(`
1506
- ${X}`)}if(Z.snippet)Y.push(`
1507
- Snippet: ${Z.snippet}`);if(Z.suggestion)Y.push(`
1508
- Suggestion: ${Z.suggestion}`);return Y.join(" ")}function NX(Z){let $=Z.code?` [${Z.code}]`:"",J=Z.filePath?` in ${Z.filePath}${Z.line?`:${Z.line}`:""}`:"",Y=`<!-- [${Z.type} Error${$}]${J}: ${i8(Z.message)}`;if(Z.suggestion)Y+=` | Suggestion: ${i8(Z.suggestion)}`;return Y+=" -->",Y}function AX(Z,$,J){let U=[],_=Z.code?` [${Z.codeName||Z.code}]`:"";if(U.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${Z.type} Error${_} \u2501\u2501\u2501${"\x1B[0m"}`),Z.filePath){let W=`\x1B[36m${Z.filePath}\x1B[0m`;if(Z.line){if(W+=`\x1B[90m:${Z.line}\x1B[0m`,Z.column)W+=`\x1B[90m:${Z.column}\x1B[0m`}U.push(`
1504
+ </script>`}var NX,RX,AX,wX,sZ;var rZ=P(()=>{NX={name:"pwa.installButton",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return HX($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},RX={name:"pwa.updatePrompt",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return LX($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},AX={name:"pwa.offlineIndicator",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return FX($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},wX={name:"pwa.pushSubscribe",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return VX($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},sZ=[NX,RX,AX,wX]});function T4($){for(let[Z,J]of Object.entries(u))if(J===$)return Z;return}var u;var c5=P(()=>{u={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 TX(){return!1}function t1(){return!TX()||process.env.STX_DEBUG==="true"}import MX from"path";function i5(){return{...M4}}function n5($){if(!M4.showRelativePaths||!$)return $;let Z=M4.baseDir||process.cwd();try{let J=MX.relative(Z,$);return J.startsWith("..")?$:J}catch{return $}}var IX,M4,o5,j1,s5;var r5=P(()=>{c5();IX={showRelativePaths:!1,enableAutoRecovery:t1(),logRecoveryWarnings:!0},M4={...IX};o5=class o5 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||u.EVALUATION_ERROR,this.filePath)this.filePath=n5(this.filePath)}};j1=class j1 extends o5{constructor($,Z,J,Y,Q,X){super($,"stx_RUNTIME_ERROR",Z,J,Y,Q,X||u.EVALUATION_ERROR);this.name="StxRuntimeError"}};s5=class s5 extends o5{isFatal=!0;constructor($,Z,J,Y,Q,X){super($,"stx_VALIDATION_ERROR",Z,J,Y,Q,X||u.DOM_API_VIOLATION);this.name="StxValidationError"}}});function tZ($){let{type:Z,message:J,code:Y,filePath:Q,line:X,column:G,template:K,offset:q,snippet:U,suggestion:_,format:W="text"}=$,z=X,j=G;if(!z&&K&&q!==void 0){let H=yX(K,q);z=H.line,j=H.column}let B=Q?n5(Q):void 0,O=Y?T4(Y):void 0,F={type:Z,code:Y,codeName:O,message:J,filePath:B,line:z,column:j,snippet:U,suggestion:_,timestamp:new Date().toISOString()},L;switch(W){case"html":L=DX(F);break;case"json":L=JSON.stringify(F,null,2);break;case"console":L=kX(F,K,q);break;case"text":default:L=EX(F,K,q);break}return{formatted:L,data:F}}function EX($,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(`
1505
+ ${$.message}`),Z&&$.line){let X=SX(Z,$.line,2);if(X)Y.push(`
1506
+ ${X}`)}if($.snippet)Y.push(`
1507
+ Snippet: ${$.snippet}`);if($.suggestion)Y.push(`
1508
+ Suggestion: ${$.suggestion}`);return Y.join(" ")}function DX($){let Z=$.code?` [${$.code}]`:"",J=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",Y=`<!-- [${$.type} Error${Z}]${J}: ${aZ($.message)}`;if($.suggestion)Y+=` | Suggestion: ${aZ($.suggestion)}`;return Y+=" -->",Y}function kX($,Z,J){let U=[],_=$.code?` [${$.codeName||$.code}]`:"";if(U.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${_} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let W=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(W+=`\x1B[90m:${$.line}\x1B[0m`,$.column)W+=`\x1B[90m:${$.column}\x1B[0m`}U.push(`
1509
1509
  \x1B[90mat\x1B[0m ${W}`)}if(U.push(`
1510
1510
 
1511
- ${Z.message}`),$&&Z.line){let W=wX($,Z.line,2);if(W)U.push(`
1511
+ ${$.message}`),Z&&$.line){let W=bX(Z,$.line,2);if(W)U.push(`
1512
1512
 
1513
1513
  \x1B[90mContext:\x1B[0m
1514
- ${W}`)}if(Z.suggestion)U.push(`
1515
-
1516
- \x1B[33mSuggestion:\x1B[0m ${Z.suggestion}`);return U.push(`
1517
- ${"\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"}`),U.join("")}function RX(Z,$,J){let Y=Z.split(`
1518
- `),Q=Math.max(0,$-J-1),X=Math.min(Y.length-1,$+J-1),G=[];for(let K=Q;K<=X;K++){let q=(K+1).toString().padStart(4),U=K===$-1?">":" ";G.push(`${U}${q} | ${Y[K]}`)}return G.join(`
1519
- `)}function wX(Z,$,J){let Y=Z.split(`
1520
- `),Q=Math.max(0,$-J-1),X=Math.min(Y.length-1,$+J-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",U=[];for(let _=Q;_<=X;_++){let W=(_+1).toString().padStart(4),z=_===$-1,j=z?"\x1B[31m>\x1B[0m":" ",B=z?`\x1B[31m${Y[_]}\x1B[0m`:`\x1B[90m${Y[_]}\x1B[0m`;U.push(`${j}\x1B[90m${W}\x1B[0m | ${B}`)}return U.join(`
1521
- `)}function i8(Z){return Z.replace(/--/g,"- -").replace(/>/g,"&gt;")}function TX(Z,$){let Y=Z.substring(0,$).split(`
1522
- `);return{line:Y.length,column:Y[Y.length-1].length}}function s(Z,$,J){return n8({type:Z,message:$,code:J,format:"html"}).formatted}async function E5(Z,$,J){try{return await Z()}catch(Y){if(J&&Y instanceof Error)J(Y);return $}}var s8=P(()=>{c7();r7()});class I6{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(Z={}){this.maxErrors=Z.maxErrors??1000,this.enableFileLogging=Z.enableFileLogging??!1,this.logFilePath=Z.logFilePath??".stx/errors.log",this.logFormat=Z.logFormat??"json",this.maxFileSize=Z.maxFileSize??10485760,this.maxLogFiles=Z.maxLogFiles??5,this.minLevel=Z.minLevel??"all"}configure(Z){if(Z.maxErrors!==void 0)this.maxErrors=Z.maxErrors;if(Z.enableFileLogging!==void 0)this.enableFileLogging=Z.enableFileLogging;if(Z.logFilePath!==void 0)this.logFilePath=Z.logFilePath;if(Z.logFormat!==void 0)this.logFormat=Z.logFormat;if(Z.maxFileSize!==void 0)this.maxFileSize=Z.maxFileSize;if(Z.maxLogFiles!==void 0)this.maxLogFiles=Z.maxLogFiles;if(Z.minLevel!==void 0)this.minLevel=Z.minLevel}log(Z,$,J="error"){let Y={timestamp:new Date,error:Z,context:$,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(Z){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return Z==="error"||Z==="warning";if(this.minLevel==="error")return Z==="error";return!0}formatEntry(Z){if(this.logFormat==="json")return JSON.stringify({timestamp:Z.timestamp.toISOString(),level:Z.level||"error",type:Z.error.constructor.name,message:Z.error.message,stack:Z.error.stack,context:Z.context});let $=[`[${Z.timestamp.toISOString()}] [${(Z.level||"error").toUpperCase()}] ${Z.error.constructor.name}: ${Z.error.message}`];if(Z.error.stack)$.push(` Stack: ${Z.error.stack.split(`
1514
+ ${W}`)}if($.suggestion)U.push(`
1515
+
1516
+ \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return U.push(`
1517
+ ${"\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"}`),U.join("")}function SX($,Z,J){let Y=$.split(`
1518
+ `),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),U=K===Z-1?">":" ";G.push(`${U}${q} | ${Y[K]}`)}return G.join(`
1519
+ `)}function bX($,Z,J){let Y=$.split(`
1520
+ `),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",U=[];for(let _=Q;_<=X;_++){let W=(_+1).toString().padStart(4),z=_===Z-1,j=z?"\x1B[31m>\x1B[0m":" ",B=z?`\x1B[31m${Y[_]}\x1B[0m`:`\x1B[90m${Y[_]}\x1B[0m`;U.push(`${j}\x1B[90m${W}\x1B[0m | ${B}`)}return U.join(`
1521
+ `)}function aZ($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function yX($,Z){let Y=$.substring(0,Z).split(`
1522
+ `);return{line:Y.length,column:Y[Y.length-1].length}}function o($,Z,J){return tZ({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 eZ=P(()=>{c5();r5()});class E4{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(`
1523
1523
  `).slice(1).join(`
1524
- `)}`);if(Z.context)$.push(` Context: ${JSON.stringify(Z.context)}`);return $.join(`
1525
- `)}writeToFile(Z){this.writeQueue=this.writeQueue.then(async()=>{try{let $=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!$.existsSync(Y))$.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded($);let Q=`${this.formatEntry(Z)}
1526
- `;$.appendFileSync(this.logFilePath,Q,"utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",$)}})}async rotateIfNeeded(Z){try{if(!Z.existsSync(this.logFilePath))return;if(Z.statSync(this.logFilePath).size<this.maxFileSize)return;for(let J=this.maxLogFiles-1;J>=1;J--){let Y=`${this.logFilePath}.${J}`,Q=`${this.logFilePath}.${J+1}`;if(Z.existsSync(Y))if(J>=this.maxLogFiles-1)Z.unlinkSync(Y);else Z.renameSync(Y,Q)}if(this.maxLogFiles<=1)Z.writeFileSync(this.logFilePath,"");else Z.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",$)}}getRecentErrors(Z=10){return this.errors.slice(-Z)}getErrorsByType(Z){return this.errors.filter(($)=>$.error.constructor.name===Z)}getErrorsByLevel(Z){return this.errors.filter(($)=>$.level===Z)}clear(){this.errors.length=0}async clearLogFile(){try{let Z=await import("fs");if(Z.existsSync(this.logFilePath))Z.writeFileSync(this.logFilePath,"","utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",Z)}}getStats(){let Z={},$={error:0,warning:0,info:0};for(let J of this.errors){let Y=J.error.constructor.name;Z[Y]=(Z[Y]||0)+1;let Q=J.level||"error";$[Q]=($[Q]||0)+1}return{total:this.errors.length,byType:Z,byLevel:$}}async exportToFile(Z,$="json"){let J=await import("fs"),Q=(await import("path")).dirname(Z);if(!J.existsSync(Q))J.mkdirSync(Q,{recursive:!0});if($==="json"){let X=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));J.writeFileSync(Z,JSON.stringify(X,null,2),"utf-8")}else{let X=this.errors.map((G)=>this.formatEntry(G));J.writeFileSync(Z,X.join(`
1527
-
1528
- `),"utf-8")}}async flush(){await this.writeQueue}}var M6,j5,E6;var o8=P(()=>{r7();M6={isEnabled(){return i7().enableAutoRecovery},fixCommonSyntaxErrors(Z){let $=i7();if(!$.enableAutoRecovery)return{fixed:Z,fixes:[]};let J=Z,Y=[],Q=(J.match(/\{\{/g)||[]).length,X=(J.match(/\}\}/g)||[]).length;if(Q>X){let K=Q-X;J+="}}".repeat(K),Y.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(J.match(new RegExp(`@${K}\\b`,"g"))||[]).length,U=(J.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>U){let _=q-U;for(let W=0;W<_;W++)J+=`
1529
- @end${K}`;Y.push(`Added ${_} missing @end${K}`)}}if(Y.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:J,fixes:Y}},createFallbackContent(Z,$){if(t5())return`<!-- ${Z} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};j5=new I6,E6={isDevelopment(){return t5()},logDetailedError(Z,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",Z.message),console.error("Stack:",Z.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(Z,$){let J=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${Z.message}`,`Type: ${Z.constructor.name}`,`Stack: ${Z.stack}`];if($)J.push(`Context: ${JSON.stringify($,null,2)}`);return J.push("========================"),J.join(`
1530
- `)}}});var r8=()=>{};var a8=P(()=>{c7();s8();o8();r8();r7()});var l4=P(()=>{a8()});function t8(Z,$,J,Y){let Q=Z;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,U)=>{if(!U&&q.includes(":")){let _=q.split(":"),W=q,z=_.length>1?_[1]:"";if(z&&$[z])U=$[z];else if(W.startsWith("og:")&&$.openGraph&&$.openGraph[_[1]])U=$.openGraph[_[1]];else U="";return U?`<meta property="${d(W)}" content="${d(U)}">`:""}return U?`<meta name="${d(q)}" content="${d(U)}">`:""});let X=/@metaTag\s*\(/g,G;while((G=X.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,U=1,_=q+1;while(_<Q.length&&U>0){if(Q[_]==="(")U++;else if(Q[_]===")"){if(U--,U===0)break}_++}if(U!==0)break;let W=Q.substring(q+1,_).trim(),z=_+1,j=(()=>{try{let B=H4(W,$);if(!B)return"";let H="<meta";if(B.name)H+=` name="${d(String(B.name))}"`;if(B.property)H+=` property="${d(String(B.property))}"`;if(B.httpEquiv)H+=` http-equiv="${d(String(B.httpEquiv))}"`;if(B.content)H+=` content="${d(String(B.content))}"`;return H+=">",H}catch(B){let H=B instanceof Error?B.message:String(B);return s("MetaTag",H,u.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+j+Q.substring(z),X.lastIndex=0}return Q}function e8(Z,$,J){let Y=Z,Q=/@structuredData\s*\(/g,X;while((X=Q.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,q=1,U=K+1;while(U<Y.length&&q>0){if(Y[U]==="(")q++;else if(Y[U]===")"){if(q--,q===0)break}U++}if(q!==0)break;let _=Y.substring(K+1,U).trim(),W=U+1,z=(()=>{try{let j=H4(_,$);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,u.EVALUATION_ERROR)}})();Y=Y.substring(0,G)+z+Y.substring(W),Q.lastIndex=0}return Y}function Z3(Z,$,J,Y){let Q=Z,X=/@seo\s*\(\s*\{/g,G;while((G=X.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,U=K+1,_=null,W=!1;while(U<Q.length&&q>0){let L=Q[U];if(W){W=!1,U++;continue}if(L==="\\"&&_){W=!0,U++;continue}if(_){if(L===_)_=null;U++;continue}if(L==='"'||L==="'"||L==="`"){_=L,U++;continue}if(L==="{")q++;else if(L==="}")q--;U++}if(q!==0)break;let z=Q.substring(U).match(/^\s*\)/);if(!z)break;let j=U+z[0].length,B=Q.substring(K,U),H=Q.substring(G.index,j),F=((L)=>{try{let O=H4(L,$);if(!O)return"";let V="";if(O.title)V+=`<title>${d(O.title)}</title>
1531
- `,V+=`<meta name="title" content="${d(O.title)}">
1532
- `;if(O.description)V+=`<meta name="description" content="${d(O.description)}">
1533
- `;if(O.keywords){let A=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${d(A)}">
1534
- `}if(O.robots)V+=`<meta name="robots" content="${d(O.robots)}">
1535
- `;if(O.canonical)V+=`<link rel="canonical" href="${d(O.canonical)}">
1536
- `;if(O.openGraph){let A=O.openGraph;if(V+=`<meta property="og:type" content="${d(A.type||"website")}">
1537
- `,A.title||O.title){let N=A.title||O.title||"";V+=`<meta property="og:title" content="${d(N)}">
1538
- `}if(A.description||O.description){let N=A.description||O.description||"";V+=`<meta property="og:description" content="${d(N)}">
1539
- `}if(A.url||O.canonical){let N=A.url||O.canonical||"";V+=`<meta property="og:url" content="${d(N)}">
1540
- `}if(A.image){if(V+=`<meta property="og:image" content="${d(A.image)}">
1541
- `,A.imageAlt)V+=`<meta property="og:image:alt" content="${d(A.imageAlt)}">
1542
- `;if(A.imageWidth)V+=`<meta property="og:image:width" content="${d(String(A.imageWidth))}">
1543
- `;if(A.imageHeight)V+=`<meta property="og:image:height" content="${d(String(A.imageHeight))}">
1544
- `}if(A.siteName)V+=`<meta property="og:site_name" content="${d(A.siteName)}">
1545
- `}if(O.twitter){let A=O.twitter;if(V+=`<meta name="twitter:card" content="${d(A.card||"summary_large_image")}">
1546
- `,A.title||O.title){let N=A.title||O.title||"";V+=`<meta name="twitter:title" content="${d(N)}">
1547
- `}if(A.description||O.description){let N=A.description||O.description||"";V+=`<meta name="twitter:description" content="${d(N)}">
1548
- `}if(A.image||O.openGraph&&O.openGraph.image){let N=A.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${d(N)}">
1549
- `}if(A.site)V+=`<meta name="twitter:site" content="${d(A.site)}">
1550
- `;if(A.creator)V+=`<meta name="twitter:creator" content="${d(A.creator)}">
1551
- `}if(O.structuredData){let A=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${A}</script>
1552
- `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return s("SEO",`Error processing @seo directive: ${V}`,u.EVALUATION_ERROR)}})(B);Q=Q.substring(0,G.index)+F+Q.substring(j),X.lastIndex=G.index+F.length}return Q}function $3(Z,$,J){if(J.seo?.enabled===!1)return Z;if(Z.includes("<!-- stx SEO Tags -->")||J.skipDefaultSeoTags===!0)return Z;if(!Z.includes("<head>")&&!Z.includes("<head "))return Z;let Y=Z.includes("<title>")||Z.includes("</title>"),Q="";if($.title)Q=$.title;else if($.meta&&$.meta.title)Q=$.meta.title;else if(J.seo?.defaultConfig?.title)Q=J.seo.defaultConfig.title;else Q=J.defaultTitle||"stx Project";let X="";if($.description)X=$.description;else if($.meta&&$.meta.description)X=$.meta.description;else if(J.seo?.defaultConfig?.description)X=J.seo.defaultConfig.description;else X=J.defaultDescription||"A website built with stx templating engine";let G="";if($.image)G=$.image;else if($.meta&&$.meta.image)G=$.meta.image;else if($.openGraph&&$.openGraph.image)G=$.openGraph.image;else if(J.seo?.defaultImage)G=J.seo.defaultImage;else if(J.defaultImage)G=J.defaultImage;let K=`
1524
+ `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
1525
+ `)}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($)}
1526
+ `;Z.appendFileSync(this.logFilePath,Q,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let J=this.maxLogFiles-1;J>=1;J--){let Y=`${this.logFilePath}.${J}`,Q=`${this.logFilePath}.${J+1}`;if($.existsSync(Y))if(J>=this.maxLogFiles-1)$.unlinkSync(Y);else $.renameSync(Y,Q)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let J of this.errors){let Y=J.error.constructor.name;$[Y]=($[Y]||0)+1;let Q=J.level||"error";Z[Q]=(Z[Q]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let J=await import("fs"),Q=(await import("path")).dirname($);if(!J.existsSync(Q))J.mkdirSync(Q,{recursive:!0});if(Z==="json"){let X=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));J.writeFileSync($,JSON.stringify(X,null,2),"utf-8")}else{let X=this.errors.map((G)=>this.formatEntry(G));J.writeFileSync($,X.join(`
1527
+
1528
+ `),"utf-8")}}async flush(){await this.writeQueue}}var I4,O1,D4;var $3=P(()=>{r5();I4={isEnabled(){return i5().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=i5();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let J=$,Y=[],Q=(J.match(/\{\{/g)||[]).length,X=(J.match(/\}\}/g)||[]).length;if(Q>X){let K=Q-X;J+="}}".repeat(K),Y.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(J.match(new RegExp(`@${K}\\b`,"g"))||[]).length,U=(J.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>U){let _=q-U;for(let W=0;W<_;W++)J+=`
1529
+ @end${K}`;Y.push(`Added ${_} missing @end${K}`)}}if(Y.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:J,fixes:Y}},createFallbackContent($,Z){if(t1())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};O1=new E4,D4={isDevelopment(){return t1()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let J=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)J.push(`Context: ${JSON.stringify(Z,null,2)}`);return J.push("========================"),J.join(`
1530
+ `)}}});var Z3=()=>{};var Y3=P(()=>{c5();eZ();$3();Z3();r5()});var l0=P(()=>{Y3()});function J3($,Z,J,Y){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,U)=>{if(!U&&q.includes(":")){let _=q.split(":"),W=q,z=_.length>1?_[1]:"";if(z&&Z[z])U=Z[z];else if(W.startsWith("og:")&&Z.openGraph&&Z.openGraph[_[1]])U=Z.openGraph[_[1]];else U="";return U?`<meta property="${d(W)}" content="${d(U)}">`:""}return U?`<meta name="${d(q)}" content="${d(U)}">`:""});let X=/@metaTag\s*\(/g,G;while((G=X.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,U=1,_=q+1;while(_<Q.length&&U>0){if(Q[_]==="(")U++;else if(Q[_]===")"){if(U--,U===0)break}_++}if(U!==0)break;let W=Q.substring(q+1,_).trim(),z=_+1,j=(()=>{try{let B=O0(W,Z);if(!B)return"";let O="<meta";if(B.name)O+=` name="${d(String(B.name))}"`;if(B.property)O+=` property="${d(String(B.property))}"`;if(B.httpEquiv)O+=` http-equiv="${d(String(B.httpEquiv))}"`;if(B.content)O+=` content="${d(String(B.content))}"`;return O+=">",O}catch(B){let O=B instanceof Error?B.message:String(B);return o("MetaTag",O,u.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+j+Q.substring(z),X.lastIndex=0}return Q}function X3($,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,U=K+1;while(U<Y.length&&q>0){if(Y[U]==="(")q++;else if(Y[U]===")"){if(q--,q===0)break}U++}if(q!==0)break;let _=Y.substring(K+1,U).trim(),W=U+1,z=(()=>{try{let j=O0(_,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 o("StructuredData",B,u.EVALUATION_ERROR)}})();Y=Y.substring(0,G)+z+Y.substring(W),Q.lastIndex=0}return Y}function Q3($,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,U=K+1,_=null,W=!1;while(U<Q.length&&q>0){let L=Q[U];if(W){W=!1,U++;continue}if(L==="\\"&&_){W=!0,U++;continue}if(_){if(L===_)_=null;U++;continue}if(L==='"'||L==="'"||L==="`"){_=L,U++;continue}if(L==="{")q++;else if(L==="}")q--;U++}if(q!==0)break;let z=Q.substring(U).match(/^\s*\)/);if(!z)break;let j=U+z[0].length,B=Q.substring(K,U),O=Q.substring(G.index,j),F=((L)=>{try{let H=O0(L,Z);if(!H)return"";let V="";if(H.title)V+=`<title>${d(H.title)}</title>
1531
+ `,V+=`<meta name="title" content="${d(H.title)}">
1532
+ `;if(H.description)V+=`<meta name="description" content="${d(H.description)}">
1533
+ `;if(H.keywords){let R=Array.isArray(H.keywords)?H.keywords.join(", "):H.keywords;V+=`<meta name="keywords" content="${d(R)}">
1534
+ `}if(H.robots)V+=`<meta name="robots" content="${d(H.robots)}">
1535
+ `;if(H.canonical)V+=`<link rel="canonical" href="${d(H.canonical)}">
1536
+ `;if(H.openGraph){let R=H.openGraph;if(V+=`<meta property="og:type" content="${d(R.type||"website")}">
1537
+ `,R.title||H.title){let N=R.title||H.title||"";V+=`<meta property="og:title" content="${d(N)}">
1538
+ `}if(R.description||H.description){let N=R.description||H.description||"";V+=`<meta property="og:description" content="${d(N)}">
1539
+ `}if(R.url||H.canonical){let N=R.url||H.canonical||"";V+=`<meta property="og:url" content="${d(N)}">
1540
+ `}if(R.image){if(V+=`<meta property="og:image" content="${d(R.image)}">
1541
+ `,R.imageAlt)V+=`<meta property="og:image:alt" content="${d(R.imageAlt)}">
1542
+ `;if(R.imageWidth)V+=`<meta property="og:image:width" content="${d(String(R.imageWidth))}">
1543
+ `;if(R.imageHeight)V+=`<meta property="og:image:height" content="${d(String(R.imageHeight))}">
1544
+ `}if(R.siteName)V+=`<meta property="og:site_name" content="${d(R.siteName)}">
1545
+ `}if(H.twitter){let R=H.twitter;if(V+=`<meta name="twitter:card" content="${d(R.card||"summary_large_image")}">
1546
+ `,R.title||H.title){let N=R.title||H.title||"";V+=`<meta name="twitter:title" content="${d(N)}">
1547
+ `}if(R.description||H.description){let N=R.description||H.description||"";V+=`<meta name="twitter:description" content="${d(N)}">
1548
+ `}if(R.image||H.openGraph&&H.openGraph.image){let N=R.image||(H.openGraph?H.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${d(N)}">
1549
+ `}if(R.site)V+=`<meta name="twitter:site" content="${d(R.site)}">
1550
+ `;if(R.creator)V+=`<meta name="twitter:creator" content="${d(R.creator)}">
1551
+ `}if(H.structuredData){let R=JSON.stringify(H.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${R}</script>
1552
+ `}return V.trim()}catch(H){let V=H instanceof Error?H.message:String(H);return o("SEO",`Error processing @seo directive: ${V}`,u.EVALUATION_ERROR)}})(B);Q=Q.substring(0,G.index)+F+Q.substring(j),X.lastIndex=G.index+F.length}return Q}function G3($,Z,J){if(J.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||J.skipDefaultSeoTags===!0)return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=$.includes("<title>")||$.includes("</title>"),Q="";if(Z.title)Q=Z.title;else if(Z.meta&&Z.meta.title)Q=Z.meta.title;else if(J.seo?.defaultConfig?.title)Q=J.seo.defaultConfig.title;else Q=J.defaultTitle||"stx Project";let X="";if(Z.description)X=Z.description;else if(Z.meta&&Z.meta.description)X=Z.meta.description;else if(J.seo?.defaultConfig?.description)X=J.seo.defaultConfig.description;else X=J.defaultDescription||"A website built with stx templating engine";let G="";if(Z.image)G=Z.image;else if(Z.meta&&Z.meta.image)G=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)G=Z.openGraph.image;else if(J.seo?.defaultImage)G=J.seo.defaultImage;else if(J.defaultImage)G=J.defaultImage;let K=`
1553
1553
  <!-- stx SEO Tags -->
1554
1554
  <meta name="title" content="${d(Q)}">
1555
1555
  <meta name="description" content="${d(X)}">
@@ -1562,10 +1562,10 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
1562
1562
  `;if(G)K+=`
1563
1563
  <meta property="og:image" content="${d(G)}">
1564
1564
  <meta name="twitter:image" content="${d(G)}">
1565
- `;let q=Z;if(!Y)q=q.replace(/<head[^>]*>/,`$&
1565
+ `;let q=$;if(!Y)q=q.replace(/<head[^>]*>/,`$&
1566
1566
  <title>${d(Q)}</title>`);return q.replace(/<head[^>]*>/,`$&
1567
1567
  ${K}
1568
- `)}function d(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Y3,J3;var D6=P(()=>{l4();A4();Y3={name:"meta",handler:(Z,$,J,Y)=>{if($.length<1)return s("Meta","meta directive requires at least the meta name",u.INVALID_DIRECTIVE_SYNTAX);let Q=$[0].replace(/['"]/g,""),X=$.length>1?$[1].replace(/['"]/g,""):"";return`<meta name="${d(Q)}" content="${d(X)}">`},hasEndTag:!1},J3={name:"structuredData",handler:(Z,$,J,Y)=>{if(Z.trim()==="")return s("StructuredData","structuredData directive requires JSON-LD content",u.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse(Z);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return s("StructuredData","structuredData requires @type property",u.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,u.EVALUATION_ERROR)}},hasEndTag:!0}});import e5 from"path";function MX(Z,$){let J=Z.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=J?J[1].trim():"",Q=$,X=[],G=!0;if(Y){let W=Y.match(/export\s+default\s+({[\s\S]*})/);if(W)try{let z=W[1],j=z.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Q=j[1];let B=z.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)X=B[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let H=z.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=Z.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",U=Z.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),_=U?U[1].trim():"";return{tag:Q,props:X,template:q,styles:_,script:Y,shadowDOM:G}}function IX(Z){let{tag:$,props:J,template:Y,styles:Q,shadowDOM:X}=Z,G=$.split("-").map((W)=>W.charAt(0).toUpperCase()+W.slice(1)).join(""),K=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),U=J.map((W)=>`'${W}'`).join(", "),_=J.map((W)=>`
1568
+ `)}function d($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var K3,q3;var k4=P(()=>{l0();R0();K3={name:"meta",handler:($,Z,J,Y)=>{if(Z.length<1)return o("Meta","meta directive requires at least the meta name",u.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${d(Q)}" content="${d(X)}">`},hasEndTag:!1},q3={name:"structuredData",handler:($,Z,J,Y)=>{if($.trim()==="")return o("StructuredData","structuredData directive requires JSON-LD content",u.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return o("StructuredData","structuredData requires @type property",u.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 o("StructuredData",X,u.EVALUATION_ERROR)}},hasEndTag:!0}});import e1 from"path";function CX($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=J?J[1].trim():"",Q=Z,X=[],G=!0;if(Y){let W=Y.match(/export\s+default\s+({[\s\S]*})/);if(W)try{let z=W[1],j=z.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Q=j[1];let B=z.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=z.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():"",U=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),_=U?U[1].trim():"";return{tag:Q,props:X,template:q,styles:_,script:Y,shadowDOM:G}}function PX($){let{tag:Z,props:J,template:Y,styles:Q,shadowDOM:X}=$,G=Z.split("-").map((W)=>W.charAt(0).toUpperCase()+W.slice(1)).join(""),K=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),U=J.map((W)=>`'${W}'`).join(", "),_=J.map((W)=>`
1569
1569
  get ${W}() {
1570
1570
  return this.getAttribute('${W}') || '';
1571
1571
  }
@@ -1615,17 +1615,17 @@ ${_}
1615
1615
  }
1616
1616
  }
1617
1617
 
1618
- customElements.define('${$}', ${G});
1619
- `}async function X3(Z,$,J,Y){if($.length<1)return s("WebComponent","@webcomponent directive requires at least the tag name parameter",u.INVALID_DIRECTIVE_SYNTAX);let Q=$[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",K=[e5.join(e5.dirname(Y),G,`${Q}.stx`),e5.join(process.cwd(),G,`${Q}.stx`),e5.join(e5.dirname(Y),`${Q}.stx`)],q=null;for(let W of K)if(await c(W)){q=await Bun.file(W).text();break}if(!q)return s("WebComponent",`Component file not found: ${Q}.stx`,u.FILE_NOT_FOUND);let U=MX(q,Q);return`<script type="module">
1620
- ${IX(U)}
1621
- </script>`}var Q3=P(()=>{l4();V4()});var G3={};r(G3,{timingPlugin:()=>bX,pluginManager:()=>EX,definePlugin:()=>a7,debugPlugin:()=>SX,createVariablesPlugin:()=>yX,createFilterPlugin:()=>kX,createDirectivePlugin:()=>DX,PluginManager:()=>k6});function a7(Z){return Z}class k6{plugins=new Map;sortedPlugins=[];initialized=!1;async register(Z,$){if(this.plugins.has(Z.name))throw Error(`Plugin "${Z.name}" is already registered`);if(Z.dependencies){for(let J of Z.dependencies)if(!this.plugins.has(J))throw Error(`Plugin "${Z.name}" depends on "${J}" which is not registered`)}if(this.plugins.set(Z.name,Z),Z.onRegister)await Z.onRegister($);this.sortPlugins()}async unregister(Z){let $=this.plugins.get(Z);if(!$)return!1;for(let[J,Y]of this.plugins)if(Y.dependencies?.includes(Z))throw Error(`Cannot unregister "${Z}" because "${J}" depends on it`);if($.onUnregister)await $.onUnregister();return this.plugins.delete(Z),this.sortPlugins(),!0}get(Z){return this.plugins.get(Z)}has(Z){return this.plugins.has(Z)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let Z=[];for(let $ of this.sortedPlugins)if($.registerDirectives)Z.push(...$.registerDirectives());return Z}getAllFilters(){let Z={};for(let $ of this.sortedPlugins)if($.registerFilters)Object.assign(Z,$.registerFilters());return Z}async runBeforeProcess(Z){return this.runHooks("beforeProcess",Z)}async runAfterParse(Z){return this.runHooks("afterParse",Z)}async runBeforeDirective(Z,$){return this.runDirectiveHooks("beforeDirective",Z,$)}async runAfterDirective(Z,$){return this.runDirectiveHooks("afterDirective",Z,$)}async runBeforeRender(Z){return this.runHooks("beforeRender",Z)}async runAfterRender(Z){return this.runHooks("afterRender",Z)}async runOnError(Z){for(let $ of this.sortedPlugins)if($.onError)try{let J=await $.onError(Z);if(J){if(J.template!==void 0)Z.template=J.template;if(J.context)Z.context={...Z.context,...J.context};if(J.metadata)Z.metadata={...Z.metadata,...J.metadata};if(J.skip)return Z}}catch(J){console.error(`Error in plugin "${$.name}" onError hook:`,J)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((Z,$)=>(Z.priority??100)-($.priority??100))}async runHooks(Z,$){let J={...$};for(let Y of this.sortedPlugins){let Q=Y[Z];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}" ${Z} hook:`,X)}}return J}async runDirectiveHooks(Z,$,J){let Y={...J};for(let Q of this.sortedPlugins){let X=Q[Z];if(X)try{let G=await X($,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}" ${Z} hook:`,G)}}return Y}}function DX(Z,$,J={}){return{name:Z,...J,registerDirectives:()=>$}}function kX(Z,$,J={}){return{name:Z,...J,registerFilters:()=>$}}function yX(Z){return a7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess($){return{context:{...$.context,...Z}}}})}var EX,SX,bX;var K3=P(()=>{EX=new k6;SX=a7({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(Z){console.log("[stx-debug] beforeProcess:",Z.filePath)},afterParse(Z){console.log("[stx-debug] afterParse:",Z.template.length,"chars")},beforeDirective(Z,$){console.log("[stx-debug] beforeDirective:",Z)},afterDirective(Z,$){console.log("[stx-debug] afterDirective:",Z)},beforeRender(Z){console.log("[stx-debug] beforeRender")},afterRender(Z){console.log("[stx-debug] afterRender:",Z.template.length,"chars")},onError(Z){console.error("[stx-debug] onError:",Z.error.message,"in phase:",Z.phase)}}),bX=a7({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(Z){Z.metadata.startTime=performance.now()},afterRender(Z){let $=Z.metadata.startTime;if($){let J=performance.now()-$;console.log(`[stx-timing] Processing took ${J.toFixed(2)}ms`)}}})});var _3={};r(_3,{validateConfig:()=>xX,loadStxConfig:()=>H5,defineStxConfig:()=>vX,defaultConfig:()=>b6,config:()=>y6});import S6 from"fs";import w4 from"path";import{loadConfigWithResult as CX}from"bunfig";function PX(Z,$){let J=$||"pages";if(Z)return{root:Z,pagesDir:J};let Y=w4.join(process.cwd(),"resources","views"),Q=w4.join(process.cwd(),"resources","layouts");if(S6.existsSync(Y)&&S6.existsSync(Q))return{root:"resources",pagesDir:"views"};let X=w4.join(process.cwd(),"resources","views","pages");if(S6.existsSync(X))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}async function H5(Z){if(!Z){if(D5)return D5;if(t7)return t7}let $=Z?w4.resolve(Z):process.cwd(),J=q3.get($);if(J)return J;let Y=(async()=>{let X=(await CX({name:"stx",alias:"ui",cwd:$,defaultConfig:b6,verbose:!1})).config,G=PX(X.root,X.pagesDir);if(X.root=G.root,X.pagesDir=G.pagesDir,X.root&&X.root!=="."){let K=X.root;if(X.partialsDir&&!w4.isAbsolute(X.partialsDir))X.partialsDir=w4.join(K,X.partialsDir);if(X.componentsDir&&!w4.isAbsolute(X.componentsDir))X.componentsDir=w4.join(K,X.componentsDir);if(X.layoutsDir&&!w4.isAbsolute(X.layoutsDir))X.layoutsDir=w4.join(K,X.layoutsDir)}if(X.plugins&&X.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (K3(),G3)),q=[],U=[];for(let _ of X.plugins){let W=typeof _==="string"?_:_[0],z=typeof _==="string"?{}:_[1]||{};try{let j,B;try{j=await import(W),B=w4.dirname(J4.resolve(W))}catch{let F=w4.resolve(process.cwd(),W);j=await import(F),B=w4.dirname(F)}let H=j.default||j;if(K.register(H,X),H.components){let F=w4.resolve(B,H.components);q.push(F)}if(H.pages){let F=w4.resolve(B,H.pages),L=z.path||"/";U.push({dir:F,prefix:L})}if(H.setup){let F={addDirective:(L)=>{X.customDirectives=X.customDirectives||[],X.customDirectives.push(L)},addRoute:(L,O)=>{X.apiRoutes=X.apiRoutes||{},X.apiRoutes[L]=O},addMiddleware:(L)=>{X.middleware=X.middleware||[],X.middleware.push(L)},pluginDir:B,config:X};await H.setup(z,F)}console.log(`[stx] Plugin loaded: ${H.name||W}`)}catch(j){console.warn(`[stx] Failed to load plugin ${W}:`,j.message)}}X._pluginComponentDirs=q,X._pluginPageDirs=U}return X})();if(q3.set($,Y),!Z)t7=Y,Y.then((Q)=>{D5=Q}).catch(()=>{});return Y}function vX(Z){return Z}function xX(Z){let $=[],J=[];if(Z.partialsDir!==void 0&&typeof Z.partialsDir!=="string")$.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(Z.componentsDir!==void 0&&typeof Z.componentsDir!=="string")$.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(Z.cache!==void 0&&typeof Z.cache!=="boolean")$.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(Z.debug!==void 0&&typeof Z.debug!=="boolean")$.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(Z.streaming){if(Z.streaming.bufferSize!==void 0){if(typeof Z.streaming.bufferSize!=="number"||Z.streaming.bufferSize<=0)$.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(Z.streaming.timeout!==void 0){if(typeof Z.streaming.timeout!=="number"||Z.streaming.timeout<=0)$.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(Z.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes(Z.streaming.strategy))$.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if(Z.i18n){if(Z.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes(Z.i18n.format))$.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if(Z.animation){if(Z.animation.defaultDuration!==void 0){if(typeof Z.animation.defaultDuration!=="number"||Z.animation.defaultDuration<0)$.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(Z.animation.staggerDelay!==void 0){if(typeof Z.animation.staggerDelay!=="number"||Z.animation.staggerDelay<0)$.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(Z.a11y){if(Z.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes(Z.a11y.level))$.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if(Z.hydration){if(Z.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes(Z.hydration.mode))$.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if(Z.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes(Z.hydration.preload))$.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if(Z.customDirectives)if(!Array.isArray(Z.customDirectives))$.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else Z.customDirectives.forEach((Y,Q)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(Z.middleware)if(!Array.isArray(Z.middleware))$.push({path:"middleware",message:"middleware must be an array",severity:"error"});else Z.middleware.forEach((Y,Q)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))$.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(Z.debug===!0&&Z.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(Z.seo?.enabled===!0&&!Z.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(Z.pwa){if(Z.pwa.enabled===!0&&!Z.pwa.manifest?.name)$.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(Z.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes(Z.pwa.manifest.display))$.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if(Z.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes(Z.pwa.manifest.orientation))$.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if(Z.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];Z.pwa.routes.forEach((Q,X)=>{if(!Q.pattern||typeof Q.pattern!=="string")$.push({path:`pwa.routes[${X}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(Q.strategy))$.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))$.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))$.push({path:`pwa.routes[${X}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(Z.pwa.icons?.sizes){if(!Array.isArray(Z.pwa.icons.sizes))$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(Z.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(Z.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if(Z.pwa.icons.purpose.filter((X)=>!Y.includes(X)).length>0)$.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if(Z.pwa.enabled===!0&&!Z.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(Z.pwa.enabled===!0&&!Z.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:$.length===0,errors:$,warnings:J}}var b6,D5=null,q3,t7=null,y6;var Z7=P(()=>{EZ();DZ();kZ();SZ();cZ();V8();R6();c8();D6();Q3();b6={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:c$,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:X3,hasEndTag:!1,description:"Include a web component in the template"},n0,s0,Y3,J3,o0,a0,t0,r0,Y$,Q$,F8,A6,...l8],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}};q3=new Map;y6=new Proxy(b6,{get(Z,$){if(D5&&$ in D5)return D5[$];if(!t7)H5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return Z[$]}})});var H3={};r(H3,{resetCrosswindCache:()=>gX,rebuildCrosswindCSS:()=>dX,loadCrosswindConfig:()=>v6,loadCrosswind:()=>P6,injectCrosswindCSS:()=>Y7,getCachedCSS:()=>mX,generateCrosswindCSS:()=>j3,extractClassNames:()=>B3,buildCrosswindCSS:()=>z3});import U3 from"fs";import a from"path";async function W3(Z){try{let $=await import(Z);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig}}catch{}return null}function fX(){let Z=[],$=process.env.HOME||process.env.USERPROFILE||"",J=process.cwd();while(J!==a.dirname(J))Z.push(a.join(J,"node_modules","@cwcss","crosswind","dist","index.js")),Z.push(a.join(J,"node_modules","@cwcss","crosswind","src","index.ts")),Z.push(a.join(J,"node_modules","@stacksjs","crosswind","dist","index.js")),J=a.dirname(J);if($){let Y=[a.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),a.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),a.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),a.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),a.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),a.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];Z.push(...Y)}return Z.push(a.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),Z.push(a.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),Z}async function P6(){if(C6)return S5;C6=!0;try{let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let Y=await W3(J);if(Y)return S5=Y,console.log(`${K4.green}[Crosswind]${K4.reset} CSS engine loaded`),S5}let $=fX();for(let J of $)if(await Bun.file(J).exists()){let Y=await W3(J);if(Y)return S5=Y,console.log(`${K4.green}[Crosswind]${K4.reset} CSS engine loaded from ${a.dirname(a.dirname(J))}`),S5}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${K4.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${K4.reset}`),console.warn(`${K4.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${K4.reset}`),null}}function gX(){S5=null,C6=!1,g4=null,$7=""}async function v6(Z){let $=null;for(let J of hX){let Y=a.join(Z,J);if(await Bun.file(Y).exists()){$=Y;break}}if(!$)return null;try{let{loadConfigWithResult:J}=await import("bunfig"),Y=await J({name:"crosswind",cwd:Z,defaultConfig:{},verbose:!1});if(Y?.config&&Object.keys(Y.config).length>0){let Q=Y.path?a.relative(Z,Y.path):a.relative(Z,$);return console.log(`${K4.green}[Crosswind]${K4.reset} Loaded config from ${Q||$}`),Y.config}}catch{}try{let J=await import($),Y=J.default||J,Q=a.relative(Z,$);return console.log(`${K4.green}[Crosswind]${K4.reset} Loaded config from ${Q||$}`),Y}catch(J){return console.warn(`${K4.yellow}[Crosswind]${K4.reset} Failed to load ${a.basename($)}:`,J instanceof Error?J.message:J),null}}async function z3(Z){if(k5)return $7;k5=!0;try{let $=await P6();if(!$||!$.build)return k5=!1,"";if(!g4)g4=await v6(Z);if(!g4)return k5=!1,"";let J=$.defaultConfig?.theme||{},Y=g4.theme||{},Q={...$.defaultConfig,...g4,theme:{...J,...Y,extend:{...J.extend||{},...Y.extend||{}}}},X=performance.now(),G=await $.build(Q),K=performance.now()-X;if($7=G.css,console.log(`${K4.cyan}[Crosswind]${K4.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),Q.output){let q=a.isAbsolute(Q.output)?Q.output:a.join(Z,Q.output),U=a.dirname(q);if(!U3.existsSync(U))U3.mkdirSync(U,{recursive:!0});await Bun.write(q,G.css)}return k5=!1,G.css}catch($){return console.error(`${K4.red}[Crosswind]${K4.reset} Build error:`,$),k5=!1,$7}}async function dX(Z){g4=null,await z3(Z)}function mX(){return $7}function B3(Z){let $=new Set,J=/class\s*=\s*["']([^"']+)["']/gi,Y=J.exec(Z);while(Y!==null){for(let G of Y[1].split(/\s+/))if(G.trim())$.add(G.trim());Y=J.exec(Z)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,X=Q.exec(Z);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())$.add(q.trim())}X=Q.exec(Z)}return $}async function j3(Z,$){try{let J=await P6();if(!J)return"";let Y=B3(Z);if(Y.size===0)return"";let Q=$?a.resolve($):process.cwd();if(!g4){let L=null;try{let{loadStxConfig:O}=await Promise.resolve().then(() => (Z7(),_3)),V=await O(Q);if(V.css)if(typeof V.css==="string"){let A=a.isAbsolute(V.css)?V.css:a.resolve(Q,V.css);if(await Bun.file(A).exists()){let N=await import(A);L=N.default||N,console.log(`${K4.green}[Crosswind]${K4.reset} Loaded config from stx.config.ts \u2192 ${V.css}`)}}else{if(L={content:V.css.content||[],preflight:V.css.preflight??!0,minify:V.css.minify??!1},V.css.config){let A=a.isAbsolute(V.css.config)?V.css.config:a.resolve(Q,V.css.config);if(await Bun.file(A).exists()){let N=await import(A);L={...N.default||N,...L}}}console.log(`${K4.green}[Crosswind]${K4.reset} Using inline CSS config from stx.config.ts`)}}catch{}g4=L||await v6(Q)}let X=J.defaultConfig||J.config,G=g4||{},K=X.theme||{},U=(G.theme||{}).extend||{},_={...K};if(Object.keys(U).length>0)_.extend=U;let W=[...X.safelist||[],...G.safelist||[]],z={...X,...G,content:[],output:"",preflight:!0,minify:!1,theme:_,safelist:W},j=new J.CSSGenerator(z);for(let L of W)j.generate(L);for(let L of Y)j.generate(L);let B=j.toCSS(!0,!1),H=z.shortcuts||G.shortcuts||{};for(let[L,O]of Object.entries(H)){if(!Y.has(L)&&!W.includes(L))continue;let V=O.split(/\s+/).filter(Boolean);for(let A of V)j.generate(A)}B=j.toCSS(!0,!1);let F=B.split(`
1622
- `);for(let[L,O]of Object.entries(H)){if(!Y.has(L)&&!W.includes(L))continue;let V=O.split(/\s+/).filter(Boolean),A=[],N=[];for(let R of V){let w=R.startsWith("dark:"),T=`.${(w?R.slice(5):R).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let I=0;I<F.length;I++){let D=F[I].trim();if(D===`${T} {`||D.startsWith(`${T} {`)){let y=I,b="";while(y<F.length){if(b+=F[y],F[y].includes("}"))break;y++}let S=b.match(/\{([^}]+)\}/);if(S)if(w)N.push(S[1].trim());else A.push(S[1].trim());break}}}if(A.length)B+=`
1623
- .${L} { ${A.join(" ")} }`;if(N.length)B+=`
1624
- @media (prefers-color-scheme: dark) { .dark .${L} { ${N.join(" ")} } }`}return B}catch(J){return console.warn("Failed to generate Crosswind CSS:",J),""}}async function Y7(Z,$){if(Z.includes('data-crosswind="generated"'))return Z;let J=await j3(Z,$);if(!J)return Z;let Y=`<style data-crosswind="generated">
1618
+ customElements.define('${Z}', ${G});
1619
+ `}async function _3($,Z,J,Y){if(Z.length<1)return o("WebComponent","@webcomponent directive requires at least the tag name parameter",u.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",K=[e1.join(e1.dirname(Y),G,`${Q}.stx`),e1.join(process.cwd(),G,`${Q}.stx`),e1.join(e1.dirname(Y),`${Q}.stx`)],q=null;for(let W of K)if(await c(W)){q=await Bun.file(W).text();break}if(!q)return o("WebComponent",`Component file not found: ${Q}.stx`,u.FILE_NOT_FOUND);let U=CX(q,Q);return`<script type="module">
1620
+ ${PX(U)}
1621
+ </script>`}var U3=P(()=>{l0();V0()});var W3={};r(W3,{timingPlugin:()=>hX,pluginManager:()=>vX,definePlugin:()=>a5,debugPlugin:()=>gX,createVariablesPlugin:()=>dX,createFilterPlugin:()=>fX,createDirectivePlugin:()=>xX,PluginManager:()=>S4});function a5($){return $}class S4{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 xX($,Z,J={}){return{name:$,...J,registerDirectives:()=>Z}}function fX($,Z,J={}){return{name:$,...J,registerFilters:()=>Z}}function dX($){return a5({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var vX,gX,hX;var z3=P(()=>{vX=new S4;gX=a5({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)}}),hX=a5({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 j3={};r(j3,{validateConfig:()=>lX,loadStxConfig:()=>H1,defineStxConfig:()=>pX,defaultConfig:()=>y4,config:()=>C4});import b4 from"fs";import w0 from"path";import{loadConfigWithResult as mX}from"bunfig";function uX($,Z){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=w0.join(process.cwd(),"resources","views"),Q=w0.join(process.cwd(),"resources","layouts");if(b4.existsSync(Y)&&b4.existsSync(Q))return{root:"resources",pagesDir:"views"};let X=w0.join(process.cwd(),"resources","views","pages");if(b4.existsSync(X))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}async function H1($){if(!$){if(D1)return D1;if(t5)return t5}let Z=$?w0.resolve($):process.cwd(),J=B3.get(Z);if(J)return J;let Y=(async()=>{let X=(await mX({name:"stx",alias:"ui",cwd:Z,defaultConfig:y4,verbose:!1})).config,G=uX(X.root,X.pagesDir);if(X.root=G.root,X.pagesDir=G.pagesDir,X.root&&X.root!=="."){let K=X.root;if(X.partialsDir&&!w0.isAbsolute(X.partialsDir))X.partialsDir=w0.join(K,X.partialsDir);if(X.componentsDir&&!w0.isAbsolute(X.componentsDir))X.componentsDir=w0.join(K,X.componentsDir);if(X.layoutsDir&&!w0.isAbsolute(X.layoutsDir))X.layoutsDir=w0.join(K,X.layoutsDir)}if(X.plugins&&X.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (z3(),W3)),q=[],U=[];for(let _ of X.plugins){let W=typeof _==="string"?_:_[0],z=typeof _==="string"?{}:_[1]||{};try{let j,B;try{j=await import(W),B=w0.dirname(J0.resolve(W))}catch{let F=w0.resolve(process.cwd(),W);j=await import(F),B=w0.dirname(F)}let O=j.default||j;if(K.register(O,X),O.components){let F=w0.resolve(B,O.components);q.push(F)}if(O.pages){let F=w0.resolve(B,O.pages),L=z.path||"/";U.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(z,F)}console.log(`[stx] Plugin loaded: ${O.name||W}`)}catch(j){console.warn(`[stx] Failed to load plugin ${W}:`,j.message)}}X._pluginComponentDirs=q,X._pluginPageDirs=U}return X})();if(B3.set(Z,Y),!$)t5=Y,Y.then((Q)=>{D1=Q}).catch(()=>{});return Y}function pX($){return $}function lX($){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 y4,D1=null,B3,t5=null,C4;var $5=P(()=>{D$();k$();S$();b$();i$();TZ();w4();rZ();k4();U3();y4={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:r6,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:_3,hasEndTag:!1,description:"Include a web component in the template"},t7,e7,K3,q3,$6,Y6,J6,Z6,K6,U6,wZ,A4,...sZ],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}};B3=new Map;C4=new Proxy(y4,{get($,Z){if(D1&&Z in D1)return D1[Z];if(!t5)H1().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}})});var N3={};r(N3,{resetCrosswindCache:()=>iX,rebuildCrosswindCSS:()=>oX,loadCrosswindConfig:()=>x4,loadCrosswind:()=>v4,injectCrosswindCSS:()=>Y5,getCachedCSS:()=>sX,generateCrosswindCSS:()=>V3,extractClassNames:()=>F3,buildCrosswindCSS:()=>L3});import O3 from"fs";import a from"path";async function H3($){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 cX(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",J=process.cwd();while(J!==a.dirname(J))$.push(a.join(J,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(a.join(J,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(a.join(J,"node_modules","@stacksjs","crosswind","dist","index.js")),J=a.dirname(J);if(Z){let Y=[a.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),a.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),a.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),a.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),a.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),a.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(a.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(a.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function v4(){if(P4)return S1;P4=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of $){let Y=await H3(J);if(Y)return S1=Y,console.log(`${K0.green}[Crosswind]${K0.reset} CSS engine loaded`),S1}let Z=cX();for(let J of Z)if(await Bun.file(J).exists()){let Y=await H3(J);if(Y)return S1=Y,console.log(`${K0.green}[Crosswind]${K0.reset} CSS engine loaded from ${a.dirname(a.dirname(J))}`),S1}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${K0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${K0.reset}`),console.warn(`${K0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${K0.reset}`),null}}function iX(){S1=null,P4=!1,g0=null,Z5=""}async function x4($){let Z=null;for(let J of nX){let Y=a.join($,J);if(await Bun.file(Y).exists()){Z=Y;break}}if(!Z)return null;try{let{loadConfigWithResult:J}=await import("bunfig"),Y=await J({name:"crosswind",cwd:$,defaultConfig:{},verbose:!1});if(Y?.config&&Object.keys(Y.config).length>0){let Q=Y.path?a.relative($,Y.path):a.relative($,Z);return console.log(`${K0.green}[Crosswind]${K0.reset} Loaded config from ${Q||Z}`),Y.config}}catch{}try{let J=await import(Z),Y=J.default||J,Q=a.relative($,Z);return console.log(`${K0.green}[Crosswind]${K0.reset} Loaded config from ${Q||Z}`),Y}catch(J){return console.warn(`${K0.yellow}[Crosswind]${K0.reset} Failed to load ${a.basename(Z)}:`,J instanceof Error?J.message:J),null}}async function L3($){if(k1)return Z5;k1=!0;try{let Z=await v4();if(!Z||!Z.build)return k1=!1,"";if(!g0)g0=await x4($);if(!g0)return k1=!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(Z5=G.css,console.log(`${K0.cyan}[Crosswind]${K0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),Q.output){let q=a.isAbsolute(Q.output)?Q.output:a.join($,Q.output),U=a.dirname(q);if(!O3.existsSync(U))O3.mkdirSync(U,{recursive:!0});await Bun.write(q,G.css)}return k1=!1,G.css}catch(Z){return console.error(`${K0.red}[Crosswind]${K0.reset} Build error:`,Z),k1=!1,Z5}}async function oX($){g0=null,await L3($)}function sX(){return Z5}function F3($){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 V3($,Z){try{let J=await v4();if(!J)return"";let Y=F3($);if(Y.size===0)return"";let Q=Z?a.resolve(Z):process.cwd();if(!g0){let L=null;try{let{loadStxConfig:H}=await Promise.resolve().then(() => ($5(),j3)),V=await H(Q);if(V.css)if(typeof V.css==="string"){let R=a.isAbsolute(V.css)?V.css:a.resolve(Q,V.css);if(await Bun.file(R).exists()){let N=await import(R);L=N.default||N,console.log(`${K0.green}[Crosswind]${K0.reset} Loaded config from stx.config.ts \u2192 ${V.css}`)}}else{if(L={content:V.css.content||[],preflight:V.css.preflight??!0,minify:V.css.minify??!1},V.css.config){let R=a.isAbsolute(V.css.config)?V.css.config:a.resolve(Q,V.css.config);if(await Bun.file(R).exists()){let N=await import(R);L={...N.default||N,...L}}}console.log(`${K0.green}[Crosswind]${K0.reset} Using inline CSS config from stx.config.ts`)}}catch{}g0=L||await x4(Q)}let X=J.defaultConfig||J.config,G=g0||{},K=X.theme||{},U=(G.theme||{}).extend||{},_={...K};if(Object.keys(U).length>0)_.extend=U;let W=[...X.safelist||[],...G.safelist||[]],z={...X,...G,content:[],output:"",preflight:!0,minify:!1,theme:_,safelist:W},j=new J.CSSGenerator(z);for(let L of W)j.generate(L);for(let L of Y)j.generate(L);let B=j.toCSS(!0,!1),O=z.shortcuts||G.shortcuts||{};for(let[L,H]of Object.entries(O)){if(!Y.has(L)&&!W.includes(L))continue;let V=H.split(/\s+/).filter(Boolean);for(let R of V)j.generate(R)}B=j.toCSS(!0,!1);let F=B.split(`
1622
+ `);for(let[L,H]of Object.entries(O)){if(!Y.has(L)&&!W.includes(L))continue;let V=H.split(/\s+/).filter(Boolean),R=[],N=[];for(let A of V){let w=A.startsWith("dark:"),T=`.${(w?A.slice(5):A).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let I=0;I<F.length;I++){let D=F[I].trim();if(D===`${T} {`||D.startsWith(`${T} {`)){let y=I,b="";while(y<F.length){if(b+=F[y],F[y].includes("}"))break;y++}let S=b.match(/\{([^}]+)\}/);if(S)if(w)N.push(S[1].trim());else R.push(S[1].trim());break}}}if(R.length)B+=`
1623
+ .${L} { ${R.join(" ")} }`;if(N.length)B+=`
1624
+ @media (prefers-color-scheme: dark) { .dark .${L} { ${N.join(" ")} } }`}return B}catch(J){return console.warn("Failed to generate Crosswind CSS:",J),""}}async function Y5($,Z){if($.includes('data-crosswind="generated"'))return $;let J=await V3($,Z);if(!J)return $;let Y=`<style data-crosswind="generated">
1625
1625
  ${J}
1626
- </style>`;if(Z.includes("</head>"))return Z.replace("</head>",`${Y}
1627
- </head>`);if(Z.includes("<body"))return Z.replace(/<body([^>]*)>/,`<body$1>
1628
- ${Y}`);return Y+Z}var S5=null,C6=!1,g4=null,$7="",k5=!1,hX;var e7=P(()=>{c0();hX=["crosswind.config.ts","crosswind.config.js","crosswind.config.mjs","crosswind.config.cjs"]});function O3(){return`
1626
+ </style>`;if($.includes("</head>"))return $.replace("</head>",`${Y}
1627
+ </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
1628
+ ${Y}`);return Y+$}var S1=null,P4=!1,g0=null,Z5="",k1=!1,nX;var e5=P(()=>{r7();nX=["crosswind.config.ts","crosswind.config.js","crosswind.config.mjs","crosswind.config.cjs"]});function R3(){return`
1629
1629
  // STX Lifecycle Runtime
1630
1630
  (function() {
1631
1631
  if (typeof window === 'undefined') return;
@@ -1970,7 +1970,7 @@ else {
1970
1970
 
1971
1971
  console.log('[stx] Lifecycle runtime initialized');
1972
1972
  })();
1973
- `}function x6(Z){return Symbol(Z)}var Vz,Nz,Az;var L3=P(()=>{Vz=x6("theme"),Nz=x6("router"),Az=x6("i18n")});import*as V3 from"crypto";function F3(Z){let $=/\$(\w+)\./g,J=[],Y;while((Y=$.exec(Z))!==null)if(!J.includes(Y[1]))J.push(Y[1]);return J}function uX(){return`stx-${V3.randomBytes(4).toString("hex")}`}function pX(Z){return/\$\w+\./.test(Z)}function lX(Z){let $=[],J=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=Z;return Q=Q.replace(Y,(X,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return X;let U=[],_=!1,W=K,z=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(z)];for(let F of j){let L=F[0],O=F[1],V=F[2];if(pX(V)){_=!0;let A=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(A){let N=A[1];if(U.push({attr:O,expr:N,fullMatch:L,originalAttr:O}),F3(N).forEach((w)=>J.add(w)),O==="text")W=W.replace(L,"");else if(O==="class")W=W.replace(L,'class=""');else if(O==="disabled"||O==="hidden")W=W.replace(L,"");else W=W.replace(L,`${O}=""`)}}}if(!_)return X;let B=W.match(/\bid\s*=\s*"([^"]+)"/),H;if(B)H=B[1];else H=uX(),W=` id="${H}"${W}`;for(let F of U)$.push({elementId:H,attribute:F.attr,expression:F.expr,stores:F3(F.expr)});return`<${G}${W}${q}`}),{html:Q,bindings:$,stores:J}}function cX(Z,$){if(Z.length===0)return"";let J=Array.from($),Y=`
1973
+ `}function f4($){return Symbol($)}var Dz,kz,Sz;var A3=P(()=>{Dz=f4("theme"),kz=f4("router"),Sz=f4("i18n")});import*as T3 from"crypto";function w3($){let Z=/\$(\w+)\./g,J=[],Y;while((Y=Z.exec($))!==null)if(!J.includes(Y[1]))J.push(Y[1]);return J}function rX(){return`stx-${T3.randomBytes(4).toString("hex")}`}function aX($){return/\$\w+\./.test($)}function tX($){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 U=[],_=!1,W=K,z=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(z)];for(let F of j){let L=F[0],H=F[1],V=F[2];if(aX(V)){_=!0;let R=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(R){let N=R[1];if(U.push({attr:H,expr:N,fullMatch:L,originalAttr:H}),w3(N).forEach((w)=>J.add(w)),H==="text")W=W.replace(L,"");else if(H==="class")W=W.replace(L,'class=""');else if(H==="disabled"||H==="hidden")W=W.replace(L,"");else W=W.replace(L,`${H}=""`)}}}if(!_)return X;let B=W.match(/\bid\s*=\s*"([^"]+)"/),O;if(B)O=B[1];else O=rX(),W=` id="${O}"${W}`;for(let F of U)Z.push({elementId:O,attribute:F.attr,expression:F.expr,stores:w3(F.expr)});return`<${G}${W}${q}`}),{html:Q,bindings:Z,stores:J}}function eX($,Z){if($.length===0)return"";let J=Array.from(Z),Y=`
1974
1974
  <script>
1975
1975
  (function() {
1976
1976
  'use strict';
@@ -1990,7 +1990,7 @@ else {
1990
1990
  `;Y+=`
1991
1991
  // Binding update functions
1992
1992
  function updateBindings() {
1993
- `;for(let Q of Z){let{elementId:X,attribute:G,expression:K}=Q,q=K.replace(/\$(\w+)\./g,"$state.$1.");if(G==="text")Y+=` (function() {
1993
+ `;for(let Q of $){let{elementId:X,attribute:G,expression:K}=Q,q=K.replace(/\$(\w+)\./g,"$state.$1.");if(G==="text")Y+=` (function() {
1994
1994
  var el = document.getElementById('${X}');
1995
1995
  if (el) {
1996
1996
  try {
@@ -2096,10 +2096,10 @@ else {
2096
2096
  }
2097
2097
  })();
2098
2098
  </script>
2099
- `,Y}function N3(Z){let{html:$,bindings:J,stores:Y}=lX(Z);if(J.length===0)return Z;let Q=cX(J,Y),X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Q+$.slice(X);return $+Q}var A3=()=>{};function iX(Z){let $=Z.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return nX($);case"google-analytics":return sX($);case"plausible":return oX($);case"self-hosted":return rX($);case"custom":return aX($);default:return""}}function nX(Z){let $=Z.fathom;if(!$?.siteId)return"";let J=$.scriptUrl||"https://cdn.usefathom.com/script.js",Y=$.defer!==!1?" defer":"",Q=[`data-site="${D4($.siteId)}"`];if($.honorDnt)Q.push('data-honor-dnt="true"');if($.spa)Q.push('data-spa="auto"');if($.canonical)Q.push(`data-canonical="${D4($.canonical)}"`);if($.auto===!1)Q.push('data-auto="false"');return`
2099
+ `,Y}function M3($){let{html:Z,bindings:J,stores:Y}=tX($);if(J.length===0)return $;let Q=eX(J,Y),X=Z.lastIndexOf("</body>");if(X!==-1)return Z.slice(0,X)+Q+Z.slice(X);return Z+Q}var I3=()=>{};function $Q($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return ZQ(Z);case"google-analytics":return YQ(Z);case"plausible":return JQ(Z);case"self-hosted":return XQ(Z);case"custom":return QQ(Z);default:return""}}function ZQ($){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="${D0(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="${D0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
2100
2100
  <!-- Fathom Analytics -->
2101
- <script src="${D4(J)}" ${Q.join(" ")}${Y}></script>
2102
- `}function sX(Z){let $=Z.googleAnalytics;if(!$?.measurementId)return"";let J=D4($.measurementId),Y=$.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
2101
+ <script src="${D0(J)}" ${Q.join(" ")}${Y}></script>
2102
+ `}function YQ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=D0(Z.measurementId),Y=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
2103
2103
  <!-- Google Analytics -->
2104
2104
  <script async src="https://www.googletagmanager.com/gtag/js?id=${J}"></script>
2105
2105
  <script>
@@ -2109,10 +2109,10 @@ else {
2109
2109
  gtag('config', '${J}');
2110
2110
  ${Y}
2111
2111
  </script>
2112
- `}function oX(Z){let $=Z.plausible;if(!$?.domain)return"";let J=$.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${D4($.domain)}"`],Q=J,X=[];if($.trackLocalhost)X.push("local");if($.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`
2112
+ `}function JQ($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${D0(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`
2113
2113
  <!-- Plausible Analytics -->
2114
- <script defer data-domain="${D4($.domain)}" src="${D4(Q)}"></script>
2115
- `}function rX(Z){let $=Z.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let J=D4($.siteId),Y=D4($.apiEndpoint),Q=$.honorDnt?'if(n.doNotTrack==="1")return;':"",X=$.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=$.trackOutboundLinks?`
2114
+ <script defer data-domain="${D0(Z.domain)}" src="${D0(Q)}"></script>
2115
+ `}function XQ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=D0(Z.siteId),Y=D0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",X=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
2116
2116
  d.addEventListener('click',function(e){
2117
2117
  var a=e.target.closest('a');
2118
2118
  if(a&&a.hostname!==location.hostname){
@@ -2145,15 +2145,15 @@ else {
2145
2145
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
2146
2146
  })();
2147
2147
  </script>
2148
- `}function aX(Z){let $=Z.custom;if(!$)return"";if($.inlineScript)return`
2148
+ `}function QQ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
2149
2149
  <!-- Custom Analytics -->
2150
2150
  <script>
2151
- ${$.inlineScript}
2151
+ ${Z.inlineScript}
2152
2152
  </script>
2153
- `;if(!$.scriptUrl)return"";let J=[];if($.scriptId)J.push(`id="${D4($.scriptId)}"`);if($.attributes)for(let[Q,X]of Object.entries($.attributes))J.push(`${D4(Q)}="${D4(X)}"`);return`
2153
+ `;if(!Z.scriptUrl)return"";let J=[];if(Z.scriptId)J.push(`id="${D0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,X]of Object.entries(Z.attributes))J.push(`${D0(Q)}="${D0(X)}"`);return`
2154
2154
  <!-- Custom Analytics -->
2155
- <script${J.length>0?` ${J.join(" ")}`:""} src="${D4($.scriptUrl)}" defer></script>
2156
- `}function R3(Z,$){let J=iX($);if(!J)return Z;if(!Z.includes("</head>")){let Y=Z.lastIndexOf("</body>");if(Y!==-1)return Z.slice(0,Y)+J+Z.slice(Y);return Z+J}return Z.replace("</head>",`${J}</head>`)}function D4(Z){return Z.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var w3=()=>{};function I3(Z){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of Z){let Y=J.toLowerCase();if(Y==="prevent")$.prevent=!0;else if(Y==="stop")$.stop=!0;else if(Y==="once")$.once=!0;else if(Y==="capture")$.capture=!0;else if(Y==="self")$.self=!0;else if(Y==="passive")$.passive=!0;else if(tX.has(Y))$.systemKeys.push(Y);else if(Y in E3)$.mouse=Y;else if(Y in M3||/^[a-z]$/.test(Y))$.keys.push(M3[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let Q=Y.match(/debounce(?:\.(\d+))?/);$.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(Y.startsWith("throttle")){let Q=Y.match(/throttle(?:\.(\d+))?/);$.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return $}function D3(Z){let $=[],J=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=Y.exec(Z))!==null){let[X,G,K]=Q,q=Q.index,U=q+X.length,_=`__stx_evt_${J++}`,W=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=z.exec(K))!==null){let[,H,F]=j,L=H.split("."),O=L[0];if(!T3.has(O))continue;W.push({attribute:`@${H}`,event:O,handler:F,modifiers:I3(L.slice(1)),elementId:_})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(K))!==null){let[,H,F]=j,L=H.split("."),O=L[0];if(!T3.has(O))continue;W.push({attribute:`@${H}`,event:O,handler:F,modifiers:I3(L.slice(1)),elementId:_})}if(W.length>0)$.push({originalTag:X,elementId:_,events:W,startIndex:q,endIndex:U})}return $}function eX(Z){let $=[],{modifiers:J}=Z;if(J.self)$.push("if ($event.target !== $el) return");for(let Y of J.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(J.keys.length>0){let Y=J.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(J.mouse!==null){let Y=E3[J.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(J.prevent)$.push("$event.preventDefault()");if(J.stop)$.push("$event.stopPropagation()");return $.join("; ")}function ZQ(Z,$){let J=Z;if($.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${$.debounce})`;else if($.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${$.throttle})`;return J}function $Q(Z){let{modifiers:$}=Z,J=Z.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=eX(Z),Q=ZQ(Z.handler,$),X=[];if($.once)X.push("once: true");if($.capture)X.push("capture: true");if($.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(Z.event==="mounted")return`
2155
+ <script${J.length>0?` ${J.join(" ")}`:""} src="${D0(Z.scriptUrl)}" defer></script>
2156
+ `}function E3($,Z){let J=$Q(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 D0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var D3=()=>{};function b3($){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(GQ.has(Y))Z.systemKeys.push(Y);else if(Y in y3)Z.mouse=Y;else if(Y in S3||/^[a-z]$/.test(Y))Z.keys.push(S3[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 C3($){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,U=q+X.length,_=`__stx_evt_${J++}`,W=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=z.exec(K))!==null){let[,O,F]=j,L=O.split("."),H=L[0];if(!k3.has(H))continue;W.push({attribute:`@${O}`,event:H,handler:F,modifiers:b3(L.slice(1)),elementId:_})}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(!k3.has(H))continue;W.push({attribute:`@${O}`,event:H,handler:F,modifiers:b3(L.slice(1)),elementId:_})}if(W.length>0)Z.push({originalTag:X,elementId:_,events:W,startIndex:q,endIndex:U})}return Z}function KQ($){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=y3[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 qQ($,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 _Q($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=KQ($),Q=qQ($.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`
2157
2157
  (function() {
2158
2158
  var $el = document.getElementById('${J}');
2159
2159
  if (!$el) return;
@@ -2165,7 +2165,7 @@ ${$.inlineScript}
2165
2165
  else {
2166
2166
  ${Q}
2167
2167
  }
2168
- })();`;if(Z.event==="unmounted")return`
2168
+ })();`;if($.event==="unmounted")return`
2169
2169
  (function() {
2170
2170
  var $el = document.getElementById('${J}');
2171
2171
  if (!$el) return;
@@ -2195,7 +2195,7 @@ else {
2195
2195
  var $el = document.getElementById('${J}');
2196
2196
  if (!$el) return;
2197
2197
  // eslint-disable-next-line pickier/no-unused-vars
2198
- $el.addEventListener('${Z.event}', function($event) {
2198
+ $el.addEventListener('${$.event}', function($event) {
2199
2199
  ${Y?Y+";":""}
2200
2200
  // Find the closest reactive scope and execute within its context
2201
2201
  var scope = $el.closest('[data-stx-scope]');
@@ -2207,7 +2207,7 @@ else {
2207
2207
  ${Q}
2208
2208
  }
2209
2209
  }${G});
2210
- })();`}function YQ(Z){if(Z.length===0)return"";return`
2210
+ })();`}function UQ($){if($.length===0)return"";return`
2211
2211
  <script data-stx-events>
2212
2212
  (function() {
2213
2213
  'use strict';
@@ -2235,11 +2235,11 @@ else {
2235
2235
  }
2236
2236
 
2237
2237
  // Event listeners
2238
- ${Z.flatMap((J)=>J.events).map($Q).join(`
2238
+ ${$.flatMap((J)=>J.events).map(_Q).join(`
2239
2239
  `)}
2240
2240
  })();
2241
- </script>`}function JQ(Z){let $=D3(Z);if($.length===0)return{template:Z,bindings:[]};let J=Z,Y=[];for(let Q=$.length-1;Q>=0;Q--){let X=$[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,"\\$&"),U=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),_=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(U,""),G=G.replace(_,"")}J=J.slice(0,X.startIndex)+G+J.slice(X.endIndex),Y.push(...X.events)}return{template:J,bindings:Y}}function k3(Z,$,J){if(/\b(?:state|derived|effect)\s*\(/.test(Z)||/@(?:model|show|for|if)\s*=/.test(Z)||/data-stx(?:-auto)?(?![-\w])/.test(Z))return Z;if($.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(Z))return Z;let{template:q,bindings:U}=JQ(Z),_=$.__stx_event_bindings||[];return $.__stx_event_bindings=[..._,...U],q}let Q=D3(Z);if(Q.length===0)return Z;let X=Z;for(let q=Q.length-1;q>=0;q--){let U=Q[q],_=U.originalTag;if(!_.includes(" id="))_=_.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${U.elementId}"`);else{let W=_.match(/id=["']([^"']+)["']/);if(W)for(let z of U.events)z.elementId=W[1]}for(let W of U.events){let z=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");_=_.replace(j,""),_=_.replace(B,"")}X=X.slice(0,U.startIndex)+_+X.slice(U.endIndex)}let G=YQ(Q),K=X.lastIndexOf("</body>");if(K!==-1)X=X.slice(0,K)+G+`
2242
- `+X.slice(K);else X+=G;return X}var T3,M3,tX,E3;var S3=P(()=>{T3=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"]),M3={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"},tX=new Set(["ctrl","alt","shift","meta"]),E3={left:0,middle:1,right:2}});function ZZ(Z){return Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function b3(Z,$){let J=Z.match(new RegExp(`${$}\\s*=\\s*"([^"]*)"`,"i"));if(J)return J[1];let Y=Z.match(new RegExp(`${$}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function QQ(Z){let $=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=J.exec(Z))!==null){let[Q,X,G]=Y,K=Y.index,q=b3(G,"x-data");if(!q)continue;let U=`__stx_scope_${y3++}`,_=b3(G,"x-init"),W=GQ(Z,X,K+Q.length),z=Z.slice(K,W.endIndex),j=KQ(z);$.push({id:U,selector:`[data-stx-scope="${U}"]`,stateExpr:q,initExpr:_,bindings:[],refs:j})}return $}function GQ(Z,$,J){let Y=1,Q=J,X=new RegExp(`<${$}(?:\\s|>)`,"gi"),G=new RegExp(`</${$}>`,"gi"),K=new RegExp(`<${$}[^>]*/\\s*>`,"gi");while(Y>0&&Q<Z.length){X.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=X.exec(Z),U=G.exec(Z),_=K.exec(Z);if(_&&_.index<(q?.index??1/0)){Q=_.index+_[0].length;continue}if(!U)return{endIndex:Z.length};if(q&&q.index<U.index)Y++,Q=q.index+q[0].length;else{if(Y--,Y===0)return{endIndex:U.index+U[0].length};Q=U.index+U[0].length}}return{endIndex:Z.length}}function KQ(Z){let $=new Map,J=Z.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=qQ(X);$.set(G,K)}return $}function qQ(Z){let $=Z.match(/\bid\s*=\s*["']([^"']*)["']/);if($)return $[1];return`__stx_el_${XQ++}`}function _Q(){return`
2241
+ </script>`}function WQ($){let Z=C3($);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,"\\$&"),U=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),_=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(U,""),G=G.replace(_,"")}J=J.slice(0,X.startIndex)+G+J.slice(X.endIndex),Y.push(...X.events)}return{template:J,bindings:Y}}function P3($,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:U}=WQ($),_=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[..._,...U],q}let Q=C3($);if(Q.length===0)return $;let X=$;for(let q=Q.length-1;q>=0;q--){let U=Q[q],_=U.originalTag;if(!_.includes(" id="))_=_.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${U.elementId}"`);else{let W=_.match(/id=["']([^"']+)["']/);if(W)for(let z of U.events)z.elementId=W[1]}for(let W of U.events){let z=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");_=_.replace(j,""),_=_.replace(B,"")}X=X.slice(0,U.startIndex)+_+X.slice(U.endIndex)}let G=UQ(Q),K=X.lastIndexOf("</body>");if(K!==-1)X=X.slice(0,K)+G+`
2242
+ `+X.slice(K);else X+=G;return X}var k3,S3,GQ,y3;var v3=P(()=>{k3=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"]),S3={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"},GQ=new Set(["ctrl","alt","shift","meta"]),y3={left:0,middle:1,right:2}});function $$($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x3($,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 BQ($){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=x3(G,"x-data");if(!q)continue;let U=`__stx_scope_${f3++}`,_=x3(G,"x-init"),W=jQ($,X,K+Q.length),z=$.slice(K,W.endIndex),j=OQ(z);Z.push({id:U,selector:`[data-stx-scope="${U}"]`,stateExpr:q,initExpr:_,bindings:[],refs:j})}return Z}function jQ($,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($),U=G.exec($),_=K.exec($);if(_&&_.index<(q?.index??1/0)){Q=_.index+_[0].length;continue}if(!U)return{endIndex:$.length};if(q&&q.index<U.index)Y++,Q=q.index+q[0].length;else{if(Y--,Y===0)return{endIndex:U.index+U[0].length};Q=U.index+U[0].length}}return{endIndex:$.length}}function OQ($){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=HQ(X);Z.set(G,K)}return Z}function HQ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${zQ++}`}function LQ(){return`
2243
2243
  // STX Reactive Runtime - x-cloak and transition CSS
2244
2244
  (function() {
2245
2245
  var style = document.createElement('style');
@@ -2443,7 +2443,7 @@ window.__stx_reactive = (function() {
2443
2443
 
2444
2444
  return { initScope: initScope, reactive: reactive };
2445
2445
  })();
2446
- `}function UQ(Z){if(Z.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`
2446
+ `}function FQ($){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`
2447
2447
  (function() {
2448
2448
  var scopeEl = document.querySelector('${J.selector}');
2449
2449
  if (!scopeEl) return;
@@ -2452,77 +2452,77 @@ window.__stx_reactive = (function() {
2452
2452
  })();`}).join(`
2453
2453
  `);return`
2454
2454
  <script data-stx-scoped data-stx-reactive>
2455
- ${_Q()}
2456
- ${$}
2457
- </script>`}function C3(Z,$,J){if(y3=0,!zQ(Z))return Z;let Y=QQ(Z);if(Y.length===0)return Z;let Q=WQ(Z,Y),X=UQ(Y),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+X+`
2458
- `+Q.slice(G);else Q+=X;return Q}function WQ(Z,$){let J=Z;for(let Y of $){let X=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${ZZ(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*["']${ZZ(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*"${ZZ(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*'${ZZ(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 zQ(Z){return/x-data\s*=\s*["']/.test(Z)}var y3=0,XQ=0;import BQ from"fs";import f6 from"path";import{createHighlighter as jQ}from"ts-syntax-highlighter";async function HQ(Z,$={}){try{if(!await c(Z))throw Error(`Markdown file not found: ${Z}`);let Y=(await BQ.promises.stat(Z)).mtime.getTime();if($.cache&&g6.has(Z)){let W=g6.get(Z);if(W.updatedAt>=Y)return{content:W.content,data:W.data}}let Q=await Bun.file(Z).text(),{data:X,content:G}=K$(Q),K=$.markdown||y6.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=m5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)U=await OQ(U,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let _={content:U,data:X||{}};if($.cache)g6.set(Z,{..._,updatedAt:Y});return _}catch(J){if($.debug)console.error(`Error reading/parsing markdown file ${Z}:`,J);let Y=J instanceof Error?J.message:String(J);return{content:Q4("Markdown File",`Error reading/parsing markdown file: ${Y}`,Z,"",0,""),data:{}}}}async function OQ(Z,$,J){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!$Z)try{$Z=await jQ({theme:$||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),Z}let Q=async(K,q,U,_)=>{let W=_.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),z=U||(J?"text":"");if(!z)return K;try{if(!$Z.getSupportedLanguages().includes(z))return K;return(await $Z.highlight(W,z,{theme:$})).html}catch(j){console.error(`Error highlighting code block with language ${U}:`,j)}return K},X=Z,G=Z.matchAll(Y);for(let K of G){let[q,U,_,W]=K,z=await Q(q,U,_,W);X=X.replace(q,z)}return X}async function P3(Z,$,J="",Y={}){return await LQ(Z,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,U)=>{try{let _=K;if(!f6.isAbsolute(K))_=f6.resolve(f6.dirname(J),K);let W={};if(q)try{try{W=JSON.parse(q)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let A=V.indexOf(":");if(A>0){let N=V.substring(0,A).trim(),R=V.substring(A+1).trim(),w=R.startsWith('"')&&R.endsWith('"'),M=R.startsWith("'")&&R.endsWith("'");if(w||M)R=R.substring(1,R.length-1);W[N]=R}}}}catch(L){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:z,data:j}=await HQ(_,Y),B={...$,...j,...W},H=z,F=/\{\{([^}]+)\}\}/g;return H=H.replace(F,(L,O)=>{let V=O.trim();return B[V]!==void 0?String(B[V]):L}),H}catch(_){let W=_ instanceof Error?_.message:String(_);return Q4("Markdown File",`Error including markdown file: ${W}`,J,Z,U,G)}})}async function LQ(Z,$,J){let Y=[],Q;while((Q=$.exec(Z))!==null){let K=Q[0],q=Q.index,U=Q;Y.push(J(...U).then((_)=>({match:K,replacement:_,index:q})))}let X=await Promise.all(Y);X.sort((K,q)=>q.index-K.index);let G=Z;for(let{match:K,replacement:q}of X)G=G.replace(K,()=>q);return G}var g6,$Z=null;var v3=P(()=>{Z7();V4();g6=new Map});function r4(Z,$){try{let J=Z.trim();if(e(J))return Z4(J,Object.keys($))(...Object.values($));else return X4(J,$)}catch{return!1}}var x3=P(()=>{A4()});function a4(Z,$){let J=FQ(Z,$);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function FQ(Z,$){let J=$;while(J<Z.length&&/\s/.test(Z[J]))J++;if(Z[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let Y=I4(Z,"(",")",J);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:Z.slice(J+1,Y),endPos:Y+1}}function O5(Z,$,J,Y){let Q=1,X=Y,G=new RegExp(`@${$}\\s*\\(`,"g"),K=new RegExp(`@${J}(?![a-z])`,"g");while(X<Z.length&&Q>0){G.lastIndex=X,K.lastIndex=X;let q=G.exec(Z),U=K.exec(Z),_=q?q.index:1/0,W=U?U.index:1/0;if(_<W)Q++,X=_+q[0].length;else if(W<1/0){if(Q--,Q===0)return W;X=W+U[0].length}else break}return-1}function f3(Z,$){let J=Z.slice($).match(/^@if\s*/);if(!J)return null;let Y=$+J[0].length,Q=a4(Z,Y);if(!Q)return null;let X=Q.endPos,G=O5(Z,"if","endif",X);if(G===-1)return null;let K=Z.slice(X,G),q=[],U=0,_="if",W=Q.expression,z=0,j=0;while(U<K.length){let B=K.indexOf("@",U);if(B===-1)break;U=B;let H=K.substring(B);if(/^@if\s*\(/.test(H)){j++,U++;continue}if(/^@endif(?![a-z])/.test(H)){j--,U+=6;continue}if(j===0){let F=H.match(/^@elseif\s*/);if(F){q.push({type:_,condition:W,content:K.substring(z,U),start:X+z,end:X+U});let L=U+F[0].length,O=a4(K,L);if(!O){U++;continue}_="elseif",W=O.expression,U=O.endPos,z=U;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:_,condition:W,content:K.substring(z,U),start:X+z,end:X+U}),_="else",W=void 0,U+=5,z=U;continue}}U++}return q.push({type:_,condition:W,content:K.slice(z),start:X+z,end:X+K.length}),{fullMatch:Z.slice($,G+6),branches:q,start:$,end:G+6}}function h6(Z){let $=[],J=/@if\s*\(/g,Y=J.exec(Z);while(Y!==null){if($.some((G)=>Y.index>G.start&&Y.index<G.end)){Y=J.exec(Z);continue}let X=f3(Z,Y.index);if(X)$.push(X),J.lastIndex=X.end;Y=J.exec(Z)}return $}function YZ(Z,$,J){let Y=[],Q=new RegExp(`@${$}\\s*\\(`,"g"),X=Q.exec(Z);while(X!==null){if(Y.some((H)=>X.index>H.start&&X.index<H.end)){X=Q.exec(Z);continue}let K=X.index,q=K+X[0].length-1,U=I4(Z,"(",")",q);if(U===-1){X=Q.exec(Z);continue}let _=Z.slice(q+1,U),W=U+1,z=O5(Z,$,J,W);if(z===-1){X=Q.exec(Z);continue}let j=Z.slice(W,z),B=z+`@${J}`.length;Y.push({fullMatch:Z.slice(K,B),name:$,params:_,content:j,start:K,end:B}),Q.lastIndex=B,X=Q.exec(Z)}return Y}function d6(Z,$){let J=Z.slice($).match(/^@switch\s*/);if(!J)return null;let Y=$+J[0].length,Q=a4(Z,Y);if(!Q)return null;let X=Q.endPos,G=O5(Z,"switch","endswitch",X);if(G===-1)return null;let K=Z.slice(X,G),q=[],U=0,_=null,W=0;while(U<K.length){let z=K.slice(U),j=z.match(/^@switch\s*\(/),B=z.match(/^@endswitch(?![a-z])/);if(j){if(W++,_)_.content+=j[0];U+=j[0].length;continue}if(B){if(W--,_)_.content+=B[0];U+=B[0].length;continue}if(W>0){if(_)_.content+=K[U];U++;continue}let H=z.match(/^@case\s*/),F=z.match(/^@default(?![a-z])/),L=z.match(/^@break(?![a-z])/);if(H&&z.startsWith("@case")){if(_)q.push(_);let O=U+H[0].length,V=a4(K,O);if(!V){U++;continue}_={type:"case",value:V.expression,content:""},U=V.endPos}else if(F&&z.startsWith("@default")){if(_)q.push(_);_={type:"default",content:""},U+=F[0].length}else if(L&&z.startsWith("@break"))U+=L[0].length;else{if(_)_.content+=K[U];U++}}if(_)q.push(_);return{fullMatch:Z.slice($,G+10),expression:Q.expression,cases:q,start:$,end:G+10}}var g3=()=>{};var h3=()=>{};var m6=P(()=>{g3();h3()});function RQ(Z,$,J){let Y=Z,Q=!0;while(Q){Q=!1;let X=Y.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=d6(Y,G);if(!K)break;try{let q;if(e(K.expression))q=Z4(K.expression,Object.keys($))(...Object.values($));else q=X4(K.expression,$);let U="",_=!1;for(let W of K.cases)if(W.type==="default"){if(!_)U=W.content.trim()}else try{let z;if(W.value&&e(W.value))z=Z4(W.value,Object.keys($))(...Object.values($));else if(W.value)z=X4(W.value,$);if(q===z){U=W.content.trim(),_=!0;break}}catch{continue}Y=Y.substring(0,G)+U+Y.substring(K.end),Q=!0}catch(q){let U=q instanceof Error?q.message:String(q),_=s("Switch",`Error evaluating @switch expression: ${U}`,u.EVALUATION_ERROR);Y=Y.substring(0,G)+_+Y.substring(K.end);break}}return Y}function b5(Z,$,J){let Y=Z;Y=RQ(Y,$,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=a4(Y,K+7);if(!q)break;let U=q.endPos,_=O5(Y,"unless","endunless",U);if(_===-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 W=Y.slice(U,_),z=q.expression,j=-1;{let H=0,F=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],A;while((A=F.exec(W))!==null)V.push({pos:A.index,type:"open"});while((A=L.exec(W))!==null)V.push({pos:A.index,type:"close"});while((A=O.exec(W))!==null)V.push({pos:A.index,type:"else"});V.sort((N,R)=>N.pos-R.pos);for(let N of V)if(N.type==="open")H++;else if(N.type==="close")H--;else if(N.type==="else"&&H===0){j=N.pos;break}}let B;if(j!==-1){let H=W.slice(0,j),F=W.slice(j+5);B=`@if (${z})${F}@else ${H}@endif`}else B=`@if (!(${z}))${W}@endif`;Y=Y.substring(0,K)+B+Y.substring(_+10),X=!0}}Y=p6(Y,$,J),Y=l6(Y,$,J),Y=u6(Y,$);let Q=()=>{let X=h6(Y);if(X.length===0)return!1;for(let G=X.length-1;G>=0;G--){let K=X[G];try{let q="",U=!1;for(let _ of K.branches){if(U)break;if(_.type==="else")q=_.content,U=!0;else try{let W;if(_.condition&&e(_.condition))W=Z4(_.condition,Object.keys($))(...Object.values($));else if(_.condition)W=X4(_.condition,$);if(W)q=_.content,U=!0}catch(W){q=s(_.type==="if"?"If":"Elseif",`Error in @${_.type}(${_.condition}): ${W instanceof Error?W.message:String(W)}`,u.EVALUATION_ERROR),U=!0}}Y=Y.substring(0,K.start)+q+Y.substring(K.end)}catch(q){let U=q instanceof Error?q.message:String(q),_=s("If",`Error processing @if block: ${U}`,u.EVALUATION_ERROR);Y=Y.substring(0,K.start)+_+Y.substring(K.end)}}return!0};while(Q());return Y}function d3(Z){let $=0;while($<Z.length&&/\s/.test(Z[$]))$++;if(Z[$]!=="(")return null;$++;while($<Z.length&&/\s/.test(Z[$]))$++;let J=Z[$];if(J!=="'"&&J!=='"')return null;$++;let Y=[];while($<Z.length){let Q=Z[$];if(Q==="\\"&&$+1<Z.length){Y.push(Z[$+1]),$+=2;continue}if(Q===J){$++;break}Y.push(Q),$++}while($<Z.length&&/\s/.test(Z[$]))$++;if(Z[$]!==")")return null;return $++,{value:Y.join(""),consumed:$}}function u6(Z,$){let J=Z;function Y(K,q,U,_){let W=1,z=_,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${U}(?![a-z])`,"g");while(z<K.length&&W>0){j.lastIndex=z,B.lastIndex=z;let H=j.exec(K),F=B.exec(K),L=H?H.index:1/0,O=F?F.index:1/0;if(L<O)W++,z=L+H[0].length;else if(O<1/0){if(W--,W===0)return O;z=O+F[0].length}else break}return-1}function Q(K,q,U){let _=0,W=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${U}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],H;while((H=W.exec(K))!==null)B.push({pos:H.index,type:"open"});while((H=z.exec(K))!==null)B.push({pos:H.index,type:"close"});while((H=j.exec(K))!==null)B.push({pos:H.index,type:"else"});B.sort((F,L)=>F.pos-L.pos);for(let F of B)if(F.type==="open")_++;else if(F.type==="close")_--;else if(F.type==="else"&&_===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 U=q.index,_,W,z=J.slice(U+5),j=d3(z);if(j)_=j.value,W=U+5+j.consumed;else W=U+5;let B=Y(J,"auth","endauth",W);if(B===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let H=J.slice(W,B),F=Q(H,"auth","endauth"),L;if(!$.auth)L=!1;else L=_?r4(`auth?.check && auth?.user?.[${_}]`,$):r4("auth?.check",$);let O;if(F!==-1){let V=H.slice(0,F),A=H.slice(F+5);O=L?V:A}else O=L?H:"";J=J.substring(0,U)+O+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 U=q.index,_,W,z=J.slice(U+6),j=d3(z);if(j)_=j.value,W=U+6+j.consumed;else W=U+6;let B=Y(J,"guest","endguest",W);if(B===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let H=J.slice(W,B),F=Q(H,"guest","endguest"),L;if(!$.auth)L=!0;else L=_?r4(`!auth?.check || !auth?.user?.[${_}]`,$):r4("!auth?.check",$);let O;if(F!==-1){let V=H.slice(0,F),A=H.slice(F+5);O=L?V:A}else O=L?H:"";J=J.substring(0,U)+O+J.substring(B+9),K=!0}}function X(K,q,U){if($.userCan&&typeof $.userCan[K]==="boolean")return $.userCan[K];if($.permissions?.check&&typeof $.permissions.check==="function")try{let _=[K];if(q)_.push(q);if(U){let W=r4(U,$);_.push(W)}return $.permissions.check(..._)}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}`,U=K==="can"?"elsecan":"elsecannot",_=!0;while(_){_=!1;let W=J.match(new RegExp(`@${K}\\s*\\(`));if(!W||W.index===void 0)break;let z=W.index,j=J.slice(z+`@${K}`.length),B=G(j);if(!B)break;let H=z+`@${K}`.length+B.paramsEnd,F=Y(J,K,q,H);if(F===-1){console.warn(`[stx] @${K} directive at position ${z} has no matching @${q} \u2014 the block was skipped.`);break}let L=J.slice(H,F),O=[],V=0,A=new RegExp(`@${K}\\s*\\(`,"g"),N=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${U}\\s*\\(`,"g"),w=/@else(?![a-z])/g,M=[],E;while((E=A.exec(L))!==null)M.push({pos:E.index,type:"open"});while((E=N.exec(L))!==null)M.push({pos:E.index,type:"close"});while((E=R.exec(L))!==null)M.push({pos:E.index,type:"elseDirective"});while((E=w.exec(L))!==null)M.push({pos:E.index,type:"else"});M.sort((S,k)=>S.pos-k.pos);for(let S of M){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)O.push(S)}let T=[],I=0;for(let S=0;S<O.length;S++){let k=O[S];if(T.push({content:L.slice(I,k.pos),ability:void 0}),k.type==="elseDirective"){let f=L.slice(k.pos+`@${U}`.length),h=G(f);if(h){T[T.length-1]={content:L.slice(I,k.pos)},I=k.pos+`@${U}`.length+h.paramsEnd,T.push({content:"",ability:h.ability,type:h.type,id:h.id}),T.pop();let p=O[S+1],z4=p?p.pos:L.length;T.push({content:L.slice(I,z4),ability:h.ability,type:h.type,id:h.id}),I=z4}}else I=k.pos+5}if(I<L.length){let S=T[T.length-1];if(O.length>0&&O[O.length-1].type==="else")T.push({content:L.slice(I),isFinalElse:!0});else if(T.length===0)T.push({content:L.slice(I)})}let D=X(B.ability,B.type,B.id),y=K==="can"?D:!D,b="";if(y)b=T[0]?.content||"";else{let S=!1;for(let k=1;k<T.length;k++){let f=T[k];if(f.isFinalElse){b=f.content,S=!0;break}if(f.ability){let h=X(f.ability,f.type,f.id);if(K==="can"?h:!h){b=f.content,S=!0;break}}}if(!S&&T.length>0){let k=T[T.length-1];if(k.isFinalElse)b=k.content}}J=J.substring(0,z)+b+J.substring(F+`@${q}`.length),_=!0}}return J}function p6(Z,$,J){let Y=Z;function Q(X,G,K,q,U){let _=!0;while(_){_=!1;let W=new RegExp(`@${G}\\s*\\(`),z=X.match(W);if(!z||z.index===void 0)break;let j=z.index,B=a4(X,j+`@${G}`.length);if(!B)break;let H=B.endPos,F=O5(X,G,K,H);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(H,F),O=B.expression,V=-1,A=0,N=0;while(N<L.length){let R=L.indexOf("@",N);if(R===-1)break;let w=L.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(w)){A++,N=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(w)){A--,N=R+1;continue}if(A===0&&/^@else(?![a-z])/.test(w)){V=R;break}N=R+1}try{let R=q(O.trim()),w;if(V!==-1){let M=L.slice(0,V),E=L.slice(V+5);w=R?M:E}else w=R?L:"";X=X.substring(0,j)+w+X.substring(F+`@${K}`.length),_=!0}catch(R){let w=R instanceof Error?R.message:String(R),M=s(U,`Error processing @${G} directive: ${w}`,u.EVALUATION_ERROR);X=X.substring(0,j)+M+X.substring(F+`@${K}`.length);break}}return X}return Y=Q(Y,"isset","endisset",(X)=>{let G=r4(X,$);return G!==void 0&&G!==null},"Isset"),Y=Q(Y,"empty","endempty",(X)=>{let G=r4(X,$);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 l6(Z,$,J){let Y=Z,Q="development";function X(G,K,q,U){let _=new RegExp(`@${K}(?![a-z])`,"g"),W=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,H=!0;while(H){H=!1,_.lastIndex=0;let F=_.exec(B);if(!F)break;let L=F.index,O=L+F[0].length;if(K==="env"){let D=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,U=Q===D[2]}let V=1,A=O,N=-1;while(V>0&&A<B.length){_.lastIndex=A,W.lastIndex=A;let D=_.exec(B),y=W.exec(B),b=D?D.index:1/0,S=y?y.index:1/0;if(b<S)V++,A=b+D[0].length;else if(S<1/0){if(V--,V===0){N=S;break}A=S+y[0].length}else break}if(N===-1){console.warn(`[stx] @${K} directive at position ${L} has no matching @${q} \u2014 the block was skipped.`);break}let R=B.substring(O,N),w=-1,M=0,E=0;while(E<R.length){let D=R.indexOf("@",E);if(D===-1)break;let y=R.substring(D);if(z.test(y)){M++,E=D+1;continue}if(j.test(y)){M--,E=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(y)){w=D;break}E=D+1}let T;if(w!==-1){let D=R.slice(0,w),y=R.slice(w+5);T=U?D:y}else T=U?R:"";let I=`@${q}`.length;B=B.substring(0,L)+T+B.substring(N+I),H=!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 JZ=P(()=>{x3();l4();m6();A4()});function u3(Z=16){let $=new Uint8Array(Z);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function XZ(Z,$){if(!Z)return $?.nonceGenerator?.()??u3();let J=m3.get(Z);if(!J)J=$?.nonceGenerator?.()??u3(),m3.set(Z,J);return J}function wQ(Z,$){let J=[];for(let[Y,Q]of Object.entries(Z)){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($&&(Y==="script-src"||Y==="style-src"))X=X.filter((G)=>!G.startsWith("'nonce-")),X.push(`'nonce-${$}'`);if(X.length>0)J.push(`${Y} ${X.join(" ")}`)}}return J.join("; ")}function p3(Z,$){return`<meta http-equiv="Content-Security-Policy" content="${wQ(Z,$).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function l3(Z,$,J){if(!$.enabled||!$.addMetaTag)return Z;if(Z.includes('http-equiv="Content-Security-Policy"'))return Z;if(!Z.includes("<head>")&&!Z.includes("<head "))return Z;let Y=$.useNonce?XZ(J,$):void 0,Q=p3($.directives,Y);return Z.replace(/<head([^>]*)>/,`<head$1>
2459
- ${Q}`)}function c3(Z,$,J,Y){let Q=Z,X=Y.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!X?.enabled||!X.directives)return"<!-- CSP not configured -->";let G=X.useNonce?XZ($,X):void 0;return p3(X.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return XZ($,X)}),X?.enabled&&X.useNonce)$.cspNonce=XZ($,X);return Q}var m3;var i3=P(()=>{m3=new WeakMap});import TQ from"crypto";function IQ(Z=MQ){let $=TQ.randomBytes(Math.ceil(Z/2)).toString("hex").slice(0,Z);return c6=$,$}function EQ(){if(!c6)IQ();return c6}function DQ(Z=n3){let $=EQ();return`<input type="hidden" name="${Z}" value="${$}">`}function s3(Z){return Z.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,J,Y)=>{return DQ(Y||n3)})}var MQ=40,n3="_token",c6=null;var o3=()=>{};async function r3(Z,$,J,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return Z;let Q=Z;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 kQ(Q,X,$,J,Y);else Q=await SQ(Q,X,$,J,Y)}return Q}async function kQ(Z,$,J,Y,Q){let{name:X,handler:G}=$,K=`@${X}`,q=`@end${X}`,U=Z,_=w5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),W=[],z=_.exec(U);while(z!==null){let[j,B="",H=""]=z,F=z.index||0;try{let L=B?a3(B):[],O=H.trim(),V=await G(O,L,J,Y);W.push({original:j,processed:V,startIndex:F})}catch(L){let O=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${X}:`,L);W.push({original:j,processed:s("CustomDirective",`Error in @${X}${B?`(${B})`:""}: ${O}`,u.EVALUATION_ERROR),startIndex:F})}z=_.exec(U)}for(let j=W.length-1;j>=0;j--){let{original:B,processed:H}=W[j];U=U.replace(B,H)}return U}async function SQ(Z,$,J,Y,Q){let{name:X,handler:G}=$,K=Z,q=w5(`@${X}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),U=[],_=q.exec(K);while(_!==null){let[j,B=""]=_,H=_.index||0;try{let F=a3(B),L=await G("",F,J,Y);U.push({original:j,processed:L,startIndex:H})}catch(F){let L=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${X}:`,F);U.push({original:j,processed:s("CustomDirective",`Error in @${X}(${B}): ${L}`,u.EVALUATION_ERROR),startIndex:H})}_=q.exec(K)}let W=w5(`@${X}(?!\\w)(?!\\s*\\()`,"g"),z=W.exec(K);while(z!==null){let[j]=z,B=z.index||0;try{let H=await G("",[],J,Y);U.push({original:j,processed:H,startIndex:B})}catch(H){let F=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${X}:`,H);U.push({original:j,processed:s("CustomDirective",`Error in @${X}: ${F}`,u.EVALUATION_ERROR),startIndex:B})}z=W.exec(K)}for(let j=U.length-1;j>=0;j--){let{original:B,processed:H}=U[j];K=K.replace(B,H)}return K}function a3(Z){if(!Z.trim())return[];let $=[],J="",Y=!1,Q="";for(let X=0;X<Z.length;X++){let G=Z[X];if((G==='"'||G==="'")&&(X===0||Z[X-1]!=="\\"))if(!Y)Y=!0,Q=G;else if(G===Q)Y=!1;else J+=G;else if(G===","&&!Y)$.push(J.trim()),J="";else J+=G}if(J.trim())$.push(J.trim());return $.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 t3=P(()=>{l4();T5()});import bQ from"crypto";function O4(Z){return String(Z??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function QZ(Z,$,J,Y){let Q=Z||$;return J?`${Q} ${Y}`:Q}function yQ(){return bQ.randomUUID()}function GZ(Z,$){let J=Z;return J=J.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let Y=yQ();$.csrf={token:Y}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${O4($.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="${O4(X)}">`;return Y}),J}function $1(Z,$,J=Z1){let Y=Z;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,X,G,K,q,U="")=>{let _=X||G||"POST",W=K||q||"",z=t4(U),j=_.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",H=`<form method="${O4(B)}" action="${O4(W)}"${z?` ${z}`:""}>`;if(H+=`
2460
- ${GZ("@csrf",$)}`,!["GET","POST"].includes(j))H+=`
2461
- ${GZ(`@method('${j}')`,$)}`;return H}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,X,G,K,q,U="")=>{let _=X||G||"",W=K||q||"",z=t4(U),j=J7(_,$),B=j!==void 0&&j!==null?j:W||"",H=z.match(/type=['"]([^'"]+)['"]/i),F=H?H[1]:"text",L=X7(_,$),O=z.match(/class=['"]([^'"]+)['"]/i),V=QZ(O?O[1]:"",J.input,L,J.inputError),A=z.replace(/class=['"][^'"]+['"]/i,"");return A=A.replace(/type=['"][^'"]+['"]/i,""),`<input type="${O4(F)}" name="${O4(_)}" value="${O4(B)}" class="${V}"${A?` ${A}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,X,G="",K="")=>{let q=t4(G),U=J7(X,$)||K.trim(),_=X7(X,$),W=q.match(/class=['"]([^'"]+)['"]/i),z=QZ(W?W[1]:"",J.input,_,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${O4(X)}" class="${z}"${j?` ${j}`:""}>${O4(U)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,X,G="",K)=>{let q=t4(G),U=J7(X,$),_=X7(X,$),W=q.match(/class=['"]([^'"]+)['"]/i),z=QZ(W?W[1]:"",J.input,_,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(U!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,F,L)=>{if((Array.isArray(U)?U.some((V)=>String(V)===L):String(U)===L)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return H});return`<select name="${O4(X)}" class="${z}"${j?` ${j}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="1",K="")=>{let q=t4(K),U=J7(X,$),_=U!==void 0&&(Array.isArray(U)?U.some((B)=>String(B)===G):U===!0||String(U)===G),W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${O4(X)}" value="${O4(G)}" class="${z}"${_?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G,K="")=>{let q=t4(K),U=J7(X,$),_=U!==void 0&&U===G,W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${O4(X)}" value="${O4(G)}" class="${z}"${_?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="")=>{let K=t4(G),q=K.match(/accept=['"]([^'"]+)['"]/i),U=q?q[1]:"",_=K.includes("multiple"),W=X7(X,$),z=K.match(/class=['"]([^'"]+)['"]/i),j=QZ(z?z[1]:"",J.input,W,J.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${O4(X)}"`,`class="${j}"`];if(U)H.push(`accept="${O4(U)}"`);if(_)H.push("multiple");if(B)H.push(B);return`${H.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,X,G="",K)=>{let q=t4(G),U=q.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:J.label,W=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${O4(X)}" class="${_}"${W?` ${W}`:""}>${K}</label>`}),Y}function Y1(Z,$,J=Z1){return Z.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,Q,X)=>{try{if(X7(Q,$))return X.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return e3(Q,$);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(Q);return e3(Q,$)}let q=K.trim();if(e(q)){let U=X4(q,$);return U!==void 0?String(U):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),Y}})}function X7(Z,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(Z);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,Z);return!1}function e3(Z,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(Z);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,Z)){let J=$.errors[Z];return Array.isArray(J)?J[0]:String(J)}return""}function J7(Z,$){let J;if($.old&&typeof $.old==="function")return $.old(Z);if($.old&&typeof $.old==="object")return $.old[Z];if(Z.endsWith("[]")){let Y=Z.slice(0,-2);if(J=$[Y],J!==void 0)return J}return $[Z]}function t4(Z){if(!Z.trim())return"";let $=[],J=Z.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=Y.exec(J))!==null){let[,X,,G]=Q;$.push(`${X}="${G.trim()}"`)}return $.join(" ")}var Z1;var J1=P(()=>{A4();Z1={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import X1 from"path";function CQ(Z,$=0){if($<=0)return!1;return Date.now()-Z.loadedAt>$}async function PQ(Z,$){if({...o6,...$.i18n}.cache&&s6[Z]){let Q=s6[Z],X=$.i18n?.cacheMaxAge??0;if(!CQ(Q,X))return Q.translations}if(Q7[Z]?.state==="loading")return Q7[Z].promise;i6[Z]="loading";let Y=K1(Z,$).then((Q)=>{return i6[Z]="loaded",delete Q7[Z],Q}).catch((Q)=>{throw i6[Z]="error",Q7[Z]={promise:Y,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return Q7[Z]={promise:Y,state:"loading"},Y}async function K1(Z,$){let J={...o6,...$.i18n},Y=X1.resolve(import.meta.dir,"..",J.translationsDir),Q=gQ(J.format),X=X1.join(Y,`${Z}${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=xQ(q);else if(J.format==="json")G=JSON.parse(q);else throw K}if(J.cache)s6[Z]={translations:G,loadedAt:Date.now(),locale:Z};return G}catch(G){if($.debug)console.error(`Error loading translation file for locale "${Z}":`,G);if(Z!==J.defaultLocale)return K1(J.defaultLocale,$);return{}}}async function vQ(Z,$){return PQ(Z,$)}function xQ(Z){let $={},J=Z.split(`
2462
- `),Y=[{obj:$,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[,,U,_]=q,W=U.trim(),z=_.trim();if(z==="")K[W]={},Y.push({obj:K[W],indent:G});else K[W]=fQ(z)}}return $}function fQ(Z){if(Z.startsWith("'")&&Z.endsWith("'")||Z.startsWith('"')&&Z.endsWith('"'))return Z.slice(1,-1);let $=Z.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let J=Number(Z);if(!Number.isNaN(J))return J;return Z}function gQ(Z){switch(Z){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function hQ(Z,$){for(let J of Z){let Y=J.trim(),Q=Y.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if($===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($>=G&&$<=K)return X[3];continue}}if(Z.length===2)return $===1?Z[0].trim():Z[1].trim();if($<Z.length)return Z[$].trim();return Z[Z.length-1].trim()}function dQ(Z,$={}){return q1(Z,$)}function q1(Z,$){let J="",Y=0;while(Y<Z.length)if(Z[Y]==="{"){let Q=mQ(Z,Y);if(Q===-1){J+=Z[Y],Y++;continue}let X=Z.slice(Y+1,Q);J+=uQ(X,$),Y=Q+1}else if(Z[Y]==="'"&&Y+1<Z.length)if(Z[Y+1]==="'")J+="'",Y+=2;else if(Z[Y+1]==="{"||Z[Y+1]==="}")J+=Z[Y+1],Y+=2;else J+=Z[Y],Y++;else J+=Z[Y],Y++;return J}function mQ(Z,$){let J=0;for(let Y=$;Y<Z.length;Y++)if(Z[Y]==="{")J++;else if(Z[Y]==="}"){if(J--,J===0)return Y}return-1}function uQ(Z,$){let J=pQ(Z);if(J.length===0)return`{${Z}}`;let Y=J[0].trim(),Q=$[Y];if(J.length===1)return Q!==void 0?String(Q):`{${Y}}`;switch(J[1].trim().toLowerCase()){case"plural":return lQ(Q,J.slice(2).join(","),$);case"select":return iQ(Q,J.slice(2).join(","));case"selectordinal":return nQ(Q,J.slice(2).join(","));case"number":return oQ(Q,J[2]?.trim());case"date":return rQ(Q,J[2]?.trim());case"time":return aQ(Q,J[2]?.trim());default:return Q!==void 0?String(Q):`{${Z}}`}}function pQ(Z){let $=[],J="",Y=0;for(let Q=0;Q<Z.length;Q++){let X=Z[Q];if(X==="{")Y++,J+=X;else if(X==="}")Y--,J+=X;else if(X===","&&Y===0)$.push(J),J="";else J+=X}if(J)$.push(J);return $}function lQ(Z,$,J){let Y=Number(Z)||0,Q=r6($),X=`=${Y}`;if(Q[X])return n6(Q[X],Y,J);let G=cQ(Y);if(Q[G])return n6(Q[G],Y,J);if(Q.other)return n6(Q.other,Y,J);return String(Y)}function n6(Z,$,J){let Y=Z.replace(/#/g,String($));return q1(Y,J)}function cQ(Z){let $=Math.abs(Z),J=Math.floor($),Y=String(Z).includes(".")?String(Z).split(".")[1].length:0;if(J===1&&Y===0)return"one";return"other"}function iQ(Z,$){let J=String(Z||""),Y=r6($);if(Y[J])return Y[J];return Y.other||String(Z)}function nQ(Z,$){let J=Number(Z)||0,Y=r6($),Q=sQ(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 sQ(Z){let $=Math.abs(Z),J=$%10,Y=$%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 r6(Z){let $={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=J.exec(Z);while(Y!==null)$[Y[1]]=Y[2],Y=J.exec(Z);return $}function oQ(Z,$){let J=Number(Z);if(Number.isNaN(J))return String(Z);switch($){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 rQ(Z,$){let J=Z instanceof Date?Z:new Date(String(Z));if(Number.isNaN(J.getTime()))return String(Z);let Y={};switch($){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 aQ(Z,$){let J=Z instanceof Date?Z:new Date(String(Z));if(Number.isNaN(J.getTime()))return String(Z);let Y={};switch($){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 tQ(Z){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(Z)}function Q1(Z,$,J=!0,Y={}){let Q=Z.split("."),X=$;for(let K of Q){if(X===void 0||X===null)break;X=X[K]}if(X===void 0||X===null)return J?Z:"";let G=String(X);if(tQ(G))return dQ(G,Y);if(G.includes("|")&&"count"in Y){let K=Number(Y.count),q=G.split("|");G=hQ(q,K)}for(let[K,q]of Object.entries(Y)){let U=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${U}`,"g"),String(q))}return G}async function _1(Z,$,J,Y){let Q=Z,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...o6,...Y.i18n},K=await vQ(G.locale,Y);$.__translations=K,$.__locale=G.locale,$.__i18nConfig=G,Q=await G1(Q,X,async(_,W,z,j,B)=>{try{let H={};if(z)try{let L=[()=>JSON.parse(z),()=>{let O=`{"data":${z}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return H4(z,$)}];for(let O of L)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(L){if(Y.debug)console.error("Error parsing parameters for @translate directive:",L)}return Q1(W,K,G.fallbackToKey,H)||j.trim()}catch(H){if(Y.debug)console.error("Error processing @translate directive:",H);return s("Translate",`Error in @translate('${W}'): ${H instanceof Error?H.message:String(H)}`,u.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 _=[...Q.matchAll(q)];console.warn(`Found ${_.length} @translate matches`),_.forEach((W,z)=>console.warn(`Match ${z}: ${W[0]}, Key: ${W[1]}, Params: ${W[2]||"none"}`))}return Q=await G1(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(_,W,z,j)=>{try{let B={};if(z)try{let H=[()=>JSON.parse(z),()=>{let F=`{"data":${z}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return H4(z,$)}];for(let F of H)try{if(B=F(),Object.keys(B).length>0)break}catch{}}catch(H){if(Y.debug)console.error("Error parsing parameters for @translate directive:",H)}return Q1(W,K,G.fallbackToKey,B)}catch(B){if(Y.debug)console.error("Error processing @translate directive:",B);return s("Translate",`Error in @translate('${W}'): ${B instanceof Error?B.message:String(B)}`,u.EVALUATION_ERROR)}}),Q}async function G1(Z,$,J){let Y=[];return Z.replace($,(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),Z)}var o6,s6,Q7,i6;var U1=P(()=>{l4();A4();o6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},s6={},Q7={},i6={}});var O1={};r(O1,{processLoops:()=>a6});function $G(Z,$){let J=/@component\s*\(/g,Y=Z,Q,X=[];while((Q=J.exec(Y))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,U=K+1;while(U<Y.length&&q>0){if(Y[U]==="(")q++;else if(Y[U]===")"){if(q--,q===0)break}U++}if(q!==0)continue;let _=Y.substring(K+1,U),W=U+1,z=_.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let j=z[1],B=_.slice(z[0].length),H=B.match(/^\s*,\s*/);if(!H)continue;let F=B.slice(H[0].length).trim();if(!F)continue;try{let L=H4(F,$),O=JSON.stringify(L),V=`@component('${j}', ${O})`;X.push({start:G,end:W,replacement:V})}catch{continue}}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:U}=X[G];Y=Y.substring(0,K)+U+Y.substring(q)}return Y}function KZ(Z,$,J){let Y=Z,Q=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),X;while((X=Q.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,q=1,U=K+1,_=null,W=!1;while(U<Y.length&&q>0){let B=Y[U];if(W){W=!1,U++;continue}if(B==="\\"&&_){W=!0,U++;continue}if(_){if(B===_)_=null;U++;continue}if(B==='"'||B==="'"||B==="`"){_=B,U++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}U++}if(q!==0)break;let z=Y.substring(K+1,U),j=J(z);Y=Y.substring(0,G)+j+Y.substring(U+1)}return Y}function YG(Z,$){let J=Z;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,Q)=>{if(Q in $)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($),K=Object.values($);u5(X);let U=Z4(X,G)(...K),W=JSON.stringify(U).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${Q}="${W}"`}catch(G){return Y}}),J}function JG(Z,$){let J=Z;return J=KZ(J,"@break",(Y)=>{try{let X=`!!(${Y.trim()})`,G;if(e(X)){let K=Z4(X,Object.keys($));G=Boolean(K(...Object.values($)))}else G=Boolean(X4(X,$));return G?qZ:""}catch{return""}}),J=KZ(J,"@continue",(Y)=>{try{let X=`!!(${Y.trim()})`,G;if(e(X)){let K=Z4(X,Object.keys($));G=Boolean(K(...Object.values($)))}else G=Boolean(X4(X,$));return G?_Z:""}catch{return""}}),J}function XG(Z){let $=Z;return $=$.replace(/@break(?!\()/g,qZ),$=$.replace(/@continue(?!\()/g,_Z),$}function W1(Z){let $=Z.includes(qZ),J=$?Z.substring(0,Z.indexOf(qZ)):Z;return{hasBreak:$,content:J}}function z1(Z){let $=Z.includes(_Z),J=$?Z.substring(0,Z.indexOf(_Z)):Z;return{hasContinue:$,content:J}}function j1(Z){let $=Z;return $=KZ($,"@break",(J)=>{let Y=J.trim();if(!H7(Y))return"";return`\`; if (${Y}) { break; } result += \``}),$=KZ($,"@continue",(J)=>{let Y=J.trim();if(!H7(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function QG(Z){let $=/@forelse\s*\(/g,J,Y=[],Q=/@foreach\s*\(/g,X=/@endforeach/g,G;while((G=Q.exec(Z))!==null)Y.push({pos:G.index,delta:1});while((G=X.exec(Z))!==null)Y.push({pos:G.index,delta:-1});Y.sort((_,W)=>_.pos-W.pos);let K=[],q=0;for(let _ of Y)q+=_.delta,K.push({pos:_.pos,depth:q});function U(_){let W=0,z=K.length-1,j=0;while(W<=z){let B=W+z>>1;if(K[B].pos<=_)j=K[B].depth,W=B+1;else z=B-1}return j}while((J=$.exec(Z))!==null){if(U(J.index)>0)continue;let _=J.index,W=J.index+J[0].length-1,z=1,j=W+1,B=-1;while(j<Z.length&&z>0){if(Z[j]==="(")z++;else if(Z[j]===")"){if(z--,z===0){B=j;break}}j++}if(B===-1)continue;let H=Z.substring(W+1,B),F=H.indexOf(" as ");if(F===-1)continue;let L=H.substring(0,F).trim(),O=H.substring(F+4).trim(),V=B+1,A=1,N=V,R=/@forelse\s*\(/g,w=/@endforelse/g,M=-1;while(A>0&&N<Z.length){R.lastIndex=N,w.lastIndex=N;let b=R.exec(Z),S=w.exec(Z);if(!S)break;if(b&&b.index<S.index)A++,N=b.index+b[0].length;else{if(A--,A===0){M=S.index;break}N=S.index+11}}if(M===-1)continue;let E=Z.substring(V,M),T=M+11,I=-1,D=0,y=0;while(y<E.length){let b=E.indexOf("@",y);if(b===-1)break;let S=E.substring(b);if(/^@forelse\s*\(/.test(S))D++,y=b+1;else if(S.startsWith("@endforelse"))D--,y=b+11;else if(D===0&&S.startsWith("@empty")){if(E.length<=b+6||!/[a-z]/i.test(E[b+6])){I=b;break}y=b+1}else y=b+1}if(I===-1)continue;return{start:_,end:T,arrayExpr:L,itemVar:O,foreachContent:E.substring(0,I),emptyContent:E.substring(I+6)}}return null}function B1(Z,$){let J=Z;while(!0){let Y=QG(J);if(!Y)break;let{start:Q,end:X,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:U}=Y;try{let _;if(e(G))_=Z4(G,Object.keys($))(...Object.values($));else _=X4(G,$);let W;if(!Array.isArray(_)||_.length===0)W=U;else W=`@foreach (${G} as ${K})${q}@endforeach`;J=J.substring(0,Q)+W+J.substring(X)}catch(_){let W=_ instanceof Error?_.message:String(_),z=s("Forelse",`Error in @forelse(${G} as ${K}): ${W}`,u.EVALUATION_ERROR);J=J.substring(0,Q)+z+J.substring(X)}}return J}function a6(Z,$,J,Y){let Q=Z;Q=B1(Q,$);function X(q){let U=/@foreach\s*\(/g,_;while((_=U.exec(q))!==null){let W=_.index,z=_.index+_[0].length-1,j=1,B=z+1,H=-1;while(B<q.length&&j>0){if(q[B]==="(")j++;else if(q[B]===")"){if(j--,j===0){H=B;break}}B++}if(H===-1)continue;let F=q.substring(z+1,H),L=F.indexOf(" as ");if(L===-1)continue;let O=W,V=F.substring(0,L),A=F.substring(L+4),N=H+1,R=1,w=N,M=/@foreach\s*\(/g,E=/@endforeach/g;while(R>0&&w<q.length){M.lastIndex=w,E.lastIndex=w;let T=M.exec(q),I=E.exec(q);if(!I)break;if(T&&T.index<I.index)R++,w=T.index+T[0].length;else{if(R--,R===0){let D=q.substring(N,I.index),y=I.index+11;return{start:O,end:y,arrayExpr:V,itemVar:A,content:D}}w=I.index+11}}}return null}function G(q,U){let _=q;while(!0){let W=X(_);if(!W)break;let{start:z,end:j,arrayExpr:B,itemVar:H,content:F}=W;try{let L=B.trim(),O;if(e(L))O=Z4(L,Object.keys(U))(...Object.values(U));else O=X4(L,U);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let T=s("Foreach",`Error in @foreach: ${L} is not iterable`,u.TYPE_ERROR);_=_.substring(0,z)+T+_.substring(j);continue}let A=Y?.loops?.useAltLoopVariable??ZG,N=H.trim(),R=null,w;if(N.includes("=>")){let T=N.split("=>").map((I)=>I.trim());if(T.length===2)R=T[0],w=T[1];else w=N}else w=N;let M="",E=O;for(let T=0;T<E.length;T++){let I=E[T],D={index:T,iteration:T+1,first:T===0,last:T===E.length-1,count:E.length},y={...U,loop:D,$loop:D};if(w.startsWith("[")&&w.endsWith("]")){let f=w.slice(1,-1).split(",").map((h)=>h.trim());if(Array.isArray(I))f.forEach((h,p)=>{if(h)y[h]=I[p]});else y[w]=I}else y[w]=I;if(R)if(V&&Array.isArray(I)&&I.length===2)y[R]=I[0],y[w]=I[1];else y[R]=T;let b=JG(F,y),S=z1(b);if(S.hasContinue){M+=S.content;continue}let k=W1(b);if(k.hasBreak){M+=k.content;break}if(b=B1(b,y),b=G(b,y),b=b5(b,y,J),b=XG(b),k=W1(b),k.hasBreak){M+=k.content;break}if(S=z1(b),S.hasContinue){M+=S.content;continue}b=K5(b,y,J),b=YG(b,y),b=$G(b,y),M+=b}_=_.substring(0,z)+M+_.substring(j)}catch(L){let O=s("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${L instanceof Error?L.message:String(L)}`,u.EVALUATION_ERROR);_=_.substring(0,z)+O+_.substring(j)}}return _}Q=G(Q,$),Q=GG(Q,$);let K=Y?.loops?.maxWhileIterations??eQ;return Q=KG(Q,$,K),Q}function H1(Z){return H7(Z)}function GG(Z,$){let J=Z,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=I4(J,"(",")",G);if(K===-1)break;let q=J.slice(G+1,K),U=K+1,_=YZ(J.slice(X),"for","endfor");if(_.length===0)break;let W=_[0].content,z=X+_[0].end;if(!H1(q)){let j=s("For",`Unsafe expression in @for: ${q}`,u.UNSAFE_EXPRESSION);J=J.substring(0,X)+j+J.substring(z),Y=!0;continue}try{let j=Object.keys($),B=Object.values($),H=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=j1(H);let L=Function(...j,`
2455
+ ${LQ()}
2456
+ ${Z}
2457
+ </script>`}function g3($,Z,J){if(f3=0,!NQ($))return $;let Y=BQ($);if(Y.length===0)return $;let Q=VQ($,Y),X=FQ(Y),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+X+`
2458
+ `+Q.slice(G);else Q+=X;return Q}function VQ($,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*["']${$$(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*["']${$$(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*"${$$(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*'${$$(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 NQ($){return/x-data\s*=\s*["']/.test($)}var f3=0,zQ=0;import RQ from"fs";import g4 from"path";import{createHighlighter as AQ}from"ts-syntax-highlighter";async function wQ($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let Y=(await RQ.promises.stat($)).mtime.getTime();if(Z.cache&&h4.has($)){let W=h4.get($);if(W.updatedAt>=Y)return{content:W.content,data:W.data}}let Q=await Bun.file($).text(),{data:X,content:G}=z6(Q),K=Z.markdown||C4.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=m1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)U=await TQ(U,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let _={content:U,data:X||{}};if(Z.cache)h4.set($,{..._,updatedAt:Y});return _}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 TQ($,Z,J){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Z$)try{Z$=await AQ({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,U,_)=>{let W=_.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),z=U||(J?"text":"");if(!z)return K;try{if(!Z$.getSupportedLanguages().includes(z))return K;return(await Z$.highlight(W,z,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${U}:`,j)}return K},X=$,G=$.matchAll(Y);for(let K of G){let[q,U,_,W]=K,z=await Q(q,U,_,W);X=X.replace(q,z)}return X}async function h3($,Z,J="",Y={}){return await MQ($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,U)=>{try{let _=K;if(!g4.isAbsolute(K))_=g4.resolve(g4.dirname(J),K);let W={};if(q)try{try{W=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 R=V.indexOf(":");if(R>0){let N=V.substring(0,R).trim(),A=V.substring(R+1).trim(),w=A.startsWith('"')&&A.endsWith('"'),M=A.startsWith("'")&&A.endsWith("'");if(w||M)A=A.substring(1,A.length-1);W[N]=A}}}}catch(L){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:z,data:j}=await wQ(_,Y),B={...Z,...j,...W},O=z,F=/\{\{([^}]+)\}\}/g;return O=O.replace(F,(L,H)=>{let V=H.trim();return B[V]!==void 0?String(B[V]):L}),O}catch(_){let W=_ instanceof Error?_.message:String(_);return Q0("Markdown File",`Error including markdown file: ${W}`,J,$,U,G)}})}async function MQ($,Z,J){let Y=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,U=Q;Y.push(J(...U).then((_)=>({match:K,replacement:_,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 h4,Z$=null;var d3=P(()=>{$5();V0();h4=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 m3=P(()=>{R0()});function t0($,Z){let J=IQ($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function IQ($,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 L1($,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($),U=K.exec($),_=q?q.index:1/0,W=U?U.index:1/0;if(_<W)Q++,X=_+q[0].length;else if(W<1/0){if(Q--,Q===0)return W;X=W+U[0].length}else break}return-1}function u3($,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=L1($,"if","endif",X);if(G===-1)return null;let K=$.slice(X,G),q=[],U=0,_="if",W=Q.expression,z=0,j=0;while(U<K.length){let B=K.indexOf("@",U);if(B===-1)break;U=B;let O=K.substring(B);if(/^@if\s*\(/.test(O)){j++,U++;continue}if(/^@endif(?![a-z])/.test(O)){j--,U+=6;continue}if(j===0){let F=O.match(/^@elseif\s*/);if(F){q.push({type:_,condition:W,content:K.substring(z,U),start:X+z,end:X+U});let L=U+F[0].length,H=t0(K,L);if(!H){U++;continue}_="elseif",W=H.expression,U=H.endPos,z=U;continue}else if(/^@else(?![a-z])/.test(O)){q.push({type:_,condition:W,content:K.substring(z,U),start:X+z,end:X+U}),_="else",W=void 0,U+=5,z=U;continue}}U++}return q.push({type:_,condition:W,content:K.slice(z),start:X+z,end:X+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function d4($){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=u3($,Y.index);if(X)Z.push(X),J.lastIndex=X.end;Y=J.exec($)}return Z}function Y$($,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,U=I0($,"(",")",q);if(U===-1){X=Q.exec($);continue}let _=$.slice(q+1,U),W=U+1,z=L1($,Z,J,W);if(z===-1){X=Q.exec($);continue}let j=$.slice(W,z),B=z+`@${J}`.length;Y.push({fullMatch:$.slice(K,B),name:Z,params:_,content:j,start:K,end:B}),Q.lastIndex=B,X=Q.exec($)}return Y}function m4($,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=L1($,"switch","endswitch",X);if(G===-1)return null;let K=$.slice(X,G),q=[],U=0,_=null,W=0;while(U<K.length){let z=K.slice(U),j=z.match(/^@switch\s*\(/),B=z.match(/^@endswitch(?![a-z])/);if(j){if(W++,_)_.content+=j[0];U+=j[0].length;continue}if(B){if(W--,_)_.content+=B[0];U+=B[0].length;continue}if(W>0){if(_)_.content+=K[U];U++;continue}let O=z.match(/^@case\s*/),F=z.match(/^@default(?![a-z])/),L=z.match(/^@break(?![a-z])/);if(O&&z.startsWith("@case")){if(_)q.push(_);let H=U+O[0].length,V=t0(K,H);if(!V){U++;continue}_={type:"case",value:V.expression,content:""},U=V.endPos}else if(F&&z.startsWith("@default")){if(_)q.push(_);_={type:"default",content:""},U+=F[0].length}else if(L&&z.startsWith("@break"))U+=L[0].length;else{if(_)_.content+=K[U];U++}}if(_)q.push(_);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var p3=()=>{};var l3=()=>{};var u4=P(()=>{p3();l3()});function SQ($,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=m4(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 U="",_=!1;for(let W of K.cases)if(W.type==="default"){if(!_)U=W.content.trim()}else try{let z;if(W.value&&e(W.value))z=$0(W.value,Object.keys(Z))(...Object.values(Z));else if(W.value)z=X0(W.value,Z);if(q===z){U=W.content.trim(),_=!0;break}}catch{continue}Y=Y.substring(0,G)+U+Y.substring(K.end),Q=!0}catch(q){let U=q instanceof Error?q.message:String(q),_=o("Switch",`Error evaluating @switch expression: ${U}`,u.EVALUATION_ERROR);Y=Y.substring(0,G)+_+Y.substring(K.end);break}}return Y}function b1($,Z,J){let Y=$;Y=SQ(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 U=q.endPos,_=L1(Y,"unless","endunless",U);if(_===-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 W=Y.slice(U,_),z=q.expression,j=-1;{let O=0,F=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,H=/@else(?![a-z])/g,V=[],R;while((R=F.exec(W))!==null)V.push({pos:R.index,type:"open"});while((R=L.exec(W))!==null)V.push({pos:R.index,type:"close"});while((R=H.exec(W))!==null)V.push({pos:R.index,type:"else"});V.sort((N,A)=>N.pos-A.pos);for(let N of V)if(N.type==="open")O++;else if(N.type==="close")O--;else if(N.type==="else"&&O===0){j=N.pos;break}}let B;if(j!==-1){let O=W.slice(0,j),F=W.slice(j+5);B=`@if (${z})${F}@else ${O}@endif`}else B=`@if (!(${z}))${W}@endif`;Y=Y.substring(0,K)+B+Y.substring(_+10),X=!0}}Y=l4(Y,Z,J),Y=c4(Y,Z,J),Y=p4(Y,Z);let Q=()=>{let X=d4(Y);if(X.length===0)return!1;for(let G=X.length-1;G>=0;G--){let K=X[G];try{let q="",U=!1;for(let _ of K.branches){if(U)break;if(_.type==="else")q=_.content,U=!0;else try{let W;if(_.condition&&e(_.condition))W=$0(_.condition,Object.keys(Z))(...Object.values(Z));else if(_.condition)W=X0(_.condition,Z);if(W)q=_.content,U=!0}catch(W){q=o(_.type==="if"?"If":"Elseif",`Error in @${_.type}(${_.condition}): ${W instanceof Error?W.message:String(W)}`,u.EVALUATION_ERROR),U=!0}}Y=Y.substring(0,K.start)+q+Y.substring(K.end)}catch(q){let U=q instanceof Error?q.message:String(q),_=o("If",`Error processing @if block: ${U}`,u.EVALUATION_ERROR);Y=Y.substring(0,K.start)+_+Y.substring(K.end)}}return!0};while(Q());return Y}function c3($){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 p4($,Z){let J=$;function Y(K,q,U,_){let W=1,z=_,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${U}(?![a-z])`,"g");while(z<K.length&&W>0){j.lastIndex=z,B.lastIndex=z;let O=j.exec(K),F=B.exec(K),L=O?O.index:1/0,H=F?F.index:1/0;if(L<H)W++,z=L+O[0].length;else if(H<1/0){if(W--,W===0)return H;z=H+F[0].length}else break}return-1}function Q(K,q,U){let _=0,W=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${U}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],O;while((O=W.exec(K))!==null)B.push({pos:O.index,type:"open"});while((O=z.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")_++;else if(F.type==="close")_--;else if(F.type==="else"&&_===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 U=q.index,_,W,z=J.slice(U+5),j=c3(z);if(j)_=j.value,W=U+5+j.consumed;else W=U+5;let B=Y(J,"auth","endauth",W);if(B===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let O=J.slice(W,B),F=Q(O,"auth","endauth"),L;if(!Z.auth)L=!1;else L=_?a0(`auth?.check && auth?.user?.[${_}]`,Z):a0("auth?.check",Z);let H;if(F!==-1){let V=O.slice(0,F),R=O.slice(F+5);H=L?V:R}else H=L?O:"";J=J.substring(0,U)+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 U=q.index,_,W,z=J.slice(U+6),j=c3(z);if(j)_=j.value,W=U+6+j.consumed;else W=U+6;let B=Y(J,"guest","endguest",W);if(B===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let O=J.slice(W,B),F=Q(O,"guest","endguest"),L;if(!Z.auth)L=!0;else L=_?a0(`!auth?.check || !auth?.user?.[${_}]`,Z):a0("!auth?.check",Z);let H;if(F!==-1){let V=O.slice(0,F),R=O.slice(F+5);H=L?V:R}else H=L?O:"";J=J.substring(0,U)+H+J.substring(B+9),K=!0}}function X(K,q,U){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let _=[K];if(q)_.push(q);if(U){let W=a0(U,Z);_.push(W)}return Z.permissions.check(..._)}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}`,U=K==="can"?"elsecan":"elsecannot",_=!0;while(_){_=!1;let W=J.match(new RegExp(`@${K}\\s*\\(`));if(!W||W.index===void 0)break;let z=W.index,j=J.slice(z+`@${K}`.length),B=G(j);if(!B)break;let O=z+`@${K}`.length+B.paramsEnd,F=Y(J,K,q,O);if(F===-1){console.warn(`[stx] @${K} directive at position ${z} has no matching @${q} \u2014 the block was skipped.`);break}let L=J.slice(O,F),H=[],V=0,R=new RegExp(`@${K}\\s*\\(`,"g"),N=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${U}\\s*\\(`,"g"),w=/@else(?![a-z])/g,M=[],E;while((E=R.exec(L))!==null)M.push({pos:E.index,type:"open"});while((E=N.exec(L))!==null)M.push({pos:E.index,type:"close"});while((E=A.exec(L))!==null)M.push({pos:E.index,type:"elseDirective"});while((E=w.exec(L))!==null)M.push({pos:E.index,type:"else"});M.sort((S,k)=>S.pos-k.pos);for(let S of M){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)H.push(S)}let T=[],I=0;for(let S=0;S<H.length;S++){let k=H[S];if(T.push({content:L.slice(I,k.pos),ability:void 0}),k.type==="elseDirective"){let f=L.slice(k.pos+`@${U}`.length),h=G(f);if(h){T[T.length-1]={content:L.slice(I,k.pos)},I=k.pos+`@${U}`.length+h.paramsEnd,T.push({content:"",ability:h.ability,type:h.type,id:h.id}),T.pop();let p=H[S+1],z0=p?p.pos:L.length;T.push({content:L.slice(I,z0),ability:h.ability,type:h.type,id:h.id}),I=z0}}else I=k.pos+5}if(I<L.length){let S=T[T.length-1];if(H.length>0&&H[H.length-1].type==="else")T.push({content:L.slice(I),isFinalElse:!0});else if(T.length===0)T.push({content:L.slice(I)})}let D=X(B.ability,B.type,B.id),y=K==="can"?D:!D,b="";if(y)b=T[0]?.content||"";else{let S=!1;for(let k=1;k<T.length;k++){let f=T[k];if(f.isFinalElse){b=f.content,S=!0;break}if(f.ability){let h=X(f.ability,f.type,f.id);if(K==="can"?h:!h){b=f.content,S=!0;break}}}if(!S&&T.length>0){let k=T[T.length-1];if(k.isFinalElse)b=k.content}}J=J.substring(0,z)+b+J.substring(F+`@${q}`.length),_=!0}}return J}function l4($,Z,J){let Y=$;function Q(X,G,K,q,U){let _=!0;while(_){_=!1;let W=new RegExp(`@${G}\\s*\\(`),z=X.match(W);if(!z||z.index===void 0)break;let j=z.index,B=t0(X,j+`@${G}`.length);if(!B)break;let O=B.endPos,F=L1(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,R=0,N=0;while(N<L.length){let A=L.indexOf("@",N);if(A===-1)break;let w=L.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(w)){R++,N=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(w)){R--,N=A+1;continue}if(R===0&&/^@else(?![a-z])/.test(w)){V=A;break}N=A+1}try{let A=q(H.trim()),w;if(V!==-1){let M=L.slice(0,V),E=L.slice(V+5);w=A?M:E}else w=A?L:"";X=X.substring(0,j)+w+X.substring(F+`@${K}`.length),_=!0}catch(A){let w=A instanceof Error?A.message:String(A),M=o(U,`Error processing @${G} directive: ${w}`,u.EVALUATION_ERROR);X=X.substring(0,j)+M+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 c4($,Z,J){let Y=$,Q="development";function X(G,K,q,U){let _=new RegExp(`@${K}(?![a-z])`,"g"),W=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,O=!0;while(O){O=!1,_.lastIndex=0;let F=_.exec(B);if(!F)break;let L=F.index,H=L+F[0].length;if(K==="env"){let D=B.substring(H).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;H+=D[0].length,U=Q===D[2]}let V=1,R=H,N=-1;while(V>0&&R<B.length){_.lastIndex=R,W.lastIndex=R;let D=_.exec(B),y=W.exec(B),b=D?D.index:1/0,S=y?y.index:1/0;if(b<S)V++,R=b+D[0].length;else if(S<1/0){if(V--,V===0){N=S;break}R=S+y[0].length}else break}if(N===-1){console.warn(`[stx] @${K} directive at position ${L} has no matching @${q} \u2014 the block was skipped.`);break}let A=B.substring(H,N),w=-1,M=0,E=0;while(E<A.length){let D=A.indexOf("@",E);if(D===-1)break;let y=A.substring(D);if(z.test(y)){M++,E=D+1;continue}if(j.test(y)){M--,E=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(y)){w=D;break}E=D+1}let T;if(w!==-1){let D=A.slice(0,w),y=A.slice(w+5);T=U?D:y}else T=U?A:"";let I=`@${q}`.length;B=B.substring(0,L)+T+B.substring(N+I),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 J$=P(()=>{m3();l0();u4();R0()});function n3($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function X$($,Z){if(!$)return Z?.nonceGenerator?.()??n3();let J=i3.get($);if(!J)J=Z?.nonceGenerator?.()??n3(),i3.set($,J);return J}function bQ($,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 o3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${bQ($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function s3($,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?X$(J,Z):void 0,Q=o3(Z.directives,Y);return $.replace(/<head([^>]*)>/,`<head$1>
2459
+ ${Q}`)}function r3($,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?X$(Z,X):void 0;return o3(X.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return X$(Z,X)}),X?.enabled&&X.useNonce)Z.cspNonce=X$(Z,X);return Q}var i3;var a3=P(()=>{i3=new WeakMap});import yQ from"crypto";function PQ($=CQ){let Z=yQ.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return i4=Z,Z}function vQ(){if(!i4)PQ();return i4}function xQ($=t3){let Z=vQ();return`<input type="hidden" name="${$}" value="${Z}">`}function e3($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,Y)=>{return xQ(Y||t3)})}var CQ=40,t3="_token",i4=null;var $9=()=>{};async function Z9($,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 fQ(Q,X,Z,J,Y);else Q=await gQ(Q,X,Z,J,Y)}return Q}async function fQ($,Z,J,Y,Q){let{name:X,handler:G}=Z,K=`@${X}`,q=`@end${X}`,U=$,_=w1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),W=[],z=_.exec(U);while(z!==null){let[j,B="",O=""]=z,F=z.index||0;try{let L=B?Y9(B):[],H=O.trim(),V=await G(H,L,J,Y);W.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);W.push({original:j,processed:o("CustomDirective",`Error in @${X}${B?`(${B})`:""}: ${H}`,u.EVALUATION_ERROR),startIndex:F})}z=_.exec(U)}for(let j=W.length-1;j>=0;j--){let{original:B,processed:O}=W[j];U=U.replace(B,O)}return U}async function gQ($,Z,J,Y,Q){let{name:X,handler:G}=Z,K=$,q=w1(`@${X}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),U=[],_=q.exec(K);while(_!==null){let[j,B=""]=_,O=_.index||0;try{let F=Y9(B),L=await G("",F,J,Y);U.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);U.push({original:j,processed:o("CustomDirective",`Error in @${X}(${B}): ${L}`,u.EVALUATION_ERROR),startIndex:O})}_=q.exec(K)}let W=w1(`@${X}(?!\\w)(?!\\s*\\()`,"g"),z=W.exec(K);while(z!==null){let[j]=z,B=z.index||0;try{let O=await G("",[],J,Y);U.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);U.push({original:j,processed:o("CustomDirective",`Error in @${X}: ${F}`,u.EVALUATION_ERROR),startIndex:B})}z=W.exec(K)}for(let j=U.length-1;j>=0;j--){let{original:B,processed:O}=U[j];K=K.replace(B,O)}return K}function Y9($){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 J9=P(()=>{l0();T1()});import hQ from"crypto";function H0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Q$($,Z,J,Y){let Q=$||Z;return J?`${Q} ${Y}`:Q}function dQ(){return hQ.randomUUID()}function G$($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let Y=dQ();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 G9($,Z,J=Q9){let Y=$;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,X,G,K,q,U="")=>{let _=X||G||"POST",W=K||q||"",z=e0(U),j=_.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",O=`<form method="${H0(B)}" action="${H0(W)}"${z?` ${z}`:""}>`;if(O+=`
2460
+ ${G$("@csrf",Z)}`,!["GET","POST"].includes(j))O+=`
2461
+ ${G$(`@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,U="")=>{let _=X||G||"",W=K||q||"",z=e0(U),j=J5(_,Z),B=j!==void 0&&j!==null?j:W||"",O=z.match(/type=['"]([^'"]+)['"]/i),F=O?O[1]:"text",L=X5(_,Z),H=z.match(/class=['"]([^'"]+)['"]/i),V=Q$(H?H[1]:"",J.input,L,J.inputError),R=z.replace(/class=['"][^'"]+['"]/i,"");return R=R.replace(/type=['"][^'"]+['"]/i,""),`<input type="${H0(F)}" name="${H0(_)}" value="${H0(B)}" class="${V}"${R?` ${R}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,X,G="",K="")=>{let q=e0(G),U=J5(X,Z)||K.trim(),_=X5(X,Z),W=q.match(/class=['"]([^'"]+)['"]/i),z=Q$(W?W[1]:"",J.input,_,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${H0(X)}" class="${z}"${j?` ${j}`:""}>${H0(U)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,X,G="",K)=>{let q=e0(G),U=J5(X,Z),_=X5(X,Z),W=q.match(/class=['"]([^'"]+)['"]/i),z=Q$(W?W[1]:"",J.input,_,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(U!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(O,F,L)=>{if((Array.isArray(U)?U.some((V)=>String(V)===L):String(U)===L)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return O});return`<select name="${H0(X)}" class="${z}"${j?` ${j}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="1",K="")=>{let q=e0(K),U=J5(X,Z),_=U!==void 0&&(Array.isArray(U)?U.some((B)=>String(B)===G):U===!0||String(U)===G),W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${H0(X)}" value="${H0(G)}" class="${z}"${_?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G,K="")=>{let q=e0(K),U=J5(X,Z),_=U!==void 0&&U===G,W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${H0(X)}" value="${H0(G)}" class="${z}"${_?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="")=>{let K=e0(G),q=K.match(/accept=['"]([^'"]+)['"]/i),U=q?q[1]:"",_=K.includes("multiple"),W=X5(X,Z),z=K.match(/class=['"]([^'"]+)['"]/i),j=Q$(z?z[1]:"",J.input,W,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(U)O.push(`accept="${H0(U)}"`);if(_)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),U=q.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:J.label,W=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${H0(X)}" class="${_}"${W?` ${W}`:""}>${K}</label>`}),Y}function K9($,Z,J=Q9){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,Q,X)=>{try{if(X5(Q,Z))return X.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return X9(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 X9(Q,Z)}let q=K.trim();if(e(q)){let U=X0(q,Z);return U!==void 0?String(U):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),Y}})}function X5($,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 X9($,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 J5($,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 Q9;var q9=P(()=>{R0();Q9={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import _9 from"path";function mQ($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function uQ($,Z){if({...r4,...Z.i18n}.cache&&s4[$]){let Q=s4[$],X=Z.i18n?.cacheMaxAge??0;if(!mQ(Q,X))return Q.translations}if(Q5[$]?.state==="loading")return Q5[$].promise;n4[$]="loading";let Y=z9($,Z).then((Q)=>{return n4[$]="loaded",delete Q5[$],Q}).catch((Q)=>{throw n4[$]="error",Q5[$]={promise:Y,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return Q5[$]={promise:Y,state:"loading"},Y}async function z9($,Z){let J={...r4,...Z.i18n},Y=_9.resolve(import.meta.dir,"..",J.translationsDir),Q=iQ(J.format),X=_9.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=lQ(q);else if(J.format==="json")G=JSON.parse(q);else throw K}if(J.cache)s4[$]={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 z9(J.defaultLocale,Z);return{}}}async function pQ($,Z){return uQ($,Z)}function lQ($){let Z={},J=$.split(`
2462
+ `),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[,,U,_]=q,W=U.trim(),z=_.trim();if(z==="")K[W]={},Y.push({obj:K[W],indent:G});else K[W]=cQ(z)}}return Z}function cQ($){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 iQ($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function nQ($,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 oQ($,Z={}){return B9($,Z)}function B9($,Z){let J="",Y=0;while(Y<$.length)if($[Y]==="{"){let Q=sQ($,Y);if(Q===-1){J+=$[Y],Y++;continue}let X=$.slice(Y+1,Q);J+=rQ(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 sQ($,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 rQ($,Z){let J=aQ($);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 tQ(Q,J.slice(2).join(","),Z);case"select":return $G(Q,J.slice(2).join(","));case"selectordinal":return ZG(Q,J.slice(2).join(","));case"number":return JG(Q,J[2]?.trim());case"date":return XG(Q,J[2]?.trim());case"time":return QG(Q,J[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function aQ($){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 tQ($,Z,J){let Y=Number($)||0,Q=a4(Z),X=`=${Y}`;if(Q[X])return o4(Q[X],Y,J);let G=eQ(Y);if(Q[G])return o4(Q[G],Y,J);if(Q.other)return o4(Q.other,Y,J);return String(Y)}function o4($,Z,J){let Y=$.replace(/#/g,String(Z));return B9(Y,J)}function eQ($){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 $G($,Z){let J=String($||""),Y=a4(Z);if(Y[J])return Y[J];return Y.other||String($)}function ZG($,Z){let J=Number($)||0,Y=a4(Z),Q=YG(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 YG($){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 a4($){let Z={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=J.exec($);while(Y!==null)Z[Y[1]]=Y[2],Y=J.exec($);return Z}function JG($,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 XG($,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 QG($,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 GG($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function U9($,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(GG(G))return oQ(G,Y);if(G.includes("|")&&"count"in Y){let K=Number(Y.count),q=G.split("|");G=nQ(q,K)}for(let[K,q]of Object.entries(Y)){let U=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${U}`,"g"),String(q))}return G}async function j9($,Z,J,Y){let Q=$,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...r4,...Y.i18n},K=await pQ(G.locale,Y);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await W9(Q,X,async(_,W,z,j,B)=>{try{let O={};if(z)try{let L=[()=>JSON.parse(z),()=>{let H=`{"data":${z}}`,V=JSON.parse(H);return typeof V.data==="object"?V.data:{}},()=>{return O0(z,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 U9(W,K,G.fallbackToKey,O)||j.trim()}catch(O){if(Y.debug)console.error("Error processing @translate directive:",O);return o("Translate",`Error in @translate('${W}'): ${O instanceof Error?O.message:String(O)}`,u.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 _=[...Q.matchAll(q)];console.warn(`Found ${_.length} @translate matches`),_.forEach((W,z)=>console.warn(`Match ${z}: ${W[0]}, Key: ${W[1]}, Params: ${W[2]||"none"}`))}return Q=await W9(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(_,W,z,j)=>{try{let B={};if(z)try{let O=[()=>JSON.parse(z),()=>{let F=`{"data":${z}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return O0(z,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 U9(W,K,G.fallbackToKey,B)}catch(B){if(Y.debug)console.error("Error processing @translate directive:",B);return o("Translate",`Error in @translate('${W}'): ${B instanceof Error?B.message:String(B)}`,u.EVALUATION_ERROR)}}),Q}async function W9($,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 r4,s4,Q5,n4;var O9=P(()=>{l0();R0();r4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},s4={},Q5={},n4={}});var R9={};r(R9,{processLoops:()=>t4});function _G($,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,U=K+1;while(U<Y.length&&q>0){if(Y[U]==="(")q++;else if(Y[U]===")"){if(q--,q===0)break}U++}if(q!==0)continue;let _=Y.substring(K+1,U),W=U+1,z=_.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let j=z[1],B=_.slice(z[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:W,replacement:V})}catch{continue}}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:U}=X[G];Y=Y.substring(0,K)+U+Y.substring(q)}return Y}function K$($,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,U=K+1,_=null,W=!1;while(U<Y.length&&q>0){let B=Y[U];if(W){W=!1,U++;continue}if(B==="\\"&&_){W=!0,U++;continue}if(_){if(B===_)_=null;U++;continue}if(B==='"'||B==="'"||B==="`"){_=B,U++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}U++}if(q!==0)break;let z=Y.substring(K+1,U),j=J(z);Y=Y.substring(0,G)+j+Y.substring(U+1)}return Y}function UG($,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);u1(X);let U=$0(X,G)(...K),W=JSON.stringify(U).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${Q}="${W}"`}catch(G){return Y}}),J}function WG($,Z){let J=$;return J=K$(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?q$:""}catch{return""}}),J=K$(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?_$:""}catch{return""}}),J}function zG($){let Z=$;return Z=Z.replace(/@break(?!\()/g,q$),Z=Z.replace(/@continue(?!\()/g,_$),Z}function H9($){let Z=$.includes(q$),J=Z?$.substring(0,$.indexOf(q$)):$;return{hasBreak:Z,content:J}}function L9($){let Z=$.includes(_$),J=Z?$.substring(0,$.indexOf(_$)):$;return{hasContinue:Z,content:J}}function V9($){let Z=$;return Z=K$(Z,"@break",(J)=>{let Y=J.trim();if(!O5(Y))return"";return`\`; if (${Y}) { break; } result += \``}),Z=K$(Z,"@continue",(J)=>{let Y=J.trim();if(!O5(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function BG($){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)=>_.pos-W.pos);let K=[],q=0;for(let _ of Y)q+=_.delta,K.push({pos:_.pos,depth:q});function U(_){let W=0,z=K.length-1,j=0;while(W<=z){let B=W+z>>1;if(K[B].pos<=_)j=K[B].depth,W=B+1;else z=B-1}return j}while((J=Z.exec($))!==null){if(U(J.index)>0)continue;let _=J.index,W=J.index+J[0].length-1,z=1,j=W+1,B=-1;while(j<$.length&&z>0){if($[j]==="(")z++;else if($[j]===")"){if(z--,z===0){B=j;break}}j++}if(B===-1)continue;let O=$.substring(W+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,R=1,N=V,A=/@forelse\s*\(/g,w=/@endforelse/g,M=-1;while(R>0&&N<$.length){A.lastIndex=N,w.lastIndex=N;let b=A.exec($),S=w.exec($);if(!S)break;if(b&&b.index<S.index)R++,N=b.index+b[0].length;else{if(R--,R===0){M=S.index;break}N=S.index+11}}if(M===-1)continue;let E=$.substring(V,M),T=M+11,I=-1,D=0,y=0;while(y<E.length){let b=E.indexOf("@",y);if(b===-1)break;let S=E.substring(b);if(/^@forelse\s*\(/.test(S))D++,y=b+1;else if(S.startsWith("@endforelse"))D--,y=b+11;else if(D===0&&S.startsWith("@empty")){if(E.length<=b+6||!/[a-z]/i.test(E[b+6])){I=b;break}y=b+1}else y=b+1}if(I===-1)continue;return{start:_,end:T,arrayExpr:L,itemVar:H,foreachContent:E.substring(0,I),emptyContent:E.substring(I+6)}}return null}function F9($,Z){let J=$;while(!0){let Y=BG(J);if(!Y)break;let{start:Q,end:X,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:U}=Y;try{let _;if(e(G))_=$0(G,Object.keys(Z))(...Object.values(Z));else _=X0(G,Z);let W;if(!Array.isArray(_)||_.length===0)W=U;else W=`@foreach (${G} as ${K})${q}@endforeach`;J=J.substring(0,Q)+W+J.substring(X)}catch(_){let W=_ instanceof Error?_.message:String(_),z=o("Forelse",`Error in @forelse(${G} as ${K}): ${W}`,u.EVALUATION_ERROR);J=J.substring(0,Q)+z+J.substring(X)}}return J}function t4($,Z,J,Y){let Q=$;Q=F9(Q,Z);function X(q){let U=/@foreach\s*\(/g,_;while((_=U.exec(q))!==null){let W=_.index,z=_.index+_[0].length-1,j=1,B=z+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(z+1,O),L=F.indexOf(" as ");if(L===-1)continue;let H=W,V=F.substring(0,L),R=F.substring(L+4),N=O+1,A=1,w=N,M=/@foreach\s*\(/g,E=/@endforeach/g;while(A>0&&w<q.length){M.lastIndex=w,E.lastIndex=w;let T=M.exec(q),I=E.exec(q);if(!I)break;if(T&&T.index<I.index)A++,w=T.index+T[0].length;else{if(A--,A===0){let D=q.substring(N,I.index),y=I.index+11;return{start:H,end:y,arrayExpr:V,itemVar:R,content:D}}w=I.index+11}}}return null}function G(q,U){let _=q;while(!0){let W=X(_);if(!W)break;let{start:z,end:j,arrayExpr:B,itemVar:O,content:F}=W;try{let L=B.trim(),H;if(e(L))H=$0(L,Object.keys(U))(...Object.values(U));else H=X0(L,U);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 T=o("Foreach",`Error in @foreach: ${L} is not iterable`,u.TYPE_ERROR);_=_.substring(0,z)+T+_.substring(j);continue}let R=Y?.loops?.useAltLoopVariable??qG,N=O.trim(),A=null,w;if(N.includes("=>")){let T=N.split("=>").map((I)=>I.trim());if(T.length===2)A=T[0],w=T[1];else w=N}else w=N;let M="",E=H;for(let T=0;T<E.length;T++){let I=E[T],D={index:T,iteration:T+1,first:T===0,last:T===E.length-1,count:E.length},y={...U,loop:D,$loop:D};if(w.startsWith("[")&&w.endsWith("]")){let f=w.slice(1,-1).split(",").map((h)=>h.trim());if(Array.isArray(I))f.forEach((h,p)=>{if(h)y[h]=I[p]});else y[w]=I}else y[w]=I;if(A)if(V&&Array.isArray(I)&&I.length===2)y[A]=I[0],y[w]=I[1];else y[A]=T;let b=WG(F,y),S=L9(b);if(S.hasContinue){M+=S.content;continue}let k=H9(b);if(k.hasBreak){M+=k.content;break}if(b=F9(b,y),b=G(b,y),b=b1(b,y,J),b=zG(b),k=H9(b),k.hasBreak){M+=k.content;break}if(S=L9(b),S.hasContinue){M+=S.content;continue}b=q1(b,y,J),b=UG(b,y),b=_G(b,y),M+=b}_=_.substring(0,z)+M+_.substring(j)}catch(L){let H=o("Foreach",`Error in @foreach(${B.trim()} as ${O.trim()}): ${L instanceof Error?L.message:String(L)}`,u.EVALUATION_ERROR);_=_.substring(0,z)+H+_.substring(j)}}return _}Q=G(Q,Z),Q=jG(Q,Z);let K=Y?.loops?.maxWhileIterations??KG;return Q=OG(Q,Z,K),Q}function N9($){return O5($)}function jG($,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),U=K+1,_=Y$(J.slice(X),"for","endfor");if(_.length===0)break;let W=_[0].content,z=X+_[0].end;if(!N9(q)){let j=o("For",`Unsafe expression in @for: ${q}`,u.UNSAFE_EXPRESSION);J=J.substring(0,X)+j+J.substring(z),Y=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),O=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,V)=>{return`\${${V}}`});O=V9(O);let L=Function(...j,`
2463
2463
  let result = '';
2464
2464
  for (${q}) {
2465
- result += \`${H}\`;
2465
+ result += \`${O}\`;
2466
2466
  }
2467
2467
  return result;
2468
- `)(...B);J=J.substring(0,X)+L+J.substring(z),Y=!0}catch(j){let B=s("For",`Error in @for(${q}): ${j instanceof Error?j.message:String(j)}`,u.EVALUATION_ERROR);J=J.substring(0,X)+B+J.substring(z),Y=!0}}return J}function KG(Z,$,J){let Y=Z,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=I4(Y,"(",")",K);if(q===-1)break;let U=Y.slice(K+1,q),_=YZ(Y.slice(G),"while","endwhile");if(_.length===0)break;let W=_[0].content,z=G+_[0].end;if(!H1(U)){let j=s("While",`Unsafe expression in @while: ${U}`,u.UNSAFE_EXPRESSION);Y=Y.substring(0,G)+j+Y.substring(z),Q=!0;continue}try{let j=Object.keys($),B=Object.values($),H=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=j1(H);let L=Function(...j,`
2468
+ `)(...B);J=J.substring(0,X)+L+J.substring(z),Y=!0}catch(j){let B=o("For",`Error in @for(${q}): ${j instanceof Error?j.message:String(j)}`,u.EVALUATION_ERROR);J=J.substring(0,X)+B+J.substring(z),Y=!0}}return J}function OG($,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 U=Y.slice(K+1,q),_=Y$(Y.slice(G),"while","endwhile");if(_.length===0)break;let W=_[0].content,z=G+_[0].end;if(!N9(U)){let j=o("While",`Unsafe expression in @while: ${U}`,u.UNSAFE_EXPRESSION);Y=Y.substring(0,G)+j+Y.substring(z),Q=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),O=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,V)=>{return`\${${V}}`});O=V9(O);let L=Function(...j,`
2469
2469
  let result = '';
2470
2470
  let maxIterations = ${J}; // Configurable safety limit
2471
2471
  let counter = 0;
2472
2472
  while (${U} && counter < maxIterations) {
2473
2473
  counter++;
2474
- result += \`${H}\`;
2474
+ result += \`${O}\`;
2475
2475
  }
2476
2476
  if (counter > maxIterations) {
2477
2477
  result += '<!-- [While Error [1104]]: Maximum iterations (${J}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
2478
2478
  }
2479
2479
  return result;
2480
- `)(...B);Y=Y.substring(0,G)+L+Y.substring(z),Q=!0}catch(j){let B=s("While",`Error in @while(${U}): ${j instanceof Error?j.message:String(j)}`,u.EVALUATION_ERROR);Y=Y.substring(0,G)+B+Y.substring(z),Q=!0}}return Y}var eQ=1000,ZG=!1,qZ="<!--__STX_BREAK__-->",_Z="<!--__STX_CONTINUE__-->";var t6=P(()=>{JZ();l4();n4();m6();A4()});import q4 from"path";function e6(Z,$){let J=0;for(let Y=$;Y<Z.length;Y++){let Q=Z[Y];if(Q==="("||Q==="["||Q==="{")J++;else if(Q===")"||Q==="]"||Q==="}")J--;else if(Q===","&&J===0)return Y}return-1}function qG(Z,$,J){let Y=Z,Q=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),X=Q.exec(Y);while(X){let G=X.index,K=G+X[0].length-1,q=1,U=K+1;while(U<Y.length&&q>0){if(Y[U]==="(")q++;else if(Y[U]===")")q--;U++}if(q!==0)break;let _=Y.substring(K+1,U-1),W=`${J}(${_})`;Y=Y.substring(0,G)+W+Y.substring(U),Q.lastIndex=G+W.length,X=Q.exec(Y)}return Y}function _G(Z){return/\b(state|derived|effect)\s*\(/.test(Z)}function UG(Z){let $=Z,J=[],Y=new Set,Q=0,X=0,G=$.length,K=(W)=>{X++;while(X<G){if($[X]==="\\"){X+=2;continue}if($[X]===W){X++;return}X++}},q=()=>{X++;while(X<G){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let W=1;while(X<G&&W>0)if($[X]==="{")W++;else if($[X]==="}")W--;else if($[X]==="'"||$[X]==='"')K($[X]);else if($[X]==="`")q();else X++;continue}X++}},U=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<G&&$[X]!==`
2481
- `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<G-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},_=()=>{if(Q!==0)return;let W=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!Y.has(B))J.push(B),Y.add(B);return}let z=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[1];if(!Y.has(B))J.push(B),Y.add(B);return}let j=$.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(U())continue;if($[X]==="'"||$[X]==='"'){K($[X]);continue}if($[X]==="`"){q();continue}if($[X]==="{"){Q++,X++;continue}if($[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))_();X++}return J.join(", ")}function WG(Z,$){let J=UG(Z);return`
2480
+ `)(...B);Y=Y.substring(0,G)+L+Y.substring(z),Q=!0}catch(j){let B=o("While",`Error in @while(${U}): ${j instanceof Error?j.message:String(j)}`,u.EVALUATION_ERROR);Y=Y.substring(0,G)+B+Y.substring(z),Q=!0}}return Y}var KG=1000,qG=!1,q$="<!--__STX_BREAK__-->",_$="<!--__STX_CONTINUE__-->";var e4=P(()=>{J$();l0();o0();u4();R0()});import q0 from"path";function $7($,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 HG($,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,U=K+1;while(U<Y.length&&q>0){if(Y[U]==="(")q++;else if(Y[U]===")")q--;U++}if(q!==0)break;let _=Y.substring(K+1,U-1),W=`${J}(${_})`;Y=Y.substring(0,G)+W+Y.substring(U),Q.lastIndex=G+W.length,X=Q.exec(Y)}return Y}function LG($){return/\b(state|derived|effect)\s*\(/.test($)}function FG($){let Z=$,J=[],Y=new Set,Q=0,X=0,G=Z.length,K=(W)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===W){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 W=1;while(X<G&&W>0)if(Z[X]==="{")W++;else if(Z[X]==="}")W--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},U=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
2481
+ `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},_=()=>{if(Q!==0)return;let W=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!Y.has(B))J.push(B),Y.add(B);return}let z=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[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(U())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])))_();X++}return J.join(", ")}function VG($,Z){let J=FG($);return`
2482
2482
  (function() {
2483
2483
  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;
2484
2484
  var __destroyHooks = [];
2485
2485
  var __origOnDestroy = onDestroy;
2486
2486
  onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
2487
2487
 
2488
- ${Z}
2488
+ ${$}
2489
2489
 
2490
2490
  // Register scope variables for STX runtime
2491
2491
  if (!window.stx._scopes) window.stx._scopes = {};
2492
- window.stx._scopes['${$}'] = { ${J}, __destroyCallbacks: __destroyHooks };
2492
+ window.stx._scopes['${Z}'] = { ${J}, __destroyCallbacks: __destroyHooks };
2493
2493
  })();
2494
- `}function zG(Z,$){let J=Z.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:Z,mergedIntoExisting:Q[1]};let X=J[1],G=J[2],K=J[3];return{html:`${X}${G} data-stx-scope="${$}"${K}${Z.slice(J[0].length)}`,mergedIntoExisting:null}}return{html:Z,mergedIntoExisting:null}}function HG(Z){if(Z.__onceStore instanceof Set)return Z.__onceStore;return jG}async function Z0(Z,$,J,Y,Q,X=new Set){let G=Y.partialsDir||q4.join(q4.dirname(J),"partials");if(G&&!q4.isAbsolute(G)){let B=q4.resolve(__dirname,"..");G=q4.resolve(B,G)}let K=qG(Z,"@partial","@include"),q=HG($);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,H,F)=>{let L=H.trim(),O=`${J}:${L}`;if(q.has(O))return"";return q.add(O),H});{let B=/@includeIf\s*\(/g,H;while((H=B.exec(K))!==null){let F=H.index,L=F+H[0].length-1,O=1,V=L+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let A=K.substring(L+1,V-1),N=A.match(/^\s*['"]([^'"]+)['"]/);if(!N){B.lastIndex=V;continue}let R=N[1],w=U(R,G,J),M="";if(w&&await Bun.file(w).exists())Q.add(w),M=`@include(${A})`;K=K.substring(0,F)+M+K.substring(V),B.lastIndex=0}}for(let[B,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let F=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=F.exec(K))!==null){let O=L.index,V=O+L[0].length-1,A=1,N=V+1;while(N<K.length&&A>0){if(K[N]==="(")A++;else if(K[N]===")")A--;N++}if(A!==0)break;let R=K.substring(V+1,N-1),w=e6(R,0);if(w===-1){F.lastIndex=N;continue}let M=R.substring(0,w).trim(),E=R.substring(w+1).trim(),T=E.match(/^\s*['"]([^'"]+)['"]/);if(!T){F.lastIndex=N;continue}let I=T[1],D=E.substring(T[0].length),y,b=e6(D,0);if(b!==-1)y=D.substring(b+1).trim();try{let S=`Boolean(${M})`,k;if(e(S)){let p=Z4(S,Object.keys($));k=Boolean(p(...Object.values($)))}else k=Boolean(X4(S,$));let f=H?!k:k,h="";if(f){let p=U(I,G,J);if(p&&await Bun.file(p).exists())Q.add(p);h=`@include('${I}'${y?`, ${y}`:""})`}K=K.substring(0,O)+h+K.substring(N),F.lastIndex=0}catch(S){let k=S instanceof Error?S.message:String(S),f=Q4("Include",`Error evaluating ${B} condition: ${k}`,J,Z,O);K=K.substring(0,O)+f+K.substring(N),F.lastIndex=0}}}{let B=/@each\s*\(/g,H;while((H=B.exec(K))!==null){let F=H.index,L=F+H[0].length-1,O=1,V=L+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let A=K.substring(L+1,V),N=K.substring(F,V+1),R=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){B.lastIndex=0,K=K.replace(N,"");continue}let[,w,M,E,T]=R;try{let I,D=M.trim();if(e(D))I=Z4(D,Object.keys($))(...Object.values($));else I=X4(D,$);let y="";if(Array.isArray(I)&&I.length>0)for(let b of I){let S={...$,[E]:b},k=await W(w,S,Z,F);y+=k}else if(T)y=await W(T,{},Z,F);K=K.substring(0,F)+y+K.substring(V+1),B.lastIndex=0}catch(I){let D=I instanceof Error?I.message:String(I);K=K.substring(0,F)+Q4("Each",`Error in @each: ${D}`,J,Z,F)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,H;while((H=B.exec(K))!==null){let F=H.index,L=F+H[0].length-1,O=1,V=L+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let A=K.substring(L+1,V),N=K.substring(F,V+1),R=A.match(/^\s*(\[[^\]]+\])/);if(!R){B.lastIndex=0,K=K.replace(N,"");continue}let w=R[1],M=A.slice(R[0].length),E,T=M.match(/^\s*,\s*\{/);if(T){M=M.slice(T[0].length-1);let y=1,b=1;while(b<M.length&&y>0){if(M[b]==="{")y++;else if(M[b]==="}"){if(y--,y===0)break}b++}E=M.substring(0,b+1),M=M.slice(b+1)}let I,D=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)I=D[1];try{let y=JSON.parse(w.replace(/'/g,'"')),b={};if(E)try{b=H4(E,$)}catch(k){let f=k instanceof Error?k.message:String(k);if(Y.debug){let h=Q4("Include",`Error parsing includeFirst variables: ${f}`,J,Z,F,N);K=K.replace(N,()=>h)}else K=K.replace(N,()=>I||"");continue}let S=!1;for(let k of y){let f=U(k,G,J);if(!f)continue;if(await c(f)){let h=await W(k,b,Z,F);K=K.replace(N,()=>h),S=!0;break}}if(!S)if(I!==void 0)K=K.replace(N,()=>I);else if(Y.debug){let k=Q4("Include",`None of the includeFirst paths exist: ${w}`,J,Z,F,N);K=K.replace(N,()=>k)}else K=K.replace(N,"")}catch(y){let b=y instanceof Error?y.message:String(y),S=Q4("Include",`Error processing @includeFirst: ${b}`,J,Z,F,N);K=K.replace(N,()=>S)}B.lastIndex=0}}function U(B,H,F){try{let L=B;if(!B.endsWith(".stx"))L=`${B}.stx`;let O=q4.resolve(H),V=q4.resolve(q4.dirname(F)),A;if(!L.startsWith("./")&&!L.startsWith("../"))A=q4.resolve(H,L);else A=q4.resolve(V,L);let N=q4.normalize(A),R=N.startsWith(O+q4.sep)||N===O,w=N.startsWith(V+q4.sep)||N===V,M=!1,E=q4.dirname(V);if(N.startsWith(E+q4.sep)){if(!q4.relative(E,N).split(q4.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))M=!0}if(!R&&!w&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return N}catch(L){return console.error(`Error resolving path ${B}: ${L}`),null}}let _=q4.resolve(J);X.add(_);async function W(B,H={},F,L){let O=U(B,G,J);if(!O)return Q4("Include",`Could not resolve path for include: ${B}`,J,F,L);let V=q4.resolve(O);if(X.has(V)){let A=[...X,V].map((N)=>q4.basename(N)).join(" -> ");return Q4("Include",`Circular include detected: ${A}`,J,F,L)}try{Q.add(O);let A;if(!A)try{A=await Bun.file(O).text()}catch(k){let f=k instanceof Error?k.message:String(k);return Q4("Include",`Error loading include file ${B}: ${f}`,J,F,L)}let N=A,R=N.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(R)N=R[1].trim();let w=A.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(w)M=`<style${w[1]}>${w[2]}</style>`;N=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let E={...$};for(let[k,f]of Object.entries(H))E[k]=f;let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...A.matchAll(T)],D="",y=null;for(let k of I){let f=k[1]||"",h=k[2]||"",p=f.includes("server");if(X5(f)&&h.trim())h=Q5(h);let M4=_G(h);if(M4&&!p){y=`stx_scope_${q4.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++BG}`;let U4=i4(h),b4=WG(U4,y);D+=`<script data-stx-scoped>${b4}</script>
2495
- `;continue}if(p)try{let{extractVariables:U4}=await Promise.resolve().then(() => (o5(),A7));await U4(h,E,O)}catch(U4){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,U4)}if(!p&&!M4){let U4=f.replace(/\bclient\b/i,"").trim();D+=`<script data-stx-scoped${U4?` ${U4}`:""}>${h}</script>
2496
- `}}if(y){let k=zG(N,y);if(N=k.html,k.mergedIntoExisting)D=D.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${k.mergedIntoExisting}']`),y=k.mergedIntoExisting}if(N.includes("@include")||N.includes("@partial"))N=await Z0(N,E,O,Y,Q,X);let{processLoops:b}=await Promise.resolve().then(() => (t6(),O1)),S=b(N,E,O);if(S=b5(S,E,O),S=K5(S,E,O),M)S+=`
2494
+ `}function NG($,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 wG($){if($.__onceStore instanceof Set)return $.__onceStore;return AG}async function Z7($,Z,J,Y,Q,X=new Set){let G=Y.partialsDir||q0.join(q0.dirname(J),"partials");if(G&&!q0.isAbsolute(G)){let B=q0.resolve(__dirname,"..");G=q0.resolve(B,G)}let K=HG($,"@partial","@include"),q=wG(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 R=K.substring(L+1,V-1),N=R.match(/^\s*['"]([^'"]+)['"]/);if(!N){B.lastIndex=V;continue}let A=N[1],w=U(A,G,J),M="";if(w&&await Bun.file(w).exists())Q.add(w),M=`@include(${R})`;K=K.substring(0,F)+M+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,R=1,N=V+1;while(N<K.length&&R>0){if(K[N]==="(")R++;else if(K[N]===")")R--;N++}if(R!==0)break;let A=K.substring(V+1,N-1),w=$7(A,0);if(w===-1){F.lastIndex=N;continue}let M=A.substring(0,w).trim(),E=A.substring(w+1).trim(),T=E.match(/^\s*['"]([^'"]+)['"]/);if(!T){F.lastIndex=N;continue}let I=T[1],D=E.substring(T[0].length),y,b=$7(D,0);if(b!==-1)y=D.substring(b+1).trim();try{let S=`Boolean(${M})`,k;if(e(S)){let p=$0(S,Object.keys(Z));k=Boolean(p(...Object.values(Z)))}else k=Boolean(X0(S,Z));let f=O?!k:k,h="";if(f){let p=U(I,G,J);if(p&&await Bun.file(p).exists())Q.add(p);h=`@include('${I}'${y?`, ${y}`:""})`}K=K.substring(0,H)+h+K.substring(N),F.lastIndex=0}catch(S){let k=S instanceof Error?S.message:String(S),f=Q0("Include",`Error evaluating ${B} condition: ${k}`,J,$,H);K=K.substring(0,H)+f+K.substring(N),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 R=K.substring(L+1,V),N=K.substring(F,V+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){B.lastIndex=0,K=K.replace(N,"");continue}let[,w,M,E,T]=A;try{let I,D=M.trim();if(e(D))I=$0(D,Object.keys(Z))(...Object.values(Z));else I=X0(D,Z);let y="";if(Array.isArray(I)&&I.length>0)for(let b of I){let S={...Z,[E]:b},k=await W(w,S,$,F);y+=k}else if(T)y=await W(T,{},$,F);K=K.substring(0,F)+y+K.substring(V+1),B.lastIndex=0}catch(I){let D=I instanceof Error?I.message:String(I);K=K.substring(0,F)+Q0("Each",`Error in @each: ${D}`,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 R=K.substring(L+1,V),N=K.substring(F,V+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){B.lastIndex=0,K=K.replace(N,"");continue}let w=A[1],M=R.slice(A[0].length),E,T=M.match(/^\s*,\s*\{/);if(T){M=M.slice(T[0].length-1);let y=1,b=1;while(b<M.length&&y>0){if(M[b]==="{")y++;else if(M[b]==="}"){if(y--,y===0)break}b++}E=M.substring(0,b+1),M=M.slice(b+1)}let I,D=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)I=D[1];try{let y=JSON.parse(w.replace(/'/g,'"')),b={};if(E)try{b=O0(E,Z)}catch(k){let f=k instanceof Error?k.message:String(k);if(Y.debug){let h=Q0("Include",`Error parsing includeFirst variables: ${f}`,J,$,F,N);K=K.replace(N,()=>h)}else K=K.replace(N,()=>I||"");continue}let S=!1;for(let k of y){let f=U(k,G,J);if(!f)continue;if(await c(f)){let h=await W(k,b,$,F);K=K.replace(N,()=>h),S=!0;break}}if(!S)if(I!==void 0)K=K.replace(N,()=>I);else if(Y.debug){let k=Q0("Include",`None of the includeFirst paths exist: ${w}`,J,$,F,N);K=K.replace(N,()=>k)}else K=K.replace(N,"")}catch(y){let b=y instanceof Error?y.message:String(y),S=Q0("Include",`Error processing @includeFirst: ${b}`,J,$,F,N);K=K.replace(N,()=>S)}B.lastIndex=0}}function U(B,O,F){try{let L=B;if(!B.endsWith(".stx"))L=`${B}.stx`;let H=q0.resolve(O),V=q0.resolve(q0.dirname(F)),R;if(!L.startsWith("./")&&!L.startsWith("../"))R=q0.resolve(O,L);else R=q0.resolve(V,L);let N=q0.normalize(R),A=N.startsWith(H+q0.sep)||N===H,w=N.startsWith(V+q0.sep)||N===V,M=!1,E=q0.dirname(V);if(N.startsWith(E+q0.sep)){if(!q0.relative(E,N).split(q0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))M=!0}if(!A&&!w&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${H}, ${V}`),null;return N}catch(L){return console.error(`Error resolving path ${B}: ${L}`),null}}let _=q0.resolve(J);X.add(_);async function W(B,O={},F,L){let H=U(B,G,J);if(!H)return Q0("Include",`Could not resolve path for include: ${B}`,J,F,L);let V=q0.resolve(H);if(X.has(V)){let R=[...X,V].map((N)=>q0.basename(N)).join(" -> ");return Q0("Include",`Circular include detected: ${R}`,J,F,L)}try{Q.add(H);let R;if(!R)try{R=await Bun.file(H).text()}catch(k){let f=k instanceof Error?k.message:String(k);return Q0("Include",`Error loading include file ${B}: ${f}`,J,F,L)}let N=R,A=N.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(A)N=A[1].trim();let w=R.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(w)M=`<style${w[1]}>${w[2]}</style>`;N=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let E={...Z};for(let[k,f]of Object.entries(O))E[k]=f;let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...R.matchAll(T)],D="",y=null;for(let k of I){let f=k[1]||"",h=k[2]||"",p=f.includes("server");if(Q1(f)&&h.trim())h=G1(h);let M0=LG(h);if(M0&&!p){y=`stx_scope_${q0.basename(H,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++RG}`;let U0=n0(h),b0=VG(U0,y);D+=`<script data-stx-scoped>${b0}</script>
2495
+ `;continue}if(p)try{let{extractVariables:U0}=await Promise.resolve().then(() => (s1(),R5));await U0(h,E,H)}catch(U0){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${H}:`,U0)}if(!p&&!M0){let U0=f.replace(/\bclient\b/i,"").trim();D+=`<script data-stx-scoped${U0?` ${U0}`:""}>${h}</script>
2496
+ `}}if(y){let k=NG(N,y);if(N=k.html,k.mergedIntoExisting)D=D.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${k.mergedIntoExisting}']`),y=k.mergedIntoExisting}if(N.includes("@include")||N.includes("@partial"))N=await Z7(N,E,H,Y,Q,X);let{processLoops:b}=await Promise.resolve().then(() => (e4(),R9)),S=b(N,E,H);if(S=b1(S,E,H),S=q1(S,E,H),M)S+=`
2497
2497
  `+M;if(D)S+=`
2498
- `+D;return S}catch(A){let N=A instanceof Error?A.message:String(A);return Q4("Include",`Error processing include ${B}: ${N}`,J,F,L)}}let z=/@include\s*\(/g,j;while((j=z.exec(K))!==null){let B=j.index,H=B+j[0].length-1,F=1,L=H+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")")F--;L++}if(F!==0)break;let O=K.substring(B,L),V=K.substring(H+1,L-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){z.lastIndex=L;continue}let N=A[1],R,w=V.substring(A[0].length),M=e6(w,0);if(M!==-1)R=w.substring(M+1).trim();let E={};if(R)try{E=H4(R,$)}catch(I){let D=I instanceof Error?I.message:String(I);K=K.replace(O,Q4("Include",`Error parsing include variables for ${N}: ${D}`,J,Z,B)),z.lastIndex=0;continue}let T=await W(N,E,Z,B);K=K.substring(0,B)+T+K.substring(L),z.lastIndex=0}return K}function $0(Z,$){let J=Z;function Y(Q,X,G,K){let q=Q,U=!0;while(U){U=!1;let _=new RegExp(`@${X}\\(['"]([^'"]+)['"]\\)`),W=q.match(_);if(!W||W.index===void 0)break;let z=W.index,j=W[1],B=z+W[0].length,H=new RegExp(`@${X}\\(`),F=new RegExp(`@${G}(?![a-z])`),L=1,O=B,V=-1;while(L>0&&O<q.length){let N=q.slice(O),R=N.match(H),w=N.match(F),M=R?O+R.index:1/0,E=w?O+w.index:1/0;if(M<E)L++,O=M+(R[0].length||1);else if(E<1/0){if(L--,L===0){V=E;break}O=E+G.length+1}else break}if(V===-1)break;let A=q.slice(B,V);if(!$[j])$[j]=[];if(K)$[j].unshift(A);else $[j].push(A);q=q.substring(0,z)+q.substring(V+`@${G}`.length),U=!0}return q}return J=Y(J,"push","endpush",!1),J=Y(J,"prepend","endprepend",!0),J}function Y0(Z,$){return Z.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,Y)=>{if(!$[Y]||$[Y].length===0)return"";return $[Y].join(`
2499
- `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",BG=0,IB,jG;var L1=P(()=>{JZ();n4();T5();A4();V4();IB=new c5(500),jG=new Set});import*as J0 from"path";async function F1(Z,$,J=""){if(J0.basename(J)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,Z.replace(/@js[\s\S]*?@endjs/g,"");return N1(Z,$,J,"@js","@endjs")}async function V1(Z,$,J=""){if(J0.basename(J)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((X)=>({...X,displayName:`User ${X.id}: ${X.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return Z.replace(/@ts[\s\S]*?@endts/g,"")}return N1(Z,$,J,"@ts","@endts")}async function N1(Z,$,J,Y,Q){let X=Z,G=w5(`${Y}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec(Z))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:U,content:_,index:W}of K)try{let z=Object.keys($),j=Object.values($),B=_.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((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",O=`
2498
+ `+D;return S}catch(R){let N=R instanceof Error?R.message:String(R);return Q0("Include",`Error processing include ${B}: ${N}`,J,F,L)}}let z=/@include\s*\(/g,j;while((j=z.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),R=V.match(/^\s*['"]([^'"]+)['"]/);if(!R){z.lastIndex=L;continue}let N=R[1],A,w=V.substring(R[0].length),M=$7(w,0);if(M!==-1)A=w.substring(M+1).trim();let E={};if(A)try{E=O0(A,Z)}catch(I){let D=I instanceof Error?I.message:String(I);K=K.replace(H,Q0("Include",`Error parsing include variables for ${N}: ${D}`,J,$,B)),z.lastIndex=0;continue}let T=await W(N,E,$,B);K=K.substring(0,B)+T+K.substring(L),z.lastIndex=0}return K}function Y7($,Z){let J=$;function Y(Q,X,G,K){let q=Q,U=!0;while(U){U=!1;let _=new RegExp(`@${X}\\(['"]([^'"]+)['"]\\)`),W=q.match(_);if(!W||W.index===void 0)break;let z=W.index,j=W[1],B=z+W[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 N=q.slice(H),A=N.match(O),w=N.match(F),M=A?H+A.index:1/0,E=w?H+w.index:1/0;if(M<E)L++,H=M+(A[0].length||1);else if(E<1/0){if(L--,L===0){V=E;break}H=E+G.length+1}else break}if(V===-1)break;let R=q.slice(B,V);if(!Z[j])Z[j]=[];if(K)Z[j].unshift(R);else Z[j].push(R);q=q.substring(0,z)+q.substring(V+`@${G}`.length),U=!0}return q}return J=Y(J,"push","endpush",!1),J=Y(J,"prepend","endprepend",!0),J}function J7($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,Y)=>{if(!Z[Y]||Z[Y].length===0)return"";return Z[Y].join(`
2499
+ `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",RG=0,vB,AG;var A9=P(()=>{J$();o0();T1();R0();V0();vB=new c1(500),AG=new Set});import*as X7 from"path";async function w9($,Z,J=""){if(X7.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 M9($,Z,J,"@js","@endjs")}async function T9($,Z,J=""){if(X7.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 M9($,Z,J,"@ts","@endts")}async function M9($,Z,J,Y,Q){let X=$,G=w1(`${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:U,content:_,index:W}of K)try{let z=Object.keys(Z),j=Object.values(Z),B=_.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((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",H=`
2500
2500
  ${B}
2501
2501
  ${L}
2502
- `,A=Function(...z,O)(...j);if(A&&typeof A==="object")Object.assign($,A);X=X.replace(U,"")}catch(z){console.error(`Error executing ${Y} code block in ${J}:`,z);let j=z instanceof Error?z.message:String(z),B=Q4(`${Y} Directive`,`Error executing code: ${j}`,J,Z,W,U);console.error(B),X=X.replace(U,"")}return X}var A1=P(()=>{T5();V4()});function OG(Z,$="_method"){let J=Z.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${$}" value="${J}">`}function R1(Z){return Z.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,J,Y,Q,X)=>{return OG(Y,X||"_method")})}async function w1(Z,$,J,Y,Q){if(!Y.middleware||Y.middleware.length===0)return Z;let X=Z,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,$,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 U=Q4("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,J,Z);X=X.replace(/<body[^>]*>/,`$&
2503
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${G5(U)}</div>
2504
- `)}}}return X}async function T1(Z,$,J,Y){return w1(Z,$,J,Y,"before")}async function M1(Z,$,J,Y){return w1(Z,$,J,Y,"after")}var I1=P(()=>{n4();V4()});import{defineRoute as hB,defineRoutes as dB,resetRoutes as mB,route as uB,setAppUrl as pB}from"stx-router";import{route as LG}from"stx-router";function E1(Z){return Z.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,J,Y,Q,X)=>{try{let G=Q?H4(Q,{}):{};return LG(Y,G,X==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var D1=P(()=>{A4()});async function k1(Z,$){let J=Z.split("/").pop()?.split(".")[0]||"";if(G7.exact[Z])for(let Y of G7.exact[Z])await Promise.resolve(Y($,Z));if(G7.exact[J])for(let Y of G7.exact[J])await Promise.resolve(Y($,Z));for(let{pattern:Y,callback:Q}of G7.patterns)if(Y.test(Z)||Y.test(J))await Promise.resolve(Q($,Z))}var G7;var S1=P(()=>{G7={patterns:[],exact:{}}});function b1(Z){if(typeof Z==="string")return Z;if(Array.isArray(Z))return Z.filter(Boolean).map(($)=>b1($)).join(" ");if(Z&&typeof Z==="object")return Object.entries(Z).filter(([,$])=>$).map(([$])=>$).join(" ");return Z?String(Z):""}function y1(Z,$){if(!/:[\w-]+=/.test(Z))return Z;let J=Z,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],X;while((X=Y.exec(Z))!==null)Q.push([X.index,X.index+X[0].length]);function G(U){return Q.some(([_,W])=>U>=_&&U<W)}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 U=X[0],_=X[2];if(!_||!_.includes(":"))continue;let W=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,j=_,B=!1;while((z=W.exec(_))!==null){let H=z[1],F=z[2];if(F.includes("()")&&!F.includes(".get(")||F.includes("$store")||F.includes("$ref"))continue;try{let L=Object.keys($),O=Object.values($),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 N=Function(...L,`return (${F})`)(...O);if(H==="class"){let R=b1(N);if(R){let w=j.match(/\sclass="([^"]*)"/);if(w)j=j.replace(w[0],` class="${w[1]} ${R}"`);else j=j.replace(z[0],` class="${R}"`)}else j=j.replace(z[0],"");B=!0;continue}if(FG.has(H)){if(N)j=j.replace(z[0],` ${H}`);else j=j.replace(z[0],"");B=!0;continue}if(N===null||N===void 0||N===!1)j=j.replace(z[0],"");else{let R=String(N).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(z[0],` ${H}="${R}"`)}B=!0}catch{continue}}if(B){let H=U.endsWith("/>")?" /":"",L=`<${X[1]}${j}${H}>`;q.push({start:X.index,end:X.index+U.length,replacement:L})}}for(let U=q.length-1;U>=0;U--){let{start:_,end:W,replacement:z}=q[U];J=J.slice(0,_)+z+J.slice(W)}return J}var FG;var C1=P(()=>{FG=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function L5(Z,$){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=$;let Y=J.exec(Z);if(!Y)return null;return{full:Y[0],tag:Y[1],attrs:Y[2],selfClosing:Y[3].includes("/")||VG.has(Y[1].toLowerCase()),start:Y.index,end:Y.index+Y[0].length}}function AG(Z,$,J){let Y=1,Q=J,X=new RegExp(`<${$}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${$}\\s*>`,"gi");while(Y>0&&Q<Z.length){X.lastIndex=Q,G.lastIndex=Q;let K=X.exec(Z),q=G.exec(Z);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 h4(Z,$){if($.selfClosing)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};let J=AG(Z,$.tag,$.end);if(J===-1)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};return{outerStart:$.start,outerEnd:J,innerHTML:Z.slice($.end,J-`</${$.tag}>`.length)}}function P1(Z,$){return new RegExp(`(?:^|\\s)${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(Z)||Z.includes(` ${$}=`)||Z.includes(` ${$} `)||Z.trimEnd().endsWith(` ${$}`)}function y5(Z,$){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=Z.match(new RegExp(`${J}="([^"]*)"`,"s"))||Z.match(new RegExp(`${J}='([^']*)'`,"s"));return Y?Y[1]:null}function e4(Z,$){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return Z.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function Z5(Z,$,J){let Y=$.selfClosing?" /":"",Q=`<${$.tag}${J}${Y}>`;return Z.slice(0,$.start)+Q+Z.slice($.end)}function RG(Z){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(Z)}function wG(Z){let $=Z,J=0;while(J<$.length){let Y=L5($,J);if(!Y)break;let Q=y5(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],O=F[1];q=`${K} as ${O} => ${L}`}else q=`${K} as ${G}`;let U=e4(Y.attrs,"v-for"),_=e4(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),W=h4($,Y),z=$.slice(W.outerStart,W.outerEnd),j=Z5(z,{...Y,start:0,end:Y.end-Y.start},_),B=`@foreach(${q})
2505
- `,H=`${B}${j}
2506
- @endforeach`;$=$.slice(0,W.outerStart)+H+$.slice(W.outerEnd),J=W.outerStart+B.length}return $}function TG(Z){let $=Z,J=0;while(J<$.length){let Y=L5($,J);if(!Y)break;let Q=y5(Y.attrs,"v-if");if(Q===null){J=Y.end;continue}let X=[],G=h4($,Y),K=e4(Y.attrs,"v-if"),q=Z5($.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 U=G.outerEnd,_=!0;while(_){let H=$.slice(U).match(/^\s*/),F=H?H[0].length:0,L=L5($,U+F);if(!L){_=!1;break}let O=y5(L.attrs,"v-else-if"),V=P1(L.attrs,"v-else");if(O!==null){let A=h4($,L),N=e4(L.attrs,"v-else-if"),R=Z5($.slice(A.outerStart,A.outerEnd),{...L,start:0,end:L.end-L.start},N);X.push({type:"else-if",expr:O,outerStart:U,outerEnd:A.outerEnd,element:R,parsedTag:L}),U=A.outerEnd}else if(V){let A=h4($,L),N=e4(L.attrs,"v-else"),R=Z5($.slice(A.outerStart,A.outerEnd),{...L,start:0,end:L.end-L.start},N);X.push({type:"else",outerStart:U,outerEnd:A.outerEnd,element:R,parsedTag:L}),_=!1}else _=!1}let W=[];for(let H of X)if(H.type==="if")W.push(`@if(${H.expr})
2507
- ${H.element}`);else if(H.type==="else-if")W.push(`@elseif(${H.expr})
2508
- ${H.element}`);else W.push(`@else
2509
- ${H.element}`);W.push("@endif");let z=W.join(`
2510
- `),j=X[0].outerStart,B=X[X.length-1].outerEnd;$=$.slice(0,j)+z+$.slice(B),J=j+z.length}return $}function MG(Z){return Z.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function IG(Z){let $=Z,J=0;while(J<$.length){let Y=L5($,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 _=K[1],W=K[2],z=K[3];Q=Q.replace(K[0],""),Q+=` :${_}="${z}" @update:${_}="${z} = $event"`,K=Q.match(G)}if(X){let _=h4($,Y),W=$.slice(_.outerStart,_.outerEnd),z=Z5(W,{...Y,start:0,end:Y.end-Y.start},Q);$=$.slice(0,_.outerStart)+z+$.slice(_.outerEnd),J=_.outerStart+z.length;continue}let q=y5(Y.attrs,"v-model");if(q===null){J=Y.end;continue}if(NG.has(Y.tag.toLowerCase())){let _=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,W=h4($,Y),z=$.slice(W.outerStart,W.outerEnd),j=Z5(z,{...Y,start:0,end:Y.end-Y.start},_);$=$.slice(0,W.outerStart)+j+$.slice(W.outerEnd),J=W.outerStart+j.length}else{let _=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");_+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let W=h4($,Y),z=$.slice(W.outerStart,W.outerEnd),j=Z5(z,{...Y,start:0,end:Y.end-Y.start},_);$=$.slice(0,W.outerStart)+j+$.slice(W.outerEnd),J=W.outerStart+j.length}}return $}function EG(Z){return Z.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function DG(Z){return Z.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function kG(Z){let $=Z,J=0;while(J<$.length){let Y=L5($,J);if(!Y)break;let Q=y5(Y.attrs,"v-html");if(Q===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let X=h4($,Y),G=e4(Y.attrs,"v-html"),K=Y.selfClosing?" /":"",q=`<${Y.tag}${G}${K}>{!! ${Q} !!}</${Y.tag}>`;$=$.slice(0,X.outerStart)+q+$.slice(X.outerEnd),J=X.outerStart+q.length}return $}function SG(Z){let $=Z,J=0;while(J<$.length){let Y=L5($,J);if(!Y)break;let Q=y5(Y.attrs,"v-text");if(Q===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let X=h4($,Y),G=e4(Y.attrs,"v-text"),K=Y.selfClosing?" /":"",q=`<${Y.tag}${G}${K}>{{ ${Q} }}</${Y.tag}>`;$=$.slice(0,X.outerStart)+q+$.slice(X.outerEnd),J=X.outerStart+q.length}return $}function bG(Z){return Z.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 yG(Z){let $=Z,J=0;while(J<$.length){let Y=L5($,J);if(!Y)break;if(!P1(Y.attrs,"v-once")){J=Y.end;continue}let Q=e4(Y.attrs,"v-once"),X=h4($,Y),G=$.slice(X.outerStart,X.outerEnd),q=`@once
2511
- ${Z5(G,{...Y,start:0,end:Y.end-Y.start},Q)}
2512
- @endonce`;$=$.slice(0,X.outerStart)+q+$.slice(X.outerEnd),J=X.outerStart+q.length}return $}function CG(Z){return Z.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function PG(Z){return Z.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 v1(Z){if(!RG(Z))return Z;let $=Z;return $=wG($),$=TG($),$=yG($),$=EG($),$=DG($),$=IG($),$=MG($),$=PG($),$=kG($),$=SG($),$=bG($),$=CG($),$}var VG,NG;var x1=P(()=>{VG=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 f1(Z,$,J,Y,Q){let X=Z,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 U=K.length-1;U>=0;U--){let _=K[U];try{let W=X4(_.expr,$);if(!W||typeof W!=="string"){let O=`<!-- dynamic component: could not resolve "${_.expr}" -->`;X=X.slice(0,_.index)+O+X.slice(_.index+_.full.length);continue}let z=_.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=B.exec(z))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{j[O]=X4(V,$)}catch{j[O]=V}else j[O]=V}let F=Y.componentsDir||"components",L=await U5(W,j,_.slotContent,F,$,J,Y,new Set,Q??new Set);X=X.slice(0,_.index)+L+X.slice(_.index+_.full.length)}catch(W){let j=`<!-- dynamic component error: ${W instanceof Error?W.message:String(W)} -->`;X=X.slice(0,_.index)+j+X.slice(_.index+_.full.length)}}return X=await vG(X,$,J,Y,Q),X}async function vG(Z,$,J,Y,Q){let X=Z,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 U=K.length-1;U>=0;U--){let _=K[U];try{let W=X4(_.expr,$);if(!W||typeof W!=="string"){let B=`<!-- dynamic component: could not resolve "${_.expr}" -->`;X=X.slice(0,_.index)+B+X.slice(_.index+_.full.length);continue}let z=Y.componentsDir||"components",j=await U5(W,{},"",z,$,J,Y,new Set,Q??new Set);X=X.slice(0,_.index)+j+X.slice(_.index+_.full.length)}catch(W){let j=`<!-- dynamic component error: ${W instanceof Error?W.message:String(W)} -->`;X=X.slice(0,_.index)+j+X.slice(_.index+_.full.length)}}return X}var g1=P(()=>{V4();A4()});function xG(Z,$={},J={}){let{title:Y="stx App",lang:Q="en",meta:X=[],link:G=[],script:K=[],headRaw:q="",bodyClass:U="",bodyAttrs:_={}}=$,W=J.title||Y,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...X].map((N)=>{return` <meta ${Object.entries(N).map(([w,M])=>`${w}="${M}"`).join(" ")}>`}).join(`
2513
- `),H=G.map((N)=>{return` <link ${Object.entries(N).map(([w,M])=>`${w}="${M}"`).join(" ")}>`}).join(`
2502
+ `,R=Function(...z,H)(...j);if(R&&typeof R==="object")Object.assign(Z,R);X=X.replace(U,"")}catch(z){console.error(`Error executing ${Y} code block in ${J}:`,z);let j=z instanceof Error?z.message:String(z),B=Q0(`${Y} Directive`,`Error executing code: ${j}`,J,$,W,U);console.error(B),X=X.replace(U,"")}return X}var I9=P(()=>{T1();V0()});function TG($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function E9($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,Y,Q,X)=>{return TG(Y,X||"_method")})}async function D9($,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 U=Q0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,J,$);X=X.replace(/<body[^>]*>/,`$&
2503
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${K1(U)}</div>
2504
+ `)}}}return X}async function k9($,Z,J,Y){return D9($,Z,J,Y,"before")}async function S9($,Z,J,Y){return D9($,Z,J,Y,"after")}var b9=P(()=>{o0();V0()});import{defineRoute as oB,defineRoutes as sB,resetRoutes as rB,route as aB,setAppUrl as tB}from"stx-router";import{route as MG}from"stx-router";function y9($){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 MG(Y,G,X==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var C9=P(()=>{R0()});async function P9($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(G5.exact[$])for(let Y of G5.exact[$])await Promise.resolve(Y(Z,$));if(G5.exact[J])for(let Y of G5.exact[J])await Promise.resolve(Y(Z,$));for(let{pattern:Y,callback:Q}of G5.patterns)if(Y.test($)||Y.test(J))await Promise.resolve(Q(Z,$))}var G5;var v9=P(()=>{G5={patterns:[],exact:{}}});function x9($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>x9(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function f9($,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(U){return Q.some(([_,W])=>U>=_&&U<W)}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 U=X[0],_=X[2];if(!_||!_.includes(":"))continue;let W=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,j=_,B=!1;while((z=W.exec(_))!==null){let O=z[1],F=z[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 N=Function(...L,`return (${F})`)(...H);if(O==="class"){let A=x9(N);if(A){let w=j.match(/\sclass="([^"]*)"/);if(w)j=j.replace(w[0],` class="${w[1]} ${A}"`);else j=j.replace(z[0],` class="${A}"`)}else j=j.replace(z[0],"");B=!0;continue}if(IG.has(O)){if(N)j=j.replace(z[0],` ${O}`);else j=j.replace(z[0],"");B=!0;continue}if(N===null||N===void 0||N===!1)j=j.replace(z[0],"");else{let A=String(N).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(z[0],` ${O}="${A}"`)}B=!0}catch{continue}}if(B){let O=U.endsWith("/>")?" /":"",L=`<${X[1]}${j}${O}>`;q.push({start:X.index,end:X.index+U.length,replacement:L})}}for(let U=q.length-1;U>=0;U--){let{start:_,end:W,replacement:z}=q[U];J=J.slice(0,_)+z+J.slice(W)}return J}var IG;var g9=P(()=>{IG=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("/")||EG.has(Y[1].toLowerCase()),start:Y.index,end:Y.index+Y[0].length}}function kG($,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=kG($,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 h9($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function y1($,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 SG($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function bG($){let Z=$,J=0;while(J<Z.length){let Y=F1(Z,J);if(!Y)break;let Q=y1(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 U=$1(Y.attrs,"v-for"),_=$1(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),W=h0(Z,Y),z=Z.slice(W.outerStart,W.outerEnd),j=Z1(z,{...Y,start:0,end:Y.end-Y.start},_),B=`@foreach(${q})
2505
+ `,O=`${B}${j}
2506
+ @endforeach`;Z=Z.slice(0,W.outerStart)+O+Z.slice(W.outerEnd),J=W.outerStart+B.length}return Z}function yG($){let Z=$,J=0;while(J<Z.length){let Y=F1(Z,J);if(!Y)break;let Q=y1(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 U=G.outerEnd,_=!0;while(_){let O=Z.slice(U).match(/^\s*/),F=O?O[0].length:0,L=F1(Z,U+F);if(!L){_=!1;break}let H=y1(L.attrs,"v-else-if"),V=h9(L.attrs,"v-else");if(H!==null){let R=h0(Z,L),N=$1(L.attrs,"v-else-if"),A=Z1(Z.slice(R.outerStart,R.outerEnd),{...L,start:0,end:L.end-L.start},N);X.push({type:"else-if",expr:H,outerStart:U,outerEnd:R.outerEnd,element:A,parsedTag:L}),U=R.outerEnd}else if(V){let R=h0(Z,L),N=$1(L.attrs,"v-else"),A=Z1(Z.slice(R.outerStart,R.outerEnd),{...L,start:0,end:L.end-L.start},N);X.push({type:"else",outerStart:U,outerEnd:R.outerEnd,element:A,parsedTag:L}),_=!1}else _=!1}let W=[];for(let O of X)if(O.type==="if")W.push(`@if(${O.expr})
2507
+ ${O.element}`);else if(O.type==="else-if")W.push(`@elseif(${O.expr})
2508
+ ${O.element}`);else W.push(`@else
2509
+ ${O.element}`);W.push("@endif");let z=W.join(`
2510
+ `),j=X[0].outerStart,B=X[X.length-1].outerEnd;Z=Z.slice(0,j)+z+Z.slice(B),J=j+z.length}return Z}function CG($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function PG($){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 _=K[1],W=K[2],z=K[3];Q=Q.replace(K[0],""),Q+=` :${_}="${z}" @update:${_}="${z} = $event"`,K=Q.match(G)}if(X){let _=h0(Z,Y),W=Z.slice(_.outerStart,_.outerEnd),z=Z1(W,{...Y,start:0,end:Y.end-Y.start},Q);Z=Z.slice(0,_.outerStart)+z+Z.slice(_.outerEnd),J=_.outerStart+z.length;continue}let q=y1(Y.attrs,"v-model");if(q===null){J=Y.end;continue}if(DG.has(Y.tag.toLowerCase())){let _=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,W=h0(Z,Y),z=Z.slice(W.outerStart,W.outerEnd),j=Z1(z,{...Y,start:0,end:Y.end-Y.start},_);Z=Z.slice(0,W.outerStart)+j+Z.slice(W.outerEnd),J=W.outerStart+j.length}else{let _=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");_+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let W=h0(Z,Y),z=Z.slice(W.outerStart,W.outerEnd),j=Z1(z,{...Y,start:0,end:Y.end-Y.start},_);Z=Z.slice(0,W.outerStart)+j+Z.slice(W.outerEnd),J=W.outerStart+j.length}}return Z}function vG($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function xG($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function fG($){let Z=$,J=0;while(J<Z.length){let Y=F1(Z,J);if(!Y)break;let Q=y1(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 gG($){let Z=$,J=0;while(J<Z.length){let Y=F1(Z,J);if(!Y)break;let Q=y1(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 hG($){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 dG($){let Z=$,J=0;while(J<Z.length){let Y=F1(Z,J);if(!Y)break;if(!h9(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
2511
+ ${Z1(G,{...Y,start:0,end:Y.end-Y.start},Q)}
2512
+ @endonce`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function mG($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function uG($){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 d9($){if(!SG($))return $;let Z=$;return Z=bG(Z),Z=yG(Z),Z=dG(Z),Z=vG(Z),Z=xG(Z),Z=PG(Z),Z=CG(Z),Z=uG(Z),Z=fG(Z),Z=gG(Z),Z=hG(Z),Z=mG(Z),Z}var EG,DG;var m9=P(()=>{EG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),DG=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 u9($,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 U=K.length-1;U>=0;U--){let _=K[U];try{let W=X0(_.expr,Z);if(!W||typeof W!=="string"){let H=`<!-- dynamic component: could not resolve "${_.expr}" -->`;X=X.slice(0,_.index)+H+X.slice(_.index+_.full.length);continue}let z=_.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(z))!==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 W1(W,j,_.slotContent,F,Z,J,Y,new Set,Q??new Set);X=X.slice(0,_.index)+L+X.slice(_.index+_.full.length)}catch(W){let j=`<!-- dynamic component error: ${W instanceof Error?W.message:String(W)} -->`;X=X.slice(0,_.index)+j+X.slice(_.index+_.full.length)}}return X=await pG(X,Z,J,Y,Q),X}async function pG($,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 U=K.length-1;U>=0;U--){let _=K[U];try{let W=X0(_.expr,Z);if(!W||typeof W!=="string"){let B=`<!-- dynamic component: could not resolve "${_.expr}" -->`;X=X.slice(0,_.index)+B+X.slice(_.index+_.full.length);continue}let z=Y.componentsDir||"components",j=await W1(W,{},"",z,Z,J,Y,new Set,Q??new Set);X=X.slice(0,_.index)+j+X.slice(_.index+_.full.length)}catch(W){let j=`<!-- dynamic component error: ${W instanceof Error?W.message:String(W)} -->`;X=X.slice(0,_.index)+j+X.slice(_.index+_.full.length)}}return X}var p9=P(()=>{V0();R0()});function lG($,Z={},J={}){let{title:Y="stx App",lang:Q="en",meta:X=[],link:G=[],script:K=[],headRaw:q="",bodyClass:U="",bodyAttrs:_={}}=Z,W=J.title||Y,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...X].map((N)=>{return` <meta ${Object.entries(N).map(([w,M])=>`${w}="${M}"`).join(" ")}>`}).join(`
2513
+ `),O=G.map((N)=>{return` <link ${Object.entries(N).map(([w,M])=>`${w}="${M}"`).join(" ")}>`}).join(`
2514
2514
  `),F=K.map((N)=>{if(N.src)return` <script ${Object.entries(N).filter(([w])=>w!=="content").map(([w,M])=>`${w}="${M}"`).join(" ")}></script>`;if(N.content)return` <script>${N.content}</script>`;return""}).filter(Boolean).join(`
2515
- `),L=Object.entries(_).map(([N,R])=>` ${N}="${R}"`).join(""),O=U?` class="${U}"`:"",V=[B,` <title>${W}</title>`,H,F,q?` ${q}`:"",...(J.styles||[]).map((N)=>` ${N}`),...(J.headScripts||[]).map((N)=>` ${N}`),J.headStack||""].filter(Boolean),A=[Z,...(J.bodyScripts||[]).map((N)=>N),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
2515
+ `),L=Object.entries(_).map(([N,A])=>` ${N}="${A}"`).join(""),H=U?` class="${U}"`:"",V=[B,` <title>${W}</title>`,O,F,q?` ${q}`:"",...(J.styles||[]).map((N)=>` ${N}`),...(J.headScripts||[]).map((N)=>` ${N}`),J.headStack||""].filter(Boolean),R=[$,...(J.bodyScripts||[]).map((N)=>N),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
2516
2516
  <html lang="${Q}">
2517
2517
  <head>
2518
2518
  ${V.join(`
2519
2519
  `)}
2520
2520
  </head>
2521
- <body${O}${L}>
2522
- ${A.join(`
2521
+ <body${H}${L}>
2522
+ ${R.join(`
2523
2523
  `)}
2524
2524
  </body>
2525
- </html>`}function fG(Z){let $=Z.trim();while($.startsWith("<!--")){let J=$.indexOf("-->");if(J===-1)break;$=$.slice(J+3).trim()}return/^<!DOCTYPE\b/i.test($)||/^<html[\s>]/i.test($)}function h1(Z,$={},J={}){if(fG(Z))return Z;return xG(Z,$,J)}function X0(Z){let $=Z,J=new Set,Y=new Set,Q=()=>{if(k4)Y.add(k4);return $};return Q.set=(X)=>{if(!Object.is(X,$)){let G=$;if($=X,J.forEach((K)=>K($,G)),K7)Y.forEach((K)=>WZ.add(K));else Y.forEach((K)=>K())}},Q.update=(X)=>{Q.set(X($))},Q.subscribe=(X)=>{return J.add(X),()=>J.delete(X)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function Q0(Z){let $,J=!0,Y=new Set,Q=()=>{if(!J)if(J=!0,K7)Y.forEach((G)=>WZ.add(G));else Y.forEach((G)=>G())},X=()=>{if(k4)Y.add(k4);if(J){let G=k4;k4=Q,UZ.push(Q);try{$=Z()}finally{UZ.pop(),k4=G}J=!1}return $};return Object.defineProperty(X,"_isDerived",{value:!0,writable:!1}),X}function G0(Z,$={}){let J,Y=!1,Q=()=>{if(Y)return;if(J)J(),J=void 0;let X=k4;k4=Q,UZ.push(Q);try{J=Z()}finally{UZ.pop(),k4=X}};if($.immediate!==!1)Q();return()=>{if(Y=!0,J)J()}}function K0(Z){if(K7){Z();return}K7=!0;try{Z()}finally{K7=!1,WZ.forEach(($)=>$()),WZ.clear()}}function q0(Z){gG.push(Z)}function _0(Z){hG.push(Z)}function zZ(Z){return typeof Z==="function"&&Z._isSignal===!0}function BZ(Z){return typeof Z==="function"&&Z._isDerived===!0}function U0(Z){if(zZ(Z)||BZ(Z))return Z();return Z}function W0(Z){let $=k4;k4=null;try{return Z()}finally{k4=$}}var k4=null,UZ,K7=!1,WZ,gG,hG;var z0=P(()=>{UZ=[],WZ=new Set,gG=[],hG=[]});var B0={};r(B0,{untrack:()=>U0,state:()=>X0,peek:()=>W0,onMount:()=>q0,onDestroy:()=>_0,isSignal:()=>zZ,isDerived:()=>BZ,generateSignalsRuntimeDev:()=>jZ,generateSignalsRuntime:()=>d1,effect:()=>G0,derived:()=>Q0,default:()=>dG,batch:()=>K0});function d1(){try{let $=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(jZ());return $=$.replace(/\}(var |let |const |function )/g,"};$1"),$}catch{return jZ()}}function jZ(){return`
2525
+ </html>`}function cG($){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 l9($,Z={},J={}){if(cG($))return $;return lG($,Z,J)}function Q7($){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)),K5)Y.forEach((K)=>W$.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 G7($){let Z,J=!0,Y=new Set,Q=()=>{if(!J)if(J=!0,K5)Y.forEach((G)=>W$.add(G));else Y.forEach((G)=>G())},X=()=>{if(k0)Y.add(k0);if(J){let G=k0;k0=Q,U$.push(Q);try{Z=$()}finally{U$.pop(),k0=G}J=!1}return Z};return Object.defineProperty(X,"_isDerived",{value:!0,writable:!1}),X}function K7($,Z={}){let J,Y=!1,Q=()=>{if(Y)return;if(J)J(),J=void 0;let X=k0;k0=Q,U$.push(Q);try{J=$()}finally{U$.pop(),k0=X}};if(Z.immediate!==!1)Q();return()=>{if(Y=!0,J)J()}}function q7($){if(K5){$();return}K5=!0;try{$()}finally{K5=!1,W$.forEach((Z)=>Z()),W$.clear()}}function _7($){iG.push($)}function U7($){nG.push($)}function z$($){return typeof $==="function"&&$._isSignal===!0}function B$($){return typeof $==="function"&&$._isDerived===!0}function W7($){if(z$($)||B$($))return $();return $}function z7($){let Z=k0;k0=null;try{return $()}finally{k0=Z}}var k0=null,U$,K5=!1,W$,iG,nG;var B7=P(()=>{U$=[],W$=new Set,iG=[],nG=[]});var j7={};r(j7,{untrack:()=>W7,state:()=>Q7,peek:()=>z7,onMount:()=>_7,onDestroy:()=>U7,isSignal:()=>z$,isDerived:()=>B$,generateSignalsRuntimeDev:()=>j$,generateSignalsRuntime:()=>c9,effect:()=>K7,derived:()=>G7,default:()=>oG,batch:()=>q7});function c9(){try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(j$());return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return j$()}}function j$(){return`
2526
2526
  // STX Signals Runtime (Development Build)
2527
2527
  console.log('[stx] signals runtime loading');
2528
2528
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -5359,6 +5359,277 @@ catch (e) {}
5359
5359
  useHead({ title: config.title || config.ogTitle, meta: meta });
5360
5360
  }
5361
5361
 
5362
+ // ==========================================================================
5363
+ // Toast notification system
5364
+ // ==========================================================================
5365
+
5366
+ var _toastId = 0;
5367
+ var _toastIcons = {
5368
+ success: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#16a34a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>',
5369
+ error: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',
5370
+ info: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',
5371
+ warning: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'
5372
+ };
5373
+ var _toastColors = {
5374
+ success: '#16a34a',
5375
+ error: '#dc2626',
5376
+ info: '#2563eb',
5377
+ warning: '#d97706'
5378
+ };
5379
+
5380
+ function _getToastContainer() {
5381
+ return document.getElementById('stx-toast-container');
5382
+ }
5383
+
5384
+ function _getToastAnimClass(container) {
5385
+ if (!container) return { inAnim: 'stx-toast-in', outAnim: 'stx-toast-out' };
5386
+ var pos = container.getAttribute('data-stx-toast-position') || 'top-right';
5387
+ if (pos.indexOf('left') !== -1) return { inAnim: 'stx-toast-in-left', outAnim: 'stx-toast-out-left' };
5388
+ if (pos.indexOf('center') !== -1) return { inAnim: 'stx-toast-in-center', outAnim: 'stx-toast-out-center' };
5389
+ return { inAnim: 'stx-toast-in', outAnim: 'stx-toast-out' };
5390
+ }
5391
+
5392
+ function removeToast(id) {
5393
+ var el = document.getElementById('stx-toast-' + id);
5394
+ if (!el) return;
5395
+ var container = _getToastContainer();
5396
+ var anims = _getToastAnimClass(container);
5397
+ el.style.animation = anims.outAnim + ' 0.3s ease forwards';
5398
+ setTimeout(function() {
5399
+ if (el.parentNode) el.parentNode.removeChild(el);
5400
+ }, 300);
5401
+ }
5402
+
5403
+ function addToast(type, message, options) {
5404
+ var container = _getToastContainer();
5405
+ if (!container) {
5406
+ console.warn('[stx:toast] No <StxToast /> container found. Add <StxToast /> to your layout.');
5407
+ return -1;
5408
+ }
5409
+ var opts = options || {};
5410
+ var duration = opts.duration !== undefined ? opts.duration : 3000;
5411
+ var id = ++_toastId;
5412
+ var maxToasts = parseInt(container.getAttribute('data-stx-toast-max') || '5', 10);
5413
+
5414
+ // Enforce max toasts \u2014 remove oldest
5415
+ var existing = container.querySelectorAll('[data-stx-toast]');
5416
+ while (existing.length >= maxToasts && existing.length > 0) {
5417
+ var oldId = existing[0].getAttribute('data-stx-toast');
5418
+ removeToast(oldId);
5419
+ existing = container.querySelectorAll('[data-stx-toast]');
5420
+ }
5421
+
5422
+ var anims = _getToastAnimClass(container);
5423
+ var borderColor = _toastColors[type] || _toastColors.info;
5424
+ var icon = _toastIcons[type] || _toastIcons.info;
5425
+ var isDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
5426
+ var bg = isDark ? '#1f2937' : '#ffffff';
5427
+ var textColor = isDark ? '#f3f4f6' : '#1f2937';
5428
+ var shadow = isDark ? '0 4px 12px rgba(0,0,0,0.4)' : '0 4px 12px rgba(0,0,0,0.15)';
5429
+
5430
+ var el = document.createElement('div');
5431
+ el.id = 'stx-toast-' + id;
5432
+ el.setAttribute('data-stx-toast', String(id));
5433
+ el.setAttribute('role', 'alert');
5434
+ el.setAttribute('aria-live', 'assertive');
5435
+ el.style.cssText = 'pointer-events:auto;display:flex;align-items:flex-start;gap:0.75rem;padding:0.875rem 1rem;border-radius:0.5rem;border-left:4px solid ' + borderColor + ';background:' + bg + ';color:' + textColor + ';box-shadow:' + shadow + ';animation:' + anims.inAnim + ' 0.3s ease;font-family:system-ui,-apple-system,sans-serif;font-size:0.875rem;line-height:1.4;max-width:100%';
5436
+
5437
+ var iconSpan = document.createElement('span');
5438
+ iconSpan.style.cssText = 'flex-shrink:0;display:flex;align-items:center;margin-top:1px';
5439
+ iconSpan.innerHTML = icon;
5440
+
5441
+ var msgSpan = document.createElement('span');
5442
+ msgSpan.style.cssText = 'flex:1;word-wrap:break-word';
5443
+ msgSpan.textContent = message;
5444
+
5445
+ var closeBtn = document.createElement('button');
5446
+ closeBtn.type = 'button';
5447
+ closeBtn.setAttribute('aria-label', 'Dismiss notification');
5448
+ closeBtn.style.cssText = 'flex-shrink:0;background:none;border:none;cursor:pointer;padding:0;color:' + (isDark ? '#9ca3af' : '#6b7280') + ';font-size:1.125rem;line-height:1;display:flex;align-items:center';
5449
+ closeBtn.innerHTML = '<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"/></svg>';
5450
+ closeBtn.onclick = function() { removeToast(id); };
5451
+
5452
+ el.appendChild(iconSpan);
5453
+ el.appendChild(msgSpan);
5454
+ el.appendChild(closeBtn);
5455
+ container.appendChild(el);
5456
+
5457
+ if (duration > 0) {
5458
+ setTimeout(function() { removeToast(id); }, duration);
5459
+ }
5460
+
5461
+ return id;
5462
+ }
5463
+
5464
+ var toast = {
5465
+ success: function(message, options) { return addToast('success', message, options); },
5466
+ error: function(message, options) { return addToast('error', message, options); },
5467
+ info: function(message, options) { return addToast('info', message, options); },
5468
+ warning: function(message, options) { return addToast('warning', message, options); },
5469
+ dismiss: function(id) {
5470
+ if (id !== undefined) { removeToast(id); return; }
5471
+ var container = _getToastContainer();
5472
+ if (!container) return;
5473
+ var all = container.querySelectorAll('[data-stx-toast]');
5474
+ for (var i = 0; i < all.length; i++) {
5475
+ var tid = all[i].getAttribute('data-stx-toast');
5476
+ removeToast(tid);
5477
+ }
5478
+ }
5479
+ };
5480
+
5481
+ // \u2500\u2500 Modal system \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
5482
+ var modal = {
5483
+ open: function(id) {
5484
+ var el = document.querySelector('[data-stx-modal="' + id + '"]');
5485
+ if (!el) { console.warn('[stx:modal] Modal "' + id + '" not found'); return; }
5486
+ el.style.display = 'flex';
5487
+ // Force reflow then animate
5488
+ void el.offsetHeight;
5489
+ el.setAttribute('data-stx-modal-open', '');
5490
+ document.body.style.overflow = 'hidden';
5491
+ // Escape key handler
5492
+ if (el.getAttribute('data-close-escape') !== 'false') {
5493
+ var escHandler = function(e) {
5494
+ if (e.key === 'Escape') { modal.close(id); document.removeEventListener('keydown', escHandler); }
5495
+ };
5496
+ document.addEventListener('keydown', escHandler);
5497
+ el._stxEscHandler = escHandler;
5498
+ }
5499
+ // Backdrop click
5500
+ if (el.getAttribute('data-close-backdrop') !== 'false') {
5501
+ el.onclick = function(e) { if (e.target === el) modal.close(id); };
5502
+ }
5503
+ },
5504
+ close: function(id) {
5505
+ var el = document.querySelector('[data-stx-modal="' + id + '"]');
5506
+ if (!el) return;
5507
+ el.removeAttribute('data-stx-modal-open');
5508
+ if (el._stxEscHandler) { document.removeEventListener('keydown', el._stxEscHandler); el._stxEscHandler = null; }
5509
+ el.onclick = null;
5510
+ setTimeout(function() {
5511
+ el.style.display = 'none';
5512
+ // Restore scroll if no other modals are open
5513
+ if (!document.querySelector('[data-stx-modal-open]')) document.body.style.overflow = '';
5514
+ }, 200);
5515
+ },
5516
+ toggle: function(id) {
5517
+ var el = document.querySelector('[data-stx-modal="' + id + '"]');
5518
+ if (el && el.hasAttribute('data-stx-modal-open')) modal.close(id);
5519
+ else modal.open(id);
5520
+ }
5521
+ };
5522
+
5523
+ // \u2500\u2500 Alert & Confirm dialogs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
5524
+ // Styled replacements for window.alert() and window.confirm().
5525
+ // Both return Promises and render into a temporary modal overlay.
5526
+
5527
+ var _dialogId = 0;
5528
+ var _dialogIcons = {
5529
+ info: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#2563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',
5530
+ warning: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>',
5531
+ error: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#dc2626" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',
5532
+ success: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#16a34a" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>',
5533
+ question: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#6366f1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'
5534
+ };
5535
+
5536
+ function _createDialog(message, options, isConfirm) {
5537
+ var opts = options || {};
5538
+ var type = opts.type || (isConfirm ? 'question' : 'info');
5539
+ var title = opts.title || '';
5540
+ var confirmText = opts.confirmText || 'OK';
5541
+ var cancelText = opts.cancelText || 'Cancel';
5542
+ var id = 'stx-dialog-' + (++_dialogId);
5543
+ var isDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
5544
+ var bg = isDark ? '#1f2937' : '#ffffff';
5545
+ var textColor = isDark ? '#f3f4f6' : '#1f2937';
5546
+ var subColor = isDark ? '#9ca3af' : '#6b7280';
5547
+ var icon = _dialogIcons[type] || _dialogIcons.info;
5548
+
5549
+ return new Promise(function(resolve) {
5550
+ var backdrop = document.createElement('div');
5551
+ backdrop.id = id;
5552
+ backdrop.style.cssText = 'position:fixed;inset:0;z-index:999999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease;font-family:system-ui,-apple-system,sans-serif';
5553
+ backdrop.setAttribute('role', 'alertdialog');
5554
+ backdrop.setAttribute('aria-modal', 'true');
5555
+
5556
+ var panel = document.createElement('div');
5557
+ panel.style.cssText = 'max-width:24rem;width:calc(100% - 2rem);border-radius:0.75rem;padding:1.5rem;background:' + bg + ';color:' + textColor + ';box-shadow:0 20px 60px rgba(0,0,0,0.3);transform:scale(0.95);transition:transform 0.2s ease;text-align:center';
5558
+
5559
+ var iconDiv = document.createElement('div');
5560
+ iconDiv.style.cssText = 'display:flex;justify-content:center;margin-bottom:1rem';
5561
+ iconDiv.innerHTML = icon;
5562
+ panel.appendChild(iconDiv);
5563
+
5564
+ if (title) {
5565
+ var titleEl = document.createElement('h3');
5566
+ titleEl.style.cssText = 'margin:0 0 0.5rem;font-size:1.125rem;font-weight:600';
5567
+ titleEl.textContent = title;
5568
+ panel.appendChild(titleEl);
5569
+ }
5570
+
5571
+ var msgEl = document.createElement('p');
5572
+ msgEl.style.cssText = 'margin:0 0 1.25rem;font-size:0.875rem;line-height:1.5;color:' + subColor;
5573
+ msgEl.textContent = message;
5574
+ panel.appendChild(msgEl);
5575
+
5576
+ var btnRow = document.createElement('div');
5577
+ btnRow.style.cssText = 'display:flex;gap:0.75rem;justify-content:center';
5578
+
5579
+ function cleanup(result) {
5580
+ backdrop.style.opacity = '0';
5581
+ panel.style.transform = 'scale(0.95)';
5582
+ setTimeout(function() { backdrop.remove(); }, 200);
5583
+ resolve(result);
5584
+ }
5585
+
5586
+ if (isConfirm) {
5587
+ var cancelBtn = document.createElement('button');
5588
+ cancelBtn.textContent = cancelText;
5589
+ cancelBtn.style.cssText = 'padding:0.5rem 1.25rem;border-radius:0.5rem;font-size:0.875rem;font-weight:500;cursor:pointer;border:1px solid ' + (isDark ? '#374151' : '#d1d5db') + ';background:transparent;color:' + textColor + ';transition:background 0.15s';
5590
+ cancelBtn.onmouseover = function() { this.style.background = isDark ? '#374151' : '#f3f4f6'; };
5591
+ cancelBtn.onmouseout = function() { this.style.background = 'transparent'; };
5592
+ cancelBtn.onclick = function() { cleanup(false); };
5593
+ btnRow.appendChild(cancelBtn);
5594
+ }
5595
+
5596
+ var okBtn = document.createElement('button');
5597
+ okBtn.textContent = confirmText;
5598
+ var btnColor = type === 'error' ? '#dc2626' : type === 'warning' ? '#d97706' : '#5672cd';
5599
+ okBtn.style.cssText = 'padding:0.5rem 1.25rem;border-radius:0.5rem;font-size:0.875rem;font-weight:500;cursor:pointer;border:none;background:' + btnColor + ';color:#fff;transition:opacity 0.15s';
5600
+ okBtn.onmouseover = function() { this.style.opacity = '0.9'; };
5601
+ okBtn.onmouseout = function() { this.style.opacity = '1'; };
5602
+ okBtn.onclick = function() { cleanup(isConfirm ? true : undefined); };
5603
+ btnRow.appendChild(okBtn);
5604
+
5605
+ panel.appendChild(btnRow);
5606
+ backdrop.appendChild(panel);
5607
+ document.body.appendChild(backdrop);
5608
+
5609
+ // Animate in
5610
+ void backdrop.offsetHeight;
5611
+ backdrop.style.opacity = '1';
5612
+ panel.style.transform = 'scale(1)';
5613
+
5614
+ // Escape key
5615
+ var escHandler = function(e) {
5616
+ if (e.key === 'Escape') { cleanup(isConfirm ? false : undefined); document.removeEventListener('keydown', escHandler); }
5617
+ };
5618
+ document.addEventListener('keydown', escHandler);
5619
+
5620
+ // Focus the primary button
5621
+ okBtn.focus();
5622
+ });
5623
+ }
5624
+
5625
+ function stxAlert(message, options) {
5626
+ return _createDialog(message, options, false);
5627
+ }
5628
+
5629
+ function stxConfirm(message, options) {
5630
+ return _createDialog(message, options, true);
5631
+ }
5632
+
5362
5633
  // Component mount system
5363
5634
  var mountQueue = [];
5364
5635
 
@@ -5407,6 +5678,10 @@ catch (e) {}
5407
5678
  useDark,
5408
5679
  useHead,
5409
5680
  useSeoMeta,
5681
+ toast,
5682
+ modal,
5683
+ alert: stxAlert,
5684
+ confirm: stxConfirm,
5410
5685
  helpers: globalHelpers,
5411
5686
 
5412
5687
  // Component composition API (Phase 4)
@@ -5862,6 +6137,10 @@ else {
5862
6137
  window.useDark = useDark;
5863
6138
  window.useHead = useHead;
5864
6139
  window.useSeoMeta = useSeoMeta;
6140
+ window.toast = toast;
6141
+ window.modal = modal;
6142
+ window.stxAlert = stxAlert;
6143
+ window.stxConfirm = stxConfirm;
5865
6144
  window.defineStore = window.stx.defineStore;
5866
6145
  window.useStore = window.stx.useStore;
5867
6146
  window.ref = state;
@@ -6249,30 +6528,30 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
6249
6528
  }
6250
6529
  }
6251
6530
  })();
6252
- `}var dG;var j0=P(()=>{z0();z0();dG={state:X0,derived:Q0,effect:G0,batch:K0,onMount:q0,onDestroy:_0,isSignal:zZ,isDerived:BZ,untrack:U0,peek:W0,generateSignalsRuntime:d1,generateSignalsRuntimeDev:jZ}});var H0={};r(H0,{templateCache:()=>m1,readFileCached:()=>mG,invalidateFileCacheByDir:()=>pG,invalidateFileCache:()=>uG,hashFilePath:()=>q7,getCachedSignalsRuntime:()=>cG,getCachedRouterScript:()=>iG,clearDevCaches:()=>nG,checkCache:()=>sG,cacheTemplate:()=>oG});import F5 from"fs";import C5 from"path";async function mG(Z){try{let J=(await F5.promises.stat(Z)).mtime.getTime(),Y=V5.get(Z);if(Y&&Y.mtime===J)return Y.content;let Q=await Bun.file(Z).text();return V5.set(Z,{content:Q,mtime:J}),Q}catch{throw V5.delete(Z),Error(`File not found: ${Z}`)}}function uG(Z){V5.delete(Z)}function pG(Z){for(let $ of V5.keys())if($.startsWith(Z))V5.delete($)}async function cG(Z=!1){if(Z){let{generateSignalsRuntimeDev:$}=await Promise.resolve().then(() => (j0(),B0));return $()}if(HZ===null){let{generateSignalsRuntime:$}=await Promise.resolve().then(() => (j0(),B0));HZ=$()}return HZ}async function iG(){if(OZ===null){let{getRouterScript:Z}=await import("stx-router");OZ=Z()}return OZ}function nG(){V5.clear(),HZ=null,lG=null,OZ=null}async function sG(Z,$){try{if(!$.cachePath)return null;let J=C5.resolve($.cachePath),Y=C5.join(J,`${q7(Z)}.html`),Q=C5.join(J,`${q7(Z)}.meta.json`);if(!await c(Y)||!await c(Q))return null;let X=await Bun.file(Q).text(),G=JSON.parse(X);if(G.cacheVersion!==$.cacheVersion)return null;if((await F5.promises.stat(Z)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await F5.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 ${Z}:`,J),null}}async function oG(Z,$,J,Y){try{if(!Y.cachePath)return;let Q=C5.resolve(Y.cachePath);await F5.promises.mkdir(Q,{recursive:!0});let X=C5.join(Q,`${q7(Z)}.html`),G=C5.join(Q,`${q7(Z)}.meta.json`),K=await F5.promises.stat(Z);await Bun.write(X,$);let q={sourcePath:Z,mtime:K.mtime.getTime(),dependencies:Array.from(J),cacheVersion:Y.cacheVersion,generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),m1.set(Z,{output:$,mtime:K.mtime.getTime(),dependencies:J})}catch(Q){console.warn(`Failed to cache template ${Z}:`,Q)}}function q7(Z){return new Bun.CryptoHasher("sha1").update(Z).digest("hex").substring(0,rG)}var m1,V5,HZ=null,lG=null,OZ=null,rG=16;var O0=P(()=>{V4();m1=new Map,V5=new Map});function u1(Z){if(Z.includes("window.StacksBrowser")||Z.includes("StacksBrowser ="))return Z;let $=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,J="",Y;while((Y=$.exec(Z))!==null)J+=Y[1]+`
6253
- `;let Q=/\{\{([\s\S]*?)\}\}/g;while((Y=Q.exec(Z))!==null)J+=Y[1]+`
6254
- `;if(!J.trim())return Z;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((z)=>{return new RegExp(`\\b${z}\\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,U,_=!1;while((U=q.exec(J))!==null)if(!K.has(U[1])){_=!0;break}if(!G&&!_)return Z;let W=`<script type="module">
6531
+ `}var oG;var O7=P(()=>{B7();B7();oG={state:Q7,derived:G7,effect:K7,batch:q7,onMount:_7,onDestroy:U7,isSignal:z$,isDerived:B$,untrack:W7,peek:z7,generateSignalsRuntime:c9,generateSignalsRuntimeDev:j$}});var H7={};r(H7,{templateCache:()=>i9,readFileCached:()=>sG,invalidateFileCacheByDir:()=>aG,invalidateFileCache:()=>rG,hashFilePath:()=>q5,getCachedSignalsRuntime:()=>eG,getCachedRouterScript:()=>$K,clearDevCaches:()=>ZK,checkCache:()=>YK,cacheTemplate:()=>JK});import V1 from"fs";import C1 from"path";async function sG($){try{let J=(await V1.promises.stat($)).mtime.getTime(),Y=N1.get($);if(Y&&Y.mtime===J)return Y.content;let Q=await Bun.file($).text();return N1.set($,{content:Q,mtime:J}),Q}catch{throw N1.delete($),Error(`File not found: ${$}`)}}function rG($){N1.delete($)}function aG($){for(let Z of N1.keys())if(Z.startsWith($))N1.delete(Z)}async function eG($=!1){if($){let{generateSignalsRuntimeDev:Z}=await Promise.resolve().then(() => (O7(),j7));return Z()}if(O$===null){let{generateSignalsRuntime:Z}=await Promise.resolve().then(() => (O7(),j7));O$=Z()}return O$}async function $K(){if(H$===null){let{getRouterScript:$}=await import("stx-router");H$=$()}return H$}function ZK(){N1.clear(),O$=null,tG=null,H$=null}async function YK($,Z){try{if(!Z.cachePath)return null;let J=C1.resolve(Z.cachePath),Y=C1.join(J,`${q5($)}.html`),Q=C1.join(J,`${q5($)}.meta.json`);if(!await c(Y)||!await c(Q))return null;let X=await Bun.file(Q).text(),G=JSON.parse(X);if(G.cacheVersion!==Z.cacheVersion)return null;if((await V1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await V1.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 JK($,Z,J,Y){try{if(!Y.cachePath)return;let Q=C1.resolve(Y.cachePath);await V1.promises.mkdir(Q,{recursive:!0});let X=C1.join(Q,`${q5($)}.html`),G=C1.join(Q,`${q5($)}.meta.json`),K=await V1.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)),i9.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:J})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function q5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,XK)}var i9,N1,O$=null,tG=null,H$=null,XK=16;var L7=P(()=>{V0();i9=new Map,N1=new Map});function n9($){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]+`
6532
+ `;let Q=/\{\{([\s\S]*?)\}\}/g;while((Y=Q.exec($))!==null)J+=Y[1]+`
6533
+ `;if(!J.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((z)=>{return new RegExp(`\\b${z}\\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,U,_=!1;while((U=q.exec(J))!==null)if(!K.has(U[1])){_=!0;break}if(!G&&!_)return $;let W=`<script type="module">
6255
6534
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
6256
6535
  import '@stacksjs/browser'
6257
- </script>`;if(Z.includes("</head>")){let z=Z.indexOf("</head>"),B=Z.slice(0,z).indexOf("<script");if(B!==-1)return Z.slice(0,B)+W+`
6258
- `+Z.slice(B);return Z.replace("</head>",`${W}
6259
- </head>`)}if(Z.includes("<body"))return Z.replace(/<body([^>]*)>/,`<body$1>
6536
+ </script>`;if($.includes("</head>")){let z=$.indexOf("</head>"),B=$.slice(0,z).indexOf("<script");if(B!==-1)return $.slice(0,B)+W+`
6537
+ `+$.slice(B);return $.replace("</head>",`${W}
6538
+ </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
6260
6539
  ${W}`);return W+`
6261
- `+Z}async function p1(Z,$){if(Z.includes("window.stx.state")||Z.includes("STX Signals Runtime"))return Z;if($.buildMode==="compile"){let K=Z.indexOf("<script");if(K!==-1)return Z.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
6262
- `+Z.slice(K);if(Z.includes("</head>")){let q=Z.indexOf("</head>");return Z.slice(0,q)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
6263
- `+Z.slice(q)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
6264
- `+Z}let{getCachedSignalsRuntime:J}=await Promise.resolve().then(() => (O0(),H0)),Q=`<script data-stx-scoped>${await J($.debug)}</script>`,X=Z.indexOf("<script");if(X!==-1)return Z.slice(0,X)+Q+`
6265
- `+Z.slice(X);if(Z.includes("</head>")){let G=Z.indexOf("</head>");return Z.slice(0,G)+Q+`
6266
- `+Z.slice(G)}if(Z.includes("<body")){let G=Z.indexOf("<body"),K=Z.indexOf(">",G);return Z.slice(0,K+1)+`
6267
- `+Q+Z.slice(K+1)}return Q+`
6268
- `+Z}async function L0(Z,$){if(!Z.includes("</body>"))return Z;if(Z.includes("__stxRouter)return")||Z.includes("__stxRouter=true"))return Z;let J=$?.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>
6269
- `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (O0(),H0)),X=$?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=Z.lastIndexOf("</body>");return Z.slice(0,G)+Y+X+`
6270
- </body>`+Z.slice(G+7)}var o1={};r(o1,{scanScriptTags:()=>c1,processSignals:()=>N0,processScriptSetup:()=>n1,parseLoopExpression:()=>i1,hasSignalsSyntax:()=>LZ,extractExports:()=>s1,convertSignalLoopsToAttributes:()=>V0,convertSignalDirectivesToAttributes:()=>F0});function c1(Z,$={}){let J=[],Y=/<script\b([^>]*)>/gi,Q;while((Q=Y.exec(Z))!==null){let X=Q[1],G=Q.index+Q[0].length,K=Z.toLowerCase().indexOf("</script>",G);if(K===-1)break;let q=K+9;if($.skipAttrs&&$.skipAttrs.test(X)){Y.lastIndex=q;continue}J.push({fullMatch:Z.slice(Q.index,q),attrs:X,body:Z.slice(G,K),start:Q.index,end:q}),Y.lastIndex=q}return J}function i1(Z){let $=Z.trim(),J=$.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Q=J[1].trim(),X=J[2].trim(),{itemVar:G,indexVar:K}=l1(X);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let Y=$.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}=l1(Q);if(G)return{style:"in",iterable:X,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function l1(Z){let $=Z.trim(),J=$.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let Y=$.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let Q=$.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let X=$.match(/^(\w+)$/);if(X)return{itemVar:X[1],indexVar:null};return{itemVar:null,indexVar:null}}function LZ(Z){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(Z))}function tG(Z){let $=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,Y;while((Y=$.exec(Z))!==null){let Q=Y[1];if(Q.startsWith("if"))J++;else if(Q==="endif")J--;else if(J===0)return!0}return!1}function F0(Z){let $=Z,J=/@if\s*\(/g,Y,Q=[];while((Y=J.exec($))!==null){let X=Y.index,G=X+Y[0].length,K=1,q=G;while(q<$.length&&K>0){if($[q]==="(")K++;else if($[q]===")")K--;q++}if(K!==0)continue;let U=$.substring(G,q-1).trim(),_=q,W=1,z=_,j=/@(if\s*\(|endif)/g;j.lastIndex=_;let B;while((B=j.exec($))!==null)if(B[1].startsWith("if"))W++;else if(B[1]==="endif"){if(W--,W===0){z=B.index+B[0].length;break}}if(W!==0)continue;let H=$.substring(_,z-6).trim();if(tG(H))continue;let F=H.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s),L;if(F){let[,O,V,A]=F,N=U.replace(/"/g,"&quot;");L=`<${O}${V} @if="${N}">${A}</${O}>`}else L=`<template @if="${U.replace(/"/g,"&quot;")}">${H}</template>`;Q.push({start:X,end:z,replacement:L})}for(let X=Q.length-1;X>=0;X--){let{start:G,end:K,replacement:q}=Q[X];$=$.substring(0,G)+q+$.substring(K)}return $}function V0(Z,$){let J=Z,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,U=1,_=q;while(_<J.length&&U>0){if(J[_]==="(")U++;else if(J[_]===")")U--;_++}if(U!==0)continue;let W=J.substring(q,_-1).trim(),z=_,j=i1(W);if(j.iterable){let R=j.iterable.trim();if(R.startsWith("[")||R.startsWith("{")||R.startsWith("'")||R.startsWith('"')||R.startsWith("`")||/^-?\d/.test(R))continue;if($){let w=R.split(/[.[(]/)[0].trim();if(w&&w in $)continue}}if(j.style==="as")W=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let B=G==="for"?"@endfor":"@endforeach",H=1,F=z,L=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");L.lastIndex=z;let O;while((O=L.exec(J))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){F=O.index+O[0].length;break}if(H!==0)continue;let V=J.substring(z,F-B.length).trim(),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s),N;if(A){let[,R,w,M]=A;N=`<${R}${w} @for="${W}">${M}</${R}>`}else N=`<template @for="${W}">${V}</template>`;X.push({start:K,end:F,replacement:N})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:U}=X[G];J=J.substring(0,K)+U+J.substring(q)}return J}function eG(Z){let $=new Set,J=[],Y=0,Q=0,X=Z.length,G=(_)=>{let W=Y+1;while(W<X){let z=Z[W];if(z==="\\"){W+=2;continue}if(z===_)return W+1;W++}return X},K=()=>{let _=Y+2;while(_<X&&Z[_]!==`
6271
- `)_++;return _},q=()=>{let _=Y+2;while(_<X-1){if(Z[_]==="*"&&Z[_+1]==="/")return _+2;_++}return X},U=(_)=>{let W=_,z=0;while(W<X){let j=Z[W];if(j==="/"&&Z[W+1]==="/"){let B=W+2;while(B<X&&Z[B]!==`
6272
- `)B++;W=B;continue}if(j==="/"&&Z[W+1]==="*"){let B=W+2;while(B<X-1&&!(Z[B]==="*"&&Z[B+1]==="/"))B++;W=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=W+1;while(B<X){if(Z[B]==="\\"){B+=2;continue}if(Z[B]===j){B++;break}B++}W=B;continue}if(j==="("||j==="["||j==="{"){z++,W++;continue}if(j===")"||j==="]"||j==="}"){z--,W++;continue}if(j===";"&&z===0)return W+1;W++}return X};while(Y<X){let _=Z[Y];if(_==="/"&&Z[Y+1]==="/"){let W=K();J.push(Z.slice(Y,W)),Y=W;continue}if(_==="/"&&Z[Y+1]==="*"){let W=q();J.push(Z.slice(Y,W)),Y=W;continue}if(_==='"'||_==="'"||_==="`"){let W=G(_);J.push(Z.slice(Y,W)),Y=W;continue}if(_==="{"){Q++,J.push(_),Y++;continue}if(_==="}"){Q--,J.push(_),Y++;continue}if(Q===0){let W=Y>0?Z[Y-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=Z.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],H=U(Y+j[0].length);if($.has(B)){J.push(`/* stx: deduped const ${B} */`),Y=H;continue}$.add(B),J.push(Z.slice(Y,H)),Y=H;continue}}}J.push(_),Y++}return J.join("")}async function n1(Z,$){let J=c1(Z,{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(X5(j.attrs))B=Q5(B);if(Y.test(B))Q.push({fullMatch:j.fullMatch,attrs:j.attrs,content:B})}if(Q.length===0)return{output:Z,setupCode:null};let X=`__stx_setup_${Date.now()}_${aG++}`,{hasUserImports:G,bundleClientScript:K}=await Promise.resolve().then(() => (yZ(),bZ)),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,$||"",{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 H=i4(B);q.push(`// \u2500\u2500 merged signal script #${j+1} \u2500\u2500
6273
- ${H}`)}let U=q.join(`
6274
-
6275
- `);U=eG(U);let _=s1(U),W=`
6540
+ `+$}async function o9($,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>
6541
+ `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
6542
+ `+$.slice(q)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
6543
+ `+$}let{getCachedSignalsRuntime:J}=await Promise.resolve().then(() => (L7(),H7)),Q=`<script data-stx-scoped>${await J(Z.debug)}</script>`,X=$.indexOf("<script");if(X!==-1)return $.slice(0,X)+Q+`
6544
+ `+$.slice(X);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Q+`
6545
+ `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
6546
+ `+Q+$.slice(K+1)}return Q+`
6547
+ `+$}async function F7($,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>
6548
+ `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (L7(),H7)),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+`
6549
+ </body>`+$.slice(G+7)}var $8={};r($8,{scanScriptTags:()=>r9,processSignals:()=>R7,processScriptSetup:()=>t9,parseLoopExpression:()=>a9,hasSignalsSyntax:()=>L$,extractExports:()=>e9,convertSignalLoopsToAttributes:()=>N7,convertSignalDirectivesToAttributes:()=>V7});function r9($,Z={}){let J=[],Y=/<script\b([^>]*)>/gi,Q;while((Q=Y.exec($))!==null){let X=Q[1],G=Q.index+Q[0].length,K=$.toLowerCase().indexOf("</script>",G);if(K===-1)break;let q=K+9;if(Z.skipAttrs&&Z.skipAttrs.test(X)){Y.lastIndex=q;continue}J.push({fullMatch:$.slice(Q.index,q),attrs:X,body:$.slice(G,K),start:Q.index,end:q}),Y.lastIndex=q}return J}function a9($){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}=s9(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}=s9(Q);if(G)return{style:"in",iterable:X,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function s9($){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 L$($){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 GK($){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 V7($){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 U=Z.substring(G,q-1).trim(),_=q,W=1,z=_,j=/@(if\s*\(|endif)/g;j.lastIndex=_;let B;while((B=j.exec(Z))!==null)if(B[1].startsWith("if"))W++;else if(B[1]==="endif"){if(W--,W===0){z=B.index+B[0].length;break}}if(W!==0)continue;let O=Z.substring(_,z-6).trim();if(GK(O))continue;let F=O.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s),L;if(F){let[,H,V,R]=F,N=U.replace(/"/g,"&quot;");L=`<${H}${V} @if="${N}">${R}</${H}>`}else L=`<template @if="${U.replace(/"/g,"&quot;")}">${O}</template>`;Q.push({start:X,end:z,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 N7($,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,U=1,_=q;while(_<J.length&&U>0){if(J[_]==="(")U++;else if(J[_]===")")U--;_++}if(U!==0)continue;let W=J.substring(q,_-1).trim(),z=_,j=a9(W);if(j.iterable){let A=j.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A))continue;if(Z){let w=A.split(/[.[(]/)[0].trim();if(w&&w in Z)continue}}if(j.style==="as")W=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let B=G==="for"?"@endfor":"@endforeach",O=1,F=z,L=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");L.lastIndex=z;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(z,F-B.length).trim(),R=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s),N;if(R){let[,A,w,M]=R;N=`<${A}${w} @for="${W}">${M}</${A}>`}else N=`<template @for="${W}">${V}</template>`;X.push({start:K,end:F,replacement:N})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:U}=X[G];J=J.substring(0,K)+U+J.substring(q)}return J}function KK($){let Z=new Set,J=[],Y=0,Q=0,X=$.length,G=(_)=>{let W=Y+1;while(W<X){let z=$[W];if(z==="\\"){W+=2;continue}if(z===_)return W+1;W++}return X},K=()=>{let _=Y+2;while(_<X&&$[_]!==`
6550
+ `)_++;return _},q=()=>{let _=Y+2;while(_<X-1){if($[_]==="*"&&$[_+1]==="/")return _+2;_++}return X},U=(_)=>{let W=_,z=0;while(W<X){let j=$[W];if(j==="/"&&$[W+1]==="/"){let B=W+2;while(B<X&&$[B]!==`
6551
+ `)B++;W=B;continue}if(j==="/"&&$[W+1]==="*"){let B=W+2;while(B<X-1&&!($[B]==="*"&&$[B+1]==="/"))B++;W=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=W+1;while(B<X){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}W=B;continue}if(j==="("||j==="["||j==="{"){z++,W++;continue}if(j===")"||j==="]"||j==="}"){z--,W++;continue}if(j===";"&&z===0)return W+1;W++}return X};while(Y<X){let _=$[Y];if(_==="/"&&$[Y+1]==="/"){let W=K();J.push($.slice(Y,W)),Y=W;continue}if(_==="/"&&$[Y+1]==="*"){let W=q();J.push($.slice(Y,W)),Y=W;continue}if(_==='"'||_==="'"||_==="`"){let W=G(_);J.push($.slice(Y,W)),Y=W;continue}if(_==="{"){Q++,J.push(_),Y++;continue}if(_==="}"){Q--,J.push(_),Y++;continue}if(Q===0){let W=Y>0?$[Y-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],O=U(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(_),Y++}return J.join("")}async function t9($,Z){let J=r9($,{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()}_${QK++}`,{hasUserImports:G,bundleClientScript:K}=await Promise.resolve().then(() => (C$(),y$)),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
6552
+ ${O}`)}let U=q.join(`
6553
+
6554
+ `);U=KK(U);let _=e9(U),W=`
6276
6555
  <script data-stx-scoped>
6277
6556
  function ${X}() {
6278
6557
  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;
@@ -6280,40 +6559,57 @@ ${U}
6280
6559
  return { ${_} };
6281
6560
  }
6282
6561
  if(window.stx)window.stx._latestSetup=${X};
6283
- </script>`,z=Z;for(let j of Q)z=z.split(j.fullMatch).join("");if(z.includes("<body"))z=z.replace(/<body([^>]*)>/,`<body$1 data-stx="${X}">`);else{let j=["script","style","html","head","meta","link","title","!doctype"];z=z.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(B,H,F)=>{if(j.includes(H.toLowerCase()))return B;return`<${H}${F} data-stx="${X}">`})}return{output:z,setupCode:W}}function s1(Z){let $=Z,J=[],Y=new Set,Q=0,X=0,G=$.length,K=(W)=>{X++;while(X<G){if($[X]==="\\"){X+=2;continue}if($[X]===W){X++;return}X++}},q=()=>{X++;while(X<G){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let W=1;while(X<G&&W>0)if($[X]==="{")W++;else if($[X]==="}")W--;else if($[X]==="'"||$[X]==='"')K($[X]);else if($[X]==="`")q();else X++;continue}X++}},U=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<G&&$[X]!==`
6284
- `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<G-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},_=()=>{if(Q!==0)return;let W=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!Y.has(B))J.push(B),Y.add(B);return}let z=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[1];if(!Y.has(B))J.push(B),Y.add(B);return}let j=$.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(U())continue;if($[X]==="'"||$[X]==='"'){K($[X]);continue}if($[X]==="`"){q();continue}if($[X]==="{"){Q++,X++;continue}if($[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))_();X++}return J.join(", ")}async function N0(Z,$,J){if(!LZ(Z))return Z;let Y=Z;if($.skipSignalsRuntime)return Y;let{output:Q,setupCode:X}=await n1(Y,J);if(Y=Q,Y=await p1(Y,$),Y=u1(Y),X)if(Y.includes("</head>"))Y=Y.replace("</head>",`${X}
6562
+ </script>`,z=$;for(let j of Q)z=z.split(j.fullMatch).join("");if(z.includes("<body"))z=z.replace(/<body([^>]*)>/,`<body$1 data-stx="${X}">`);else{let j=["script","style","html","head","meta","link","title","!doctype"];z=z.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:z,setupCode:W}}function e9($){let Z=$,J=[],Y=new Set,Q=0,X=0,G=Z.length,K=(W)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===W){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 W=1;while(X<G&&W>0)if(Z[X]==="{")W++;else if(Z[X]==="}")W--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},U=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
6563
+ `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},_=()=>{if(Q!==0)return;let W=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!Y.has(B))J.push(B),Y.add(B);return}let z=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let B=z[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(U())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])))_();X++}return J.join(", ")}async function R7($,Z,J){if(!L$($))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:X}=await t9(Y,J);if(Y=Q,Y=await o9(Y,Z),Y=n9(Y),X)if(Y.includes("</head>"))Y=Y.replace("</head>",`${X}
6285
6564
  </head>`);else if(Y.includes("<body"))Y=Y.replace(/<body([^>]*)>/,`<body$1>
6286
6565
  ${X}`);else Y=Y+`
6287
- `+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 aG=0;var A0=P(()=>{V4()});import S4 from"path";import R0 from"fs";function r1(Z){return Z.split("-").map(($)=>$.charAt(0).toUpperCase()+$.slice(1)).join("")}function a1(Z){return Z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class t1{builtins=new Map;registerBuiltin(Z){this.builtins.set(Z.name.toLowerCase(),Z);for(let $ of Z.aliases)this.builtins.set($.toLowerCase(),Z)}isBuiltin(Z){return this.builtins.has(Z.toLowerCase())}getBuiltin(Z){return this.builtins.get(Z.toLowerCase())??null}async resolveFile(Z,$,J,Y){let Q=Z.endsWith(".stx")?Z.slice(0,-4):Z,X=Y?.__importedComponents;if(X){let j=[Q,Q.toLowerCase(),r1(Q),a1(Q)];for(let B of j)if(X.has(B))return X.get(B)}let G=[...new Set([`${Q}.stx`,`${r1(Q)}.stx`,`${a1(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=S4.resolve(S4.dirname($),`${Q}.stx`);if(await c(j))return j;return null}let K=[],q=J.componentsDir||"",U=Y?.__originalFilePath;if(U)K.push(S4.join(S4.dirname(U),"components"));if(q)K.push(q);let _=S4.join(S4.dirname($),"components");if(!K.includes(_))K.push(_);let W=process.cwd(),z=[S4.resolve(W,"src/components"),S4.resolve(W,"components"),S4.resolve(import.meta.dir,"components")];for(let j of z)if(!K.includes(j))K.push(j);for(let j of K){if(!j)continue;for(let B of G){let H=S4.join(j,B);if(await c(H))return H}try{if(!R0.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let H=R0.readdirSync(j,{withFileTypes:!0});for(let F of H)if(F.isDirectory()){let L=S4.join(j,F.name);for(let O of G){let V=S4.join(L,O);if(await c(V))return V}}}catch{}}return null}}var N5;var w0=P(()=>{V4();N5=new t1});function d4(Z){return Z.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ZK(Z){if(Z.clientReactive.to)return{value:Z.clientReactive.to,reactive:!0};if(Z.serverDynamic.to!==void 0)return{value:String(Z.serverDynamic.to),reactive:!1};if(typeof Z.static.to==="string")return{value:Z.static.to,reactive:!1};return{value:"#",reactive:!1}}var T0;var M0=P(()=>{T0={name:"StxLink",aliases:["stx-link"],render(Z,$,J){let Y=ZK(Z),Q=(typeof Z.static.class==="string"?Z.static.class:"")||(typeof Z.static.className==="string"?Z.static.className:""),X=typeof Z.static.activeClass==="string"?Z.static.activeClass:"active",G=typeof Z.static.exactActiveClass==="string"?Z.static.exactActiveClass:"exact-active",K=Z.static.prefetch===!0||Z.static.prefetch==="true"||Z.serverDynamic.prefetch===!0,q=[];if(Y.reactive)q.push(`:href="${d4(Y.value)}"`);else q.push(`href="${d4(Y.value)}"`);if(Q)q.push(`class="${d4(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${d4(X)}"`),q.push(`data-stx-exact-active-class="${d4(G)}"`),K)q.push("data-stx-prefetch");for(let[_,W]of Object.entries(Z.events))q.push(`@${d4(_)}="${d4(W)}"`);let U=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[_,W]of Object.entries(Z.static)){if(U.has(_))continue;if(typeof W==="boolean"){if(W)q.push(d4(_))}else q.push(`${d4(_)}="${d4(W)}"`)}return`<a ${q.join(" ")}>${$}</a>`}}});function W4(Z){return Z.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function T4(Z,$){if(Z.serverDynamic[$]!==void 0)return String(Z.serverDynamic[$]);let J=Z.static[$];if(typeof J==="string")return J;return}function E0(Z,$,J=!1){let Y=Z.serverDynamic[$];if(Y!==void 0)return Y!==!1&&Y!=="false";let Q=Z.static[$];if(Q!==void 0)return Q!=="false"&&Q!==!1;return J}function e1(Z){if(Z.includes("(")||Z.includes(","))return Z;let $=Z.trim().split(/\s+/),J=[];for(let Y of $)if(Y.includes(":")){let[Q,X]=Y.split(":"),G=$K[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 D0(Z,$,J,Y){return $.map((Q)=>`${_7(Z,Q,void 0,J,Y)} ${Q}w`).join(", ")}function YK(Z,$,J,Y,Q){return $.map((X)=>{let G=J?J*X:void 0;return`${_7(Z,G,void 0,Y,Q)} ${X}x`}).join(", ")}function _7(Z,$,J,Y,Q){if(!Y||Y==="local"||Y==="static")return Z;if(Y==="cloudinary"){let X=[];if($)X.push(`w_${$}`);if(J)X.push(`h_${J}`);if(Q)X.push(`f_${Q}`);X.push("q_auto");let G=X.join(",");return Z.replace("/upload/",`/upload/${G}/`)}if(Y==="imgix"){let X=new URLSearchParams;if($)X.set("w",String($));if(J)X.set("h",String(J));if(Q)X.set("fm",Q);X.set("auto","format");let G=Z.includes("?")?"&":"?";return`${Z}${G}${X.toString()}`}if(Y==="bunny"){let X=new URLSearchParams;if($)X.set("width",String($));if(J)X.set("height",String(J));if(Q)X.set("format",Q);let G=Z.includes("?")?"&":"?";return`${Z}${G}${X.toString()}`}return Z}function JK(Z,$,J="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${$}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var $K,I0,k0;var S0=P(()=>{$K={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},I0=[320,640,768,1024,1280,1536,1920];k0={name:"StxImage",aliases:["stx-image","stx-img"],render(Z,$,J){let Y=T4(Z,"src")||"",Q=T4(Z,"alt")||"",X=T4(Z,"width"),G=T4(Z,"height"),K=T4(Z,"sizes"),q=T4(Z,"srcset"),U=T4(Z,"densities"),_=T4(Z,"format"),W=T4(Z,"placeholder"),z=T4(Z,"placeholderColor")||"#e5e7eb",j=T4(Z,"provider"),B=T4(Z,"class")||T4(Z,"className")||"",H=T4(Z,"style")||"",F=T4(Z,"quality"),L=E0(Z,"lazy",!0),O=E0(Z,"preload",!1),V=E0(Z,"picture",!1)||!!_,A=X?Number.parseInt(X):void 0,N=G?Number.parseInt(G):void 0,R=q||"",w="";if(!R&&K)R=D0(Y,I0,j,_),w=e1(K);else if(!R&&U){let b=U.split(/\s+/).map((S)=>Number.parseFloat(S.replace("x","")));R=YK(Y,b,A,j,_)}else if(K)w=e1(K);let M=[];if(H)M.push(H);if(A&&N)M.push(`aspect-ratio:${A}/${N}`);if(W==="blur"||W==="color"){let b=JK(A||16,N||9,z);M.push(`background-image:url(${b})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(W&&W!=="empty"&&W!=="none")M.push(`background-image:url(${W4(W)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let E=_7(Y,A,N,j,_),T=[];if(T.push(`src="${W4(E)}"`),T.push(`alt="${W4(Q)}"`),X)T.push(`width="${W4(X)}"`);if(G)T.push(`height="${W4(G)}"`);if(L)T.push('loading="lazy"');if(T.push('decoding="async"'),B)T.push(`class="${W4(B)}"`);if(M.length>0)T.push(`style="${W4(M.join(";"))}"`);if(R)T.push(`srcset="${W4(R)}"`);if(w)T.push(`sizes="${W4(w)}"`);let I=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[b,S]of Object.entries(Z.static)){if(I.has(b))continue;if(typeof S==="boolean"){if(S)T.push(W4(b))}else T.push(`${W4(b)}="${W4(S)}"`)}let D=`<img ${T.join(" ")} />`,y="";if(O){let S=_==="webp"?"image/webp":_==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${W4(E)}"${S?` type="${S}"`:""}${R?` imagesrcset="${W4(R)}"`:""}${w?` imagesizes="${W4(w)}"`:""} />
6288
- `}if(V){let b=[];if(_==="avif"||_==="auto"){let S=_7(Y,A,N,j,"avif"),k=R?D0(Y,I0,j,"avif"):`${S}`;b.push(`<source type="image/avif" srcset="${W4(k)}"${w?` sizes="${W4(w)}"`:""} />`)}if(_==="webp"||_==="auto"){let S=_7(Y,A,N,j,"webp"),k=R?D0(Y,I0,j,"webp"):`${S}`;b.push(`<source type="image/webp" srcset="${W4(k)}"${w?` sizes="${W4(w)}"`:""} />`)}return`${y}<picture>
6566
+ `+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 QK=0;var A7=P(()=>{V0()});import S0 from"path";import w7 from"fs";function Z8($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function Y8($){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(),Z8(Q),Y8(Q)];for(let B of j)if(X.has(B))return X.get(B)}let G=[...new Set([`${Q}.stx`,`${Z8(Q)}.stx`,`${Y8(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=S0.resolve(S0.dirname(Z),`${Q}.stx`);if(await c(j))return j;return null}let K=[],q=J.componentsDir||"",U=Y?.__originalFilePath;if(U)K.push(S0.join(S0.dirname(U),"components"));if(q)K.push(q);let _=S0.join(S0.dirname(Z),"components");if(!K.includes(_))K.push(_);let W=process.cwd(),z=[S0.resolve(W,"src/components"),S0.resolve(W,"components"),S0.resolve(import.meta.dir,"components")];for(let j of z)if(!K.includes(j))K.push(j);for(let j of K){if(!j)continue;for(let B of G){let O=S0.join(j,B);if(await c(O))return O}try{if(!w7.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let O=w7.readdirSync(j,{withFileTypes:!0});for(let F of O)if(F.isDirectory()){let L=S0.join(j,F.name);for(let H of G){let V=S0.join(L,H);if(await c(V))return V}}}catch{}}return null}}var c0;var T7=P(()=>{V0();c0=new J8});function d0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qK($){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 M7;var I7=P(()=>{M7={name:"StxLink",aliases:["stx-link"],render($,Z,J){let Y=qK($),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="${d0(Y.value)}"`);else q.push(`href="${d0(Y.value)}"`);if(Q)q.push(`class="${d0(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${d0(X)}"`),q.push(`data-stx-exact-active-class="${d0(G)}"`),K)q.push("data-stx-prefetch");for(let[_,W]of Object.entries($.events))q.push(`@${d0(_)}="${d0(W)}"`);let U=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[_,W]of Object.entries($.static)){if(U.has(_))continue;if(typeof W==="boolean"){if(W)q.push(d0(_))}else q.push(`${d0(_)}="${d0(W)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function W0($){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 D7($,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 X8($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let Y of Z)if(Y.includes(":")){let[Q,X]=Y.split(":"),G=_K[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 k7($,Z,J,Y){return Z.map((Q)=>`${_5($,Q,void 0,J,Y)} ${Q}w`).join(", ")}function UK($,Z,J,Y,Q){return Z.map((X)=>{let G=J?J*X:void 0;return`${_5($,G,void 0,Y,Q)} ${X}x`}).join(", ")}function _5($,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 WK($,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 _K,E7,S7;var b7=P(()=>{_K={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},E7=[320,640,768,1024,1280,1536,1920];S7={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"),U=T0($,"densities"),_=T0($,"format"),W=T0($,"placeholder"),z=T0($,"placeholderColor")||"#e5e7eb",j=T0($,"provider"),B=T0($,"class")||T0($,"className")||"",O=T0($,"style")||"",F=T0($,"quality"),L=D7($,"lazy",!0),H=D7($,"preload",!1),V=D7($,"picture",!1)||!!_,R=X?Number.parseInt(X):void 0,N=G?Number.parseInt(G):void 0,A=q||"",w="";if(!A&&K)A=k7(Y,E7,j,_),w=X8(K);else if(!A&&U){let b=U.split(/\s+/).map((S)=>Number.parseFloat(S.replace("x","")));A=UK(Y,b,R,j,_)}else if(K)w=X8(K);let M=[];if(O)M.push(O);if(R&&N)M.push(`aspect-ratio:${R}/${N}`);if(W==="blur"||W==="color"){let b=WK(R||16,N||9,z);M.push(`background-image:url(${b})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(W&&W!=="empty"&&W!=="none")M.push(`background-image:url(${W0(W)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let E=_5(Y,R,N,j,_),T=[];if(T.push(`src="${W0(E)}"`),T.push(`alt="${W0(Q)}"`),X)T.push(`width="${W0(X)}"`);if(G)T.push(`height="${W0(G)}"`);if(L)T.push('loading="lazy"');if(T.push('decoding="async"'),B)T.push(`class="${W0(B)}"`);if(M.length>0)T.push(`style="${W0(M.join(";"))}"`);if(A)T.push(`srcset="${W0(A)}"`);if(w)T.push(`sizes="${W0(w)}"`);let I=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[b,S]of Object.entries($.static)){if(I.has(b))continue;if(typeof S==="boolean"){if(S)T.push(W0(b))}else T.push(`${W0(b)}="${W0(S)}"`)}let D=`<img ${T.join(" ")} />`,y="";if(H){let S=_==="webp"?"image/webp":_==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${W0(E)}"${S?` type="${S}"`:""}${A?` imagesrcset="${W0(A)}"`:""}${w?` imagesizes="${W0(w)}"`:""} />
6567
+ `}if(V){let b=[];if(_==="avif"||_==="auto"){let S=_5(Y,R,N,j,"avif"),k=A?k7(Y,E7,j,"avif"):`${S}`;b.push(`<source type="image/avif" srcset="${W0(k)}"${w?` sizes="${W0(w)}"`:""} />`)}if(_==="webp"||_==="auto"){let S=_5(Y,R,N,j,"webp"),k=A?k7(Y,E7,j,"webp"):`${S}`;b.push(`<source type="image/webp" srcset="${W0(k)}"${w?` sizes="${W0(w)}"`:""} />`)}return`${y}<picture>
6289
6568
  ${b.join(`
6290
6569
  `)}
6291
6570
  ${D}
6292
- </picture>`}return`${y}${D}`}}});function b0(Z){return Z.replace(/[;{}()]/g,"").replace(/url/gi,"")}function U7(Z,$){if(Z.serverDynamic[$]!==void 0)return String(Z.serverDynamic[$]);let J=Z.static[$];if(typeof J==="string")return J;return}function FZ(Z,$,J){let Y=U7(Z,$);if(Y!==void 0){let Q=Number.parseInt(Y,10);if(!Number.isNaN(Q))return Q}return J}var y0;var C0=P(()=>{y0={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(Z,$,J){let Y=b0(U7(Z,"color")||"#6366f1"),Q=b0(U7(Z,"initialColor")||U7(Z,"initial-color")||""),X=b0(U7(Z,"height")||"3px"),G=FZ(Z,"duration",2000),K=FZ(Z,"throttle",200),q=FZ(Z,"zIndex",999999)||FZ(Z,"z-index",999999),U=Q?`linear-gradient(to right, ${Q}, ${Y})`:Y;return`
6571
+ </picture>`}return`${y}${D}`}}});function y7($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function U5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function F$($,Z,J){let Y=U5($,Z);if(Y!==void 0){let Q=Number.parseInt(Y,10);if(!Number.isNaN(Q))return Q}return J}var C7;var P7=P(()=>{C7={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let Y=y7(U5($,"color")||"#6366f1"),Q=y7(U5($,"initialColor")||U5($,"initial-color")||""),X=y7(U5($,"height")||"3px"),G=F$($,"duration",2000),K=F$($,"throttle",200),q=F$($,"zIndex",999999)||F$($,"z-index",999999),U=Q?`linear-gradient(to right, ${Q}, ${Y})`:Y;return`
6293
6572
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${X};background:${U};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
6294
6573
  <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>
6295
6574
  </div>
6296
6575
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
6297
6576
  <script>
6298
6577
  (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()})})();
6299
- </script>`}}});var YY={};r(YY,{preloadIconCollection:()=>$Y,IconBuiltin:()=>VZ});async function ZY(Z){if(W7.has(Z))return W7.get(Z);try{let $=J4.resolve(`@iconify/json/json/${Z}.json`),J=await Bun.file($).json();return W7.set(Z,J.icons),J.icons}catch{try{let J=`${process.cwd()}/node_modules/@iconify/json/json/${Z}.json`,Y=Bun.file(J);if(await Y.exists()){let Q=await Y.json();return W7.set(Z,Q.icons),Q.icons}}catch{}}return null}function P5(Z,$){if(Z.serverDynamic[$]!==void 0)return String(Z.serverDynamic[$]);if(Z.static[$]!==void 0)return String(Z.static[$]);if(Z.clientReactive[$]!==void 0)return Z.clientReactive[$];return}async function $Y(Z="lucide"){await ZY(Z)}var W7,VZ;var NZ=P(()=>{W7=new Map;VZ={name:"Icon",aliases:["icon","stx-icon"],render(Z,$,J){let Y=P5(Z,"name")??P5(Z,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",X=Y;if(Y.includes(":")){let O=Y.split(":");Q=O[0],X=O[1]}let G=P5(Z,"size")||"24",K=P5(Z,"color")||"currentColor",q=P5(Z,"class")||"",U=P5(Z,"style")||"",_=W7.get(Q);if(!_)return ZY(Q),`<!-- Icon: collection "${Q}" not loaded -->`;let W=_[X];if(!W)return`<!-- Icon: "${X}" not found in ${Q} -->`;let z=W.width||24,j=W.height||24,B=`0 0 ${z} ${j}`,H=W.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let F=q?` class="${q}"`:"",L=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${L}>${H}</svg>`}}});function JY(){N5.registerBuiltin(T0),N5.registerBuiltin(k0),N5.registerBuiltin(y0),N5.registerBuiltin(VZ)}var XY=P(()=>{M0();S0();C0();NZ();w0();M0();S0();C0();NZ()});function QY(Z){return Z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function GY(Z,$,J){let Y=[],Q=0;while(Q<Z.length){let X=Z.indexOf("<",Q);if(X===-1)break;let K=Z.slice(X+1).match(new RegExp(`^(${$.source})`));if(!K){Q=X+1;continue}let q=K[1];if(J&&J.has(q.toLowerCase())){let H=X+1+q.length;while(H<Z.length&&Z[H]!==">")H++;Q=H+1;continue}let U=X+1+q.length,_=null,W=U,z=-1,j=!1;while(U<Z.length){let H=Z[U];if(_){if(H==="\\"&&U+1<Z.length){U+=2;continue}if(H===_)_=null;U++;continue}if(H==='"'||H==="'"){_=H,U++;continue}if(H==="/"&&U+1<Z.length&&Z[U+1]===">"){z=U+2,j=!0;break}if(H===">"){z=U+1;break}U++}if(z===-1){Q=X+1;continue}let B=Z.slice(W,j?z-2:z-1).trim();if(j)Y.push({fullMatch:Z.slice(X,z),tagName:q,attributes:B,content:"",startIndex:X,endIndex:z,isSelfClosing:!0}),Q=z;else{let H=`<${q}`,F=`</${q}>`,L=1,O=z,V=-1;while(L>0&&O<Z.length){let R=Z.indexOf(H,O),w=Z.indexOf(F,O);if(w===-1)break;if(R!==-1&&R<w){let M=Z[R+H.length];if(M===" "||M===">"||M==="/"||M===`
6300
- `||M==="\t")L++;O=R+H.length}else{if(L--,L===0){V=w;break}O=w+F.length}}if(V===-1){Q=z;continue}let A=Z.slice(z,V),N=V+F.length;Y.push({fullMatch:Z.slice(X,N),tagName:q,attributes:B,content:A,startIndex:X,endIndex:N,isSelfClosing:!1}),Q=N}}return Y}var KY=P(()=>{A4();V4()});import v5 from"path";function QK(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"]);for(let[X,G]of Object.entries(Z)){let K=X.startsWith("x-")&&!Q.has(X)&&!X.startsWith("x-bind:")&&!X.startsWith("x-on:")?`:${X.slice(2)}`:X;if(K.startsWith("@")){Y.events[K]=G;continue}if(K.startsWith("__stx_")){let q=K.slice(6);try{let U=G.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");Y.serverDynamic[q]=JSON.parse(U)}catch(U){if(J.debug)console.error(`Error parsing __stx_${q}:`,U);Y.serverDynamic[q]=G}continue}if(K.startsWith(":")){let q=K.slice(1),U=G==="true"?q:G;try{if(!e(U)){if(J.debug)console.error(`Unsafe expression in :${q} binding: ${U}`);Y.clientReactive[q]=U;continue}let _=Object.keys($),z=Z4(U,_)(...Object.values($));if(z===void 0){let j=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],B=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!B.has(F)&&!_.includes(F))){Y.clientReactive[q]=U;continue}}Y.serverDynamic[q]=z}catch{Y.clientReactive[q]=U}continue}if(typeof G==="string"&&G.includes("{{")&&G.includes("}}")){let q=G.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(q)try{let U=q[1];if(e(U)){let W=Z4(U,Object.keys($))(...Object.values($));Y.static[K]=W!=null?String(W):""}else{if(J.debug)console.error(`Unsafe expression in ${K}: ${U}`);Y.static[K]=G}}catch(U){if(J.debug)console.error(`Error evaluating expression for ${K}:`,U);Y.static[K]=G}else{let U=G,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,W;while((W=_.exec(G))!==null)try{let z=W[1];if(!e(z)){if(J.debug)console.error(`Unsafe expression in ${K}: ${z}`);continue}let B=Z4(z,Object.keys($))(...Object.values($));U=U.replace(W[0],String(B??""))}catch(z){if(J.debug)console.error(`Error evaluating expression in ${K}:`,z)}Y.static[K]=U}continue}Y.static[K]=G}return Y}function GK(Z){let $={},J=0,Y=Z.length;while(J<Y){while(J<Y&&/\s/.test(Z[J]))J++;if(J>=Y)break;let Q="";while(J<Y&&!/[\s=]/.test(Z[J]))Q+=Z[J],J++;if(!Q)break;while(J<Y&&/\s/.test(Z[J]))J++;if(J<Y&&Z[J]==="="){J++;while(J<Y&&/\s/.test(Z[J]))J++;let X="";if(J<Y&&(Z[J]==='"'||Z[J]==="'")){let G=Z[J];J++;while(J<Y){let K=Z[J];if(K==="\\"&&J+1<Y){J++,X+=Z[J],J++;continue}if(K===G){J++;break}X+=K,J++}}else while(J<Y&&!/\s/.test(Z[J]))X+=Z[J],J++;$[Q]=X}else $[Q]="true"}return $}async function KK(Z,$,J,Y,Q){let X=Z;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(X))!==null){let[U,_]=q,W=_.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of W){let j=z.split("/"),H=j[j.length-1].replace(/\.stx$/,""),F=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),L=null,O=[v5.resolve(v5.dirname(J),`${z}.stx`),v5.resolve(v5.dirname(J),z),v5.resolve(Y.componentsDir||"components",`${z}.stx`),v5.resolve(Y.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){L=V;break}}catch{}if(L){G.set(F,L),G.set(H,L),G.set(H.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: ${z}`)}X=X.replace(U,""),K.lastIndex=0}return X}async function qK(Z,$,J,Y,Q){let X=Z,G=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let K=$.__processedComponents,q=/@component\s*\(/g,U;while((U=q.exec(X))!==null){let _=U.index,W=_+U[0].length-1,z=1,j=W+1;while(j<X.length&&z>0){if(X[j]==="(")z++;else if(X[j]===")"){if(z--,z===0)break}j++}if(z!==0)break;let B=X.substring(W+1,j),H=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){q.lastIndex=0;continue}let L=F[1],O,V=B.slice(F[0].length),A=V.match(/^\s*,\s*/);if(A)O=V.slice(A[0].length).trim();let N={};if(O)try{N=H4(O,$)}catch(I){let D=I instanceof Error?I.message:String(I);X=X.replace(X.substring(_,H),`[Error parsing component props: ${D}]`);continue}let R="",w=H,E=X.substring(H).match(/^([\s\S]*?)@endcomponent/);if(E)R=E[1].trim(),w=H+E[0].length;let T=await U5(L,N,R,G,$,J,Y,K,Q);X=X.substring(0,_)+T+X.substring(w),q.lastIndex=0}return X}async function _K(Z,$,J,Y,Q){if(!Z)return Z;let X=Z,G=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let K=$.__processedComponents;return X=await W(X,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),X=await W(X,/[A-Z][a-zA-Z0-9]*/,!0),X=await W(X,/[a-z][a-z0-9]*/,!1,XK),X;async function W(z,j,B,H){if(!z)return z;let F=z,L=GY(F,j,H);for(let O=L.length-1;O>=0;O--){let V=L[O],A=B?QY(V.tagName):V.tagName,N=GK(V.attributes),R=QK(N,$,Y),w=N5.getBuiltin(V.tagName);if(w){let I={context:$,filePath:J,options:Y,dependencies:Q},D=w.render(R,V.content,I);if(Object.keys(R.clientReactive).length>0)D=_Y(D,R.clientReactive);if(Object.keys(R.events).length>0){let y=Object.entries(R.events).map(([b,S])=>`${b}="${S.replace(/"/g,"&quot;")}"`).join(" ");D=D.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}F=F.substring(0,V.startIndex)+D+F.substring(V.endIndex);continue}let M={};for(let[I,D]of Object.entries(R.static))M[I]=D;for(let[I,D]of Object.entries(R.serverDynamic))M[I]=D;let T=await U5(A,M,V.content,G,$,J,Y,K,Q);if(Object.keys(R.clientReactive).length>0)T=_Y(T,R.clientReactive);if(Object.keys(R.events).length>0){let I=T.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(I){let D=Object.entries(R.events).map(([b,S])=>`${b}="${S}"`).join(" "),y=I[1].length+I[2].length;T=T.substring(0,y)+" "+D+T.substring(y)}}F=F.substring(0,V.startIndex)+T+F.substring(V.endIndex)}return F}}function _Y(Z,$){let J=Z.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!J)return Z;let Y=Object.entries($).map(([X,G])=>`:${X}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=J[1].length+J[2].length;return Z.substring(0,Q)+" "+Y+Z.substring(Q)}async function P0(Z,$,J,Y,Q){if(!qY)JY(),qY=!0;let X=await KK(Z,$,J,Y,Q);X=await qK(X,$,J,Y,Q);for(let G=0;G<3;G++){let K=X;if(X=await _K(X,$,J,Y,Q),X===K)break}return X}var qY=!1,XK;var UY=P(()=>{w0();XY();KY();V4();A4();XK=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 x5 from"path";function WY(Z){return Z.startsWith("http://")||Z.startsWith("https://")||Z.startsWith("//")}function zY(Z,$,J){try{let Y;if(Z.startsWith("/")){let Q=$;for(let X=0;X<5;X++){let G=x5.join(Q,Z);if(J4("fs").existsSync(G))return G;Q=x5.dirname(Q)}Y=x5.join($,Z)}else if(Z.startsWith("./")||Z.startsWith("../"))Y=x5.resolve($,Z);else Y=x5.resolve($,Z);if(J4("fs").existsSync(Y))return Y;return null}catch{return null}}async function BY(Z,$,J){let Y=Z,Q=x5.dirname($),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=X.exec(Y))!==null){let[U,_,W,z]=G;if(WY(W))continue;let j=zY(W,Q,$);if(j)try{let B=await Bun.file(j).text();if(J.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!1});if(F.outputs.length>0)B=await F.outputs[0].text()}let H=`<script>
6578
+ </script>`}}});function G8($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function zK($,Z,J){let Y=G8($,Z);if(Y!==void 0){let Q=Number.parseInt(Y,10);if(!Number.isNaN(Q))return Q}return J}var Q8,v7;var x7=P(()=>{Q8={"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%)"},v7={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let Y=G8($,"position")||"top-right",Q=zK($,"max",5),X=Q8[Y]||Q8["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>
6579
+ <style>
6580
+ @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
6581
+ @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
6582
+ @keyframes stx-toast-in-left{from{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}
6583
+ @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
6584
+ @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
6585
+ @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
6586
+ </style>`}}});function V$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var K8,f7;var g7=P(()=>{K8={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)"},f7={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let Y=V$($,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=V$($,"size")||"md",X=V$($,"closeOnBackdrop")!=="false",G=V$($,"closeOnEscape")!=="false",K=K8[Q]||K8.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">
6587
+ <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)">
6588
+ <div style="padding:1.5rem">${Z}</div>
6589
+ </div>
6590
+ </div>
6591
+ <style>
6592
+ @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
6593
+ .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
6594
+ .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
6595
+ </style>`}}});var U8={};r(U8,{preloadIconCollection:()=>_8,IconBuiltin:()=>N$});async function q8($){if(W5.has($))return W5.get($);try{let Z=J0.resolve(`@iconify/json/json/${$}.json`),J=await Bun.file(Z).json();return W5.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 W5.set($,Q.icons),Q.icons}}catch{}}return null}function P1($,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 _8($="lucide"){await q8($)}var W5,N$;var R$=P(()=>{W5=new Map;N$={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let Y=P1($,"name")??P1($,"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=P1($,"size")||"24",K=P1($,"color")||"currentColor",q=P1($,"class")||"",U=P1($,"style")||"",_=W5.get(Q);if(!_)return q8(Q),`<!-- Icon: collection "${Q}" not loaded -->`;let W=_[X];if(!W)return`<!-- Icon: "${X}" not found in ${Q} -->`;let z=W.width||24,j=W.height||24,B=`0 0 ${z} ${j}`,O=W.body;if(K!=="currentColor")O=O.replace(/currentColor/g,K);let F=q?` class="${q}"`:"",L=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${L}>${O}</svg>`}}});function W8(){c0.registerBuiltin(M7),c0.registerBuiltin(S7),c0.registerBuiltin(C7),c0.registerBuiltin(v7),c0.registerBuiltin(f7),c0.registerBuiltin(N$)}var z8=P(()=>{I7();b7();P7();x7();g7();R$();T7();I7();b7();P7();x7();g7();R$()});function B8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function j8($,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 U=X+1+q.length,_=null,W=U,z=-1,j=!1;while(U<$.length){let O=$[U];if(_){if(O==="\\"&&U+1<$.length){U+=2;continue}if(O===_)_=null;U++;continue}if(O==='"'||O==="'"){_=O,U++;continue}if(O==="/"&&U+1<$.length&&$[U+1]===">"){z=U+2,j=!0;break}if(O===">"){z=U+1;break}U++}if(z===-1){Q=X+1;continue}let B=$.slice(W,j?z-2:z-1).trim();if(j)Y.push({fullMatch:$.slice(X,z),tagName:q,attributes:B,content:"",startIndex:X,endIndex:z,isSelfClosing:!0}),Q=z;else{let O=`<${q}`,F=`</${q}>`,L=1,H=z,V=-1;while(L>0&&H<$.length){let A=$.indexOf(O,H),w=$.indexOf(F,H);if(w===-1)break;if(A!==-1&&A<w){let M=$[A+O.length];if(M===" "||M===">"||M==="/"||M===`
6596
+ `||M==="\t")L++;H=A+O.length}else{if(L--,L===0){V=w;break}H=w+F.length}}if(V===-1){Q=z;continue}let R=$.slice(z,V),N=V+F.length;Y.push({fullMatch:$.slice(X,N),tagName:q,attributes:B,content:R,startIndex:X,endIndex:N,isSelfClosing:!1}),Q=N}}return Y}var O8=P(()=>{R0();V0()});import v1 from"path";function jK($,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"]);for(let[X,G]of Object.entries($)){let K=X.startsWith("x-")&&!Q.has(X)&&!X.startsWith("x-bind:")&&!X.startsWith("x-on:")?`:${X.slice(2)}`:X;if(K.startsWith("@")){Y.events[K]=G;continue}if(K.startsWith("__stx_")){let q=K.slice(6);try{let U=G.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");Y.serverDynamic[q]=JSON.parse(U)}catch(U){if(J.debug)console.error(`Error parsing __stx_${q}:`,U);Y.serverDynamic[q]=G}continue}if(K.startsWith(":")){let q=K.slice(1),U=G==="true"?q:G;try{if(!e(U)){if(J.debug)console.error(`Unsafe expression in :${q} binding: ${U}`);Y.clientReactive[q]=U;continue}let _=Object.keys(Z),z=$0(U,_)(...Object.values(Z));if(z===void 0){let j=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],B=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!B.has(F)&&!_.includes(F))){Y.clientReactive[q]=U;continue}}Y.serverDynamic[q]=z}catch{Y.clientReactive[q]=U}continue}if(typeof G==="string"&&G.includes("{{")&&G.includes("}}")){let q=G.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(q)try{let U=q[1];if(e(U)){let W=$0(U,Object.keys(Z))(...Object.values(Z));Y.static[K]=W!=null?String(W):""}else{if(J.debug)console.error(`Unsafe expression in ${K}: ${U}`);Y.static[K]=G}}catch(U){if(J.debug)console.error(`Error evaluating expression for ${K}:`,U);Y.static[K]=G}else{let U=G,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,W;while((W=_.exec(G))!==null)try{let z=W[1];if(!e(z)){if(J.debug)console.error(`Unsafe expression in ${K}: ${z}`);continue}let B=$0(z,Object.keys(Z))(...Object.values(Z));U=U.replace(W[0],String(B??""))}catch(z){if(J.debug)console.error(`Error evaluating expression in ${K}:`,z)}Y.static[K]=U}continue}Y.static[K]=G}return Y}function OK($){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 HK($,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[U,_]=q,W=_.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of W){let j=z.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=[v1.resolve(v1.dirname(J),`${z}.stx`),v1.resolve(v1.dirname(J),z),v1.resolve(Y.componentsDir||"components",`${z}.stx`),v1.resolve(Y.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.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: ${z}`)}X=X.replace(U,""),K.lastIndex=0}return X}async function LK($,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,U;while((U=q.exec(X))!==null){let _=U.index,W=_+U[0].length-1,z=1,j=W+1;while(j<X.length&&z>0){if(X[j]==="(")z++;else if(X[j]===")"){if(z--,z===0)break}j++}if(z!==0)break;let B=X.substring(W+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),R=V.match(/^\s*,\s*/);if(R)H=V.slice(R[0].length).trim();let N={};if(H)try{N=O0(H,Z)}catch(I){let D=I instanceof Error?I.message:String(I);X=X.replace(X.substring(_,O),`[Error parsing component props: ${D}]`);continue}let A="",w=O,E=X.substring(O).match(/^([\s\S]*?)@endcomponent/);if(E)A=E[1].trim(),w=O+E[0].length;let T=await W1(L,N,A,G,Z,J,Y,K,Q);X=X.substring(0,_)+T+X.substring(w),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 W(X,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),X=await W(X,/[A-Z][a-zA-Z0-9]*/,!0),X=await W(X,/[a-z][a-z0-9]*/,!1,BK),X;async function W(z,j,B,O){if(!z)return z;let F=z,L=j8(F,j,O);for(let H=L.length-1;H>=0;H--){let V=L[H],R=B?B8(V.tagName):V.tagName,N=OK(V.attributes),A=jK(N,Z,Y),w=c0.getBuiltin(V.tagName);if(w){let I={context:Z,filePath:J,options:Y,dependencies:Q},D=w.render(A,V.content,I);if(Object.keys(A.clientReactive).length>0)D=L8(D,A.clientReactive);if(Object.keys(A.events).length>0){let y=Object.entries(A.events).map(([b,S])=>`${b}="${S.replace(/"/g,"&quot;")}"`).join(" ");D=D.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}F=F.substring(0,V.startIndex)+D+F.substring(V.endIndex);continue}let M={};for(let[I,D]of Object.entries(A.static))M[I]=D;for(let[I,D]of Object.entries(A.serverDynamic))M[I]=D;let T=await W1(R,M,V.content,G,Z,J,Y,K,Q);if(Object.keys(A.clientReactive).length>0)T=L8(T,A.clientReactive);if(Object.keys(A.events).length>0){let I=T.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(I){let D=Object.entries(A.events).map(([b,S])=>`${b}="${S}"`).join(" "),y=I[1].length+I[2].length;T=T.substring(0,y)+" "+D+T.substring(y)}}F=F.substring(0,V.startIndex)+T+F.substring(V.endIndex)}return F}}function L8($,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 h7($,Z,J,Y,Q){if(!H8)W8(),H8=!0;let X=await HK($,Z,J,Y,Q);X=await LK(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 H8=!1,BK;var F8=P(()=>{T7();z8();O8();V0();R0();BK=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 x1 from"path";function V8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function N8($,Z,J){try{let Y;if($.startsWith("/")){let Q=Z;for(let X=0;X<5;X++){let G=x1.join(Q,$);if(J0("fs").existsSync(G))return G;Q=x1.dirname(Q)}Y=x1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))Y=x1.resolve(Z,$);else Y=x1.resolve(Z,$);if(J0("fs").existsSync(Y))return Y;return null}catch{return null}}async function R8($,Z,J){let Y=$,Q=x1.dirname(Z),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=X.exec(Y))!==null){let[U,_,W,z]=G;if(V8(W))continue;let j=N8(W,Q,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!1});if(F.outputs.length>0)B=await F.outputs[0].text()}let O=`<script>
6301
6597
  // Source: ${W}
6302
6598
  ${B}
6303
- </script>`;Y=Y.replace(U,H),X.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(Y))!==null){let[U,_,W,z]=q,j=_+z;if(WY(W))continue;if(/rel=["']stylesheet["']/.test(j)||W.endsWith(".css")){let H=zY(W,Q,$);if(H)try{let F=await Bun.file(H).text();J.add(H);let L=`<style>
6599
+ </script>`;Y=Y.replace(U,O),X.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(Y))!==null){let[U,_,W,z]=q,j=_+z;if(V8(W))continue;if(/rel=["']stylesheet["']/.test(j)||W.endsWith(".css")){let O=N8(W,Q,Z);if(O)try{let F=await Bun.file(O).text();J.add(O);let L=`<style>
6304
6600
  /* Source: ${W} */
6305
6601
  ${F}
6306
- </style>`;Y=Y.replace(U,L),K.lastIndex=0}catch(F){}}}return Y}var jY=()=>{};function v0(Z,$){let J=Z,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,U=null,_=!1;while(q<J.length&&K>0){let V=J[q];if(_){_=!1,q++;continue}if(V==="\\"&&U){_=!0,q++;continue}if(U){if(V===U)U=null;q++;continue}if(V==='"'||V==="'"||V==="`"){U=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let W=J.substring(G+1,q).trim(),z=J.substring(X,q+1),j=-1,B=0,H=null,F=!1;for(let V=0;V<W.length;V++){let A=W[V];if(F){F=!1;continue}if(A==="\\"&&H){F=!0;continue}if(H){if(A===H)H=null;continue}if(A==='"'||A==="'"||A==="`"){H=A;continue}if(A==="("||A==="["||A==="{")B++;else if(A===")"||A==="]"||A==="}")B--;if(A===","&&B===0){j=V;break}}let L=j>=0?W.substring(0,j).trim():W,O=j>=0?W.substring(j+1).trim():void 0;try{let V=L.trim(),A;if(e(V))A=Z4(V,Object.keys($))(...Object.values($));else A=void 0;let N;if(O==="true")N=JSON.stringify(A,null,2);else N=JSON.stringify(A);let R=N.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){j5.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),Y.lastIndex=X+z.length}}return J}function x0(Z){return Z.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function HY(Z){let $=Z,J=/@memo\s*\(/g,Y,Q=[];while((Y=J.exec($))!==null){let X=Y.index,G=X+Y[0].length,K=1,q=G;while(q<$.length&&K>0){if($[q]==="(")K++;else if($[q]===")")K--;q++}if(K!==0)continue;let U=$.slice(G,q-1).trim(),_=q,W=$.slice(_),z=W.indexOf("@endmemo");if(z===-1)continue;let j=W.slice(0,z),B=_+z+8,H=j.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)/),F=H?H[0].length:0,L=j.slice(F),O=j.match(/(\s*)$/),V=O?O[0].length:0,A=L.slice(0,L.length-V),N=A.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(N){let[w,M,E="",T]=N,I=`<${M}${E} data-stx-memo="${U}"${T}>`;R=j.slice(0,F)+I+A.slice(w.length)+j.slice(F+A.length)}else R=`${j.slice(0,F)}<div data-stx-memo="${U}">${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];$=$.slice(0,G.start)+G.replacement+$.slice(G.end)}return $.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function f0(Z){let $=Z.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),$}function OY(Z){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(Z))!==null){let G=X.index,K=G+X[0].length,q=!1,U=!1,_=-1;while(K<Z.length){let H=Z[K];if(q){if(H==="'")q=!1}else if(U){if(H==='"')U=!1}else if(H==="'")q=!0;else if(H==='"')U=!0;else if(H===">"){_=K;break}K++}if(_===-1)continue;if(Z.slice(G,_+1).includes("x-cloak"))continue;let z=Z.slice(_+1),j=z.indexOf("</"),B=j>=0?z.slice(0,j):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))Y+=Z.slice(Q,_)+" x-cloak>",Q=_+1}return Y+=Z.slice(Q),Y}var g0=P(()=>{l4();A4()});function h0(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 UK){if(Q.some((_)=>K.includes(_)||G.source.includes(_)))continue;G.lastIndex=0;let U=Z.match(G);if(U&&U.length>0){let _=Z.split(`
6602
+ </style>`;Y=Y.replace(U,L),K.lastIndex=0}catch(F){}}}return Y}var A8=()=>{};function d7($,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,U=null,_=!1;while(q<J.length&&K>0){let V=J[q];if(_){_=!1,q++;continue}if(V==="\\"&&U){_=!0,q++;continue}if(U){if(V===U)U=null;q++;continue}if(V==='"'||V==="'"||V==="`"){U=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let W=J.substring(G+1,q).trim(),z=J.substring(X,q+1),j=-1,B=0,O=null,F=!1;for(let V=0;V<W.length;V++){let R=W[V];if(F){F=!1;continue}if(R==="\\"&&O){F=!0;continue}if(O){if(R===O)O=null;continue}if(R==='"'||R==="'"||R==="`"){O=R;continue}if(R==="("||R==="["||R==="{")B++;else if(R===")"||R==="]"||R==="}")B--;if(R===","&&B===0){j=V;break}}let L=j>=0?W.substring(0,j).trim():W,H=j>=0?W.substring(j+1).trim():void 0;try{let V=L.trim(),R;if(e(V))R=$0(V,Object.keys(Z))(...Object.values(Z));else R=void 0;let N;if(H==="true")N=JSON.stringify(R,null,2);else N=JSON.stringify(R);let A=N.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,X)+A+J.substring(q+1),Y.lastIndex=X+A.length}catch(V){O1.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),Y.lastIndex=X+z.length}}return J}function m7($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function w8($){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 U=Z.slice(G,q-1).trim(),_=q,W=Z.slice(_),z=W.indexOf("@endmemo");if(z===-1)continue;let j=W.slice(0,z),B=_+z+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,R=L.slice(0,L.length-V),N=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(N){let[w,M,E="",T]=N,I=`<${M}${E} data-stx-memo="${U}"${T}>`;A=j.slice(0,F)+I+R.slice(w.length)+j.slice(F+R.length)}else A=`${j.slice(0,F)}<div data-stx-memo="${U}">${R}</div>${j.slice(F+R.length)}`;Q.push({start:X,end:B,replacement:A}),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 u7($){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 T8($){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,U=!1,_=-1;while(K<$.length){let O=$[K];if(q){if(O==="'")q=!1}else if(U){if(O==='"')U=!1}else if(O==="'")q=!0;else if(O==='"')U=!0;else if(O===">"){_=K;break}K++}if(_===-1)continue;if($.slice(G,_+1).includes("x-cloak"))continue;let z=$.slice(_+1),j=z.indexOf("</"),B=j>=0?z.slice(0,j):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))Y+=$.slice(Q,_)+" x-cloak>",Q=_+1}return Y+=$.slice(Q),Y}var p7=P(()=>{l0();R0()});function l7($,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 VK){if(Q.some((_)=>K.includes(_)||G.source.includes(_)))continue;G.lastIndex=0;let U=$.match(G);if(U&&U.length>0){let _=$.split(`
6307
6603
  `),W=[];_.forEach((j,B)=>{if(G.lastIndex=0,G.test(j))W.push(B+1)});let z=W.length>0?` (line${W.length>1?"s":""}: ${W.join(", ")})`:"";X.push(` \u2717 ${K}${z}
6308
- \u2192 ${q}`)}}if(X.length>0&&Y.enabled){let K=`[STX] DOM API violation in ${$.split("/").pop()||$}:
6604
+ \u2192 ${q}`)}}if(X.length>0&&Y.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
6309
6605
  ${X.join(`
6310
6606
  `)}
6311
- Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var UK;var d0=P(()=>{UK=[{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 LY={};r(LY,{getStoreScript:()=>WK,clearStoreCache:()=>zK});import AZ from"path";async function WK(Z){let $;if(Z)$=AZ.resolve(Z);else{let _=await H5();$=AZ.resolve(_.root||process.cwd(),_.storesDir||"stores")}let J=f5.get($);if(J!==void 0)return J||null;let Y=new Bun.Glob("*.ts"),Q=[];try{for await(let _ of Y.scan({cwd:$,absolute:!0})){let W=AZ.basename(_,".ts");if(["index","types"].includes(W))continue;if(_.includes(".d.ts"))continue;Q.push(_)}}catch{return f5.set($,""),null}if(Q.length===0)return f5.set($,""),null;let X=[];for(let _ of Q){let W=await Bun.file(_).text();X.push({file:_,hasUseStore:/useStore\s*\(/.test(W)})}X.sort((_,W)=>{if(_.hasUseStore===W.hasUseStore)return 0;return _.hasUseStore?1:-1});let G=X.map((_)=>_.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser"});for(let _ of G)try{let W=await Bun.file(_).text(),z=AZ.basename(_,".ts");W=W.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),W=W.replace(/^export\s+(default\s+)?/gm,""),W=q.transformSync(W),K.push(`// Store: ${z}
6312
- ${W.trim()}`)}catch(W){console.warn(`[stx] Failed to load store ${_}:`,W)}if(K.length===0)return f5.set($,""),null;let U=`;(function(){
6607
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var VK;var c7=P(()=>{VK=[{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 M8={};r(M8,{getStoreScript:()=>NK,clearStoreCache:()=>RK});import A$ from"path";async function NK($){let Z;if($)Z=A$.resolve($);else{let _=await H1();Z=A$.resolve(_.root||process.cwd(),_.storesDir||"stores")}let J=f1.get(Z);if(J!==void 0)return J||null;let Y=new Bun.Glob("*.ts"),Q=[];try{for await(let _ of Y.scan({cwd:Z,absolute:!0})){let W=A$.basename(_,".ts");if(["index","types"].includes(W))continue;if(_.includes(".d.ts"))continue;Q.push(_)}}catch{return f1.set(Z,""),null}if(Q.length===0)return f1.set(Z,""),null;let X=[];for(let _ of Q){let W=await Bun.file(_).text();X.push({file:_,hasUseStore:/useStore\s*\(/.test(W)})}X.sort((_,W)=>{if(_.hasUseStore===W.hasUseStore)return 0;return _.hasUseStore?1:-1});let G=X.map((_)=>_.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser"});for(let _ of G)try{let W=await Bun.file(_).text(),z=A$.basename(_,".ts");W=W.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),W=W.replace(/^export\s+(default\s+)?/gm,""),W=q.transformSync(W),K.push(`// Store: ${z}
6608
+ ${W.trim()}`)}catch(W){console.warn(`[stx] Failed to load store ${_}:`,W)}if(K.length===0)return f1.set(Z,""),null;let U=`;(function(){
6313
6609
  ${K.join(`
6314
6610
 
6315
6611
  `)}
6316
- })();`;return f5.set($,U),U}function zK(){f5.clear()}var f5;var FY=P(()=>{Z7();f5=new Map});var NY={};r(NY,{processDeferDirectives:()=>LK});function BK(){return`stx-defer-${++VY}`}function jK(Z){let $=Z.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function HK(Z,$,J){let{trigger:Y,value:Q}=jK($),X=J,G,K,q,U=J.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(U)G=U[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let _=J.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(_)K=_[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let W=J.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(W)q=W[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 OK(Z,$){let{trigger:J,triggerValue:Y}=$,Q;switch(J){case"visible":Q=`
6612
+ })();`;return f1.set(Z,U),U}function RK(){f1.clear()}var f1;var I8=P(()=>{$5();f1=new Map});var D8={};r(D8,{processDeferDirectives:()=>IK});function AK(){return`stx-defer-${++E8}`}function wK($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function TK($,Z,J){let{trigger:Y,value:Q}=wK(Z),X=J,G,K,q,U=J.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(U)G=U[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let _=J.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(_)K=_[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let W=J.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(W)q=W[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 MK($,Z){let{trigger:J,triggerValue:Y}=Z,Q;switch(J){case"visible":Q=`
6317
6613
  const observer = new IntersectionObserver((entries) => {
6318
6614
  if (entries[0].isIntersecting) {
6319
6615
  observer.disconnect();
@@ -6350,7 +6646,7 @@ else {
6350
6646
  `;break}return`
6351
6647
  <script>
6352
6648
  (function() {
6353
- const container = document.getElementById('${Z}');
6649
+ const container = document.getElementById('${$}');
6354
6650
  if (!container) return;
6355
6651
 
6356
6652
  const contentEl = container.querySelector('[data-defer-content]');
@@ -6386,7 +6682,7 @@ else {
6386
6682
  ${Q}
6387
6683
  })();
6388
6684
  </script>
6389
- `}function LK(Z,$,J){VY=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return Z.replace(Y,(Q,X,G)=>{let K=BK(),q=HK(Q,X,G),U=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",_=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',W=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",z=`<div data-defer-content style="display: none;">${q.content}</div>`,j=OK(K,q);return`
6685
+ `}function IK($,Z,J){E8=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(Y,(Q,X,G)=>{let K=AK(),q=TK(Q,X,G),U=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",_=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',W=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",z=`<div data-defer-content style="display: none;">${q.content}</div>`,j=MK(K,q);return`
6390
6686
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
6391
6687
  ${U}
6392
6688
  ${_}
@@ -6394,15 +6690,15 @@ else {
6394
6690
  ${W}
6395
6691
  </div>
6396
6692
  ${j}
6397
- `})}var VY=0;var RY={};r(RY,{processTeleportDirectives:()=>AK,ensureTeleportTargets:()=>RK});function FK(){return`stx-teleport-${++AY}`}function VK(Z){let $=Z.split(",").map((Q)=>Q.trim()),J=$[0].replace(/['"]/g,""),Y;for(let Q=1;Q<$.length;Q++){let X=$[Q].match(/disabled:\s*(.+)/);if(X)Y=X[1].trim()}return{target:J,disabled:Y}}function NK(Z,$){return`
6693
+ `})}var E8=0;var S8={};r(S8,{processTeleportDirectives:()=>SK,ensureTeleportTargets:()=>bK});function EK(){return`stx-teleport-${++k8}`}function DK($){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 kK($,Z){return`
6398
6694
  <script>
6399
6695
  (function() {
6400
- const source = document.getElementById('${Z}');
6696
+ const source = document.getElementById('${$}');
6401
6697
  if (!source) return;
6402
6698
 
6403
- const targetEl = document.querySelector('${$}');
6699
+ const targetEl = document.querySelector('${Z}');
6404
6700
  if (!targetEl) {
6405
- console.warn('[stx] Teleport target not found: ${$}');
6701
+ console.warn('[stx] Teleport target not found: ${Z}');
6406
6702
  return;
6407
6703
  }
6408
6704
 
@@ -6415,7 +6711,7 @@ else {
6415
6711
 
6416
6712
  // Create a wrapper to track teleported content
6417
6713
  const wrapper = document.createElement('div');
6418
- wrapper.setAttribute('data-teleport-from', '${Z}');
6714
+ wrapper.setAttribute('data-teleport-from', '${$}');
6419
6715
  wrapper.appendChild(content);
6420
6716
 
6421
6717
  targetEl.appendChild(wrapper);
@@ -6426,16 +6722,16 @@ else {
6426
6722
  // Dispatch event for tracking
6427
6723
  wrapper.dispatchEvent(new CustomEvent('teleport:mounted', {
6428
6724
  bubbles: true,
6429
- detail: { sourceId: '${Z}', target: '${$}' }
6725
+ detail: { sourceId: '${$}', target: '${Z}' }
6430
6726
  }));
6431
6727
  })();
6432
6728
  </script>
6433
- `}function AK(Z,$,J){AY=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return Z.replace(Y,(Q,X,G)=>{let K=FK(),{target:q,disabled:U}=VK(X),_=G.trim();if(U)try{let z=!1;if(U==="true")z=!0;else if(U==="false")z=!1;else if(U in $)z=Boolean($[U]);if(z)return`<div class="stx-teleport-inline" data-teleport-disabled>${_}</div>`}catch{}let W=NK(K,q);return`
6729
+ `}function SK($,Z,J){k8=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(Y,(Q,X,G)=>{let K=EK(),{target:q,disabled:U}=DK(X),_=G.trim();if(U)try{let z=!1;if(U==="true")z=!0;else if(U==="false")z=!1;else if(U in Z)z=Boolean(Z[U]);if(z)return`<div class="stx-teleport-inline" data-teleport-disabled>${_}</div>`}catch{}let W=kK(K,q);return`
6434
6730
  <div id="${K}" class="stx-teleport-source" style="display: none;">
6435
6731
  <template>${_}</template>
6436
6732
  </div>
6437
6733
  ${W}
6438
- `})}function RK(){return`
6734
+ `})}function bK(){return`
6439
6735
  <script>
6440
6736
  (function() {
6441
6737
  // Common teleport targets
@@ -6452,7 +6748,7 @@ else {
6452
6748
  });
6453
6749
  })();
6454
6750
  </script>
6455
- `}var AY=0;var IY={};r(IY,{processTransitionDirectives:()=>IK,processTransitionAttributes:()=>SK,performLeave:()=>MK,performEnter:()=>TK,generateTransitionRuntime:()=>kK,generateTransitionCSS:()=>DK});function wY(Z,$={}){return{enterFrom:$.enterClass||`${Z}-enter-from`,enterActive:$.enterActiveClass||`${Z}-enter-active`,enterTo:$.enterToClass||`${Z}-enter-to`,leaveFrom:$.leaveClass||`${Z}-leave-from`,leaveActive:$.leaveActiveClass||`${Z}-leave-active`,leaveTo:$.leaveToClass||`${Z}-leave-to`}}function wK(Z){let $=getComputedStyle(Z),J=$.transitionDuration||"0s",Y=$.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 TY(Z,$){return new Promise((J)=>{let Y=$??wK(Z);if(Y===0){J();return}let Q=!1,X=()=>{if(Q)return;Q=!0,Z.removeEventListener("transitionend",G),Z.removeEventListener("animationend",G),J()},G=(K)=>{if(K.target===Z)X()};Z.addEventListener("transitionend",G),Z.addEventListener("animationend",G),setTimeout(X,Y+50)})}function MY(Z){Z.offsetHeight}async function TK(Z,$={}){let J=$.name||"stx",Y=wY(J,$),Q=typeof $.duration==="object"?$.duration.enter:$.duration;if($.onBeforeEnter?.(Z),Z.classList.add(Y.enterFrom),Z.classList.add(Y.enterActive),MY(Z),Z.classList.remove(Y.enterFrom),Z.classList.add(Y.enterTo),$.onEnter)await new Promise((X)=>{$.onEnter(Z,X)});else await TY(Z,Q);Z.classList.remove(Y.enterActive),Z.classList.remove(Y.enterTo),$.onAfterEnter?.(Z)}async function MK(Z,$={}){let J=$.name||"stx",Y=wY(J,$),Q=typeof $.duration==="object"?$.duration.leave:$.duration;if($.onBeforeLeave?.(Z),Z.classList.add(Y.leaveFrom),Z.classList.add(Y.leaveActive),MY(Z),Z.classList.remove(Y.leaveFrom),Z.classList.add(Y.leaveTo),$.onLeave)await new Promise((X)=>{$.onLeave(Z,X)});else await TY(Z,Q);Z.classList.remove(Y.leaveActive),Z.classList.remove(Y.leaveTo),$.onAfterLeave?.(Z)}function IK(Z,$={},J){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return Z.replace(Y,(Q,X,G)=>{let K=EK(X),q=K.name||"stx",U=K.duration||300,_=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
6751
+ `}var k8=0;var P8={};r(P8,{processTransitionDirectives:()=>vK,processTransitionAttributes:()=>hK,performLeave:()=>PK,performEnter:()=>CK,generateTransitionRuntime:()=>gK,generateTransitionCSS:()=>fK});function b8($,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 yK($){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 y8($,Z){return new Promise((J)=>{let Y=Z??yK($);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 CK($,Z={}){let J=Z.name||"stx",Y=b8(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 y8($,Q);$.classList.remove(Y.enterActive),$.classList.remove(Y.enterTo),Z.onAfterEnter?.($)}async function PK($,Z={}){let J=Z.name||"stx",Y=b8(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 y8($,Q);$.classList.remove(Y.leaveActive),$.classList.remove(Y.leaveTo),Z.onAfterLeave?.($)}function vK($,Z={},J){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(Y,(Q,X,G)=>{let K=xK(X),q=K.name||"stx",U=K.duration||300,_=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
6456
6752
  <div
6457
6753
  class="stx-transition-wrapper"
6458
6754
  data-transition="${q}"
@@ -6494,7 +6790,7 @@ else {
6494
6790
  });
6495
6791
  })();
6496
6792
  </script>
6497
- `})}function EK(Z){let $={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec(Z))!==null){let Q=Y[1],X=Y[2]||Y[3]||Y[4]||Y[5];switch(Q){case"name":$.name=X;break;case"duration":$.duration=parseInt(X,10);break;case"mode":$.mode=X;break;case"easing":$.easing=X;break}}return $}function DK(){return`
6793
+ `})}function xK($){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 fK(){return`
6498
6794
  /* STX Transition Presets */
6499
6795
 
6500
6796
  /* Fade */
@@ -6681,7 +6977,7 @@ else {
6681
6977
  opacity: 1;
6682
6978
  max-height: 1000px;
6683
6979
  }
6684
- `}function kK(){return`
6980
+ `}function gK(){return`
6685
6981
  // STX Transition Runtime
6686
6982
  (function() {
6687
6983
  if (typeof window === 'undefined') return;
@@ -6770,18 +7066,18 @@ else {
6770
7066
 
6771
7067
  console.log('[stx] Transition runtime initialized');
6772
7068
  })();
6773
- `}function SK(Z){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return Z.replace($,(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 DY={};r(DY,{withErrorBoundary:()=>EY,processErrorBoundaryDirectives:()=>CK,generateErrorBoundaryRuntime:()=>gK,generateErrorBoundaryCSS:()=>fK,createErrorBoundary:()=>xK});function yK(){return`eb-${++bK}-${Date.now().toString(36)}`}function CK(Z,$={},J){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return Z.replace(Y,(Q,X,G,K)=>{let q=yK(),U=PK(X||"");return vK(q,G.trim(),K.trim(),U)})}function PK(Z){let $={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=J.exec(Z))!==null){let Q=Y[1],X=Y[2]||Y[3]||Y[4];switch(Q){case"id":$.id=X;break;case"logErrors":$.logErrors=X==="true";break}}return $}function vK(Z,$,J,Y){let Q=Y.logErrors!==!1;return`
6774
- <div class="stx-error-boundary" data-boundary-id="${Z}" data-has-error="false">
6775
- <div class="stx-error-boundary-content" data-boundary-content="${Z}">
6776
- ${$}
7069
+ `}function hK($){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 x8={};r(x8,{withErrorBoundary:()=>v8,processErrorBoundaryDirectives:()=>uK,generateErrorBoundaryRuntime:()=>nK,generateErrorBoundaryCSS:()=>iK,createErrorBoundary:()=>cK});function mK(){return`eb-${++dK}-${Date.now().toString(36)}`}function uK($,Z={},J){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(Y,(Q,X,G,K)=>{let q=mK(),U=pK(X||"");return lK(q,G.trim(),K.trim(),U)})}function pK($){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 lK($,Z,J,Y){let Q=Y.logErrors!==!1;return`
7070
+ <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
7071
+ <div class="stx-error-boundary-content" data-boundary-content="${$}">
7072
+ ${Z}
6777
7073
  </div>
6778
- <div class="stx-error-boundary-fallback" data-boundary-fallback="${Z}" style="display: none;">
7074
+ <div class="stx-error-boundary-fallback" data-boundary-fallback="${$}" style="display: none;">
6779
7075
  ${J}
6780
7076
  </div>
6781
7077
  </div>
6782
7078
  <script>
6783
7079
  (function() {
6784
- const boundaryId = '${Z}';
7080
+ const boundaryId = '${$}';
6785
7081
  const logErrors = ${Q};
6786
7082
  const boundary = document.querySelector('[data-boundary-id="' + boundaryId + '"]');
6787
7083
  const contentEl = document.querySelector('[data-boundary-content="' + boundaryId + '"]');
@@ -6890,7 +7186,7 @@ else {
6890
7186
  };
6891
7187
  })();
6892
7188
  </script>
6893
- `}async function EY(Z,$,J){try{return await Z()}catch(Y){if(J)J(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return $}}function xK(Z,$={}){let J=$.onError?(Y)=>$.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>EY(Y,Z,J)}function fK(){return`
7189
+ `}async function v8($,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 cK($,Z={}){let J=Z.onError?(Y)=>Z.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>v8(Y,$,J)}function iK(){return`
6894
7190
  /* STX Error Boundary Styles */
6895
7191
  .stx-error-boundary {
6896
7192
  position: relative;
@@ -6934,7 +7230,7 @@ else {
6934
7230
  color: #fecaca;
6935
7231
  }
6936
7232
  }
6937
- `}function gK(){return`
7233
+ `}function nK(){return`
6938
7234
  // STX Error Boundary Runtime
6939
7235
  (function() {
6940
7236
  if (typeof window === 'undefined') return;
@@ -6999,18 +7295,18 @@ else {
6999
7295
 
7000
7296
  console.log('[stx] Error boundary runtime initialized');
7001
7297
  })();
7002
- `}var bK=0;var kY={};r(kY,{renderSSRSuspense:()=>cK,processSuspenseDirectives:()=>mK,generateSuspenseRuntime:()=>nK,generateSuspenseCSS:()=>iK,createSSRSuspense:()=>lK});function dK(){return`suspense-${++hK}-${Date.now().toString(36)}`}function mK(Z,$={},J){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return Z.replace(Y,(Q,X,G,K)=>{let q=dK(),U=uK(X||"");return pK(q,G.trim(),K.trim(),U)})}function uK(Z){let $={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec(Z))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4];switch(Q){case"id":$.id=X;break;case"timeout":$.timeout=G?parseInt(G,10):void 0;break}}return $}function pK(Z,$,J,Y){let Q=Y.timeout||30000,X=Y.id||Z;return`
7003
- <div class="stx-suspense" data-suspense-id="${Z}" data-custom-id="${X}" data-status="pending">
7004
- <div class="stx-suspense-fallback" data-suspense-fallback="${Z}">
7298
+ `}var dK=0;var f8={};r(f8,{renderSSRSuspense:()=>$q,processSuspenseDirectives:()=>rK,generateSuspenseRuntime:()=>Yq,generateSuspenseCSS:()=>Zq,createSSRSuspense:()=>eK});function sK(){return`suspense-${++oK}-${Date.now().toString(36)}`}function rK($,Z={},J){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(Y,(Q,X,G,K)=>{let q=sK(),U=aK(X||"");return tK(q,G.trim(),K.trim(),U)})}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],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 tK($,Z,J,Y){let Q=Y.timeout||30000,X=Y.id||$;return`
7299
+ <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${X}" data-status="pending">
7300
+ <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
7005
7301
  ${J}
7006
7302
  </div>
7007
- <div class="stx-suspense-content" data-suspense-content="${Z}" style="display: none;">
7008
- ${$}
7303
+ <div class="stx-suspense-content" data-suspense-content="${$}" style="display: none;">
7304
+ ${Z}
7009
7305
  </div>
7010
7306
  </div>
7011
7307
  <script>
7012
7308
  (function() {
7013
- const suspenseId = '${Z}';
7309
+ const suspenseId = '${$}';
7014
7310
  const customId = '${X}';
7015
7311
  const timeout = ${Q};
7016
7312
 
@@ -7189,12 +7485,12 @@ else {
7189
7485
  }, 0);
7190
7486
  })();
7191
7487
  </script>
7192
- `}function lK(Z,$,J){return{id:Z,fallback:J,content:$}}async function cK(Z){let $=Z.map((Y)=>`
7488
+ `}function eK($,Z,J){return{id:$,fallback:J,content:Z}}async function $q($){let Z=$.map((Y)=>`
7193
7489
  <div id="stx-ssr-suspense-${Y.id}" class="stx-ssr-suspense">
7194
7490
  ${Y.fallback}
7195
7491
  </div>
7196
7492
  `).join(`
7197
- `);async function*J(){for(let Y of Z)try{let Q=await Y.content;yield`
7493
+ `);async function*J(){for(let Y of $)try{let Q=await Y.content;yield`
7198
7494
  <script>
7199
7495
  (function() {
7200
7496
  const el = document.getElementById('stx-ssr-suspense-${Y.id}');
@@ -7214,7 +7510,7 @@ else {
7214
7510
  }
7215
7511
  })();
7216
7512
  </script>
7217
- `}}return{initial:$,streaming:J()}}function iK(){return`
7513
+ `}}return{initial:Z,streaming:J()}}function Zq(){return`
7218
7514
  /* STX Suspense Styles */
7219
7515
  .stx-suspense {
7220
7516
  position: relative;
@@ -7270,7 +7566,7 @@ else {
7270
7566
  background-size: 200% 100%;
7271
7567
  }
7272
7568
  }
7273
- `}function nK(){return`
7569
+ `}function Yq(){return`
7274
7570
  // STX Suspense Runtime
7275
7571
  (function() {
7276
7572
  if (typeof window === 'undefined') return;
@@ -7337,20 +7633,20 @@ else {
7337
7633
 
7338
7634
  console.log('[stx] Suspense runtime initialized');
7339
7635
  })();
7340
- `}var hK=0;var CY={};r(CY,{processAsyncDirectives:()=>oK,isAsyncComponent:()=>aK,generateAsyncComponentRuntime:()=>eK,generateAsyncComponentCSS:()=>tK,defineAsyncComponent:()=>rK});function SY(){return`async-${++sK}-${Date.now().toString(36)}`}function oK(Z,$={},J){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,X=Z;return X=X.replace(Y,(G,K,q,U)=>{let _=SY(),W=bY(K);return yY(_,W,q.trim(),U.trim())}),X=X.replace(Q,(G,K,q)=>{let U=SY(),_=bY(K);return yY(U,_,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function bY(Z){let $={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec(Z))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4],K=Y[5];switch(Q){case"component":$.component=X||K||"";break;case"timeout":$.timeout=G?parseInt(G,10):30000;break;case"delay":$.delay=G?parseInt(G,10):200;break;case"suspensible":$.suspensible=K==="true";break;case"retries":$.retries=G?parseInt(G,10):0;break;case"loadingComponent":$.loadingComponent=X||K;break;case"errorComponent":$.errorComponent=X||K;break}}return $}function yY(Z,$,J,Y){let{component:Q,timeout:X,delay:G,suspensible:K,retries:q}=$;return`
7341
- <div class="stx-async-component" data-async-id="${Z}" data-component="${Q}" data-status="pending">
7342
- <div class="stx-async-loading" data-async-loading="${Z}">
7636
+ `}var oK=0;var m8={};r(m8,{processAsyncDirectives:()=>Xq,isAsyncComponent:()=>Gq,generateAsyncComponentRuntime:()=>qq,generateAsyncComponentCSS:()=>Kq,defineAsyncComponent:()=>Qq});function g8(){return`async-${++Jq}-${Date.now().toString(36)}`}function Xq($,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,U)=>{let _=g8(),W=h8(K);return d8(_,W,q.trim(),U.trim())}),X=X.replace(Q,(G,K,q)=>{let U=g8(),_=h8(K);return d8(U,_,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function h8($){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 d8($,Z,J,Y){let{component:Q,timeout:X,delay:G,suspensible:K,retries:q}=Z;return`
7637
+ <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
7638
+ <div class="stx-async-loading" data-async-loading="${$}">
7343
7639
  ${J}
7344
7640
  </div>
7345
- <div class="stx-async-content" data-async-content="${Z}" style="display: none;">
7641
+ <div class="stx-async-content" data-async-content="${$}" style="display: none;">
7346
7642
  </div>
7347
- <div class="stx-async-error" data-async-error="${Z}" style="display: none;">
7643
+ <div class="stx-async-error" data-async-error="${$}" style="display: none;">
7348
7644
  ${Y}
7349
7645
  </div>
7350
7646
  </div>
7351
7647
  <script>
7352
7648
  (function() {
7353
- const asyncId = '${Z}';
7649
+ const asyncId = '${$}';
7354
7650
  const componentPath = '${Q}';
7355
7651
  const timeout = ${X};
7356
7652
  const delay = ${G};
@@ -7522,7 +7818,7 @@ catch (error) {
7522
7818
  loadComponent();
7523
7819
  })();
7524
7820
  </script>
7525
- `}function rK(Z){return{__asyncComponent:!0,...typeof Z==="function"?{loader:Z}:Z}}function aK(Z){return typeof Z==="object"&&Z!==null&&"__asyncComponent"in Z&&Z.__asyncComponent===!0}function tK(){return`
7821
+ `}function Qq($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function Gq($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function Kq(){return`
7526
7822
  /* STX Async Component Styles */
7527
7823
  .stx-async-component {
7528
7824
  position: relative;
@@ -7596,7 +7892,7 @@ catch (error) {
7596
7892
  background-size: 200% 100%;
7597
7893
  }
7598
7894
  }
7599
- `}function eK(){return`
7895
+ `}function qq(){return`
7600
7896
  // STX Async Component Runtime
7601
7897
  (function() {
7602
7898
  if (typeof window === 'undefined') return;
@@ -7650,17 +7946,17 @@ catch (error) {
7650
7946
 
7651
7947
  console.log('[stx] Async component runtime initialized');
7652
7948
  })();
7653
- `}var sK=0;var vY={};r(vY,{shouldCacheComponent:()=>Qq,processKeepAliveDirectives:()=>$q,onDeactivated:()=>_q,onActivated:()=>qq,generateKeepAliveRuntime:()=>Kq,generateKeepAliveCSS:()=>Gq,createKeepAliveCache:()=>Xq});function PY(){return`keep-alive-${++Zq}-${Date.now().toString(36)}`}function $q(Z,$={},J){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return Z.replace(Y,(Q,X,G)=>{let K=PY(),q=Yq(X||"");return Jq(K,G.trim(),q)})}function Yq(Z){let $={max:10},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec(Z))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4];switch(Q){case"max":$.max=G?parseInt(G,10):10;break;case"include":$.include=X;break;case"exclude":$.exclude=X;break;case"id":$.id=X;break}}return $}function Jq(Z,$,J){let{max:Y,include:Q,exclude:X}=J,G=J.id||Z;return`
7654
- <div class="stx-keep-alive" data-keep-alive-id="${Z}" data-custom-id="${G}">
7655
- <div class="stx-keep-alive-content" data-keep-alive-content="${Z}">
7656
- ${$}
7949
+ `}var Jq=0;var p8={};r(p8,{shouldCacheComponent:()=>jq,processKeepAliveDirectives:()=>Uq,onDeactivated:()=>Fq,onActivated:()=>Lq,generateKeepAliveRuntime:()=>Hq,generateKeepAliveCSS:()=>Oq,createKeepAliveCache:()=>Bq});function u8(){return`keep-alive-${++_q}-${Date.now().toString(36)}`}function Uq($,Z={},J){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(Y,(Q,X,G)=>{let K=u8(),q=Wq(X||"");return zq(K,G.trim(),q)})}function Wq($){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 zq($,Z,J){let{max:Y,include:Q,exclude:X}=J,G=J.id||$;return`
7950
+ <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
7951
+ <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
7952
+ ${Z}
7657
7953
  </div>
7658
- <div class="stx-keep-alive-cache" data-keep-alive-cache="${Z}" style="display: none;">
7954
+ <div class="stx-keep-alive-cache" data-keep-alive-cache="${$}" style="display: none;">
7659
7955
  </div>
7660
7956
  </div>
7661
7957
  <script>
7662
7958
  (function() {
7663
- const keepAliveId = '${Z}';
7959
+ const keepAliveId = '${$}';
7664
7960
  const customId = '${G}';
7665
7961
  const maxCache = ${Y||10};
7666
7962
  const includeFilter = ${Q?JSON.stringify(Q.split(",").map((K)=>K.trim())):"null"};
@@ -7937,7 +8233,7 @@ else {
7937
8233
  });
7938
8234
  })();
7939
8235
  </script>
7940
- `}function Xq(Z={}){return{id:Z.id||PY(),cache:new Map,max:Z.max||10,include:Z.include?Z.include.split(",").map((J)=>J.trim()):null,exclude:Z.exclude?Z.exclude.split(",").map((J)=>J.trim()):null}}function Qq(Z,$){if($.exclude&&$.exclude.includes(Z))return!1;if($.include&&!$.include.includes(Z))return!1;return!0}function Gq(){return`
8236
+ `}function Bq($={}){return{id:$.id||u8(),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 jq($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function Oq(){return`
7941
8237
  /* STX Keep-Alive Styles */
7942
8238
  .stx-keep-alive {
7943
8239
  position: relative;
@@ -7962,7 +8258,7 @@ else {
7962
8258
  .stx-keep-alive-content > [data-activated] {
7963
8259
  opacity: 1;
7964
8260
  }
7965
- `}function Kq(){return`
8261
+ `}function Hq(){return`
7966
8262
  // STX Keep-Alive Runtime
7967
8263
  (function() {
7968
8264
  if (typeof window === 'undefined') return;
@@ -7998,11 +8294,11 @@ else {
7998
8294
 
7999
8295
  console.log('[stx] Keep-alive runtime initialized');
8000
8296
  })();
8001
- `}function qq(Z){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{Z($.detail)})}function _q(Z){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{Z($.detail)})}var Zq=0;var dY={};r(dY,{useVirtualList:()=>fY,processVirtualListDirectives:()=>u0,processVirtualGridDirectives:()=>hY,processInfiniteListDirectives:()=>gY,generateVirtualListCSS:()=>xY,default:()=>Uq,createVirtualList:()=>m0});function m0(Z,$){let{itemHeight:J,containerHeight:Y,overscan:Q=3,keyProperty:X="id",dynamicHeight:G=!1,estimatedItemHeight:K=J,direction:q="vertical"}=$,U=[...Z],_=0,W=new Map;function z(){if(G)return j();let R=Math.max(0,Math.floor(_/J)-Q),w=Math.ceil(Y/J),M=Math.min(U.length-1,R+w+Q*2);return{startIndex:R,endIndex:M}}function j(){let R=0,w=0,M=U.length-1;for(let E=0;E<U.length;E++){let T=W.get(E)||K;if(R+T>_){w=Math.max(0,E-Q);break}R+=T}R=0;for(let E=0;E<U.length;E++){let T=W.get(E)||K;if(R+=T,R>_+Y){M=Math.min(U.length-1,E+Q);break}}return{startIndex:w,endIndex:M}}function B(){if(G){let R=0;for(let w=0;w<U.length;w++)R+=W.get(w)||K;return R}return U.length*J}function H(R){if(G){let w=0;for(let M=0;M<R;M++)w+=W.get(M)||K;return w}return R*J}function F(){let{startIndex:R,endIndex:w}=z();return{startIndex:R,endIndex:w,scrollTop:_,totalHeight:B(),visibleItems:U.slice(R,w+1),itemHeights:new Map(W)}}function L(R,w="auto"){let M=H(R);O(M,w)}function O(R,w="auto"){_=Math.max(0,Math.min(R,B()-Y))}function V(){z()}function A(R){U=[...R],W.clear(),V()}function N(){U=[],W.clear()}return{scrollToIndex:L,scrollToOffset:O,getState:F,refresh:V,setItems:A,destroy:N}}function u0(Z,$={},J){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return Z.replace(Y,(Q,X,G,K)=>{let q=X.trim(),U=$[q];if(!U||!Array.isArray(U))return`<!-- virtualList: items "${q}" not found or not an array -->`;let _={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();_={..._,...V}}catch{}let W=`vlist-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(_.containerHeight/_.itemHeight),j=_.overscan||3,B=0,H=Math.min(U.length-1,z+j),F="";for(let O=B;O<=H&&O<U.length;O++){let V=U[O],A=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(N,R)=>{if(typeof V==="object"&&V!==null)return String(V[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));F+=`
8297
+ `}function Lq($){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 _q=0;var o8={};r(o8,{useVirtualList:()=>c8,processVirtualListDirectives:()=>n7,processVirtualGridDirectives:()=>n8,processInfiniteListDirectives:()=>i8,generateVirtualListCSS:()=>l8,default:()=>Vq,createVirtualList:()=>i7});function i7($,Z){let{itemHeight:J,containerHeight:Y,overscan:Q=3,keyProperty:X="id",dynamicHeight:G=!1,estimatedItemHeight:K=J,direction:q="vertical"}=Z,U=[...$],_=0,W=new Map;function z(){if(G)return j();let A=Math.max(0,Math.floor(_/J)-Q),w=Math.ceil(Y/J),M=Math.min(U.length-1,A+w+Q*2);return{startIndex:A,endIndex:M}}function j(){let A=0,w=0,M=U.length-1;for(let E=0;E<U.length;E++){let T=W.get(E)||K;if(A+T>_){w=Math.max(0,E-Q);break}A+=T}A=0;for(let E=0;E<U.length;E++){let T=W.get(E)||K;if(A+=T,A>_+Y){M=Math.min(U.length-1,E+Q);break}}return{startIndex:w,endIndex:M}}function B(){if(G){let A=0;for(let w=0;w<U.length;w++)A+=W.get(w)||K;return A}return U.length*J}function O(A){if(G){let w=0;for(let M=0;M<A;M++)w+=W.get(M)||K;return w}return A*J}function F(){let{startIndex:A,endIndex:w}=z();return{startIndex:A,endIndex:w,scrollTop:_,totalHeight:B(),visibleItems:U.slice(A,w+1),itemHeights:new Map(W)}}function L(A,w="auto"){let M=O(A);H(M,w)}function H(A,w="auto"){_=Math.max(0,Math.min(A,B()-Y))}function V(){z()}function R(A){U=[...A],W.clear(),V()}function N(){U=[],W.clear()}return{scrollToIndex:L,scrollToOffset:H,getState:F,refresh:V,setItems:R,destroy:N}}function n7($,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(),U=Z[q];if(!U||!Array.isArray(U))return`<!-- virtualList: items "${q}" not found or not an array -->`;let _={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let H=G.trim(),V=Function(`return ${H}`)();_={..._,...V}}catch{}let W=`vlist-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(_.containerHeight/_.itemHeight),j=_.overscan||3,B=0,O=Math.min(U.length-1,z+j),F="";for(let H=B;H<=O&&H<U.length;H++){let V=U[H],R=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(N,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(H));F+=`
8002
8298
  <div class="virtual-item ${_.itemClass||""}"
8003
- style="position: absolute; top: ${O*_.itemHeight}px; height: ${_.itemHeight}px; width: 100%;"
8004
- data-index="${O}">
8005
- ${A}
8299
+ style="position: absolute; top: ${H*_.itemHeight}px; height: ${_.itemHeight}px; width: 100%;"
8300
+ data-index="${H}">
8301
+ ${R}
8006
8302
  </div>`}let L=U.length*_.itemHeight;return`
8007
8303
  <div id="${W}"
8008
8304
  class="virtual-list-container ${_.containerClass||""}"
@@ -8075,7 +8371,7 @@ else {
8075
8371
  };
8076
8372
  })();
8077
8373
  </script>
8078
- `})}function xY(){return`
8374
+ `})}function l8(){return`
8079
8375
  .virtual-list-container {
8080
8376
  position: relative;
8081
8377
  overflow-y: auto;
@@ -8123,7 +8419,7 @@ else {
8123
8419
  0% { background-position: 200% 0; }
8124
8420
  100% { background-position: -200% 0; }
8125
8421
  }
8126
- `}function fY(Z,$){let J=null,Y=()=>{if(!J)J=m0(Z(),$);return J};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${$.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*$.itemHeight}px`,height:`${$.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{Y().scrollToIndex(Q)}}}function gY(Z,$={},J){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return Z.replace(Y,(Q,X,G,K,q)=>{let U=X.trim(),_=$[U];if(!_||!Array.isArray(_))return`<!-- infiniteList: items "${U}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();W={...W,...B}}catch{}let z=`ilist-${Math.random().toString(36).substring(2,9)}`,j=u0(`@virtualList(${U}, ${JSON.stringify({itemHeight:W.itemHeight,containerHeight:W.containerHeight,overscan:W.overscan,containerClass:W.containerClass})})${K}@endvirtualList`,$);return j=j.replace("</script>",`
8422
+ `}function c8($,Z){let J=null,Y=()=>{if(!J)J=i7($(),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 i8($,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 U=X.trim(),_=Z[U];if(!_||!Array.isArray(_))return`<!-- infiniteList: items "${U}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();W={...W,...B}}catch{}let z=`ilist-${Math.random().toString(36).substring(2,9)}`,j=n7(`@virtualList(${U}, ${JSON.stringify({itemHeight:W.itemHeight,containerHeight:W.containerHeight,overscan:W.overscan,containerClass:W.containerClass})})${K}@endvirtualList`,Z);return j=j.replace("</script>",`
8127
8423
  // Infinite scroll detection
8128
8424
  container.addEventListener('scroll', function() {
8129
8425
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -8141,7 +8437,7 @@ else {
8141
8437
  ${q}
8142
8438
  </div>
8143
8439
  </div>
8144
- `})}function hY(Z,$={},J){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return Z.replace(Y,(Q,X,G,K)=>{let q=X.trim(),U=$[q];if(!U||!Array.isArray(U))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let _={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();_={..._,...V}}catch{}let W=`vgrid-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(U.length/_.columns),j=z*(_.rowHeight+(_.gap||0)),B=Math.ceil(_.containerHeight/(_.rowHeight+(_.gap||0))),H=_.overscan||2,F=0,L=Math.min(z-1,B+H),O="";for(let V=F;V<=L;V++)for(let A=0;A<_.columns;A++){let N=V*_.columns+A;if(N>=U.length)break;let R=U[N],w=A*(100/_.columns),M=V*(_.rowHeight+(_.gap||0)),E=K.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(T,I)=>{if(typeof R==="object"&&R!==null)return String(R[I]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(N));O+=`
8440
+ `})}function n8($,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(),U=Z[q];if(!U||!Array.isArray(U))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let _={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();_={..._,...V}}catch{}let W=`vgrid-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(U.length/_.columns),j=z*(_.rowHeight+(_.gap||0)),B=Math.ceil(_.containerHeight/(_.rowHeight+(_.gap||0))),O=_.overscan||2,F=0,L=Math.min(z-1,B+O),H="";for(let V=F;V<=L;V++)for(let R=0;R<_.columns;R++){let N=V*_.columns+R;if(N>=U.length)break;let A=U[N],w=R*(100/_.columns),M=V*(_.rowHeight+(_.gap||0)),E=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(T,I)=>{if(typeof A==="object"&&A!==null)return String(A[I]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(N));H+=`
8145
8441
  <div class="virtual-grid-item"
8146
8442
  style="position: absolute; top: ${M}px; left: ${w}%; width: calc(${100/_.columns}% - ${_.gap||0}px); height: ${_.rowHeight}px;"
8147
8443
  data-index="${N}">
@@ -8152,7 +8448,7 @@ else {
8152
8448
  style="position: relative; height: ${_.containerHeight}px; overflow-y: auto;">
8153
8449
  <div class="virtual-grid-viewport"
8154
8450
  style="position: relative; height: ${j}px; width: 100%;">
8155
- ${O}
8451
+ ${H}
8156
8452
  </div>
8157
8453
  </div>
8158
8454
  <script data-virtual-grid="${W}">
@@ -8165,7 +8461,7 @@ else {
8165
8461
  const rowHeight = ${_.rowHeight};
8166
8462
  const gap = ${_.gap||0};
8167
8463
  const totalItems = ${U.length};
8168
- const overscan = ${H};
8464
+ const overscan = ${O};
8169
8465
  const containerHeight = ${_.containerHeight};
8170
8466
  const items = ${JSON.stringify(U)};
8171
8467
  const template = ${JSON.stringify(K.trim())};
@@ -8211,7 +8507,7 @@ else {
8211
8507
  });
8212
8508
  })();
8213
8509
  </script>
8214
- `})}var Uq;var mY=P(()=>{Uq={createVirtualList:m0,processVirtualListDirectives:u0,processInfiniteListDirectives:gY,processVirtualGridDirectives:hY,generateVirtualListCSS:xY,useVirtualList:fY}});function uY(){return`<script data-stx-hydration-runtime>
8510
+ `})}var Vq;var s8=P(()=>{Vq={createVirtualList:i7,processVirtualListDirectives:n7,processInfiniteListDirectives:i8,processVirtualGridDirectives:n8,generateVirtualListCSS:l8,useVirtualList:c8}});function r8(){return`<script data-stx-hydration-runtime>
8215
8511
  (function() {
8216
8512
  'use strict';
8217
8513
 
@@ -8371,10 +8667,10 @@ else {
8371
8667
  stxIslands.initIslands();
8372
8668
  }
8373
8669
  })();
8374
- </script>`}function pY(Z){let $=Z.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let J=Z.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(J)return J[1];return null}function lY(Z,$){let J={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=Y.exec(Z))!==null){let X=Q[1],G=Q[2];if(G in $)J[X]=$[G];else J[X]=G}return J}var $9={};r($9,{processStaticDirectives:()=>eY,processPartialHydrationDirectives:()=>iY,onHydrated:()=>tY,isHydrated:()=>aY,hydrateIsland:()=>sY,hydrateByStrategy:()=>oY,hydrateAll:()=>rY,generatePartialHydrationCSS:()=>nY,generateIslandManifest:()=>Z9,default:()=>Fq,createIslandRegistry:()=>cY});function cY(){let Z=new Map;return{islands:Z,register($){Z.set($.id,$)},get($){return Z.get($)},async hydrate($){let J=Z.get($);if(!J||J.hydrated)return;if(J.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:$,component:J.component}}))},async hydrateAll(){let $=Array.from(Z.values()).filter((J)=>!J.hydrated).map((J)=>this.hydrate(J.id));await Promise.all($)}}}function Wq(Z){return`
8375
- <script data-hydrate="${Z}">
8670
+ </script>`}function a8($){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 t8($,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 _Y={};r(_Y,{processStaticDirectives:()=>KY,processPartialHydrationDirectives:()=>$Y,onHydrated:()=>GY,isHydrated:()=>QY,hydrateIsland:()=>YY,hydrateByStrategy:()=>JY,hydrateAll:()=>XY,generatePartialHydrationCSS:()=>ZY,generateIslandManifest:()=>qY,default:()=>Eq,createIslandRegistry:()=>e8});function e8(){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 Nq($){return`
8671
+ <script data-hydrate="${$}">
8376
8672
  (function() {
8377
- const island = document.querySelector('[data-island="${Z}"]');
8673
+ const island = document.querySelector('[data-island="${$}"]');
8378
8674
  if (!island) return;
8379
8675
 
8380
8676
  // Immediately hydrate
@@ -8382,10 +8678,10 @@ else {
8382
8678
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
8383
8679
  })();
8384
8680
  </script>
8385
- `}function zq(Z,$){let J=$.timeout||2000,Y=$.priority||"low";return`
8386
- <script data-hydrate="${Z}">
8681
+ `}function Rq($,Z){let J=Z.timeout||2000,Y=Z.priority||"low";return`
8682
+ <script data-hydrate="${$}">
8387
8683
  (function() {
8388
- const island = document.querySelector('[data-island="${Z}"]');
8684
+ const island = document.querySelector('[data-island="${$}"]');
8389
8685
  if (!island) return;
8390
8686
 
8391
8687
  function hydrate() {
@@ -8418,10 +8714,10 @@ else {
8418
8714
  }
8419
8715
  })();
8420
8716
  </script>
8421
- `}function Bq(Z,$){let J=$.rootMargin||"0px",Y=$.threshold||0;return`
8422
- <script data-hydrate="${Z}">
8717
+ `}function Aq($,Z){let J=Z.rootMargin||"0px",Y=Z.threshold||0;return`
8718
+ <script data-hydrate="${$}">
8423
8719
  (function() {
8424
- const island = document.querySelector('[data-island="${Z}"]');
8720
+ const island = document.querySelector('[data-island="${$}"]');
8425
8721
  if (!island) return;
8426
8722
 
8427
8723
  function hydrate() {
@@ -8451,10 +8747,10 @@ else {
8451
8747
  }
8452
8748
  })();
8453
8749
  </script>
8454
- `}function jq(Z,$){let J=$.media||"(min-width: 768px)";return`
8455
- <script data-hydrate="${Z}">
8750
+ `}function wq($,Z){let J=Z.media||"(min-width: 768px)";return`
8751
+ <script data-hydrate="${$}">
8456
8752
  (function() {
8457
- const island = document.querySelector('[data-island="${Z}"]');
8753
+ const island = document.querySelector('[data-island="${$}"]');
8458
8754
  if (!island) return;
8459
8755
 
8460
8756
  function hydrate() {
@@ -8480,10 +8776,10 @@ else {
8480
8776
  }
8481
8777
  })();
8482
8778
  </script>
8483
- `}function Hq(Z){return`
8484
- <script data-hydrate="${Z}">
8779
+ `}function Tq($){return`
8780
+ <script data-hydrate="${$}">
8485
8781
  (function() {
8486
- const island = document.querySelector('[data-island="${Z}"]');
8782
+ const island = document.querySelector('[data-island="${$}"]');
8487
8783
  if (!island) return;
8488
8784
 
8489
8785
  function hydrate() {
@@ -8502,10 +8798,10 @@ else {
8502
8798
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
8503
8799
  })();
8504
8800
  </script>
8505
- `}function Oq(Z,$){let J=$.event||"stx:activate";return`
8506
- <script data-hydrate="${Z}">
8801
+ `}function Mq($,Z){let J=Z.event||"stx:activate";return`
8802
+ <script data-hydrate="${$}">
8507
8803
  (function() {
8508
- const island = document.querySelector('[data-island="${Z}"]');
8804
+ const island = document.querySelector('[data-island="${$}"]');
8509
8805
  if (!island) return;
8510
8806
 
8511
8807
  function hydrate() {
@@ -8516,18 +8812,18 @@ else {
8516
8812
 
8517
8813
  // Listen for custom event
8518
8814
  window.addEventListener('${J}', function handler(e) {
8519
- if (!e.detail || e.detail.id === '${Z}' || e.detail.id === '*') {
8815
+ if (!e.detail || e.detail.id === '${$}' || e.detail.id === '*') {
8520
8816
  window.removeEventListener('${J}', handler);
8521
8817
  hydrate();
8522
8818
  }
8523
8819
  });
8524
8820
  })();
8525
8821
  </script>
8526
- `}function iY(Z,$={},J){let Y=Z,Q=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test(Z);if(Y=g5(Y,"load",$),Y=g5(Y,"idle",$),Y=g5(Y,"visible",$),Y=g5(Y,"media",$),Y=Lq(Y),Y=g5(Y,"hover",$),Y=g5(Y,"event",$),Q=X&&Y!==Z,Q)Y+=`
8527
- `+uY();return Y}function g5(Z,$,J){let Y=new RegExp(`@client:${$}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return Z.replace(Y,(Q,X,G)=>{let K={strategy:$};if(X)try{let H=X.split(",").map((F)=>F.trim());for(let F of H){let[L,O]=F.split(":").map((V)=>V.trim());if(L&&O){let V=O.replace(/^['"]|['"]$/g,"");K[L]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,U=pY(G.trim()),_=lY(G.trim(),J),W=[];if(K.rootMargin)W.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)W.push(`data-threshold="${K.threshold}"`);if(K.media)W.push(`data-media="${K.media}"`);if(K.event)W.push(`data-event="${K.event}"`);if(U)W.push(`data-component="${U}"`);let j=Object.keys(_).length>0?`
8528
- <script type="application/json" data-island-props="${q}">${JSON.stringify(_)}</script>`:"",B="";switch($){case"load":B=Wq(q);break;case"idle":B=zq(q,K);break;case"visible":B=Bq(q,K);break;case"media":B=jq(q,K);break;case"hover":B=Hq(q);break;case"event":B=Oq(q,K);break}return`
8822
+ `}function $Y($,Z={},J){let Y=$,Q=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(Y=g1(Y,"load",Z),Y=g1(Y,"idle",Z),Y=g1(Y,"visible",Z),Y=g1(Y,"media",Z),Y=Iq(Y),Y=g1(Y,"hover",Z),Y=g1(Y,"event",Z),Q=X&&Y!==$,Q)Y+=`
8823
+ `+r8();return Y}function g1($,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)}`,U=a8(G.trim()),_=t8(G.trim(),J),W=[];if(K.rootMargin)W.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)W.push(`data-threshold="${K.threshold}"`);if(K.media)W.push(`data-media="${K.media}"`);if(K.event)W.push(`data-event="${K.event}"`);if(U)W.push(`data-component="${U}"`);let j=Object.keys(_).length>0?`
8824
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(_)}</script>`:"",B="";switch(Z){case"load":B=Nq(q);break;case"idle":B=Rq(q,K);break;case"visible":B=Aq(q,K);break;case"media":B=wq(q,K);break;case"hover":B=Tq(q);break;case"event":B=Mq(q,K);break}return`
8529
8825
  <div data-island="${q}"
8530
- data-strategy="${$}"
8826
+ data-strategy="${Z}"
8531
8827
  ${W.join(`
8532
8828
  `)}
8533
8829
  class="stx-island"
@@ -8535,7 +8831,7 @@ else {
8535
8831
  ${G.trim()}${j}
8536
8832
  </div>
8537
8833
  ${B}
8538
- `})}function Lq(Z){let $=/@client:only\s*([\s\S]*?)@endclient/gi;return Z.replace($,(J,Y)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
8834
+ `})}function Iq($){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`
8539
8835
  <div data-island="${Q}"
8540
8836
  data-strategy="only"
8541
8837
  class="stx-island stx-client-only">
@@ -8554,7 +8850,7 @@ else {
8554
8850
  }
8555
8851
  })();
8556
8852
  </script>
8557
- `})}function nY(){return`
8853
+ `})}function ZY(){return`
8558
8854
  /* Island base styles */
8559
8855
  .stx-island {
8560
8856
  display: contents;
@@ -8595,11 +8891,11 @@ else {
8595
8891
  .stx-island.hydrated {
8596
8892
  opacity: 1;
8597
8893
  }
8598
- `}function sY(Z){if(typeof window>"u")return;let $=document.querySelector(`[data-island="${Z}"]`);if(!$||$.classList.contains("hydrated"))return;$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function oY(Z){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${Z}"]:not(.hydrated)`).forEach((J)=>{J.classList.add("hydrated"),J.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function rY(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach(($)=>{$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function aY(Z){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${Z}"]`)?.classList.contains("hydrated")??!1}function tY(Z){return new Promise(($)=>{if(typeof window>"u"){$();return}let J=document.querySelector(`[data-island="${Z}"]`);if(!J){$();return}if(J.classList.contains("hydrated")){$();return}J.addEventListener("stx:hydrated",()=>$(),{once:!0})})}function eY(Z){return Z.replace(/@static\s*([\s\S]*?)@endstatic/gi,($,J)=>{return`<div class="stx-static">${J.trim()}</div>`})}function Z9(Z){let $=Z.map((J)=>({id:J.id,component:J.component,strategy:J.options.strategy,props:J.props}));return`
8894
+ `}function YY($){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 JY($){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 XY(){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 QY($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function GY($){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 KY($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,J)=>{return`<div class="stx-static">${J.trim()}</div>`})}function qY($){let Z=$.map((J)=>({id:J.id,component:J.component,strategy:J.options.strategy,props:J.props}));return`
8599
8895
  <script type="application/json" id="stx-island-manifest">
8600
- ${JSON.stringify($)}
8896
+ ${JSON.stringify(Z)}
8601
8897
  </script>
8602
- `}var Fq;var Y9=P(()=>{Fq={processPartialHydrationDirectives:iY,processStaticDirectives:eY,generatePartialHydrationCSS:nY,generateIslandManifest:Z9,createIslandRegistry:cY,hydrateIsland:sY,hydrateByStrategy:oY,hydrateAll:rY,isHydrated:aY,onHydrated:tY}});var B9={};r(B9,{watchMultiple:()=>K9,watchEffect:()=>q9,watch:()=>G9,unref:()=>J9,toRefs:()=>X9,throttledComputed:()=>z9,stxWatchMultiple:()=>K9,stxWatchEffect:()=>q9,stxWatch:()=>G9,stxUnref:()=>J9,stxToRefs:()=>X9,stxThrottledComputed:()=>z9,stxShallowRef:()=>Q9,stxRef:()=>h5,stxIsRef:()=>$5,stxDebouncedComputed:()=>W9,stxComputed:()=>B7,shallowRef:()=>Q9,ref:()=>h5,processWatchDirectives:()=>U9,processComputedDirectives:()=>_9,isRef:()=>$5,default:()=>Vq,debouncedComputed:()=>W9,computed:()=>B7});function h5(Z){let $=Z,J=new Set,Y={get value(){if(m4){let Q=z7.get(Y);if(!Q)Q=new Set,z7.set(Y,Q);Q.add(m4)}return $},set value(Q){if(!Object.is($,Q)){$=Q,J.forEach((G)=>G(Q));let X=z7.get(Y);if(X)X.forEach((G)=>G())}},subscribe(Q){return J.add(Q),()=>J.delete(Q)},peek(){return $}};return Y}function $5(Z){return Z!==null&&typeof Z==="object"&&"value"in Z&&"subscribe"in Z&&"peek"in Z}function J9(Z){return $5(Z)?Z.value:Z}function X9(Z){let $={};for(let J in Z)if(Object.prototype.hasOwnProperty.call(Z,J))$[J]=h5(Z[J]);return $}function Q9(Z){return h5(Z)}function B7(Z){let $=typeof Z==="function",J=$?Z:Z.get,Y=$?void 0:Z.set,Q=$?Object.is:Z.equals||Object.is,X,G=!0,K=new Set,q=new Set,U=()=>{if(G=!0,q.size>0){let z=W.value;q.forEach((j)=>j(z))}};function _(){K.clear();let z=m4;m4=U,RZ.push(U);try{return J()}finally{RZ.pop(),m4=z}}let W={get value(){if(m4){let z=z7.get(W);if(!z)z=new Set,z7.set(W,z);z.add(m4)}if(G){let z=_();if(!Q(X,z))X=z;G=!1}return X},set value(z){if(Y)Y(z);else console.warn("Computed property is readonly")},subscribe(z){return q.add(z),()=>q.delete(z)},peek(){if(G)X=J(),G=!1;return X},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return W}function G9(Z,$,J={}){let{immediate:Y=!1,deep:Q=!1,flush:X="pre",once:G=!1}=J,K,q=!0,U=!1,_=()=>{if($5(Z))return Q?A5(Z.value):Z.value;return Z()},W=()=>{if(!q||U)return;let B=_();if(K!==void 0&&Object.is(K,B)&&!Q)return;let H=()=>{if($(B,K),K=Q?A5(B):B,G)j()};if(X==="sync")H();else if(X==="post")queueMicrotask(H);else Promise.resolve().then(H)},z=null;if($5(Z))z=Z.subscribe(()=>W());else z=B7(Z).subscribe(()=>W());if(Y)K=void 0,W();else K=_();let j=()=>{if(q=!1,z)z(),z=null};return j.pause=()=>{U=!0},j.resume=()=>{U=!1},j}function K9(Z,$,J={}){let{immediate:Y=!1,once:Q=!1}=J,X=Z.map((W)=>$5(W)?W.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let W=Z.map((z)=>$5(z)?z.value:void 0);if($(W,X),X=[...W],Q)_()},U=Z.map((W)=>{if($5(W))return W.subscribe(()=>q());return()=>{}});if(Y)q();let _=()=>{G=!1,U.forEach((W)=>W())};return _.pause=()=>{K=!0},_.resume=()=>{K=!1},_}function q9(Z,$={}){let{flush:J="pre"}=$,Y,Q=!0,X=!1,G=()=>{if(!Q||X)return;if(Y)Y();let q=m4;m4=G,RZ.push(G);try{Y=Z()}finally{RZ.pop(),m4=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 _9(Z,$={},J){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return Z.replace(Y,(Q,X,G)=>{try{let q=Function(...Object.keys($),`return ${G}`)(...Object.values($));return $[X]=q,`<!-- computed: ${X} = ${q} -->`}catch(K){return`<!-- computed error: ${X} - ${K} -->`}})}function U9(Z,$={},J){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return Z.replace(Y,(Q,X,G)=>{return`
8898
+ `}var Eq;var UY=P(()=>{Eq={processPartialHydrationDirectives:$Y,processStaticDirectives:KY,generatePartialHydrationCSS:ZY,generateIslandManifest:qY,createIslandRegistry:e8,hydrateIsland:YY,hydrateByStrategy:JY,hydrateAll:XY,isHydrated:QY,onHydrated:GY}});var RY={};r(RY,{watchMultiple:()=>OY,watchEffect:()=>HY,watch:()=>jY,unref:()=>WY,toRefs:()=>zY,throttledComputed:()=>NY,stxWatchMultiple:()=>OY,stxWatchEffect:()=>HY,stxWatch:()=>jY,stxUnref:()=>WY,stxToRefs:()=>zY,stxThrottledComputed:()=>NY,stxShallowRef:()=>BY,stxRef:()=>h1,stxIsRef:()=>Y1,stxDebouncedComputed:()=>VY,stxComputed:()=>B5,shallowRef:()=>BY,ref:()=>h1,processWatchDirectives:()=>FY,processComputedDirectives:()=>LY,isRef:()=>Y1,default:()=>Dq,debouncedComputed:()=>VY,computed:()=>B5});function h1($){let Z=$,J=new Set,Y={get value(){if(m0){let Q=z5.get(Y);if(!Q)Q=new Set,z5.set(Y,Q);Q.add(m0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,J.forEach((G)=>G(Q));let X=z5.get(Y);if(X)X.forEach((G)=>G())}},subscribe(Q){return J.add(Q),()=>J.delete(Q)},peek(){return Z}};return Y}function Y1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function WY($){return Y1($)?$.value:$}function zY($){let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=h1($[J]);return Z}function BY($){return h1($)}function B5($){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,U=()=>{if(G=!0,q.size>0){let z=W.value;q.forEach((j)=>j(z))}};function _(){K.clear();let z=m0;m0=U,w$.push(U);try{return J()}finally{w$.pop(),m0=z}}let W={get value(){if(m0){let z=z5.get(W);if(!z)z=new Set,z5.set(W,z);z.add(m0)}if(G){let z=_();if(!Q(X,z))X=z;G=!1}return X},set value(z){if(Y)Y(z);else console.warn("Computed property is readonly")},subscribe(z){return q.add(z),()=>q.delete(z)},peek(){if(G)X=J(),G=!1;return X},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return W}function jY($,Z,J={}){let{immediate:Y=!1,deep:Q=!1,flush:X="pre",once:G=!1}=J,K,q=!0,U=!1,_=()=>{if(Y1($))return Q?R1($.value):$.value;return $()},W=()=>{if(!q||U)return;let B=_();if(K!==void 0&&Object.is(K,B)&&!Q)return;let O=()=>{if(Z(B,K),K=Q?R1(B):B,G)j()};if(X==="sync")O();else if(X==="post")queueMicrotask(O);else Promise.resolve().then(O)},z=null;if(Y1($))z=$.subscribe(()=>W());else z=B5($).subscribe(()=>W());if(Y)K=void 0,W();else K=_();let j=()=>{if(q=!1,z)z(),z=null};return j.pause=()=>{U=!0},j.resume=()=>{U=!1},j}function OY($,Z,J={}){let{immediate:Y=!1,once:Q=!1}=J,X=$.map((W)=>Y1(W)?W.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let W=$.map((z)=>Y1(z)?z.value:void 0);if(Z(W,X),X=[...W],Q)_()},U=$.map((W)=>{if(Y1(W))return W.subscribe(()=>q());return()=>{}});if(Y)q();let _=()=>{G=!1,U.forEach((W)=>W())};return _.pause=()=>{K=!0},_.resume=()=>{K=!1},_}function HY($,Z={}){let{flush:J="pre"}=Z,Y,Q=!0,X=!1,G=()=>{if(!Q||X)return;if(Y)Y();let q=m0;m0=G,w$.push(G);try{Y=$()}finally{w$.pop(),m0=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 LY($,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 FY($,Z={},J){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(Y,(Q,X,G)=>{return`
8603
8899
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
8604
8900
  (function() {
8605
8901
  // Watch implementation for ${X}
@@ -8611,9 +8907,9 @@ else {
8611
8907
  }
8612
8908
  })();
8613
8909
  </script>
8614
- `})}function A5(Z){if(Z===null||typeof Z!=="object")return Z;if(Array.isArray(Z))return Z.map((J)=>A5(J));if(Z instanceof Date)return new Date(Z.getTime());if(Z instanceof Map){let J=new Map;return Z.forEach((Y,Q)=>J.set(A5(Q),A5(Y))),J}if(Z instanceof Set){let J=new Set;return Z.forEach((Y)=>J.add(A5(Y))),J}let $={};for(let J in Z)if(Object.prototype.hasOwnProperty.call(Z,J))$[J]=A5(Z[J]);return $}function W9(Z,$=100){let J=h5(Z()),Y=null,Q=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{J.value=Z()},$)};return B7(Z).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 z9(Z,$=100){let J=h5(Z()),Y=0,Q=()=>{let G=Date.now();if(G-Y>=$)Y=G,J.value=Z()};return B7(Z).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 m4=null,RZ,z7,Vq;var j9=P(()=>{RZ=[],z7=new WeakMap;Vq={ref:h5,computed:B7,watch:G9,watchMultiple:K9,watchEffect:q9,isRef:$5,unref:J9,toRefs:X9,shallowRef:Q9,debouncedComputed:W9,throttledComputed:z9,processComputedDirectives:_9,processWatchDirectives:U9}});var F9={};r(F9,{v:()=>Nq,processHasErrorsDirective:()=>L9,processFormValidationDirectives:()=>Rq,processErrorsDirective:()=>O9,processErrorDirective:()=>H9,defineForm:()=>Aq,Validator:()=>d5});class d5{rules=[];defaultValue="";addRule(Z){let $=new d5;return $.rules=[...this.rules,Z],$.defaultValue=this.defaultValue,$}required(Z="This field is required"){return this.addRule({name:"required",message:Z,validate:($)=>{if($===null||$===void 0)return Z;if(typeof $==="string"&&$.trim()==="")return Z;if(Array.isArray($)&&$.length===0)return Z;return!0}})}email(Z="Please enter a valid email"){return this.addRule({name:"email",message:Z,validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||Z}})}url(Z="Please enter a valid URL"){return this.addRule({name:"url",message:Z,validate:($)=>{if(!$)return!0;try{return new URL(String($)),!0}catch{return Z}}})}min(Z,$){let J=$||`Must be at least ${Z} characters`;return this.addRule({name:"min",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=Z||J}})}max(Z,$){let J=$||`Must be no more than ${Z} characters`;return this.addRule({name:"max",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=Z||J}})}length(Z,$,J){let Y=J||`Must be between ${Z} and ${$} characters`;return this.addRule({name:"length",message:Y,validate:(Q)=>{if(!Q)return!0;let X=String(Q).length;return X>=Z&&X<=$||Y}})}pattern(Z,$="Invalid format"){return this.addRule({name:"pattern",message:$,validate:(J)=>{if(!J)return!0;return Z.test(String(J))||$}})}hasUppercase(Z="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,Z)}hasLowercase(Z="Must contain a lowercase letter"){return this.pattern(/[a-z]/,Z)}hasNumber(Z="Must contain a number"){return this.pattern(/\d/,Z)}hasSpecial(Z="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,Z)}alphanumeric(Z="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,Z)}startsWithLetter(Z="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,Z)}noSpaces(Z="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:Z,validate:($)=>{if(!$)return!0;return!String($).includes(" ")||Z}})}number(Z="Must be a number"){let $=this.addRule({name:"number",message:Z,validate:(J)=>{if(!J&&J!==0)return!0;return!Number.isNaN(Number(J))||Z}});return $.defaultValue=0,$}integer(Z="Must be a whole number"){return this.addRule({name:"integer",message:Z,validate:($)=>{if(!$&&$!==0)return!0;return Number.isInteger(Number($))||Z}})}positive(Z="Must be a positive number"){return this.addRule({name:"positive",message:Z,validate:($)=>{if(!$&&$!==0)return!0;return Number($)>0||Z}})}negative(Z="Must be a negative number"){return this.addRule({name:"negative",message:Z,validate:($)=>{if(!$&&$!==0)return!0;return Number($)<0||Z}})}minValue(Z,$){let J=$||`Must be at least ${Z}`;return this.addRule({name:"minValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=Z||J}})}maxValue(Z,$){let J=$||`Must be no more than ${Z}`;return this.addRule({name:"maxValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=Z||J}})}between(Z,$,J){let Y=J||`Must be between ${Z} and ${$}`;return this.addRule({name:"between",message:Y,validate:(Q)=>{if(!Q&&Q!==0)return!0;let X=Number(Q);return X>=Z&&X<=$||Y}})}matches(Z,$){let J=$||`Must match ${Z}`;return this.addRule({name:"matches",message:J,validate:(Y,Q)=>{if(!Q)return!0;return Y===Q[Z]||J}})}oneOf(Z,$){let J=$||`Must be one of: ${Z.join(", ")}`;return this.addRule({name:"oneOf",message:J,validate:(Y)=>{if(!Y)return!0;return Z.includes(Y)||J}})}notOneOf(Z,$){let J=$||`Cannot be one of: ${Z.join(", ")}`;return this.addRule({name:"notOneOf",message:J,validate:(Y)=>{if(!Y)return!0;return!Z.includes(Y)||J}})}date(Z="Must be a valid date"){return this.addRule({name:"date",message:Z,validate:($)=>{if(!$)return!0;let J=new Date(String($));return!Number.isNaN(J.getTime())||Z}})}before(Z,$){let J=new Date(Z),Y=$||`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(Z),Y=$||`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:$,validate:Z})}async(Z,$="Invalid value"){return this.addRule({name:"async",message:$,async:!0,validate:Z})}when(Z,$){let J=new d5;J.rules=[...this.rules],J.defaultValue=this.defaultValue;for(let Y of $.getRules())J.rules.push({...Y,validate:(Q,X)=>{if(!Z(Q,X||{}))return!0;return Y.validate(Q,X)}});return J}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(Z){let $=new d5;return $.rules=[...this.rules],$.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 Aq(Z,$){let J=Object.keys(Z),Y={},Q={},X={},G={},K={};for(let O of J)Y[O]=$?.[O]??Z[O].getDefaultValue(),Q[O]=[],X[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function U(O){K[O]=!0;let V=await Z[O].validate(Y[O],Y);return Q[O]=V,K[O]=!1,V.length===0}async function _(){q=!0;let O=await Promise.all(J.map(U));return q=!1,O.every(Boolean)}function W(){for(let O of J)Y[O]=$?.[O]??Z[O].getDefaultValue(),Q[O]=[],X[O]=!1,G[O]=!1}function z(O){for(let V of J)if(V in O)Y[V]=O[V],G[V]=!0}function j(O,V){Y[O]=V,G[O]=!0}function B(O,V=!0){if(X[O]=V,V)U(O)}function H(O){return{value:Y[O],errors:Q[O],touched:X[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function F(O){return async(V)=>{V?.preventDefault?.();for(let N of J)X[N]=!0;if(await _())await O(Y)}}return{values:Y,errors:Q,touched:X,dirty:G,get isValid(){return J.every((O)=>Q[O].length===0)},get isValidating(){return q||J.some((O)=>K[O])},get isDirty(){return J.some((O)=>G[O])},validate:_,validateField:U,reset:W,setValues:z,setFieldValue:j,setFieldTouched:B,getFieldState:H,handleSubmit:F}}function H9(Z,$,J){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return Z.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=$;for(let _ of K)if(q&&typeof q==="object"&&_ in q)q=q[_];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((_)=>{return G.replace(/\{\{\s*message\s*\}\}/g,_)}).join(`
8615
- `)}catch{return""}})}function O9(Z,$,J){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return Z.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=$;for(let _ of K)if(q&&typeof q==="object"&&_ in q)q=q[_];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((_)=>G.replace(/\{\{\s*message\s*\}\}/g,_)).join(`
8616
- `)}catch{return""}})}function L9(Z,$,J){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return Z.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=$;for(let _ of K)if(q&&typeof q==="object"&&_ in q)q=q[_];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return G}catch{return""}})}function Rq(Z,$,J){let Y=Z;return Y=H9(Y,$,J),Y=O9(Y,$,J),Y=L9(Y,$,J),Y}var Nq;var V9=P(()=>{Nq=new d5});var R9={};r(R9,{processXElementDirectives:()=>wq,hasXElementDirectives:()=>A9,generateXElementRuntime:()=>N9});function N9(){return`<script data-stx-scoped>
8910
+ `})}function R1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>R1(J));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let J=new Map;return $.forEach((Y,Q)=>J.set(R1(Q),R1(Y))),J}if($ instanceof Set){let J=new Set;return $.forEach((Y)=>J.add(R1(Y))),J}let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=R1($[J]);return Z}function VY($,Z=100){let J=h1($()),Y=null,Q=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{J.value=$()},Z)};return B5($).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 NY($,Z=100){let J=h1($()),Y=0,Q=()=>{let G=Date.now();if(G-Y>=Z)Y=G,J.value=$()};return B5($).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 m0=null,w$,z5,Dq;var AY=P(()=>{w$=[],z5=new WeakMap;Dq={ref:h1,computed:B5,watch:jY,watchMultiple:OY,watchEffect:HY,isRef:Y1,unref:WY,toRefs:zY,shallowRef:BY,debouncedComputed:VY,throttledComputed:NY,processComputedDirectives:LY,processWatchDirectives:FY}});var IY={};r(IY,{v:()=>kq,processHasErrorsDirective:()=>MY,processFormValidationDirectives:()=>bq,processErrorsDirective:()=>TY,processErrorDirective:()=>wY,defineForm:()=>Sq,Validator:()=>d1});class d1{rules=[];defaultValue="";addRule($){let Z=new d1;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 d1;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 d1;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 U(H){K[H]=!0;let V=await $[H].validate(Y[H],Y);return Q[H]=V,K[H]=!1,V.length===0}async function _(){q=!0;let H=await Promise.all(J.map(U));return q=!1,H.every(Boolean)}function W(){for(let H of J)Y[H]=Z?.[H]??$[H].getDefaultValue(),Q[H]=[],X[H]=!1,G[H]=!1}function z(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)U(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 N of J)X[N]=!0;if(await _())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:_,validateField:U,reset:W,setValues:z,setFieldValue:j,setFieldTouched:B,getFieldState:O,handleSubmit:F}}function wY($,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 _ of K)if(q&&typeof q==="object"&&_ in q)q=q[_];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((_)=>{return G.replace(/\{\{\s*message\s*\}\}/g,_)}).join(`
8911
+ `)}catch{return""}})}function TY($,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 _ of K)if(q&&typeof q==="object"&&_ in q)q=q[_];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((_)=>G.replace(/\{\{\s*message\s*\}\}/g,_)).join(`
8912
+ `)}catch{return""}})}function MY($,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 _ of K)if(q&&typeof q==="object"&&_ in q)q=q[_];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return G}catch{return""}})}function bq($,Z,J){let Y=$;return Y=wY(Y,Z,J),Y=TY(Y,Z,J),Y=MY(Y,Z,J),Y}var kq;var EY=P(()=>{kq=new d1});var SY={};r(SY,{processXElementDirectives:()=>yq,hasXElementDirectives:()=>kY,generateXElementRuntime:()=>DY});function DY(){return`<script data-stx-scoped>
8617
8913
  (function() {
8618
8914
  'use strict';
8619
8915
 
@@ -8897,16 +9193,16 @@ else {
8897
9193
  // Expose for manual initialization
8898
9194
  window.XElement = XElement;
8899
9195
  })();
8900
- </script>`}function A9(Z){return/\bx-(data|model|text|show|init|html)\b/.test(Z)||/\s:[a-z]/.test(Z)}function wq(Z){if(!A9(Z))return Z;let $=N9(),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+$+`
8901
- `+Z.slice(J);return Z+`
8902
- `+$}var w9=()=>{};function p0(Z){return Z.pwa?.serviceWorker?.fileName||"sw.js"}var T9=P(()=>{w9()});var M9={};r(M9,{injectPwaTags:()=>Tq,generateThemeColorMeta:()=>Eq,generateSwRegistrationScript:()=>Mq,generatePwaTags:()=>wZ,generateManifestLink:()=>Iq});function wZ(Z){let $=Z.pwa;if(!$?.enabled)return"";let J=$.manifest,Y=$.icons?.outputDir?`/${$.icons.outputDir}`:"/pwa-icons",Q=p0(Z),X=`
9196
+ </script>`}function kY($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function yq($){if(!kY($))return $;let Z=DY(),J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+`
9197
+ `+$.slice(J);return $+`
9198
+ `+Z}var bY=()=>{};function o7($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var yY=P(()=>{bY()});var CY={};r(CY,{injectPwaTags:()=>Cq,generateThemeColorMeta:()=>xq,generateSwRegistrationScript:()=>Pq,generatePwaTags:()=>T$,generateManifestLink:()=>vq});function T$($){let Z=$.pwa;if(!Z?.enabled)return"";let J=Z.manifest,Y=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=o7($),X=`
8903
9199
  <!-- stx PWA Meta Tags -->
8904
9200
  <link rel="manifest" href="/manifest.json">
8905
- <meta name="theme-color" content="${l0(J?.themeColor||"#000000")}">
9201
+ <meta name="theme-color" content="${s7(J?.themeColor||"#000000")}">
8906
9202
  <meta name="mobile-web-app-capable" content="yes">
8907
9203
  <meta name="apple-mobile-web-app-capable" content="yes">
8908
9204
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
8909
- <meta name="apple-mobile-web-app-title" content="${l0(J?.shortName||J?.name||"App")}">`;if($.icons?.generateAppleIcons!==!1)X+=`
9205
+ <meta name="apple-mobile-web-app-title" content="${s7(J?.shortName||J?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)X+=`
8910
9206
  <link rel="apple-touch-icon" href="${Y}/apple-touch-icon.png">
8911
9207
  <link rel="apple-touch-icon" sizes="120x120" href="${Y}/apple-touch-icon-120x120.png">
8912
9208
  <link rel="apple-touch-icon" sizes="152x152" href="${Y}/apple-touch-icon-152x152.png">
@@ -8943,12 +9239,12 @@ if ('serviceWorker' in navigator) {
8943
9239
  });
8944
9240
  }
8945
9241
  </script>
8946
- <!-- End stx PWA -->`,X}function Tq(Z,$){let J=$.pwa;if(!J?.enabled||J.autoInject===!1)return Z;if(Z.includes("<!-- stx PWA Meta Tags -->"))return Z;if(!Z.includes("</head>")){let Q=Z.lastIndexOf("</body>");if(Q!==-1){let X=wZ($);return Z.slice(0,Q)+X+`
8947
- `+Z.slice(Q)}return Z+wZ($)}let Y=wZ($);return Z.replace("</head>",`${Y}
8948
- </head>`)}function Mq(Z){if(!Z.pwa?.enabled)return"";return`<script>
9242
+ <!-- End stx PWA -->`,X}function Cq($,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=T$(Z);return $.slice(0,Q)+X+`
9243
+ `+$.slice(Q)}return $+T$(Z)}let Y=T$(Z);return $.replace("</head>",`${Y}
9244
+ </head>`)}function Pq($){if(!$.pwa?.enabled)return"";return`<script>
8949
9245
  if ('serviceWorker' in navigator) {
8950
9246
  window.addEventListener('load', function() {
8951
- navigator.serviceWorker.register('/${p0(Z)}')
9247
+ navigator.serviceWorker.register('/${o7($)}')
8952
9248
  .then(function(registration) {
8953
9249
  console.log('[PWA] Service Worker registered:', registration.scope);
8954
9250
  })
@@ -8957,67 +9253,67 @@ if ('serviceWorker' in navigator) {
8957
9253
  });
8958
9254
  });
8959
9255
  }
8960
- </script>`}function Iq(){return'<link rel="manifest" href="/manifest.json">'}function Eq(Z){return`<meta name="theme-color" content="${l0(Z)}">`}function l0(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var I9=P(()=>{T9()});import E4 from"path";async function o4(Z,$,J,Y,Q){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return Z;let X=!$.__stxProcessingDepth;if(!$.__stxProcessingDepth)$.__stxProcessingDepth=0;if($.__stxProcessingDepth++,!$.__onceStore)$.__onceStore=new Set;try{return await R$.timeAsync("template-processing",async()=>{let G=await Dq(Z,$,J,Y,Q);if(X)G=f0(G);if(X&&Y.autoShell&&Y.buildMode!=="compile"){let K=Y.app?.head||{},U=($.__stx_runtime_head||null)??i5(),_={...K,...U.title&&{title:U.title},meta:[...K.meta||[],...U.meta||[]],link:[...K.link||[],...U.link||[]],script:[...K.script||[],...U.script||[]],...U.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...U.htmlAttrs}},...U.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...U.bodyAttrs}}};G=h1(G,_);let W=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(W&&G.includes("<head")){let j=W[1];G=G.replace("<head>",`<head>
8961
- <meta name="stx-layout" content="${j}">`)}let z=G.match(/function (__stx_setup_\d+_\d+)\(/);if(z&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${z[1]}">`);let j=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${z[1]}"`,"i");G=G.replace(j,"$1")}}if(X)try{let{getStoreScript:K}=await Promise.resolve().then(() => (FY(),LY)),q=Y.storesDir,U=await K(q);if(U){let _=`<script data-stx-stores>${U}</script>`,W=G.indexOf("<script data-stx-scoped>");if(W!==-1){let z=G.indexOf("</script>",W+24);if(z!==-1){let j=z+9;G=G.slice(0,j)+`
8962
- `+_+G.slice(j)}}}}catch{}if(X)G=await Y7(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof o7)throw G;let K=G instanceof Error?G.message:String(G),q=new B5(`Template processing failed: ${K}`,J,void 0,void 0,Z.substring(0,200)+(Z.length>200?"...":""));if(j5.log(q,{filePath:J,context:$}),E6.logDetailedError(q,{filePath:J,template:Z.substring(0,500)}),Y.debug)throw q;return M6.createFallbackContent("Template Processing",q)}}async function Dq(Z,$,J,Y,Q){let X=process.cwd(),G={...Y,partialsDir:Y.partialsDir&&!E4.isAbsolute(Y.partialsDir)?E4.resolve(X,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!E4.isAbsolute(Y.componentsDir)?E4.resolve(X,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!E4.isAbsolute(Y.layoutsDir)?E4.resolve(X,Y.layoutsDir):Y.layoutsDir},K=G,q=Z;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,U),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(H,F)=>{return`{{ ${F} }}`}),q=v1(q),q=await BY(q,J,Q);let _={};q=$0(q,_);let W={...$.__sections||{}},z="",j=/@nolayout\b/.test(q);if(j)q=q.replace(/@nolayout\b\s*/g,"");let B=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B)z=B[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!z&&!j&&K.defaultLayout){let H=/<!DOCTYPE\s/i.test(q),F=/@section\s*\(/.test(q);if(!H||F){let L="",O=E4.dirname(J),V=K.layoutsDir?E4.dirname(K.layoutsDir):process.cwd();for(let A=0;A<20;A++){let N=E4.join(O,"_layout.stx");if(await c(N)){L=N;break}let R=E4.dirname(O);if(R===O||R.length<V.length)break;O=R}if(L)z=L;else if(K.layoutsDir){let A=E4.isAbsolute(K.layoutsDir)?K.layoutsDir:E4.resolve(process.cwd(),K.layoutsDir),N=E4.join(A,`${K.defaultLayout}.stx`);if(await c(N))z=N}if(z&&!F)q=`@section('content')
9256
+ </script>`}function vq(){return'<link rel="manifest" href="/manifest.json">'}function xq($){return`<meta name="theme-color" content="${s7($)}">`}function s7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var PY=P(()=>{yY()});import E0 from"path";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 E6.timeAsync("template-processing",async()=>{let G=await fq($,Z,J,Y,Q);if(X)G=u7(G);if(X&&Y.autoShell&&Y.buildMode!=="compile"){let K=Y.app?.head||{},U=(Z.__stx_runtime_head||null)??i1(),_={...K,...U.title&&{title:U.title},meta:[...K.meta||[],...U.meta||[]],link:[...K.link||[],...U.link||[]],script:[...K.script||[],...U.script||[]],...U.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...U.htmlAttrs}},...U.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...U.bodyAttrs}}};G=l9(G,_);let W=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(W&&G.includes("<head")){let j=W[1];G=G.replace("<head>",`<head>
9257
+ <meta name="stx-layout" content="${j}">`)}let z=G.match(/function (__stx_setup_\d+_\d+)\(/);if(z&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${z[1]}">`);let j=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${z[1]}"`,"i");G=G.replace(j,"$1")}}if(X)try{let{getStoreScript:K}=await Promise.resolve().then(() => (I8(),M8)),q=Y.storesDir,U=await K(q);if(U){let _=`<script data-stx-stores>${U}</script>`,W=G.indexOf("<script data-stx-scoped>");if(W!==-1){let z=G.indexOf("</script>",W+24);if(z!==-1){let j=z+9;G=G.slice(0,j)+`
9258
+ `+_+G.slice(j)}}}}catch{}if(X)G=await Y5(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof s5)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(O1.log(q,{filePath:J,context:Z}),D4.logDetailedError(q,{filePath:J,template:$.substring(0,500)}),Y.debug)throw q;return I4.createFallbackContent("Template Processing",q)}}async function fq($,Z,J,Y,Q){let X=process.cwd(),G={...Y,partialsDir:Y.partialsDir&&!E0.isAbsolute(Y.partialsDir)?E0.resolve(X,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!E0.isAbsolute(Y.componentsDir)?E0.resolve(X,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!E0.isAbsolute(Y.layoutsDir)?E0.resolve(X,Y.layoutsDir):Y.layoutsDir},K=G,q=$;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,U),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,F)=>{return`{{ ${F} }}`}),q=d9(q),q=await R8(q,J,Q);let _={};q=Y7(q,_);let W={...Z.__sections||{}},z="",j=/@nolayout\b/.test(q);if(j)q=q.replace(/@nolayout\b\s*/g,"");let B=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B)z=B[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!z&&!j&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),F=/@section\s*\(/.test(q);if(!O||F){let L="",H=E0.dirname(J),V=K.layoutsDir?E0.dirname(K.layoutsDir):process.cwd();for(let R=0;R<20;R++){let N=E0.join(H,"_layout.stx");if(await c(N)){L=N;break}let A=E0.dirname(H);if(A===H||A.length<V.length)break;H=A}if(L)z=L;else if(K.layoutsDir){let R=E0.isAbsolute(K.layoutsDir)?K.layoutsDir:E0.resolve(process.cwd(),K.layoutsDir),N=E0.join(R,`${K.defaultLayout}.stx`);if(await c(N))z=N}if(z&&!F)q=`@section('content')
8963
9259
  ${q.trim()}
8964
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(H,F,L)=>{return W[F]=L,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(H,F,L)=>{if(L.includes("@parent"))W[F]=L.replace("@parent","<!--PARENT_CONTENT_PLACEHOLDER-->");else W[F]=L.trim();return""}),$.__sections=W,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(H,F,L)=>{return W[F]||L||""}),!("slot"in $)||$.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""});if(q=Y0(q,_),z)try{let H=E4.isAbsolute(z)?z:await E5(()=>pZ(z,J,G,Q),null,()=>{throw new B5(`Failed to resolve layout path: ${z}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!H){let N=`Layout not found: ${z} (referenced from ${J})`;if(j5.log(Error(N),{layoutPath:z,filePath:J},"warning"),G.debug)throw new B5(N,J);return q}let F=await E5(()=>Bun.file(H).text(),"",()=>{throw new B5(`Failed to read layout file: ${H}`,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 ${H}`);let N={},R=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,T,I)=>{return N[T]=I.trim(),""});for(let[E,T]of Object.entries(N))if(W[E]&&W[E].includes("<!--PARENT_CONTENT_PLACEHOLDER-->")){let I=W[E].indexOf("<!--PARENT_CONTENT_PLACEHOLDER-->");W[E]=W[E].slice(0,I)+T+W[E].slice(I+33)}else if(!W[E])W[E]=T;let w={...$,__sections:W},M=`@layout('${L[1]}')${R}`;return await o4(M,w,H,G,Q)}let O=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),V=$0(O,_),A={};return V=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,R,w)=>{return A[R]=w.trim(),`@slot('${R}')`}),V=V.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,R,w)=>{if(W[R]){let M=W[R];if(M.includes("<!--PARENT_CONTENT_PLACEHOLDER-->")){let E=A[R]||"",T=M.indexOf("<!--PARENT_CONTENT_PLACEHOLDER-->");M=M.slice(0,T)+E+M.slice(T+33)}return M}return w||""}),V=V.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""}),V=Y0(V,_),$.__originalFilePath=J,q=await E9(V,$,H,G,Q),q=`<!-- stx-layout: ${z} -->
8965
- ${q}`,q}catch(H){return j5.log(H instanceof Error?H:Error(String(H)),{layoutPath:z,filePath:J},"error"),`[Error processing layout: ${H instanceof Error?H.message:String(H)}]`}return await E9(q,$,J,G,Q)}async function E9(Z,$,J,Y,Q){let X=Z;$.__stx_sfc_mode=!0;let G=Y;if(await E5(()=>k1(J,$),void 0,(g)=>{if(G.debug)console.warn(`View composer error for ${J}:`,g.message)}),$.__stx_options=G,G.buildMode)$.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",q={};for(let[g,m]of Object.entries(process.env))if(g.startsWith(K)&&m!==void 0)q[g]=m;$.$env=q,X=await E5(()=>T1(X,$,J,G),X,(g)=>{if(G.debug)console.warn("Pre-processing middleware error:",g.message)});let U=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,_;while((_=U.exec(X))!==null){let g=_[1],m=_[2];if(/\bserver\b/.test(g)&&m.trim())try{let{extractVariables:$4}=await Promise.resolve().then(() => (o5(),A7));await $4(m,$,J)}catch($4){if(G.debug)console.warn("Script extraction error:",$4)}}try{let{interpolateScriptsInTemplate:g}=await Promise.resolve().then(() => (n4(),V$));X=g(X,$,{skipServer:!0})}catch(g){if(G.debug)console.warn("Script expression interpolation error:",g)}if(X=await F1(X,$,J),X=await V1(X,$,J),X=await r3(X,$,J,G),L7(X))X=F0(X),X=V0(X,$);X=a6(X,$,J,G),X=await P0(X,$,J,G,Q),X=await f1(X,$,J,G,Q),X=e0(X,$,J,G);let{processDeferDirectives:W}=await Promise.resolve().then(() => NY);X=W(X,$,J);let{processTeleportDirectives:z}=await Promise.resolve().then(() => RY);X=z(X,$,J);let{processTransitionDirectives:j,processTransitionAttributes:B}=await Promise.resolve().then(() => IY);X=j(X,$,J),X=B(X);let{processErrorBoundaryDirectives:H}=await Promise.resolve().then(() => DY);X=H(X,$,J);let{processSuspenseDirectives:F}=await Promise.resolve().then(() => kY);X=F(X,$,J);let{processAsyncDirectives:L}=await Promise.resolve().then(() => CY);X=L(X,$,J);let{processKeepAliveDirectives:O}=await Promise.resolve().then(() => vY);X=O(X,$,J);let{processVirtualListDirectives:V,processVirtualGridDirectives:A,processInfiniteListDirectives:N}=await Promise.resolve().then(() => (mY(),dY));X=V(X,$,J),X=A(X,$,J),X=N(X,$,J);let{processPartialHydrationDirectives:R,processStaticDirectives:w}=await Promise.resolve().then(() => (Y9(),$9));X=R(X,$,J),X=w(X);let{processComputedDirectives:M,processWatchDirectives:E}=await Promise.resolve().then(() => (j9(),B9));X=M(X,$,J),X=E(X,$,J);let{processFormValidationDirectives:T}=await Promise.resolve().then(() => (V9(),F9));X=T(X,$,J);let{processHeadDirective:I,processTitleDirective:D,processMetaDirective:y,resetHead:b}=await Promise.resolve().then(() => (n5(),hZ));if(!$.__stx_head_preset&&!$.__stx_runtime_head)b();let S=I(X);if(X=S.content,X=D(X,$),X=y(X,$),X=E1(X),X=u6(X,$),X=s3(X),X=R1(X),X=await Z0(X,$,J,G,Q),X=await P0(X,$,J,G,Q),X=f0(X),X=b5(X,$,J),X=p6(X,$),X=l6(X,$),X=GZ(X,$),X=$1(X,$),X=Y1(X,$),X=await P3(X,$,J,G),X=await l$(X,$,J),X=await _1(X,$,J,G),X=i0(X,$,J,G),X=t8(X,$,J,G),X=e8(X,$,J),X=Z3(X,$,J,G),X=c3(X,$,J,G),X=v0(X,$),X=x0(X),X=HY(X),!G.skipEventDirectives)X=k3(X,$,J);if(X=C3(X,$,J),G.debug){let g=/\bx-data\s*=/.test(X),m=LZ(Z);if(g&&m)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
9260
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,F,L)=>{return W[F]=L,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,F,L)=>{if(L.includes("@parent"))W[F]=L.replace("@parent","<!--PARENT_CONTENT_PLACEHOLDER-->");else W[F]=L.trim();return""}),Z.__sections=W,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,F,L)=>{return W[F]||L||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""});if(q=J7(q,_),z)try{let O=E0.isAbsolute(z)?z:await E1(()=>l$(z,J,G,Q),null,()=>{throw new j1(`Failed to resolve layout path: ${z}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!O){let N=`Layout not found: ${z} (referenced from ${J})`;if(O1.log(Error(N),{layoutPath:z,filePath:J},"warning"),G.debug)throw new j1(N,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 N={},A=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,T,I)=>{return N[T]=I.trim(),""});for(let[E,T]of Object.entries(N))if(W[E]&&W[E].includes("<!--PARENT_CONTENT_PLACEHOLDER-->")){let I=W[E].indexOf("<!--PARENT_CONTENT_PLACEHOLDER-->");W[E]=W[E].slice(0,I)+T+W[E].slice(I+33)}else if(!W[E])W[E]=T;let w={...Z,__sections:W},M=`@layout('${L[1]}')${A}`;return await r0(M,w,O,G,Q)}let H=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),V=Y7(H,_),R={};return V=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,A,w)=>{return R[A]=w.trim(),`@slot('${A}')`}),V=V.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,A,w)=>{if(W[A]){let M=W[A];if(M.includes("<!--PARENT_CONTENT_PLACEHOLDER-->")){let E=R[A]||"",T=M.indexOf("<!--PARENT_CONTENT_PLACEHOLDER-->");M=M.slice(0,T)+E+M.slice(T+33)}return M}return w||""}),V=V.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""}),V=J7(V,_),Z.__originalFilePath=J,q=await vY(V,Z,O,G,Q),q=`<!-- stx-layout: ${z} -->
9261
+ ${q}`,q}catch(O){return O1.log(O instanceof Error?O:Error(String(O)),{layoutPath:z,filePath:J},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return await vY(q,Z,J,G,Q)}async function vY($,Z,J,Y,Q){let X=$;Z.__stx_sfc_mode=!0;let G=Y;if(await E1(()=>P9(J,Z),void 0,(g)=>{if(G.debug)console.warn(`View composer error for ${J}:`,g.message)}),Z.__stx_options=G,G.buildMode)Z.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",q={};for(let[g,m]of Object.entries(process.env))if(g.startsWith(K)&&m!==void 0)q[g]=m;Z.$env=q,X=await E1(()=>k9(X,Z,J,G),X,(g)=>{if(G.debug)console.warn("Pre-processing middleware error:",g.message)});let U=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,_;while((_=U.exec(X))!==null){let g=_[1],m=_[2];if(/\bserver\b/.test(g)&&m.trim())try{let{extractVariables:Z0}=await Promise.resolve().then(() => (s1(),R5));await Z0(m,Z,J)}catch(Z0){if(G.debug)console.warn("Script extraction error:",Z0)}}try{let{interpolateScriptsInTemplate:g}=await Promise.resolve().then(() => (o0(),T6));X=g(X,Z,{skipServer:!0})}catch(g){if(G.debug)console.warn("Script expression interpolation error:",g)}if(X=await w9(X,Z,J),X=await T9(X,Z,J),X=await Z9(X,Z,J,G),L5(X))X=V7(X),X=N7(X,Z);X=t4(X,Z,J,G),X=await h7(X,Z,J,G,Q),X=await u9(X,Z,J,G,Q),X=X6(X,Z,J,G);let{processDeferDirectives:W}=await Promise.resolve().then(() => D8);X=W(X,Z,J);let{processTeleportDirectives:z}=await Promise.resolve().then(() => S8);X=z(X,Z,J);let{processTransitionDirectives:j,processTransitionAttributes:B}=await Promise.resolve().then(() => P8);X=j(X,Z,J),X=B(X);let{processErrorBoundaryDirectives:O}=await Promise.resolve().then(() => x8);X=O(X,Z,J);let{processSuspenseDirectives:F}=await Promise.resolve().then(() => f8);X=F(X,Z,J);let{processAsyncDirectives:L}=await Promise.resolve().then(() => m8);X=L(X,Z,J);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => p8);X=H(X,Z,J);let{processVirtualListDirectives:V,processVirtualGridDirectives:R,processInfiniteListDirectives:N}=await Promise.resolve().then(() => (s8(),o8));X=V(X,Z,J),X=R(X,Z,J),X=N(X,Z,J);let{processPartialHydrationDirectives:A,processStaticDirectives:w}=await Promise.resolve().then(() => (UY(),_Y));X=A(X,Z,J),X=w(X);let{processComputedDirectives:M,processWatchDirectives:E}=await Promise.resolve().then(() => (AY(),RY));X=M(X,Z,J),X=E(X,Z,J);let{processFormValidationDirectives:T}=await Promise.resolve().then(() => (EY(),IY));X=T(X,Z,J);let{processHeadDirective:I,processTitleDirective:D,processMetaDirective:y,resetHead:b}=await Promise.resolve().then(() => (n1(),d$));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)b();let S=I(X);if(X=S.content,X=D(X,Z),X=y(X,Z),X=y9(X),X=p4(X,Z),X=e3(X),X=E9(X),X=await Z7(X,Z,J,G,Q),X=await h7(X,Z,J,G,Q),X=u7(X),X=b1(X,Z,J),X=l4(X,Z),X=c4(X,Z),X=G$(X,Z),X=G9(X,Z),X=K9(X,Z),X=await h3(X,Z,J,G),X=await s6(X,Z,J),X=await j9(X,Z,J,G),X=a7(X,Z,J,G),X=J3(X,Z,J,G),X=X3(X,Z,J),X=Q3(X,Z,J,G),X=r3(X,Z,J,G),X=d7(X,Z),X=m7(X),X=w8(X),!G.skipEventDirectives)X=P3(X,Z,J);if(X=g3(X,Z,J),G.debug){let g=/\bx-data\s*=/.test(X),m=L$($);if(g&&m)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
8966
9262
  Both work on the same page, but they manage separate scopes.
8967
- Prefer signals (state/derived/effect) for new components.`)}X=y1(X,$),X=await K5(X,$,J),X=OY(X),X=N3(X);let{processXElementDirectives:k}=await Promise.resolve().then(() => R9);if(X=k(X),X=await N0(X,G,J),X=await M1(X,$,J,G),G.seo?.enabled)X=$3(X,$,G);let{renderHead:f,getHead:h}=await Promise.resolve().then(() => (n5(),hZ)),p=$.__stx_runtime_head,z4=p&&(p.title||p.meta?.length||p.link?.length)?p:h();if(z4.title||z4.meta?.length||z4.link?.length){let g=f(z4);if(g){if(X.includes("</head>"))X=X.replace("</head>",`${g}
9263
+ Prefer signals (state/derived/effect) for new components.`)}X=f9(X,Z),X=await q1(X,Z,J),X=T8(X),X=M3(X);let{processXElementDirectives:k}=await Promise.resolve().then(() => SY);if(X=k(X),X=await R7(X,G,J),X=await S9(X,Z,J,G),G.seo?.enabled)X=G3(X,Z,G);let{renderHead:f,getHead:h}=await Promise.resolve().then(() => (n1(),d$)),p=Z.__stx_runtime_head,z0=p&&(p.title||p.meta?.length||p.link?.length)?p:h();if(z0.title||z0.meta?.length||z0.link?.length){let g=f(z0);if(g){if(X.includes("</head>"))X=X.replace("</head>",`${g}
8968
9264
  </head>`);else if(X.includes("<head>"))X=X.replace("<head>",`<head>
8969
9265
  ${g}`)}}if(S.headContent){if(X.includes("</head>"))X=X.replace("</head>",`${S.headContent}
8970
9266
  </head>`);else if(X.includes("<head>"))X=X.replace("<head>",`<head>
8971
- ${S.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)X=l3(X,G.csp,$);if(G.analytics?.enabled)X=R3(X,G);if(G.heatmap?.enabled)X=X$(X,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:g}=await Promise.resolve().then(() => (I9(),M9));X=g(X,G)}let M4=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),U4=/\bSTX\.\w+/.test(X),b4=/window\.STX\s*=/.test(X);if(M4&&U4&&!b4){let m=`<script data-stx-scoped>
8972
- ${O3()}
8973
- </script>`;if(X.includes("</head>")){let _4=X.indexOf("</head>"),G4=X.slice(0,_4).indexOf("<script");if(G4!==-1){let F4=X.slice(0,G4),v4=X.slice(G4);X=F4+m+`
8974
- `+v4}else X=X.replace("</head>",`${m}
9267
+ ${S.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)X=s3(X,G.csp,Z);if(G.analytics?.enabled)X=E3(X,G);if(G.heatmap?.enabled)X=_6(X,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:g}=await Promise.resolve().then(() => (PY(),CY));X=g(X,G)}let M0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),U0=/\bSTX\.\w+/.test(X),b0=/window\.STX\s*=/.test(X);if(M0&&U0&&!b0){let m=`<script data-stx-scoped>
9268
+ ${R3()}
9269
+ </script>`;if(X.includes("</head>")){let _0=X.indexOf("</head>"),G0=X.slice(0,_0).indexOf("<script");if(G0!==-1){let F0=X.slice(0,G0),v0=X.slice(G0);X=F0+m+`
9270
+ `+v0}else X=X.replace("</head>",`${m}
8975
9271
  </head>`)}else if(X.includes("<body"))X=X.replace(/<body([^>]*)>/,`<body$1>
8976
9272
  ${m}`);else X=m+`
8977
- `+X}{let g=/<script\s+server\b[^>]*>/gi,m,_4=[];while((m=g.exec(X))!==null){let $4=m.index+m[0].length,G4=1,F4=$4;while(F4<X.length&&G4>0){let v4=X.indexOf("<script",F4),x4=X.indexOf("</script>",F4);if(x4===-1)break;if(v4!==-1&&v4<x4)G4++,F4=v4+7;else{if(G4--,G4===0){let Y5=x4+9;while(Y5<X.length&&/\s/.test(X[Y5]))Y5++;_4.push({start:m.index,end:Y5});break}F4=x4+9}}}for(let $4=_4.length-1;$4>=0;$4--){let{start:G4,end:F4}=_4[$4];X=X.substring(0,G4)+X.substring(F4)}}let P4=F7(X,J);if(P4.hasScoped)X=P4.html;let L4=$.__stx_event_bindings||[],C=!1,v=[],x=/\s:[a-z][\w.-]*\s*=/.test(X),{scanScriptTags:l}=await Promise.resolve().then(() => (A0(),o1));for(let g of l(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))v.push({match:g.fullMatch,attrs:g.attrs,content:g.body});for(let{match:g,attrs:m,content:_4}of v){C=!0;let $4=_4;h0(_4,J,Y.strict);let G4=await j7(_4,{eventBindings:L4,attrs:m,hasColonDirectives:x,templateContent:Z,filePath:J,projectRoot:process.cwd(),production:Y.buildMode==="compile"});X=X.replace(g,()=>G4)}if(C)$.__stx_event_bindings=[];return X}var lZ=P(()=>{e7();EZ();L3();A3();w3();SZ();DZ();S3();CZ();v3();JZ();i3();o3();t3();l4();n5();n4();J1();U1();L1();A1();t6();cZ();I1();T5();D1();D6();V4();S1();C1();x1();g1();gZ();A0();UY();jY();g0();d0();g0();d0()});import j4 from"fs";import Y4 from"path";import{matchRoute as nq,Router as m9}from"stx-router";import{findErrorPage as rq,formatRoutes as aq,generateRouteManifest as tq,generateRouteTypes as eq,matchRoute as Z_}from"stx-router";function IZ(Z,$={}){return new m9(Z,$).routes}lZ();Z7();e7();import{abortNavigation as sH,clearMiddleware as D9,createClientCookieManager as oH,createMiddlewareContext as k9,createRouteLocation as S9,createServerCookieManager as rH,createStorageManager as aH,defineMiddleware as tH,getMiddleware as eH,getMiddlewareNames as b9,hasMiddleware as ZO,loadMiddlewareFromDirectory as y9,navigateTo as $O,registerMiddleware as YO,runMiddleware as C9}from"stx-router";class P9{cacheDir;cache=new Map;loaded=!1;constructor(Z){this.cacheDir=Z}async load(){if(this.loaded)return;let Z=Y4.join(this.cacheDir,"build-cache.json");if(await Bun.file(Z).exists())try{let $=JSON.parse(await Bun.file(Z).text());for(let[J,Y]of Object.entries($))this.cache.set(J,Y)}catch{}this.loaded=!0}async save(){await j4.promises.mkdir(this.cacheDir,{recursive:!0});let Z=Y4.join(this.cacheDir,"build-cache.json"),$={};for(let[J,Y]of this.cache)$[J]=Y;await Bun.write(Z,JSON.stringify($))}getHash(Z,$){let J=j4.statSync(Z),Y=`${Z}:${J.mtimeMs}`;for(let X of $)if(j4.existsSync(X)){let G=j4.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(Z);if(!Y)return null;let Q=this.getHash($,J);if(Y.hash!==Q)return this.cache.delete(Z),null;return Y.html}set(Z,$,J,Y){let Q=this.getHash($,J);this.cache.set(Z,{hash:Q,html:Y,generatedAt:Date.now(),dependencies:J})}}class v9{cacheDir;constructor(Z){this.cacheDir=Z}getFilePath(Z){let $=Z.replace(/[^a-zA-Z0-9]/g,"_")+".json";return Y4.join(this.cacheDir,"isr",$)}async get(Z){let $=this.getFilePath(Z);if(!await Bun.file($).exists())return null;try{return JSON.parse(await Bun.file($).text())}catch{return null}}async set(Z,$){let J=this.getFilePath(Z);await j4.promises.mkdir(Y4.dirname(J),{recursive:!0}),await Bun.write(J,JSON.stringify($))}async invalidate(Z){let $=this.getFilePath(Z);if(await Bun.file($).exists())await j4.promises.unlink($)}async invalidatePattern(Z){let $=Y4.join(this.cacheDir,"isr");if(!j4.existsSync($))return;let J=await j4.promises.readdir($);for(let Y of J){let Q=Y.replace(/_/g,"/").replace(".json","");if(Z.test(Q))await j4.promises.unlink(Y4.join($,Y))}}async needsRevalidation(Z){let $=await this.get(Z);if(!$)return!0;return Date.now()>$.revalidateAfter}}async function kq(Z){try{let J=(await Bun.file(Z).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(`
9273
+ `+X}{let g=/<script\s+server\b[^>]*>/gi,m,_0=[];while((m=g.exec(X))!==null){let Z0=m.index+m[0].length,G0=1,F0=Z0;while(F0<X.length&&G0>0){let v0=X.indexOf("<script",F0),x0=X.indexOf("</script>",F0);if(x0===-1)break;if(v0!==-1&&v0<x0)G0++,F0=v0+7;else{if(G0--,G0===0){let J1=x0+9;while(J1<X.length&&/\s/.test(X[J1]))J1++;_0.push({start:m.index,end:J1});break}F0=x0+9}}}for(let Z0=_0.length-1;Z0>=0;Z0--){let{start:G0,end:F0}=_0[Z0];X=X.substring(0,G0)+X.substring(F0)}}let P0=F5(X,J);if(P0.hasScoped)X=P0.html;let L0=Z.__stx_event_bindings||[],C=!1,v=[],x=/\s:[a-z][\w.-]*\s*=/.test(X),{scanScriptTags:l}=await Promise.resolve().then(() => (A7(),$8));for(let g of l(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))v.push({match:g.fullMatch,attrs:g.attrs,content:g.body});for(let{match:g,attrs:m,content:_0}of v){C=!0;let Z0=_0;l7(_0,J,Y.strict);let G0=await j5(_0,{eventBindings:L0,attrs:m,hasColonDirectives:x,templateContent:$,filePath:J,projectRoot:process.cwd(),production:Y.buildMode==="compile"});X=X.replace(g,()=>G0)}if(C)Z.__stx_event_bindings=[];return X}var c$=P(()=>{e5();D$();A3();I3();D3();b$();k$();v3();P$();d3();J$();a3();$9();J9();l0();n1();o0();q9();O9();A9();I9();e4();i$();b9();T1();C9();k4();V0();v9();g9();m9();p9();h$();A7();F8();A8();p7();c7();p7();c7()});import j0 from"fs";import Y0 from"path";import{matchRoute as Y_,Router as sY}from"stx-router";import{findErrorPage as Q_,formatRoutes as G_,generateRouteManifest as K_,generateRouteTypes as q_,matchRoute as __}from"stx-router";function E$($,Z={}){return new sY($,Z).routes}c$();$5();e5();import{abortNavigation as _H,clearMiddleware as xY,createClientCookieManager as UH,createMiddlewareContext as fY,createRouteLocation as gY,createServerCookieManager as WH,createStorageManager as zH,defineMiddleware as BH,getMiddleware as jH,getMiddlewareNames as hY,hasMiddleware as OH,loadMiddlewareFromDirectory as dY,navigateTo as HH,registerMiddleware as LH,runMiddleware as mY}from"stx-router";class uY{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=Y0.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 $=Y0.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 pY{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return Y0.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(Y0.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=Y0.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(Y0.join(Z,Y))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function gq($){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(`
8978
9274
  return (async function getStaticPaths() {
8979
9275
  ${Q[1]}
8980
9276
  })()
8981
- `)()}catch($){return console.error(`Error extracting static paths from ${Z}:`,$),null}}async function Sq(Z){let $=[];if(!Z.isDynamic)$.push({url:Z.pattern,params:{}});else{let J=await kq(Z.filePath);if(!J||J.paths.length===0)return console.warn(`Warning: Dynamic route ${Z.pattern} has no getStaticPaths or returned empty paths`),$;for(let Y of J.paths){let Q=Z.pattern;for(let[X,G]of Object.entries(Y.params))Q=Q.replace(`:${X}`,G).replace(`:${X}*`,G);$.push({url:Q,params:Y.params,props:Y.props,revalidate:Y.revalidate})}}return $}async function bq(Z){let $=[Z.replace(/\.stx$/,".data.ts"),Z.replace(/\.stx$/,".data.js"),Z+".data.ts",Z+".data.js"];for(let J of $)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 yq(Z,$,J){let Y=Z.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",`
9277
+ `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function hq($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let J=await gq($.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 dq($){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 mq($,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",`
8982
9278
  return (async function getStaticProps() {
8983
9279
  ${X[1]}
8984
9280
  })()
8985
- `)($)}catch(X){return console.error(`Error executing getStaticProps in ${J}:`,X),null}}async function x9(Z,$,J={},Y,Q){let X=await Bun.file(Z.filePath).text(),G=await bq(Z.filePath),K=await yq(X,$,Z.filePath),q={...G||{},...K||{},...J,params:$,$route:{path:Z.pattern,params:$}},U=new Set,_={...Q,debug:!1,cache:!1,autoShell:!0},W=await o4(X,q,Z.filePath,_,U);if(Object.keys($).length>0){let z=`<script>if(window.stx)window.stx._rp=${JSON.stringify($)};else window.__stx_rp=${JSON.stringify($)};</script>`;if(W.includes("</head>"))W=W.replace("</head>",`${z}
9281
+ `)(Z)}catch(X){return console.error(`Error executing getStaticProps in ${J}:`,X),null}}async function lY($,Z,J={},Y,Q){let X=await Bun.file($.filePath).text(),G=await dq($.filePath),K=await mq(X,Z,$.filePath),q={...G||{},...K||{},...J,params:Z,$route:{path:$.pattern,params:Z}},U=new Set,_={...Q,debug:!1,cache:!1,autoShell:!0},W=await r0(X,q,$.filePath,_,U);if(Object.keys(Z).length>0){let z=`<script>if(window.stx)window.stx._rp=${JSON.stringify(Z)};else window.__stx_rp=${JSON.stringify(Z)};</script>`;if(W.includes("</head>"))W=W.replace("</head>",`${z}
8986
9282
  </head>`);else W=`${z}
8987
- ${W}`}if(W=await L0(W),W=await Y7(W),Y.minify!==!1)return Cq(W);return W}function Cq(Z){let $=[],J=0,Y=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,Q;while((Q=Y.exec(Z))!==null){let G=Z.slice(J,Q.index);$.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=Q[1],q=Q[2],U=Q[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),$.push(K+q+U),J=Q.index+Q[0].length}let X=Z.slice(J);return $.push(X.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),$.join("").trim()}function Pq(Z){let $=0;for(let J=0;J<Z.length;J++){let Y=Z.charCodeAt(J);$=($<<5)-$+Y,$=$&$}return`"${Math.abs($).toString(36)}"`}function vq(Z,$){return`<?xml version="1.0" encoding="UTF-8"?>
9283
+ ${W}`}if(W=await F7(W),W=await Y5(W),Y.minify!==!1)return uq(W);return W}function uq($){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],U=Q[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+q+U),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 pq($){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 lq($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
8988
9284
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
8989
- ${Z.map((Y)=>{let Q=new URL(Y.loc,$).href,X=` <url>
8990
- <loc>${C4(Q)}</loc>`;if(Y.lastmod)X+=`
9285
+ ${$.map((Y)=>{let Q=new URL(Y.loc,Z).href,X=` <url>
9286
+ <loc>${C0(Q)}</loc>`;if(Y.lastmod)X+=`
8991
9287
  <lastmod>${Y.lastmod}</lastmod>`;if(Y.changefreq)X+=`
8992
9288
  <changefreq>${Y.changefreq}</changefreq>`;if(Y.priority!==void 0)X+=`
8993
9289
  <priority>${Y.priority}</priority>`;return X+=`
8994
9290
  </url>`,X}).join(`
8995
9291
  `)}
8996
- </urlset>`}function C4(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function xq(Z,$){let J=$.map((Y)=>{let Q=" <item>";if(Q+=`
8997
- <title>${C4(Y.title)}</title>`,Q+=`
8998
- <link>${C4(Y.link)}</link>`,Y.description)Q+=`
8999
- <description>${C4(Y.description)}</description>`;if(Y.pubDate)Q+=`
9292
+ </urlset>`}function C0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function cq($,Z){let J=Z.map((Y)=>{let Q=" <item>";if(Q+=`
9293
+ <title>${C0(Y.title)}</title>`,Q+=`
9294
+ <link>${C0(Y.link)}</link>`,Y.description)Q+=`
9295
+ <description>${C0(Y.description)}</description>`;if(Y.pubDate)Q+=`
9000
9296
  <pubDate>${Y.pubDate.toUTCString()}</pubDate>`;if(Y.author)Q+=`
9001
- <author>${C4(Y.author)}</author>`;if(Y.categories)for(let X of Y.categories)Q+=`
9002
- <category>${C4(X)}</category>`;if(Y.guid)Q+=`
9003
- <guid>${C4(Y.guid)}</guid>`;return Q+=`
9297
+ <author>${C0(Y.author)}</author>`;if(Y.categories)for(let X of Y.categories)Q+=`
9298
+ <category>${C0(X)}</category>`;if(Y.guid)Q+=`
9299
+ <guid>${C0(Y.guid)}</guid>`;return Q+=`
9004
9300
  </item>`,Q});return`<?xml version="1.0" encoding="UTF-8"?>
9005
9301
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
9006
9302
  <channel>
9007
- <title>${C4(Z.title)}</title>
9008
- <link>${C4(Z.link)}</link>
9009
- <description>${C4(Z.description)}</description>
9010
- ${Z.language?`<language>${Z.language}</language>`:""}
9011
- ${Z.copyright?`<copyright>${C4(Z.copyright)}</copyright>`:""}
9303
+ <title>${C0($.title)}</title>
9304
+ <link>${C0($.link)}</link>
9305
+ <description>${C0($.description)}</description>
9306
+ ${$.language?`<language>${$.language}</language>`:""}
9307
+ ${$.copyright?`<copyright>${C0($.copyright)}</copyright>`:""}
9012
9308
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
9013
- <atom:link href="${Z.link}/rss.xml" rel="self" type="application/rss+xml"/>
9309
+ <atom:link href="${$.link}/rss.xml" rel="self" type="application/rss+xml"/>
9014
9310
  ${J.join(`
9015
9311
  `)}
9016
9312
  </channel>
9017
- </rss>`}async function fq(Z={}){let $=Date.now(),J=await H5(),Y={pagesDir:Z.pagesDir||"pages",outputDir:Z.outputDir||"dist",baseUrl:Z.baseUrl||"/",domain:Z.domain||"http://localhost",revalidate:Z.revalidate??!1,sitemap:Z.sitemap??!0,rss:Z.rss??!1,concurrency:Z.concurrency||10,cache:Z.cache??!0,cacheDir:Z.cacheDir||".stx/ssg-cache",contentLoaders:Z.contentLoaders||[],hooks:Z.hooks||{},minify:Z.minify??!1,generate404:Z.generate404??!0,publicDir:Z.publicDir||"public",trailingSlash:Z.trailingSlash??!1,cleanOutput:Z.cleanOutput??!0},Q={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]};await Y.hooks.onBuildStart?.();try{if(Y.cleanOutput&&j4.existsSync(Y.outputDir))await j4.promises.rm(Y.outputDir,{recursive:!0});await j4.promises.mkdir(Y.outputDir,{recursive:!0});let X=new P9(Y.cacheDir);if(Y.cache)await X.load();try{let{preloadIconCollection:B}=await Promise.resolve().then(() => (NZ(),YY));await B("lucide")}catch{}try{let{generateCrosswindCSS:B}=await Promise.resolve().then(() => (e7(),H3));await B('<div class="bg-black"></div>')}catch{}D9();let G=J?.routeMiddleware?.dir||"middleware";await y9(process.cwd(),G);let K=b9();if(K.length>0)console.log(`Loaded ${K.length} middleware: ${K.join(", ")}`);let q=J?.routeMiddleware?.global||[],U=IZ(".",{pagesDir:Y.pagesDir});console.log(`Found ${U.length} routes`);let _=[];for(let B of U){let H=await Sq(B);for(let F of H)_.push({route:B,url:F.url,params:F.params,props:F.props,revalidate:F.revalidate??Y.revalidate})}Q.totalPages=_.length,console.log(`Generating ${Q.totalPages} pages...`);let W=[],z=[];for(let B=0;B<_.length;B+=Y.concurrency)z.push(_.slice(B,B+Y.concurrency));for(let B of z)await Promise.all(B.map(async(H)=>{let{route:F,url:L,params:O,props:V,revalidate:A}=H;try{await Y.hooks.onPageStart?.(L);let N=await Bun.file(F.filePath).text(),R=mq(N),w=R?.middleware?Array.isArray(R.middleware)?R.middleware:[R.middleware]:[],M=[...q,...w];if(M.length>0){let b=S9(L,O,R||{}),S=k9(b,null),k=await C9(M,S);if(k.redirect){let f=typeof k.redirect==="string"?k.redirect:k.redirect.path||k.redirect,h=uq(String(f),L),p=pq(L,Y);await j4.promises.mkdir(Y4.dirname(p),{recursive:!0}),await Bun.write(p,h),Q.successCount++,Q.pages.push({route:L,outputPath:p,size:Buffer.byteLength(h),cached:!1}),W.push({loc:L,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${L} \u2192 redirect to ${f}`);return}if(k.abort){let f=typeof k.abort==="string"?k.abort:k.abort?.error?.message||"aborted";console.warn(` \u21B3 ${L} \u2014 middleware aborted: ${f}`);return}}let E=N.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(E)try{if(!await Function("route",`
9313
+ </rss>`}async function iq($={}){let Z=Date.now(),J=await H1(),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 uY(Y.cacheDir);if(Y.cache)await X.load();try{let{preloadIconCollection:B}=await Promise.resolve().then(() => (R$(),U8));await B("lucide")}catch{}try{let{generateCrosswindCSS:B}=await Promise.resolve().then(() => (e5(),N3));await B('<div class="bg-black"></div>')}catch{}xY();let G=J?.routeMiddleware?.dir||"middleware";await dY(process.cwd(),G);let K=hY();if(K.length>0)console.log(`Loaded ${K.length} middleware: ${K.join(", ")}`);let q=J?.routeMiddleware?.global||[],U=E$(".",{pagesDir:Y.pagesDir});console.log(`Found ${U.length} routes`);let _=[];for(let B of U){let O=await hq(B);for(let F of O)_.push({route:B,url:F.url,params:F.params,props:F.props,revalidate:F.revalidate??Y.revalidate})}Q.totalPages=_.length,console.log(`Generating ${Q.totalPages} pages...`);let W=[],z=[];for(let B=0;B<_.length;B+=Y.concurrency)z.push(_.slice(B,B+Y.concurrency));for(let B of z)await Promise.all(B.map(async(O)=>{let{route:F,url:L,params:H,props:V,revalidate:R}=O;try{await Y.hooks.onPageStart?.(L);let N=await Bun.file(F.filePath).text(),A=rq(N),w=A?.middleware?Array.isArray(A.middleware)?A.middleware:[A.middleware]:[],M=[...q,...w];if(M.length>0){let b=gY(L,H,A||{}),S=fY(b,null),k=await mY(M,S);if(k.redirect){let f=typeof k.redirect==="string"?k.redirect:k.redirect.path||k.redirect,h=aq(String(f),L),p=tq(L,Y);await j0.promises.mkdir(Y0.dirname(p),{recursive:!0}),await Bun.write(p,h),Q.successCount++,Q.pages.push({route:L,outputPath:p,size:Buffer.byteLength(h),cached:!1}),W.push({loc:L,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${L} \u2192 redirect to ${f}`);return}if(k.abort){let f=typeof k.abort==="string"?k.abort:k.abort?.error?.message||"aborted";console.warn(` \u21B3 ${L} \u2014 middleware aborted: ${f}`);return}}let E=N.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(E)try{if(!await Function("route",`
9018
9314
  const validate = ${E[1]};
9019
9315
  return validate(route);
9020
- `)({params:O})){console.warn(`Validation failed for ${L}, skipping...`);return}}catch{}let T=null,I=!1;if(Y.cache){if(T=X.get(L,F.filePath,[]),T)I=!0,Q.cachedCount++}if(!T){if(T=await x9(F,O,V,Y,J),Y.cache)X.set(L,F.filePath,[],T)}let D;if(Y.trailingSlash)D=Y4.join(Y.outputDir,L,"index.html");else D=L==="/"?Y4.join(Y.outputDir,"index.html"):Y4.join(Y.outputDir,`${L}.html`);await j4.promises.mkdir(Y4.dirname(D),{recursive:!0}),await Bun.write(D,T),W.push({loc:L,lastmod:new Date().toISOString().split("T")[0],priority:L==="/"?1:0.8});let y={route:L,outputPath:D,size:Buffer.byteLength(T,"utf8"),cached:I};if(A!==!1)y.revalidateAt=Date.now()+A*1000;Q.pages.push(y),Q.successCount++,await Y.hooks.onPageEnd?.(L,T)}catch(N){Q.failedCount++,Q.errors.push({route:L,error:N}),await Y.hooks.onError?.(N,L),console.error(`Error generating ${L}:`,N)}}));if(Y.cache)await X.save();if(Y.generate404){let B=Y4.join(Y.pagesDir,"404.stx");if(await Bun.file(B).exists()){let H=new Set,F={...J,debug:!1,cache:!1},L=await o4(await Bun.file(B).text(),{},B,F,H);await Bun.write(Y4.join(Y.outputDir,"404.html"),L)}else await Bun.write(Y4.join(Y.outputDir,"404.html"),`<!DOCTYPE html>
9316
+ `)({params:H})){console.warn(`Validation failed for ${L}, skipping...`);return}}catch{}let T=null,I=!1;if(Y.cache){if(T=X.get(L,F.filePath,[]),T)I=!0,Q.cachedCount++}if(!T){if(T=await lY(F,H,V,Y,J),Y.cache)X.set(L,F.filePath,[],T)}let D;if(Y.trailingSlash)D=Y0.join(Y.outputDir,L,"index.html");else D=L==="/"?Y0.join(Y.outputDir,"index.html"):Y0.join(Y.outputDir,`${L}.html`);await j0.promises.mkdir(Y0.dirname(D),{recursive:!0}),await Bun.write(D,T),W.push({loc:L,lastmod:new Date().toISOString().split("T")[0],priority:L==="/"?1:0.8});let y={route:L,outputPath:D,size:Buffer.byteLength(T,"utf8"),cached:I};if(R!==!1)y.revalidateAt=Date.now()+R*1000;Q.pages.push(y),Q.successCount++,await Y.hooks.onPageEnd?.(L,T)}catch(N){Q.failedCount++,Q.errors.push({route:L,error:N}),await Y.hooks.onError?.(N,L),console.error(`Error generating ${L}:`,N)}}));if(Y.cache)await X.save();if(Y.generate404){let B=Y0.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(Y0.join(Y.outputDir,"404.html"),L)}else await Bun.write(Y0.join(Y.outputDir,"404.html"),`<!DOCTYPE html>
9021
9317
  <html lang="en">
9022
9318
  <head>
9023
9319
  <meta charset="UTF-8">
@@ -9038,24 +9334,24 @@ ${J.join(`
9038
9334
  <a href="/">Go home</a>
9039
9335
  </div>
9040
9336
  </body>
9041
- </html>`)}for(let B of[500]){let H=Y4.join(Y.pagesDir,`${B}.stx`);if(await Bun.file(H).exists()){let F=new Set,L={...J,debug:!1,cache:!1},O=await o4(await Bun.file(H).text(),{},H,L,F);await Bun.write(Y4.join(Y.outputDir,`${B}.html`),O)}}let j=Y4.join(Y.pagesDir,"error.stx");if(await Bun.file(j).exists()){let B=new Set,H={...J,debug:!1,cache:!1},F=await o4(await Bun.file(j).text(),{},j,H,B);await Bun.write(Y4.join(Y.outputDir,"error.html"),F)}if(Y.sitemap&&W.length>0){let B=vq(W,Y.domain),H=Y4.join(Y.outputDir,"sitemap.xml");await Bun.write(H,B),Q.sitemapPath=H,console.log(`Generated sitemap.xml with ${W.length} URLs`)}if(Y.rss){let B=typeof Y.rss==="object"?Y.rss:{title:"Site Feed",description:"Latest updates",link:Y.domain},H=[];if(B.getItems)H=await B.getItems();let F=xq(B,H),L=Y4.join(Y.outputDir,"rss.xml");await Bun.write(L,F),Q.rssPath=L,console.log(`Generated rss.xml with ${H.length} items`)}if(Y.publicDir&&j4.existsSync(Y.publicDir))await f9(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()-$,await Y.hooks.onBuildEnd?.(Q),console.log(`
9337
+ </html>`)}for(let B of[500]){let O=Y0.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(Y0.join(Y.outputDir,`${B}.html`),H)}}let j=Y0.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(Y0.join(Y.outputDir,"error.html"),F)}if(Y.sitemap&&W.length>0){let B=lq(W,Y.domain),O=Y0.join(Y.outputDir,"sitemap.xml");await Bun.write(O,B),Q.sitemapPath=O,console.log(`Generated sitemap.xml with ${W.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=cq(B,O),L=Y0.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 cY(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(`
9042
9338
  Build complete!
9043
9339
  Total: ${Q.totalPages} pages
9044
9340
  Success: ${Q.successCount}
9045
9341
  Cached: ${Q.cachedCount}
9046
9342
  Failed: ${Q.failedCount}
9047
9343
  Time: ${Q.buildTime}ms
9048
- `),Q}async function f9(Z,$){let J=await j4.promises.readdir(Z,{withFileTypes:!0});for(let Y of J){let Q=Y4.join(Z,Y.name),X=Y4.join($,Y.name);if(Y.isDirectory())await j4.promises.mkdir(X,{recursive:!0}),await f9(Q,X);else await j4.promises.copyFile(Q,X)}}function gq(Z={}){let $=Z.cacheDir||".stx/ssg-cache",J=new v9($),Y=Z.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=IZ(".",{pagesDir:Z.pagesDir||"pages"}).find((W)=>{return Q.match(W.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((W,z)=>{q[W]=K[z+1]});let U=await H5(),_=await x9(G,q,{},Z,U);await J.set(Q,{html:_,generatedAt:Date.now(),revalidateAfter:Date.now()+Y*1000,etag:Pq(_)}),console.log(`Revalidated: ${Q}`)},async invalidate(Q){if(typeof Q==="string")await J.invalidate(Q);else await J.invalidatePattern(Q)}}}function hq(Z){return async()=>{return{paths:await Z(),fallback:!1}}}function dq(){return{name:"markdown",extensions:[".md",".mdx"],async load(Z){let $=await Bun.file(Z).text(),J=$.match(/^---\n([\s\S]*?)\n---/),Y={},Q=$;if(J){let U=J[1];Q=$.slice(J[0].length).trim();for(let _ of U.split(`
9049
- `)){let W=_.indexOf(":");if(W>0){let z=_.slice(0,W).trim(),j=_.slice(W+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[z]=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 U=parseInt(q[1],10),_=q[2],W=_.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:W,text:_,level:U})}return{content:X,data:Y,toc:G}}}}function mq(Z){let $=Z.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!$)return null;try{return Function(`return ${$[1]}`)()}catch{return null}}function uq(Z,$){return`<!DOCTYPE html>
9344
+ `),Q}async function cY($,Z){let J=await j0.promises.readdir($,{withFileTypes:!0});for(let Y of J){let Q=Y0.join($,Y.name),X=Y0.join(Z,Y.name);if(Y.isDirectory())await j0.promises.mkdir(X,{recursive:!0}),await cY(Q,X);else await j0.promises.copyFile(Q,X)}}function nq($={}){let Z=$.cacheDir||".stx/ssg-cache",J=new pY(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=E$(".",{pagesDir:$.pagesDir||"pages"}).find((W)=>{return Q.match(W.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((W,z)=>{q[W]=K[z+1]});let U=await H1(),_=await lY(G,q,{},$,U);await J.set(Q,{html:_,generatedAt:Date.now(),revalidateAfter:Date.now()+Y*1000,etag:pq(_)}),console.log(`Revalidated: ${Q}`)},async invalidate(Q){if(typeof Q==="string")await J.invalidate(Q);else await J.invalidatePattern(Q)}}}function oq($){return async()=>{return{paths:await $(),fallback:!1}}}function sq(){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 U=J[1];Q=Z.slice(J[0].length).trim();for(let _ of U.split(`
9345
+ `)){let W=_.indexOf(":");if(W>0){let z=_.slice(0,W).trim(),j=_.slice(W+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[z]=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 U=parseInt(q[1],10),_=q[2],W=_.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:W,text:_,level:U})}return{content:X,data:Y,toc:G}}}}function rq($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function aq($,Z){return`<!DOCTYPE html>
9050
9346
  <html>
9051
9347
  <head>
9052
9348
  <meta charset="utf-8">
9053
- <meta http-equiv="refresh" content="0; url=${Z}">
9054
- <link rel="canonical" href="${Z}">
9349
+ <meta http-equiv="refresh" content="0; url=${$}">
9350
+ <link rel="canonical" href="${$}">
9055
9351
  <title>Redirecting...</title>
9056
9352
  </head>
9057
9353
  <body>
9058
- <p>Redirecting to <a href="${Z}">${Z}</a>...</p>
9059
- <script>window.location.replace('${Z}')</script>
9354
+ <p>Redirecting to <a href="${$}">${$}</a>...</p>
9355
+ <script>window.location.replace('${$}')</script>
9060
9356
  </body>
9061
- </html>`}function pq(Z,$){if(Z==="/"||Z==="")return Y4.join($.outputDir,"index.html");let J=Z.replace(/^\/|\/$/g,"");if($.trailingSlash)return Y4.join($.outputDir,J,"index.html");return Y4.join($.outputDir,`${J}.html`)}var UO={generateStaticSite:fq,createISRHandler:gq,defineStaticPaths:hq,createMarkdownLoader:dq};export{fq as generateStaticSite,hq as defineStaticPaths,UO as default,dq as createMarkdownLoader,gq as createISRHandler};
9357
+ </html>`}function tq($,Z){if($==="/"||$==="")return Y0.join(Z.outputDir,"index.html");let J=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return Y0.join(Z.outputDir,J,"index.html");return Y0.join(Z.outputDir,`${J}.html`)}var MH={generateStaticSite:iq,createISRHandler:nq,defineStaticPaths:oq,createMarkdownLoader:sq};export{iq as generateStaticSite,oq as defineStaticPaths,MH as default,sq as createMarkdownLoader,nq as createISRHandler};